每次在magento中使用某个优惠券代码时,如何查看完整的订单详细信息? [英] How can I see full order details for each time a certain coupon code was used in magento?

查看:75
本文介绍了每次在magento中使用某个优惠券代码时,如何查看完整的订单详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试收集使用特定优惠券代码"NEWCUSTOMER"的每个人的数据.我们正在尝试获取订单详细信息,包括其名称,电子邮件地址以及订购的商品.

We are trying to collect data on each person that used a certain coupon code "NEWCUSTOMER". We are trying to get the order details including their name, email address, and what they ordered.

rule_id是否以任何方式连接到数据库中的订单?当您尝试编写自己的mySQL语句以找出该信息时,magento数据库似乎并不那么友好.

Is the rule_id connected to an order in any way in the database? The magento databases don't seem to be all that friendly when you are trying to write your own mySQL statement to figure this information out.

谢谢!

推荐答案

这类似于您之前为您解答的问题:

This is similar to your previous question which i have also answered for you: Find the name and email address of non-members who used coupon code in Magento

订单上使用的优惠券代码实际上是订单的属性:coupon_code

The coupon code used on an order is actually a property of the order: coupon_code

从您的问题中得知,您是直接查询数据库,如果是,那么您正在寻找sales_flat_order表中的coupon_code字段.

It sounds from your question that you are directly querying the db, if so then you are looking for the coupon_code field in the sales_flat_order table.

这是sql:

SELECT `customer_firstname`, `customer_lastname`, `customer_email` FROM `sales_flat_order` WHERE  `coupon_code` = 'your_awesome_coupon_code' AND `customer_group_id` = 0

或者通过magento ...

Or, via magento...

 $orderCollection = Mage::getModel('sales/order')->getCollection()
        ->addAttributeToSelect('customer_firstname')
        ->addAttributeToSelect('customer_lastname')
        ->addAttributeToSelect('customer_email')
        ->addAttributeToSelect('customer_group_id')
        ->addAttributeToSelect('coupon_code')
        ->addAttributeToFilter('customer_group_id', Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
        ->addAttributeToFilter('coupon_code', 'NEWCUSTOMER');

这篇关于每次在magento中使用某个优惠券代码时,如何查看完整的订单详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