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
sjk    0

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×