Cookie compliance integration for PrestaShop 1.7

Cookie compliance integration for PrestaShop 1.7

Written by NelsonLast update 1 month ago

To install the CookieScript cookie banner code on PrestaShop 1.7, perform the following steps:

  1. Go to your account > Settings > Installation.

  2. Configure geo-targeting (if needed).

  3. Copy your item's src attribute's value (i.e. the file URL) from your CookieScript code.

  4. Open the {project_directory}/classes/controller/FrontController.php file.

  5. Go to setMedia() function.

  6. Add the following code, where your-file-URL is your item's src attribute value.

    ['server' => 'remote', 'position' => 'head', 'priority' => 20]

There are 2 positions where you can set your CookieScript file:

  1. The top of the page (inside <header>) by setting the position to top like this ‘position’ => ‘top’. 

  2. The end of the tag <body> by ‘position’ => ‘bottom’. 

CookieScript is installed on PrestaShop 1.7 now and should be ready for use.

Did this answer your question?