Loyalty Booster

Loyalty Booster Email Variables

Since the version 2.9.0 you can assign custom email templates to each credit rule. Here is the list of available variables you can use in the email templates:

  1. BALANCE_CHANGED

    • creditChange - amount of credits a customer received by the current rule;

    • balance - a current customer’s balance;

    • customerName - a customer’s name;

    • comment - a comment of the current reward;

  2. EXPIRATION_NOTICE

    • daysLeft - a number of days left before credits will be expired;

    • customerName - a customer’s name;

  3. CREDIT_RULES

    • creditChange - amount of credits a customer received by the current rule;

    • balance - a current customer’s balance;

    • customerName - a customer’s name;

    • comment - a comment of the current reward;

    • ruleName - a name of a rule applied to a customer;

    • orderIncId - order ID, in which the current rule was applied;

  4. CUSTOMER_BIRTHDAY

    • birthday - a customer’s birthday date;

    • creditChange - amount of credits a customer received by the current rule;

    • balance - a current customer’s balance;

    • customerName - a customer’s name;

    • comment - a comment of the current reward;

  5. PRODUCT_REVIEW

    • creditChange - amount of credits a customer received by the current rule;

    • balance - a current customer’s balance;

    • customerName - a customer’s name;

    • comment - a comment of the current reward;

    • reviewTitle - a title of a review posted by a customer;

    • reviewDetail - a review posted by a customer;

    • productName - a product name for which customer posted a review;

    • productUrl - URL of a product for which customer posted a review;

  6. NEWSLETTER_SUBSCRIPTION

    • creditChange - amount of credits a customer received by the current rule;

    • balance - a current customer’s balance;

    • customerName - a customer’s name;

    • comment - a comment of the current reward;

  7. PRODUCT_TAG

    • creditChange - amount of credits a customer received by the current rule;

    • balance - a current customer’s balance;

    • customerName - a customer’s name;

    • comment - a comment of the current reward;

    • tagName - a tag added by a customer;

    • productName - a product name for which customer posted a review;

    • productUrl - URL of a product for which customer posted a review.

New templates can be created in System ⟶ Transaction Emails.

Example of using the variables in the email templates:

Hello {{htmlescape var=$customerName}},

You got {{htmlescape var=$creditChange}} credits for posting your great
feedback for our  {{htmlescape var=$productName}} product.

Your current balance is {{htmlescape var=$balance}}.

Have a nice day.

How to modify email templates sent by the extension

You can edit the email templates that are sent out to customers in the following folder on your server: app/locale/en_US/template/email/

Please note that if you use a different language locale, you should copy the email templates to your locale folder.

How to ‘top up’ a customer’s credit balance from a third party application

To add some credits for the activities that are made by means of some third-party extension, you need to add this code to the corresponding file with this action

<?php
$customerId = 1;
$websiteId = 1;
$addCreditValue = 100; // add 100 credit value
$comment = 'You bonus';

$customer = Mage::getModel('customer/customer')->setWebsiteId($websiteId)->load($customerId);
$data = array('value_change' => $addCreditValue, 'website_id' => websiteId, 'comment' => $comment);
Mage::getModel('mageworx_customercredit/credit')->setData($data)->setCustomer($customer)->save();

where

  • cutomerId is the ID of the customer;

  • websiteId is the store ID;

  • addCreditValue specifies the exact number of the points to be added;

  • comment is the comment for the customer credit.

How to use Soap API v.2 in Loyalty Booster

<?php
// connect to API
$url = 'http://'.$_SERVER['HTTP_HOST'].'/api/v2_soap/?wsdl=1';
$client = new SoapClient($url, array('cache_wsdl' => WSDL_CACHE_NONE));
//array('cache_wsdl' => WSDL_CACHE_NONE) - optional
$session = $client->login($login, $pass);

// getting the complete list of credits out of the base (return array())
$client->customerCreditList($session);

// getting credits for a customer with ID=5 (return float())
$client->customerCreditGetcredit($session,5);

// replace the customer's (ID=5) current credit with value of 10 (return bool())
$client->customerCreditSetcredit($session,5,10);

// increase the customer's (ID=5) current credit up to 123 (return bool())
$client->customerCreditIncrcredit($session,5,123);

// decrease the customer's (ID=5) current credit to 17 (return bool())
$client->customerCreditDecrcredit($session,5,17);