4

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

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

谢谢

4

2 回答 2

1

签出以下网址即可。

http://www.creativemediagroup.net/creative-media-web-services/magento-blog/27-magento-show-only-special-price-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')).'" />
于 2013-05-22T05:35:31.090 回答
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; 
} 
于 2013-10-22T13:31:45.230 回答