cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase history of product in admin product page

Purchase history of product in admin product page

Is there a way in Magento to see when a product was last purchased while looking at the product in either the "Manage Products" page or inside the product itself?

2 REPLIES

Re: Purchase history of product in admin product page

Hi,

 

@letssewllc

 

You need to create a module for this. You can either show this in Product grid, or in a tab in product edit page.

 

the follwing code should help

 

// product last purchase date 

$productId
= $productId; $collection = Mage::getModel('sales/order_item')
->
getCollection()
->
addFieldToFilter('product_id', array("eq" => $productId))
->
addFieldToSort('created_at', 'DESC')
->
addPageSize(1)->addCurPage(1); if($collection->count()) {
$itemPurchaseDate = $collection->getFirstItem()->getCreatedAt(); }

 

There are tutorials available how you can create modules.

 

If you need more information please post your reply.

Re: Purchase history of product in admin product page

@asrarau

 

I will see what I can do. Thanks. If I need any help I will make sure to reply.