defender39 Posted April 24, 2004 Share Posted April 24, 2004 I have at my site displayed sold out items. I want this so that search engines can see the pages and also so that users can select product notification and when an item is added they will get an email...anyways..I hear complaints because there isnt a way to search the site for in stock items only. So I went and added a variable to advanced_search.php and thats fine...but after looking at advanced_search_results.php I am a little over my head. Has anyone done this? It would be very handy for those of us displaying sold out items. my site is videogamedeals.com if you want to see the advanced search page the variable I created is inst and its a checkbox I am just not sure how to add it to the results yet. I would think I have to change a query an add an if statement I think..I gotta go look again..any help would be great. I am MS1 but I am pretty sure that the MS2 file is about the same. If you make changes to that just let me know what the changes are. Thank you for any help and this could be useful for any users. Link to comment Share on other sites More sharing options...
♥yesudo Posted April 24, 2004 Share Posted April 24, 2004 I am on MS2 so maybe different but try: In advanced_search_result.php find: $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id "; and replace with: $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_quantity > '0'"; Your online success is Paramount. Link to comment Share on other sites More sharing options...
defender39 Posted April 24, 2004 Author Share Posted April 24, 2004 I prefer to have this optional so this is the code I have tried: //+++++++++++++++++++++++++++++++++++++++++ if (isset($HTTP_GET_VARS['inst']) && tep_not_null($HTTP_GET_VARS['inst'])) { if ($HTTP_GET_VARS['inst'] == '1') { $where_str .= "and p2c.products_id where p.products_quantity > '0'"; } } //++++++++++++++++++++++++++++++++++++++++++ I get this error on that code: 1064 - You have an error in your SQL syntax near 'where p.products_quantity > '0' and ((pd.products_name like '%test%' or p.produc' at line 1 select count(*) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.products_id where p.products_quantity > '0' and ((pd.products_name like '%test%' or p.products_model like '%test%' or m.manufacturers_name like '%test%') )order by p.products_date_added desc [TEP STOP] Link to comment Share on other sites More sharing options...
♥yesudo Posted April 24, 2004 Share Posted April 24, 2004 $where_str .= "and p2c.products_id where p.products_quantity > '0'"; Doesn't seem correct - should it be something like: $where_str .= "and p2c.products_id = p.products_id where p.products_quantity > '0'"; or $where_str .= "and p2c.products_id = p.products_id and p.products_quantity > '0'"; Your online success is Paramount. Link to comment Share on other sites More sharing options...
defender39 Posted April 24, 2004 Author Share Posted April 24, 2004 GOT IT! After that string you have I added this: //+++++++++++++++++++++++++++++++++++++++++ if (isset($HTTP_GET_VARS['inst']) && tep_not_null($HTTP_GET_VARS['inst'])) { if ($HTTP_GET_VARS['inst'] == '1') { $where_str .= "and p.products_quantity > '0'"; } } //++++++++++++++++++++++++++++++++++++++++++ I also had to add this line to the top code where the http_get_vars are read '&inst=' . $HTTP_GET_VARS['inst'] . also in the advanced_search.php I added a checkbox to the appropriate area: ' <tr>' . "\n" . ' <td class="fieldKey">' . ENTRY_IN_STOCK . '</td>' . "\n" . ' <td class="smallText">' . tep_draw_checkbox_field('inst', '1', true) . ' ' . ENTRY_INSTOCK_ONLY . '</td>' . "\n" . ' </tr>' . "\n" . and then added to the language file for advanced_search.php the 2 definitions: define('ENTRY_IN_STOCK', 'Stock:'); define('ENTRY_INSTOCK_ONLY', 'Include items in stock only'); and waaa laaa! done. now you can get a checkbox for advanced search to look for items that are in-stock only..you can set the checkbox to false if you dont want that as default Link to comment Share on other sites More sharing options...
defender39 Posted April 25, 2004 Author Share Posted April 25, 2004 deleted double post Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.