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?

10
  • put <?php at top of your controller Commented Sep 4, 2014 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
    Commented Sep 4, 2014 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
    Commented Sep 4, 2014 at 11:32
  • call your controller like this www.domain.com/index.php/arithmetic/integer/multiply Commented Sep 4, 2014 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
    Commented Sep 4, 2014 at 12:05

1 Answer 1

2

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

8
  • Can I ask why you downwote?
    – Alan
    Commented Sep 4, 2014 at 11:40
  • can you try this url www.domain.com/index.php/arithmetic/integer/multiply ? Commented Sep 4, 2014 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
    Commented Sep 4, 2014 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 ????? Commented Sep 4, 2014 at 11:52
  • Thanks Marius :). @programmer_rkt: I tried this. My reply is in comments below the question.
    – Alan
    Commented Sep 4, 2014 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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