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/=>モジュールとコントローラーのmapeed。

resources.router.routes.view-article.map.1 = topicSlugカテゴリです。ショップ用。

616/4-marta-vse-za-ruletkamiID とスラッグ。製品の説明、たとえば「iphone-4S-16-gb」

デフォルトは構成にあります。

もう一つの例/{maps2module}/{maps2topicSlug}/{maps2id}/{maps2articleSlug}

于 2012-03-02T11:12:50.437 に答える