2016-03-20 50 views
1

使用blockLayered,通過排序時, '產品名稱:A到Z',我得到如下結果:的Prestashop:自然排序進行排序 '產品名稱:A到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」最後?
  • 如果沒有使用,我應該在哪裏使用它?
+0

我不知道它與blockLayered。 。 。 – Atara

+0

它按MySQL查詢進行排序。它不能識別「5W」小於「10W」,它按字符排序,所以「someCode 1 ...」小於「someCode 5 ...」。 –

+0

我可以使用natcasesort()重新排序查詢結果嗎?如果是的話,在哪裏以及如何? – Atara

回答

0

去首選項 - >產品

看在 「尋呼」 的呼叫。你可以找到他們「默認順序」。李選擇「產品名稱」