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

后端 未结 2 1498
[愿得一人]
[愿得一人] 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:45

    The "Use Default Value" flag isn't stored in the database anywhere.

    Magento core uses that flag to do this when saving products:

       /**
         * Check "Use Default Value" checkboxes values
         */
        if ($useDefaults = $this->getRequest()->getPost('use_default')) {
            foreach ($useDefaults as $attributeCode) {
                $product->setData($attributeCode, false);
            }
        }
    

    Before doing some other things.

    I would look at Mage_Adminhtml_Catalog_ProductController (app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php) and learn how Magento core does it.

    Specifically saveAction() and _initProductSave()

    I hope this points you in the right direction.

提交回复
热议问题