2015-10-19 75 views

回答

0

有同樣的問題數量。 請嘗試在文件app /代碼/核心/法師/銷售/型號/ 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進行更改。

+0

此代碼使所有項目新的購物車,所以如果我有購物車中的項目,並試圖添加相同的項目我沒有得到數量增加,但我得到另一個相同的項目在購物車http://shot.qip.ru/00LU8g -6Kzjldg9v /但還是謝謝。 – Cheezone

相關問題