0

I'm having dreadful performance with Commerce Kickstart 2. Trying to troubleshoot.

I noticed that when viewing any Product in the catalog, the Rules Evaluation log looks like the log below.

Questions: 1. Why is the event Calculating the sell price of a product firing multiple times?

  1. Why is the rule "Apply a discount to a given order" firing? The product I'm viewing has nothing to do with the reaction rule or the cart?

This adding a lot of unneeded overhead, right? How do I stop it?

0 ms Reacting on event Calculating the sell price of a product. 7.329 ms Evaluating conditions of rule Unset the price of disabled products in the cart. [edit] 7.698 ms The condition data_is_empty evaluated to FALSE [edit] 7.903 ms The condition entity_has_field evaluated to TRUE [edit] 8.669 ms The condition data_is evaluated to FALSE [edit] 8.676 ms AND evaluated to FALSE. 8.694 ms Finished reacting on event Calculating the sell price of a product.

0 ms Reacting on event Apply a discount to a given order.
0.256 ms Evaluating conditions of rule 10% Of AH-10. [edit]
0.854 ms The condition commerce_order_contains_products evaluated to FALSE [edit]
0.862 ms AND evaluated to FALSE.
0.876 ms Finished reacting on event Apply a discount to a given order.
0 ms Reacting on event Calculating the sell price of a product.
0.164 ms Evaluating conditions of rule Unset the price of disabled products in the cart. [edit]
0.317 ms The condition data_is_empty evaluated to TRUE [edit]
0.324 ms AND evaluated to FALSE.
0.336 ms Finished reacting on event Calculating the sell price of a product.
0 ms Reacting on event Calculating the sell price of a product.
0.376 ms Evaluating conditions of rule Unset the price of disabled products in the cart. [edit]
0.656 ms The condition data_is_empty evaluated to TRUE [edit]
0.673 ms AND evaluated to FALSE.
0.7 ms Finished reacting on event Calculating the sell price of a product.
0 ms Reacting on event Calculating the sell price of a product.
0.223 ms Evaluating conditions of rule Unset the price of disabled products in the cart. [edit]
0.407 ms The condition data_is_empty evaluated to TRUE [edit]
0.42 ms AND evaluated to FALSE.
0.439 ms Finished reacting on event Calculating the sell price of a product.
0 ms Reacting on event Calculating the sell price of a product.
0.221 ms Evaluating conditions of rule Unset the price of disabled products in the cart. [edit]
0.384 ms The condition data_is_empty evaluated to TRUE [edit]
0.393 ms AND evaluated to FALSE.
0.418 ms Finished reacting on event Calculating the sell price of a product.

0 ms Reacting on event Calculating the sell price of a product.
0.398 ms Evaluating conditions of rule Unset the price of disabled products in the cart. [edit]
0.67 ms The condition data_is_empty evaluated to TRUE [edit]
0.687 ms AND evaluated to FALSE.
0.714 ms Finished reacting on event Calculating the sell price of a product.

0

This is because the price is calculated during preparation for display where the field is rendered on the page, for the Add to Cart form to determine product availability, and for recalculation of any instance of that product in your cart. I believe we tried caching calculated prices in the product entity at one point in time to avoid duplicate calculation, but that obviously didn't stick. I don't have a solid recommendation here, just wanted to provide the info requested. Also, note that cart price refreshing is adjustable but is intended to happen in realtime with the full cart context. I'd think you could safely find a way to eliminate the duplicate calculation between the price field and cart form, but you'd want to do it without interfering with the cart refresh.

  • You wrote "Also, note that cart price refreshing is adjustable." Can you point me to where I can make these adjustments? Are you talking about the rule itself or somewhere else? Please be as specific as you can; obviously, I need all the help I can get. TIA. – jchwebdev Dec 8 '14 at 1:36
  • There are a few options in the Admin > Store > Configuration > Order settings form. Let me know if the descriptions for any of them are confusing; happy to improve the UI. : ) – Ryan Szrama Dec 11 '14 at 11:41
  • So I went to Admin > Store > Configuration > Order settings and I may be too old for earth but I don't see -anything- that indicates that the pricing rules will fire every time a product is displayed. So if you have a collection page with 30 products, you get 30 triggers of Calculate the sell price -and- Calculate sales tax X the # of Sales Tax Jurisdictions. This starts to add some -real- overhead. We don't -need- to calculate sales tax on any page until checkout. 1. Can we turn off Sales Tax Calc? 2. We only use MSRP. Can we turn off the Calc Sell Price and just use Unit Price? – jchwebdev Dec 11 '14 at 18:53
  • I'd add a condition to the default Sales Tax rule that checked for a non empty line item ID. When calculating the price of products on the page, it will be on a line item with no ID. – Ryan Szrama Dec 15 '14 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.