Display backup status on magento interface

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

I have at the moment those in the warehouse, showing the number of available and those products in the background, do not show anything.

Does anyone know a code that I can put in a view.phtml file that will ONLY display a message about those products that are installed as backup?

Thanks!

Simon.

+6
source share
2 answers

To do this, make sure that you have enabled backups in the inventory tab.

If you are on the product page, then first of all get the product number.

<?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 , where a message about product availability appears.

+7
source

Here is the code to add to view.phtml. This will display a non-delivery message:

 $inventory = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product); $inv_qty = (int)$inventory->getQty(); if($inventory->getBackorders() >= 0 && $inv_qty == 0) { echo "Your backorder message goes here"; } 
+1
source

Source: https://habr.com/ru/post/944616/


All Articles