0

After magento upgrade, instead of special price, its loading the original price of the product to the cart. Though special price are on the listing page and product view page.

0

When I read through the magento 1.9.4.0 code, I found that in this release there is some new code inserted in file app/code/core/mage/catalog/model/resource/product/collection.php marked as bold below

public function isEnabledFlat() {

    if (Mage::app()->getStore()->isAdmin() || **$this->getFlatHelper()->isFlatCollectionDisabled()**) {
        return false;
    }
    $storeId = $this->getStoreId();
    if (!isset($this->_flatEnabled[$storeId])) {
        $flatHelper = $this->getFlatHelper();
        $this->_flatEnabled[$storeId] = $flatHelper->isAvailable() && $flatHelper->isBuilt($storeId);
    }
    return $this->_flatEnabled[$storeId];

}

When I, researched further, I found that two more functions along with this are defined to set and reset the variable in the below helper file app/code/core/mage/catalog/helper/product/flat.php

public function disableFlatCollection($save = false) { $this->_forceFlatStatus = true;

    if ($save) {
        $this->_forceFlatStatusOld = $this->_forceFlatStatus;
    }
}

/**
 * Reset Catalog Product Flat
 */
public function resetFlatCollection()
{
    if (isset($this->_forceFlatStatusOld)) {
        $this->_forceFlatStatus = $this->_forceFlatStatusOld;
    } else {
        $this->_forceFlatStatus = false;
    }
}

/** * Checks if Catalog Product Flat was forced disabled * * @return bool */

public function isFlatCollectionDisabled()
{
    return $this->_forceFlatStatus;
}

Now, cart controller, multishipping controller , onepage controller are using this disableFlatCollection() in preDispath() function , which in turn sets the $this->_forceFlatStatus variable to true and remains always true and magento starts using eav collection for cart and checkout instead of flat collection. I wonder why the resetFlatCollection() not called to reset the variable to false again in the above mentioned controllers.

I wonder, it is a major change but there is not even a single line described about it in release note.

I hope it is a magento bug and will be resolved soon!.

| improve this answer | |

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.