// Fix join between product_attribute and product_attribute_shop on getproducts methods

This commit is contained in:
rMalie
2012-04-17 16:10:51 +00:00
parent 652d60525b
commit 60b281c4e3
4 changed files with 7 additions and 8 deletions
+4 -3
View File
@@ -730,10 +730,10 @@ class ShopCore extends ObjectModel
* @param string $table Table name (E.g. product, module, etc.)
* @param string $alias Alias of table
* @param bool $inner_join Use or not INNER JOIN
* @param Context $context
* @param string $on
* @return string
*/
public static function addSqlAssociation($table, $alias, $inner_join = true)
public static function addSqlAssociation($table, $alias, $inner_join = true, $on = null)
{
$table_alias = $table.'_shop';
if (strpos($table, '.') !== false)
@@ -745,7 +745,8 @@ class ShopCore extends ObjectModel
$sql = (($inner_join) ? ' INNER' : ' LEFT').' JOIN '._DB_PREFIX_.$table.'_shop '.$table_alias.'
ON '.$table_alias.'.id_'.$table.' = '.$alias.'.id_'.$table.'
AND '.$table_alias.'.id_shop IN('.implode(', ', Shop::getContextListShopID()).') ';
AND '.$table_alias.'.id_shop IN('.implode(', ', Shop::getContextListShopID()).') '
.(($on) ? ' AND '.$on : '');
return $sql;
}