久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Magento 中生成自定義 URL

Gernerate custom urls within Magento(在 Magento 中生成自定義 URL)
本文介紹了在 Magento 中生成自定義 URL的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我目前正在嘗試使用 magento 生成自定義 url/路由,目前我已經在本地模塊的 config.xml 中設置了默認路由.

I am currently looking at trying to generate custom urls/routing using magento, currently I have set a default route in config.xml within the local module.

<frontend>
 <routers>
         <portfolios>
             <use>standard</use>
             <args>
                 <module>Custom_Portfolios</module>
                 <frontName>portfolios</frontName>
             </args>
         </portfolios>
     </routers>
     <default>
         <router>portfolios</router>
     </default>
 </frontend>

這當前適用于/portfolios/index/action/custom-string 的 url 路徑,這是 magento 默認路由.我想要實現的是讓/portfolios/custom-string.html 我嘗試使用 mod_rewrite 規則但沒有成功,我找到了一些關于使用 .html 的自定義后綴的參考,我已將其添加到相同的 config.xml 文件.

This currently works with the url path of /portfolios/index/action/custom-string which is the magento default route. What I am trying to achieve is to have /portfolios/custom-string.html I have attempted to use a mod_rewrite rule with no success, I have found some references in relation to utilising a custom suffix of .html which I have added to the same config.xml file.

<default><portfolios><seo><portfolios_url_suffix>.html</portfolios_url_suffix></seo></portfolios></default>

我查看了與路由相關的 alan Storm 文檔,發現它僅與默認路由路徑相關,或者信息有點過時.

I have looked at the alan storm docs in relation to routing and found it relevent to the default routing paths only or the information is a little out-dated.

您是否知道在 magento 中控制路由的最佳方法以及可能易于遵循和相關的教程?如果是這樣,請分享 :D 很多

Do you know the best method to control the routing within magento with possibly an easy to follow and relevent tutorial? if so please share :D many

推薦答案

實現此目的的方法是重寫 URL.事實上,您發現的后綴配置可能被 Mage_Catalog 用于創建它的重寫集.我是第一次接觸這個特殊的功能,所以這個片段應該加一點鹽......

The way to do this is with an URL rewrite. In fact, the suffix config you found is probably used by Mage_Catalog to create it's sets of rewrites. I'm approaching this particular feature for the first time so this snippet should be taken with a pinch of salt...

// Creating a rewrite
/* @var $rewrite Mage_Core_Model_Url_Rewrite */
$rewrite = Mage::getModel('core/url_rewrite');
$rewrite->setStoreId($store_id)
        ->setIdPath('portfolios/'.$url_key)
        ->setRequestPath('portfolios/'.$url_key.'.html')
        ->setTargetPath('portfolios/index/action/id/'.$url_key)
        ->setIsSystem(true)
        ->save();

每個可能的路徑都需要一個新的重寫.

A new rewrite is needed for each possible path.

編輯;我添加了一個 setIdPath 因為它可能是必要的.

Edit; I've added a setIdPath because it might be necessary.

這篇關于在 Magento 中生成自定義 URL的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Override Magento Config(覆蓋 Magento 配置)
What would cause a print_r and/or a var_dump to fail debugging a variable?(什么會導致 print_r 和/或 var_dump 調試變量失敗?)
How to update custom options programatically in magento?(如何在 magento 中以編程方式更新自定義選項?)
Magento 404 on Admin Page(管理頁面上的 Magento 404)
Magento - get price rules from order(Magento - 從訂單中獲取價格規則)
Magento Change Product Page Titles to Include Attributes(Magento 更改產品頁面標題以包含屬性)
主站蜘蛛池模板: 成人在线欧美 | 久久国产精品99久久久久 | 日韩成人在线免费视频 | 久久国产婷婷国产香蕉 | 日日操夜夜操天天操 | 日韩中文字幕 | 国产精品久久二区 | 天天色天天色 | 在线视频91| www.国产.com| 一级片免费在线观看 | h免费观看 | 欧洲成人 | 天天干狠狠操 | 日韩精品色网 | 天堂av中文| 久久最新精品视频 | 国产福利在线播放 | 中文字幕一区二区三区乱码在线 | 欧美日韩精品一区二区天天拍 | 一区二区三区在线免费观看 | 青青久久av北条麻妃海外网 | 日韩一级免费电影 | 91国内产香蕉 | 伊人精品一区二区三区 | 天堂久| 亚洲精品国产成人 | 国产一区二区免费 | 国产福利网站 | 亚洲欧美日韩在线一区二区 | 成人影院av | av在线免费观看网站 | 成人免费视频在线观看 | 国产免费一区二区三区网站免费 | 成人国产精品免费观看视频 | 国产日韩一区二区三区 | 成人精品一区二区 | 日韩高清中文字幕 | 国产精品成人一区二区 | 欧美亚洲视频在线观看 | 欧美成人手机在线 |