Magento - Set product attribute to use default values

后端 未结 1 1071
南方客
南方客 2020-12-31 20:25

This has been asked many times before but with no working answer.

I have multiple stores and some attributes have been overridden. I want to change these attributes

相关标签:
1条回答
  • 2020-12-31 20:51

    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();
    
    0 讨论(0)
提交回复
热议问题