public function sendConfirmation($orderId) { $order = ORM::factory('order', $orderId); $db = new Database(); $res = $db->query('SELECT oa.* FROM orders_addresses oa JOIN orders o ON (oa.id = o.orders_address_id) WHERE o.id="' . $orderId . '"'); // call autoresponder handlers $shippingInfo = $res[0]->shipping_first_name . ' ' . $res[0]->shipping_last_name . '<br/>' . $res[0]->shipping_address1 . '<br/>' . $res[0]->shipping_address2 . '<br/>' . $res[0]->shipping_city . ' ' . $res[0]->shipping_state . '<br/>' . $res[0]->shipping_zip . '<br/>' . $res[0]->shipping_country; $billingInfo = $res[0]->billing_first_name . ' ' . $res[0]->billing_last_name . '<br/>' . $res[0]->billing_address1 . '<br/>' . $res[0]->billing_address2 . '<br/>' . $res[0]->billing_city . ' ' . $res[0]->billing_state . '<br/>' . $res[0]->billing_zip . '<br/>' . $res[0]->billing_country; $dateTime = date('Y-m-d H:i:s'); $res = $db->query('SELECT p.name, ob.qty, ob.subtotal FROM products p JOIN orders_baskets ob ON (ob.product_id=p.id) WHERE ob.order_id="' . $orderId . '"'); $order_basket = new Orders_basket_Model(); $description = ''; $subtotal = 0; foreach ($res as $item) { $description .= $item->name . ' ' . $item->qty . ' x ' . format::dollar($item->subtotal) . '<br/>'; $subtotal += $item->subtotal; } if (!empty($order->comment)) { $description .= 'Comment:' . $order->comment . '<br/>'; } $total = 'Subtotal: ' . format::dollar($subtotal) . '<br/>Shipping:' . format::dollar($order->shipping_total); $total .= '<br/>Total:' . format::dollar($order->payment_total); Autoresponder::sendEmail('order.confirmation', $order->email, $order, array('shipping_info' => $shippingInfo, 'billing_info' => $billingInfo, 'date_time' => $dateTime, 'description' => $description, 'total' => $total)); }
<tr> <td colspan="2"><strong>Taxes:</strong></td> <td align="right">TBD</td> </tr> <tr> <td colspan="2"><strong>Shipping Cost:</strong></td> <td align="right">TBD</td> </tr> <tr> <td colspan="2"><strong>Order Total:</strong></td> <td align="right"><?php echo format::dollar($cart->subtotal() - $amount['total']); ?> </td> </tr> <tr> <td colspan="3" class="button"><a href="/cart"><img src="/env/images/back_to_order.jpg" alt="" /></a></td> </tr> </table> <?php } ?> </div>
</td> </tr> <?php /*if (($discount = $order_subtotal + $order->shipping_total - $order->order_total) > 0){ ?> <tr> <td colspan="4" align="right">Discount: </td> <td align="right"><?php echo format::dollar($discount) ?></td> </tr> <?php }*/ ?> <tr> <td colspan="4" align="right">Total: </td> <td align="right"><?php echo format::dollar($_order->order_total); ?> </td> </tr> </table> </div> <!-- div id="tab_products" --> <div id="tab_shipping_address"> <table class="form"> <tr> <td>First Name:</td> <td id='shipping_firstname'><?php echo $shipping->firstname;
public function test() { $id = $this->uri->segment(3); $order = ORM::factory('order')->find($id); // call autoresponder handler $order_address = ORM::factory('orders_address')->find($order->orders_address_id); $shippingInfo = $order_address->shipping_first_name . ' ' . $order_address->shipping_last_name . '<br/>' . $order_address->shipping_address1 . '<br/>' . $order_address->shipping_city . ' ' . $order_address->shipping_state . '<br/>' . $order_address->shipping_zip . '<br/>' . $order_address->shipping_country; $billingInfo = $order_address->billing_first_name . ' ' . $order_address->billing_last_name . '<br/>' . $order_address->billing_address1 . '<br/>' . $order_address->billing_city . ' ' . $order_address->billing_state . '<br/>' . $order_address->billing_zip . '<br/>' . $order_address->billing_country; $dateTime = date('Y-m-d H:i:s'); $db = new Database(); $res = $db->query('SELECT p.name, ob.qty FROM products p JOIN orders_baskets ob ON (ob.product_id=p.id) WHERE ob.order_id="' . $order->id . '"'); $order_basket = new Orders_basket_Model(); $description = ''; foreach ($res as $item) { $description .= $item->name . ' x ' . $item->qty . '<br/>'; } Autoresponder::sendEmail('order.status.changed', '*****@*****.**', $order, array('shipping_info' => $shippingInfo, 'billing_info' => $billingInfo, 'date_time' => $dateTime, 'description' => $description, 'total' => format::dollar($order->payment_total))); }