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?mai...&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:
www.example.com/yhteystiedot open up index.php?main_page=contact us page, or
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 :)


Reply With Quote

