Magento - How to extend Front Controller

odd_duck

I am need of making a change to the Magento function _checkBaseUrl found within:

app/code/core/Mage/Core/Controller/Varien/Front.php

As best practice I am trying to extend it with my own module so I am not editing the core code and files but it is not working. If I make the change in the core file i get the desired response but when using this it doesn't work. My module is showing up as Enabled in Configuration > Advanced > Advanced

Files are as below:

etc/modules/Me_Coreextend.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Me_Coreextend>
            <active>true</active>
            <codePool>local</codePool>
        </Me_Coreextend>
    </modules>
</config>

app/code/local/Me/Coreextend/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Me_Coreextend>
            <version>1.0</version>
        </Me_Coreextend>
  </modules>
    <frontend>
        <routers>
            <core>
                <args>
                    <modules>
                         <Me_Coreextend before="Mage_Core">Me_Coreextend</Me_Coreextend>
                    </modules>
                </args>
            </core>
        </routers>
    </frontend>
</config>

app/code/local/Me/Coreextend/Controller/Varien/Front.php

I am including only the _checkBaseUrl function in this file not the whole contents of app/code/core/Mage/Core/Controller/Varien/Front.php - is this correct? (I have tried to include it all as well but that still doesn't work either)

include_once('Mage/Core/Controller/Varien/Front.php');
class Me_Coreextend_Controller_Varien_Front extends Mage_Core_Controller_Varien_Front
{
    protected function _checkBaseUrl($request)
    {
        // custom changes...
    }
}

Is there anything I am doing wrong?

Cristiano Casciotti

You cannot extend Magento's Front Controller because isn't a "standard" service controller (notice that is in the Controller folder and not in the controllers one). As you can see in Mage_Core_Model_App class in _initFrontController method called by run method:

$this->_frontController = new Mage_Core_Controller_Varien_Front();

You can only copy the file in your project's local folder:

app/code/local/Mage/Core/Controller/Varien/Front.php

and safely edit the file according to your business requirements.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to add slideshow in magento front-end

From Dev

How to hide simple products in Magento front end?

From Dev

How to extend Spring MVC Controller Annotation?

From Dev

How to extend a main controller within a meteor package

From Dev

How to get data in function extend controller?

From Dev

How to extend Spring MVC Controller Annotation?

From Dev

OctoberCMS: How to extend a controller by adding or editing RelationController?

From Dev

How to extend femanager controller under php 7

From Dev

How to rewrite/extend a Magento class in an existing third party extension

From Dev

How to get controller method in Observer in magento?

From Dev

how to use other function in the same controller in magento?

From Dev

How to get a url parameter in Magento controller?

From Dev

Magento How to pass data from a controller to a template?

From Dev

how to call controller with jquery ajax magento

From Dev

Magento how to define layout handle for all controller

From Dev

How to get URL of admin controller method in Magento?

From Dev

Magento How to pass data from a controller to a template?

From Dev

How to add an action to the button in Controller of magento?

From Dev

how to use other function in the same controller in magento?

From Dev

magento how to rewrite checkout community controller

From Dev

How to make xdebug not stop in the front controller of Symfony

From Dev

How can i upload image from front-end in magento?

From Dev

How to animate image in tableview to extend and open another view controller simultaneously?

From Dev

How to animate image in tableview to extend and open another view controller simultaneously?

From Dev

How to extend existing links to resources with custom Spring Data Rest Controller

From Dev

Extend Onepage Billing block in Magento

From Dev

AngularJS Extend a controller

From Dev

Extend Marionette.Controller

From Dev

Extend controller with class

Related Related

  1. 1

    how to add slideshow in magento front-end

  2. 2

    How to hide simple products in Magento front end?

  3. 3

    How to extend Spring MVC Controller Annotation?

  4. 4

    How to extend a main controller within a meteor package

  5. 5

    How to get data in function extend controller?

  6. 6

    How to extend Spring MVC Controller Annotation?

  7. 7

    OctoberCMS: How to extend a controller by adding or editing RelationController?

  8. 8

    How to extend femanager controller under php 7

  9. 9

    How to rewrite/extend a Magento class in an existing third party extension

  10. 10

    How to get controller method in Observer in magento?

  11. 11

    how to use other function in the same controller in magento?

  12. 12

    How to get a url parameter in Magento controller?

  13. 13

    Magento How to pass data from a controller to a template?

  14. 14

    how to call controller with jquery ajax magento

  15. 15

    Magento how to define layout handle for all controller

  16. 16

    How to get URL of admin controller method in Magento?

  17. 17

    Magento How to pass data from a controller to a template?

  18. 18

    How to add an action to the button in Controller of magento?

  19. 19

    how to use other function in the same controller in magento?

  20. 20

    magento how to rewrite checkout community controller

  21. 21

    How to make xdebug not stop in the front controller of Symfony

  22. 22

    How can i upload image from front-end in magento?

  23. 23

    How to animate image in tableview to extend and open another view controller simultaneously?

  24. 24

    How to animate image in tableview to extend and open another view controller simultaneously?

  25. 25

    How to extend existing links to resources with custom Spring Data Rest Controller

  26. 26

    Extend Onepage Billing block in Magento

  27. 27

    AngularJS Extend a controller

  28. 28

    Extend Marionette.Controller

  29. 29

    Extend controller with class

HotTag

Archive