Quote:
Originally Posted by MAPerformance
I am using a {if} {else} statement to show or hide a Free Shipping graphic on certain items on our shop.
Code:
{if $product.price >= 99.99 && $product.productid ne 20786 && $product.productid ne 17302}
<img src="image.jpg" />
{else}
<img src="_spacer.gif"/>
{/if}
This shows my free shipping graphic on items that are $99.99 or more, and shows a blank spacer image if it's less. The problem is I have a handful of items that don't qualify for free shipping even though they are over $99.99. You can see what I did do in the code there to account for those items, but I'm wondering of there's a shorter way of declaring the $productid of these exception items other than what I've already done?
Also, maybe this can be used as a reference for someone else looking to do this
|
You may want to check this condition in PHP code (in_array() function will be useful) and then assign result to a boolean flag in $product array. It will allow you to check the same condition as something like this in Smarty:
HTML Code:
{if $product.my_free_shipping_flag eq 'Y'}
<img src="image.jpg" />
{else}
<img src="_spacer.gif"/>
{/if}
Guess, it looks more elegant.