Magento 将产品批量分配到类别

编程入门 行业动态 更新时间:2024-10-22 16:19:53
本文介绍了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 将产品批量分配到类别

本文发布于:2023-11-30 01:24:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648254.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:批量   分配   类别   产品   Magento

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!