我有以下代码:
umask(0);
Mage::app();
$category =new Mage_Catalog_Model_Category();
$category->load($cid);
if ($status == "2") {
$products = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*')
->addFieldToFilter('status',Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
$products->load();
}
if ($status == "1") {
$products = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*');
$products->load();
}
我想添加一个库存数量过滤器来过滤产品,我尝试过:
$products = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*');
**->addAttributeToFilter('qty', array("gt" => 0));**
但是不成功,有什么想法吗?