php 从magento sql获取订单

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 从magento sql获取订单相关的知识,希望对你有一定的参考价值。

SELECT      
    orders.increment_id AS orderId,
    CONCAT(address.firstname,' ',
    address.lastname) AS name,
    address.email AS email,
    address.telephone AS telephone,
    items.created_at AS createdAt           
FROM sales_flat_order AS orders
	JOIN sales_flat_order_item AS items 
	ON items.order_id = orders.entity_id 
	LEFT JOIN sales_flat_order_address AS address
	ON orders.entity_id = address.parent_id
WHERE    
  items .created_at BETWEEN  '2014-04-15 00:00:00' AND '2014-07-30 00:00:00'
  AND items.store_id = 1
GROUP BY orderId



SELECT      
    orders.increment_id AS orderId,
    CONCAT(address.firstname,' ',
    address.lastname) AS name,
    address.email AS email,
    address.telephone AS telephone,
    items.created_at AS createdAt           
FROM sales_flat_order AS orders
	JOIN sales_flat_order_item AS items 
	ON items.order_id = orders.entity_id 
	LEFT JOIN sales_flat_order_address AS address
	ON orders.entity_id = address.parent_id
WHERE    
  items.store_id = 1 and city LIKE '%Москва%'
GROUP BY email

### Вытащить информацию по товарам из постельрф только по КПБ
```
SELECT sfo.entity_id, sfo.customer_id, sfoi.order_id, sfoi.sku, sfoi.name, sfoi.qty_ordered, sfoi.row_total_incl_tax 
FROM `sales_flat_order` AS sfo
INNER JOIN `sales_flat_order_item` AS sfoi
ON sfo.entity_id = sfoi.order_id
INNER JOIN `catalog_product_entity` AS cpe
ON cpe.entity_id =  sfoi.product_id
WHERE cpe.attribute_set_id = 9 AND sfo.store_id = 2
```

以上是关于php 从magento sql获取订单的主要内容,如果未能解决你的问题,请参考以下文章

PHP 从Magento的结账会议中获取最后的订单详细信息

从Magento中的签出会话获取最后一个订单详细信息

sql sql获取magento 2中的所有销售订单备注

sql Magento 1 - SQL获取每个客户的销售和订单总数

如何在 Magento 中获取订单时间?

sql 清理magento订单日志#magento #order #log #eaventity