<h4>Product Details</h4> <table width="595" border="0" cellspacing="0" cellpadding="0" style="border:#000000 1px solid;padding:10px"> <tbody> <tr> <td height="32">ID</td> <td>Name</td> <td>Value</td> </tr> <tr> <td width="98" height="27"> <?php if ($order->picture) { ?> <img src="<?php echo img_format('../pictures/' . $order->picture, 'stamp'); ?> " width="70" height="70" /> <?php } ?> </td> <td width="347"> <strong> <?php echo $order->product_id; ?> - <?php echo $order->product; ?> </strong> </td>
if (count($catproducts)) { ?> <tr> <td valign="top" class="label">Products Display Order</td> <td><div class="scroll_win" style="height:550px; width:700px;"> <table border="0" cellspacing="0" cellpadding="0" id="result" class="result"> <tr> <th colspan="2">Products</th><th>Display Order</th> </tr> <?php foreach ($catproducts as $row) { ?> <tr> <td> <img src="<?php echo img_format('productres/' . $row->product_picture, 'macro'); ?> " /></td> <td nowrap="nowrap"><?php echo $row->product_name; ?> </td> <td><input type="text" name="display_order[<?php echo $row->product_id; ?> ]" value="<?php if (isset($row->display_order)) { echo $row->display_order; } else { echo '0'; }
</div> <div id="birthday_month_thumbs" class="clearfix"> <?php foreach ($products as $row) { ?> <div class="product-item clearfix"> <center> <div class="item"> <a href="/<?php echo $row->url; ?> "><img src="<?php echo img_format('productres/' . $row->product_picture, 'birthmonthitem'); ?> " alt="<?php echo $row->alternate_text; ?> " title="<?php echo $row->alternate_text; ?> " class="mpic" /></a> <a class="product-name" href="/<?php echo $row->url; ?> "><?php echo $row->product_code; ?> </a>
<h3><?php echo lang('your_cart'); ?> </h3> <div class="sidebar-item" id="side-cart"> <?php if (isset($this->cart) && $this->cart->total_items() > 0) { ?> <div class="sidebar-cart"> <?php foreach ($this->cart->contents() as $cart) { ?> <div class="sidecart-item"> <p><img src="<?php echo img_format('../pictures/' . $cart['options']['picture'], 'stamp'); ?> " width="50" height="50" /></p> <p><em><?php echo $cart['name']; ?> </em></p> <p><em><?php echo $cart['qty'] . ' x $' . number_format($cart['price'], 2); ?> </em></p> </div> <?php } ?> <div class="total"><span>Total:</span> <?php echo '$' . number_format($this->cart->total(), 2);
public function submit() { $cart_id = $this->session->userdata('cart_id'); if ($this->Order_model->is_cart_empty($cart_id)) { die('Cart is empty!'); } elseif (!$this->Order_model->is_delivery_entered($cart_id)) { die('Invalid Use! Delivery is not entered'); } elseif (!$this->Order_model->is_billing_entered($cart_id)) { die('Invalid Use! Billing info not entered'); } else { $this->load->model('Group_model'); $cart = $this->Order_model->get_fullcart($this->session->userdata('cart_id')); $totals = array('itemtotal' => 0, 'shipping' => 0, 'service' => 0, 'surcharge' => 0, 'tax' => 0, 'discount' => 0, 'coupon' => 0, 'coupon_code' => '', 'companyless' => 0, 'grandtotal' => 0); $order_items = ''; $oformat = file_get_contents('assets/email_items.html'); $aoformat = $itemformat = ''; $aitemformat = ''; $icnt = 0; $itemprc = 0; $this->load->model('Affiliate_model'); $cartdiscount = 0; $cartcoupon = 0; $cartdiscounttype = 'percentage'; $cartcoupontype = 'percentage'; foreach ($cart as $item) { $totals['itemtotal'] += $item->product_price; foreach ($item->addons as $addon) { $totals['itemtotal'] += $addon->addon_price * $addon->addon_quantity; } } $coupon_discount = 0; $cartitems = array(); $itemscount = count($cart); foreach ($cart as $item) { $ptotal = $item->product_price; $addition = $this->Order_model->get_add_charges($item->orderitem_id); $totals['shipping'] += $addition['shipping']; $totals['service'] += $addition['service']; $totals['surcharge'] += $addition['surcharge']; if ($cartcoupon > 0) { if ($cartcoupontype == 'percentage') { $totals['coupon'] += $cartcoupon * $ptotal / 100; $ptotal -= $cartcoupon * $ptotal / 100; } else { $part = $cartcoupon / $itemscount; $totals['coupon'] += $part; $ptotal -= $part; } } else { if ($cartdiscounttype == 'percentage') { $totals['discount'] += $cartdiscount * $ptotal / 100; $ptotal -= $cartdiscount * $ptotal / 100; } else { $part = $cartdiscount / $itemscount; $totals['discount'] += $part; $ptotal -= $part; } } $ptotal += $addition['shipping']; $ptotal += $addition['service']; $ptotal += $addition['surcharge']; $totals['tax'] += $addition['tax'] * $ptotal / 100; } $totals['grandtotal'] = number_format($totals['itemtotal'], 2) + number_format($totals['shipping'], 2) + number_format($totals['service'], 2) + number_format($totals['surcharge'], 2) + number_format($totals['tax'], 2) - number_format($totals['discount'], 2) - number_format($totals['coupon'], 2); $invoiceTotal = number_format($totals['grandtotal'], 2); $customer_id = $this->session->userdata('affiliate_id'); $affiliate_id = $this->session->userdata('affiliate_id'); $aff = $this->Affiliate_model->get_affiliate($this->session->userdata('affiliate_id')); $this->form_validation->set_rules("cc", 'Credit Card Number', 'required|numeric|min_length[15]|max_length[16]'); $this->form_validation->set_rules("cmonth", 'Expiry Month', 'required|min_length[2]|max_length[5]'); $this->form_validation->set_rules("cyear", 'Expiry Year', 'required|min_length[2]|max_length[5]'); $this->form_validation->set_rules("cvv", 'CVV2', 'required|min_length[3]|max_length[5]'); $this->form_validation->set_error_delimiters('<span class="error error_span">', '</span>'); if ($this->form_validation->run() == TRUE || $aff->customer_onaccount == 1) { $this->load->library('plugnpay'); $order = (object) $_POST; $this->load->model('Country_model'); $country = $this->Country_model->get_country($order->country_id); $order->country = $country->country_name; $order->ipaddress = $_SERVER['REMOTE_ADDR']; $order->nameoncard = $this->input->post('payeename'); $order->cardnumber = $this->input->post('cc'); $order->cvv = $this->input->post('cvv'); $order->expiry = $this->input->post('cmonth') . '/' . $this->input->post('cyear'); $order->total = $totals['grandtotal']; $order->affiliate_id = $this->session->userdata('affiliate_id'); $order->email = $aff->user_email; $order->address1 = $aff->user_address1; $order->address2 = $aff->user_address2; if ($aff->customer_onaccount != 1) { if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' && ENVIRONMENT == 'development') { //$result = $this->plugnpay->pay($order); $result['FinalStatus'] = 'success'; $payment_method = 'credit_card'; } else { $result = $this->plugnpay->pay($order); $payment_method = 'credit_card'; } } else { $result['FinalStatus'] = 'success'; $payment_method = 'on_account'; } if ($result['FinalStatus'] == 'success') { if ($oid = $this->Order_model->create_Order($this->session->userdata('cart_id'), $totals, $customer_id, $affiliate_id, $payment_method)) { $cart_id = $this->session->userdata('cart_id'); $this->db->where('cart_id', $cart_id); $this->db->update('carts', array('completed' => '1')); $this->session->set_userdata('cart_id', '0'); //$this->unset_cart(); $data['items'] = $this->Order_model->getDelivery($cart_id); $data['message'] = 'Your order completed successfully'; $data['invoice_number'] = $oid; $data['totals'] = $totals; $data['billing'] = $this->Order_model->getBilling($cart_id); $conversion = ''; $cartitems = array(); $itemscount = count($cart); foreach ($cart as $item) { $itemprc = 0; $ptotal = $item->product_price; $icnt++; $itemf = $oformat; $itemf = str_replace('{counter}', $icnt, $itemf); $itemf = str_replace('{firstname}', $item->firstname, $itemf); $itemf = str_replace('{lastname}', $item->lastname, $itemf); $itemf = str_replace('{location_type}', $item->location_type, $itemf); $itemf = str_replace('{location_type_name}', $item->location_type_name, $itemf); $itemf = str_replace('{address1}', $item->address1, $itemf); $itemf = str_replace('{address2}', $item->address2, $itemf); $itemf = str_replace('{city}', $item->city, $itemf); $itemf = str_replace('{postalcode}', $item->postalcode, $itemf); $itemf = str_replace('{province}', $item->province, $itemf); $itemf = str_replace('{country}', $item->country_id, $itemf); $itemf = str_replace('{phone}', $item->dayphone . ' ' . $item->evephone, $itemf); $itemf = str_replace('{message}', $item->card_message, $itemf); $itemf = str_replace('{delivery_date}', date('d M Y', strtotime($item->delivery_date)), $itemf); $itemf = str_replace('{shipping_method}', $item->infotext, $itemf); $itemf = str_replace('{delivery_info}', $item->delivery_description, $itemf); $itemf = str_replace('{product_image}', '<img src="' . $this->config->item('base_url') . img_format('productres/' . $item->product_picture, 'thumb') . '" />', $itemf); $itemf = str_replace('{product_code}', $item->product_code, $itemf); $itemf = str_replace('{orderitem_id}', $item->orderitem_id, $itemf); $itemf = str_replace('{product_name}', $item->product_name . '<br/><small>(' . $item->price_name . ')</small>', $itemf); $itemf = str_replace('{price}', '$' . number_format($item->product_price, 2), $itemf); $itemf = str_replace('{quantity}', '1', $itemf); $itemprc += $item->product_price; if ($item->delivery_method_id == 1) { $itemf = str_replace('{delivery_by}', 'Delivery by Local', $itemf); } else { $itemf = str_replace('{delivery_by}', 'This bouquet comes to via UPS.', $itemf); } $itemf = str_replace('{total}', '$' . number_format($item->product_price, 2), $itemf); if (array_key_exists($item->product_id, $cartitems)) { $cartitems[$item->product_id]['sku'] = $item->product_code; $cartitems[$item->product_id]['qty'] = $cartitems[$item->product_id]['qty'] + 1; $cartitems[$item->product_id]['amt'] = $cartitems[$item->product_id]['amt'] + $item->product_price * 100; $cartitems[$item->product_id]['name'] = urlencode($item->product_name); $cartitems[$item->product_id]['category'] = urlencode($item->category); } else { $cartitems[$item->product_id]['sku'] = $item->product_code; $cartitems[$item->product_id]['qty'] = 1; $cartitems[$item->product_id]['amt'] = $item->product_price * 100; $cartitems[$item->product_id]['name'] = urlencode($item->product_name); $cartitems[$item->product_id]['category'] = urlencode($item->category); } $addontot = 0; if (count($item->addons)) { $order_items = ''; foreach ($item->addons as $addon) { $order_items .= '+(' . $addon->addon_name . " " . $addon->addon_quantity . 'x$' . number_format($addon->addon_price, 2) . ") \$" . number_format($addon->addon_price * $addon->addon_quantity, 2) . "<br/>\n"; $itemprc += $addon->addon_price * $addon->addon_quantity; $addontot += $addon->addon_price * $addon->addon_quantity; $ptotal += $addon->addon_price * $addon->addon_quantity; if (array_key_exists($addon->addon_id, $cartitems)) { $cartitems[$addon->addon_id]['sku'] = $addon->addon_id; $cartitems[$addon->addon_id]['qty'] = $cartitems[$addon->addon_id]['qty'] + $addon->addon_quantity; $cartitems[$addon->addon_id]['amt'] = $cartitems[$addon->addon_id]['amt'] + $addon->addon_price * 100; $cartitems[$addon->addon_id]['name'] = urlencode($addon->addon_name); $cartitems[$addon->addon_id]['category'] = urlencode($item->category); } else { $cartitems[$addon->addon_id]['sku'] = $addon->addon_id; $cartitems[$addon->addon_id]['qty'] = $addon->addon_quantity; $cartitems[$addon->addon_id]['amt'] = $addon->addon_price * 100; $cartitems[$addon->addon_id]['name'] = urlencode($addon->addon_name); $cartitems[$addon->addon_id]['category'] = urlencode($item->category); } //echo $order_items; } //echo $order_items; } else { $order_items .= 'None'; } $conversion .= 'bta.addConversionLegacy("$", "' . $item->product_name . '", "' . number_format($itemprc, 2) . '");' . "\n"; $itemf = str_replace('{addons}', $order_items, $itemf); $itemf = str_replace('{addon_price}', '$' . number_format($addontot, 2), $itemf); $addition = $this->Order_model->get_add_charges($item->orderitem_id); $totals['shipping'] += $addition['shipping']; $totals['service'] += $addition['service']; $totals['surcharge'] += $addition['surcharge']; if ($cartcoupon > 0) { if ($cartcoupontype == 'percentage') { $totals['coupon'] += $cartcoupon * $ptotal / 100; $ptotal -= $cartcoupon * $ptotal / 100; } else { $part = $cartcoupon / $itemscount; $totals['coupon'] += $part; $ptotal -= $part; } } else { if ($cartdiscounttype == 'percentage') { $totals['discount'] += $cartdiscount * $ptotal / 100; $ptotal -= $cartdiscount * $ptotal / 100; } else { $part = $cartdiscount / $itemscount; $totals['discount'] += $part; $ptotal -= $part; } } $ptotal += $addition['shipping']; $ptotal += $addition['service']; $ptotal += $addition['surcharge']; //$totals['tax'] += ($addition['tax'] * $ptotal) / 100; $aitemformat .= str_replace('{product_description}', '', $itemf); $itemf = str_replace('{product_description}', substr($item->product_description, 0, 50), $itemf); $itemformat .= $itemf; } $ggitems = ''; foreach ($cartitems as $citem) { $productids[] = $citem['sku'] . ':' . str_replace('+', '', $citem['name']); $itemvalues[] = $citem['amt']; $units[] = $citem['qty']; $skulist[] = $citem['sku']; $qlist[] = $citem['qty']; $amtlist[] = $citem['amt']; $namelist[] = $citem['name']; } /*$addition = $this->Order_model->get_add_charges($item->orderitem_id); $totals['shipping'] += $addition['shipping']; $totals['service'] += $addition['service']; $totals['surcharge'] += $addition['surcharge']; */ //email code $eformat = file_get_contents('assets/ff_email_format.html'); $eheader = file_get_contents('assets/ff_email_header.html'); $this->load->library('plugnpay'); //$order = unserialize(base64_decode($_POST['data'])); //$country = $this->Country_model->get_country($order->country_id); //$gci=$this->session->userdata('cart_id'); //$bil = $this->Order_model->getBilling2($this->session->userdata('cart_id')); //$this->Order_model->get_add_charges($item->orderitem_id); $country = $this->Country_model->get_country($order->country_id); $order2->country = $country->country_name; $billi = $this->Order_model->getBilling2($this->session->userdata('affiliate_id')); $order2->firstname = $billi->user_firstname; $order2->lastname = $billi->user_lastname; $order2->address1 = $billi->user_address1; $order2->address2 = $billi->user_address2; $order2->postalcode = $billi->user_postalcode; $order2->city = $billi->user_city; $order2->email = $billi->user_email; $inf_oscar = $billi->user_firstname; $g_total = $totals['itemtotal'] + $totals['tax']; $order->affiliate_id = $this->session->userdata('referer') ? $this->session->userdata('referer') : '0'; $aff_phone = ''; /*if($order->dayphone!='') { $aff_phone=$order->dayphone; }*/ $eheader = str_replace('{firstname}', $order->firstname, $eheader); $eformat = str_replace('{firstname}', $order2->firstname, $eformat); $eheader = str_replace('{lastname}', $order->lastname, $eheader); $eformat = str_replace('{lastname}', $order2->lastname, $eformat); $eformat = str_replace('{address1}', $order2->address1, $eformat); $eformat = str_replace('{address2}', $order2->address2, $eformat); $eformat = str_replace('{city}', $order2->city, $eformat); $eformat = str_replace('{postalcode}', $order2->postalcode, $eformat); $eformat = str_replace('{country}', $order2->country, $eformat); $eformat = str_replace('{email}', $order2->email, $eformat); /*$eformat = str_replace('{dayphone}',$order->user_phone1,$eformat); $eformat = str_replace('{evephone}',$order->user_phone2,$eformat);*/ $eformat = str_replace('{product_price}', '$' . number_format($totals['itemtotal'], 2), $eformat); /*$eformat = str_replace('{delivery_charge}','$'.number_format($totals['shipping'],2),$eformat); $eformat = str_replace('{service_charge}','$'.number_format($totals['service'],2),$eformat); $eformat = str_replace('{surcharge}','$'.number_format($totals['surcharge'],2),$eformat); $eformat = str_replace('{discount}','$'.number_format($totals['discount']-$totals['coupon']-$totals['companyless'],2),$eformat);*/ $eformat = str_replace('{tax}', '$' . number_format($totals['tax'], 2), $eformat); //$eformat = str_replace('{grand_total}','$'.number_format($totals['grandtotal'],2),$eformat); $eformat = str_replace('{grand_total}', '$' . number_format($g_total, 2), $eformat); // $eformat = str_replace('{affi_logo}',$this->session->userdata('logo'),$eformat); $eformat = str_replace('{invoice_num}', $oid, $eformat); $admin_format = $eformat; $admin_format = str_replace('{items}', $aitemformat, $admin_format); $admin_format = str_replace('{email_header}', 'Dear :' . strtoupper($this->session->userdata('user_role')), $admin_format); $eformat = str_replace('{items}', $itemformat, $eformat); $eformat = str_replace('{email_header}', $eheader, $eformat); $eformat = str_replace('{invoice_num}', $oid, $eformat); //$session['firstname'] $eformat = str_replace('{items}', $itemformat, $eformat); $eformat = str_replace('{email_header}', $eheader, $eformat); $this->load->library('email'); $email_config['mailtype'] = 'html'; $this->email->initialize($email_config); $this->email->from('*****@*****.**', 'Memorial Flowers'); //$this->email->to($order->email); $this->email->to($order->email); //$this->email->bcc('*****@*****.**'); $this->email->subject('Memorial Flowers Order Confirmation'); $this->email->message($eformat); if ($this->email->send()) { $success = true; } $this->email->from('*****@*****.**', 'Memorial Flowers'); //$this->email->to('*****@*****.**'); //$this->email->cc('*****@*****.**'); $this->email->to('*****@*****.**'); $this->email->subject('Memorial Flowers Order Confirmation'); $this->email->message($admin_format); if ($this->email->send()) { $success = true; } //end here $data['page'] = $this->Pages_model->return_page('order-thanks'); $data['paths'] = array('Home' => path(), 'Checkout' => '#', 'Thank you' => ''); $this->load->view('mymemorial/thankyou', $data); exit; } } else { $elist = '<ul class="elist">'; if ($cerrors = explode('|', $result['MErrMsg'])) { foreach ($cerrors as $ce) { if (!empty($ce)) { $elist .= '<li>' . $ce . '</li>'; } } } else { $elist = '<li>' . $result['MErrMsg'] . '<li>'; } $elist .= '</ul>'; $elist = '<div class="show_errors"><h3>' . 'Error in Payment' . '</h3>' . $elist . '</div>'; } } else { echo validation_errors(); die('~Invalid Use!'); } } }
?> <div class="product-item box-small"> <div class="row-fluid"> <div class="span12" style="height:600px;"> <?php if (strlen($product->product_picture) > 4) { ?> <img src="<?php echo img_format('productres/' . $product->product_picture, 'sthumb'); ?> " /> <?php } else { ?> <img src="<?php echo img_format('productres/' . $product->product_picture, 'sthumb'); ?> " /> <?php } ?> <?php $con = mysqli_connect("localhost", "flowercrazy", "fc883", "funeral_test"); $result = mysqli_query($con, "SELECT * FROM product_prices WHERE product_id='" . $product->product_id . "' ORDER BY price_value ASC"); $nu = 1; echo '<table width="100%"><tr >'; while ($row = mysqli_fetch_array($result)) { echo '<td style="text-align:center; width:40px;">'; echo '<label style="font-size:16px; font-weight:bold;">$' . $row['price_value'] . '</label>'; if ($nu == 1) {
echo $month->name; ?> "> <em><?php echo lang('read more'); ?> </em></a> </p> <?php } else { ?> <a href="/products/birthmonth_flowers/<?php echo $month->name; ?> "><img src="<?php echo img_format('productres/' . $month->picture, 'birthmonth'); ?> " /></a> <p class="description"> <?php echo substr($month->description, 0, 100); ?> :<a href="/products/birthmonth_flowers/<?php echo $month->name; ?> "><em><?php echo lang('read more'); ?> </em></a> </p> <?php
?> <?php $upath = str_replace(' ', '-', strtolower($row->occasion_name)) . '/'; if ($upath == '/') { $upath = ''; } ?> <div class="product-item"> <div class="item"> <a href="/<?php echo $upath . $row->url; ?> "><img src="<?php echo img_format('productres/' . $row->product_picture, 'thumb'); ?> " alt="<?php echo $row->alternate_text; ?> " title="<?php echo $row->alternate_text; ?> " width="186" height="208"/></a> <a class="product-name" href="/<?php echo $upath . $row->url; ?> "><?php echo rightLang($row->product_name, $row->product_name_fr); ?> </a>
<button name="rem" class="btn btn-danger btn-mini" /><?php echo lang('Remove'); ?> </button></a></td> <td class="pprice right" width="25%"><?php echo getRate($row->product_price); ?> </p></td> </tr> <?php foreach ($row->addons as $addon) { $total_price += $addon->addon_price * $addon->addon_quantity; ?> <tr> <td class="addonrow"><img src="<?php echo img_format('productres/' . $addon->addon_picture, 'sthumb'); ?> " /></td> <td class="addonrow"> <?php echo ucfirst(strtolower($addon->addon_name)); ?> - <?php echo ucfirst(strtolower($addon->description)); ?> (<?php echo getRate($addon->addon_price); ?> ) </td> <td class="center">
?> </td> <td><?php echo $res->product; ?> <br/> <?php echo '<small><em>(From: ' . date('d M Y', strtotime($res->created)) . ')</small></em>'; ?> </td> <td width="50"> <?php if (strlen($res->picture) > 4) { ?> <img src="<?php echo img_format('../pictures/' . $res->picture, 'thumb'); ?> " width="50" height="50" /> <?php } else { ?> No Image <?php } ?> </td> <td><?php echo $res->sales ? $res->sales : '0'; ?> </td> <td><?php
<?php $total = 0; foreach ($addons as $addon) { ?> <div class="addon-item"> <div class="item_pic"> <img src="<?php echo img_format('../pictures/' . $addon->picture, 'tiny'); ?> " width="30" height="30" /> <p><?php echo $addon->additionalitem; ?> </p> </div> <div class="item_price"> <?php echo '$' . number_format($addon->price, 2); ?> </div> <div class="item_quantity"> <input type="text" name="quantity" size="3" value="0" /> </div> <div class="item_action"> <a href="#" class="remove" id="<?php echo $item['rowid']; ?> ">Remove</a> </div> </div>
</p> <p> <label for="delivery_id">Delivery Type</label> <select name="delivery_id"> <option value="1">Sameday</option> <option value="2">Grower Direct</option> <option value="3">International</option> </select> </p> <?php if (isset($product) && strlen($product->picture) > 4) { ?> <p><label> </label> <img src="<?php echo img_format('../pictures/' . $product->picture, 'stamp'); ?> " /></p> <?php } ?> <p><label for="picture">Product Image</label> <input type="file" name="picture" size="35" /> </p> <p><label for="active">Activate?</label> <input type="checkbox" name="active" value="1" <?php if (isset($_POST) && isset($_POST['active'])) { echo ' checked="checked" '; } elseif (isset($product) && $product->active == 1) { echo ' checked="checked" ';
function img($image, $size, $attributes = '') { return '<img src="' . img_format('productres/' . $image, $size) . '" ' . $attributes . ' />'; }
<br /> <!-- <?php if (count($product->addons)) { ?> <h4>Add to your Order <em>(Optional)</em></h4> <div id="addons" class="clearfix"> <?php foreach ($product->addons as $add) { ?> <div class="addonbox"> <img src="<?php echo img_format('productres/' . $add->addon_picture, 'macro'); ?> " alt="<?php echo $add->addon_name; ?> " align="left" class="img-polaroid" /> <ul class="addon_details"> <span class="lead"><?php echo $add->addon_name; ?> </span> <li> <select name="option[<?php echo $add->addon_id; ?> ]" class="seladdon" style="width:180px;" id="seladdon<?php
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo"> Your Cart </a> </div> <div id="collapseTwo" class="accordion-body collapse in"> <div class="accordion-inner"> <?php if (count($cart)) { $total = 0; foreach ($cart as $item) { ?> <div class="row-fluid sidebar-cart-item"> <div class="span8"> <img src="<?php echo img_format('productres/' . $item->product_picture, 'stamppng'); ?> " /> </div> <div class="span16"> <?php echo $item->product_name; ?> <br/> 1 x <?php echo getRate($item->product_price); $total += $item->product_price; ?> </div> </div>
<input type="hidden" name="oid" id="oid" value="<?php echo $orderitem_id; ?> " /> </div> </div><!-- common_form--> <div class="col2"> <h3><?php echo lang('Card Message'); ?> </h3> <div class="form-control"> <div class="form-field"> <img src="<?php echo img_format('productres/' . $row->product_picture, 'stamp'); ?> " /> <strong><?php echo $row->product_name; ?> </strong> </div> </div> <div class="form-control"> <label for="delivery_date" class="form-label"><?php echo lang('Delivery Date'); ?> </label> <div class="form-field"> <?php
function checkout() { use_ssl(TRUE); $cart_id = $this->session->userdata('cart_id'); if ($this->Order_model->is_cart_empty($cart_id)) { redirect('/shop/cart'); exit; } elseif (!$this->Order_model->is_delivery_entered($cart_id)) { redirect('/shop/delivery'); exit; } elseif (!$this->Order_model->is_billing_entered($cart_id)) { redirect('/shop/billing'); exit; } else { $this->load->model('Group_model'); $cart = $this->Order_model->get_fullcart($this->session->userdata('cart_id')); $totals = array('itemtotal' => 0, 'shipping' => 0, 'service' => 0, 'surcharge' => 0, 'tax' => 0, 'discount' => 0, 'coupon' => 0, 'coupon_code' => '', 'companyless' => 0, 'grandtotal' => 0); $order_items = ''; $oformat = file_get_contents('assets/email_items.html'); $aoformat = $itemformat = ''; $aitemformat = ''; $icnt = 0; $itemprc = 0; $this->load->model('Company_model'); $this->load->model('Customer_model'); $conversion = ''; $cartitems = array(); foreach ($cart as $item) { $itemprc = 0; $ptotal = $item->product_price; $icnt++; $itemf = $oformat; $itemf = str_replace('{counter}', $icnt, $itemf); $itemf = str_replace('{firstname}', $item->firstname, $itemf); $itemf = str_replace('{lastname}', $item->lastname, $itemf); $itemf = str_replace('{address1}', $item->address1, $itemf); $itemf = str_replace('{address2}', $item->address2, $itemf); $itemf = str_replace('{city}', $item->city, $itemf); $itemf = str_replace('{postalcode}', $item->postalcode, $itemf); $itemf = str_replace('{province}', $item->province, $itemf); $itemf = str_replace('{country}', $item->country_id, $itemf); $itemf = str_replace('{phone}', $item->dayphone . ' ' . $item->evephone, $itemf); $itemf = str_replace('{message}', $item->card_message, $itemf); // $itemf = str_replace('{delivery_date}',date('d M Y',strtotime($item->delivery_date)),$itemf); $itemf = str_replace('{delivery_date}', date('d M Y', strtotime($item->delivery_date)) . ' - ' . $item->delivery_time, $itemf); $itemf = str_replace('{shipping_method}', $item->infotext, $itemf); $itemf = str_replace('{delivery_info}', $item->delivery_description, $itemf); $itemf = str_replace('{product_image}', '<img src="' . $this->config->item('base_url') . img_format('productres/' . $item->product_picture, 'thumb') . '" />', $itemf); $itemf = str_replace('{product_code}', $item->product_code, $itemf); $itemf = str_replace('{product_name}', $item->product_name . '<br/><small>(' . $item->price_name . ')</small>', $itemf); $itemf = str_replace('{price}', '$' . number_format($item->product_price, 2), $itemf); $itemf = str_replace('{quantity}', '1', $itemf); $itemprc += $item->product_price; if ($item->delivery_method_id == 1) { $itemf = str_replace('{delivery_by}', 'Delivery by Local', $itemf); } else { $itemf = str_replace('{delivery_by}', 'This bouquet comes to via UPS.', $itemf); } $itemf = str_replace('{total}', '$' . number_format($item->product_price, 2), $itemf); $totals['itemtotal'] += $item->product_price; if (array_key_exists($item->product_id, $cartitems)) { $cartitems[$item->product_id]['sku'] = $item->product_code; $cartitems[$item->product_id]['qty'] = $cartitems[$item->product_id]['qty'] + 1; $cartitems[$item->product_id]['amt'] = $cartitems[$item->product_id]['amt'] + $item->product_price * 100; $cartitems[$item->product_id]['name'] = urlencode($item->product_name); $cartitems[$item->product_id]['category'] = urlencode($item->category); } else { $cartitems[$item->product_id]['sku'] = $item->product_code; $cartitems[$item->product_id]['qty'] = 1; $cartitems[$item->product_id]['amt'] = $item->product_price * 100; $cartitems[$item->product_id]['name'] = urlencode($item->product_name); $cartitems[$item->product_id]['category'] = urlencode($item->category); } $addontot = 0; if (count($item->addons)) { $order_items = ''; foreach ($item->addons as $addon) { $order_items .= '+(' . $addon->addon_name . " " . $addon->addon_quantity . 'x$' . number_format($addon->addon_price, 2) . ") \$" . number_format($addon->addon_price * $addon->addon_quantity, 2) . "<br/>\n"; $totals['itemtotal'] += $addon->addon_price * $addon->addon_quantity; $itemprc += $addon->addon_price * $addon->addon_quantity; $addontot += $addon->addon_price * $addon->addon_quantity; $ptotal += $addon->addon_price * $addon->addon_quantity; if (array_key_exists($addon->addon_id, $cartitems)) { $cartitems[$addon->addon_id]['sku'] = $addon->addon_id; $cartitems[$addon->addon_id]['qty'] = $cartitems[$addon->addon_id]['qty'] + $addon->addon_quantity; $cartitems[$addon->addon_id]['amt'] = $cartitems[$addon->addon_id]['amt'] + $addon->addon_price * 100; $cartitems[$addon->addon_id]['name'] = urlencode($addon->addon_name); $cartitems[$item->product_id]['category'] = urlencode($item->category); } else { $cartitems[$addon->addon_id]['sku'] = $addon->addon_id; $cartitems[$addon->addon_id]['qty'] = $addon->addon_quantity; $cartitems[$addon->addon_id]['amt'] = $addon->addon_price * 100; $cartitems[$addon->addon_id]['name'] = urlencode($addon->addon_name); $cartitems[$item->product_id]['category'] = urlencode($item->category); } //echo $order_items; } //echo $order_items; } else { $order_items .= 'None'; } $conversion .= 'bta.addConversionLegacy("$", "' . $item->product_name . '", "' . number_format($itemprc, 2) . '");' . "\n"; $itemf = str_replace('{addons}', $order_items, $itemf); $itemf = str_replace('{addon_price}', '$' . number_format($addontot, 2), $itemf); $addition = $this->Order_model->get_add_charges($item->orderitem_id); if (!($waiver = $this->Company_model->checkWaiver($this->session->userdata('customer_id')))) { $totals['shipping'] += $addition['shipping']; $totals['service'] += $addition['service']; $totals['surcharge'] += $addition['surcharge']; } $totals['tax'] += $addition['tax'] * $ptotal / 100; $aitemformat .= str_replace('{product_description}', '', $itemf); $itemf = str_replace('{product_description}', substr($item->product_description, 0, 50), $itemf); $itemformat .= $itemf; } $ggitems = ''; foreach ($cartitems as $citem) { $productids[] = $citem['sku'] . ':' . str_replace('+', '', $citem['name']); $itemvalues[] = $citem['amt']; $units[] = $citem['qty']; $skulist[] = $citem['sku']; $qlist[] = $citem['qty']; $amtlist[] = $citem['amt']; $namelist[] = $citem['name']; } $coupon_discount = 0; if ($user_discount = $this->Customer_model->getDiscount($this->session->userdata('customer_id'))) { $totals['discount'] = $totals['itemtotal'] * $user_discount / 100; } else { if ($this->session->userdata('coupon')) { $coupon = get_coupon_discount($this->session->userdata('coupon'), $totals['itemtotal']); $totals['coupon_code'] = $coupon->discount_name; $totals['coupon'] = $coupon->discount_amount ? $coupon->discount_amount : $coupon->discount_percentage * $totals['itemtotal'] / 100; } $totals['discount'] = get_discount($totals['itemtotal']); $totals['companyless'] = get_company_discount($totals['itemtotal'], $this->session->userdata('customer_id') ? $this->session->userdata('customer_id') : '0'); } if ($totals['discount'] > 0) { $skulist[] = 'Discount'; $qlist[] = 0; $amtlist[] = $totals['discount'] * -100; $namelist[] = 'Discount'; $productids[] = 'Discount'; $itemvalues[] = round($totals['discount'] * 100); $units[] = 1; } else { $productids[] = 'Discount'; $itemvalues[] = 0; $units[] = 1; } $totals['grandtotal'] = $totals['itemtotal'] + $totals['shipping'] + $totals['service'] + $totals['surcharge'] + $totals['tax'] - $totals['discount'] - $totals['coupon'] - $totals['companyless']; $invoiceTotal = number_format($totals['grandtotal'], 2); $customer_id = $this->session->userdata('customer_id') ? $this->session->userdata('customer_id') : '0'; $affiliate_id = $this->session->userdata('referer') ? $this->session->userdata('referer') : ''; $this->form_validation->set_rules("cardnumber", 'Credit Card Number', 'required|numeric|min_length[15]|max_length[16]'); $this->form_validation->set_rules("expiry_month", 'Expiry Month', 'required|min_length[2]|max_length[5]'); $this->form_validation->set_rules("expiry_year", 'Expiry Year', 'required|min_length[2]|max_length[5]'); $this->form_validation->set_rules("cvv", 'CVV2', 'required|min_length[3]|max_length[5]'); $this->form_validation->set_error_delimiters('<span class="error error_span">', '</span>'); if ($this->form_validation->run() == TRUE) { $eformat = file_get_contents('assets/email_format.html'); $eheader = file_get_contents('assets/email_header.html'); $this->load->library('plugnpay'); $order = unserialize(base64_decode($_POST['data'])); $country = $this->Country_model->get_country($order->country_id); $order->country = $country->country_name; $order->ipaddress = $_SERVER['REMOTE_ADDR']; $order->nameoncard = $this->input->post('nameoncard'); $order->cardnumber = $this->input->post('cardnumber'); $order->cvv = $this->input->post('cvv'); $order->expiry = $this->input->post('expiry_month') . '/' . $this->input->post('expiry_year'); $order->total = $totals['grandtotal']; $order->affiliate_id = $this->session->userdata('referer') ? $this->session->userdata('referer') : '0'; $eheader = str_replace('{firstname}', $order->firstname, $eheader); $eformat = str_replace('{firstname}', $order->firstname, $eformat); $eformat = str_replace('{lastname}', $order->lastname, $eformat); $eformat = str_replace('{address1}', $order->address1, $eformat); $eformat = str_replace('{address2}', $order->address2, $eformat); $eformat = str_replace('{city}', $order->city, $eformat); $eformat = str_replace('{postalcode}', $order->postalcode, $eformat); $eformat = str_replace('{country}', $order->country, $eformat); $eformat = str_replace('{email}', $order->email, $eformat); $eformat = str_replace('{dayphone}', $order->dayphone, $eformat); $eformat = str_replace('{evephone}', $order->dayphone, $eformat); $eformat = str_replace('{product_price}', '$' . number_format($totals['itemtotal'], 2), $eformat); $eformat = str_replace('{delivery_charge}', '$' . number_format($totals['shipping'], 2), $eformat); $eformat = str_replace('{service_charge}', '$' . number_format($totals['service'], 2), $eformat); $eformat = str_replace('{surcharge}', '$' . number_format($totals['surcharge'], 2), $eformat); $eformat = str_replace('{discount}', '$' . number_format($totals['discount'] - $totals['coupon'] - $totals['companyless'], 2), $eformat); $eformat = str_replace('{tax}', '$' . number_format($totals['tax'], 2), $eformat); $eformat = str_replace('{grand_total}', '$' . number_format($totals['grandtotal'], 2), $eformat); if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' && ENVIRONMENT == 'development') { $result['FinalStatus'] = 'success'; $payment_method = 'credit_card'; } else { $result = $this->plugnpay->pay($order); /* echo 'Website on Test...<br/>'; echo $result['MErrMsg']; echo '<pre>'; die(print_r($result)); echo '</pre>'; */ $payment_method = 'credit_card'; } if ($result['FinalStatus'] == 'success') { if ($oid = $this->Order_model->create_Order($this->session->userdata('cart_id'), $totals, $customer_id, $affiliate_id, $payment_method)) { //$linkimg = '<img src="http://track.linksynergy.com/ // ep?mid=xxxx&ord=xx&skulist=xxxx // &qlist=xxx&amtlist=xxxx&cur=xxx&namelist=xxxxx">'; $cart_id = $this->session->userdata('cart_id'); $this->db->where('cart_id', $cart_id); $this->db->update('carts', array('completed' => '1')); $this->session->set_userdata('cart_id', '0'); $temptot = $totals['itemtotal'] - $totals['discount'] - $totals['coupon']; $linkimg = '<img src="http://track.linksynergy.com/ep?mid=37609&ord=' . $oid; $linkimg .= '&skulist=' . implode('|', $skulist); $linkimg .= '&qlist=' . implode('|', $qlist); $linkimg .= '&amtlist=' . implode('|', $amtlist); $linkimg .= '&cur=CAD'; $linkimg .= '&namelist=' . implode('|', $namelist) . '">'; $tsa = '<script src="https://thesearchagency.net/tsawaypoint.php?siteid=855&wayid=7685&'; $tsa .= 'value=' . round($totals['grandtotal'] * 100); $tsa .= '&units=1|' . implode('|', $units) . '|1'; $tsa .= '&productID=order|' . implode('|', $productids) . '|Shipping'; $tsa .= '&itemValues=' . round($totals['grandtotal'] * 100) . '|' . implode('|', $itemvalues) . '|' . ($totals['shipping'] + $totals['service'] + $totals['surcharge']) * 100; $tsa .= '&backref=' . $oid . '" language="JavaScript" type="text/javascript"></script>'; $emlimg = '<img src="http://email.1800florists.ca/public/?q=direct_add&fn=Public_DirectAddForm&id=bvvqnvtvffundtrubmhhrsjocigpbmg&email='; $emlimg .= $order->email . '&field1=lastorderdate,set,'; $emlimg .= date('Y-m-d', time()) . '&field2=lastordertotal,set,'; $emlimg .= number_format($temptot, 2) . '&list1=0bba03ec00000000000000000000000492e6" width="0" height="0" border="0" alt=""/>'; $ggtrans = 'pageTracker._addTrans('; $ggtrans .= '"' . $oid . '",'; $ggtrans .= '"1-800-Flowers Canada",'; $ggtrans .= '"' . $temptot . '",'; $ggtrans .= '"' . number_format($totals['tax'], 2) . '",'; $ggtrans .= '"' . number_format($totals['shipping'] + $totals['service'] + $totals['surcharge'], 2) . '",'; $ggtrans .= '"Toronto",'; $ggtrans .= '"Ontario",'; $ggtrans .= '"Canada");'; $ggitems = ''; foreach ($cartitems as $citem) { $skulist[] = $citem['sku']; $qlist[] = $citem['qty']; $amtlist[] = $citem['amt']; $namelist[] = $citem['name']; $ggitems .= 'pageTracker._addItem('; $ggitems .= '"' . $oid . '",'; $ggitems .= '"' . $citem['sku'] . '",'; $ggitems .= '"' . $citem['name'] . '",'; $ggitems .= '"' . $citem['category'] . '",'; $ggitems .= '"' . number_format($citem['amt'] / 100, 2) . '",1'; $ggitems .= ');' . "\n"; } $data['googlecode'] = $ggtrans . "\n\n" . $ggitems; $data['linkimg'] = $linkimg; $data['tsa'] = $tsa; $data['emlimg'] = $emlimg; $data['conversion'] = $conversion; $data['invoiceTotal'] = $invoiceTotal; $eformat = str_replace('{invoice_num}', $oid, $eformat); $admin_format = $eformat; $admin_format = str_replace('{items}', $aitemformat, $admin_format); $admin_format = str_replace('{email_header}', 'User Type:' . strtoupper($this->session->userdata('user_role')), $admin_format); $eformat = str_replace('{items}', $itemformat, $eformat); $eformat = str_replace('{email_header}', $eheader, $eformat); $this->load->library('email'); $email_config['mailtype'] = 'html'; $this->email->initialize($email_config); $this->email->from('*****@*****.**', '1-800-Flowers'); //$this->email->to($order->email); $this->email->to($order->email); $this->email->subject('1-800-Flowers Order Confirmation'); $this->email->message($eformat); if ($this->email->send()) { $success = true; } $this->email->from('*****@*****.**', '1-800-Flowers'); $this->email->to('*****@*****.**'); $this->email->subject('1-800-Flowers Order Confirmation'); $this->email->message($admin_format); if ($this->email->send()) { $success = true; } $this->unset_cart(); $data['items'] = $this->Order_model->getDelivery($cart_id); $data['message'] = 'Your order completed successfully'; $data['invoice_number'] = $oid; $data['totals'] = $totals; $data['billing'] = $this->Order_model->getBilling($cart_id); $data['page'] = $this->Pages_model->return_page('order-thanks'); $data['paths'] = array('Home' => path(), 'Checkout' => '#', 'Thank you' => ''); $this->load->view('thankyou', $data); exit; } } else { $elist = '<ul class="elist">'; if ($cerrors = explode('|', $result['MErrMsg'])) { foreach ($cerrors as $ce) { if (!empty($ce)) { $elist .= '<li>' . $ce . '</li>'; } } } else { $elist = '<li>' . $result['MErrMsg'] . '<li>'; } $elist .= '</ul>'; $elist = '<div class="show_errors"><h3>' . 'Error in Payment' . '</h3>' . $elist . '</div>'; } } $this->load->Model('Occasion_model'); $data['elist'] = isset($elist) ? $elist : ''; $data['countries'] = $this->Country_model->get_countries(); $data['items'] = $this->Order_model->getDelivery($cart_id); $data['occasions'] = $this->Occasion_model->get_occasions_array(); $data['billing'] = $this->Order_model->getBilling($cart_id); if ($this->session->userdata('user_role') == 'company') { $this->load->model('Company_model'); $pmethod = $this->Company_model->get_pmethod($this->session->userdata('customer_id')); if ($pmethod == 1) { $data['on_account'] = 1; } else { $data['on_account'] = 0; } } else { $data['on_account'] = 0; } $data['encoded'] = base64_encode(serialize($data['billing'])); $data['totals'] = $totals; $data['current_page'] = 'revieworder'; $data['page'] = $this->Pages_model->return_page('checkout'); $data['paths'] = array('Home' => path(), 'Checkout' => '#', 'Review & Pay' => ''); $this->load->View('checkout', $data); } }
foreach ($order->items as $item) { $counter++; ?> <div class="tab-pane <?php if ($counter === 1) { echo ' active'; } ?> " id="tab<?php echo $counter; ?> "> <div class="row-fluid"> <div class="span6"> <img src="<?php echo img_format('productres/' . $item->product_picture, 'thumbpng'); ?> " /> <h3><?php echo $item->product_name; ?> </h3> <p class="lead"> 1 & <?php echo getRate($item->product_price); ?> = <?php echo getRate($item->product_price); ?> </p> </div> <div class="span12">
function checkout() { $this->load->Model('Product_model'); //UPDATE CARD MESSAGE $datos = $this->Order_model->get_fullcart($this->session->userdata('cart_id')); foreach ($datos as $item) { $this->Order_model->update_item_card_message($this->input->post('card_message' . $item->orderitem_id), $item->orderitem_id); } //UPDATE CARD MESSAGE $cart = $this->Order_model->get_fullcart($this->session->userdata('cart_id')); if (count($cart) < 1) { redirect('/shop/cart'); exit; } $data['cart'] = $cart; $totals = $this->get_totals($this->session->userdata('cart_id')); //OSCAR CODE $totals['itemtotal'] = $this->input->post('final_pricing'); $totals['service'] = $this->input->post('final_service'); $totals['shipping'] = 0; $totals['tax'] = $this->input->post('final_tax'); //OSCAR CODE $data['totals'] = $totals; $this->load->library('Form_validation'); $this->load->model('Province_model'); $this->form_validation->set_rules('nameoncard', 'Name on Card', 'required'); $this->form_validation->set_rules("card_number", 'Credit Card Number', 'required|numeric|min_length[15]|max_length[16]'); $this->form_validation->set_rules("exp_month", 'Expiry Month', 'required|min_length[2]|max_length[5]'); $this->form_validation->set_rules("exp_year", 'Expiry Year', 'required|min_length[2]|max_length[5]'); $this->form_validation->set_rules("cvv", 'CVV2', 'required|min_length[3]|max_length[5]'); $this->form_validation->set_rules('address1', 'Address', 'required'); $this->form_validation->set_rules('city', 'City', 'required'); $this->form_validation->set_rules('postalcode', 'Postalcode', 'required'); $this->form_validation->set_rules('province_id', 'Province_id', 'required'); $this->form_validation->set_rules('email', 'Email Address', 'required|valid_email'); /* if($_POST['shipping_to']=='funeral home') { */ $this->form_validation->set_rules('fh_name', 'Name', 'required'); $this->form_validation->set_rules('fh_address1', 'Address Line 1', 'required'); $this->form_validation->set_rules('fh_postalcode', 'Postal code', 'required'); $this->form_validation->set_rules('fh_city', 'City', 'required'); $this->form_validation->set_rules('fh_province_id', 'Provnce', 'required'); /* } else { $this->form_validation->set_rules('ho_name','Name','required'); $this->form_validation->set_rules('ho_address1','Address Line 1','required'); $this->form_validation->set_rules('ho_postalcode','Postal code','required'); $this->form_validation->set_rules('ho_city','City','required'); $this->form_validation->set_rules('ho_province_id','Provnce','required'); } */ if ($this->form_validation->run() == TRUE) { $totals = array(); if ($this->_update_delivery($this->session->userdata('cart_id'), $this->input->post())) { if ($this->_update_billing($this->session->userdata('cart_id'), $this->input->post())) { $cart = $this->Order_model->get_fullcart($this->session->userdata('cart_id')); $order_items = ''; $oformat = file_get_contents('assets/email_items.html'); $aoformat = $itemformat = ''; $aitemformat = ''; $icnt = 0; $itemprc = 0; $this->load->model('Company_model'); $this->load->model('Customer_model'); $cartdiscount = 0; $cartcoupon = 0; $cartdiscounttype = 'percentage'; $cartcoupontype = 'percentage'; $conversion = ''; $cartitems = array(); $itemscount = count($cart); foreach ($cart as $item) { //echo $this->input->post('card_message'.$item->orderitem_id); //OSCAR CODE //$this->Order_model->update_item_card_message($this->input->post('card_message'.$item->orderitem_id),$item->orderitem_id); //OSCAR CODE $itemprc = 0; $ptotal = $item->product_price; $icnt++; $itemf = $oformat; $itemf = str_replace('{counter}', $icnt, $itemf); $itemf = str_replace('{firstname}', $item->firstname, $itemf); $itemf = str_replace('{lastname}', $item->lastname, $itemf); $itemf = str_replace('{location_type}', $item->location_type, $itemf); $itemf = str_replace('{location_type_name}', $item->location_type_name, $itemf); $itemf = str_replace('{address1}', $item->address1, $itemf); $itemf = str_replace('{address2}', $item->address2, $itemf); $itemf = str_replace('{city}', $item->city, $itemf); $itemf = str_replace('{postalcode}', $item->postalcode, $itemf); $itemf = str_replace('{province}', $item->province, $itemf); $itemf = str_replace('{country}', $item->country_id, $itemf); $itemf = str_replace('{phone}', $item->dayphone . ' ' . $item->evephone, $itemf); $itemf = str_replace('{message}', $item->card_message, $itemf); $itemf = str_replace('{special_note}', $item->ribbon_text, $itemf); $itemf = str_replace('{delivery_date}', date('d M Y', strtotime($item->delivery_date)) . ' - ' . $item->delivery_time, $itemf); $itemf = str_replace('{shipping_method}', $item->infotext, $itemf); $itemf = str_replace('{delivery_info}', $item->delivery_description, $itemf); if ($item->option_picture == '') { $itemf = str_replace('{product_image}', '<img src="' . $this->config->item('base_url') . img_format('productres/' . $item->product_picture, 'thumb') . '" />', $itemf); } else { $itemf = str_replace('{product_image}', '<img src="' . $this->config->item('base_url') . img_format('productres/' . $item->option_picture, 'thumb') . '" />', $itemf); } $itemf = str_replace('{product_code}', $item->product_code, $itemf); $itemf = str_replace('{orderitem_id}', $item->orderitem_id, $itemf); if ($item->ribbon_text != '') { $itemf = str_replace('{product_name}', $item->product_name . ' + Ribbon ($12.99)<br/><small>(' . $item->price_name . ')</small>', $itemf); } else { $itemf = str_replace('{product_name}', $item->product_name . '<br/><small>(' . $item->price_name . ')</small>', $itemf); } if ($item->ribbon_text != '') { $itemf = str_replace('{price}', '$' . number_format($item->product_price + 12.99, 2), $itemf); $itemf = str_replace('{total}', '$' . number_format($item->product_price + 12.99, 2), $itemf); } else { $itemf = str_replace('{price}', '$' . number_format($item->product_price, 2), $itemf); $itemf = str_replace('{total}', '$' . number_format($item->product_price, 2), $itemf); } //$itemf = str_replace('{product_name}',$item->product_name .'<br/><small>('.$item->price_name.')</small>',$itemf); //$itemf = str_replace('{price}','$'.number_format($item->product_price,2),$itemf); //$itemf = str_replace('{total}','$'.number_format($item->product_price,2),$itemf); $itemf = str_replace('{quantity}', '1', $itemf); $itemprc += $item->product_price; if ($item->delivery_method_id == 1) { $itemf = str_replace('{delivery_by}', 'Delivery by Local', $itemf); } else { $itemf = str_replace('{delivery_by}', 'This bouquet comes to via UPS.', $itemf); } if (array_key_exists($item->product_id, $cartitems)) { $cartitems[$item->product_id]['sku'] = $item->product_code; $cartitems[$item->product_id]['qty'] = $cartitems[$item->product_id]['qty'] + 1; $cartitems[$item->product_id]['amt'] = $cartitems[$item->product_id]['amt'] + $item->product_price * 100; $cartitems[$item->product_id]['name'] = urlencode($item->product_name); $cartitems[$item->product_id]['category'] = urlencode($item->category); } else { $cartitems[$item->product_id]['sku'] = $item->product_code; $cartitems[$item->product_id]['qty'] = 1; $cartitems[$item->product_id]['amt'] = $item->product_price * 100; $cartitems[$item->product_id]['name'] = urlencode($item->product_name); $cartitems[$item->product_id]['category'] = urlencode($item->category); } $addontot = 0; if (count($item->addons)) { $order_items = ''; foreach ($item->addons as $addon) { $order_items .= '+(' . $addon->addon_name . " " . $addon->addon_quantity . 'x$' . number_format($addon->addon_price, 2) . ") \$" . number_format($addon->addon_price * $addon->addon_quantity, 2) . "<br/>\n"; $itemprc += $addon->addon_price * $addon->addon_quantity; $addontot += $addon->addon_price * $addon->addon_quantity; $ptotal += $addon->addon_price * $addon->addon_quantity; if (array_key_exists($addon->addon_id, $cartitems)) { $cartitems[$addon->addon_id]['sku'] = $addon->addon_id; $cartitems[$addon->addon_id]['qty'] = $cartitems[$addon->addon_id]['qty'] + $addon->addon_quantity; $cartitems[$addon->addon_id]['amt'] = $cartitems[$addon->addon_id]['amt'] + $addon->addon_price * 100; $cartitems[$addon->addon_id]['name'] = urlencode($addon->addon_name); $cartitems[$addon->addon_id]['category'] = urlencode($item->category); } else { $cartitems[$addon->addon_id]['sku'] = $addon->addon_id; $cartitems[$addon->addon_id]['qty'] = $addon->addon_quantity; $cartitems[$addon->addon_id]['amt'] = $addon->addon_price * 100; $cartitems[$addon->addon_id]['name'] = urlencode($addon->addon_name); $cartitems[$addon->addon_id]['category'] = urlencode($item->category); } //echo $order_items; } } else { $order_items .= 'None'; } $conversion .= 'bta.addConversionLegacy("$", "' . $item->product_name . '", "' . number_format($itemprc, 2) . '");' . "\n"; $itemf = str_replace('{addons}', $order_items, $itemf); $itemf = str_replace('{addon_price}', '$' . number_format($addontot, 2), $itemf); $addition = $this->Order_model->get_add_charges($item->orderitem_id); $totals['shipping'] += $addition['shipping']; $totals['service'] += $addition['service']; $totals['surcharge'] += $addition['surcharge']; if ($cartcoupon > 0) { if ($cartcoupontype == 'percentage') { $totals['coupon'] += $cartcoupon * $ptotal / 100; $ptotal -= $cartcoupon * $ptotal / 100; } else { $part = $cartcoupon / $itemscount; $totals['coupon'] += $part; $ptotal -= $part; } } else { if ($cartdiscounttype == 'percentage') { $totals['discount'] += $cartdiscount * $ptotal / 100; $ptotal -= $cartdiscount * $ptotal / 100; } else { $part = $cartdiscount / $itemscount; $totals['discount'] += $part; $ptotal -= $part; } } $ptotal += $addition['shipping']; $ptotal += $addition['service']; $ptotal += $addition['surcharge']; $totals['tax'] += $addition['tax'] * $ptotal / 100; $aitemformat .= str_replace('{product_description}', '', $itemf); $itemf = str_replace('{product_description}', substr($item->product_description, 0, 50), $itemf); $itemformat .= $itemf; } $ggitems = ''; foreach ($cartitems as $citem) { $productids[] = $citem['sku'] . ':' . str_replace('+', '', $citem['name']); $itemvalues[] = $citem['amt']; $units[] = $citem['qty']; $skulist[] = $citem['sku']; $qlist[] = $citem['qty']; $amtlist[] = $citem['amt']; $namelist[] = $citem['name']; } if ($totals['discount'] > 0) { $skulist[] = 'Discount'; $qlist[] = 0; $amtlist[] = round($totals['discount'] * -100); $namelist[] = 'Discount'; $productids[] = 'Discount'; $itemvalues[] = round($totals['discount'] * 100); $units[] = 1; } elseif ($totals['coupon'] > 0) { $skulist[] = 'Discount'; $qlist[] = 0; $amtlist[] = round($totals['coupon'] * -100); $namelist[] = 'Discount'; $productids[] = 'Discount'; $itemvalues[] = round($totals['coupon'] * 100); $units[] = 1; } else { $productids[] = 'Discount'; $itemvalues[] = 0; $units[] = 1; } $affid = $this->session->userdata('referer'); if ($affid != '') { $totals['grandtotal'] = round($totals['itemtotal'], 2) + round($totals['shipping'], 2) + round($totals['service'], 2) + round($totals['surcharge'], 2) + round($totals['tax'], 2) - round($totals['discount'], 2) - round($totals['coupon'], 2); } else { $totals['grandtotal'] = round($totals['itemtotal'], 2) + round($totals['shipping'], 2) + round($totals['service'], 2) + round($totals['surcharge'], 2) + round($totals['tax'], 2) - round($totals['discount'], 2) - round($totals['coupon'], 2); } // $totals['grandtotal'] = number_format($totals['itemtotal'],2) + number_format($totals['shipping'],2) + number_format($totals['service'],2) + number_format($totals['surcharge'],2) + number_format($totals['tax'],2) - number_format($totals['discount'],2) - number_format($totals['coupon'],2); $invoiceTotal = number_format($totals['grandtotal'], 2); $customer_id = $this->session->userdata('customer_id') ? $this->session->userdata('customer_id') : '0'; $affiliate_id = $this->session->userdata('referer') ? $this->session->userdata('referer') : ''; $eformat = file_get_contents('assets/email_format.html'); $eheader = file_get_contents('assets/email_header.html'); $result = $this->_pay($this->input->post(), $totals); $eheader = str_replace('{firstname}', $_POST['firstname'], $eheader); $eformat = str_replace('{firstname}', $_POST['firstname'], $eformat); $eformat = str_replace('{lastname}', $_POST['lastname'], $eformat); $eformat = str_replace('{address1}', $_POST['address1'], $eformat); $eformat = str_replace('{address2}', $_POST['address2'], $eformat); $eformat = str_replace('{city}', $_POST['city'], $eformat); $eformat = str_replace('{postalcode}', $_POST['postalcode'], $eformat); $eformat = str_replace('{country}', $_POST['country'], $eformat); $eformat = str_replace('{email}', $_POST['email'], $eformat); $eformat = str_replace('{dayphone}', $_POST['dayphone'], $eformat); $eformat = str_replace('{evephone}', $_POST['dayphone'], $eformat); $eformat = str_replace('{product_price}', '$' . number_format($this->input->post('final_pricing'), 2), $eformat); $eformat = str_replace('{delivery_charge}', '$' . number_format($totals['shipping'], 2), $eformat); $eformat = str_replace('{service_charge}', '$' . number_format($this->input->post('final_service'), 2), $eformat); $eformat = str_replace('{surcharge}', '$' . number_format($totals['surcharge'], 2), $eformat); $eformat = str_replace('{discount}', '$' . number_format($totals['discount'] - $totals['coupon'] - $totals['companyless'], 2), $eformat); $eformat = str_replace('{tax}', '$' . number_format($this->input->post('final_tax'), 2), $eformat); $eformat = str_replace('{grand_total}', '$' . number_format($this->input->post('final_pricing') + $this->input->post('final_service') + $this->input->post('final_tax'), 2), $eformat); $eformat = str_replace('{affi_logo}', $this->session->userdata('logo'), $eformat); if ($result['FinalStatus'] == 'success') { //OSCAR CODE $totals['itemtotal'] = $this->input->post('final_pricing'); $totals['service'] = $this->input->post('final_service'); $totals['shipping'] = 0; $totals['tax'] = $this->input->post('final_tax'); //OSCAR CODE /* $totals = $totals[]; $data['totals'] = $totals; */ if ($oid = $this->Order_model->new_order($this->input->post(), $this->session->userdata('cart_id'), $totals, 0)) { $cart_id = $this->session->userdata('cart_id'); $data['cart'] = $this->Order_model->get_cart($cart_id); $data['invoice_id'] = $oid; $this->db->where('cart_id', $cart_id); $this->db->update('carts', array('completed' => '1')); $this->session->set_userdata('cart_id', '0'); $data['funeral_home_id'] = $this->input->post('fh_id'); $data['funeral_home_description'] = $this->input->post('fh_location'); $temptot = $totals['itemtotal'] - $totals['discount'] - $totals['coupon']; $gtemptot = $totals['itemtotal']; $linkimg = '<img src="http://track.linksynergy.com/ep?mid=37609&ord=' . $oid; $linkimg .= '&skulist=' . implode('|', $skulist); $linkimg .= '&qlist=' . implode('|', $qlist); $linkimg .= '&amtlist=' . implode('|', $amtlist); $linkimg .= '&cur=CAD'; $linkimg .= '&namelist=' . implode('|', $namelist) . '">'; $tsa = '<script src="https://thesearchagency.net/tsawaypoint.php?siteid=855&wayid=7685&'; $tsa .= 'value=' . round($totals['grandtotal'] * 100); $tsa .= '&units=1|' . implode('|', $units) . '|1'; $tsa .= '&productID=order|' . implode('|', $productids) . '|Shipping'; $tsa .= '&itemValues=' . round($totals['grandtotal'] * 100) . '|' . implode('|', $itemvalues) . '|' . ($totals['shipping'] + $totals['service'] + $totals['surcharge']) * 100; $tsa .= '&backref=' . $oid . '" language="JavaScript" type="text/javascript"></script>'; $emlimg = '<img src="http://email.memorialflowers.ca/public/?q=direct_add&fn=Public_DirectAddForm&id=bvvqnvtvffundtrubmhhrsjocigpbmg&email='; $emlimg .= $order->email . '&field1=lastorderdate,set,'; $emlimg .= date('Y-m-d', time()) . '&field2=lastordertotal,set,'; $emlimg .= number_format($temptot, 2) . '&list1=0bba03ec00000000000000000000000492e6" width="0" height="0" border="0" alt=""/>'; $ggtrans = 'pageTracker._addTrans('; $ggtrans .= '"' . $oid . '",'; $ggtrans .= '"1-800-Flowers Canada",'; $ggtrans .= '"' . $gtemptot . '",'; $ggtrans .= '"' . number_format($totals['tax'], 2) . '",'; $ggtrans .= '"' . number_format($totals['shipping'] + $totals['service'] + $totals['surcharge'], 2) . '",'; $ggtrans .= '"Toronto",'; $ggtrans .= '"Ontario",'; $ggtrans .= '"Canada");'; $ggitems = ''; foreach ($cartitems as $citem) { $skulist[] = $citem['sku']; $qlist[] = $citem['qty']; $amtlist[] = $citem['amt']; $namelist[] = $citem['name']; $ggitems .= 'pageTracker._addItem('; $ggitems .= '"' . $oid . '",'; $ggitems .= '"' . $citem['sku'] . '",'; $ggitems .= '"' . $citem['name'] . '",'; $ggitems .= '"' . $citem['category'] . '",'; $ggitems .= '"' . number_format($citem['amt'] / 100, 2) . '",' . $citem['qty']; $ggitems .= ');' . "\n"; } $sconvtot = number_format($totals['grandtotal'], 2); //$totals['itemtotal'] - $totals['discount'] - $totals['coupon'] + $totals['shipping'] + $totals['service'] + $totals['surcharge'] + $totals['tax']; $data['googlecode'] = $ggtrans . "\n\n" . $ggitems; $data['sconversion'] = '<img src="http://app.bronto.com/public/?q=stream_conversion&fn=Mail_Conversion&id=bvvqnvtvffundtrubmhhrsjocigpbmg&type=$&description=siteorder&money=' . number_format($sconvtot, 2) . '" width="0" height="0" border="0" alt=""/>'; $data['linkimg'] = $linkimg; $data['tsa'] = $tsa; $data['emlimg'] = $emlimg; $data['conversion'] = $conversion; $data['invoiceTotal'] = $invoiceTotal; $eformat = str_replace('{invoice_num}', $oid, $eformat); $admin_format = $eformat; $admin_format = str_replace('{items}', $aitemformat, $admin_format); $admin_format = str_replace('{email_header}', 'User Type:' . strtoupper($this->session->userdata('user_role')), $admin_format); $eformat = str_replace('{items}', $itemformat, $eformat); $eformat = str_replace('{email_header}', $eheader, $eformat); /* $this->load->library('email'); $email_config['mailtype'] = 'html'; $this->email->initialize($email_config); $this->email->from('*****@*****.**', 'Dignity Flowers'); $this->email->to($_POST['email']); $this->email->bcc('*****@*****.**'); $this->email->subject('Dignity Flowers Order Confirmation'); $this->email->message($eformat); if($this->email->send()) { $success = true; } $this->email->from('*****@*****.**', 'Dignity Flowers'); $this->email->to('*****@*****.**'); $this->email->subject('Dignity Flowers Order Confirmation'); $this->email->message($admin_format); if($this->email->send()) { $success = true; } */ $ema_order = $this->Order_model->get_email_order_info($oid); $ema_deli = $this->Order_model->get_delivery_order_info($ema_order->cart_id); $e_delivery = $this->Order_model->get_delivery_order_info_details($ema_order->cart_id); $to = $ema_order->email; //$to = '*****@*****.**'; $header = "From: orders@memorialflowers.ca \r\n"; $header .= "Cc: jakki@memorialflowers.ca \r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $subject = "Order Confirmation " . $ema_order->invoice_id . " - Memorial Flowers"; $message = '<html><body>'; $message .= ' <table width="100%" border="0" style="background-color:#F4F4F4;"> <tr> <td width="30%"> </td> <td width="40%" align="center" valign="top"> <table width="100%" style="font-family:Tahoma, Geneva, sans-serif;background-color:#fff;"> <tr style="background-color:#fff;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="4" width="100%" align="center"> <img src="' . base_url() . 'templates/memorial/img/memlogo.png" width="157" height="62"> </td> </tr> <tr style="background-color:#fff;color:#757167;font-family:Tahoma, Geneva, sans-serif;"> <td rowspan="7" width="2%"> </td> <td colspan="2" width="96%" style="padding-top:10px;"> <span style="font-size:20px;">Thank You for your order.</span><br /><br /> <span style="font-size:15px;">Your order has been received and is now being processed. Your order details are shown below for your reference.</span><br /><br /> <span style="font-size:16px;"><b>Order Number: ' . $ema_order->invoice_id . '</b></span><br /> <span style="font-size:13px;">Order Placed on ' . date("M j, Y h:i:s A", strtotime($ema_order->order_date)) . '</span><br /><br /> </td> <td rowspan="7" width="2%"> </td> </tr> <tr style="background-color:#F4F4F4;color:#757167;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="2" width="96%" style="padding-top:10px;padding-bottom:10px;"> <span style="font-size:15px;"><b>Shipping Details</b></span><br /> </td> </tr> <tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="2" width="96%" style="padding-top:5px;" valign="top"> <table width="100%" style="font-family:Tahoma, Geneva, sans-serif;"> <tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="2" width="100%" style="padding-top:5px;" valign="top"> ' . $ema_deli->firstname . ' ' . $ema_deli->lastname . '<br />'; if ($ema_deli->location_type_name != '') { $message .= $ema_deli->location_type_name . '<br />'; } $message .= $ema_deli->address1 . ' ' . $ema_deli->address2 . '<br /> ' . $ema_deli->city . ', ' . $ema_deli->province . ' ' . $ema_deli->postalcode . '<br /> ' . $ema_deli->dayphone . '<br /><br /> </td> </tr>'; foreach ($e_delivery as $ed) { $message .= '<tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td width="25%" style="padding-top:5px;" valign="top"> <img src="' . base_url() . 'productres/' . $ed->option_picture . '" width="85%"> </td> <td width="75%" style="padding-top:5px;padding-left:10px;color:#757167;" valign="top"> <span style="font-weight:bold;font-size:14px;">' . $ed->product_name . '</span><br /> <b>Item ID: </b>' . $ed->orderitem_id . ' | <b>Delivery Date: </b>' . date("M j, Y", strtotime($ed->delivery_date)); if ($ed->card_message != '') { $message .= '<br /><br /> <b>Card Message</b><br /> ' . $ed->card_message . ''; } if ($ed->ribbon_text != '') { $message .= '<br /><br /> <b>Ribbon Message</b><br /> ' . $ed->ribbon_text . ''; } $message .= '</td> </tr>'; } $message .= '</table> </td> </tr> <tr style="background-color:#F4F4F4;color:#757167;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="2" width="96%" style="padding-top:10px;padding-bottom:10px;"> <span style="font-size:15px;"><b>Billing Details</b></span><br /> </td> </tr> <tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="2" width="96%" style="padding-top:5px;" valign="top"> <table width="100%" style="font-family:Tahoma, Geneva, sans-serif;"> <tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td width="50%" style="padding-top:5px;" valign="top"> ' . $ema_order->firstname . ' ' . $ema_order->lastname . '<br /> ' . $ema_order->address1 . ' ' . $ema_order->address2 . '<br /> ' . $ema_order->city . ', ' . $ema_order->province . ' ' . $ema_order->postalcode . '<br /> ' . $ema_order->dayphone . '<br /> ' . $ema_order->email . ' <br /> </td> <td width="50%" style="padding-top:5px;" valign="top"> <b>Payment Type</b><br /> ' . $ema_order->cardtype . ': xxxx xxxx xxxx ' . substr($ema_order->cardnumber, -4) . ' </td> </tr> </table> </td> </tr> <tr style="background-color:#F4F4F4;color:#757167;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="2" width="96%" style="padding-top:10px;padding-bottom:10px;"> <table width="100%" border="0" style="font-family:Tahoma, Geneva, sans-serif;"> <tr style="color:#757167;font-size:13px;"> <td width="45%" style="padding-top:5px;" valign="top"> <span style="font-size:11px;"><b>Product Name</b></span><br /> </td> <td width="23%" style="padding-top:5px;" align="center" valign="top"> <span style="font-size:11px;"><b>Price</b></span><br /> </td> <td width="10%" style="padding-top:5px;" align="center" valign="top"> <span style="font-size:11px;"><b>Qty</b></span><br /> </td> <td width="22%" style="padding-top:5px;" align="right" valign="top"> <span style="font-size:11px;"><b>Subtotal</b></span><br /> </td> </tr> </table> </td> </tr> <tr style="background-color:#fff;color:#757167;font-size:12px;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="2" width="96%" style="padding-top:5px;" valign="top"> <table width="100%" style="font-family:Tahoma, Geneva, sans-serif;">'; foreach ($e_delivery as $ed) { $message .= '<tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td width="45%" style="padding-top:5px;" valign="middle"> <span style="font-weight:bold;font-size:13px;">' . $ed->product_name . ''; $rt = 0; if ($ed->ribbon_text != '') { $rt = $ed->product_price + 12.99; $message .= '<span style="color:#757167;"> + Ribbon (C$ 12.99)</span>'; } else { $rt = $ed->product_price; } $message .= '</span><br /> </td> <td width="23%" style="padding-top:5px;" valign="middle" align="center"> C$ ' . $rt . '<br /> </td> <td width="10%" style="padding-top:5px;" valign="middle" align="center"> 1<br /> </td> <td width="22%" style="padding-top:5px;" valign="middle" align="right"> C$ ' . $rt . '<br /> </td> </tr>'; } $message .= '<tr style="background-color:#fff;color:#757167;font-size:13px;height:20px;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="4" style="padding-top:5px;" valign="middle" align="right"> </td> </tr> <tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="3" style="padding-top:5px;" valign="middle" align="right"> Sub-Total </td> <td style="padding-top:5px;" valign="middle" align="right"> C$ ' . $ema_order->amount . '<br /> </td> </tr> <tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="3" style="padding-top:5px;" valign="middle" align="right"> Shipping </td> <td style="padding-top:5px;" valign="middle" align="right"> C$ ' . $ema_order->service . '<br /> </td> </tr> <tr style="background-color:#fff;color:#757167;font-size:13px;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="3" style="padding-top:5px;" valign="middle" align="right"> Taxes </td> <td style="padding-top:5px;" valign="middle" align="right"> C$ ' . $ema_order->tax . '<br /> </td> </tr> <tr style="background-color:#F4F4F4;color:#757167;font-size:13px;height:35px;vertical-align:middle;font-family:Tahoma, Geneva, sans-serif;"> <td colspan="3" style="padding-top:5px;" valign="middle" align="right"> <b>Total</b> </td> <td style="padding-top:5px;" valign="middle" align="right"> <b>C$ ' . number_format($ema_order->amount + $ema_order->service + $ema_order->tax, 2) . '</b><br /> </td> </tr> </table> </td> </tr> </table> </td> <td width="30%"> </td> </tr> <tr> <td> </td> <td align="center" style="font-family:Tahoma, Geneva, sans-serif;color:#757167;font-size:10px;"> <br /><br /> <small> <b> This website and floral service is provided by Memorial Flowers, a division of 1882540 Ontario, which holds trademark rights in the Memorial Flowers brand and logo and in the copyright holder (© 2015) in the Memorial Flowers content. </b> </small> </td> <td> </td> </tr> </table> '; $message .= '</body></html>'; $retval = mail($to, $subject, $message, $header); if ($retval == true) { } else { } $purchase = TRUE; $this->load->view('thankyou', $data); } } else { $elist = '<ul class="elist">'; if ($cerrors = explode('|', $result['MErrMsg'])) { foreach ($cerrors as $ce) { if (!empty($ce)) { $elist .= '<li>' . $ce . '</li>'; } } } else { $elist .= '<li>' . $result['MErrMsg'] . '<li>'; } $elist .= '</ul>'; $elist = '<div class="show_errors"><h3>' . 'Error in Payment' . '</h3>' . $elist . '</div>'; $data['errors'] = $elist; } } else { $data['errors'] = '<div class="show_errors">Unable to create billing information. Please contact website administrator!</div>'; } } else { $data['errors'] = '<div class="show_errors">Unable to create shipping information. Please contact website administrator!</div>'; } } if (!$purchase) { if ($_POST) { $data['vars'] = (object) $_POST; } $data['provinces'] = $this->Province_model->get_provinces_new(1); $this->load->view('checkout', $data); } }