[-] BO: Fix #PSCFV-8179 shop domain used in emails sometimes was for the wrong shop
This commit is contained in:
@@ -143,25 +143,39 @@ class ShopUrlCore extends ObjectModel
|
||||
return Db::getInstance()->getValue($sql);
|
||||
}
|
||||
|
||||
public static function getMainShopDomain()
|
||||
public static function getMainShopDomain($id_shop = null)
|
||||
{
|
||||
if (!self::$main_domain)
|
||||
if (!self::$main_domain || $id_shop !== null)
|
||||
self::$main_domain = Db::getInstance()->getValue('SELECT domain
|
||||
FROM '._DB_PREFIX_.'shop_url
|
||||
WHERE main=1 AND id_shop = '.Context::getContext()->shop->id);
|
||||
WHERE main=1 AND id_shop = '.($id_shop !== null ? (int)$id_shop : Context::getContext()->shop->id));
|
||||
return self::$main_domain;
|
||||
}
|
||||
|
||||
public static function getMainShopDomainSSL()
|
||||
public static function cacheMainDomainForShop($id_shop)
|
||||
{
|
||||
if (!self::$main_domain_ssl)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_shop))
|
||||
return false;
|
||||
|
||||
ShopUrl::getMainShopDomain($id_shop);
|
||||
ShopUrl::getMainShopDomainSSL($id_shop);
|
||||
}
|
||||
|
||||
public static function resetMainDomainCache()
|
||||
{
|
||||
self::$main_domain = null;
|
||||
self::$main_domain_ssl = null;
|
||||
}
|
||||
|
||||
|
||||
public static function getMainShopDomainSSL($id_shop = null)
|
||||
{
|
||||
if (!self::$main_domain_ssl || $id_shop !== null)
|
||||
$sql = 'SELECT domain_ssl
|
||||
FROM '._DB_PREFIX_.'shop_url
|
||||
WHERE main = 1
|
||||
AND id_shop='.Context::getContext()->shop->id;
|
||||
AND id_shop = '.($id_shop !== null ? (int)$id_shop : Context::getContext()->shop->id);
|
||||
self::$main_domain_ssl = Db::getInstance()->getValue($sql);
|
||||
}
|
||||
return self::$main_domain_ssl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user