function get_content_email($email_order_code, $tel_number, $delivery_address) { $arr = array(); $i = $total_price = 0; $basket = getBasketByOrder($email_order_code); foreach ($basket as $pr_b) { $pr_info = getProductByID($pr_b["prID"]); $total_price += $pr_b['aPrice']; if ($i == 0) { $arr[$i]['baID'] = $pr_b['baID']; $arr[$i]['aPrice'] = $pr_b['aPrice']; $arr[$i]['aTitle'] = $pr_info['aTitle']; $arr[$i]['prID'] = $pr_b["prID"]; $arr[$i]['QTY'] = 1; $i++; } else { $isProduct = false; for ($j = 0; $j < count($arr); $j++) { if ($pr_b["prID"] == $arr[$j]['prID'] && $pr_b["aPrice"] == $arr[$j]['aPrice']) { $arr[$j]['QTY']++; $arr[$j]['baID'] .= ',' . $pr_b['baID']; $isProduct = true; } } if (!$isProduct) { $arr[$i]['baID'] = $pr_b['baID']; $arr[$i]['aPrice'] = $pr_b['aPrice']; $arr[$i]['aTitle'] = $pr_info['aTitle']; $arr[$i]['prID'] = $pr_b["prID"]; $arr[$i]['QTY'] = 1; $i++; } } } $i = 1; $table_body = ''; foreach ($arr as $b) { $table_body .= '<tr> <td>' . $b['QTY'] . '</td> <td class="textLeft">' . $b['aTitle'] . '</td> <td>£' . $b['aPrice'] . '</td> </tr>'; $i++; } $table_body .= '<tr> <td></td> <td class="textRight"><b>Total</b></td> <td><b>£' . $total_price . '</b></td> </tr>'; // you need to add content here. $content = '<p>Dear ' . $_SESSION['user']->Fname . '</p> <p>Thank you for your recent purchase.</p> <p><b>Items Purchased</b></p>'; $content .= '<table id="table_basket" class="invoice" border="0" cellpadding="2" cellspacing="0" > <tr> <th width="100">QTY</th> <th class="textLeft">PRODUCT NAME</th> <th width="125">PRICE</th> </tr> ' . $table_body . ' </table><br> '; //add shopping basket here in a table $content .= '<table id="table_basket" class="details" border="0" cellpadding="2" cellspacing="0" > <tr> <td width="150"><b>Your order code:</b></td> <td> CR' . $email_order_code . ' </td> </tr> <tr> <td><b>Name:</b></td> <td>' . $_SESSION['user']->Fname . ' ' . $_SESSION['user']->Sname . '</td> </tr> <tr> <td><b>Email:</b></td> <td>' . $_SESSION['user']->Eaddress . '</td> </tr> <tr> <td><b>Telephone Number:</b></td> <td>' . $tel_number . '</td> </tr>'; if ($delivery_address != '') { $content .= '<tr> <td><b>Delivery address:</b></td> <td>' . $delivery_address . '</td> </tr>'; } $content .= '</table>'; //add order details here in a table $content .= ''; $content .= '<p>If you have any questions regarding your order, please email <a href="mailto:concierge@xexec.com">concierge@xexec.com</a> or<br>call +44 20 8201 6483 quoting your unique order code.</p>'; return $content; }
foreach ($redeemList as $list) { ?> <div class="row"> <div class="tableColumn-4 textRight"> <?php echo getConvertedDate($list->DateClaimed); ?> </div> <div class="tableColumn-3 textRight"> <?php echo '£' . $list->totalPrice; ?> </div> <div class="tableColumn-5 textRight"> <?php $basket = getBasketByOrder($list->id); //print_r($basket); foreach ($basket as $pr_b) { $pr_info = getProductByID($pr_b["prID"]); echo $pr_info['aTitle'] . ' - £' . $pr_b['aPrice'] . '<br>'; } ?> </div> </div> <?php } ?> </div> <?php } ?>