Making the 'quick search' feature search by a product code

In default CS-Cart quick search searches by product name and description.

To make the 'quick search' feature search by a product code:
  1. Open the search_products.php file located in the include/common directory of your CS-Cart installation.
  2. Find and replace the following part of code there:
    foreach ($pieces as $piece) {
            $tmp = array();
            if ($search_data['search_product_name'] == 'Y') {
                $tmp[] = "descr1.product LIKE '%$piece%'";
            }
            if ($search_data['search_short_description'] == 'Y') {
                $tmp[] = "descr1.short_description LIKE '%$piece%'";
            }

    with this one:
    foreach ($pieces as $piece) {
            $tmp = array();
            if ($search_data['search_product_name'] == 'Y') {
                $tmp[] = "descr1.product LIKE '%$piece%'";
            }
            if ($search_data['search_product_name'] == 'Y') {
                $tmp[] = "products.product_code LIKE '%$piece%'";
            }
            if ($search_data['search_short_description'] == 'Y') {
                $tmp[] = "descr1.short_description LIKE '%$piece%'";
            }
  3. Save the file.

Noticed an error in the article or it is not clear enough? Any suggestions to improve it? Please let us know by filling in the feedback form. Click here.