0

I need to find a way to get the grouped products, find the simple products attached to them, sum the amount sold of these simple product.I have this code for simple products this works fine.

 $productCount = 10;
        $i = 0;
        $id = Mage::getModel('catalog/category')->load(6);    
        $product = Mage::getResourceModel('reports/product_collection')
            ->addOrderedQty()
            ->setOrder('ordered_qty', 'desc')
            ->addAttributeToSelect('*')  
            ->setStoreId($storeId)
            ->addCategoryFilter($id)
            ->setPageSize($productCount);


        foreach ($product as $p) {
            var_dump($p)
        }
4

0 に答える 0