From e7fa1160d74e94a09b4cdb0519f6997e41a7fbf1 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 2 Dec 2016 16:30:40 -0500 Subject: [PATCH] Updates for front end and pdf. Update the pdf so it won't print same coupon twice. Update the list so it outputs the member name. --- models/admin/ajax/pdfCoupons.php | 8 ++++-- views/front/coupons/list.html | 48 ++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/models/admin/ajax/pdfCoupons.php b/models/admin/ajax/pdfCoupons.php index cc1e464..c4611f4 100644 --- a/models/admin/ajax/pdfCoupons.php +++ b/models/admin/ajax/pdfCoupons.php @@ -128,7 +128,7 @@ class GlmMembersAdmin_ajax_pdfCoupons extends GlmDataCoupons foreach ($_REQUEST as $posted => $value) { if (preg_match('%coupon-id-(\d+)%', $posted, $matches)) { //echo '
' . print_r($matches, true) . '
'; - $printIds[] = $matches[1]; + $printIds[$matches[1]] = $matches[1]; } } } else { @@ -141,9 +141,11 @@ class GlmMembersAdmin_ajax_pdfCoupons extends GlmDataCoupons $mycount = $count = 1; // $options = $coupon_lft_opt; - foreach ($coupons as $coupon) { - if (!$printAll && !in_array($coupon['id'], $printIds)) { + foreach ( $coupons as $coupon ) { + if ( !$printAll && !in_array( $coupon['id'], $printIds ) ) { continue; + } else if ( !$printAll && in_array( $coupon['id'], $printIds ) ) { + unset( $printIds[$coupon['id']] ); } $reset = $y; $val = array(); diff --git a/views/front/coupons/list.html b/views/front/coupons/list.html index 24a4738..5168b36 100644 --- a/views/front/coupons/list.html +++ b/views/front/coupons/list.html @@ -1,9 +1,9 @@ -{debug}

List Coupons

-
- - + + + + {if $categories} {foreach $categories as $catName => $coupons} {if $catName != '1-category'} @@ -17,7 +17,7 @@
- {if $coupon.glm_coupons_member}

{$coupon.glm_coupons_member}

{/if} + {if $coupon.ref_dest}

{$coupon.ref_dest}

{/if}

{$coupon.name}

{if $coupon.image}{/if}
{$coupon.descr}
@@ -32,3 +32,41 @@ {/if}
+{literal} + +{/literal} -- 2.17.1