0
似乎我必須設置一個商店視圖才能更新網站範圍上的屬性 - 是否正確?Magento需要一個storeview設置來更新網站範圍屬性
我的代碼:
Mage::app('admin');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$product = Mage::getModel('catalog/product');
$product->load(123);
$product->setStoreId('1'); // without this line the attribute is not updated
$product->setSomeattribute("abc");
$product->save();
好的,謝謝我會嘗試。順便說一句......有可能,這在早期版本中有所不同嗎?我的導入腳本運行良好,但未更新之前設置storeId(從1.4到1.7.0.2) – johjoh
@johjoh我認爲這個限制是在1.3中添加的,但我不確定。 – Marius
仍然沒有得到它。我不是說'setCurrentStore(Mage_Core_Model_App :: ADMIN_STORE_ID)',而是'setStoreId('1')'......就這樣使用它,但現在遇到了網站範圍內的圖像問題,因此沒有在那裏更新。 – johjoh