0

I followed this tutorial: blog.baobaz.com/en/blog/magento-module-create-your-own-controller but it doesn't work for me. My files:

/app/etc/modules/Baobaz_Arithmetic.xml

<?xml version="1.0" ?>
<config>
<modules>
    <Baobaz_Arithmetic>
        <active>true</active>
        <codePool>local</codePool>
    </Baobaz_Arithmetic>
</modules>
</config>

/app/code/local/Baobaz/Arithmetic/etc/config.xml file:

<?xml version="1.0" ?>
<config>
<modules>
    <Baobaz_Arithmetic>
        <version>0.1.0</version>
    </Baobaz_Arithmetic>
</modules>
<frontend>
    <routers>
        <arithmetic>
            <use>standard</use>
            <args>
                <module>Baobaz_Arithmetic</module>
                <frontName>arithmetic</frontName>
            </args>
        </arithmetic>
    </routers>   
</frontend>
</config>

/app/code/local/Baobaz/Arithmetic/controllers/IntegerController.php

<?php
 class Baobaz_Arithmetic_IntegerController extends Mage_Core_Controller_Front_Action {
  public function multiplyAction(){
    echo "Respect my authoritah";
  }
 }
?>

I cleared the cache. When calling (...).com/arithmetic/integer/multiply I get 404 page. I run Magento 1.8.1.

How to fix this?

  • put <?php at top of your controller – Rajeev K Tomy Sep 4 '14 at 11:26
  • 1
    Just replicated your module on my side. It works perfectly. make sure you cleared the cache. If it's enabled you should disable it while developing. If you have the compiler enabled, disable it. Also make sure you have the <?php tag in your controller class as programmer_rkt said above. – Marius Sep 4 '14 at 11:31
  • Sorry, it was already in the file. I've just did't copy it. I've found an answer, will post it now. – Alan Sep 4 '14 at 11:32
  • call your controller like this www.domain.com/index.php/arithmetic/integer/multiply – Rajeev K Tomy Sep 4 '14 at 11:40
  • 1
    it worked because it has the form it should have module/controller/action. Also it worked for me without the de part because I don't have the store codes in url setting enabled. Maybe it didn't work for you and you need to add index.php because you don't have the mod_rewrite module enabled on your server. – Marius Sep 4 '14 at 12:05
2

So my website is in German and controller worked when I added (...).com/de/ arithmetic/integer/multiply (without spaces :).

|improve this answer|||||
  • Can I ask why you downwote? – Alan Sep 4 '14 at 11:40
  • can you try this url www.domain.com/index.php/arithmetic/integer/multiply ? – Rajeev K Tomy Sep 4 '14 at 11:47
  • I'm curious why the downvotes also. The answer comes from the OP and states that it fixed the problem. You can vote to close as off topic but why downvote. Seams like a legit answer to me. Here is a +1 to compensate. – Marius Sep 4 '14 at 11:48
  • @Marius : i cant believe this url worked ! So downvoted ! when I realized it really worked, I became obliged and hence I removed downvoting and put an upvote. He teached me new thing. Thank you Alan for this question. But still I am confused. How did that url worked ????? – Rajeev K Tomy Sep 4 '14 at 11:52
  • Thanks Marius :). @programmer_rkt: I tried this. My reply is in comments below the question. – Alan Sep 4 '14 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.