url rewriting - rewrite cart url is not working in magento -


i want re-write checkout cart url. had created module not working. had created config.xml , url.php in model didn't succeed. code is: etc/config.xml

<?xml version="1.0"?> <config>     <modules>         <ghrix_newcart>           <version>1.0.0</version>         </ghrix_newcart>     </modules>   <global>     <rewrite>       <ghrix_newcart_checkout_cart>         <from><![cdata[#^/checkout/winkelwagen#]]></from>         <to><![cdata[#^/checkout/cart#]]></to>       </ghrix_newcart_checkout_cart>     </rewrite>    <models>       <ghrix_newcart>         <class>ghrix_newcart_model</class>       </ghrix_newcart>       <core>         <rewrite>           <url>ghrix_newcart_model_url</url>         </rewrite>       </core>     </models>   </global>  </config> 

in model/url.php

<?php class ghrix_newcart_model_url extends mage_core_model_url {     /**     * build url requested path , parameters     *     * @param string|null $routepath     * @param array|null $routeparams     * @return string     */     public function geturl($routepath = null, $routeparams = null) {     if(strstr($routepath,'checkout')){         //echo $routepath.'--ss--<br />';     }         if ( $routepath == 'checkout/cart' ) {                            $routepath = 'checkout/cart';             }             return parent::geturl($routepath, $routeparams);         } }  ?> 

i had created function didn't work me. want checkout/cart url should checkout/winkelwagen please suggest can do.

i approach in less intrusive way, using magento’s event observer system. redirect requests checkout/cart route new route checkout/winkelwagen this:

etc/config.xml

<frontend>     <events>         <controller_action_predispatch_checkout_cart_index>             <observers>                 <redirectcart>                     <class>ghrix_newcart_model_observer</class>                     <method>redirectcart</method>                 </redirectcart>             </observers>         </controller_action_predispatch_checkout_cart_index>     </events> </frontend> 

model/observer.php

public function redirectcart(varien_event_observer $observer) {     mage::app()->getresponse()->setredirect('/checkout/winkelwagen')->sendresponse();     exit; } 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -