Using magento is_in_stock

What is a feature function is_in_stockin Magento? Is it possible to determine whether there is a product in stock, is it possible qty >= 1?

It seems to automatically adjust to the current value of stock_level (compared to the minimum amount allowed?), But why then can you change it manually? I feel that it is useless to change it, because it will change to anything that he wants in any case.

I can not find much information about the functionality of this property through google, so it can be a good addition :-).

+5
source share
3 answers

Magento ( ) . , , , , Magento , .

, is_in_stock , , , .

+5

, : app/code/core/Mage/CatalogInventory/Model/Stock/Item.php

, : Magento isInStock()

0

, . , /code/core/mage/Catalog/Model/Product.php, :

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

As long as the product is on, isInStock always returns true. Function to indicate whether a product is for sale, isSaleable ().

0
source

All Articles