Jump to content
HA!*!*Y

[Override] Friendly Urls Without Id Number For V1.5

Recommended Posts

if use Route to products: {categories:/}{rewrite}{-:ean13}.html , url is like:

 

www.mysite.com/root/home/accessories-ipod/ecouteurs-a-isolation-sonore-shure-se210-blanc.html?product_rewrite=ecouteurs-a-isolation-sonore-shure-se210-blanc

 

if use only {rewrite}{-:ean13}.html url is ok ... what is the point ?

Share this post


Link to post
Share on other sites

if use Route to products: {categories:/}{rewrite}{-:ean13}.html , url is like:

 

www.mysite.com/root/home/accessories-ipod/ecouteurs-a-isolation-sonore-shure-se210-blanc.html?product_rewrite=ecouteurs-a-isolation-sonore-shure-se210-blanc

 

if use only {rewrite}{-:ean13}.html url is ok ... what is the point ?

 

It's up-to you, if you want you could do only: {rewrite}.html

 

Are you using multishop?

Edited by HA!*!*Y

Share this post


Link to post
Share on other sites

Hi, I have applied your fix and it works perfectly. The only problem is that the link does not work from home or the CMS any ideas?

 

thanks

 

P.D: sorry for my english :P

Share this post


Link to post
Share on other sites

This works fine on one site both in categories and products but in another site I tested this on today the category URL is getting a %20 added to the URL /%20rocking-horses/ any idea, have I missed something.

Edited by tdr170

Share this post


Link to post
Share on other sites

This works fine on one site both in categories and products but in another site I tested this on today the category URL is getting a %20 added to the URL /%20rocking-horses/ any idea, have I missed something.

 

there is a space in your URL rewright link you can remove it by editing the items SEO URL

 

http://www.w3schools...f_urlencode.asp

ASCII Character ----- URL-encoding

space ------------------ %20

Edited by HA!*!*Y

Share this post


Link to post
Share on other sites

...The only problem is that the link does not work from home or the CMS any ideas? ...

 

Where on the home & where/what CMS page?

 

Can you send me the page url or an screenshot of it?

Share this post


Link to post
Share on other sites

I'm sorry but i revert the changes on my site.

 

The problem was in all cms pages, if i click in a link to cms page the prestashop return 404 error.

 

I have installed the prestashop in a subfolder of my domain it can be the problem?

 

Thanks.

 

P.D: tomorrow i will reinstall your fix, can i send a private message to see and check the problem? Lots of thanks dude

Edited by mrashole

Share this post


Link to post
Share on other sites

Hi! i Install copy the the files in to override folder:

 

/override/controllers/front/CategoryController.php - ok

/override/controllers/front/ProductController.php - ok

/override/classes/Dispatcher.php - error

 

And i have HTTP 500 (Internal Server Error)

 

whats problem?

Share this post


Link to post
Share on other sites

Thanks, but I'm a fool, I copied the files to the wrong folder

 

all ok, but main page not work (error 404) all other page with product - ok

Edited by aeroplah

Share this post


Link to post
Share on other sites

I'm testing the override in PS 1.5.2 demo store and it works! Great job.

It's very important to have the rigth values under Preferences > SEO:

 

Route to products: {categories:/}{rewrite}{-:ean13}.html

*Does not work with {category:/} see Bug report for a fix:http://forge.prestas...owse/PSCFV-4978

Route to category: {rewrite}/

*It must have a ending slash

Route to category with attribute selected_filter for the module block layered: {rewrite}/{selected_filters}

*moved the slash

 

Here are my 2 cents. In my demo store, the url of the products is the following:

http:// localhost/prestashop/root/home/category/product.html

 

To remove "/root/home" I used the solution proposed in this blog.

 

Basically, you have to modify getProductLink method from /classes/Link.php class and add this:

 

$cont = 0;

foreach ($product->getParentCategories() as $cat) {

$cont++;

if($cont>2)

$cats[] = $cat['link_rewrite'];

}

 

I've attached my modification, you've to add this file in /override/classes/

Link.php

Edited by cloder

Share this post


Link to post
Share on other sites

I've just tried this in 1.5.3.1 and it doesn't work.

 

Does anyone know the existence of this mod that works?

Share this post


Link to post
Share on other sites

Took me some time to figure out all the details, but now it works like a charm on prestashop 1.5.2, thanks a lot op!!

 

