Jump to content

Multistore and currencies on BO


mohamed23

Recommended Posts

Hello guys , hope someone can help me.

I'm running prestashop(1.5) with multistore configuration, the default currency is EUR but I set some additionnal currencies for each shop

everything is working fine. The only issue I have is that I want to keep all currencies enabled on the back office regardless of the selected shop

I know it somewhere here :

public static function setCurrency($cookie)
    {
        if (Tools::isSubmit('SubmitCurrency'))
            if (isset($_POST['id_currency']) && is_numeric($_POST['id_currency']))
            {
                $currency = Currency::getCurrencyInstance($_POST['id_currency']);
                if (is_object($currency) && $currency->id && !$currency->deleted && $currency->isAssociatedToShop())
                    $cookie->id_currency = (int)$currency->id;
            }

        $currency = Currency::getCurrencyInstance(Configuration::get('PS_CURRENCY_DEFAULT'));
        if ((int)$cookie->id_currency)
            $currency = Currency::getCurrencyInstance((int)$cookie->id_currency);

        if (is_object($currency) && (int)$currency->id && (int)$currency->deleted != 1 && $currency->active)
        {
            $cookie->id_currency = (int)$currency->id;
            if ($currency->isAssociatedToShop())
                return $currency;
            else
            {
                // get currency from context
                $currency = Shop::getEntityIds('currency', Context::getContext()->shop->id, true, true);
                if (isset($currency[0]) && $currency[0]['id_currency'])
                {
                    $cookie->id_currency = $currency[0]['id_currency'];
                    return Currency::getCurrencyInstance((int)$cookie->id_currency);
                }
            }
        }
        return $currency;
    }
 

 

thank you

Link to comment
Share on other sites

  • 2 weeks later...

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...