| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| merkalt:coupons_using_description [2010/02/02 14:43] – daruma | merkalt:coupons_using_description [2010/02/03 17:35] (current) – daruma |
|---|
| **Coupons using description** | **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. | 1. New Coupon is created automatically on sendmail.php page, only if customer previously completed his order. Customer data (name and e-mail address) on sendmail.php page are taken from DB table, from header record of just completed order. These customer data are 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. // If name and e-mail address of customer are undefined, customer will be redirected on index page on "Tell a friend" form submit. // |
| |
| // 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. // | // 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.** | Then coupon record with **unique** coupon code (which is random string) is created and value of discount is selected depending on the number of e-mail addresses, entered by the customer. |
| |
| // 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 value selected from "[instance prefix]_coupons_discounts" table, "discount_value" field. "Discount_threshold" field contains minimal number of entered e-mail addresses for each discount value. At this moment, we have the following discount selection schema: // |
| |
| ^ discount_threshold ^ discount_value ^ description ^ | ^ discount_threshold ^ discount_value ^ description ^ |
| | 10 | 30 | from 10 addresses - discount 30% | | | 10 | 30 | from 10 addresses - discount 30% | |
| |
| For instance, customer has entered 3 e-mail addresses. Coupon discount value is 10%. If customer has entered 7 e-mail addresses, coupon discount value is 20%. | For instance, customer has entered 3 e-mail addresses. Coupon discount value will be set to 10%. If customer has entered 7 e-mail addresses, coupon discount value will be set 20%. |
| |
| // You could change current threshold and discount values or add new records for more discount thresholds. Coupons records stored in "[instance | // You could change current threshold and discount values or add new records for more discount thresholds. Coupons records stored in "[instance prefix]_coupons" table. // |
| 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. // | As a result we have coupon record in "[instance prefix]_coupons" table, for example: |
| |
| 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**. | ^ coupon_code ^ coupon_discount ^ |
| | | AV5DbjRZ | 20 | |
| |
| **Issues to be resolved** | 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 auto generated coupon code will be created and sent to customer. // This message created on the basis of "tell_customer_email.tpl" template from templates folder. // |
| |
| **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. 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. |
| |
| **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. In order to share coupons between several instances of one site I plan to use common coupons table. In other words, bedrift, idband, matmerker and root instances on merkalt.no (for example) will use the single coupons table, so each coupon will be valid for all intances of merkalt.no. |
| | |
| **3. Should the length of coupon code be adjustable or fixed?** | |