osCommerce Community Support Forums: Expand fields in Admin search - osCommerce Community Support Forums

Jump to content

Corporate Sponsor


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Expand fields in Admin search Rate Topic: -----

#1 User is offline   mugitty Icon

  • Find Posts
  • Group: Community Member
  • Posts: 1,201
  • Joined: 18-December 02
  • Real Name:Stuart Owens
  • Location:Great Southeastern Washington Desert, USA

Posted 15 March 2003 - 09:28 AM

I asked this earlier but I'll try to be a little more specific with what I'm trying to accomplish.

It appears that when you search in the Admin area within the Category/Product area, that the search only keys on the product name or the category name, i.e. I search for "engine" and the return includes all folders with "engine" in their name and all individual products with "engine" in their name. I would like to expand this function so that if I enter a product_model number, I can also get a return that way. As it stands now, if I enter the model, I get no return.

It seems that the area of categories.php that would control this is here:
<?php

    }



    $products_count = 0;

    if ($HTTP_GET_VARS['search']) {

     $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_bimage, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by p.products_model");

    } else {

      $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_bimage, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . $current_category_id . "' order by p.products_model");

    }

    while ($products = tep_db_fetch_array($products_query)) {

      $products_count++;

      $rows++;

Can anyone help with how to amend this so I can get a return on product_model in addition to the currently returned results?

Thanx :)
... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,
try being a Foster Parent!
0

#2 User is offline   mugitty Icon

  • Find Posts
  • Group: Community Member
  • Posts: 1,201
  • Joined: 18-December 02
  • Real Name:Stuart Owens
  • Location:Great Southeastern Washington Desert, USA

Posted 16 March 2003 - 05:25 PM

Well, I managed to get the Admin search in the Categories/Products area so I can search on an item's model # instead of the name. In the query
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_bimage, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by p.products_model");

I changed
pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%'

to
p.products_model like '%" . $HTTP_GET_VARS['search'] . "%'

which is great since I usually am going to readily know the products' model number (mine are all unique) if I want to find an item to make an amendment.

What I haven't been able to accomplish is to add this capability as well as keeping the original search on category or product name. I tried just adding a line with an "} else {" statement using the original "pd.products_name", but I get a parse error on the line that contains the additional "} else {"

Anyone have a solution?
:?
... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,
try being a Foster Parent!
0

#3 User is offline   clarocque Icon

  • Find Posts
  • Group: Community Member
  • Posts: 554
  • Joined: 31-August 03
  • Real Name:Chris
  • Location:VT/USA

Posted 07 March 2004 - 07:33 AM

OK I figured out the same as above except I tried to add another }else{ statement and add the original string back in but it wont take it???

Any ideas? Thjis is what I tried
[CODE]
<?php

}



$products_count = 0;

if ($HTTP_GET_VARS['search']) {

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_bimage, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_model like '%" . $HTTP_GET_VARS['search'] . "%' order by p.products_model");

} else {

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_bimage, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' order by p.products_name");

} else {


$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_bimage, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . $current_category_id . "' order by p.products_model");

}

But I get

Parse error: parse error in /Library/WebServer/Documents/loaded64/admin/categories.php on line 2225

which is the second else???

Help please.

This post has been edited by clarocque: 07 March 2004 - 07:36 AM

osC Contributions I have published.

Note: Some I only provided minor changes, updates or additions!
0

#4 User is offline   bravejoey Icon

  • Find Posts
  • Group: Community Member
  • Posts: 8
  • Joined: 18-January 04
  • Real Name:Chris
  • Location:Los Angeles, CA

Post icon  Posted 07 March 2004 - 08:20 AM

Quote

What I haven't been able to accomplish is to add this capability as well as keeping the original search on category or product name. I tried just adding a line with an "} else {" statement using the original "pd.products_name", but I get a parse error on the line that contains the additional "} else {"

Anyone have a solution?


What about something like this? Notice the added ()'s and the OR statement.

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_bimage, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and (pd.products_name like '%" . $HTTP_GET_VARS['search'] . "%' or p.products_model like '%" . $HTTP_GET_VARS['search'] . "%') order by p.products_model");

This post has been edited by bravejoey: 07 March 2004 - 08:21 AM

0

#5 User is offline   clarocque Icon

  • Find Posts
  • Group: Community Member
  • Posts: 554
  • Joined: 31-August 03
  • Real Name:Chris
  • Location:VT/USA

Posted 07 March 2004 - 08:32 AM

Ya I just got it to work with " or" I was coming to post it and saw your reply.

Thanks anyway
osC Contributions I have published.

Note: Some I only provided minor changes, updates or additions!
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic