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

在 Magento 中生成自定義 URL

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

問(wèn)題描述

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

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>

這當(dāng)前適用于/portfolios/index/action/custom-string 的 url 路徑,這是 magento 默認(rèn)路由.我想要實(shí)現(xiàn)的是讓/portfolios/custom-string.html 我嘗試使用 mod_rewrite 規(guī)則但沒(méi)有成功,我找到了一些關(guān)于使用 .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>

我查看了與路由相關(guān)的 alan Storm 文檔,發(fā)現(xiàn)它僅與默認(rèn)路由路徑相關(guān),或者信息有點(diǎn)過(guò)時(shí).

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 中控制路由的最佳方法以及可能易于遵循和相關(guān)的教程?如果是這樣,請(qǐng)分享 :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

推薦答案

實(shí)現(xiàn)此目的的方法是重寫 URL.事實(shí)上,您發(fā)現(xiàn)的后綴配置可能被 Mage_Catalog 用于創(chuàng)建它的重寫集.我是第一次接觸這個(gè)特殊的功能,所以這個(gè)片段應(yīng)該加一點(diǎn)鹽......

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();

每個(gè)可能的路徑都需要一個(gè)新的重寫.

A new rewrite is needed for each possible path.

編輯;我添加了一個(gè) setIdPath 因?yàn)樗赡苁潜匾?

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

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

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

相關(guān)文檔推薦

Override Magento Config(覆蓋 Magento 配置)
What would cause a print_r and/or a var_dump to fail debugging a variable?(什么會(huì)導(dǎo)致 print_r 和/或 var_dump 調(diào)試變量失敗?)
How to update custom options programatically in magento?(如何在 magento 中以編程方式更新自定義選項(xiàng)?)
Magento 404 on Admin Page(管理頁(yè)面上的 Magento 404)
Magento - get price rules from order(Magento - 從訂單中獲取價(jià)格規(guī)則)
Magento Change Product Page Titles to Include Attributes(Magento 更改產(chǎn)品頁(yè)面標(biāo)題以包含屬性)
主站蜘蛛池模板: 天天爽天天操 | 国内精品国产成人国产三级 | 日韩中文字幕一区二区 | 一区二区三区黄色 | 日韩一级在线观看 | 欧美日韩一区二区在线 | 天堂视频在线免费观看 | 国产一区在线播放 | 91福利视频导航 | 欧美日韩国产一区二区 | 小sao货撅起屁股扒开c微博 | 亚洲黄色网址 | 欧美日韩亚洲一区二区 | 中文字幕免费观看视频 | 欧美久久久久久久久 | 中文字幕av在线 | 久久久亚洲一区 | 91在线观 | 亚洲福利视频一区 | 成人动态视频 | 日本天天操 | 69精品视频 | 国产在线一| 国产寡妇亲子伦一区二区三区四区 | 99久久精品国产毛片 | 日韩在线视频免费观看 | 网站毛片 | 欧美日韩小视频 | 亚洲国产一区在线观看 | av观看网站| 18成人免费观看网站 | 黄色国产| 国产黄色一级片 | 17c在线 | 在线观看日韩精品 | 亚洲美女爱爱 | 国产成人精品一区二区三区福利 | 欧美日韩一二三区 | 日韩伦理视频 | 久久99热这里只频精品6学生 | 色偷偷噜噜噜亚洲男人 |