I want to display the customer's name, location and date who bought the product previously on the product page,

can anybody tell me how to do it,

please provide me the code for the same

1 Answer 1


Yes for this, you will need 1. Order data

So to load order data by product,

$order = Mage::getModel('sales/order')->getCollection();

foreach($order->getAllItems() as $item){

    //Here add your logic to match with your current product id
    if($currentProductId == $item->getProductId()){

        $customer = $order->getCustomer();
        //Now you have got the customer object 

        //so you can fetch details which you want by your logic

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.