Maa*_*lok 2 php sorting magento
我正在尝试在magento的类别视图中设置排序顺序.
在/app/design/frontend/template_name/default/template/catalog/product/list.phtml中,产品类别以这种方式调用:
$_productCollection=$this->getLoadedProductCollection();
Run Code Online (Sandbox Code Playgroud)
是否有可能使用以下方法对此集合进行排序?为了记录,这不起作用.;)
->addAttributeToSort('updated_at','asc')->setOrder('updated_at', 'asc')
Run Code Online (Sandbox Code Playgroud)
提前致谢,
马腾
我所要做的就是做一些SQL查询.
为sort-by属性设置前端标签.
update eav_attribute set frontend_label = "Updated" where attribute_code = "updated_at"
Run Code Online (Sandbox Code Playgroud)
启用used_for_sort_by
update catalog_eav_attribute set used_for_sort_by = 1 where attribute_id = (select attribute_id from eav_attribute where attribute_code = "updated_at")
Run Code Online (Sandbox Code Playgroud)
将updated_at设置为标准排序值(也可以在后端完成)
update core_config_data set value = "updated_at" where path = "catalog/frontend/default_sort_by"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3484 次 |
| 最近记录: |