url now is: yoursite/en/laptops/macbook-air.html

 

if anyone wants help with that, contact me!

Share this post


Link to post
Share on other sites

Hi HA!*!*Y,

 

Awesome work and great.

 

Can you or someome tell me how to do this for cms? I want to make landing pages and i need to remove category for better ranking.

Edited by Abdul1987

Share this post


Link to post
Share on other sites

Hi,

I test again with Prestashop 1.5.3.1 and it's great for products and homepage.

 

Is someone know how to add parent categories to category url like this => "www.mysite/parent-category/category/

For moment I have this:

"www.mysite/parent-category/"

and

www.mysite/category/

Share this post


Link to post
Share on other sites

I found a way to:

 

- Remove IDs in products, categories, and also CMS (based on Ha!*!*Y work)

- Add ALL the parent categories to subcategories URLs!! (Little override in Link.php class)

 

I am refraining to share it with everyone because I saw that there are people who sell this mod (without the second feature). So no, I don't share for now...

 

I will post an example ASAP to prove I did it.

 

Can I talk with the DEVs so they can consider integrating it in next PS version?

Edited by lapy90

Share this post


Link to post
Share on other sites

PS 1.5.3.1

 

Homepage is not working (404)

checkout and order pages are not working either (404)

 

Categories and products show correct URLs!

 

Has anyone fixed the homepage and checkout?

 

Can I talk with the DEVs so they can consider integrating it in next PS version?

 

If you want the devs to integrate it, you need to add a bug at the forge, provide a patch (and possibily push it to github aswell)

Edited by EV Network

Share this post


Link to post
Share on other sites

To fix the home page try to set the URLs correctly in URL & SEO page:

 

probably you didn't set {rewrite}/ for category! (the position of the slash is important)

Share this post


Link to post
Share on other sites

Yes, my CMS URLs look like this content/11-about-us. How can I make it look like this /about-us ?

Edited by soldier

Share this post


Link to post
Share on other sites

hi, thanks for share your trick :) , it works great... but i have some problem with catalog links... when i apply your settings, the catalog shows some error, when i try to filter some product with color options (or any filters), it's didn't shows up as it should... for examples, i have 10 products with red color, when i choose to filter the red color, it shows all my products... not the ten products with red colors... well now i'm back with the default settings... maybe you can check it if you want... :) thank you

Share this post


Link to post
Share on other sites

I'm testing the override in PS 1.5.2 demo store and it works! Great job.

It's very important to have the rigth values under Preferences > SEO:

 

 

 

Here are my 2 cents. In my demo store, the url of the products is the following:

 

 

To remove "/root/home" I used the solution proposed in this blog.

 

Basically, you have to modify getProductLink method from /classes/Link.php class and add this:

 

 

 

I've attached my modification, you've to add this file in /override/classes/

 

Thanks for the link ;)

Share this post


Link to post
Share on other sites

hello,

I have a "big" problem

Remove the ids of the url...all working fine, but I realized that I did not mark the subcategories, as if not exist... are subcategories that has the same name eg "Alfa Romeo" is present in several categories like "turbos" "catalizadores"...I always go to the url to the first to create:

http://www.autostocks.es/alfa-romeo/

but no here.

http://www.autostocks.es/transmisiones-y-juntas-homocinéticas/alfa-romeo/

I can´t see the subcategories thats has the same name

 

I put the configuration of seo like a post:

products:{categories:/}{rewrite}{-:ean13}.html

categories:{rewrite}/

categories filters:{rewrite}/{selected_filters}

 

Im very desperated with this problem. Can you help me?

thanks

Share this post


Link to post
Share on other sites

Hi,

I test again with Prestashop 1.5.3.1 and it's great for products and homepage.

 

Is someone know how to add parent categories to category url like this => "www.mysite/parent-category/category/

For moment I have this:

"www.mysite/parent-category/"

and

www.mysite/category/

This topic/post might help you.

Share this post


Link to post
Share on other sites

PS 1.5.3.1

 

I have this problem:

 

Homepage is not working (404)

checkout and order pages are not working either (404)

 

Categories and products show correct URLs!

 

My configuration is this:

 

 

Route to products {category:/}{rewrite}.html

Route to category {rewrite}/

Route to category with attribute selected_filter for the module block layered {rewrite}{/:selected_filters}

Route to supplier {id}__{rewrite}

Route to manufacturer {id}_{rewrite}

