public function testCreateOrderFromCart() { $cart_srl = 774; try { $cart = new Cart($cart_srl); $order = new Order($cart); $order->save(); $order->saveCartProducts($cart); } catch(Exception $e) { $this->fail($e->getMessage()); } $order_repository = new OrderRepository(); $order = $order_repository->getOrderBySrl($order->order_srl); $this->assertEquals(count($cart->getProducts()), count($order->getProducts())); $this->assertEquals($cart->getShippingMethodName(), $order->shipping_method); $this->assertEquals($cart->getShippingCost(), $order->shipping_cost); $this->assertEquals($cart->getPaymentMethodName(), $order->payment_method); $this->assertEquals($cart->getTotal(), $order->total); }
public function procShopToolPrintOrder(){ $orderRepo = new OrderRepository(); $order = $orderRepo->getOrderBySrl(Context::get('order_srl')); $this->printPDFOrder($order); }
/** * display shop view order * @return Object * @throws ShopException */ public function dispShopViewOrder(){ try{ $orderRepo = new OrderRepository(); $order = $orderRepo->getOrderBySrl(Context::get('order_srl')); $logged_info = Context::get('logged_info'); if($order->member_srl != $logged_info->member_srl) throw new ShopException("This order does not belong to you"); } catch (Exception $e) { $this->setRedirectUrl(getNotEncodedUrl('', 'act', 'dispShopHome')); return new Object(-1, $e->getMessage()); } $this->dispShopToolViewOrder(); $this->setTemplateFile('view_order'); }
/** * Send email to user notifying him of the newly created order */ public static function sendNewOrderEmails($order_srl) { $repo = new OrderRepository(); $order = $repo->getOrderBySrl($order_srl); $shop = new ShopInfo($order->module_srl); // Don't send anything if shop email is not configured if (!$shop->getShopEmail()) { ShopLogger::log("Failed to send order email for order #{$order->order_srl}; Shop email is not configured"); return; } self::sendNewOrderMailToCustomer($shop, $order); self::sendNewOrderMailToAdministrator($shop, $order); }