本文介绍了Magento 将产品批量分配到类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正如标题所说,我需要将产品批量分配到一个类别,并且在管理员中我一次只能编辑一个产品;我不知道为什么从类别页面的类别产品"选项卡中批量添加它们是行不通的.这就是为什么我需要另一种快速的方法,例如使用 phpMyAdmin 或类似方法.
As the title says,i need to mass-assign products to a category and from the admin i can only edit one product at a time; i dont know why it just doesnt work to mass add them from the "category products" tab in the category page. Thats why i need another method that's fast,like using phpMyAdmin or something alike.
有什么帮助吗?
提前致谢!
推荐答案我设法用以下代码解决了这个问题:
I managed to resolve the problem with the following code :
$write = Mage::getSingleton('core/resource')->getConnection('core_write'); $x = 1171; $y = 2000; $categoryID = 4; $productPosition = 0; while($x <= $y) { $write->query("REPLACE INTO `catalog_category_product` (`category_id`, `product_id`, `position`) VALUES ($categoryID, $x++, $productPosition)"); } echo "The job is done"; ?>我希望代码对每个人都清楚,如果不是,请回复,我会尽力解释.
I hope the code is clear for everyone,if it's not,reply and i'll try to explain it.
@nachito : 在这里.
@nachito : here it is.
更多推荐
Magento 将产品批量分配到类别
发布评论