Jump to content

New javascript variables from database


Spouter

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.

Link to comment
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(),
             )
        );
    }

 

Link to comment
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...