Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2008
    Posts
    192
    Plugin Contributions
    0

    Default Searching orders for product name

    php7.2
    zencart 1.56c
    mysql 5.7x

    Not sure if this is a bug or by design -

    When using the product search box to search through orders, results are only returned if the searched word or phrase is at the beginning of the product title.

    For example, let's say I've sold some Blue Widgets and some Green Widgets. If I use the orders product search to find orders where I've sold "Widgets" (of any kind), I get no results at all because Widgets is not at the beginning of the product title.

    Searching for "Blue Widgets" or "Green Widgets" works fine since those words appear at the beginning of the product title but searching for a word that is contained in the product title but is not at the beginning does not return a result.

    Ed

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,408
    Plugin Contributions
    88

    Default Re: Searching orders for product name

    'tis a bug. Edit /admin/orders.php, locating this section (starting at line 872 in the as-shipped zc156c version):
    Code:
    // create search_orders_products filter
                      $search = '';
                      $search_distinct = ' ';
                      $new_table = '';
                      $new_fields = '';
                      if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) {
                        $search_distinct = ' distinct ';
                        $new_table = " left join " . TABLE_ORDERS_PRODUCTS . " op on (op.orders_id = o.orders_id) ";
                        $keywords = zen_db_input(zen_db_prepare_input($_GET['search_orders_products']));
                        $search = " and (op.products_model like '%" . $keywords . "%' or op.products_name like '" . $keywords . "%')";
                        if (substr(strtoupper($_GET['search_orders_products']), 0, 3) == 'ID:') {
                          $keywords = TRIM(substr($_GET['search_orders_products'], 3));
                          $search = " and op.products_id ='" . (int)$keywords . "'";
                        }
                      } else {
    ... and change to
    Code:
    // create search_orders_products filter
                      $search = '';
                      $search_distinct = ' ';
                      $new_table = '';
                      $new_fields = '';
                      if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) {
                        $search_distinct = ' distinct ';
                        $new_table = " left join " . TABLE_ORDERS_PRODUCTS . " op on (op.orders_id = o.orders_id) ";
                        $keywords = zen_db_input(zen_db_prepare_input($_GET['search_orders_products']));
                        $search = " and (op.products_model like '%" . $keywords . "%' or op.products_name like '%" . $keywords . "%')";
                        if (substr(strtoupper($_GET['search_orders_products']), 0, 3) == 'ID:') {
                          $keywords = TRIM(substr($_GET['search_orders_products'], 3));
                          $search = " and op.products_id ='" . (int)$keywords . "'";
                        }
                      } else {

  3. #3
    Join Date
    Nov 2008
    Posts
    192
    Plugin Contributions
    0

    Default Re: Searching orders for product name

    Thank you. That fixed if for me.

 

 

Similar Threads

  1. Search box in Admin not searching in product name?
    By rudyh01 in forum Basic Configuration
    Replies: 6
    Last Post: 13 Dec 2011, 03:47 PM
  2. searching for a product module
    By jatoc in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 31 Jul 2011, 12:46 PM
  3. Search box not searching capitalized product name/model number
    By saitomedia in forum General Questions
    Replies: 2
    Last Post: 10 Feb 2010, 08:01 AM
  4. searching searching for this link
    By alwinch in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 12 Oct 2008, 06:41 PM
  5. Searching orders for certain products?
    By paults in forum General Questions
    Replies: 1
    Last Post: 5 Jul 2007, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR