开发者

Magento - Find Out of Stock Products With Inventory

In m开发者_StackOverflow社区y Magento store I sometimes forget to select 'In Stock' from the dropdown after adding new inventory to an out of stock item.

Is it possible to somehow get a list of all products which have inventory but as tagged as "Out of Stock"?


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));

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.

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.


Easiest way (I think)

Admin -> System -> Import/Export -> Profiles

Add new Profile

Change to export, give the file a name and a location. Download the file and open in your favorite spreadsheet program. Look for "is_in_stock" - 1 = in stock, 0 = out of stock. Filter by 0 and you'll have a list of all of your OOS items.

You can also check the RSS list for low stock alerts at http://shop.com/index.php/rss/catalog/notifystock/


You have to put

Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()

code in

app/design/frontend/default/[yourtemplate]/template/catalog/product/list.phtml

file to check your product inventory.


The shortest way is:

Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($_collection);


Load Products order by Stock And Descending Order

$products
->joinField(
            'inventory_in_stock', 
            'cataloginventory_stock_item', 
            'is_in_stock', 
            'product_id=entity_id',
            'is_in_stock>=0', 
            'left'
)
->setOrder('inventory_in_stock', 'desc');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