arifur rahman
arifur rahman

Reputation: 264

prestashop 1.5 core file overwrite

I want to overwrite prestashop 1.5 core file FrontController.php to overwrite from override\classes\controller folder but it didn't load my overwrite folder file.

<?php

    class FrontController extends FrontControllerCore
    {

    /* Display a specific page if the user country is not allowed */
        protected function displayRestrictedCountryPage() {

        }
    }

Any body have idea how to over write core prestashop file in 1.5

I also follow this document but no way to solve.

Upvotes: 3

Views: 2928

Answers (5)

Michael
Michael

Reputation: 21

The function you're trying to override is called in the core function init(). what you should do is to override both init() and displayRestrictedCountryPage(). Then inside the init function use Controller::init() instead of parent::init()

Upvotes: 1

Michael
Michael

Reputation: 21

The problem may be, that one of your functions which contains parent::nameOfFunction, You should replace parent in the function by the inheritance of the parent function you want to override.

Upvotes: 1

Siva Kumar
Siva Kumar

Reputation: 560

Just remove the class_index.php under /cache folder.

It carries Presta's Class & Controller file details. Once you delete and reload the page, prestashop will automatically generate the file with latest changes.

Upvotes: 2

HMagdy
HMagdy

Reputation: 3295

After override whatever you want don"t forget to delete the cache folder contents and recreate them because that lost my time for a while till found the solution here

Upvotes: 0

Alexander Simonchik
Alexander Simonchik

Reputation: 966

Prestashop 1.5.x automatically merge default override file and you custom file on module::install() function. You just need to create a correct hierarchy in your module folder: modules/your_package/override/classes/controller/FrontController.php with your custom functional. If you don't have an extension and want to add override manually - you need to change the file override/classes/controller/FrontController.php

Upvotes: 6

Related Questions