2011-03-25 47 views
2

我無法在產品列表頁面按價格排序產品。價格不適用於Magento產品列表

按名稱排序工作正常。

任何想法的傢伙?

我搜索了一下,並嘗試了一些解決方案,但他們沒有解決我的問題。

我想:系統 - >緩存管理 - >分層導航Indices->現在刷新

也試過此鏈接:http://www.miromedia.co.uk/blog/300/fixing-the-magento-price-sort-issue.htm

的Magento版本:1.3.2.4

+0

和你的magento版本是? – 2011-03-25 08:12:59

回答

3

這個版本的Magento似乎存在某種錯誤,產品目錄索引價格在產品保存時不更新。所以你可以做的就是通過如下所述的價格條件。

更新addAttributeToSort功能Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection類。

註釋掉下面的代碼: -

//  if ($attribute == 'price' && $storeId != 0) { 
//   $websiteId = Mage::app()->getStore()->getWebsiteId(); 
//   $customerGroup = Mage::getSingleton('customer/session')->getCustomerGroupId(); 
// 
//   if ($this->isEnabledFlat()) { 
//    $priceColumn = 'e.display_price_group_' . $customerGroup; 
//    $this->getSelect()->order("{$priceColumn} {$dir}"); 
//   } 
//   else { 
//    $priceAttributeId = $this->getAttribute('price')->getId(); 
// 
//    $entityCondition = '_price_order_table.entity_id = e.entity_id'; 
//    $storeCondition = $this->getConnection()->quoteInto(
//     '_price_order_table.website_id = ?', 
//     $websiteId 
//    ); 
//    $groupCondition = $this->getConnection()->quoteInto(
//     '_price_order_table.customer_group_id = ?', 
//     $customerGroup 
//    ); 
//    $attributeCondition = $this->getConnection()->quoteInto(
//     '_price_order_table.attribute_id = ?', 
//     $priceAttributeId 
//    ); 
// 
//    $this->getSelect()->joinLeft(
//     array('_price_order_table'=>$this->getTable('catalogindex/price')), 
//     "{$entityCondition} AND {$storeCondition} AND {$groupCondition} AND {$attributeCondition}", 
//     array() 
//    ); 
//    $this->getSelect()->order('_price_order_table.value ' . $dir); 
// 
//    /** 
//     * Distinct we are using for remove duplicates of products which have 
//     * several rows in price index (like grouped products) 
//     */ 
//    $this->getSelect()->distinct(true); 
//   } 
// 
//   return $this; 
//  } 

可以在比註釋掉的核心代碼Magento的其他標準的方式做到這一點。希望這可以幫助。

+0

謝謝Subesh。它對我的情況確實有幫助。 – 2011-04-13 11:41:41

+0

@subesh:謝謝我面對同樣的問題.even在我的版本1.5.1.0 – Gowri 2011-11-25 12:31:12

+0

@subesh:抱歉它導致其他排序像製造商名稱.so請大家發現其他妄想 – Gowri 2011-12-06 11:55:00

1

您需要在Magento admin中正確配置price屬性。

轉到屬性管理,發現價格屬性,並確保你打勾包裝盒上的「排序在前端」

應該爲您解決問題。