[-] BO : BugFix : #PSCFV-2798 : Multistore : BUG on the "modify products page" with another shop device
This commit is contained in:
+11
-2
@@ -414,12 +414,21 @@ class ToolsCore
|
||||
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 && $currency->isAssociatedToShop())
|
||||
return $currency;
|
||||
if (is_object($currency) && (int)$currency->id && (int)$currency->deleted != 1 && $currency->active)
|
||||
if ($currency->isAssociatedToShop())
|
||||
return $currency;
|
||||
else
|
||||
{
|
||||
// get currency from context
|
||||
$currency = Shop::getEntityIds('currency', Context::getContext()->shop->id);
|
||||
$cookie->id_currency = $currency[0]['id_currency'];
|
||||
return Currency::getCurrencyInstance((int)$cookie->id_currency);
|
||||
}
|
||||
}
|
||||
$currency = Currency::getCurrencyInstance(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
if (is_object($currency) && $currency->id)
|
||||
$cookie->id_currency = (int)$currency->id;
|
||||
|
||||
return $currency;
|
||||
}
|
||||
|
||||
|
||||
@@ -312,9 +312,10 @@ class AdminControllerCore extends Controller
|
||||
// Get the name of the folder containing the custom tpl files
|
||||
$this->tpl_folder = Tools::toUnderscoreCase(substr($this->controller_name, 5)).'/';
|
||||
|
||||
$this->context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
|
||||
$this->initShopContext();
|
||||
|
||||
$currency = Shop::getEntityIds('currency', $this->context->shop->id);
|
||||
$this->context->currency = new Currency($currency[0]['id_currency']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -991,4 +991,21 @@ class ShopCore extends ObjectModel
|
||||
Tools::displayAsDeprecated();
|
||||
return Context::getContext()->shop->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param int $id_shop
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function getEntityIds($entity, $id_shop)
|
||||
{
|
||||
if (!Shop::isTableAssociated($entity))
|
||||
return false;
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `id_'.pSQL($entity).'`
|
||||
FROM `'._DB_PREFIX_.pSQL($entity).'_shop`
|
||||
WHERE `id_shop` = '.(int)$id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user