0

我有magento 1.6.2。

在我的商店销售标签显示在有特价的产品上(按产品设置)

这里正在使用以下代码:

  function getProductLabel($_product, $list_mode)
    {
        if (!$list_mode) return;
        $output = '';
        if (Mage::getStoreConfig('product_labels/show_sale_label')) {

            $now = date("Y-m-d");
            $specialFrom = substr($_product->getData('special_from_date'), 0, 10);
            $specialTo = substr($_product->getData('special_to_date'), 0, 10);

            $special = false;

            if (!empty($specialFrom) && !empty($specialTo)) {
                if ($now >= $specialFrom && $now <= $specialTo) $special = true;

            } elseif (!empty($specialFrom) && empty($specialTo)) {
                if ($now >= $specialFrom) $special = true;

            } elseif (empty($specialFrom) && !empty($specialTo)) {
                if ($now <= $specialTo) $special = true;
            }
            if ($special) $output .= '<div class="label_sale_' . Mage::getStoreConfig('product_labels/sale_label_position') . '"></div>';

        }

但这不适用于具有由目录价格规则设置的销售价格的产品。

如何更改此代码,以便在目录规则生成特价时也显示销售标签?

提前致谢。

4

0 回答 0