Route to CMS page content/{id}-{rewrite}

Route to CMS category content/category/{id}-{rewrite}

Route to modules module/{module}{/:controller}

 

How do I fix the error?

Share this post


Link to post
Share on other sites

Hi,

I copied override files, and trying to change configuration, but getting this error:

  • Keyword "{id}" required for route "product_rule" (rule: "{categories:/}{rewrite}{-:ean13}.html")
  • Keyword "{id}" required for route "category_rule" (rule: "{rewrite}/")
  • Keyword "{id}" required for route "layered_rule" (rule: "{rewrite}/{selected_filters}")

What im doing wrong?

Share this post


Link to post
Share on other sites

Hi, I am getting the same error as user rycaga.

 

Someone posted "URL::b684af8ed06ee0b5134b7ec661f631c4-- This topic/post might help you."

 

What is the url? I can't follow that link.

Edited by raulj2000

Share this post


Link to post
Share on other sites

Hi, I am getting the same error as user rycaga.

 

Someone posted "URL::b684af8ed06ee0b5134b7ec661f631c4-- This topic/post might help you."

 

What is the url? I can't follow that link.

 

The url is:

http://www.prestashop.com/forums/index.php?/topic/220017-category-subcategory-url/page__view__findpost__p__1100612

But the topic is about how to add parent categories to url...

It's the answer to the Annino's question (Is someone know how to add parent categories to category url like this => "www.mysite/parent-category/category/)

Share this post


Link to post
Share on other sites

Thanks doubleD,

 

Does that mean that there is no way to hide the category id in the url?

 

Seems like it should be a pretty simple setting and i have not seen a site with the category id in the url..

 

What am i doing wrong?

Share this post


Link to post
Share on other sites

Thanks doubleD,

 

Does that mean that there is no way to hide the category id in the url?

 

Seems like it should be a pretty simple setting and i have not seen a site with the category id in the url..

 

What am i doing wrong?

I haven't tried this override, so can't tell your for sure.

 

And to say the truth i dont really bother about categories' id's in the url )

Share this post


Link to post
Share on other sites

i wont worry too much about it right now. The site isnt live yet.

 

Wouldn't the id in the url work against SEO ? I would imagine a cleaner, descriptive url would be best.

 

Thanks for your responses.

Share this post


Link to post
Share on other sites

i wont worry too much about it right now. The site isnt live yet.

 

Wouldn't the id in the url work against SEO ? I would imagine a cleaner, descriptive url would be best.

 

Thanks for your responses.

I don't believe that id will work against SEO... And i don't think that url ( cool-product) is better then (2-cool-product).

It's all about content.

Hey, look, there is a topic id in the address bar right now, but prestashop didn't become worse because of that :)

Share this post


Link to post
Share on other sites

Hey,

 

I know it's been awhile since posted ne update, but it's finally here.

the new files should fix all 404 errors, and remove all ID's

 

I would like to know if its working for everyone before i remove the beta notice..

So plz let me know here on the forum once you tested all out

 

http://www.prestashop.com/forums/topic/204935-override-friendly-urls-without-id-number-for-v15/

 

Thanks,

 

oh by the way it's 2am in CA, USA

who's buying me a cup of coffee... lol

Edited by HA!*!*Y

Share this post


Link to post
Share on other sites

Sorry it's just really late/early....

 

yes thank you for sending me your copy of CmsController.php

 

 

o boy...

 

I did not look at you files....

 

It's not included in the zip file (link.php)

 

ill have to look at later

Edited by HA!*!*Y

Share this post


Link to post
Share on other sites

I gave you also link.php that adds all the categories to the products URL and categories URL ! All without id

 

Adds all the categories to the product link: es,

www.shop.com/category1/category2/subcategory1/product.html

 

Adds all the categories to the category link: es,

www.shop.com/category1/category2/subcategory1/

 

+ all the previous features

 

I merged Happy's code with mine and smoothened some code, the only bug (in all versions) is that the cms categories URLs don't work... still figuring out why!

 

Download in the attachment

override-v23.zip

Edited by lapy90

Share this post


Link to post
Share on other sites

Thanks for this! Works fine, I needed to turn URL rewriting off and on again to get it working.

Share this post


Link to post
Share on other sites

Thanks for this! Works fine, I needed to turn URL rewriting off and on again to get it working.

 

Do the CMS category links work for you?

Share this post


Link to post
Share on other sites

