如何通过config.xml重写自定义模块的magento中的url

时间:2014-11-15 08:18:16

标签: php xml .htaccess magento

我在magento中创建了一个自定义模块...我的网址是

卖方/卖方/ sellercreate

我需要为我的自定义模块重写这个URL ...我需要知道如何 我可以改写我的网址....

http://example.com/seller

我的config.xml是

<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <!-- module configuration -->
    <modules>
        <Webcreon_Seller>
            <version>0.0.1</version>
        </Webcreon_Seller>
    </modules>
    <!-- module configuration end -->
    <frontend>
        <routers>
            <seller>
                <use>standard</use>
                <args>
                    <module>Webcreon_Seller</module>
                    <frontName>seller</frontName>  
                </args>
            </seller>
        </routers>
     <layout>
            <updates>
                <seller>
                      <file>sellerform.xml</file>
                </seller>
            </updates>
       </layout>
    </frontend>
    <admin>
     <routers>
         <seller>
            <use>admin</use>
            <args>
               <module>Webcreon_Seller</module>
               <frontName>adminseller</frontName>
            </args>
         </seller>
      </routers>
 </admin>
 <adminhtml>
   <layout>
      <updates>
          <seller>
              <file>sellerform.xml</file>
           </seller>
      </updates>
   </layout>
   <menu>
      <customer translate="title" module="adminhtml">

         <sort_order>10</sort_order>
         <children>
             <set_time>
                   <title>Seller List</title>
                   <action>adminseller/adminhtml_index</action>
              </set_time>
          </children>
       </customer>
    </menu>
</adminhtml> 

    <global>
        <blocks>
            <seller>
                <class>Webcreon_Seller_Block</class>
            </seller>
         </blocks>
         <helpers>
            <seller>
                <class>Webcreon_Seller_Helper</class>
            </seller> 
        </helpers>
              <models>
          <seller>
                <class>Webcreon_Seller_Model</class>
                 <resourceModel>seller_mysql4</resourceModel>
            </seller> 
            <seller_mysql4>
             <class>Webcreon_Seller_Model_Mysql4</class>
             <entities>
                 <seller>
                   <table>db_vendor</table>
                 </seller>
              </entities>
          </seller_mysql4>
        </models>
        <resources>
        <!-- connection to write -->
        <seller_write>
            <connection>
                <use>core_write</use>
            </connection>
        </seller_write>
        <!-- connection to read -->
       <seller_read>
          <connection>
             <use>core_read</use>
          </connection>
       </seller_read>
</resources>
    </global>


</config>

1 个答案:

答案 0 :(得分:0)

well example.com/seller只表示indexController.php的indexAction。你可以把你的功能放在那里。

您可以在全球标记中使用此代码:

<rewrite>
  <seller> 
    <from>
       <![CDATA[/seller\/(.*)/]]>
    </from> 
    <to>
       <![CDATA[seller/seller/sellercreate/$1/]]>
    </to> 
    <complete>1</complete>
  </seller> 
</rewrite>

但它会将所有请求重定向到salescreate,我认为最好使用以下网址: example.com/seller/create 而不仅仅是卖方