我在表sales_flat_quote_item
中創建了一個名爲'wiid'的新列。當任何產品形式願望清單添加到購物車時,我想將數據保存在此字段中。所以,這裏是我的MageWishlist_Model_Item:向sales_flat_quote_item添加新字段並保存數據
$quote_item = Mage::getModel('sales/quote_item')->load($cart->getQuote()->getItemByProduct($product)->getId());
//I log() this $quote_item and is returning the correct object
$quote_item_id = $quote_item->getId();
//Is returning the correct quote item id from database
$wishlist_item_id = $this->getId();
//Is returnig the correct wishlist item id
$quote_item->setWiid($wishlist_item_id);
$quote_item->save();
問題在於上面的最後兩行。它不是保存在數據庫中。
什麼是你的問題? – cheesemacfly
我假設在創建這個列之後,您完成了一次完整的緩存刷新。 Magento緩存表格的結構,如果你沒有清除緩存,它不會看到字段「wiid」。 – Ian
嘗試刪除'var/cache'中的所有內容 有關表列的信息從'Zend_Db'緩存。正常的情況是,'Zend_Db'不知道保存數據。如果數據已設置且列存在,則會保存。正如伊恩所說 –