Zen Cart Logo
Forums / Addon Order Total Modules / Customer Loyalty Discount

Customer Loyalty Discount

Views: 20,669

Results 1 to 16 of 16
9 Dec 2019, 7:08 AM
#1
webchills avatar

webchills

Zen Follower

Join Date:
Sep 2005
Location:
Austria
Posts:
99
Plugin Contributions:
1

Customer Loyalty Discount

Plugin:
https://www.zen-cart.com/downloads.php?do=file&id=1917

Got this question via PM (please do not PM me for support)

I have installed this but before enabling want to know if it is a Global program for every customer (I have over 3,800 website accounts) or if I can exclude some who may already have a preferred pricing structure?
The read me is pretty basic and admin only allows me to set up calendar segments, taxes, shipping and discount amounts.
Also, is there a way to let customers know a program is in place other than emailing them individually to announce (other than social media of course)
Thank you for your answers and recent update to the plug in.

This is a basic plugin, the discounts apply to every customer.
If you want to restrict it to certain customers only you would have to write the desired logic yourself.
To let ciustomers know about the program you could simply create a define page or EZ page to promote the loyalty program.

9 Dec 2019, 6:04 PM
#2
montanag avatar

montanag

New Zenner

Join Date:
Feb 2019
Location:
Kamloops, BC
Posts:
9
Plugin Contributions:
0

Re: Customer Loyalty Discount

Thank you for your reply. Sorry to have PM'd inappropriately.

10 Dec 2019, 1:11 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Customer Loyalty Discount

Noting that this discount is not compatible with One-Page Checkout, since it looks at the total-orders' history based on the current customer's id ... and OPC re-uses the same customer-id for **all **guests' checkouts!

