且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento设置产品属性的“使用默认值"使用updateAttributes

更新时间:2023-11-30 09:56:58

使用默认值"标志未存储在数据库中的任何位置.

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

Magento核心在保存产品时使用该标志来执行此操作:

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);
        }
    }

在做其他事情之前.

我将研究Mage_Adminhtml_Catalog_ProductController(app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php),并了解Magento核心是如何做到的.

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

特别是saveAction()_initProductSave()

我希望这可以为您指明正确的方向.

I hope this points you in the right direction.