Moved 'bill to' to just below CBV header
Showing
1 changed file
with
22 additions
and
23 deletions
| ... | @@ -102,6 +102,28 @@ use WP_User; | ... | @@ -102,6 +102,28 @@ use WP_User; |
| 102 | Toronto, ON, Canada M5V 3H2 | 102 | Toronto, ON, Canada M5V 3H2 |
| 103 | </p>'; | 103 | </p>'; |
| 104 | 104 | ||
| 105 | if ($status == 'unpaid') { | ||
| 106 | // Get the user's profile preference | ||
| 107 | $preference = strtolower($user->profile_preference); | ||
| 108 | |||
| 109 | // Build the 'Bill To:' info array | ||
| 110 | $user_fields = array('address', 'address2', 'city', 'province', 'country', 'postal'); | ||
| 111 | $bill_to = array(); | ||
| 112 | foreach ($user_fields as $field) { | ||
| 113 | // Use the preference to get the user's address info | ||
| 114 | $bill_to[$field] = get_user_meta($user->ID, "{$preference}_{$field}", TRUE); | ||
| 115 | } | ||
| 116 | // Finish it off with first and last name | ||
| 117 | $bill_to['first_name'] = get_user_meta($user->ID, 'first_name', TRUE); | ||
| 118 | $bill_to['last_name'] = get_user_meta($user->ID, 'last_name', TRUE); | ||
| 119 | |||
| 120 | // Now build the html | ||
| 121 | $html .= '<p><br /><h3>BILL TO:</h3>'; | ||
| 122 | $html .= "{$bill_to['first_name']} {$bill_to['last_name']}<br />"; | ||
| 123 | $html .= "{$bill_to['address']}, {$bill_to['address2']}<br />"; | ||
| 124 | $html .= "{$bill_to['city']}, {$bill_to['province']}, {$bill_to['country']} {$bill_to['postal']}</p>"; | ||
| 125 | } | ||
| 126 | |||
| 105 | $html .= '<h3 style="margin:0;padding:0;text-align:right;">Invoice No.: '.$invoice->ID.'</h3>'; | 127 | $html .= '<h3 style="margin:0;padding:0;text-align:right;">Invoice No.: '.$invoice->ID.'</h3>'; |
| 106 | $html .= '<p style="text-align:right;margin-top:0;padding-top:0;"><strong>Invoice Date:</strong> '.$date.'</p>'; | 128 | $html .= '<p style="text-align:right;margin-top:0;padding-top:0;"><strong>Invoice Date:</strong> '.$date.'</p>'; |
| 107 | $html .= '<h2>'.$invoice->post_title.'</h2>'; | 129 | $html .= '<h2>'.$invoice->post_title.'</h2>'; |
| ... | @@ -247,35 +269,12 @@ use WP_User; | ... | @@ -247,35 +269,12 @@ use WP_User; |
| 247 | //} | 269 | //} |
| 248 | $html .= '</p>'; | 270 | $html .= '</p>'; |
| 249 | 271 | ||
| 250 | if ($status == 'unpaid') { | ||
| 251 | // Get the user's profile preference | ||
| 252 | $preference = strtolower($user->profile_preference); | ||
| 253 | |||
| 254 | // Build the 'Bill To:' info array | ||
| 255 | $user_fields = array('address', 'address2', 'city', 'province', 'country', 'postal'); | ||
| 256 | $bill_to = array(); | ||
| 257 | foreach ($user_fields as $field) { | ||
| 258 | // Use the preference to get the user's address info | ||
| 259 | $bill_to[$field] = get_user_meta($user->ID, "{$preference}_{$field}", TRUE); | ||
| 260 | } | ||
| 261 | // Finish it off with first and last name | ||
| 262 | $bill_to['first_name'] = get_user_meta($user->ID, 'first_name', TRUE); | ||
| 263 | $bill_to['last_name'] = get_user_meta($user->ID, 'last_name', TRUE); | ||
| 264 | |||
| 265 | // Now build the html | ||
| 266 | $html .= '<h3>BILL TO:</h3>'; | ||
| 267 | $html .= "{$bill_to['first_name']} {$bill_to['last_name']}<br />"; | ||
| 268 | $html .= "{$bill_to['address']}<br />{$bill_to['address2']}<br />"; | ||
| 269 | $html .= "{$bill_to['city']}, {$bill_to['province']}<br />"; | ||
| 270 | $html .= "{$bill_to['country']} {$bill_to['postal']}"; | ||
| 271 | } else { | ||
| 272 | $html .= (!empty($invoice->payment['bt_card_holder'])) ? '<h3>BILLED TO:</h3>' : ""; | 272 | $html .= (!empty($invoice->payment['bt_card_holder'])) ? '<h3>BILLED TO:</h3>' : ""; |
| 273 | $html .= (!empty($invoice->payment['bt_card_holder'])) ? $invoice->payment['bt_card_holder']."<br />" : ""; | 273 | $html .= (!empty($invoice->payment['bt_card_holder'])) ? $invoice->payment['bt_card_holder']."<br />" : ""; |
| 274 | $html .= (!empty($invoice->payment['bt_address'])) ? $invoice->payment['bt_address']." ".$invoice->payment['bt_address2'] . "<br />" : ""; | 274 | $html .= (!empty($invoice->payment['bt_address'])) ? $invoice->payment['bt_address']." ".$invoice->payment['bt_address2'] . "<br />" : ""; |
| 275 | $html .= (!empty($invoice->payment['bt_city'])) ? $invoice->payment['bt_city'].", " .$invoice->payment['bt_province']."<br />" : ""; | 275 | $html .= (!empty($invoice->payment['bt_city'])) ? $invoice->payment['bt_city'].", " .$invoice->payment['bt_province']."<br />" : ""; |
| 276 | $html .= (!empty($invoice->payment['bt_country'])) ? $invoice->payment['bt_country']." ".$invoice->payment['bt_postal']."<br /><br />" : ""; | 276 | $html .= (!empty($invoice->payment['bt_country'])) ? $invoice->payment['bt_country']." ".$invoice->payment['bt_postal']."<br /><br />" : ""; |
| 277 | $html .= (!empty($invoice->payment['bt_card_type'])) ? "Paid using: <strong>".CBV\get_payment_string($invoice->payment['bt_card_type'])."</strong> " . $invoice->payment['bt_card_number'] : ""; | 277 | $html .= (!empty($invoice->payment['bt_card_type'])) ? "Paid using: <strong>".CBV\get_payment_string($invoice->payment['bt_card_type'])."</strong> " . $invoice->payment['bt_card_number'] : ""; |
| 278 | } | ||
| 279 | 278 | ||
| 280 | //if ($status != "credit") { | 279 | //if ($status != "credit") { |
| 281 | $html .= '<p>GST/HST# R108075334</p>'; | 280 | $html .= '<p>GST/HST# R108075334</p>'; | ... | ... |
-
Please register or sign in to post a comment