VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: kiwee on November 17, 2016, 10:19:59 AM

Title: List all product bought by the customer
Post by: kiwee on November 17, 2016, 10:19:59 AM
Hi,

Is there a way to display a list of all the products a customer bought ? Something like
Product I bought :
product XX : image / link to the order
product YY : image / link to the order
...

I know this is very specific, but if someone has even the beginning of an idea it would be great :D

Thanks
Title: Re: List all product bought by the customer
Post by: GJC Web Design on November 17, 2016, 13:51:02 PM
u need to write a module,

do a query in orders  using the logged in userid

display results
Title: Re: List all product bought by the customer
Post by: kiwee on November 17, 2016, 16:54:10 PM
That is what I'm doing.

Thanks.
Title: Re: List all product bought by the customer
Post by: Studio 42 on November 17, 2016, 17:12:51 PM
Hi,
The module exist already in my shop :
http://shop.st42.fr/en/products/products-any-ways.htm
This permit to display product in cart,product ordered .... in many ways.

Regards,
Patrick

Note that i don't test release with obselete Virtuemart 2.x releases
Title: Re: List all product bought by the customer
Post by: Ghost on November 18, 2016, 08:49:58 AM
In order list view you can add something like this to get all your orders with details (including products bought).

$orderModel = VmModel::getModel('orders');
foreach($this->orderlist as $order)
{
$orders[] = $orderModel->getMyOrderDetails($order->virtuemart_order_id);
}


The rest depends on how you want them displayed.
Title: Re: List all product bought by the customer
Post by: Studio 42 on November 18, 2016, 10:56:43 AM
Ghost,
it only work for 1 order, not for all products
Title: Re: List all product bought by the customer
Post by: Ghost on November 18, 2016, 11:14:36 AM
Works with all user's orders. $this->orderlist already contains orders but only basic information. For each order use getMyOrderDetails to get detailed information.
Title: Re: List all product bought by the customer
Post by: Studio 42 on November 18, 2016, 12:55:18 PM
Yes, but it's not the product list, but the order details products, so the customfield for eg. are this from user and you cannot add a add to cart, or you need to recall using the producti id.
And of course, adding code to get right display ...
My module is not to see the list of product as order details, but to display list of products brought but with the possibility to add to cart for eg.
Si this depend the real need, displaying the product in the orders(for eg. if you have donwload links) or permit user tu buy same product again.