User Tools

Site Tools


merkalt:coupons_using_description

This is an old revision of the document!


Coupons using description

1. New Coupon is created on sendmail.php page only if customer previously completed his order. Customer data (name and e-mail address) on sendmail.php page taken from DB table, from header record of just completed order. These customer data stored in hidden fields of “Tell a friend” form. When customer fill out “Tell a friend” form fields with one or more e-mail addresses (up to 10 addresses) and click “Send skjema” button, the number of non-empty e-mail addresses is calculated.

// Initial number of fields in “Tell a friend” form is defined by SENDMAIL_INIT_TF_FIELDS_AMT constant in includes/settings.inc.php file. Maximal total number of fields in this for is defined by SENDMAIL_MAX_TF_FIELDS_AMT constant in the same file. //

Then coupon record with unique coupon code is created and value of discount is selected depending on the number of entered e-mail addresses. Currently the length of coupon code comes to 6 symbols.

// Discount value selected from “[instance prefix]_coupons_discounts”, “discount_value” field. “Discount_threshold” field contains minimal number of entered e-mail addresses for each discount value. Currently, we have the following discount schema: //

discount_threshold discount_value description
1 10 from 1 to 4 addresses - discount 10%
5 20 from 5 to 9 addresses - discount 20%
10 30 from 10 addresses - discount 30%

// You could change current threshold and discount values or add new records for more discount thresholds. Coupons records stored in “[instance prefix]_coupons” table, i.e. currently both coupons tables are instance-dependant. //

After “Tell a friend” form submitted, e-mail notification messages created and sent on each entered e-mail address. // These messages created on the basis of template “tell_friend_email.tpl” from templtes folder. // Also notification message with coupon code created and sent to customer. // This message created on the basis of “tell_customer_email.tpl” template from templates folder. //

2. When customer received notification e-mail with discount coupon code, he could use it on index.php page in order to get discount for the next his order. Coupon code should be entered in “Kupongkode” field. When this field loses focus, coupon code verified against DB table. If coupon code is valid, discount value is appeared, prices and totals are recalculated. Currently each coupon code could be used unlimited number of times.

Issues to be resolved

1. If coupons which created on merkalt.no root instance are need to be valid for all instances of merkalt.no (bedrift, idband and matmerker), we could introduce separate special prefix for coupon tables (“*_coupons_discounts” and “*_coupons”). In this case these two tables could be used by all instances of merkalt.no. The same could be done for all site clones - merkalt.dk, labelyourbelongings, etc.

2. If coupon code should be used only limited number of times then maximal number of each coupon applications must be defined and additional check must be added in code.

3. Should the length of coupon code be adjustable or fixed?

merkalt/coupons_using_description.1265121453.txt.gz · Last modified: (external edit)