Search the Community
Showing results for tags 'conditional statement'.
-
I have been told to add <?php if ( isset( $product->currency ) ) : ?> into the below code to check if the "currency" field has been set. If it hasn't been set (ie left empty) then I want to show the Aussie dollaras default <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Australia.jpg" /> $AUD I've tried putting it in different places and all I get is a blank page. I think there might need to be an "else" somewhere so i put in all sorts of different elseif's and still ended up with a blank page. I am wondering if anybody could put me on the right track please. Thanks Rowan <?php if ($product->saleprice > 0 && $product->saleprice < $product->price) { ?> <div class="prc"> <small> On Sale: <span style="font-weight: bold; color:red;"><?php if ($product->currency == 'USD') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_the_United_States.jpg" /> $USD <?php elseif ($product->currency == 'USD$') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_the_United_States.jpg" /> $USD <?php elseif ($product->currency == 'GBP') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_the_United_Kingdom.jpg" /> £ <?php elseif ($product->currency == '£') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_the_United_Kingdom.jpg" /> £ <?php elseif ($product->currency == 'AUD') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Australia.jpg" /> $AUD <?php elseif ($product->currency == 'AUD$') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Australia.jpg" /> $AUD <?php elseif ($product->currency == 'CDN$') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Canada.jpg" /> $CDN <?php elseif ($product->currency == 'RM') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Malaysia.jpg" /> <?php elseif ($product->currency == 'CDN') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Canada.jpg" /> $CDN <?php elseif ($product->currency == 'NZD') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_New_Zealand.jpg" /> $NZD <?php elseif ($product->currency == 'NZD$') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_New_Zealand.jpg" /> $NZD <?php endif; ?> [product.saleprice]</span> </small> </div> <?php } else { ?> <div class="prc"> <small> <?php if ($product->currency == 'USD') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_the_United_States.jpg" /> $USD <?php elseif ($product->currency == 'USD$') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_the_United_States.jpg" /> $USD <?php elseif ($product->currency == 'GBP') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_the_United_Kingdom.jpg" /> £ <?php elseif ($product->currency == '£') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_the_United_Kingdom.jpg" /> £ <?php elseif ($product->currency == 'AUD') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Australia.jpg" /> $AUD <?php elseif ($product->currency == 'AUD$') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Australia.jpg" /> $AUD <?php elseif ($product->currency == 'CDN$') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Canada.jpg" /> $CDN <?php elseif ($product->currency == 'RM') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Malaysia.jpg" /> <?php elseif ($product->currency == 'CDN') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_Canada.jpg" /> $CDN <?php elseif ($product->currency == 'NZD') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_New_Zealand.jpg" /> $NZD <?php elseif ($product->currency == 'NZD$') : ?> <img src="http://aussietaste.recipes/wp-content/uploads/flags/Flag_of_New_Zealand.jpg" /> $NZD <?php endif; ?> [product.price] </small> </div> <?php } ?>