Jump to content

Edit History

ANGELO Vintage

ANGELO Vintage

On 8/31/2017 at 2:31 PM, bellini13 said:

another thought is to add logic in your override code, so that you first check to ensure that your module is installed and enabled before executing.  If not installed, or disabled, then you would skip your override code, and just execute the parent code.

 

This way, if PS fails to remove your override code, you atleast have a backup

that i a good idea, i've tried to identify if the module is active and not running the override but i was not able to accomplish it

 

my ProductController.php override is:

 

<?php

class ProductController extends ProductControllerCore
{


    /**
     * Initialize product controller
     * @see FrontController::init()
     */
    public function init()
    {
        parent::init();

        if ($id_product = (int)Tools::getValue('id_product')) {
            $this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
        }
		
		...
		...

    }
}

i tried to place inside the init() function the check:

 

if (Module::isEnabled('my_module_name') 

buit if the module is disabled all the init() in the override produce a white page so where i need to put the check so if the module is disabled/uninstalled the override is not executed?

 

Thanks

ANGELO Vintage

ANGELO Vintage

On 8/31/2017 at 2:31 PM, bellini13 said:

another thought is to add logic in your override code, so that you first check to ensure that your module is installed and enabled before executing.  If not installed, or disabled, then you would skip your override code, and just execute the parent code.

 

This way, if PS fails to remove your override code, you atleast have a backup

that i a good idea, i've tried to identify if the module is active and not running the override but i was not able to accomplish it

 

my OProductCXontroller.php override is:

 

<?php

class ProductController extends ProductControllerCore
{


    /**
     * Initialize product controller
     * @see FrontController::init()
     */
    public function init()
    {
        parent::init();

        if ($id_product = (int)Tools::getValue('id_product')) {
            $this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
        }
		
		...
		...

    }
}

i tried to place inside the init() function the check:

 

if (Module::isEnabled('my_module_name') 

buit if the module is disabled all the init() in the override produce a white page so where i need to put the check so if the module is disabled/uninstalled the override is not executed?

 

Thanks

×
×
  • Create New...