Magento批量分配产品到类别 [英] Magento mass-assign products to category

查看:58
本文介绍了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批量分配产品到类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