Developer forum

Forum » Templates » Cart: a tag for orderline discount (true-false)?

Cart: a tag for orderline discount (true-false)?

Jens Jakob Kristensen
Jens Jakob Kristensen
Reply

Hi,

Is there a tag for each orderline we can use to ccheck if there is a discount applied to this orderline or not?

Something like "Orderline.HasDiscount" = true/false

Or maybe an orderline tag that only renders a value, or a value different from  0, if a discount applies to the orderline. 

Our goal:

We need to show some small product information in each orderline, which has a discount applied to it. 

The product information should not be rendered in those orderlines, where no discount is applied.


Replies

 
Nicolai Pedersen
Reply

You can look at the OrderLine.TotalDiscount property 

http://doc.dynamicweb-cms.com/api/html/cb6b8e95-57a3-9f9d-6854-4b25e777e7ab.htm

Also there are tags you can use:

http://doc.dynamicweb.com/template-tags/ecommerce/shopping-cart/receipt/orderlines

 
Jens Jakob Kristensen
Jens Jakob Kristensen
Reply

Hi Nicolai,

I guess what we need is a specific orderline tag for a product orderline (not a discount-orderline) that renders true/false if a discount is applied to this particular product orderline.

I don't see that tag in the list?

Example:

Two different products are added to the cart.

Product 1 has a discount applied to it, and product 2 has no discounts applied to it. This will result in three orderlines:

  • Orderline for Product 1
  • Orderline for discount for product 1
  • Orderline for Product 2

On Product 2 we wish to display a certain info-text or product info. But this text should only be shown on product orderlines that do not have a discount. 

For that to work we need to check if the particular orderline has a discount or not.

Does it make sense?

 

   
Jens Jakob Kristensen
Jens Jakob Kristensen
Reply

Perhaps that does the trick? Just to make sure I understand this correctly:

We say that both Product 1 and Product 2 has a price of 100,- a piece, and there is a 50% discount active for product 1.

Customer adds 2 x Product 1 and 2 x Product 2 in the cart. The orderlines will be:

  1. Orderline for Product 1 (amount = 100,-)
  2. Orderline for discount for Product 1 (amount = 100,-)
  3. Orderline for Product 2 (amount = 200,-)

The tag you mention above does this:

"Returns the total price of the orderline - without currency symbol."

Wouldn't that just render the amount stated above (100,- for Orderline 1)? Or am I misunderstanding the output from this tag?

Because then we would have to compare values in different tags to see if one number is higher than the other, and then conclude that there is a discount.

But that just seem like a lot of unnecessary template logic to conclude a true/false for an orderline.

Or maybe I just misunderstand the whole thing regarding the tag mentioned above :-)

 

 

 
Nicolai Pedersen
Reply

You have another tag with the price without discount - so if they are different, there is a discount. You are welcome to try it in a template - maybe use loopItem.TemplateTags() in the orderlines loop to see what values it provides.

 

You must be logged in to post in the forum