Search code examples
phpmoduleoverridingprestashopprestashop-1.6

Prestashop - How to override another module in own module


I create own module. This module should override the BlockCart class.

I created a file /mymodule/override/blockcart/blockcart.php but this file is not executed.

I can not place this file in / override because the module must work on several shops and the instalation must works.

How I can do this?


Solution

  • You have to put your file in the right path of your module:

    mymodule/override/modules/blockcart/blockcart.php

    Then your blockcart.php should be like this:

    class BlockCartOverride extends BlockCart
    {
        /* your stuff */
    }
    

    During the installation PrestaShop install your override.

    Useful link:
    - How to override modules