[wellwell-devel] [wellwell/zoom] Add zerohide attribute to [coupons display].

Stefan Hornburg wellwell-devel at rt.icdevgroup.org
Wed Sep 15 10:47:00 UTC 2010


commit 679259a71db56409c6985534d2c5116fac2b66af
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Sat Sep 4 11:54:33 2010 +0200

    Add zerohide attribute to [coupons display].

 lib/WellWell/Coupon.pm |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/lib/WellWell/Coupon.pm b/lib/WellWell/Coupon.pm
index 509911d..790b3a8 100644
--- a/lib/WellWell/Coupon.pm
+++ b/lib/WellWell/Coupon.pm
@@ -116,6 +116,11 @@ sub coupons {
 				$hash{discount_total} = Vend::Tags->subtotal({name => 'main', noformat => 1, nodiscount => 1})
 															 - Vend::Tags->subtotal('main', 1);
 
+				if ($opt->{zerohide} && $hash{discount_total} == 0) {
+					# don't display anything
+					return;
+				}
+				
 				if ($hash{subject} eq 'subtotal') {
 					$hash{target} = ' all items';
 				}



More information about the wellwell-devel mailing list