通过MySQL查询批量更新简单产品"状态"

ped*_*oto 5 mysql magento e-commerce

我刚刚将超过12k的产品导入我的Magento产品目录.

问题是,产品带有未定义的"状态"字段,如果我想在前端存储中使用它们,我需要手动将它们设置为"启用".手动执行此操作需要数小时.

你知道在数据库中定义这个设置的位置吗?您是否知道会自动生成的查询(我想将所有产品设置为"已启用").

wor*_*hit 17

# First find the ID of the product status attribute in the EAV table:
SELECT * FROM eav_attribute where entity_type_id = 4 AND attribute_code = 'status'

# Then use that status attribute ID ($id) while querying the product entity table:
UPDATE catalog_product_entity_int SET value = 1 WHERE attribute_id = $id
Run Code Online (Sandbox Code Playgroud)
  • 1 - 启用
  • 2 - 禁用


Gus*_*tav -8

所有行设置为启用

UPDATE Catalog SET Status='Enabled'
Run Code Online (Sandbox Code Playgroud)

如果你想默认启用它,你可以稍微修改一下。

ALTER TABLE `Catalog` CHANGE `Status` `Status` ENUM('','Enabled','Disabled') NOT NULL DEFAULT 'Enabled'
Run Code Online (Sandbox Code Playgroud)

  • 这似乎不适用于任何 magento 版本。 (4认同)