Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order Search by Product Name?


JangoF

Recommended Posts

Hi all,

 

Well I know there is acontribution for searching by customer name in the Order page, but was wondering if it is possible to search by Product Name in the Order page - and thus return all the orders that have the product in them? If so, how could this be done?

Link to comment
Share on other sites

You'd need to custom code a module that loops through your orders and grabs all that have that specific item from your search field. I've done similar mods before ... takes to long to code to be done as a free forum answer though.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

I understand. Well I am just trying to tinker around with the code from the original contribution (http://www.oscommerce.com/community/contributions,5197/) to see if I can get it working somehow.

 

$search_query_pn = null;

if ( isset($_GET['pn']) && $_GET['pn']!="" ){

 

$search_query=$_GET['pn'];

 

$pn_array = explode(' ', ($search_query_pn));

$pn_product = '(op.products_name LIKE \'%' . $pn_array[0] . '%\'';

// more than one search term

for ($i = 1 ; $i < sizeof($pn_array) ; $i++) {

$pn_product .= ' OR op.products_name LIKE \'%' . $pn_array[$i] . '%\'';

}

$pn_product .= ')';

$search_query_pn = ' AND (' . $pn_product . ')';

 

}

 

Obviously this won't work as there is no query in orders.php that fetches products_name from orders_orders_products.

Link to comment
Share on other sites

yup, that what I meant, you'll need to write it all (takes time, LOL - did I mention that?)

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...