[-] BO: Fix the product indexation only on the default shop #PSCFV-5227
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()).')';
|
||||
|
||||
Reference in New Issue
Block a user