Administrator
- Join Date:
- Sep 2009
- Location:
- Stuart, FL
- Posts:
- 14,127
- Plugin Contributions:
- 56
Attribute discount when product discount: Database hits
I'm working on an update to my site that involves a product with a gazillion attributes (i.e. more than 50). For a single product to be added to the cart, upwards of **4000 **database hits were registered.
Fussing around in admin, I found the "attribute is discounted when product is discounted". Turning that off resulted in less than **400 **hits.
The hits are centered on the shopping_cart class's 'calculate' function which is called whenever the cart's weight or current price is needed.
Just a heads-up.
P.S. If the shopping cart class did a calculate whenever the cart was changed, saving the current price and weight in a variable, and then just returned the variable when the weight/price was requested it would be a big savings!