[-] BO : #PSCFV-2473 - Fix bug with attribute value and shop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15531 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-05-21 15:32:56 +00:00
parent a75cf1475d
commit b621e0f9eb
4 changed files with 9 additions and 2 deletions
+2
View File
@@ -148,6 +148,8 @@ class AttributeCore extends ObjectModel
ON a.`id_attribute_group` = ag.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
'.Shop::addSqlAssociation('attribute_group', 'ag').'
'.Shop::addSqlAssociation('attribute', 'a').'
'.($not_null ? 'WHERE a.`id_attribute` IS NOT NULL AND al.`name` IS NOT NULL' : '').'
ORDER BY agl.`name` ASC, a.`position` ASC
');
+4
View File
@@ -2834,6 +2834,7 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group`
'.Shop::addSqlAssociation('attribute', 'a').'
WHERE pa.`id_product` = '.(int)$this->id.'
AND al.`id_lang` = '.(int)$id_lang.'
AND agl.`id_lang` = '.(int)$id_lang.'
@@ -4592,6 +4593,7 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Shop::addSqlAssociation('attribute', 'pac').'
WHERE pa.`id_product` = '.(int)$id_product.'
AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')');
$result = array_merge($values_not_custom, $result);
@@ -4610,6 +4612,7 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Shop::addSqlAssociation('attribute', 'pac').'
WHERE pa.`id_product` = '.(int)$id_product);
}
}
@@ -4627,6 +4630,7 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Shop::addSqlAssociation('attribute', 'pac').'
WHERE pa.`id_product` = '.(int)$id_product);
}
return $result;
@@ -691,8 +691,9 @@ class AdminAttributesGroupsControllerCore extends AdminController
$item = &$this->_list[$i];
$query = new DbQuery();
$query->select('COUNT(id_attribute) as count_values');
$query->select('COUNT(a.id_attribute) as count_values');
$query->from('attribute', 'a');
$query->join(Shop::addSqlAssociation('attribute', 'a'));
$query->where('a.id_attribute_group ='.(int)$item['id_attribute_group']);
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
$item['count_values'] = (int)$res;
@@ -461,7 +461,7 @@ class AdminFeaturesControllerCore extends AdminController
$item = &$this->_list[$i];
$query = new DbQuery();
$query->select('COUNT(id_feature_value) as count_values');
$query->select('COUNT(fv.id_feature_value) as count_values');
$query->from('feature_value', 'fv');
$query->where('fv.id_feature ='.(int)$item['id_feature']);
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);