【问题标题】:Prestashop: Natural Sort for sort by 'Product Name: A to Z'Prestashop:按“产品名称:A 到 Z”排序的自然排序
【发布时间】:2016-03-20 12:31:29
【问题描述】:

使用blockLayered,当按'Product Name: A to Z'排序时,我得到以下结果:

  • “someCode 10W - 一些字符串”
  • “someCode 16W - 一些字符串”
  • “someCode 25W - 一些字符串”
  • “someCode 34W - 一些字符串”
  • “someCode 5W - 一些字符串”
  • “someCode 7W - 一些字符串”

虽然我希望它们按照“自然秩序”排序

  • “someCode 5W - 一些字符串”
  • “someCode 7W - 一些字符串”
  • “someCode 10W - 一些字符串”
  • “someCode 16W - 一些字符串”
  • “someCode 25W - 一些字符串”
  • “someCode 34W - 一些字符串”

在 blockLayered 代码中,我可以看到对 natcasesort() http://php.net/manual/en/function.natcasesort.php的调用

类似于“涉及特征的分层过滤器现在是自然排序的”-https://gitlab.com/alfons83/PrestaShop/commit/f0abdca08f367b99b8c970f77f13dd4626fd32ee-我的源代码中确实有这样的代码,但在其他行号中。

但我不确定它是否与“产品名称:A 到 Z”排序一起使用。 'name' 被认为是 'id_feature' 吗?

  • 如果使用,为什么最后是“5w”和“7w”?
  • 如果不使用,应该如何\在哪里使用?

【问题讨论】:

  • 我不确定它是否与 blockLayered 相关。 . .
  • 按 MySQL 查询排序。它无法识别“5W”小于“10W”,它按字符排序,因此“someCode 1...”小于“someCode 5...”。
  • 我可以使用 natcasesort() 对查询结果重新排序吗?如果是,在哪里以及如何?
  • 转到modules/blocklayered/blocklayered.php并修改getProductByFilters()
  • 应该修改什么?

标签: prestashop prestashop-1.6 natural-sort


【解决方案1】:

转到首选项 -> 产品

查看“分页”调用。您可以找到它们的“默认顺序”。李选“产品名称”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-09
    • 1970-01-01
    • 1970-01-01
    • 2018-11-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多