Next Webinar: Maximizing Magento - Get the Most out of Promotions. Register Today!

Magento

Open Source eCommerce Evolved

Magento Forum

   
Page 2 of 2
Plea for controller action override tutorial/docs
 
ralphie
Member
 
Total Posts:  47
Joined:  2007-12-20
London
 

mate you are a genius!

while writing the reply post i noticed that i forgot to put in the MyModule bit into the class name.. fix it and it works smile thanks a million!

i am slightly wondering what the direction in the checkout.xml are for now though (update handle), hence it works for me w/a any change pointing to my custom class in the checkout.xml at the moment… do you know why that is, or in what case i actually do need to update the handle?

since i am talking to the expert. do you also know in from top of your head how i would need to define the etc/local.xml file in order to achieve exactly this by not creating a custom module but simply overriding it?

thanks a lot, ralph

 
Magento Community Magento Community
Magento Community
Magento Community
 
CreedFeed
Member
 
Total Posts:  50
Joined:  2007-08-31
Milwaukee, WI
 

I know that this is a month old thread but I can’t find any other newer threads relating to overloading controllers.

I followed the directions in the tutorial Jonathan posted using my install of Magento, version 1.0.19870.1, and it was not working. This started driving me crazy, and then I tried adding the url rewrite directly to the database versus having it in the XML config file. I used the following code, taken from zburnham’s post earlier in this topic:

INSERT INTO `core_url_rewriteVALUES (''1NULLNULL'mymodule/1''checkout/cart''mymodule/checkout_cart'''0NULL)

and then it worked!

Is there something outdated in the code used in Jonathan’s tutorial for editing the file /app/code/local/MyNameSpace/MyModule/etc/config.xml which would cause this not to work?

Also, when editing the file /app/etc/modules/MyNameSpace_All.xml where do the following code additions need to be placed within that file?

<mymodule_checkout_cart_index>
        <
update handle="checkout_cart_index"/>
    </
mymodule_checkout_cart_index>

The tutorial does not mention specifically where this code should be entered in the file? I simply stuck it inside the <layout> and </layout> tags on it’s own and not nested inside any other tags. Is this correct? (it’s working for me this way but I just want to be sure)

 Signature 

-Steve
Quake 1 Resurrection

 
Magento Community Magento Community
Magento Community
Magento Community
 
Georges@Bitbol
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-08-08
Paris
 

--

 Signature 

Sylvain Gourvil
Holidays rentals
Scuba Diving in Brittany - Plongée, épaves de bretagne

 
Magento Community Magento Community
Magento Community
Magento Community
 
gamelodge
Sr. Member
 
Avatar
Total Posts:  85
Joined:  2007-08-31
Brisbane, Qld, Australia
 

Show us an example of your code and i will see if i can help.

For me it worked like this in 1.1.2.

in my config.xml file in the GLOBAL section i had this

<global>
    <!--  
Front controllers   -->
    <
rewrite>
      <!-- 
This is an identifier for your rewrite that should be unique -->
      <
twg_delivery_checkout_multishipping>
        <
from>
          <!
[CDATA[#^/checkout/multishipping/shippingPost/$#]]>
        
</from>
        <!--
                    - 
mymodule matches the router frontname below
                    
checkout_cart matches the path to your controller
                    Considering the router below
"/mymodule/checkout_cart/" will be
                    
"translated" to "/MyNameSpace/MyModule/controllers/Checkout/CartController.php" (?)
                -->
        <
to>/delivery/checkout_multishipping/shippingPost/</to>
      </
twg_delivery_checkout_multishipping>
    </
rewrite>
</global>

Notice how the exact ‘action’ [shippingPost] has been overridden not the whole controller, for me when i tried to do it at the controller level it did not work well, but overriding a single action worked fine.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Georges@Bitbol
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-08-08
Paris
 

--

 Signature 

Sylvain Gourvil
Holidays rentals
Scuba Diving in Brittany - Plongée, épaves de bretagne

 
Magento Community Magento Community
Magento Community
Magento Community
 
Georges@Bitbol
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-08-08
Paris
 

Ok, I’ll succeed.

In the ckeckout.xml, you need to name your node mynamespace_mymodule… and not only mymodule… to display layout.

Next step, I want to overload the add action fo the cartController.

So I tried this in config.xml

<rewrite>
            <
mynamespace_frontend_checkout_cart_add>
                <
from><![CDATA[#^/checkout/cart/add/$#]]></from>
                
<to>/frontend/checkout_cart/add/</to>
            </
mynamespace_frontend_checkout_cart_add>
            <
mynamespace_frontend_checkout_cart>
                <
from><![CDATA[#^/checkout/cart/$#]]></from>
                
<to>/frontend/checkout_cart/</to>
            </
mynamespace_frontend_checkout_cart>
        </
rewrite>

but it does not seem to work. I do not know if it take the second [removed]index method) or none cause the link is “http://magento.dev/index.php/checkout/cart/add/uenc/aHR0cDovL2xhdXJhc2ltLmRldi9pbmRleC5waHAvY2FydGUtc2ltLWxhdXJhc2ltLTNnLmh0bWw,/product/1/”

Could anyone help me on that ?

I think I’ll be prepared after this ^^

 Signature 

Sylvain Gourvil
Holidays rentals
Scuba Diving in Brittany - Plongée, épaves de bretagne

 
Magento Community Magento Community
Magento Community
Magento Community
 
maijar
Jr. Member
 
Total Posts:  29
Joined:  2008-06-15
 
CreedFeed - 20 June 2008 04:48 AM

I followed the directions in the tutorial Jonathan posted using my install of Magento, version 1.0.19870.1, and it was not working. This started driving me crazy, and then I tried adding the url rewrite directly to the database versus having it in the XML config file. I used the following code, taken from zburnham’s post earlier in this topic:

INSERT INTO `core_url_rewriteVALUES (''1NULLNULL'mymodule/1''checkout/cart''mymodule/checkout_cart'''0NULL)

I added rewrite straight to admin panel Url Rewrite Management (worked, yay), but noticed that I can enable one rewrite just for one store view. Is there a way to make it concern all store views with one rewrite rule since I have several views now?

table fields:
id, store_id, category_id, product_id, id_path, request_path, target_path, is_system, options, description

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 2
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
39653 users|689 users currently online|85475 forum posts