Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
nickon

custom module install

Question

Hi,

I had created a module a few years ago and it still is working. Problem is that while trying a gdpr module the module is not listed in the installed modules. After contacting the gpdr module developer he said that it does not show in prestashop core as installed module (although the module is working fine).

In short the module adds some code to the page so that it can work with a price comparison site.

The install script is the following.

<?php

if (!defined('_PS_VERSION_'))
    exit;

class skroutzAnalytics extends Module
{

    protected $_errors = array();


    public function __construct()
    {
        $this->name = 'skroutzanalytics';
        $this->tab = 'front_office_features';
        $this->version = '1.0';
        $this->author = 'Niktaris Nikos';
        $this->need_instance = 1;


        $this->bootstrap = true;


         parent::__construct();

        $this->displayName = $this->l('skroutzanalytics');
        $this->description = $this->l('Adds skroutz analytics.');
        $this->confirmUninstall = $this->l('Are you sure you want to delete this module?');
    }
    
    public function install()
    {
        if (!parent::install() OR
            !$this->registerHook('orderConfirmation') || !$this->registerHook('header')
            )
            return false;
        return true;
    }
    
    public function uninstall()
    {
        if (!parent::uninstall())
            return false;
        return true;
    }


    public function hookDisplayHeader()
    {

        return $this->display(__FILE__, 'header.tpl');

    }
    public function hookOrderConfirmation($params)
    {
        // var_dump($params['objOrder']);

        $order = $params['objOrder'];
        $products = $order->getProducts();


        // var_dump($products);
        $this->context->smarty->assign(array(
            'order'=> $order,
            'order_products' => $products
        ));
        
        return $this->display(__FILE__, 'confirmation.tpl');
    }

    
}

Is there an obvius error somewhere that I am missing?

Would be nice if a dev could help

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I'm just wondering what this has to do with gdpr module...?

Anyway, the code is pretty much ok. I would drop 

  $this->need_instance = 1;

because it's tells thirtybees to instantiate this module every time it renders Modules page in back office, which can slow it down a bit. But other than that, there's nothing wrong with it. And if you have your skroutz javascript on your order confirmation page, then the module must be installed properly.

Share this post


Link to post
Share on other sites
  • 0

Didn,t get an email about the replies...

Anyway,

Thanks for the feedback,

@datakick This has more to do with the cookies part of the gdpr. The gdpr module lists all installed modules and gives you the option to add them to a cookies category and inform the client about the cookie it is creating. If the customer does not select the cookie of that module, the module will be disabled thus removing the cookie. Reinstalling the module worked and since this is a multilanguage site the max_var_inputs where to low to list all the modules. the developer fixed that problem

 

Thanks again

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×