Developer forum

Forum » Ecommerce - Standard features » Order discount, products discount and performance

Order discount, products discount and performance

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Guys,

I am experiencing a pretty disturbing decrease in performance of the cart (basically of the add to cart) functionality as the content of the cart increases.

I have made some tests and it looks like the cart page loads slower as new products are added.
I was wondering about the impact of the Sales discounts and Order discounts on the cart performance. I would assume it takes some effort to recalculate the cart after each item is added.

Also, I am interested if the inactive discounts can also have an impact on the performance

Can anyone care to comment on this? 

Thanks,

Adrian


Replies

 
Nicolai Pedersen
Reply

Hi Adrian

You do not provide much information... First of all, iss this live integrated - with prices from external system? And/or do you have many discounts or discounts with many products/rules? Or any custom code in price/discount calculation.

We would have to take a look at the actual implementation to say something clever or to debug the performance. Start by adding ?debug=true and see if something nasty shows up. Then you can also add a profiler to the solution and see if you find something that needs attention.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

I agree it was more like a question to myself :)

The answers is all of the above. We have a price provider but it's querying prices from a local table and it's pretty fast.

What I am worried about is the segmentation level of the discounts. They have multiple discounts set to different user groups and different product groups.

I tried a quick debug with Lars last week but we have not noticed anything standing out. We have noticed a considerable delay between some of the requests, something more related to order contexts than to sales discounts.

We have even removed the template completely from the Cart module just to make sure it does not add to the delay. We are actually adding to cart with a standard Ajax call.

I guess profiling it would make more sense.

Thank you very much for taking the time to answer.

Adrian

 
Nicolai Pedersen
Reply

I know the feeling :-).

If you find anything, let us know and we will take a look at it.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

I have made some tests and I can now confirm that the number of Order discounts affects the performance of the add to cart method as the number of orderlines increase. It is noticeable from more than 10 orderlines.

I agree that my situation is out of the ordinary since my customer has defined 160+ Order discounts. The reason for that is that they need to add 4 discount levels for different discount codes (the ones that can be applied multiple times).

Now, I know that this does not have a quick solution. For the future, it would be useful to add an option to the voucher list, to allow the codes to be applied more than once. If this is something I can do on my own, I would be happy to do it if you point me in the right direction.

Until then, the only solution I could find was to create a Sales Discount that will allow for multiple codes and move the discounts over.

The second problem I have is the way the discount applies. The sales Discount provider does not have a way to exclude products from the discount, therefore I need to rely on the Lowest/Aggregates/Highest setting.

So far it seems to work correctly but I feel the need to display some information to the user after the Sales discount engide makes the discount decision.

More precisely, if I have a Product discount that generates a 10 lei on the entire order and an Order discount based on a discount code that generates a value of 8 lei on the entire order, the code will be accepted but the information about the discount will not be shown, the customer will not know what happened with the code discount.

To solve this, it would be helpful to find out if there are more discounts eligible for the current order so I can display a message. Something along the lines of "This order triggered x discounts, we have applied the combination that generates the highest total discount on the order". Do you think this is possible already?

Thanks,

Adrian

 
Nicolai Pedersen
Reply

Hi Adrian

To answer your last question: No, that is not possible.

I'll have the number of discounts on an order and created in the system investigated to see if there is a performance issue we need to address - not as a quickfix, but during the next SR cycle.

Your setup is a little too complicated for me to fully understand and provide valuable input on - that would require a hands-on session to understand. We can do that the days around the Summit.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Understood. I agree it is complicated and unusual.

A hands-on session around the Summit sounds great. We might need to fix it before then but I can keep it on the dev site for reference.

Thank you,

Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

I have managed to temporarily solve my problem but during the tests I've made, I have found another weird (from my logic) behavior of the product discounts.

Consider the following scenario:

Discount 1: Sales discount, 3% applicable to a specific product or product group, let's assume Product1 with a price of 10 EUR

Discount 2: Sales discount, 5% applicable to another specific product or another product group, let's assume Product2 with a price of 10 EUR

Discount 3: Sales discount, 2% applicable to Product2 with a price of 10 EUR.

(the absolute values of the discount are irrelevant)

The Setting of the Sales Discount is to use the Highest value and also include Product Discount in the logic.

My expectation would be that the system will make the decision for each orderline (since these are product discounts) and apply the highest value.

In the above case, it means it should apply Discount 1 to Product 1 (0.3 EUR) and Discount 2 to Product2 (0.5 EUR).

What actually happens is the system first calculates the value resulted form each application and then decides what discount to apply, and applies ONLY that discount.

Which means that the only discount will be Discount 2, applicable just to Product 2 (0.5 EUR).

I tried to uncheck the "Include Product discounts" option and the result was Discount 1 to Product1 (0.3 EUR), Discount 2 to Product2 (0.5 EUR), Discount 3 to Product2 (0.2 EUR).

The logic after the uncheck seems to be fine,. I have not chosen to aggregate the discounts, therefor all aplies. But the logic with the checked option seems to be the same as for Order discounts ignorign the fact that the discounts are Product Discounts.

I am using 8.9.2.5 but the same behavior is found in 8.8.1.32

Please let me know your thoughts.

Thank you,

Adrian

 

You must be logged in to post in the forum