[Override] Friendly Urls Without Id Number For V1.5 - Free Modules & Themes - PrestaShop

Jump to content

Photo

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

URL free module

#1

Posted 19 November 2012 - 04:36 AM

HA!*!*Y

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 206 Active Posts

*
POPULAR

ABOUT
This PrestaShop 1.5 module/override allows removal of number ID's from all URLs.

The way PrestaShop URL's work limits modification of the URL's. A lot of people are having problems with this modules is for one of two reasons.

1st the S. E. O. settings require 8 unique patterns one for each type of page.

The default patterns for this module are:
Product pages end with .html
----- That is the only way PrestaShop knows to display product
Categories pages end with a slash "/"
CMS pages start with "/info/"
CMS Category pages start with "/info/" and end with slash "/"
Module pages start with "/module/"
Manufacturer pages start with "manufacturer/"
Supplier pages start with "/supplier/"

If your using Block Layered module, the filter pages have "/filter/" after the category name and filter information after the "/filter/"

But your are not limited to having for example manufacturer page start with "/manufacturer/". You could have it display yoursite.com/apple.html but now you need a new pattern for you product pages because you can't have manufacturer and product URL pattern the same.

You MUST understand that PrestaShop URL's work on pattern recognition its the only way PrestaShop knows where to look for what.


2nd issue is with PrestaShop core code it self different versions of PrestaShop have had different bugs. on some the uninstall module override function does not work and on others the patterns saved in the backoffice (in to data base) don't override the default patterns of this module.


INSTALLATION
Install the module from the Backoffice (administration panel)
 

Module Compatibility Note
Block Layered
. . . Edit file: modules/blocklayered/blocklayered.php
. . . Find code line 3730 and add line 3732





$product_list = $smarty->fetch(_PS_THEME_DIR_.'product-list.tpl');

$_GET['id_category'] = !isset($_GET['id_category']) ? (int) $_GET['id_category_layered'] : (int) $_GET['id_category'];

How to uninstall the module:

Go to modules -> Find and uninstall "CleanURL".

Open folder /override/classes/
-> Remove "Link.php"
-> Remove "Dispatcher.php"

Open folder /override/controllers/front/
-> Remove "CategoryController.php"
-> Remove "CmsController.php"
-> Remove "ManufacturerController.php"
-> Remove "ProductController.php"
-> Remove "SupplierController.php"

Open folder /cache/
-> Remove "class_index.php"

Go to back office -> Preferences -> SEO and URLs -> Set userfriendly URL off -> Save
Go to back office -> Preferences -> SEO and URLs -> Set userfriendly URL on -> Save

If you got any other override modules, you should now go to you back office, uninstall them, and install them again to work correctly.
Now you should be good.

--thanks to @shinetech.dk for the Guide


removeURLid1.5_v0.1.zip
To Install copy the the files in to override folder
/override/classes/Dispatcher.php
/override/controllers/front/CategoryController.php
/override/controllers/front/CmsController.php
/override/controllers/front/ManufacturerController.php
/override/controllers/front/ProductController.php
/override/controllers/front/SupplierController.php

Preferences > SEO & URLs :: Schema of URLs
Than update your SEO Schema of URLs to:
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

removeURLid1.5_v0.22.zip
special thanks to lapy90 for sending me his copy of CmsController.php
-New updated removes all ID's
-And it fixed the 404 page errors

cleanurls_v0.3.zip
- works with 1.5.4 as a module

cleanurls_v0.3.1.zip (to upgrade from v0.3 just replace the 2 files)
- file: cleanurls.php
--- now you can see if you have any duplicate URL entries on the module configure page
- file: ProductController.php
--- added a test to redirect old urls with IDs to prevent duplicate content and/or page not found (404)
 
cleanurls_v0.4.2.zip
**To upgrade uninstall & delete the old module than install the new one
-All override files are updated to PrestaShop 1.5.5.0
-Updated dispatcher to Load custom routes from modules
-Multi-shop
-Multilanguage
-Works with subcategories
-Added link_rewrite as index to improve mySQL speed

