Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Reporting sales by discount code View modes: 
User avatar
Member
Member
Jodi-wattsclever - 5/23/2013 1:56:45 AM
   
Reporting sales by discount code
Hi,

I'm trying to create a report that will give me a sales figure (in $), by discount code used. I can't find anything in the CMS but I would imagine it is a very useful marketing tool for those of us who use discounts.

The results would be something like -
Sales Code
$400 50OFF1
$100 50OFF2

I've tried creating a report using a macro expression but I don't really know what I am doing. Can someone please help me?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 5/23/2013 10:53:25 PM
   
RE:Reporting sales by discount code
Only having looked at the table structure and views available, you might try this query in a report
SELECT DiscountCouponCode, SUM(OrderTotalPriceInMainCurrency) AS TotalCouponSales
FROM View_COM_Order_Joined
LEFT OUTER JOIN COM_DiscountCoupon ON OrderDiscountCouponID = DiscountCouponID
WHERE OrderDiscountCouponID > 0
GROUP BY DiscountCouponCode
This will get all orders with a coupon code ID in an order and group the sales totals by the coupon code. You might also want to check the order status, if they have paid, etc. to ensure you are getting correct data.

User avatar
Member
Member
Jodi-wattsclever - 5/27/2013 8:55:31 PM
   
RE:Reporting sales by discount code
Thank you FroggEye, your solution worked perfectly.

You don't by any chance know how I can prevent the discount code from applying to shipping costs do you? I would have thought discounts wouldn't apply to shipping by default and can't find any info online that will help me resolve this issue.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 5/28/2013 8:24:37 AM
   
RE:Reporting sales by discount code
Sorry Jodi, I don't. If I remember right, discounts apply per order and not per line item.