diff --git a/admin-dev/searchcron.php b/admin-dev/searchcron.php index 022bcf676..ce922f1e3 100644 --- a/admin-dev/searchcron.php +++ b/admin-dev/searchcron.php @@ -24,7 +24,9 @@ * International Registered Trademark & Property of PrestaShop SA */ +define('_PS_ADMIN_DIR_', getcwd()); include(dirname(__FILE__).'/../config/config.inc.php'); +Context::getContext()->shop->setContext(Shop::CONTEXT_ALL); if (substr(_COOKIE_KEY_, 34, 8) != Tools::getValue('token')) die; diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 16e24d106..4946ae6b8 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -1255,7 +1255,7 @@ abstract class ObjectModelCore } $sql = 'UPDATE '._DB_PREFIX_.$def['table'].' a - '.Shop::addSqlAssociation($def['table'], 'a').' + '.Shop::addSqlAssociation($def['table'], 'a', true, null, true).' SET '.implode(', ', $update_data).' WHERE '.$where; return Db::getInstance()->execute($sql); diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index e01abf3ee..0f436a028 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -916,7 +916,7 @@ class ShopCore extends ObjectModel * @param string $on * @return string */ - public static function addSqlAssociation($table, $alias, $inner_join = true, $on = null) + public static function addSqlAssociation($table, $alias, $inner_join = true, $on = null, $force_not_default = false) { $table_alias = $table.'_shop'; if (strpos($table, '.') !== false) @@ -929,7 +929,7 @@ class ShopCore extends ObjectModel ON ('.$table_alias.'.id_'.$table.' = '.$alias.'.id_'.$table; if ((int)self::$context_id_shop) $sql .= ' AND '.$table_alias.'.id_shop = '.(int)self::$context_id_shop; - elseif (Shop::checkIdShopDefault($table)) + elseif (Shop::checkIdShopDefault($table) && !$force_not_default) $sql .= ' AND '.$table_alias.'.id_shop = '.$alias.'.id_shop_default'; else $sql .= ' AND '.$table_alias.'.id_shop IN ('.implode(', ', Shop::getContextListShopID()).')';