// Webservice getters are now multishop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15785 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-06-01 07:45:41 +00:00
parent 4ba9796c92
commit f6059f0a67
9 changed files with 66 additions and 31 deletions
+12 -5
View File
@@ -1306,11 +1306,18 @@ class CategoryCore extends ObjectModel
public function getWsNbProductsRecursive()
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT count(distinct(id_product)) as nb_product_recursive FROM `'._DB_PREFIX_.'category_product`
WHERE id_category IN (SELECT id_category
FROM `'._DB_PREFIX_.'category`
WHERE nleft > '.(int)$this->nleft.
' AND nright < '.(int)$this->nright.' AND active = 1 UNION SELECT '.(int)$this->id.')');
SELECT COUNT(distinct(id_product)) as nb_product_recursive
FROM `'._DB_PREFIX_.'category_product`
WHERE id_category IN (
SELECT c2.id_category
FROM `'._DB_PREFIX_.'category` c2
'.Shop::addSqlAssociation('category', 'c2').'
WHERE c2.nleft > '.(int)$this->nleft.'
AND c2.nright < '.(int)$this->nright.'
AND c2.active = 1
UNION SELECT '.(int)$this->id.'
)
');
if (!$result)
return -1;
return $result[0]['nb_product_recursive'];