Great work and Great news from BuB. Did you implement the changes on a live url? working smoothly? Which one did you use v22 or v23?

 

 

I tried as well, facing a few issues tho. It gives me an error when i try to remove {id} from products & cats routes. And as soon as I replace the dispatcher, 500 and i can't access it anymore, removed htacess but nothing. I'll keep trying...

Share this post


Link to post
Share on other sites

I gave you also link.php that adds all the categories to the products URL and categories URL ! All without id

 

Adds all the categories to the product link: es,

www.shop.com/category1/category2/subcategory1/product.html

 

Adds all the categories to the category link: es,

www.shop.com/category1/category2/subcategory1/

 

+ all the previous features

 

I merged Happy's code with mine and smoothened some code, the only bug (in all versions) is that the cms categories URLs don't work... still figuring out why!

 

Download in the attachment

 

working and using in production

categories doesn't work but whatever, I will wait for the next release.

 

thank you!

Share this post


Link to post
Share on other sites

@ Alexandru R. I haven't tried V23, but V22 is working right for me. I would advise to never test things on a live site, if you have the possibility to run an extra installation then test updates and modules on that one before using it live.

Edited by BuB

Share this post


Link to post
Share on other sites

@andrep this is not because of the override files it's do to a bug in some some version of prestashop 1.5 (http://forge.prestashop.com/browse/PSCFV-4978)

 

here is a override fill to fix it.

 

Also there is a function getPaginationLink that removes category_rewrite=accessories-ipod from urls in this file ill include it with next update soon.

 

hopefully i can mark it stable with the next update

 

http://127.0.0.1/accessories-ipod/?category_rewrite=accessories-ipod&orderby=name&orderway=desc

 

 

..

Link.php

Share this post


Link to post
Share on other sites

I am confused as to which file I should use on my 1.5.3.1 server. Is it one of the two attachments on Happy's first post? Or is it Lapy90's attachment on page 3?

 

Or maybe I wait for Happy's stable release? :-)

Edited by Maury Markowitz

Share this post


Link to post
Share on other sites

404 for home page, anyone have advise for that?

 

Look in SEO settings in admin. One of the lines either has a / at the end where it doesn't need it, or doesn't have one where it does need it. I can't recall which one though!

 

Hey Happy, the validator on the SEO admin page states the ID is needed in the "route to category with attribute" field. It does not need it.

Share this post


Link to post
Share on other sites

 

Adds all the categories to the product link: es,

www.shop.com/category1/category2/subcategory1/product.html

 

Adds all the categories to the category link: es,

www.shop.com/category1/category2/subcategory1/

 

 

the categories to the product link - Working

the categories to the category link - No Working ??????????

Share this post


Link to post
Share on other sites

@Maury Markowitz all you need to do is edit /override/classes/Dispatcher.php

 

remove:

