$coupons = $this->getList( $where );
+ if ( isset( $coupons ) && !empty( $coupons ) ) {
+ foreach ( $coupons as &$coupon ) {
+ $coupon['address'] = '';
+ include_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMemberInfo.php';
+ $address = array();
+ $memberData = new GlmDataMemberInfo( $this->wpdb, $this->config );
+ $mInfo = $memberData->getActiveInfoForMember( (int)$coupon['ref_dest_id'] );
+ if ( $mInfo['addr1'] ) {
+ $address[] = $mInfo['addr1'];
+ }
+ if ( $mInfo['city'] ) {
+ $address[] = $mInfo['city'];
+ }
+ if ( $mInfo['state'] ) {
+ $address[] = $mInfo['state'];
+ }
+ if ( $mInfo['zip'] ) {
+ $address[] = $mInfo['zip'];
+ }
+ $coupon['address'] = implode( ',', $address );
+ }
+ }
+
+ //echo '<pre>$coupons: ' . print_r( $coupons, true ) . '</pre>';
+ //exit;
+
$pdf = new glmCoupon('a4', 'portrait');
$pdf->selectFont(GLM_MEMBERS_COUPONS_PLUGIN_PATH . "/fonts/Helvetica.afm");
$pdf->ezSetMargins(90, 30, 30, 35);
foreach ( $coupon['categories'] as $category ) {
$categories[$category['name']][] = $coupon;
}
+ } else {
+ $categories['1-category'][] = $coupon;
}
}
}
+ // sort them by category name
+ ksort( $categories );
// Compile template data
<input type="submit" value="Print Selected" name="printSel" class="button success glm_coupon_print">
{if $categories}
{foreach $categories as $catName => $coupons}
- <h2>{$catName}</h2>
+ {if $catName != '1-category'}
+ <h2>{$catName}</h2>
+ {else}
+ <br style="clear:both;">
+ {/if}
<div class="coupon-row">
{if $coupons}
{foreach $coupons as $coupon}