spoofy Posted January 24, 2011 Share Posted January 24, 2011 Problem- Product: Running Shoes In Categories: Red Shoes Blue Shoes The issue occurs when you create a product in let's say Red Shoes and link it in Blue Shoes. When a customer is browsing the category Blue Shoes and goes to the product Running Shoes, the bread crumb trail and the menu on the left hand side is highlighted as Red Shoes. This is because the product resides in the category of Red Shoes. Accurate to an extent, but the idea of bread crumb is to show the user how he/she got there. Solution- With this small addition which checks for referers will work 97% of the time based on some stats I picked up on some webmaster blogs and forums. For the remainder 3% it won't work but you have nothing to loose. Please note that this modification only works if you are using the Ultimate SEO URLs by FWR Media. It is compatible with the old version USU5 and the new one USU5 Pro. open /catalog/includes/functions/general.php find: function tep_get_product_path($products_id) { immediately after that, paste the following code: // we will check to see if a referer is available. // if a referer is available we will explode it to ensure that any parameters such as ?action=blah are not used if (isset($_SERVER['HTTP_REFERER'])) { $referer = $_SERVER['HTTP_REFERER']; if (stristr($referer, '.html?')) { list($referer, $query_string) = explode("?", $referer); } } else { $referer = 'Referer Not Available'; } // we will check to see if the referer matches with our url // we will also check to see if the url has -c-2.html or -c-2_1.html (used for defining categories) // if it matches, then we will extract the value for the category path and assign it to $cPath if ((stristr($referer, HTTP_SERVER . DIR_WS_HTTP_CATALOG)) && (stristr($referer, '-c-')) && (stristr($referer, '.html')) && (preg_match('/-c-(\d+(?:_\d+)?)\.html$/i',$referer))) { preg_match('/-c-(\d+(?:_\d+)?)\.html$/i',$referer, $matches); if (isset($matches[1])) { $cPath = $matches[1];} else { } } else { About 14 to 18 lines below that you will find } return $cPath; } Replace that with: } } return $cPath; } And voila! you are done. Quote My Contributions: Google XML Sitemap SEO compatible with Ultimate SEO URL by FWR Media ::: Accurate & Precise Bread Crumb Trail Link to comment Share on other sites More sharing options...
spoofy Posted January 24, 2011 Author Share Posted January 24, 2011 The contribution is also live in the Add-Ons sections: http://addons.oscommerce.com/info/7790 Quote My Contributions: Google XML Sitemap SEO compatible with Ultimate SEO URL by FWR Media ::: Accurate & Precise Bread Crumb Trail 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.