Press "Enter" to skip to content

Month: June 2012

Extracting orders from Magento

We’re just experimenting with TrustPilot at the moment, but we needed to be able to import the customer name, order id and customer email address from our Magento shopping cart system into their system for population. Here’s the simple MySQL query we used to extract these details of all completed orders (i.e. not pending/processing ones) placed in the last two months:

CONCAT(sales_flat_order.customer_firstname,' ',sales_flat_order.customer_lastname),
FROM sales_flat_order
sales_flat_order.state='complete' AND
sales_flat_order.created_at>(CURDATE()-INTERVAL 2 MONTH)