Magento篮子页面的自定义URL

Jar*_*aro 1 rewrite magento custom-url

我想为我们的Magento篮子实现自定义URL.Magento开箱即用的url paht是/ checkout/cart但是客户请求/结账/包.

我尝试以某种方式*后端的URL重写管理 - 它的工作原理,但我需要将代码中的所有出现更新为新的url,因为$ this-> getUrl('checkout/cart')不会转换为checkout/bag*我也尝试过遵循http://alanstorm.com/magento_dispatch_rewrites_intro的一些建议,但基本上它也没有帮助我.*我也试过这篇文章http://phprelated.myworks.ro/two-add-to-cart-buttons-with-different-redirect-actions-at-once-in-magnto/

那么,有什么方法可以如何重写从路径'checkout/cart'到checkout/bag的翻译而不更新我们的模板和类中的所有事件$ this-> getUrl('checkout/cart')

任何取决于Web服务器架构的解决方案都不是最终解决方案.

Jar*_*aro 6

我找到了解决方案

1)我重新设计模型core/url以获得所需的输出

编辑1 - 示例实现https://gist.github.com/jaromirmuller/132cdd9378e5b1018170

2)在config.xml中添加了url rewrite,它将url路径从/ checkout/bag重写为/ checkout/cart

    <global>
      <rewrite>
        <mynamespace_mymodule_checkout_cart>
            <from><![CDATA[#^/checkout/bag#]]></from>
            <to>/checkout/cart</to>
        </mynamespace_mymodule_checkout_cart>
         </rewrite>
    </global>
Run Code Online (Sandbox Code Playgroud)

3)在目录> URL重写管理中添加了url重写,处理是否有人来/ checkout/cart然后他被重定向到/ checkout/bag paht这是正确的.

这三点使网站一致并且没有任何问题.这是一种轻松的方式,无需重写大量的模板和类.