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.

4

1 回答 1

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

像这样的链接http://example.com/articles/circus/616/4-marta-vse-za-ruletkami

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

编辑 1

这是默认路由器插件的设置。从我的博客模块中显示articles,但很容易更新商店。

零件 -http://example.com/是主机 :) articles/circus/=> 模块和控制器映射。

resources.router.routes.view-article.map.1 = topicSlug是一个类别。商店。

616/4-marta-vse-za-ruletkami身份证和任何蛞蝓。产品描述,例如“iphone-4S-16-gb”

默认值在配置中。

另一个例子/{maps2module}/{maps2topicSlug}/{maps2id}/{maps2articleSlug}

于 2012-03-02T11:12:50.437 回答