nick2010 Posted August 12, 2010 Share Posted August 12, 2010 Hi,I'm working on a Prestashop project,As I'm working on a clothing store, and because it will be dealing with Men and Women's clothing I want the ability to distinguish between categories, and subcats.I'm trying to work out how to do the following:If I have a category called 'men', and within that, a sub-category called 'jackets', the URL still shows as http://prestashop/men/14-test-jacket.htmland'>http://prestashop/men/14-test-jacket.htmland doesn't show as /men/jackets/14-test-jacket.html, is there any way of getting sub categories to show up in the URLs so you can see which sub-category you're viewing.Also the sub-category doesn't show up in the breadcrumbs. I assume it may be possible with .htaccess. But I have limited knowledge of that.Any help would be greatly appreciated.EDIT: so I found http://www.openscriptsolution.com/2010/05/03/how-to-remove-category-id-from-url-of-prestashop-version-1-2-5/, which removes the catagory IDs fom the url,I also worked out that I can do something like this in the .htaccess file: RewriteRule ^men/jackets$ category.php?id_category=26 [QSA,L,E]Which re-writes the URL as http://shop.prestashop/men/jackets, the problem now is that the sidebar still points to /jackets/ and not /men/jackets/, And I can't see where in the Link.php file it's even possible to make that change!Ultimately this is what I want to accomplish. It seems to be very difficult to have a sensible structure, likehttp://prestashop/men/http://prestashop/men/jackets/http://prestashop/men/jackets/product-here.htmlhttp://prestashop/women/http://prestashop/women/jackets/http://prestashop/women/jackets/another-product-here.html Link to comment Share on other sites More sharing options...
nick2010 Posted August 13, 2010 Author Share Posted August 13, 2010 Can anyone help ?Is there no way of getting the sub category to show up in the URL, like this ??http://prestashop/men/http://prestashop/men/jackets/http://prestashop/men/jackets/product-here.htmlhttp://prestashop/women/http://prestashop/women/jackets/http://prestashop/women/jackets/another-product-here.html Link to comment Share on other sites More sharing options...
rocky Posted August 14, 2010 Share Posted August 14, 2010 It must be possible, since Magento appears to do it, but I think it would be very difficult to do. You'd have to mess around with the .htaccess file and classes/Link.php. I'm not aware of any modules or mods that do this. I'm not sure whether it is worth the effort. It would be easier just to edit the friendly URL of the "Jackets" category in the "Mens" category and enter the friendly URL as mens-jackets and edit the friendly URL of the "Jackets" category in the "Womens" category and enter the friendly URL as "womens-jackets". Link to comment Share on other sites More sharing options...
nick2010 Posted August 14, 2010 Author Share Posted August 14, 2010 Yes I may have to do that. I guess that work around would be best, so thanks for that. As an .htaccess & classes/Link.php solution would mean you would need to manually add a re-write rule manually every time you added a new category with the link structure you wanted.I mean I did get the rewrite working with the .htaccess : RewriteRule ^men/jackets$ category.php?id_category=26 [QSA,L,E] That rewrites the link, but the only thing I can't do is get the category links in the sidebar to show that link structure, I guess it's to do with the classes/Link.php file, but I don't know what to change in it to get the link structure I want. So as you said it's probably not worth the effort. Link to comment Share on other sites More sharing options...
rocky Posted August 14, 2010 Share Posted August 14, 2010 Yep, you'd need to modify the getCategoryLink() function in classes/Link.php and add a loop that continues to get the parent category and add it's friendly URL to the front until category 1 is reached. Link to comment Share on other sites More sharing options...
bahamut100 Posted August 23, 2010 Share Posted August 23, 2010 I try to do it too, but without success Link to comment Share on other sites More sharing options...
Shannon Cole Posted November 18, 2011 Share Posted November 18, 2011 It must be possible, since Magento appears to do it, but I think it would be very difficult to do. You'd have to mess around with the .htaccess file and classes/Link.php. I'm not aware of any modules or mods that do this. I'm not sure whether it is worth the effort. It would be easier just to edit the friendly URL of the "Jackets" category in the "Mens" category and enter the friendly URL as mens-jackets and edit the friendly URL of the "Jackets" category in the "Womens" category and enter the friendly URL as "womens-jackets". I don't know about prestashop, but this can't be very hard for an experienced coder. I see /category/subcategory/page.html in most ecommerce sites and wordpress blogs. frankly, I see this on most sites online. I rarely if at all see categoryid+friendlyname. Link to comment Share on other sites More sharing options...
dric83 Posted August 2, 2012 Share Posted August 2, 2012 Yep, you'd need to modify the getCategoryLink() function in classes/Link.php and add a loop that continues to get the parent category and add it's friendly URL to the front until category 1 is reached. This is exactly what I would like to do ... Could you help us Rocky ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now