cancel
Showing results for 
Search instead for 
Did you mean: 

SKUs from Orders

SKUs from Orders

Hi,

Does anyone know the best way to get all unique product SKUs from all orders of the user who is currently logged in?

 

For Example:

User john@email.com has placed 3 orders.

 

Order 1 contains SKUs: 0001, 0002 and 0003

Order 2 contains SKUs: 0002 and 0004

Order 3 contains SKUs: 0001, 0002 and 0005

 

I'm looking for the returned list of SKUs to be: 0001, 0002, 0003, 0004 and 0005.

 

The aim is to create a list of all the products they have ordered in one page along with the product thumbnail, name and a link to the product page.

 

Thanks,

Nick

5 REPLIES 5

Re: SKUs from Orders

You can write a simple query to fetch what is needed. Pull all the orders and their items on the basis of customer, group it by Product SKU. You'll get what is needed. You can use the same query and create a simple module to list or design the way you want your screen to look.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: SKUs from Orders

Hi,
Thanks for your reply, it’s greatly appreciated. Would you be able to help write the query?

I currently have a query but have been unable to prevent duplicate items.

Thanks,
Nick

Re: SKUs from Orders

Can you share the query you wrote so we can improve it ?

Maxime Coudreuse, developer of Product Manager for Magento: User-friendly product editor with customizable grid interface and category tree for Magento 1 and 2

Re: SKUs from Orders

Hi,

 

There are just 3 simple steps to get what they want.

Step 1: Add new tab to My Account

Step 2: Create Block in your module

Step 3: Create template and get data from your Block

 

Please check here to see the specific code! Hope it can help!

[ Tigren - Elite Magento E-commerce Solutions Provider - www.tigren.com ]

Re: SKUs from Orders

That looks like it could do the trick! I’ll give it a go shortly. Thanks!