ecshop本身默认的产品浏览历史是按照商品ID排序

 

这样似乎用户体验不太好,国内几个大型电商网站,都是用的浏览先后次序进行排序。

 

只需修改一行代码便能实现该功能,让浏览历史按照浏览先后进行排序。

 

打开 includes/lib_insert.php,找到 insert_history() 函数部分,将

 

” WHERE $where AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0″;

 

修改为

 

” WHERE $where AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 order by INSTR(‘”.$_COOKIE['ECS']['history'].”‘,goods_id)”;

 

这样,产品浏览历史便可按照先后进行排序了。

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2022-03-04
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-30
  • 2021-08-27
  • 2021-08-18
  • 2022-12-23
  • 2021-09-24
相关资源
相似解决方案