-
- stevethomas

-
Total Posts: 11
Joined: 2008-06-13
|
Is this possible or would I need to program this, if so has anyone tried…
Thanks
|
| |
-
- Posted: July 7 2008
-
| top
-
|
 |
 |
 |
|
|
-
- mirelon

-
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
|
| |
-
- Posted: November 4 2008
-
| top
| # 1
-
|
 |
 |
 |
|
|
-
- joyously

-
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).
|
| |
-
- Posted: November 5 2008
-
| top
| # 2
-
|
 |
 |
 |
|
|
-
- mirelon

-
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…
|
| |
-
- Posted: November 5 2008
-
| top
| # 3
-
|
 |
 |
 |
|
|
-
- cyana

-
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
|
| |
-
- Posted: December 8 2008
-
| top
| # 4
-
|
 |
 |
 |
|
|
-
- joyously

-
Total Posts: 447
Joined: 2008-08-21
|
I think you have to get the collection from the quote table instead.
|
| |
-
- Posted: December 10 2008
-
| top
| # 5
-
|
 |
 |
 |
|
|
-
- dradcliffe

-
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?
|
| |
-
- Posted: January 6 2009
-
| top
| # 6
-
|
 |
 |
 |
|
|
-
- mirelon

-
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.
|
| |
-
- Posted: January 19 2009
-
| top
| # 7
-
|
 |
 |
 |
|
|
-
- mirelon

-
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; ?>
|
| |
-
- Posted: January 21 2009
-
| top
| # 8
-
|
 |
 |
 |
|
|
-
- mirelon

-
Total Posts: 41
Joined: 2008-11-04
|
sorry for double post, i dont know how to delete this post
|
| |
-
- Posted: January 21 2009
-
| top
| # 9
-
|
 |
 |
 |
|
|