gpt4 book ai didi

Magento:批量更改产品商店 ID

转载 作者:行者123 更新时间:2023-12-01 02:40:25 25 4
gpt4 key购买 nike

我刚刚将大约 800 种产品导入 Magento,然后才意识到我将 store_id 设置为 0,而本应为 1。

有谁知道更新这个的简单方法?我尝试将电子表格中的 store_id 更改为 1 并再次导入以更新它们,但它没有用。

我在 http://www.magentocommerce.com/boards/viewthread/1798/ 找到了这个 SQL但是我遇到了语法错误和未知的列错误,所以我没有进一步处理它。

REPLACE INTO catalog_product_store (store_id, product_id) SELECT 1,entity_id from catalog_product_entity
update catalog_category_entity set store_id = 1 where store_id = 0;
update catalog_product_entity set store_id = 1 where store_id = 0;
update catalog_product_entity_datetime set store_id = 1 where store_id = 0;
update catalog_product_entity_decimal set store_id = 1 where store_id = 0;
update catalog_product_entity_gallery set store_id = 1 where store_id = 0;
update catalog_product_entity_int set store_id = 1 where store_id = 0;
update catalog_product_entity_text set store_id = 1 where store_id = 0;
update catalog_product_entity_tier_price set store_id = 1 where store_id = 0;
update catalog_product_entity_varchar set store_id = 1 where store_id = 0;

最佳答案

商店 ID 0 是管理商店 - 在执行自定义导入时设置此设置是很常见的。除非您与多家商店合作,否则这不是问题。

更新产品的最快方法是转到您的目录->管理产品菜单,选择所有产品,然后选择“更新状态”并提交。然后,您可以在结果菜单上的网站选项卡中分配网站关联。

批量编辑所有产品:
Product Bulk Edit

要改为使用代码来完成,您需要遍历您的产品集合并在那里设置网站或商店 ID。一个例子:

$products = Mage::getModel('catalog/product')->getCollection();

foreach( $products as $product) {
$product->setStoreId($storeId);
try {
$product->save();
} catch(Exception $e) {
echo $e->getMessage();
}
}

关于Magento:批量更改产品商店 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8575874/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com