购物车更新后捆绑产品的双单价

时间:2015-10-19 14:54:50

标签: magento-1.9

在更新之前,我有1个捆绑产品,其中1个选项是1个选项 http://shot.qip.ru/00LU8g-4Kzjldg8L/
将qty更改为2并更新后,我有2个捆绑产品,其中包含1个选项 http://shot.qip.ru/00LU8g-5Kzjldg8M/
所以问题是为什么我的更新不仅加倍主要产品数量,而且加倍所有选项(单价) 我的更新通过核心magento方法/ checkout / cart / updatePost

进行

1 个答案:

答案 0 :(得分:0)

有同样的问题。 请尝试在文件app / code / core / Mage / Sales / Model / Quote.php中更改_addCatalogProduct函数 到下一个代码

protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty = 1)
{
    /*$newItem = false;
    $item = $this->getItemByProduct($product);
    if (!$item) {*/
        $item = Mage::getModel('sales/quote_item');
        $item->setQuote($this);
        if (Mage::app()->getStore()->isAdmin()) {
            $item->setStoreId($this->getStore()->getId());
        }
        else {
            $item->setStoreId(Mage::app()->getStore()->getId());
        }
        $newItem = true;
    //}

    /**
     * We can't modify existing child items
     */
    if ($item->getId() && $product->getParentProductId()) {
        return $item;
    }

    $item->setOptions($product->getCustomOptions())
        ->setProduct($product);

    // Add only item that is not in quote already (there can be other new or already saved item
    if ($newItem) {
        $this->addItem($item);
    }

    return $item;
}

至于我,这些改变是正确的。 如果这些更改也适用于您,则可以使用自定义模块重写此功能,并且不要对Core进行更改。