Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Print a report of Quantity of each product sold…for period
 
stevethomas
Jr. Member
 
Total Posts:  11
Joined:  2008-06-12
 

Is this possible or would I need to program this, if so has anyone tried…

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
mirelon
Member
 
Total Posts:  41
Joined:  2008-11-04
 

I have similar problem (without that period)
I want to place new block on the left with some statistics telling about count of sold product.
Is there some method (of object Product or related) that returns number of sold product? I didnt find any.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

The admin Dashboard has this, doesn’t it?  But from my tests, it’s not accurate (orders vs. sales).

 
Magento Community Magento Community
Magento Community
Magento Community
 
mirelon
Member
 
Total Posts:  41
Joined:  2008-11-04
 

i found it...but that method getQtyOrdered is of sales/order_item.
I iterate through products with foreach($this->getProductCollection()->getItems() as $_product):
so $_product doesnt have that method because is instance of class Mage_Catalog_Model_Product, not Mage_Sales_Model_Order_Item
I need some sort of converting to that class…

 
Magento Community Magento Community
Magento Community
Magento Community
 
cyana
Jr. Member
 
Total Posts:  11
Joined:  2008-05-21
Los Angeles / Paris
 

Its weird that this options is not in it - I looked everywhere, found nothing -
Basically we need to see the quantity of each product sold - It shouldn’t be to hard to implement ?
Or maybe its an option already there but i didnt saw anything…

Any help would be greatly appreciate - thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

I think you have to get the collection from the quote table instead.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dradcliffe
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2008-06-12
Indianapolis, IN
 

I am looking for this too. Any ideas how to easily compile this type of report?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mirelon
Member
 
Total Posts:  41
Joined:  2008-11-04
 

joyously: what exactly do you mean? I tried $this->getQuoteTable() and some other similar methods, but all of them returned NULL.

EDIT: I found it out now. But it is not the thing i wanted. I found somewhere this:

When a user adds a product to their cart, a quote item is
created from the product and that quote item is what is added to the user’s cart, not
the product itself. When the user completes the order, the quote, and all of its items
are transformed into an order.

So I am interested in orders and iterate them, not quotes.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mirelon
Member
 
Total Posts:  41
Joined:  2008-11-04
 

So after lot of trials here comes the bruteforce solution:
I used the fact that if products are autogenerated from configurable, their sku has prefix of that configurable one.

<?php
  $itemCollection 
Mage::getModel('sales/order_item')->getCollection();
?>
<?php 
foreach($this->getProductCollection()->getItems() as $_product): ?>
  <?php $_product
->load($_product->getId()) ?>
      
<p>
            <
a href="<?php echo $_product->getProductUrl() ?>">
                <
strong>
                    
<?php echo $_product->getName(); ?>
                
</strong>
            </
a>
            <
span>
                
<?php
                  $sum
=0;
                    foreach(
$itemCollection as $item){
                      $p 
Mage::getModel('catalog/product')->load($item->getProductId());
                      if(
stripos($p->getSku(),$_product->getSku())===0)
                  
$sum+=$item->getQtyOrdered();
              
}
              
echo $sum;
                
?>
            
</span>
             
downloads
        
</p>  
<?php endforeach; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
mirelon
Member
 
Total Posts:  41
Joined:  2008-11-04
 

sorry for double post, i dont know how to delete this post

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top