更新时间:2023-11-30 10:01:22
这不起作用,因为您需要当前存储作为此类操作的管理存储.
This doesn't work because you need the current store being the admin store for this kind of operation.
要使特定商店视图使用给定属性的默认值:
To make a specific store view use the default value for a given attribute:
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$product = Mage::getModel('catalog/product')
->load($product_id) // in your case: 1
->setStoreId($store_id) // in your case: 3
->setData($attr, false) // in your case: 'name'
->save();