Magento Backorder可用性消息

时间:2011-01-07 23:03:38

标签: magento

在我的Magento商店中,我将其设置为允许某些产品的延期交货。当这些商品缺货时,他们仍然会在产品页面上显示为“有库存”,但当用户访问购物车时会通知用户延期交货。

我想更改产品页面,以便它还显示该商品已在延期交货,而不是“有库存”文字。

2 个答案:

答案 0 :(得分:8)

在文件template/catalog/product/view/type/simple.phtml中(对于捆绑,可配置,分组和虚拟相同 - 您必须全部覆盖它们),有一些代码如下所示:

<?php if($_product->isSaleable()): ?>
    <p class="availability in-stock"><?php echo $this->__('Availability:') ?>
    <span><?php echo $this->__('In stock') ?></span></p>

我的猜测是你需要改变它:

<?php if($_product->isSaleable()): ?>
    <p class="availability in-stock"><?php echo $this->__('Availability:') ?>
    <span><?php echo $this->__($_product->isInStock() ? 'In stock' : 'On Backorder') ?></span></p>

搜索所有模板文件的“可用性”,以查看可能需要修复的各个位置。

答案 1 :(得分:0)

I have found the following solution which worked for me at link below: Show backorder status on magento frontend

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.