0
我們正試圖收集每個使用特定優惠券代碼「NEWCUSTOMER」的人的數據。我們正在嘗試獲取訂單詳細信息,包括他們的姓名,電子郵件地址以及他們訂購的內容。如何在每次在magento中使用特定優惠券代碼時查看完整訂單詳細信息?
是否將rule_id以任何方式連接到數據庫中的某個訂單?當您試圖編寫自己的mySQL語句來查找這些信息時,magento數據庫似乎並沒有那麼友好。
謝謝!
我們正試圖收集每個使用特定優惠券代碼「NEWCUSTOMER」的人的數據。我們正在嘗試獲取訂單詳細信息,包括他們的姓名,電子郵件地址以及他們訂購的內容。如何在每次在magento中使用特定優惠券代碼時查看完整訂單詳細信息?
是否將rule_id以任何方式連接到數據庫中的某個訂單?當您試圖編寫自己的mySQL語句來查找這些信息時,magento數據庫似乎並沒有那麼友好。
謝謝!
這與你剛纔的問題我也回答你:Find the name and email address of non-members who used coupon code in Magento
訂單上使用的優惠券代碼實際上是訂單的屬性:coupon_code
它從你的問題聽起來是你直接查詢數據庫,如果是的話,那麼你正在尋找sales_flat_order
表中的coupon_code
字段。
這裏是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的...
$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來完成,但我甚至不知道從哪裏開始。有沒有人有一個鏈接來幫助我直接將它合併到Magento代碼中? –