Birthday Discount
Adds Birth Date field to all forms and a new total on checkout page with birthday discount. This is a fully automated modification with a lot of options to satisfy your needs. You don't have to do anything manually, even inform your customers about birthday discounts!
Features
Adds Birth Date editable field to all possible forms (customer, order etc.) both on front-end and back-end. Allows you to apply discount to selected customer groups and disallow entering birth date multiple times. Automatically sends notifications about birthday discount to customers with upcoming birthdays. Lots of options: date format, min & max subtotal, make inactive with other totals enabled, round value etc. Birthday discount can be skipped, if other discounts already added to order, to avoid over-discounting.
Compatibility: OpenCart 2.0+, 3.0+
Current version: 3.1.1
Screenshots
Demo
Place an order on our demo site (login: demo@thekrotek.com, password: demo). Add anything to cart and try to checkout.
Extension settings can be found in Extensions -> Order Totals section on backend of our demo site (username: demo, password: demo).
Change Log
3.1.1
- Minor bug fixes and improvements.
3.1.0
- OpenCart 3 Compatibility Fixes extension is not needed anymore. You may remove it.
- Minor bug fixes and improvements.
3.0.1
- FIXED: Subtotal and Age values are not properly displayed in notifications.
- Improved customer birthday notifications format.
3.0.0
- OpenCart 3 support added. See the documentation on how to properly install extension!
- ADDED: Exclude Products option to disable birthday discount, if one of the selected products was added to cart.
- ADDED: Exclude Categories option to disable birthday discount, if product from one of the selected categories was added to cart.
- Minor bug fixes and improvements.
2.5.0
- License check added. Don't forget to open settings, enter your order ID and save!
- VQMod converted to OCMod. Remove VQMod from previous version after upgrade!
- ADDED: Stores option to limit discount to selected stores only.
- ADDED: Orders option to limit number of orders eligible for discount in given period.
- ADDED: Order birth date on order viewing page (can differ from customer birth date).
- FIXED: Birth date improperly added to order, when order is updated from admin.
- FIXED: Birth date is not properly removed, when deleted by customer or from admin.
- CHANGED: Minimum and Maximum options combined into single Subtotal option.
- CHANGED: Notify Customers option removed, enable/disable cron job instead.
- CHANGED: Discounts Text option replaced with discounts_format string in catalog language file.
- CHANGED: Guests are now treated as true guests and don't belong to any customer group.
- Improved database update and birth date check logic.
- Minor bug fixes and improvements.
2.4.0
- You can now add multiple discounts with different options for each customer group separately.
- Some options removed, some moved to Discounts tab. Check and save your settings after upgrade!
- ADDED: Notifications tab to setup and send notifications about birthday discount to customers with upcoming birthdays.
- ADDED: Add Name option to add customer's group name to title.
- FIXED: Birth date is not formatted properly sometimes.
- FIXED: Birth date is not saved properly for new customers from admin.
- Extension now tries to create or convert a birth date from every valid format.
- Removed birth date support for affiliates and returns.
- A lot of minor bug fixes and improvements.
2.3.0
- OpenCart 1.5 support completely removed.
- birth_date database field type changed. Open extension settings to update all existing birth dates.
- Date Format and Hint Format options removed. date_format_short language string is now used.
- ADDED: You can now also deactivate extension, when certain payment or shipping methods are selected (as well as totals).
- ADDED: Hide Total option to hide birthday discount in another total.
- ADDED: Add Info option to add discount information to another total, if Hide Total is enabled.
- FIXED: Active totals are not properly checked on OpenCart 2.2 and higher.
- FIXED: Minor incompatibilities with OpenCart 2.3.
- Optimized code with lots of minor improvements and bug fixes.
2.2.2
- FIXED: birth_date index error, returned in AJAX requests, when displaying errors is enabled.
2.2.1
- Minor bug fixes related to birth date format check.
2.2.0
- Extension is now fully compatible with OpenCart 2.2.
- ADDED: If Date Format is not defined, default format for current customer's language will be taken.
- Minor bug fixes and improvements.
2.1.5
- FIXED: Minor OpenCart 2.1 compatibility issues.
2.1.4
- FIXED: Birth date added in UNIX format on autocomplete in order editing form.
- FIXED: Birth date not saved, when order is added or updated.
2.1.3
- ADDED: Age Limits option in extension's settings, which allows you to setup minimum and maximum age available for discount.
- ADDED: Date picker for Birth Date field in all back-end forms.
- FIXED: Parse syntax error in return's controller.
2.1.2
- Minor improvements.
2.1.1
- Minor bug fixes and improvements.
2.1.0
- A lot of improvements and bug fixes.
- ADDED: Inactive With option in extension settings. Allows you to select totals, incompatible with Birthday Discount, and avoid excessive discounting.
- Improved feedback with additional error messages.
2.0.0
- Extension is now fully compatible with OpenCart 2.0. Check and uprate your settings!
- ADDED: Discount value can now be added to the total's title.
- ADDED: Support for birth dates in affiliates and returns.
- FIXED: Birth date sometimes doesn't follow format set in options.
- Minor bug fixes and improvements.
1.0.0
- Initial release.
Documentation
Go to Extensions -> Order Totals, find Birthday Discount and setup accordingly.
How to use
When enabled, customers will find Birth Date field in their profile, registration and return forms. Upon entering their birthdays, they'll become eligible for discount. You can set different discounts with different option sets to make your discounting more flexible.
General settings:
- License ID - You order number on OpenCart Marketplace or our site.
- Customer Groups - You can define two options for each group: Required (customers are required to enter birth date) and Can Change (customers can't change birth date later).
- Round By - Discount will be rounded to given value (e.g: if set to 10 - 271.52 will be rounded to 280).
- Add Name to Title - Group name will be added to total's title.
- Add Value to Title - Discount value (if in percent) will be added to total's title.
- Hide Total - Hide Birthday Discount total from the list and add its value to selected total.
- Total to Add - When Hide Total is enabled, discount value will be added to selected total.
- Add Info to Total - Additional information about discount will be added to selected total's title.
- Discounts Inactive With - Discounts will not be applied, if any of the selected payment, shipping methods or totals are active in current order.
- Check Version - Check for extension's new version. Disable, if settings page loading too slow.
- Stores - Extension's functionality will be limited to selected stores only.
How to add discounts
You can add an unlimited number of discounts for each customer group separately. Every discount has a few options:
- Customer Group - Applicable customer group.
- Value - Discount percent or fixed value (e.g.: 3%, -5%, 10, -20). Can not be empty.
- Days - For how long discount stays available before and after actual birth date. Empty - only on birthday.
- Orders - Number of orders eligible for discount (recalculated every year). Empty - no limit.
- Subtotal - Minimum and maximum cart subtotal value to enable discount (e.g: 100, 200-500 etc). Empty - no limit.
- Age - Minimum and maximum age, when birth date is valid for discount (e.g: 18-100, 21-80 etc). Empty - no limit.
For example, you can have a 5% birthday discount for Default customer group, which will be available for 3 days and only if cart subtotal not less than 100 USD. Or 7% discount for the same Default customer group, which will be available for 2 days, only if car subtotal is between 100 and 300 USD and valid only for one order.
Notifications
If you want to attract more customers to your store, you can send them notifications about birthday discount. You can do this manually by clicking the Action Link in extension settings or setup a cron job on the same server, using the same action link. Make sure to setup and enable notifications first.
Notification options:
- Action Link - Link for your cron job (see below)
- Action Secret - Random number of characters for cron link to avoid false script executions.
- Emails Limit - How many emails should be sent per cycle. Useful to avoid being banned for spamming by hosting provider.
- Send Report - Cron job report will be sent to your main store email.
- Notify Customers - Quickly turn notification feature on/off.
- Notify Before - Before how may days to notify customers with upcoming birthdays.
- Recurring - Notifications will be sent to all matching customers on every run (No - only once a year).
- Subscribed Only - Only customers, who subscribed to newsletter, will receive emails for this reminder.
- HTML Email - Email will be sent in HTML format (No - in plain text)
- Discount text - Single discount text format for {discounts} tag in notification emails.
- Email Subject - Any subject for email notification.
- Email Message - Any text for email notification.
To setup cron job use Action Link from extension settings like this:
lynx -source 'http://yourstore.com/index.php?route=total/bdiscount/cron' > /dev/null
If Lynx is not installed or not properly working on your server, you can use wget command. See wget manual for correct command line.
How to add tags
To add any info about customer or birthday discount to message subject or body use tags: {tag_name}. Tag names should be typed strictly in Latin letters or they won't be processed!
Common tags:
- store_id - Your store ID.
- store_name - Your store name.
- store_url - Your store URL.
- store_telephone - Your store telephone.
- customer_id - Customer's ID.
- customer_group_id - Customer's group ID.
- customer_group - Customer's group name.
- firstname - Customer's first name.
- lastname - Customer's last name.
- telephone - Customer's phone number.
- fax - Customer's fax number.
- email - Customer's email.
- discounts - List of discounts, which are available for current customer group. Contains all info about all available discounts.
Tag processing algorithm is very simple and absolutely fail safe. First, the script will read all available fields from "customer" table: customer_id, firstname etc. Then it will take each field one by one and wrap its name in curly brackets {}, turning it into tag: {customer_id}, {firstname} etc. After that the script will search for tag in email text or comment and replace it with actual field value, if found.
If certain tag is not replaced with its value, there can be only two reasons: tag is not properly defined or there's no such field in given table. Most likely reason is wrong tag name, which can seem typed properly sometimes. For example, this tag name seems proper, but it's not: {firstnаme}. It has letter "a" typed in Cyrillic and thus will not be processed. Same can happen with other languages and keyboard layouts.
If you're having an issue with tag processing, check, that they all are typed correctly and in Latin letters only. There's no and can NOT be any other reason for tags not processing as expected besides two reasons mentioned above.
Additional information
- Do not overuse "Round by" feature. Setting it to wrong number will cause improper calculation of discount.
- If you want birthday discount to be applied to total sum, including shipping, voucher and all other possible fees and discounts, set "Sort order" option higher than any of them.