如果您想在Magento中设置“On Sale”项目,您必须设置“特价”。特殊价格使您能够在指定的时间段内定义产品的折扣价格。
我的问题是如何在分层导航中添加链接以显示我的所有“销售”/“特价”商品。
由于
答案 0 :(得分:1)
检查以下网址。
大约31号线有一个语法错误,所以
echo '<img src="'.$this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135);.'" width="135" height="135" alt=".$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'" title="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'" />
用以下
替换上述行echo '<img src="'.$this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135).'" width="135" height="135" alt="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'" title="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'" />
答案 1 :(得分:0)
调用此函数:
public function getSpecialProduct(){
$sql = "SELECT
cp.*,
ea.*
FROM
catalog_category_product AS cp
INNER JOIN
catalog_product_entity_decimal AS pei ON
pei.entity_id=cp.product_id
AND
pei.attribute_id =76
AND
pei.value >0
NATURAL JOIN
eav_attribute AS ea
WHERE
ea.attribute_code='special_price'
group by
cp.product_id";
$data = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchAll($sql);
foreach($data as $row)
$arr[] = Mage::getModel('catalog/product')->setStoreId($storeId)->load($row['product_id']);
return $arr;
}