Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New Product Field


Recommended Posts

I just completed adding five (5) new fields for a bookstore into the "Products" table. Everything is working as planned though the only gliche is that the new fields (p.products_author, p.products_contributor, p.products_pubdate, p.products_binding, p.products_location) doesn't seem to get queried when searching via admin/categories.php. The new coding pertaining to the searcch is below. Any obvious errors or considerations? There are no errors logged and the page refreshes though the results are null.

Thanks for any input! :blush:

 

    $products_count = 0;
   if (isset($_GET['search'])) {
		//find an item with search function
		$products_query = tep_db_query("SELECT 
			p.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_author, p.products_contributor,
               p.products_pubdate,	p.products_binding, p.products_location, p.products_image, p.products_codebar,
               p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, 
			pi.products_image1, pi.products_image2, pi.products_image3, pi.products_image4, pi.products_image5,
			pi.products_image6, pi.products_image7, pi.products_image8, pi.products_image9, 
			p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status,
			p2c.categories_id 
			FROM (".TABLE_PRODUCTS." p LEFT JOIN ".TABLE_PRODUCTS_IMAGES." pi ON p.products_id = pi.products_id) 
			INNER JOIN ".TABLE_PRODUCTS_DESCRIPTION." pd ON p.products_id = pd.products_id
			INNER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." p2c ON p.products_id = p2c.products_id
			WHERE pd.language_id = '" . (int)$languages_id . "' 
			AND pd.products_name like '%" . tep_db_input($search) . "%' 
			ORDER BY pd.products_name");     
		} else {
		//find an item with tree structure
		$products_query = tep_db_query("SELECT 
			p.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_author, p.products_contributor, 
               p.products_pubdate, p.products_binding, p.products_location, p.products_image, p.products_codebar,
			p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, 
			pi.products_image1, pi.products_image2, pi.products_image3, pi.products_image4, pi.products_image5,
			pi.products_image6, pi.products_image7, pi.products_image8, pi.products_image9, 
			p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status
			FROM (".TABLE_PRODUCTS." p LEFT JOIN ".TABLE_PRODUCTS_IMAGES." pi ON p.products_id = pi.products_id) 
			INNER JOIN ".TABLE_PRODUCTS_DESCRIPTION." pd ON p.products_id = pd.products_id
			INNER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." p2c ON p.products_id = p2c.products_id
			WHERE pd.language_id = '" . (int)$languages_id . "' 
			AND p2c.categories_id = '" . (int)$current_category_id . "' 
			ORDER BY pd.products_name");
		}

WhatsTheBigIdea.com, Inc.

Bright Ideas for the Web, Print and beyond!

 

100 Dock Street

Saugerties, NY 12477

(845)247-0909

Link to comment
Share on other sites

After some searching I found http://www.oscommerce.com/community/contri...ons,1648/page,2 and changed the line below to the line below it:

 

AND pd.products_name like '%" . tep_db_input($search) . "%'

AND (pd.products_name like '%" . tep_db_input($search) . "%' or p.products_model like '%" . tep_db_input($search) . "%')

 

It worked for searching products_model, though ofcourse the remaining five (5) fields don't query when searched.

 

Should I add the addt'l ## or p.products_author like '%" . tep_db_input($search) . "%' ## , etc?

 

Thanks for any direction.

WhatsTheBigIdea.com, Inc.

Bright Ideas for the Web, Print and beyond!

 

100 Dock Street

Saugerties, NY 12477

(845)247-0909

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...