[英]Magento - Sort on date updated in category list.phtml
我正在尝试在magento的类别视图中设置排序顺序。
在/app/design/frontend/template_name/default/template/catalog/product/list.phtml中,产品类别的调用方式如下:
$_productCollection=$this->getLoadedProductCollection();
是否可以使用以下内容对该集合进行排序? 出于记录,这是行不通的。 ;)
->addAttributeToSort('updated_at','asc')->setOrder('updated_at', 'asc')
提前致谢,
马腾
我要做的就是做一些SQL查询。
为sort-by属性设置前端标签。
update eav_attribute set frontend_label = "Updated" where attribute_code = "updated_at"
启用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")
将updated_at设置为标准排序值(也可以在后端完成)
update core_config_data set value = "updated_at" where path = "catalog/frontend/default_sort_by"
我发现了一篇满足您需求的博客文章。 还需要其他编码,但是它将通过附加的排序功能为您提供所需的内容。
http://www.excellencemagentoblog.com/magento-category-page-product-sorting
第一部分之后的所有内容,从“ 在类别页面中进行自定义产品分类”开始,将为您提供新功能所必需的替代功能和其他功能。
如果您认为缺少某些内容,并且需要更多功能,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.