我一直試圖按降序排列價格排序相關產品(最便宜的頂部和昂貴的底部)到目前爲止沒有任何運氣,也許有人可以指導我如何做到這一點?Magento按價格排序相關產品
0
A
回答
0
看到此文件的應用程序\代碼\核心\法師\目錄\型號\ Product.php,並檢查該功能線814
public function getRelatedProductCollection()
{
$collection = $this->getLinkInstance()->useRelatedLinks()
->getProductCollection()
->setIsStrongMode();
$collection->setProduct($this);
return $collection;
}
您需要修改通過擴展這個模型類此功能,所以首先要創建一個模塊並在您的功能中寫入此功能。並添加訂單到收藏。
$collection->setOrder('price', 'DESC');
public function getRelatedProductCollection()
{
$collection = $this->getLinkInstance()->useRelatedLinks()
->getProductCollection()
->setIsStrongMode();
$collection->setProduct($this);
$collection->setOrder('price', 'DESC');
return $collection;
}
您需要擴展這個模塊Mage_Catalog_Model_Product並修改該功能
+0
感謝它工作:) – user3540304 2014-10-06 06:45:12
0
轉到/應用/代碼/核心/法師/目錄/型號/路徑和Product.php
添加下面的代碼public function getRelatedProductCollection()
{
$collection = $this->getLinkInstance()->useRelatedLinks()
->getProductCollection()
->setIsStrongMode();
$collection->setProduct($this);
$collection->setOrder('price', 'DESC');
return $collection;
}
您也可以將此用於體重。只需寫'重量'來代替'價格'。 升序只需寫'ASC'代替'DESC'。
相關問題
- 1. 如何按產品價格排序Magento產品列表?
- 2. Magento - 按產品編號排序產品
- 3. Magento - 更新主要產品價格以包含所選相關產品?
- 4. Magento相關產品Sidebar
- 5. Magento相關產品選項
- 6. Magento按產品類型排序產品列表
- 7. Magento:排序產品集合
- 8. 排序的相關產品不工作在Magento 1.6
- 9. 按價格過濾產品
- 10. Magento的產品取屬性需要排序按降序排序
- 11. Magento的產品價格索引失敗
- 12. Magento:添加產品:等級價格
- 13. Magento可配置產品價格
- 14. 以購買價格銷售產品(Magento)
- 15. Magento Bundle產品缺少價格字段
- 16. Magento在應用產品目錄價格規則前的產品價格
- 17. Magento - 按地區排列發票產品
- 18. 在Magento中按價格列出產品但在最後零價格
- 19. 幫助Magento及相關產品
- 20. Magento查看list.phtml中的相關產品
- 21. Magento Show相關產品圖像
- 22. Magento可配置產品和相關產品
- 23. Magento的相關產品沒有顯示產品頁面
- 24. Magento - 相關產品不顯示在可配置產品下
- 25. 隨機產品代替magento中的相關產品
- 26. Magento產品列表排序問題
- 27. 排序Magento的產品系列由
- 28. Magento產品列表 - 按產品類型排序(可配置,然後簡單)
- 29. 打開購物車許多產品的相同產品價格?
- 30. 按產品訂購元素價格
到目前爲止你有什麼代碼... – Ashley 2014-10-03 14:44:28