[-] BO: Fix the product indexation only on the default shop #PSCFV-5227

This commit is contained in:
Rémi Gaillard committed 2012-11-22 15:35:29 +01:00
1 parent 5dfa888b6f
commit c5f52bcf7c
3 files changed
+5 -3

No files matched your search

+2
View File
@@ -24,7 +24,9 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
define('_PS_ADMIN_DIR_', getcwd());
include(dirname(__FILE__).'/../config/config.inc.php'); include(dirname(__FILE__).'/../config/config.inc.php');
Context::getContext()->shop->setContext(Shop::CONTEXT_ALL);
if (substr(_COOKIE_KEY_, 34, 8) != Tools::getValue('token')) if (substr(_COOKIE_KEY_, 34, 8) != Tools::getValue('token'))
die; die;
+1 -1
View File
@@ -1255,7 +1255,7 @@ abstract class ObjectModelCore
} }
$sql = 'UPDATE '._DB_PREFIX_.$def['table'].' a $sql = 'UPDATE '._DB_PREFIX_.$def['table'].' a
'.Shop::addSqlAssociation($def['table'], 'a').' '.Shop::addSqlAssociation($def['table'], 'a', true, null, true).'
SET '.implode(', ', $update_data).' SET '.implode(', ', $update_data).'
WHERE '.$where; WHERE '.$where;
return Db::getInstance()->execute($sql); return Db::getInstance()->execute($sql);
+2 -2
View File
@@ -916,7 +916,7 @@ class ShopCore extends ObjectModel
* @param string $on * @param string $on
* @return string * @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'; $table_alias = $table.'_shop';
if (strpos($table, '.') !== false) if (strpos($table, '.') !== false)
@@ -929,7 +929,7 @@ class ShopCore extends ObjectModel
ON ('.$table_alias.'.id_'.$table.' = '.$alias.'.id_'.$table; ON ('.$table_alias.'.id_'.$table.' = '.$alias.'.id_'.$table;
if ((int)self::$context_id_shop) if ((int)self::$context_id_shop)
$sql .= ' AND '.$table_alias.'.id_shop = '.(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'; $sql .= ' AND '.$table_alias.'.id_shop = '.$alias.'.id_shop_default';
else else
$sql .= ' AND '.$table_alias.'.id_shop IN ('.implode(', ', Shop::getContextListShopID()).')'; $sql .= ' AND '.$table_alias.'.id_shop IN ('.implode(', ', Shop::getContextListShopID()).')';