cancel
Showing results for 
Search instead for 
Did you mean: 

Cart displays wrong price after exceeding stock value. Version 1.9.3.1

SOLVED

Cart displays wrong price after exceeding stock value. Version 1.9.3.1

When entering the cart and updating the amount of in cart products, so that current stock is exceeded, the cart displays weird prices. The stock warning appears correctly, but still the prices are wrong. This applies to simple and configurable products. This happens after upgrading to 1.9.3.1. It did not happen with 1.9.2.4. No extensions were installed in the meantime.

 

Thanks for reading this.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Cart displays wrong price after exceeding stock value. Version 1.9.3.1

This "bug" was introduced in Magento CE 1.9.3.0 by the following modification in app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php:

                 $item->setPrice($finalPrice)
                     ->setBaseOriginalPrice($finalPrice);
                 $item->calcRowTotal();
    -        } else if (!$quoteItem->getParentItem()) {
    +        } else if (!$quoteItem->getParentItem() && !$item->getHasError()) {
                 $finalPrice = $product->getFinalPrice($quoteItem->getQty());
                 $item->setPrice($finalPrice)
                     ->setBaseOriginalPrice($finalPrice);



Because of this the quote calculation isn't done correctly anymore. I don't find a reasonable notification for this in the CE 1.9.3.0 release notes.

I fixed this problem by rewriting this modification back to the CE 1.9.2.x behaviour.

        <models>
            ...
            <sales>
                <rewrite>
                    <quote_address_total_subtotal>Mypackage_Mymodule_Model_Sales_Quote_Address_Total_Subtotal</quote_address_total_subtotal>
                </rewrite>
            </sales>
        </models>



and Mypackage_Mymodule_Model_Sales_Quote_Address_Total_Subtotal

    <?php
    class Mypackage_Mymodule_Model_Sales_Quote_Address_Total_Subtotal extends Mage_Sales_Model_Quote_Address_Total_Subtotal
    {
        /**
         * Address item initialization
         *
         * @param  $item
         * @return bool
         */
        protected function _initItem($address, $item)
        {
            ...
            } else if (!$quoteItem->getParentItem()) {
                $finalPrice = $product->getFinalPrice($quoteItem->getQty());
            ...
    }

View solution in original post

7 REPLIES 7

Re: Cart displays wrong price after exceeding stock value. Version 1.9.3.1

Confirmed on 1.9.3.0 as well

Re: Cart displays wrong price after exceeding stock value. Version 1.9.3.1

Hi @Alex M and @stellar_job,

 

I haven't seen this issue before when upgrading. Did you both upgrade from the same version, 1.9.2.4? Could you also give a little more info about it? Like a screenshot, or what you expected to see and what you're actually seeing, etc.

 

That might help us helping you.

 

Thanks!

If this response was helpful to you, consider giving kudos to this post.
If this response solved your problem, click accept as solution to help others solve this

Re: Cart displays wrong price after exceeding stock value. Version 1.9.3.1

Hello.

I'm not sure about the upgrade, I'll have to get back to you on that.

Here's a video of the issue taking place: https://drive.google.com/file/d/0B2il0vHgXKayWVk0T1hvQ01NTjg/view?usp=sharing

Re: Cart displays wrong price after exceeding stock value. Version 1.9.3.1

Update procedure from 1.9.2.4 :

 

to 1.9.3.0 by magentoconnect. Logs indicated successful procedure.

Because 1.9.3.0 was buggy, I changed back to 1.9.2.4 by complete replacement of the root folder and database. So everything was set back, to the state like before the upgrade.

 

to 1.9.3.1 by manually inserting all new files, deleting old files, updating changed files.

 

I can confirm the video of naaraxi. Using Onestepcheckout the mistake also appears there, when you use the " + " increase button to exceed the stock value.

Re: Cart displays wrong price after exceeding stock value. Version 1.9.3.1

This "bug" was introduced in Magento CE 1.9.3.0 by the following modification in app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php:

                 $item->setPrice($finalPrice)
                     ->setBaseOriginalPrice($finalPrice);
                 $item->calcRowTotal();
    -        } else if (!$quoteItem->getParentItem()) {
    +        } else if (!$quoteItem->getParentItem() && !$item->getHasError()) {
                 $finalPrice = $product->getFinalPrice($quoteItem->getQty());
                 $item->setPrice($finalPrice)
                     ->setBaseOriginalPrice($finalPrice);



Because of this the quote calculation isn't done correctly anymore. I don't find a reasonable notification for this in the CE 1.9.3.0 release notes.

I fixed this problem by rewriting this modification back to the CE 1.9.2.x behaviour.

        <models>
            ...
            <sales>
                <rewrite>
                    <quote_address_total_subtotal>Mypackage_Mymodule_Model_Sales_Quote_Address_Total_Subtotal</quote_address_total_subtotal>
                </rewrite>
            </sales>
        </models>



and Mypackage_Mymodule_Model_Sales_Quote_Address_Total_Subtotal

    <?php
    class Mypackage_Mymodule_Model_Sales_Quote_Address_Total_Subtotal extends Mage_Sales_Model_Quote_Address_Total_Subtotal
    {
        /**
         * Address item initialization
         *
         * @param  $item
         * @return bool
         */
        protected function _initItem($address, $item)
        {
            ...
            } else if (!$quoteItem->getParentItem()) {
                $finalPrice = $product->getFinalPrice($quoteItem->getQty());
            ...
    }

Re: Cart displays wrong price after exceeding stock value. Version 1.9.3.1

Yes, you are right. Finally someone found it. I am not sure why they have made this change in first place.

Thank you so much!!

Re: Cart displays wrong price after exceeding stock value. Version 1.9.3.1

Hi,

Many thanks for taking time to share a fix.

I am having same problem with Magento ver. 1.9.3.4, but the Subtotal.php looks a little different and I can not see where to put your Mypackage_Mymodule_Model_Sales_Quote_Address_Total_Subtotal edit.

I am more a user than a coder and so would appreciate very simple - copy and paste instructions for me to try this fix / or better still a full edit of each file to change?

Any help very much appreciated. Many thanks Psychosonicsid.