Search code examples
tagscompareliquidbusiness-catalyst

Compare tag_totalretailprice with tag_discountprice Business Catalyst


I am wondering what am I doing wrong since it keeps rendering: "no price"

here is the code:

{% if tag_totalretailprice <= tag_discountprice -%}
    <div class="sale">{tag_totalretailprice}</div>
{% else -%}
    <p>no price</p>
{% endif -%}

If this helps: I am using tag_totalretailprice as the normal market price and I want it to show it(crossed, using CSS class="sale") if the value I put in is higher than the tag_discountprice, if not, anything will be displayed.

Can anyone help me with this please?=


Solution

  • If you change the tag_totalretailprice and tag_discountprice to use liquid also like this:

    {% if this.totalRetailPrice <= this.totalDiscountPrice -%}
            <div class="sale">{tag_totalretailprice}</div>
        {% else -%}
            <p>no price</p>
        {% endif -%}
    

    I believe you will get the desired result - at the moment the if statement never returns true which is why your else statement is always displayed.