使用magento is_in_stock

发布于 2024-12-13 17:02:46 字数 221 浏览 3 评论 0原文

Magento 中的属性 is_in_stock 到底有什么作用?可以通过qty >= 1来判断产品是否有货。

它似乎会自动调整到当前的库存水平(与最小允许数量相比?),但为什么你可以手动修改它?我觉得修改它没有用,因为无论如何它都会改变成它想要的任何东西。

我无法通过谷歌找到很多关于此属性功能的信息,所以可能是一个很好的补充:-) 。

What exactly is the function of the property is_in_stock in Magento? Whether a product is in stock can be determined on whether qty >= 1?

It seems to automatically adjust to the current stock_level (compared to minimal allowed quantity?) but why then can you modify it manually? I feel like it has no use to modify it, because it will change to whatever it wants itself anyway..

I can't find a lot of information about the functionality of this property via google, so might be a good addition :-).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

紧拥背影 2024-12-20 17:02:46

许多小型商家将使用 Magento 来监控其实际“仓库”(空闲房间)产品库存水平。有时,他们可能希望暂时将网上商店中的商品列为缺货,但由于其他业务原因,他们会希望 Magento 中的库存编号能够反映他们手头的商品数量。

换句话说,is_in_stock 数据成员控制商店如何显示产品,无论您手头有多少商品。

Many smaller merchants will use Magento to monitor their actual "Warehouse" (spare room) stock levels for products. There may be times where they want to temporarily have an item listed as out of stock on their web-store, but they will sto want the stock number in Magento to reflect the number of items they have on hand for other business reasons.

Put another way, the is_in_stock data member controls how the store displays the product, irrespective of how many items you have on hand.

卸妝后依然美 2024-12-20 17:02:46

您可能想深入了解:app/code/core/Mage/CatalogInventory/Model/Stock/Item.php

可能相关的帖子:
在产品上调用 isInStock() 方法时出现 Magento 问题

You may want to dig around: app/code/core/Mage/CatalogInventory/Model/Stock/Item.php

Possibly related post:
Magento issue with calling isInStock() method on a product

心如狂蝶 2024-12-20 17:02:46

完全需要修改我的答案,非常抱歉。当我查看 app/code/core/mage/Catalog/Model/Product.php 中定义的函数时,我看到了这种非常奇怪的情况:

public function isInStock()
{
    return $this->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED;
}

因此,只要产品已启用,isInStock 将始终返回 true。判断产品是否待售的函数是 isSaleable()。

Totally need to revamp my answer here so many apologies. When I looked at the function as it is defined in app/code/core/mage/Catalog/Model/Product.php I saw this very odd situation:

public function isInStock()
{
    return $this->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED;
}

So as long as a product is Enabled, isInStock will always return true. The function for telling if a product is for sale is isSaleable().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文