Hello,

Can you please add sku and discount to [commerce-email:order-items]? Or is there a way to print this information in the template file?

Thanks for a great module,
Paul

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yaudouin’s picture

Suscribe

Slacker’s picture

Subscribe!

kevster’s picture

Subscribe - very useful for me!

TomGould01’s picture

Subscribing,
A clinet wants this!

andyg5000’s picture

See this thread: http://drupal.org/node/1532526 I've provided a sandbox module that creates a new token. You can use this module to create your own and edit to pull in the info you need.

dylanrao’s picture

Thanks 5000 andy, I was fighting this before I found your module. This probably should come out of sandbox, it seems like something Commerce mail should be capable of. SKU# are a pretty common requirement IMHO.

zpolgar’s picture

Add discount feature will be the super solution.

ptmkenny’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Active » Needs review
FileSize
862 bytes
5.45 KB
4.06 KB

I'm attaching a patch to add the discount to the token output. I didn't add the SKU because I did not need it (or want it) for my case; the SKU seems best left to a case-by-case basis.

However, in the case of discounts, I think that not showing the discount is a bug.

See the attached images. Since the "subtotal" and "total" are included, skipping the discount leads to the total being unexpectedly reduced, which can cause recipients to wonder if the discount was in fact applied.

Summit’s picture

Hi,
Thanks for adding discount.
Couldn't you add an option to y/n show sku.
I would love to have sku in the email.
Also for customer referral.
Greetings, Martijn

ptmkenny’s picture

If you want to add SKU, referral, etc., you should check out the patch in #1332698: Allow theming of [commerce-order:commerce-email-order-items] (which has already been committed). You can write your own theme function for that.

My patch includes only the discount because the Subtotal and Total are already included, so omitting the discount can lead to very strange looking e-mails, which I think is a bug.

vrMarc’s picture

Issue summary: View changes

This line in the patch didn't work for me - elseif ($data['components'][$key]['name'] == 'discount')
It turns out that I had to use 'commerce_coupon_the_name_of_the_discount_code' instead of 'discount'. Since new coupon codes would be added and I don't want to have to add each discount code to commerce_email.module, I used this instead - elseif (strpos($data['components'][$key]['name'], 'commerce_coupon') !== false)

rossb89’s picture

Made a new version of the patch, to work with the newer version of commerce discount where the key is 'discount|machine_name_of_discount' not just 'discount'.

Takes into account the customer facing title configured for the discount as well.

IckZ’s picture

thanks a lot @rossb89: I've just noticed today, that the title is missing in the mails. I'm testing now your patch!

mrP’s picture

Title: Add SKU and Discount to [commerce-email:order-items] » Add Discount to [commerce-email:order-items]
Status: Needs review » Reviewed & tested by the community

Patch #12 applies cleanly and works for me with commerce_discount-7.x-1.0-beta5. Thanks!

Updating title to reflect the patch is for discount only. +1 RBTC

rszrama’s picture

Checking to see if it still applies...

  • rszrama committed a1b537c on 7.x-2.x authored by rossb89
    Issue #1332922 by ptmkenny, rossb89, rszrama: Add Discount to [commerce-...
rszrama’s picture

Status: Reviewed & tested by the community » Fixed

Patch checks out. Didn't test in local dev but committing based on community feedback.

Status: Fixed » Closed (fixed)

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