1

I am trying to create a module for magento. I have placed it in 'local' codepool, 'Sample' namespace, 'Practice' folder . It appears in admin panel but when I type the url I get 404 response.

config.xml

 <config>
    <modules>
    <Sample_Practice>
     <version>0.1.0</version>

    </Sample_Practice>
    </modules>

    <frontend>
        <routers>
            <practice>
                <use>standard</use>
                <args>
                    <module>Sample_Practice</module>
                    <frontName>practice</frontName>
                </args>
            </practice>
        </routers>  
    </frontend>

    </config>

module config file name is Sample_Practice.xml

   <config>
    <modules>

       <Sample_Practice>

         <active>true</active>
         <codepool>local</codepool>

       </Sample_Practice>

    </modules>

    </config>

IndexController.php

<?php

   class Sample_Practice_IndexController extends      Mage_Core_Controller_Front_Action {        
   public function indexAction() {
    echo 'Practice module';
   }
 }

?>

Where is my code breaking ?

  • Are you disable/refresh cache ? – Thao Pham Dec 8 '15 at 9:00
  • Yes, my cache is disabled. – Krrish Raj Dec 8 '15 at 9:05
  • have you added IndexController.php ad location \app\code\local\Sample\Practice\controllers? – Abdul Dec 8 '15 at 9:07
  • Yes, I have added it in controllers folder. @Abdul – Krrish Raj Dec 8 '15 at 9:10
  • What URL are you accessing that is showing 404? – Jonathan Hussey Dec 8 '15 at 9:19
0

There are few issue in your modules:

  • codepool should be codePool in module config file Sample_Practice.xml .Means P should be in capital letter

This magento 1.X methodology

0

Replace your code from

<config>
    <modules>

       <Sample_Practice>

         <active>true</active>
         <codepool>local</codepool>

       </Sample_Practice>

    </modules>

    </config>

To

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

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.