Magento setting Product Attribute's “Use Default Value” using updateAttributes

后端 未结 2 1500
[愿得一人]
[愿得一人] 2021-02-09 12:05

I have a multi-store setup and I am setting a Product\'s Attribute for a particular store to use the \"Use Default Value\" option - (ie to use the value in the Store View), as f

2条回答
  •  长发绾君心
    2021-02-09 12:50

    Simply use 0 as the store ID (admin store) which is the same thing as default values in the Magento Admin.

    Mage::getSingleton('catalog/product_action')
        ->updateAttributes(
            array($productId),
            array('name' => false),
            0);
    

    If you already set the store view scopes you will have to go in and recheck the use default values or it will override the attribute at the relevant scope.

    There may be a way to programmatically set these. I'm uncertain.

提交回复
热议问题