Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / All Other Contributions/Addons / a new URL router (SEO URL if you will) on it's way

a new URL router (SEO URL if you will) on it's way

Started by pasi on 20 Dec 2013, 1:39 PM · Views: 1,500

Results 1 to 4 of 4
20 Dec 2013, 1:39 PM
#1
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Post #1 by pasi

Hello all,

I started working on a new URL router (some might call it SEO URLs).

The router itself is already pretty much working, turning:

http://www.example.com/index.php?main_page=products_info&products_id=1

to

http://www.example.com/product/products-name

Notice, that there is no products ID visible...

Same goes for categories

http://www.example.com/index.php?cPath=12_20

to

http://www.example.com/products/hardware/mouses

Again without category ID's.

There is no need for upkeeping a complex database for the url aliases. The different id's are parsed automatically from names (I will be implementing a cache for this, which will cut back on the SQL queries). Also it does not require complex .htaccess rules, simply point all non-physical paths to index.php (~4 lines in .htaccess)

Thus far it's a drop-in type of plugin and doesn't overwrite any core files.... It is only active when $_GET['main_page'] is not set (at the time the router is initialized), so the old style URLs will work. It does not interfere with normal zencart operation in any way. Non aliased parameters still get passed to the page normally, so sorting can still happen with the normal sort=a20 URL parameter (but this can be customized too if you want!)

It also features URL aliasing, so you could make example.com/contact_us page show up as just example.com/contact if you wanted to.

AND the biggest benefit (and why I started writing this), is that it supports TRANSLATING THE URLS...

So I can have URL's in Finnish like:
https://www.example.com/yhteystiedot open up index.php?main_page=contact us page, or
**https://www.example.com/tuotteet/laitteet/hiiret **open up index.php?cPath=12_20

The system uses a simple 3 column database (path, destination, language) as a routing table, which is needed for aliasing and language support... but if a native zencart page exists in includes/modules/pages/ with the same name as the requested route, it will use it automatically so you don't need to add pages to the database if you really don't want to.

Further parameters (like cPath and products_id) are handled in a routing class that is attached to a static routing class on request, so they can be customized on page basis.

Everything mentioned above is WORKING... What is not yet functional is generating the URL's with the default zencart url generating function and adding additional parameter parsing to pages that require it (ezPages etc...). I will start working on these on January 2014.

But before then, I'd like to call out for a few testers that could start testing the plug-in when it's ready enough.

Please contact me with private message.

Oh, and merry christmas and a happy new year 2014 :)

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

9 Jan 2014, 2:14 PM
#2
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Post #2 by pasi

Link generator now works, but still requires page specific routing classes implemented to generate proper links for products etc... (Product group links work already).

Feel free to check out the progress at https://github.com/xpasi/ZenCart-smart-router

There's no notifier "hook" in the zen_href_link() link generating function, so one core file edit is needed. :(

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

9 Jan 2014, 3:44 PM
#3
cvhainb avatar

cvhainb

Zen Follower

Join Date:
Sep 2008
Posts:
212
Plugin Contributions:
19

Post #3 by cvhainb

I think this is a good plugin although there are some similar. Thank you.

Also, I have quick view the code and you should add code for your to do list :)) it's very important.

Chu

Our Site: http://zucando.com
Marketing Plugins: Marketing Modules
Free Response Templates: Responsive Templates

10 Jan 2014, 7:17 AM
#4
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Post #4 by pasi

Thanks for the feedback.

I'd consider this project as "not even released yet" state. So the actual todo list is written in a piece of paper and updated when I figure stuff out ;)

Also currently the github page doesn't include an SQL file to create the routing table ... I'll add this later, when I'mcertain I don't need to alter it.

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004