Developer forum

Forum » Ecommerce - Standard features » If/else with product discount

If/else with product discount

Kim Rasmussen
Reply

Hi,

How can you test if a product has a discount, and change the look and feel accordingly?

We have tried with:

 <!--@If (@Ecom:Product.Discount.TotalAmountWithVAT<=0)-->
                      
                        <span class="regular-price" id="product-price-169">
                            <span class="price"><!--@Ecom:Product.Price--></span>                
                        </span>
 <!--@EndIf-->

And, for a product with a discount: 

 <!--@If (@Ecom:Product.Discount.TotalAmountWithVAT>0)-->
                      
  <span class="regular-price" id="product-price-169">
                                <span class="price" style="text-decoration:line-through;"><!--@Ecom:Product.Price--></span> 
                                <span class="price"><br />Tilbudspris: <!--@Ecom:Product.Discount.Price--></span>               
                            </span>

 <!--@EndIf-->


But it seems the operators >,<,=,== and so on is not working!

Please help!

 


Replies

 
Merethe Nielsen
Reply
This post has been marked as an answer

Hi

You can use the tag Ecom:Product.HaveDiscount.

 

Check the example in the template manual:
http://templates.dynamicweb-cms.com/eCommerce/Dynamicweb-eCommerce-template-tags/Product-Catalog/Product-detail/EcomProduct.HaveDiscount.aspx

 

With this you are able to change font, add a discount sign or what you like, when a product has a discount.

Hope that this is what you need.

 

Kind regards,
Merethe

Votes for this answer: 1
 
Kim Rasmussen
Reply
Thanks!

 

You must be logged in to post in the forum