Trouble with custom fields and email templates

Discussion in 'Troubleshooting' started by raph, Mar 3, 2014.

  1. raph

    raph New Member

    Joined:
    Feb 17, 2014
    Messages:
    10
    Hello,

    I added a custom field to the products table, in order to handle product subscription renewals with a discount, using the following code (in site.php) :

    PHP:
    Am_Di::getInstance()->productTable->customFields()
        ->
    add(new Am_CustomFieldText('renewal_coupon'"Coupon code for renewal"));
    The idea is that I want to be able to set the coupon code to use for each product renewal, so that I can send an email to customers with expired subscriptions, giving them the coupon code that they can use to renew their subscription with a discount.

    So I then went to the email templates, and tried to access my new field from within the mail_cancel_member template, using the following placeholder :

    %product.renewal_coupon%

    Unfortunately, that didn't do anything. I tried a few other variations, but couldn't get anything to work.

    So I then tried using a custom placeholder :

    PHP:
       $tmpl->setRenewalCoupon($product->data()->get('renewal_coupon'));
    I then access it in my template using %renewalcoupon%. But no, it doesn't work either...

    Any ideas what I'm doing wrong?

    Thanks,
    Jonathan.

Share This Page