spooks Posted May 2, 2008 Share Posted May 2, 2008 (edited) This is the forum for the Display matching categories in search results contribution This contribution will display matching categories results where the name matches the search, if you have the category description mod (http://www.oscommerce.com/community/contributions,2343), there is code to include that too. Also included is code if you have my hide categories contribution (http://addons.oscommerce.com/info/5907). Included here is an sql query to add a setting in admin to control category search. If a category is selected in the search, then only that (and subcategories if option set) are searched. The from / to date filters are also applied. I`ve also added an option to search categories only. During the writing of this I found what appears to me to be a vulnerability in the search form in OSC2.2 rc1 where it could be used by a malicious attacker to inject sql or code. I have added a trap in advanced_search_result.php for this. Contribution is found at http://addons.oscommerce.com/info/5918 I hope you all find this useful. :thumbsup: Edited May 2, 2008 by spooks Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
webmaster69 Posted May 19, 2008 Share Posted May 19, 2008 Been away for a few weeks, now back and can't wait to have a look at Sam's contribution. I dont have the category description mod, had a look at adding it but code conflicts with SEO contribution I have installed so diidn't add it. also don't have the hide categories contribution installed. Followed the instructions a couple of times and can't get it to work, when I perform a search the following error occurs: Products meeting the search criteria There is no product that matches the search criteria. HEADING_TITLE_3 1054 - Unknown column 'cd.categories_id' in 'field list' select count(distinct cd.categories_id) as total from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where cd.categories_id = c.categories_id and cd.language_id = '1' and ((cd.categories_name like '%dx9000%') ) [TEP STOP] Quote Link to comment Share on other sites More sharing options...
spooks Posted May 20, 2008 Author Share Posted May 20, 2008 Hi, sorry, there`s a missing instruction, I`ll update the contrib when I get time, for now in advanced_search_result.php after the $select_str = "select distinct cd.categories_name, cd.categories_id"; add: $from_str = " from " . TABLE_CATEGORIES_DESCRIPTION . " cd left join " . TABLE_CATEGORIES . " c on cd.categories_id "; there`s also a couple of entries in the advanced_search language file missing from the instructions (Its is all there in the included files). At the end before the final ?> add: define('TEXT_SEARCH_CATEGORIES_ONLY', 'Search Categories Only'); define('HEADING_TITLE_3', 'Categories meeting the search criteria'); Cheers :blush: Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
webmaster69 Posted May 20, 2008 Share Posted May 20, 2008 Thanks for this great contribution, it works really well. Would it be possible to add a further mod? On the bottom of the product info page it would be great if it was possible to add a table and list all the categories that that product was in. If these could by hyperlinks to the category it would be amazing. Thanks Frank Quote Link to comment Share on other sites More sharing options...
concorde44 Posted May 21, 2008 Share Posted May 21, 2008 Hi Spooks, sounds good. Where can I see the result ? Seb Quote Osc 2.2 MS2 Link to comment Share on other sites More sharing options...
Guest Posted July 26, 2008 Share Posted July 26, 2008 (edited) Hello. Great Contrib - been searching for very long :D Unfortunately it just lists the category itself but for me it would be better to see the whole breadcrumb or category tree instead XXX-AAA->KEYWORD instead of just KEYWORD Can someone help me out?? Edited July 26, 2008 by Sir.K.O. Quote Link to comment Share on other sites More sharing options...
spooks Posted July 26, 2008 Author Share Posted July 26, 2008 Hello. Great Contrib - been searching for very long :D Unfortunately it just lists the category itself but for me it would be better to see the whole breadcrumb or category tree instead XXX-AAA->KEYWORD instead of just KEYWORD Can someone help me out?? Its possible, I'll take a look. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
spooks Posted July 27, 2008 Author Share Posted July 27, 2008 Uploaded new version 1.2 Result will now display the full category tree for the matching category with matching highlighted. Added switches at start of files to simplify install: . $cat_desc=false;//set to true if you have category descriptions $cat_stat=false;//set to true if you have hide category mod $short=false; //set to true if you have short product descriptions Changed Files: category_listing.php, advanced_search.php & advanced_search_result.php Tested on PHP 4 & 5, SQL 4 & 5, osC 2.2 ms2, rc1 & rc2a and is register_globals compatible. :) Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
spooks Posted July 28, 2008 Author Share Posted July 28, 2008 Uploaded new version 1.3 Added option to position category results above or below product results. Changed Files: category_listing.php, category_search_result.php, advanced_search_result.php & additional sql query. Tested on PHP 4 & 5, SQL 4 & 5, osC 2.2 ms2, rc1 & rc2a and is register_globals compatible. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted July 28, 2008 Share Posted July 28, 2008 WOW! Fast & PERFECT Support! Thanks, will take a closer look as soon as possible Quote Link to comment Share on other sites More sharing options...
spooks Posted July 28, 2008 Author Share Posted July 28, 2008 Thanks for replying, too many don't. I hope you find it usefull. :) Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted August 7, 2008 Share Posted August 7, 2008 OK My site is able to populate the categories, but full paths are not added to the category links (ie 284_450_877) when using the search capability. The links only show in this case the last 3 digits _877. The left column where categories are shown include the full paths of those categories/subcategories/sub_subcategories as it should be; and thus able to show the category pages when clicked on such links. Please your help with this matter will be truly appreciated. Justino Quote Link to comment Share on other sites More sharing options...
spooks Posted August 7, 2008 Author Share Posted August 7, 2008 OKMy site is able to populate the categories, but full paths are not added to the category links (ie 284_450_877) when using the search capability. The links only show in this case the last 3 digits _877. The left column where categories are shown include the full paths of those categories/subcategories/sub_subcategories as it should be; and thus able to show the category pages when clicked on such links. Please your help with this matter will be truly appreciated. Justino Although it does not show parent categories in link, does it not still link to the correct category?, Do you have a url? Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
spooks Posted August 7, 2008 Author Share Posted August 7, 2008 Although it does not show parent categories in link, does it not still link to the correct category?, Do you have a url? I would add the only purpose for the extra cat info in the url is to enable the original category box to display the path, however producing it is done with a lot of extra queries, my routine does just one. Not having the full path mearly makes the original category box show blank. As most people dont use the original box this should rarely be a problem. On a busy site the extra queries the old box uses would be reason enough to get rid. If this is a real problem I`ll look at a mod, but would avoid adding any more queries. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2008 Share Posted August 11, 2008 Although it does not show parent categories in link, does it not still link to the correct category?, Do you have a url? Yep, but only link to the top categories where only the first digits are shown in the links. See http://www.equipaxxess.org Quote Link to comment Share on other sites More sharing options...
spooks Posted August 11, 2008 Author Share Posted August 11, 2008 Yep, but only link to the top categories where only the first digits are shown in the links.See http://www.equipaxxess.org there appears to be an error in your index.php where its loosing the $current_category_id, since you will note the breadcrumb is set to the category, but index don`t go there I`ll look at a mod when I get time anyway. I would also point a problem you have, on your product listing, sometimes the product link includes the cpath, sometimes not this is not a problem for osC as if cpath is not set it gets the path to the product anyway. It is a problem for you, google will index same product with different paths, & detect duplicate content & so penalise you. Remove cpath refrences to product in the listing, or add rel="nofollow", same for manufacturer. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2008 Share Posted August 11, 2008 you are right, because the list given when doing a search provide the path _887, rather that the right one which is say 284_450_877; therefore it defaults to the main index.php with a cpath=877 page which does not exist in my sts templates!. When you mention "Remove cpath refrences to product in the listing, or add rel="nofollow", same for manufacturer". What files am I suppose to modify?? Quote Link to comment Share on other sites More sharing options...
spooks Posted August 11, 2008 Author Share Posted August 11, 2008 product_listing.php see this thread http://www.oscommerce.com/forums/index.php?sho...t=#entry1290816 you could replace that with a better listing anyway Product Listing Enhancements, Thumbnails & Manufacturer Headings http://addons.oscommerce.com/info/6051 Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2008 Share Posted August 11, 2008 Many thanks Sam. Will Have a look at it. Bye for now Quote Link to comment Share on other sites More sharing options...
grayousious Posted August 27, 2008 Share Posted August 27, 2008 Something is up with mine... there is no error, but it just returns a large jumble of categories. Ever seen anything like this? http://www.toysonfire.ca/advanced_search_r...keywords=Batman Any advice would help. Cheers, Gray Quote Link to comment Share on other sites More sharing options...
spooks Posted August 28, 2008 Author Share Posted August 28, 2008 All related categories (category tree) are shown for every matching category in 1.3, that can produce a large list. I have uploaded V1.4, this add new options to category_listing.php: $cat_tree=true;//set to true to display the full tree of category (related categories), otherwise false. $duplicates=false;// Related categories are only shown with matching if they have not been shown already, set this to true to and it will show category from tree though its shown already. Changed Files: category_listing.php Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
grayousious Posted August 28, 2008 Share Posted August 28, 2008 Wow Sam! Amazing support. Thanks for the great contrib. I'll try out the 1.4. Cheers, Gray P.S. great avatar sam! Quote Link to comment Share on other sites More sharing options...
grayousious Posted August 28, 2008 Share Posted August 28, 2008 Works like a charm! How hard would it be for me to mod the category_listing.php to display the category image above the text? I'm not sure of the queries involved and the addition in the print block of code. Thanks again! -Gray Quote Link to comment Share on other sites More sharing options...
spooks Posted August 29, 2008 Author Share Posted August 29, 2008 after: $display = '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $listing['categories_id']) . '">'; add: $display .= tep_image(DIR_WS_IMAGES . $listing['categories_image'], $listing['categories_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) .'<br>'; and add c.categories_image, to query Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
grayousious Posted August 29, 2008 Share Posted August 29, 2008 Now that is gorgeous! You sir are the master. http://www.toysonfire.ca/advanced_search_r...ywords=superman Cheers, Gray Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.