显示Magento的所有特价商品

时间:2013-05-21 23:54:38

标签: magento

如果您想在Magento中设置“On Sale”项目,您必须设置“特价”。特殊价格使您能够在指定的时间段内定义产品的折扣价格。

我的问题是如何在分层导航中添加链接以显示我的所有“销售”/“特价”商品。

由于

2 个答案:

答案 0 :(得分:1)

检查以下网址。

http://www.creativemediagroup.net/creative-media-web-services/magento-blog/27-magento-show-only-special-priced-products-in-a-category

大约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; 
}