Attached Files


Edited by HA!*!*Y, 05 November 2013 - 09:44 PM.


#2

Posted 19 November 2012 - 08:04 AM

Violent

    PrestaShop Newbie

  • Members
  • Pip
  • 12 Active Posts
Nice! Wait for stabel version:)
Thank You!

#3

Posted 21 November 2012 - 12:28 PM

petete2008

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 1374 Active Posts
Thank's for sharing!

#4

Posted 21 November 2012 - 06:13 PM

MultiTricker

    PrestaShop Newbie

  • Members
  • Pip
  • 1 Active Posts
Thank you! Looking forward for stable version :)

Edited by MultiTricker, 21 November 2012 - 06:13 PM.


#5

Posted 25 November 2012 - 02:14 AM

corint1

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 181 Active 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 ?

#6

Posted 27 November 2012 - 02:15 AM

HA!*!*Y

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 206 Active 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 ?


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

Are you using multishop?

Edited by HA!*!*Y, 27 November 2012 - 02:17 AM.


#7

Posted 27 November 2012 - 12:50 PM

corint1

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 181 Active Posts
sorry , but some isnt ok .... can you explain what 's happening ?

#8

Posted 29 November 2012 - 05:36 PM

mrashole

    PrestaShop Newbie

  • Members
  • Pip
  • 3 Active Posts
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

#9

Posted 05 December 2012 - 05:50 PM

tdr170

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 2977 Active Posts
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, 05 December 2012 - 05:54 PM.

-------------------------------------------------------------------------------
Did we help, If so give us a like, it lets others know we can help
-------------------------------------------------------------------------------

#10

Posted 06 December 2012 - 09:32 AM

HA!*!*Y

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 206 Active Posts

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, 06 December 2012 - 09:33 AM.


#11

Posted 06 December 2012 - 09:37 AM

HA!*!*Y

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 206 Active Posts

...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?

#12

Posted 06 December 2012 - 09:43 AM

mrashole

    PrestaShop Newbie

  • Members
  • Pip
  • 3 Active Posts
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, 06 December 2012 - 09:44 AM.


#13

Posted 07 December 2012 - 01:13 PM

aeroplah

    PrestaShop Apprentice

  • Members
  • PipPip
  • 61 Active Posts
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?

#14

Posted 07 December 2012 - 04:31 PM

petete2008

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 1374 Active Posts
The problem of remove the ID is that if a product has the same name generate parallel and therefore will not know that url prestashop load. Besides that Google will interpret it as duplicate content.

#15

Posted 07 December 2012 - 06:23 PM

aeroplah

    PrestaShop Apprentice

  • Members
  • PipPip
  • 61 Active Posts
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, 07 December 2012 - 07:30 PM.


#16

Posted 16 December 2012 - 09:27 PM

cloder

    PrestaShop Apprentice

  • Members
  • PipPip
  • 29 Active Posts
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/

Attached Files

  • Attached File  Link.php   3.13KB   332 downloads

Edited by cloder, 28 January 2013 - 07:00 PM.


#17

Posted 21 December 2012 - 12:01 AM

rusteh

    PrestaShop Apprentice

  • Members
  • PipPip
  • 81 Active Posts
Can someome tell me how to do this for cms? I want to make landing pages and i need to remove category for better ranking.

#18
sjk

Posted 06 January 2013 - 01:40 PM

sjk

    PrestaShop Newbie

  • Members
  • Pip
  • 23 Active Posts
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?

#19

Posted 09 January 2013 - 12:33 AM

portgaz

    PrestaShop Newbie

  • Members
  • Pip
  • 1 Active Posts
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!

#20

Posted 14 January 2013 - 11:55 PM

Annino

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 126 Active Posts
It's works with 1.5.3.1
but 404 for home-page !??



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cookies help us deliver our services. By using our services, you agree to use our cookies.     Learn more