[英]Magento - Find Out of Stock Products With Inventory
In my Magento store I sometimes forget to select 'In Stock' from the dropdown after adding new inventory to an out of stock item. 在我的Magento商店中,我有时忘记在向缺货商品添加新库存后从下拉列表中选择“库存”。
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. 可悲的是,我似乎无法记住如何以一种应该工作的方式输入> 0。 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. 您可以使用$ products执行的操作是通过foreach循环运行,然后将is_in_stock设置为值1,您应该开始营业。
You have to put 你必须把
Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()
法师:: getModel( 'cataloginventory / stock_item') - > loadByProduct($ _产品) - > getQty()
code in 代码
app/design/frontend/default/[yourtemplate]/template/catalog/product/list.phtml
应用程序/设计/前端/默认/ [yourtemplate] /template/catalog/product/list.phtml
file to check your product inventory. 文件以检查您的产品库存。
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.
寻找“is_in_stock” - 1 =有货,0 =缺货。 Filter by 0 and you'll have a list of all of your OOS items.
按0过滤,您将获得所有OOS项目的列表。
You can also check the RSS list for low stock alerts at http://shop.com/index.php/rss/catalog/notifystock/ 您还可以在http://shop.com/index.php/rss/catalog/notifystock/查看RSS列表中的低库存警报
The shortest way is: 最短的方法是:
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($_collection);
法师:: getSingleton( 'cataloginventory /股') - > addInStockFilterToCollection($ _集合);
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');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.