Magento按价格排序相关产品
答
看到此文件的应用程序\代码\核心\法师\目录\型号\ 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
答
转到/应用/代码/核心/法师/目录/型号/路径和Product.php
添加下面的代码public function getRelatedProductCollection()
{
$collection = $this->getLinkInstance()->useRelatedLinks()
->getProductCollection()
->setIsStrongMode();
$collection->setProduct($this);
$collection->setOrder('price', 'DESC');
return $collection;
}
您也可以将此用于体重。只需写'重量'来代替'价格'。 升序只需写'ASC'代替'DESC'。
到目前为止你有什么代码... – Ashley 2014-10-03 14:44:28