Magento为getRelatedLinkCollection()添加排序
如何按名称或其他属性对相关产品集合进行排序?Magento为getRelatedLinkCollection()添加排序,magento,sorting,collections,product,Magento,Sorting,Collections,Product,如何按名称或其他属性对相关产品集合进行排序? 我试过这样的方法: foreach ($_product->getRelatedLinkCollection()->addAttributeToSort('name', 'ASC') as $link) {...} 但是它不起作用。该方法getRelatedLinkCollection不返回预期的产品集合,而是Mage\u Catalog\u Model\u Resource\u product\u Link\u collection不
我试过这样的方法:
foreach ($_product->getRelatedLinkCollection()->addAttributeToSort('name', 'ASC') as $link) {...}
但是它不起作用。该方法
getRelatedLinkCollection
不返回预期的产品集合,而是Mage\u Catalog\u Model\u Resource\u product\u Link\u collection
不支持adddistributetoselect
或addAttributeToSort
等方法
看看这个答案:。这几乎就是你想要达到的目标