[ec-cube] 商品一覧を商品ID昇順に変更する

対象

対象バージョン

EC-CUBE 2.11.4

対象ファイル

/data/class/pages/products/LC_Page_Products_List.php

副作用

管理画面『商品管理>商品並び替え』が正常に機能しなくなります。

変更箇所

変更前

275行目付近「lfGetProductsList」メソッド内の「default:」に注目。




$order = <<< __EOS__
                    (
                        SELECT
                             T3.rank
                        FROM
                            $dtb_product_categories T2
                            JOIN dtb_category T3
                                USING (category_id)
                        WHERE T2.product_id = alldtl.product_id
                        ORDER BY T3.rank DESC, T2.rank DESC
                        LIMIT 1
                    ) DESC
                    ,(
                        SELECT
                            T2.rank
                        FROM
                            $dtb_product_categories T2
                            JOIN dtb_category T3
                                USING (category_id)
                        WHERE T2.product_id = alldtl.product_id
                        ORDER BY T3.rank DESC, T2.rank DESC
                        LIMIT 1
                    ) DESC
                    ,product_id
__EOS__;
[/php]

変更後

『T3.rank』を『product_id』で置換するだけ




$order = <<< __EOS__
                    (
                        SELECT
                             product_id
                        FROM
                            $dtb_product_categories T2
                            JOIN dtb_category T3
                                USING (category_id)
                        WHERE T2.product_id = alldtl.product_id
                        ORDER BY product_id DESC, T2.rank DESC
                        LIMIT 1
                    ) DESC
                    ,(
                        SELECT
                            T2.rank
                        FROM
                            $dtb_product_categories T2
                            JOIN dtb_category T3
                                USING (category_id)
                        WHERE T2.product_id = alldtl.product_id
                        ORDER BY product_id DESC, T2.rank DESC
                        LIMIT 1
                    ) DESC
                    ,product_id
__EOS__;
[/php]			

Similar posts