I'll suggest the following insertion to the order-total's constructor:

    public function __construct() {
        $this->code = 'ot_loyalty_discount';
        $this->title = MODULE_LOYALTY_DISCOUNT_TITLE;
        $this->description = MODULE_LOYALTY_DISCOUNT_DESCRIPTION;
        $this->enabled = (defined('MODULE_LOYALTY_DISCOUNT_STATUS') && MODULE_LOYALTY_DISCOUNT_STATUS == 'true'); 
        $this->sort_order = defined('MODULE_LOYALTY_DISCOUNT_SORT_ORDER') ? MODULE_LOYALTY_DISCOUNT_SORT_ORDER : null;
        if (null === $this->sort_order) return false;
 [B]       if (function_exists('zen_in_guest_checkout') && zen_in_guest_checkout()) return false;[/B]
        $this->include_shipping = MODULE_LOYALTY_DISCOUNT_INC_SHIPPING;
        $this->include_tax = MODULE_LOYALTY_DISCOUNT_INC_TAX;
        $this->calculate_tax = MODULE_LOYALTY_DISCOUNT_CALC_TAX;
...

I didn't include the entire constructor, since one of the variable names was getting ###'d. That will correct the issue on the storefront, but not if the order-total is used in conjunction with Edit Orders.

17 Jan 2020, 5:37 PM
#4
heresy_miniatures avatar

heresy_miniatures

New Zenner

Join Date:
Jul 2011
Posts:
59
Plugin Contributions:
0

Re: Customer Loyalty Discount

Can anyone tell me which number relates to which order status, please? I want mine to be on 'shipped', which is 4th down my list of order statuses, should I set the order status to '4'? Hard to check as an admin if the mod is working on checkout...couldn't find a list anywhere that gave numbers to given order statuses. Any info appreciated!

17 Jan 2020, 7:39 PM
#5
webchills avatar

webchills

Zen Follower

Join Date:
Sep 2005
Location:
Austria
Posts:
99
Plugin Contributions:
1

Re: Customer Loyalty Discount

Heresy Miniatures:

Can anyone tell me which number relates to which order status, please? I want mine to be on 'shipped', which is 4th down my list of order statuses, should I set the order status to '4'? Hard to check as an admin if the mod is working on checkout...couldn't find a list anywhere that gave numbers to given order statuses. Any info appreciated!

The number (id) of an order status is individual for every store. It depends on which order stati you have defined in Localization > Orders Status
Click on an order status in the list in Localization > Orders Status and look at the URL in the browser address bar.
You will see something like orders_status.php?page=1&oID=2
oID is the id of the selected status

18 Jan 2020, 7:34 AM
#6
heresy_miniatures avatar

heresy_miniatures

New Zenner

Join Date:
Jul 2011
Posts:
59
Plugin Contributions:
0

Re: Customer Loyalty Discount

Thanks! :cool:

15 Feb 2023, 5:29 PM
#7
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Customer Loyalty Discount

v2.0.0 is now available for use on zc157 and zc158: https://www.zen-cart.com/downloads.php?do=file&id=1917

  • CHANGE: Refactoring for now-current styling; pre-define all class variables (PHP 7.4+ support).
  • BUGFIX: Correcting PHP notices due to undefined variables.
  • BUGFIX: Use the order's products, not the shopping-cart version, since this is an order-total!
  • CHANGE: Validate the configuration settings and auto-disable if an issue is found.
  • CHANGE: Disallow the discount for guest-purchases.
  • CHANGE: Disallow the discount if a coupon has been used for the order.
  • CHANGE: Update the customer 'messaging' on the order to indicate what elements of the order are discounted.
27 Mar 2023, 9:48 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Customer Loyalty Discount

v2.0.1 of the Loyalty Discount order-total is now available for download. This version corrects a MySQL Fatal error when an order is placed via the PayPal Express Payment's shortcut button.

5 May 2023, 9:12 PM
#9
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Re: Customer Loyalty Discount

Do I understand correctly that there is no way to reset an order total after a customer has been given a discount? In other words, if the customer's all-time order amount added up to enough to get the discount, then their next order would also generate that discount? I have a very high percentage of repeat customers, but I don't want them getting the discount over and over. The way around that, obviously, is to set the time interval to a shorter period. But that would shut out the people who are repeat customers but might order only once a year or less.

8 May 2023, 10:22 PM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Customer Loyalty Discount

HeleneWallis:

Do I understand correctly that there is no way to reset an order total after a customer has been given a discount? In other words, if the customer's all-time order amount added up to enough to get the discount, then their next order would also generate that discount? I have a very high percentage of repeat customers, but I don't want them getting the discount over and over. The way around that, obviously, is to set the time interval to a shorter period. But that would shut out the people who are repeat customers but might order only once a year or less.
You understand correctly. The discount applies to the a customer's purchase history over the past month, quarter, year or all-time.

31 Jan 2024, 2:24 AM
#11
persion avatar

persion

New Zenner

Join Date:
Apr 2012
Posts:
5
Plugin Contributions:
0

Re: Customer Loyalty Discount

When customers log in, can they see the discounts they enjoy and how much money they need to spend before the next higher discount?

31 Jan 2024, 1:24 PM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Customer Loyalty Discount

persion:

When customers log in, can they see the discounts they enjoy and how much money they need to spend before the next higher discount?
Nope, the customer won't see their discounts until they go through the checkout process.

25 Aug 2024, 9:05 PM
#13
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Customer Loyalty Discount

v3.0.0 is now available for use on zc158 and later: https://www.zen-cart.com/downloads.php?do=file&id=1917

This version drops support for Zen Cart versions prior to 1.5.8, based on the removal of the ot_loyalty_discount.php language file. The lang.ot_loyalty_discount.php file is required for zc210+ interoperability.

26 Jun 2026, 6:53 PM
#14
apollowilcox avatar

apollowilcox

Zen Follower

Join Date:
Sep 2014
Location:
Indiana
Posts:
123
Plugin Contributions:
0

Re: Customer Loyalty Discount

This mod is **really **appreciated in our business.

One item on my wish list for this. If we happen to edit the order (using the Edit Orders mod), the discounts recalculate and will now include the current order being edited. Nearly always, this results in a higher discount percentage (as set up in our specs) since the accumulated orders over the loyalty-discount time period is higher by including this order.

As is, if we edit the order, we then have to edit the specs of the loyalty discount tiers and percentages, re-edit the order to trigger a recalc, save it, then return the loyalty discount specs to the original settings.

Any ideas?

Thanks,

Matt

27 Jun 2026, 11:35 AM
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Customer Loyalty Discount

apollowilcox:

This mod is **really **appreciated in our business.

One item on my wish list for this. If we happen to edit the order (using the Edit Orders mod), the discounts recalculate and will now include the current order being edited. Nearly always, this results in a higher discount percentage (as set up in our specs) since the accumulated orders over the loyalty-discount time period is higher by including this order.

As is, if we edit the order, we then have to edit the specs of the loyalty discount tiers and percentages, re-edit the order to trigger a recalc, save it, then return the loyalty discount specs to the original settings.

Any ideas?

Thanks,

Matt
No ideas at this point, but I've created a GitHub issue to track (and remind myself) of the change request: https://github.com/lat9/customer_loyalty_discount/issues/11

30 Jun 2026, 7:44 PM
#16
apollowilcox avatar

apollowilcox

Zen Follower

Join Date:
Sep 2014
Location:
Indiana
Posts:
123
Plugin Contributions:
0

Re: Customer Loyalty Discount

lat9:

No ideas at this point, but I've created a GitHub issue to track (and remind myself) of the change request: https://github.com/lat9/customer_loyalty_discount/issues/11

In this feature, the code looks at sales over each "cumulative order period" as preset in the setup. When it calculates the sales for each order period, could the formula be tweaked to look at sales for "6 months ago through (today - 1)" instead of "...through today"? Is that possible?

Just a thought. Thanks.