顯示特價商品在magento的銷售圖標。僅在主頁上顯示的不是所有頁面。顯示在特價商品magento上的銷售圖標。只在主頁上顯示不是所有頁面
代碼我在 應用已經編輯/設計/前端/默認/模板/目錄/從行號產品/ list.html
:95
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"` class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
<?php
// Get the Special Price
$specialprice = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialPrice();
// Get the Special Price FROM date
$specialPriceFromDate = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialFromDate();
// Get the Special Price TO date
$specialPriceToDate = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialToDate();
// Get Current date
$today = time();
if ($specialprice):
if($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) || $today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate)):
?>
<img src="../images/sale-icon.png" width="101" height="58" class="onsaleicon" />
<?php
endif;
endif;
?>
</a>
此圖標在主頁只顯示不在所有頁面的產品列表中。我如何顯示所有頁面?
請幫我出這個
小心比較日期像這個! 這個假設永遠不會發生: '$ today <= strtotime($ specialPriceToDate)' 因爲time()獲取完整的時間,getSpecialToDate()不會。 你只得到像這樣從時間日期: '$今天=日期(「Y-M-d」);' 並由此將其轉換爲unixtime –