enter image description here

It doesn't seem that it is an attribute that I can get the value of Temporary unavailable is there any way to get exactly this text? I found this:

'label' => Mage::helper('catalog')->__('Stock Availability'),
            'name'  => 'stock_data[is_in_stock]',

I don't know how it can help this link doesnt help me because I have a product which is comming soon status and a product which is out of stock and I have temporary unavailable for just the out of stock status but if I use the code the comming soon will be not available

  • is this custom stock status is from any extension ? Commented Dec 22, 2014 at 18:29
  • no it is not from any extension
    – Nickool
    Commented Dec 22, 2014 at 18:31

3 Answers 3


You can get the in stock status by below code

// $_item->getProductId() -> your product id
$product = Mage::getModel('catalog/product')->load($_item->getProductId());

if ($product->getStockItem()->getIsInStock()) { 
    // $product->getStockItem()->getIsInStock() == 1
    echo "product is in stock";
    // $product->getStockItem()->getIsInStock() == 0
    echo "product is not in stock";

In short, is_in_stock is more of a flag (boolean) for some internals of inventory and display control, so using it to rely on for determining a presale product wouldn't be wise.

You would be better to simply create a new attribute for conditioning.

Attribute Code: pre-order
Type: Dropdown
Unique Value: No
Required: No
Validation: None
Apply To: All Products
Frontend Attributes: Used in Product Listing
Values: Preorder

Go to Manage Attribute Sets and add pre-order to the various set names.

Then any products simply set the value to Preorder that need to be.

<?php if ($preorder = $_product->getAttributeText('pre-order'); ?>
  <?php if ($preorder=="Preorder"): ?>
    <button type="button" class="form-button" onclick="setLocation('getAddToCartUrl($_product) ?>')"><span>__('Pre Order Item') ?>
  <?php endif; ?>
<?php endif; ?>

This code can now be used to replace the current add to cart button, from the if saleable statement on both the list.phtml and the view.phtml files in the frontend catalog template folder.

Modified Example


As far as I know there is no such Stock Availability in Magento by default. Most probably it's some custom modification. The stock availabilities are get from app/code/core/Mage/CatalogInventory/Model/Source/Stock.php. You have to check what is overwriting Mage_CatalogInventory_Model_Source_Stock -> public function toOptionArray or Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Inventory -> public function getStockOption.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.