Bhawin Parkeria
Bhawin Parkeria

Reputation: 51

PrestaShop - Overriding a controller does not work

I want to override a controller in PrestaShop

<?php

class ProductController extends ProductControllerCore{

    public function initContent()
    {

        parent::initContent();
    }
    public function init()
    {
        parent::init();
        echo "datbase";
        die;
    }
}

?>

The file containing my Override is located in:

projectname/override/controllers/front/ProductController.php

But my override does not work.

Upvotes: 2

Views: 4501

Answers (2)

Bruno Leveque
Bruno Leveque

Reputation: 2811

Updated answer for PrestaShop 1.7.x

In PrestaShop 1.7.x versions, the class_index.php file is now located in /var/cache/prod:

PrestaShop 1.7 class_index.php file

Don't forget to delete this file in case you've just added a new override, otherwise it won't work.

I hope this helps!

Upvotes: 2

Bhawin Parkeria
Bhawin Parkeria

Reputation: 51

Ok i got it now from researching somethings

I found the solution:

You should delete the file "class_index.php" in cache folder.

Upvotes: 1

Related Questions