Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show backorder status on magento frontend

I need to show on the product page (frontend) that the current item is for backorder ONLY and is not in stock.

I have at the moment those in stock showing qty of what is available and those products on backorder doesn't show anything.

Does anyone know a code I can put in the view.phtml file that will ONLY show a message on those products set as backorder?

Thanks!

Simon.

like image 965
Simon Avatar asked May 09 '13 10:05

Simon


1 Answers

To do this make sure you have enabled backorders from inventory tab.

If you are on product page then first of all retrieve product qty.

<?php
$inventory = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);

if( (int)$inventory->getQty() == 0 && $inventory->getBackorders() )
{
  // No Backorders => getBackorders() = 0
  // Allow Qty Below 0 => getBackorders() = 1
  // Allow Qty Below 0 and Notify Customer => getBackorders() = 2
  echo "display your backordedr message";
}
?>

You can also put this code in app\design\frontend\base\default\template\catalog\product\view\type\default.phtml file where availability message of product come from.

like image 166
Mufaddal Avatar answered Oct 03 '22 21:10

Mufaddal