Can the "Discount Code" be displayed in notification emails?

Can the "Discount Code" be displayed in notification emails?

by Jenna Pitcher -
Number of replies: 2

Does anyone know if the "discount code" have a variable name such as[code], that can be displayed in notification emails?

Jenna

Average of ratings: -
In reply to Jenna Pitcher

Re: Can the "Discount Code" be displayed in notification emails?

by Benoit Ter Burg -

Hi Jena, 

Long time ago. Seems nobody answer you request. Did you find answer to your question? 

I am also working on same concern and test several values wit no success.... I do not have access to DB so ... difficult  to check into DB.

Thanks for help. Ben


In reply to Benoit Ter Burg

Re: Can the "Discount Code" be displayed in notification emails?

by Benoit Ter Burg -

I have a look in php code  and  if well understood (I am not a php programmer) .. I'am afraid not. 

EMails placeholder are substituted with value from data object.

Normal cost and discount cost both exists in data object but together they calculate only one value for cost and substitute only this value, with a full price if none discount exists and discounted price if any discount code exist.

So currently email print only one costs and cannot include both info at the same time  (full and discounted price) nor details about discount code..

I would like substitute  into request/confirmation mails final price (full or discounted) and if discounted add also in email discount values, because I have to manage several discount types)... But seems not (yet) possible... Too bad. 

If anybody gets additional  info, I remains interested.  Regards, Ben


   /**

 * Substitute the placeholders in email templates for the actual data

 *

 * Expects the following parameters in the $data object:

 * - datetimeknown

 * - details

 * - discountcost

 * - duration

 * - normalcost

 * - sessiondates


.../....


    $msg = str_replace(get_string('placeholder:cost', 'facetoface'), facetoface_cost($user->id, $sessionid, $data, false), $msg);


.../....


 if ($count > 0) {

        return format_cost($sessiondata->discountcost, $htmloutput);

    } else {

        return format_cost($sessiondata->normalcost, $htmloutput);