How do I override my Tools.php file ?

Need help ? What is below sounds too complicated and you're afraid to do this yourself ? No problem ! Contact us !

 

PrestaShop 1.5 & 1.6:

1) Go into the /modules/gmerchantcenter/override_files/1.5/classes folder
2) Copy the Tools.php file
3) Upload it to the /override/classes/ folder of your PrestaShop installation
4) Open the /cache/class_index.php file and look for this code:

'Tools' => '',

and replace it by:

'Tools' => 'override/classes/Tools.php',

Note: if the Tools.php class has already been overridden, then you will need to have your developer insert the code from our override into his own work.

 

PrestaShop 1.4:

1) Go into the /modules/gmerchantcenter/override_files/1.4/classes folder
2) Copy the Tools.php file
3) Upload it to the /override/classes/ folder of your PrestaShop installation

Note: if the Tools.php class has already been overridden, then you will need to have your developer insert the code from our override into his own work.

 

PrestaShop 1.2 / 1.3:

1) Open the /classes/Tools.php file and make a backup of this file before modifying it
2) Look for function setCurrency() (line 140 on version 1.2.5, line 202 on version 1.3.7) and look for this code:

global $cookie;

if (self::isSubmit('SubmitCurrency'))
    if (isset($_POST['id_currency']) AND is_numeric($_POST['id_currency']))
    {
        $currency = new Currency(intval($_POST['id_currency']));
        if (is_object($currency) AND $currency->id AND !$currency->deleted)
            $cookie->id_currency = intval($currency->id);
    }

 

and replace it by:

global $cookie;

if (isset($_GET['gmc_currency']) AND is_numeric($_GET['gmc_currency']))
{
    $currency = new Currency(intval($_GET['gmc_currency']));
    if (is_object($currency) AND $currency->id AND !$currency->deleted)
        $cookie->id_currency = intval($currency->id);
}

if (self::isSubmit('SubmitCurrency')) 
    if (isset($_POST['id_currency']) AND is_numeric($_POST['id_currency']))
    {
        $currency = new Currency(intval($_POST['id_currency']));
        if (is_object($currency) AND $currency->id AND !$currency->deleted)
            $cookie->id_currency = intval($currency->id);
    }

Other FAQs in this category