Jump to content

New javascript variables from database


Spouter
 Share

Recommended Posts

I see in PS code some prestashop variables in <head> section. For example "var prestashop". Than i can access these variables in js files for example "prestashop.currency.iso_code" will print "EUR" in my case.

But how can I add new variables? I need to add all available currencies with conversions rates.

Share this post


Link to post
Share on other sites

As always - this forum is dead...

Maybe it help someone:
 

    public function hookHeader($params)
    {   

        Media::addJsDef(
            array(
                'currency_id' => (int)$this->context->currency->id,
                'conversion_rate' => Context::getContext()->currency->getConversionRate(),
             )
        );
    }

 

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
 Share

×
×
  • Create New...

Important Information

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