Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>Create your module folders and files</p> <pre><code>app/code/local/MyNameSpace/MyModule/etc/config.xml app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php app/etc/modules/MyNameSpace_All.xml </code></pre></li> <li><p>Edit /etc/config.xml and Create app/code/local/MyNameSpace/MyModule/etc/config.xml with the following content:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;config&gt; &lt;modules&gt; &lt;MyNameSpace_MyModule&gt; &lt;version&gt;0.1.0&lt;/version&gt; &lt;/MyNameSpace_MyModule&gt; &lt;/modules&gt; &lt;global&gt; &lt;!-- This rewrite rule could be added to the database instead --&gt; &lt;rewrite&gt; &lt;!-- This is an identifier for your rewrite that should be unique --&gt; &lt;!-- THIS IS THE CLASSNAME IN YOUR OWN CONTROLLER --&gt; &lt;mynamespace_mymodule_checkout_cart&gt; &lt;from&gt;&lt;![CDATA[#^/checkout/cart/#]]&gt;&lt;/from&gt; &lt;!-- - 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" (?) --&gt; &lt;to&gt;/mymodule/checkout_cart/&lt;/to&gt; &lt;/mynamespace_mymodule_checkout_cart&gt; &lt;/rewrite&gt; &lt;/global&gt; &lt;!-- If you want to overload an admin controller this tag should be &lt;admin&gt; instead, or &lt;adminhtml&gt; if youre overloading such stuff (?) --&gt; &lt;frontend&gt; &lt;routers&gt; &lt;mynamespace_mymodule&gt; &lt;!-- should be set to "admin" when overloading admin stuff (?) --&gt; &lt;use&gt;standard&lt;/use&gt; &lt;args&gt; &lt;module&gt;MyNameSpace_MyModule&lt;/module&gt; &lt;!-- This is used when "catching" the rewrite above --&gt; &lt;frontName&gt;mymodule&lt;/frontName&gt; &lt;/args&gt; &lt;/mynamespace_mymodule&gt; &lt;/routers&gt; &lt;/frontend&gt; </code></pre> <p></p> <p>Note: The above didn’t work for me when I override catalog/product controller. I had to use:</p> <pre><code> &lt;from&gt;&lt;![CDATA[#^catalog/product/#]]&gt;&lt;/from&gt; &lt;to&gt;mymodule/mycontroller&lt;/to&gt; </code></pre> <p>(notice the missing leading slash)</p> <p>Since Magento 1.3 you can simply add your module to the frontend router. Rewrites are not neccessary any more:</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;config&gt; &lt;modules&gt; &lt;MyNameSpace_MyModule&gt; &lt;version&gt;0.1.0&lt;/version&gt; &lt;/MyNameSpace_MyModule&gt; &lt;/modules&gt; &lt;frontend&gt; &lt;routers&gt; &lt;checkout&gt; &lt;args&gt; &lt;modules&gt; &lt;MyNameSpace_MyModule before="Mage_Checkout"&gt;MyNameSpace_MyModule&lt;/MyNameSpace_MyModule&gt; &lt;/modules&gt; &lt;/args&gt; &lt;/checkout&gt; &lt;/routers&gt; &lt;/frontend&gt; </code></pre> <p> Please note that <code>before=”Mage_Checkout”</code> will load your controller first if available and fall back to Magento’s if not.</p> <p>If the controller is in another folder, you’ll have to modify the code:<br> <code>app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php.</code> </p></li> </ol> <p><strong>Replace</strong></p> <p><code>&lt;MyNameSpace_MyModule before="Mage_Checkout"&gt;MyNameSpace_MyModule&lt;/MyNameSpace_MyModule&gt;</code></p> <p><strong>with</strong></p> <pre><code> &lt;MyNameSpace_MyModule before="Mage_Checkout"&gt;MyNameSpace_MyModule_Checkout&lt;/MyNameSpace_MyModule&gt; </code></pre> <ol> <li><p>Edit <code>'controllers/Checkout/CartController.php'</code></p> <p>Create <code>app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php</code> with the following content: (the only change to indexAction() is adding an error_log() call):</p> <pre><code> &lt;?php # Controllers are not autoloaded so we will have to do it manually: require_once 'Mage/Checkout/controllers/CartController.php'; class MyNameSpace_MyModule_Checkout_CartController extends Mage_Checkout_CartController { # Overloaded indexAction public function indexAction() { # Just to make sure error_log('Yes, I did it!'); parent::indexAction(); } } </code></pre> <ol> <li><p>Edit <code>'app/etc/modules/MyNameSpace_All.xml'</code> (This is to activate your module)</p> <p> true local </p></li> </ol></li> <li><p>Edit <code>'app/design/frontend/[myinterface]/[mytheme]/layout/checkout.xml'</code> and add the following to use the same update handle as before:</p> <pre><code> &lt;mynamespace_mymodule_checkout_cart_index&gt; &lt;update handle="checkout_cart_index"/&gt; &lt;/mynamespace_mymodule_checkout_cart_index&gt; </code></pre> <p>(Note that these tags seem to be case sensitive. Try using all lowercase if this isn’t working for you)</p> <p>[by Hendy: When I override catalog/product/view using the method described in this Wiki or here, I didn’t have to do the above. However, when using the 'cms way', I had to update the handle manually.]</p> <p>The above item did not work for me (2009-02-19 by Jonathan M Carvalho)</p> <p>I discovered that the file to change is app/design/frontend/[myinterface]/[mytheme]/layout/mymodule.xml</p> <p>Add the following lines:</p> <p> <br> </p> <ol> <li>Point your browser to /checkout/cart/ In your PHP error log, you should find ‘Yes, I did it!’.</li> </ol> <p>You need to be extra precise with the rewrite regular expression because errors are very hard to find.</p> <p></p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload