且构网

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

Magento批量分配产品到类别

更新时间:2021-08-21 23:41:03

我设法通过以下代码解决了该问题:

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.