steeevo Posted August 13, 2015 Share Posted August 13, 2015 I've just started reorganizing one of my websites products categories which relies heavily on the order of the categories for SEO purposes. in the SEO URLs config options there is an option in there that says" Add category parent to begining of URLs?" which I have set to true. in the past I've only have 2 levels of categories so it behaved as expected creating URLs as such: http://webiste.com/main-category-sub-category1-c-1.htmlhowever I've added another level of categories and would like the URL to read as such: http://webiste.com/main-category-sub-category1-sub-category2-c-1.html but I'm getting: http://webiste.com/sub-category1-sub-category2-c-1.htmlit only pulls in the parents category name one level up.. not all the way to the top. I have found in the seo.class.php file the following code which I believe controls this url structure which reads as so: case ($this->attributes['SEO_ADD_CAT_PARENT'] == 'true'): $sql = "SELECT c.categories_id, c.parent_id, cd.categories_name as cName, cd2.categories_name as pName FROM ".TABLE_CATEGORIES." c JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd ON c.categories_id = cd.categories_id LEFT JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd2 ON c.parent_id=cd2.categories_id AND cd2.language_id='".(int)$this->languages_id."' WHERE c.categories_id='".(int)$single_cID."' AND cd.categories_id='".(int)$single_cID."' AND cd.language_id='".(int)$this->languages_id."' LIMIT 1"; $result = $this->DB->FetchArray( $this->DB->Query( $sql ) ); $cName = $this->not_null($result['pName']) ? $result['pName'] . ' ' . $result['cName'] : $result['cName']; break; Can anyone help me modify the code so the URL structure is what I'm needing?Thanks ahead of time for the help Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 13, 2015 Share Posted August 13, 2015 The full parent parent path is in the url if the product is reached by clicking to it. That is, if you click on category A and then on its sub-category B and then the product, the url will a-b in it. But if you go directory to a product through something like the what's new box, only the immediate category will show. You will need to add a function to get the path of category ID's along with their names and build the string from that. That could slow the response time down quite a bit and may not be correct if you have linked products. I suggest leaving it as it is and using the google XML sitemap addon to let the search engines know where to look. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
steeevo Posted August 13, 2015 Author Share Posted August 13, 2015 when I view a product, the url is made up of the products title and no categories are listed with it. which is fine. This is what I want. my concern is only with subcategories. the site map is irrelevant being that my main concern is that i want all parent categories used in sub categpry urls. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 13, 2015 Share Posted August 13, 2015 If you want the full path, you will need to change the code as mentioned. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons 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.