且构网

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

Magento-查找有库存的缺货产品

更新时间:2023-11-30 12:55:10

如果您能够快速编写出真正的脚本.

If you are able to script something real quick.

$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToFilter('is_in_stock', 0)
->addAttributeToFilter('qty', array("gt" => 0));

遗憾的是,我似乎不记得如何以一种可行的方式放入> 0.也许有人可以对此发表评论.

Sadly I can't seem to remember how to put in the >0 in a way that is supposed to work. Maybe someone can comment on that.

使用$ products可以执行的操作是通过一个foreach循环运行它,然后将is_in_stock的值设置为1,这样您就可以开展业务了.

What you can do with $products is run it through a foreach loop and then set the is_in_stock to the value of 1 and you should be in business.