Ticket #200 (closed 新規開発: 修正済)

Opened 16 years ago

Last modified 16 years ago

商品の AND 検索

Reported by: nanasess Owned by: adachi
Priority: Milestone: EC-CUBE2.3.0
Component: フロント Version: 2.0系(正式版)
Keywords: Cc:
修正済み:

Description

商品の AND 検索を可能にするパッチ

via.  http://xoops.ec-cube.net/modules/newbb/viewtopic.php?forum=5&post_id=4922&topic_id=1488

ndex: LC_Page_Products_List.php
===================================================================
--- LC_Page_Products_List.php
+++ LC_Page_Products_List.php
@@ -438,11 +438,18 @@
 
         // 商品名をwhere文に
         $name = ereg_replace(",", "", $name);
-        if ( strlen($name) > 0 ){
-            $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) ";
-            $ret = SC_Utils_Ex::sfManualEscape($name);
-            $arrval[] = "%$ret%";
-            $arrval[] = "%$ret%";
+        //全角スペースを半角スペースに変換
+        $name = str_replace(' ', ' ', $name);
+        //スペースでキーワードを分割
+        $names = preg_split("/ +/", $name);
+        //分割したキーワードを一つずつwhere文に追加
+        foreach ($names as $val) {
+            if ( strlen($val) > 0 ){
+                $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) ";
+                $ret = SC_Utils_Ex::sfManualEscape($val);
+                $arrval[] = "%$ret%";
+                $arrval[] = "%$ret%";
+            }
         }
 
         if (empty($arrval)) {


Change History

comment:1 Changed 16 years ago by adachi

  • Version changed from 2.0系(ベータ版) to 2.0系(正式版)

comment:2 Changed 16 years ago by adachi

  • Milestone changed from EC-CUBE2.0 to EC-CUBE2.3.0

comment:3 Changed 16 years ago by adachi

  • Priority changed from to

comment:4 Changed 16 years ago by adachi

  • Owner changed from somebody to adachi

comment:5 Changed 16 years ago by adachi

  • Status changed from new to closed
  • Resolution set to 修正済

r17506で反映しました。

Note: See TracTickets for help on using tickets.