製品名で自宅で新製品を並べ替える方法
-
13-12-2019 - |
解決
ローカルフォルダにClass Mage_Catalog_Block_Product_Widget_New
を取るか、またはそれを自分の
下記関数を探す
protected function _getProductCollection()
{
switch ($this->getDisplayType()) {
case self::DISPLAY_TYPE_NEW_PRODUCTS:
$collection = parent::_getProductCollection();
break;
default:
$collection = $this->_getRecentlyAddedProductsCollection();
break;
}
return $collection;
}
.
とこの
に置き換えるprotected function _getProductCollection()
{
switch ($this->getDisplayType()) {
case self::DISPLAY_TYPE_NEW_PRODUCTS:
$collection = parent::_getProductCollection();
break;
default:
$collection = $this->_getRecentlyAddedProductsCollection();
break;
}
$collection->addAttributeToSort('name');
return $collection;
}
. 他のヒント
からのBellow関数を更新してください:
protected function _getProductCollection()
{
switch ($this->getDisplayType()) {
case self::DISPLAY_TYPE_NEW_PRODUCTS:
$collection = parent::_getProductCollection();
break;
default:
$collection = $this->_getRecentlyAddedProductsCollection();
break;
}
return $collection;
}
.
protected function _getProductCollection()
{
switch ($this->getDisplayType()) {
case self::DISPLAY_TYPE_NEW_PRODUCTS:
$collection = parent::_getProductCollection();
$collection->addAttributeToSort('name', 'ASC');
//or $collection->addAttributeToSort('name', 'desc');
break;
default:
$collection = $this->_getRecentlyAddedProductsCollection();
break;
}
return $collection;
. 所属していません magento.stackexchange