2
如何通過名稱或其他屬性對相關產品集合進行排序?
我已經試過類似:
Magento添加排序getRelatedLinkCollection()
foreach ($_product->getRelatedLinkCollection()->addAttributeToSort('name', 'ASC') as $link) {...}
但它沒有工作。
如何通過名稱或其他屬性對相關產品集合進行排序?
我已經試過類似:
Magento添加排序getRelatedLinkCollection()
foreach ($_product->getRelatedLinkCollection()->addAttributeToSort('name', 'ASC') as $link) {...}
但它沒有工作。
方法getRelatedLinkCollection
不會返回預期的產品集合,而是不支持addAddtributeToSelect
或addAttributeToSort
等方法的Mage_Catalog_Model_Resource_Product_Link_Collection
。
看一看這個答案:https://stackoverflow.com/a/26184265/4762900。這幾乎是你想要實現的。
請不要回答? – Gulp