Jump to content

global variable for dropdown list in plugin

Recommended Posts

In my plugin, in configuration screen I set up a dropdown menu. I retrieve the option list by calling my API

I have to call my API three times, so in the public function getContent I begin:

        $f24_template_url = $this->baseUrl.'/api/v0.3/GetTemplate';
        $f24_pdc_url = $this->baseUrl.'/api/v0.3/GetPdc';
        $f24_sezionali_url = $this->baseUrl.'/api/v0.3/GetNumerator';
	    $send_data = array();
        $send_data['apiKey'] = Configuration::get('PS_FATTURA24_API');
        $templates = $this->curlDownload($f24_template_url, http_build_query($send_data));
        $f24_pdc = $this->curlDownload($f24_pdc_url, http_build_query($send_data));
        $f24_sezionali = $this->curlDownload($f24_sezionali_url, http_build_query($send_data));

Later I build the list this way:

            array(... 'listaModelliOrdine' => $this->getTemplate(true),
				  ... 'listaModelliFattura' => $this->getTemplate(false),

By getTemplate method I read $templates values and build the list according to my needs. Since I don't want to call APIs more than three times I want to set up a global variable which can be read from my getTemplate method, but now I read that global variables are forbidden in Prestashop. Any suggestions? Thanks

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
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More