Sasha Ue Chirico Sasha Ue Chirico - 1 month ago 5
Smarty Question

Why smarty greater than function doesn't work?

I have tried to insert the following code to alternate the CSS style from my Add to Cart button on my online store, so when the product are 0 that need to display "Order" instead product are greater than 1 that need to display "Add to Cart", but the class .hideen (with the greater than >= ) doesn't work instead the other one yes..

{if $product->quantity <= 0}
<style type="text/css">
{literal}
.hideeen {display:none;}
{/literal}
</style>
{/if}
{if $product->quantity >= 1}
<style type="text/css">
{literal}
.hideen {display:none;}
{/literal}
</style>
{/if}


There can you see where the HTML where will be applied:

<button type="submit" name="Submit" class="exclusive">
<span class="btn">
{if $content_only && (isset($product->customization_required) && $product->customization_required)}<em>{l s='Customize'}</em>{else}<em class="hideeen">{l s='Add to cart'}</em>{/if}<em class"hideen">{l s='order'}</em>
</span>
</button>

Answer

On the HTML miss the = there <em class"hideen">{l s='order'}</em>

Comments