, 'param' => 'id_category'

 

 'layered_rule' => array(
  'controller' => 'category',
  'rule' =>  '{rewrite}/filter/{selected_filters}',
  'keywords' => array(
'id' =>	array('regexp' => '[0-9]+', 'param' => 'id_category'),

 

But i think it was causing a 404 error somewhere ill test it out

Edited by HA!*!*Y

Share this post


Link to post
Share on other sites

Look in SEO settings in admin. One of the lines either has a / at the end where it doesn't need it, or doesn't have one where it does need it. I can't recall which one though!

 

Hey Happy, the validator on the SEO admin page states the ID is needed in the "route to category with attribute" field. It does not need it.

Ok, I'll check it. Links to home page redirects to some page from block cms.

Share this post


Link to post
Share on other sites

categories are working perfectly, with the slash at the end / - and if I remove it, so we have mysite.com/category instead of mysite.com/category/ - by removing it in categoryController and the SEO page, the categories and productpages are still working - but the mysite.com homepage reports 404

 

Is there a way to get categories without ending /

 

Regards

DAN

Share this post


Link to post
Share on other sites

@dm[x]goshopping.dk

 

The slash tells PS to look in the categories Database

if it's without it look for it the controller page in Database like mysite.com/sitemap, mysite.com/contact-us

 

there has to be a pattern to know what type of page it is that is why all product pages end with .html & CMS have /info/about-us & so on...

Share this post


Link to post
Share on other sites

Hello everyone,

 

in case anyone is having problems with v23 here's attached the correct settings for the seo page.

post-273160-0-00497800-1362220280_thumb.png

Edited by lapy90

Share this post


Link to post
Share on other sites

Hello everyone,

 

in case anyone is having problems with v23 here's attached the correct settings for the seo page.

remove in CMS "content" or "info" no work home page (Page not found) =(

Share this post


Link to post
Share on other sites

Hi!
I just to modified the PS but categories are not in url...

Categories
--------------
1-Category http://www.esvideos.net/tienda1/prestashop/362-telefonia-gps
2-Subcategory http://www.esvideos.net/tienda1/prestashop/364-operadores/
i want this URL:
http://www.esvideos.net/tienda1/prestashop/telefonia-gps/364-operadores/

Products
-------------
http://www.esvideos.net/tienda1/prestashop/home//109601152-ultimas-uds-speed-sound-copilot-x-tro-avisador-de-radares.html
¿home// in url?
It should be:
http://www.esvideos.net/tienda1/prestashop/telefonia-gps/navegadores-gps/109601152-ultimas-uds-speed-sound-copilot-x-tro-avisador-de-radares.html


In Seo URL i have:
Products Route:  {categories:/}{id}-{rewrite}.html
Category Route:  {categories:/}{id}-{rewrite}/


Please help me!

Edited by barrosa

Share this post


Link to post
Share on other sites

In Seo URL i have:

Products Route: {categories:/}{id}-{rewrite}.html

Category Route: {categories:/}{id}-{rewrite}/

 

categories? or category?

And why did you leave {id} in there? The whole idea is to remove it!

Share this post


Link to post
Share on other sites

Great plugin! I'm using v23 (from reply #54 by lapy90) on 1.5.3.1 and everything seems to be working so far. The only thing that is kind of weird is that when I try to view a category like http://mydomain.com/products I get a 404 page but if I go to http://mydomain.com/products/ (with the ending slash) it works fine. I'm not too worried at the moment because all the generated links like the one on my main menu bar does include the slash so all of my links still work as they should. Any ideas?

Edited by mrkewl

Share this post


Link to post
Share on other sites

I have the same problem with slash in category page and this is huge problem for us, because, we are migrating our store from Joomla, and SEO strategy includes category like this:

mydomain.com/categy

but in PS i get mydomain.com/1-category

with your fix most, what i can get is only mydomain.com/category/ (with slash at the end)

 

Any suggestions?

 

 

Great plugin! I'm using v23 (from reply #54 by lapy90) on 1.5.3.1 and everything seems to be working so far. The only thing that is kind of weird is that when I try to view a category like http://mydomain.com/products I get a 404 page but if I go to http://mydomain.com/products/ (with the ending slash) it works fine. I'm not too worried at the moment because all the generated links like the one on my main menu bar does include the slash so all of my links still work as they should. Any ideas?

Share this post


Link to post
Share on other sites

@dm[x]goshopping.dk

 

The slash tells PS to look in the categories Database

if it's without it look for it the controller page in Database like mysite.com/sitemap, mysite.com/contact-us

 

there has to be a pattern to know what type of page it is that is why all product pages end with .html & CMS have /info/about-us & so on...

 

@Esnyper

@JustNomad

 

http://www.prestashop.com/forums/index.php?/topic/204935-override-friendly-urls-without-id-number-for-v15/page__view__findpost__p__1126116

Share this post


Link to post
Share on other sites

doubleD your home page & other pages not working with the slash removed from categories

 

Gives 404 Error

 

 

Sorry, did not check other pages. Now i get the problem.

Edited by doubleD

Share this post


Link to post
Share on other sites

I removed the / at the end here (at SEO & URLS) {categories:/}{rewrite} and then my homepage gives a 404.

How can I let my categories to show both as www.mysite.com/category and www.mysite.com/category/ and also not get a 404 for my homepage?

Edited by BuB

Share this post


Link to post
Share on other sites

Rewriting of URL's worked fine. Suddenly my categories give an 404, products work fine.

 

Product page: http://www.wifinetwe...ngenius-ecb150/

404 category page: http://www.wifinetwe...r-access-point/

 

What's going wrong and how can I fix this? The url's to the categories are being rewritten, but gives a 404.

 

EDIT: just read a previous message from HA!*!*Y, changed the URL's of product pages to *.html and it's working agian.

post-466137-0-18702700-1362993905_thumb.png

Edited by BuB

Share this post


Link to post
Share on other sites