0

I have a simple e-commerce web application with product URL's like:

http://www.example.com/product/view/product_id/15

where "Product" is the controller and "view" is the action in the Product Controller

How do I change this URL to show up as:

http://www.example.com/product/view/product_name/iphone-4S-16-gb

where product_id "15" is the primary key in the product table and product_name has the value "iphone 4s 16 gb" without the hyphens

What is the simplest way for me to make this change. Would really appreciate your help. Thanks a lot.

Liyali
  • 5,643
  • 2
  • 26
  • 40
Gublooo
  • 2,550
  • 8
  • 54
  • 91

1 Answers1

0
resources.router.routes.view-article.type = "Zend_Controller_Router_Route_Regex"
resources.router.routes.view-article.route = "articles/(?!archive)([a-zA-Z\-]+)/(\d+)(?:/(.*))?"
resources.router.routes.view-article.reverse = "articles/%s/%d/%s"
resources.router.routes.view-article.defaults.module = "articles"
resources.router.routes.view-article.defaults.controller = "view"
resources.router.routes.view-article.defaults.action = "view-article"
resources.router.routes.view-article.map.1 = topicSlug
resources.router.routes.view-article.defaults.topicSlug = topicSlug
resources.router.routes.view-article.map.2 = id
resources.router.routes.view-article.defaults.id = 0
resources.router.routes.view-article.map.3 = articleSlug
resources.router.routes.view-article.defaults.articleSlug = articleSlug

links like http://example.com/articles/circus/616/4-marta-vse-za-ruletkami

http://example.com/products/category/product_id/product_name

EDIT 1

this is a setup for default router plugin. shown as articles from my blog module, but easily updates for shop.

parts - http://example.com/ is host :) articles/circus/ => module and controller mapeed.

resources.router.routes.view-article.map.1 = topicSlug is a category. for shop.

616/4-marta-vse-za-ruletkami ID and any slug. product description, for example, 'iphone-4S-16-gb '

defaults are in config.

another example /{maps2module}/{maps2topicSlug}/{maps2id}/{maps2articleSlug}

SMka
  • 3,021
  • 18
  • 14