Developer forum

Forum » Ecommerce - Standard features » Discount matrix vs. Sales discount

Discount matrix vs. Sales discount

Thomas Larsen
Reply

In a new custom solution I need the possibility to do the following things.

  • Create custom discount providers
  • Show the discount orderline(s), connected to the product orderline
  • Show a products relation to different discounts on the product detail page

 

Discount Matrix

  • It’s possible to link a discount line to an orderline
  • But it’s not possible to create custom discounts providers
  • Is it possible to show "related" discounts on a product?

 

Sales discount

  • It’s possible to create custom discount providers
  • But it’s not possible to link a discount line to an orderline
  • Is it possible to show "related" discounts on a product?

 

Is it possible to create an solution, in discount matrix or sales discount,  that covers all this?


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Thomas

The 2 discount systems have different engines for finding and calculating the discounts, different data structure and user interface, but they apply the discount to the order instance in the same way.

So, you can use a DiscountProvider to calculate the discounts using your own ruleset.

But be aware that there are order discounts (they are applied to the order, hence the name) and orderline discounts (they are applied to the orderline). So if you have a discount rule for product X of 10%, you will add that as an orderline discount. If your discount has a rule that if the order has a total of more than 1000 it makes no sense to connect the discount to the orderline, but the order it self - using an order discount.

When you apply the discount to the orderline, make sure you set the orderline type correctly according to the wanted behavior. You can set a discount to an orderline discount like this:

orderLine.SetOrderLineType(Orders.OrderLine.OrderLineType.ProductDiscount)

BR Nicolai

   
Thomas Larsen
Reply

Hi Nicolai,

Thanks for your quick reply, I think the sales discount is the solution here.

But one question regarding, publishing discount information on the product detail template. I have discovered a ProductDiscounts loop: http://templates.dynamicweb.com/eCommerce/Dynamicweb-eCommerce-template-tags/Product-Catalog/Product-detail/Loops/ProductDiscounts.aspx

But not all product discount is visible in this. Product discount is visible, but not Product quantity discount?

I know that there can be some challenges, calculation the discount amount, before the product hits the cart. But it would be nice to have some information regarding Products discounts available in that loop (Discount Name, discount pct. or amount, and other discount provider specific properties ). Is that possible?

And what determines if the discount is available in that loop, when creating custom discount providers?

/Thomas

 
Vladimir
Reply

Hi Thomas,

yes you right, this is a challenge... 

However in DW 8.6 was introduced a new loop - "AllDiscounts" (http://developer.dynamicweb.com/releases/dynamicweb-8-6.aspx)

It renders all active discount(and custom too). Hope this helps!

 

Best regards,

Vladimir

 
Nicolai Høeg Pedersen
Reply

Hi Thomas

Vladimir mentions the new loop which will help you - it shows all discounts, no matter what.

The ProductDiscounts loop contains discounts that are valid in the current context. Product quantity discount is an order discount, not a product discount. So if you add the product to the cart enough times, it will also appear in th ProductDiscounts loop.

Also not, that you can control quantity prices on the price matrix. Those prices are available on the product detail.

1: 2 EUR

2: 1.9 EUR /each

etc.

Nicolai

 
Thomas Larsen
Reply

Hi Vladimir and Nicolai,

Thanks for the info, just what I needed

 
Niels Tang Sørensen
Reply

Hi Nicolai,

I have been trying to get the quantity prices on the product detail but I can't seem to get it to work. I've tried something along the lines of:

 <!--@LoopStart(Product.Prices)-->
 <!--@Ecom:Product:Prices.Price-->
 <!--@LoopEnd(Product.Prices)-->

The loop seems to run but I can't get the values. Running version   8.3.1.14

Thanks,
Niels

 
Nicolai Høeg Pedersen
Reply

Hi Niels

Inside the loop of Product.Prices, you are using the wrong tags.

Try i.e. Ecom:Product.Prices.Amount. Use the DwTemplateTags tag to output your options inside that loop:

 <!--@LoopStart(Product.Prices)-->
 <!--@DwTemplateTags-->

 <!--@LoopEnd(Product.Prices)-->

 
Niels Tang Sørensen
Reply

Great - it works. Thanks a lot!

 
Mikkel Toustrup Olsen
Reply

Hi Nicolai,

I am currently working a bug related to a SalesDiscountProvider where I'm retrieving price data, discounts etc from an ERP - everything looks fine in the debug process of the ProcessOrder() method I'm overriding.. I can see the amount of correct orderlines being added to the order object on the first call (along with the discount). However, when this has been run the first time, DW calls it multiple times afterwards (seems a bit "random" in my case if its 3 times or 5 times after the initial call where all the info where correct) .. When it's being call afterwards, the orderline I added with the discount is no longer on the order object .

Running 8.7.2.8 (I have no Sales Discount option in Management Center -> Ecommerce - Product Catalog btw, only "Order Discounts" .

BR Mikkel TO

 

You must be logged in to post in the forum