5

When adding a product to the basket, where exactly is the price that appears in the quote for each item calculated? (base, special, tier...)

My issue is this:

  • I have a simple product with a tier price with it (qty: 1 and above, customer group: special)
  • when I add the product to the basket, the base price is being added instead (the tier price is ignored) (customer is in the correct customer group)

BUT - I use 2 environments - dev and staging

  • on my dev machine, all is working fine - product is added with the tier price - all fine it the quote (sales_flat_quote_item)
  • on staging (where I have no access to the database), the base price is used

I am wondering if I missed any setting but can't think of any.

So my question is: wherein the code is the best place to see/check how the quoted price is being calculated when adding new candidates to quote?

using CE 1.7.0.0

  • Is your tier price lower as a regular price? – user487772 Feb 8 '13 at 12:57
4

RESOLVED

all right, after some code digging..

Looks like the whole process is done later when saving the basket on collectTotals:

  • $cart->save() (where $cart = Mage::helper('checkout/cart')->getCart();)
  • quote - collectTotals()
  • product - getFinalPrice()

See debug trace below:

[0] => Mage_Catalog_Model_Product_Type_Price::getTierPrice() : app\code\community\Mage\Catalog\Model\Product.php (653)
[1] => Mage_Catalog_Model_Product::getTierPrice() : app\code\core\Mage\Catalog\Model\Product\Type\Price.php (164)
[2] => Mage_Catalog_Model_Product_Type_Price::_applyTierPrice() : app\code\core\Mage\Catalog\Model\Product\Type\Price.php (61)
[3] => Mage_Catalog_Model_Product_Type_Price::getBasePrice() : app\code\core\Mage\Catalog\Model\Product\Type\Price.php (80)
[4] => Mage_Catalog_Model_Product_Type_Price::getFinalPrice() : app\code\community\Mage\Catalog\Model\Product.php (715)
[5] => Mage_Catalog_Model_Product::getFinalPrice() : app\code\core\Mage\Sales\Model\Quote\Address\Total\Subtotal.php (115)
[6] => Mage_Sales_Model_Quote_Address_Total_Subtotal::_initItem() : app\code\core\Mage\Sales\Model\Quote\Address\Total\Subtotal.php (48)
[7] => Mage_Sales_Model_Quote_Address_Total_Subtotal::collect() : app\code\core\Mage\Sales\Model\Quote\Address.php (957)
[8] => Mage_Sales_Model_Quote_Address::collectTotals() : app\code\core\Mage\Sales\Model\Quote.php (1263)
[9] => Mage_Sales_Model_Quote::collectTotals() : app\code\core\Mage\Checkout\Model\Cart.php (464)
[10] => Mage_Checkout_Model_Cart::save() : 

The issue with the Tier Price not being used on the other environment is because of the wrong customer group on checkout (that is a different issue all together - basically when having a VAT check enabled, the group may be changed automatically on the checkout)

Thanks all if you have spent any time on this

  • Can you tell how you traced the execution..Thanks – Manoj Chowrasiya Nov 10 '16 at 10:29

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.