It would be useful if we expose the commerce_promotion_usage table data to views. Although one should be careful that this only contains coupons which are applied. This wont be useful right away , if one requires to show all the coupons applied or not.

Comments

sumanthkumarc created an issue. See original summary.

sumanthkumarc’s picture

Status: Active » Needs review
StatusFileSize
new2.61 KB

For anyone with similar requirements, here's the patch.

sumanthkumarc’s picture

StatusFileSize
new2.62 KB

Oops, here's the new patch with correct module name.

sumanthkumarc’s picture

StatusFileSize
new3.45 KB

yet another patch, Last patch i promise :P, which added missing field, filter and argument handlers for fields.

sorabh.v6’s picture

Assigned: Unassigned » sorabh.v6
sorabh.v6’s picture

Hey @sumanthkumarc,

I tried your patch and I can confirm that it added a new category(commerce promotion usage) to the view of promotion type. That category also has 4 fields as shown below -

Only local images are allowed.

sorabh.v6’s picture

StatusFileSize
new232 bytes
new3.45 KB

There was a whitespace at the end of the patch. Removed that white and uploading new one.

sorabh.v6’s picture

Assigned: sorabh.v6 » Unassigned
svendecabooter’s picture

StatusFileSize
new3.7 KB

Reroll of the latest patch against latest Commerce codebase.

klabautermann_’s picture

Tested against commerce 8.x-2.33. Solved my usecase to show all used coupons.

jsacksick’s picture

StatusFileSize
new3.45 KB

I tested the patch and it works great. However I think the different labels / descriptions should be tweaked. For example, we should rename "Commerce promotion usage" to just "Promotion usage" so that it's after Promotion on the view creation page.

Also, to be consistent with the other relationships, I think we should rename the different labels to "Promotion", "Coupon" instead of "Promotion ID", "Coupon ID" etc...

Patch attached... Thoughts?

jsacksick’s picture

StatusFileSize
new3.47 KB

Attaching the interdiff.

klabautermann_’s picture

Just reviewed it and I think the renaming of labels and descriptions is good for readability at least for "mail" and "Promotion usage". Thanks @jsacksick

jsacksick’s picture

Status: Needs review » Fixed

Committed! Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.