public function httpGetMethod(Http $http, array $queryFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP GET
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $queryFields contient l'équivalent de $_GET en PHP natif.
      */
     $userSession = new UserSession();
     if ($userSession->isAuthenticated() == false) {
         $http->redirectTo('/User/Login');
     }
     if (array_key_exists('order_Id', $queryFields)) {
         if (ctype_digit($queryFields['order_Id'])) {
             //var_dump($queryFields['order_Id']);
             $orderModel = new OrderModel();
             $orderInformation = $orderModel->findOrder($queryFields['order_Id']);
             $customerModel = new CustomerModel();
             $customerInformation = $customerModel->findCustomer($orderInformation['Customer_Id']);
             $order = $orderModel->getOrderLineByOrderId($queryFields['order_Id']);
             return ['customerInformation' => $customerInformation, 'order' => $order, 'orderInformation' => $orderInformation];
         }
     }
     $http->redirectTo('/');
 }
Example #2
0
 /**
  * 取消订单
  * @param $orderId
  */
 public function cancelOrder($orderId)
 {
     $openId = (new WeixinUtil())->getOpenId();
     if (!$openId) {
         ResponseUtil::failure('未授权访问!');
     }
     if (!$orderId) {
         ResponseUtil::failure('没有订单');
     }
     $orderId += 0;
     $orderModel = new OrderModel();
     // 获得订单
     $order = $orderModel->readOne($orderId);
     if (!$order) {
         ResponseUtil::failure('取消订单失败!');
     }
     // 获得积分ID
     $couponId = $order['use_coupon_id'];
     if ($couponId) {
         (new CustomerCouponModel())->refundCoupon($couponId, $openId);
     }
     //取消订单
     if ((new CurdUtil(new OrderModel()))->update(array('order_id' => $orderId, 'open_id' => $openId), array('order_status' => OrderModel::ORDER_CANCEL))) {
         ResponseUtil::executeSuccess('订单取消成功!');
     } else {
         ResponseUtil::failure('取消订单失败!');
     }
 }
Example #3
0
 public function index()
 {
     $orderModel = new OrderModel();
     $view = new ViewModel('admin/index');
     $view->assign('orders', $orderModel->selectPendingOrders($_POST));
     $view->assign('complains', $orderModel->selectComplains($_POST));
     $view->display();
 }
Example #4
0
 static function count($where)
 {
     if (!$where) {
         return false;
     }
     $model = new OrderModel();
     $result = $model->count($where);
     return $result;
 }
Example #5
0
 public function find()
 {
     $view = new ViewModel('main/find');
     $orderModel = new OrderModel();
     if (isset($_POST['id_przesylki'])) {
         $result = $orderModel->findDelivery($_POST['id_przesylki']);
         if (!empty($result)) {
             $view->assign('delivery', $result);
             $view->assign('from', $orderModel->getAddress($result['od']));
             $view->assign('to', $orderModel->getAddress($result['do']));
         }
         $view->setTemplate('main/findResult');
     }
     $view->display();
 }
Example #6
0
 function actionOrder($id)
 {
     $this->template->o = OrderModel::get($id, $this->user->getIdentity()->data['user_id']);
     if (!$this->template->o) {
         throw new NBadRequestException('Objednávka č. ' . (int) $id . ' neexistuje');
     }
 }
 public function test()
 {
     Sys::D('Order');
     $goodsData = array(array(1, 3), array(2, 1));
     $receiveData = array('username' => 'bee', 'tel' => '18224087281', 'email' => '*****@*****.**', 'address' => '四川省成都市青羊区');
     OrderModel::add(1, 1, $goodsData, $receiveData, 'this is a remark');
 }
 public static function cancelOrder(Order $order)
 {
     if ($order->getStatus() != OrderStatus::ACTIVE) {
         self::$errorMessage = "The order cannot be canceled";
         return false;
     }
     $deal = new Deal();
     $deal->findActiveDealByOrderId($order->getId());
     $rate = new Rate();
     $rate->findById($order->getRateId());
     if ($order->getType() == OrderType::BUY) {
         $purse = self::getPurse($order->getUserId(), $rate->getSecondCurrencyId());
         $refund = $deal->getVolume() * $deal->getPrice() * (1.0 + $rate->getFee());
     } else {
         $purse = self::getPurse($order->getUserId(), $rate->getFirstCurrencyId());
         $refund = $deal->getVolume();
     }
     $purse->addValue($refund);
     $purse->save();
     $deal->delete();
     if ($order->getPart() == 0) {
         $order->setStatus(OrderStatus::CANCELLED);
     } else {
         $order->setStatus(OrderStatus::PARTIALLY_DONE);
     }
     $order->setDate(date("Y-m-d H:i:s"));
     $order->save();
     self::refreshRatePrices($rate);
     return true;
 }
 public function submitOrder($force = false)
 {
     if (!$this->_order) {
         return false;
     }
     $this->module->getLogger()->info('Will submit order to Payin7, ID: ' . $this->_order->getOrderId());
     $already_sent = $this->getPayin7IsOrderSent();
     // check if already submitted
     if ($already_sent && !$force) {
         $this->module->getLogger()->debug('Order already submitted - not doing anything');
         return $this->getPayin7OrderIdentifier();
     }
     // begin submitting
     $data = array('order_id' => $this->_order->getOrderId(), 'unique_order_id' => $this->_order->getPayin7OrderIdentifier(), 'payment_method' => $this->_order->getPaymentMethodCode(), 'device_type' => $this->_device_type, 'ordered_by_ip_address' => $this->_ordered_by_ip_address, 'source' => $this->_source, 'order' => json_encode($this->_prepareOrderData()), 'items' => json_encode($this->_prepareOrderItems()), 'addresses' => json_encode($this->_prepareOrderAddresses()), 'customer' => json_encode($this->_prepareCustomerData()), 'sysinfo' => json_encode($this->_sysinfo));
     $this->module->getLogger()->info(($already_sent ? 'RE-' : null) . 'Submitting order to Payin7: ' . print_r(array('order_id' => $this->_order->getOrderId(), 'payment_method' => $this->_order->getPaymentMethodCode()), true));
     $client = $this->module->getApiClientInstance();
     $response = $client->postOrder($data);
     if (!$response['payin7_order_id']) {
         return false;
     }
     // update the order
     $this->_order->setPayin7OrderIdentifier($response['payin7_order_id']);
     $this->_order->setPayin7OrderSent(true);
     $this->_order->setPayin7OrderAccepted((bool) $response['is_accepted']);
     $this->_order->setPayin7AccessToken($response['access_token']);
     $this->module->getLogger()->info('Order ' . ($already_sent ? 're' : null) . 'submitted to Payin7, ID: ' . $this->_order->getOrderId() . ', data: ' . print_r($response, true));
     return $this;
 }
Example #10
0
 public static function getInstance()
 {
     if (self::$instance === null) {
         return self::$instance = new self();
     } else {
         return self::$instance;
     }
 }
Example #11
0
 public function render($controls = true)
 {
     //		$this->beforeRender();
     //print_r($this->template);
     $this->template->setFile(dirname(__FILE__) . '/small.phtml');
     //		$this->template->total_sum-=$this->template->weight_price;
     $this->template->cart_info = OrderModel::getCartInfo($this->session->products, false, false, $this->getPresenter()->context, $isCache = true);
     $this->template->render();
 }
 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     $userSession = new UserSession();
     if ($userSession->isAuthenticated() == false) {
         $http->redirectTo('/User/Login');
     }
     $orderModel = new OrderModel();
     $order_Id = $orderModel->validation($formFields['order'], $userSession->getId());
     //$order = $orderModel->getOrderById($order_Id);
     //return ['order', $order];
     $http->redirectTo('/Order/Payment?order_Id=' . $order_Id);
     // TODO : PAGE DE VALIDATION DU PANIER ET BOUTON PAYMENT
 }
Example #13
0
 /**
  * (non-phpDoc)
  *
  * @see Nette\Application\Control#render()
  */
 public function render($params = array())
 {
     $order_info = NEnvironment::getSession('user_order_info');
     $this->template->delivery = (isset($params['delivery']) and $params['delivery'] == true) ? $order_info['values']['id_delivery'] : false;
     $this->template->payment = (isset($params['delivery']) and $params['delivery'] == true) ? $order_info['values']['id_payment'] : false;
     $this->template->cart_info = OrderModel::getCartInfo($this->session->products, $this->template->delivery, $this->template->payment, $this->getPresenter()->context, $isCache = true);
     //		dump($this->template->cart_info);
     $this->template->controls = (isset($params['controls']) and $params['controls'] == false) ? false : true;
     $this->template->setFile(dirname(__FILE__) . '/default.phtml');
     $this->template->render();
     //	$session = NEnvironment::getSession('cart');
 }
Example #14
0
 /**
  * 取消订单
  * @param string $order_id
  */
 public function CancelOrder($order_id = '')
 {
     if (!$order_id) {
         $this->message('订单ID不能为空!');
     }
     $orderModel = new OrderModel();
     // 获得订单
     $order = $orderModel->readOne($order_id);
     if (!$order) {
         ResponseUtil::failure('取消订单失败!');
     }
     // 获得积分ID
     $couponId = $order['use_coupon_id'];
     if ($couponId) {
         (new CustomerCouponModel())->refundCoupon($couponId, $order['open_id']);
     }
     if ((new CurdUtil($this->orderModel))->update(array('order_id' => $order_id), array('order_status' => OrderModel::ORDER_CANCEL, 'complete_time' => DateUtil::now()))) {
         $this->message('订单已取消!');
     } else {
         $this->message('处理失败!');
     }
 }
Example #15
0
 public function immediateBuy()
 {
     $goodsId = (int) $this->postParam('goodsId', 0);
     $skuAttr = $this->postParam('skuAttr', '');
     $skuvalue = $this->postParam('skuValue', '');
     $amount = (int) $this->postParam('amount', 0);
     if ($goodsId <= 0 || empty($skuAttr) || empty($skuValue)) {
         $this->ajaxReturn(ERR_PARAMS_ERROR, '参数错误');
         return;
     }
     $result = OrderModel::createOrder(UserOrderModel::ORDER_PRE_COMMON, $this->userId());
     if ($result['code'] != 0) {
         $this->ajaxReturn($result['code'], $result['desc']);
         return;
     }
     $this->ajaxReturn(0, '', '', array('token' => $result['result']['token']));
 }
Example #16
0
 public function t()
 {
     $model = new OrderModel();
     $rs = $model->where("orderNo ='" . $head["orderNo"] . "'")->find();
     print_r($rs);
     /*
     vendor("WebOrderService",LIB_PATH."\Service");
     
     $service = new WebOrderService();
     
     $result = $service->login((object)array("userID"=>"00100001","userPass"=>"0000"));
     
     print_r((object)$result);
     */
 }
Example #17
0
 private function saveOrder($jsonArray = null)
 {
     if (is_array($jsonArray) && isset($jsonArray['usr']) && isset($jsonArray['cart'])) {
         $order = new OrderModel();
         $usr = $jsonArray['usr'];
         $cart = $jsonArray['cart'];
         // echo '<pre>';print_R($cart);die;
         // add checks here before saving order
         $order->setBfname($usr['fname']);
         $order->setBlname($usr['lname']);
         $order->setBemail($usr['email']);
         $order->setBaddressl1($usr['addr1']);
         $order->setBaddressl2($usr['addr2']);
         $order->setBaddressl3($usr['addr3']);
         $order->setBcity($usr['city']);
         $order->setBcountry($usr['country']);
         $order->setBstate($usr['state']);
         $order->setBzipcode($usr['zipcode']);
         $order->setInserttime(date("Y-m-d H:i:s"));
         $order->setSfname($usr['sfname']);
         $order->setSlname($usr['slname']);
         $order->setSemail($usr['semail']);
         $order->setSaddressl1($usr['saddr1']);
         $order->setSaddressl2($usr['saddr2']);
         $order->setSaddressl3($usr['saddr3']);
         $order->setScity($usr['scity']);
         $order->setScountry($usr['scountry']);
         $order->setSstate($usr['sstate']);
         $order->setStatus("pending");
         $order->setSubtotal($cart['subTotal']);
         $order->setSzipcode($usr['szipcode']);
         $order->setDiscount($cart['discount']);
         $order->setTotal($cart['total']);
         $order->setQty($cart['qty']);
         $order->setOrder_type(strtoupper($usr['ordertype']));
         $order->setUserid(Session::getInstance()->getSess("userid"));
         $order->insert();
         if ($order->isSuccess() == 1) {
             $oid = $order->getOrderid();
             foreach ($cart['items'] as $k => $itm) {
                 $item = new OrderProdsModel();
                 $item->setOid($oid);
                 $item->setTid($itm['template']);
                 $item->setPid($itm['product']);
                 $item->setPrice($itm['price']);
                 $item->setQty($itm['qty']);
                 $item->setTotal($itm['total']);
                 $item->insert();
                 $this->moveTemplate($itm['template']);
                 // converts file urls from temp dir to final destination dir
             }
             if ($cart['disId'] != 0) {
                 $du = new DiscountUserModel();
                 $du->setDiscountId($cart['disId']);
                 $du->setUserId(Session::getInstance()->getSess("userid"));
                 $du->insert();
                 if ($cart['discountFor'] == 1) {
                     $dis = new DiscountModel();
                     $dis->setDiscountid($cart['disId']);
                     $dis->setStatus(1);
                     $dis->update_status();
                 }
             }
             if ($usr['ordertype'] == 'cod') {
                 $this->cod_order($oid, $usr, $cart['total']);
             }
             $oc = new OrderController();
             ob_start();
             $oc->printinvoice($oid);
             $html = ob_get_clean();
             if ($usr['ordertype'] != 'payment') {
                 Session::getInstance()->setMessage("Order accepted.", "green");
                 Session::getInstance()->removeSess('cart');
             }
             mail($usr['email'], "Order Confirmation", $html, "Content-type: text/html; charset=iso-8859-1 \r\nFrom: noreply@snooky.com\r\n");
             echo $oid;
         } else {
             Session::getInstance()->setMessage("Problem in accepting order, please try again.", "red");
             echo "failed";
         }
     }
 }
Example #18
0
 public function setutfbaseAction()
 {
     if ($this->checkLogin()) {
         $model = new OrderModel();
         $model->setUTF();
         die;
     } else {
         die;
     }
 }
Example #19
0
 /**
  * 微信支付后的异步回调
  */
 public function notice()
 {
     $weixin = new WeixinPayUtil();
     //通知微信
     $notice = $weixin->notifyData();
     // 签名成功, 返回数组, 否则返回xml数据
     if (!is_array($notice) || !isset($notice['transaction_id'])) {
         exit($notice);
     }
     //签名成功,处理数据
     /**
      * 返回的数据
      * 'appid' => string 'wxf5b5e87a6a0fde94' (length=18)
      * 'bank_type' => string 'CFT' (length=3)
      * 'fee_type' => string 'CNY' (length=3)
      * 'is_subscribe' => string 'N' (length=1)
      * 'mch_id' => string '10000097' (length=8)
      * 'nonce_str' => string 'dz8nirk7gmxhhxn38zgib28yx14ul2gf' (length=32)
      * 'openid' => string 'ozoKAt-MmA74zs7MBafCix6Dg8o0' (length=28)
      * 'out_trade_no' => string 'wxf5b5e87a6a0fde941409708791' (length=28)
      * 'result_code' => string 'SUCCESS' (length=7)
      * 'return_code' => string 'SUCCESS' (length=7)
      * 'sign' => string 'EDACA525F6C675337B2DAC25B7145028' (length=32)
      * 'sub_mch_id' => string '10000097' (length=8)
      * 'time_end' => string '20140903094659' (length=14)
      * 'total_fee' => string '1' (length=1)
      * 'trade_type' => string 'NATIVE' (length=6)
      * 'transaction_id' => string '1004400737201409030005091526' (length=28)  //微信支付单号
      */
     //        $notice  = array(
     //            'out_trade_no' => '201512271710391206225994',
     //            'transaction_id' => '1004400737201409030005091526'
     //        );
     $orderNo = $notice['out_trade_no'];
     $wxOrderNo = $notice['transaction_id'];
     $openId = $notice['openid'];
     $orderModel = new OrderModel();
     // 获得订单
     $orders = $orderModel->orders(array('order_no' => $orderNo));
     if (!$orders || !$orders[0]) {
         exit($weixin->notifyFailure());
     }
     // 判断是否已经支付
     $order = $orders[0];
     if ($order['order_sign'] == OrderModel::ORDER_PAYED) {
         exit($weixin->notifyPayed());
     }
     // 更新订单信息
     $this->db->trans_start();
     $orderModel->payed($orderNo, $wxOrderNo);
     // 更新积分
     $customerModel = new CustomerModel();
     $score = $order['total_fee'];
     $customer = $customerModel->readOne($openId);
     if ($customer) {
         $customerModel->addCredits($openId, $score);
     }
     // 事物完成
     $this->db->trans_complete();
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         exit($weixin->notifyFailure());
     } else {
         $this->db->trans_commit();
         // 获得access token
         $weixinUtil = new WeixinUtil();
         $token = $weixinUtil->getToken();
         if ($token) {
             //foreach ($orders as $order) {
             $orderNo = $order['order_no'];
             $appointmentDay = DateUtil::buildDateTime($order['appointment_day'], $order['appointment_start_time']);
             $shops = (new ShopModel())->getAllShops();
             $shop = $shops[$order['shop_id']];
             $beautician = (new BeauticianModel())->readOne($order['beautician_id']);
             $beauticianName = $beautician['name'];
             $project = (new CurdUtil(new OrderProjectModel()))->readOne(array('order_id' => $order['order_id']));
             $projectName = $project['project_name'];
             // 计算总积分
             $totalCredits = $customer['credits'] + $score;
             // 发送模板消息
             // $orderNo, $appointmentDay, $shop, $beautician, $projectName
             $weixinUtil->sendOrderMessage($orderNo, $appointmentDay, $shop, $beauticianName, $projectName, $openId, $token, $totalCredits);
             //}
         }
         exit($weixin->notifySuccess());
     }
 }
Example #20
0
    public function selectForSearch($data)
    {
        $searchResult = parent::selectForSearch($data);
        foreach ($searchResult as $row) {
            $newResultLine = new stdclass();
            ob_start();
            ?>
                <div class="text-center">
                    <a href="<?php 
            echo Config::read('page.url.order.detail') . '/' . $row->id;
            ?>
" class="btn btn-default btn-sm"><i class="fa fa-edit"></i> Detalhes</a>
            <?php 
            if ($row->status == Config::read('order.status')['new'] && $this->type == 'myPurchases') {
                ?>
                    
                    <a href="<?php 
                echo Config::read('page.url.order.pay') . '/' . $row->id;
                ?>
" class="btn btn-default btn-sm"><i class="fa fa-money"></i> Pagar</a>
            <?php 
            }
            ?>
                </div>
            <?php 
            $newResultLine->action = ob_get_clean();
            $newResultLine->code = $row->id;
            $newResultLine->date = $row->date;
            // Detalhes do produto
            ob_start();
            ?>
                <a href="<?php 
            echo Config::read('page.url.product.detail') . '/' . $row->product;
            ?>
">
                    <div class="row">
                        <div class="col-xs-2">
            <?php 
            if ($row->photos[0]) {
                ?>
                            <img style="width:100px;" src="<?php 
                echo Config::read('url.photos') . '/' . $row->album . '/small-' . $row->photos[0]->url;
                ?>
" draggable="false">
            <?php 
            }
            ?>
                        </div>
                        <div class="col-xs-10">
                            <h4><?php 
            echo $row->productName;
            ?>
</h4>
                            <p><?php 
            echo $row->productText;
            ?>
</p>
                        </div>
                    </div>
                </a>
            <?php 
            $newResultLine->product = ob_get_clean();
            // Comprador ou Vendedor?
            switch ($this->type) {
                case 'mySales':
                    $newResultLine->person = $row->buyerName;
                    break;
                case 'myPurchases':
                    $newResultLine->person = $row->vendorName;
                    break;
                default:
                    $newResultLine->person = "&nbsp;";
                    break;
            }
            // Status do produto
            $newResultLine->status = '<span class="label label-' . Config::read('order.status.state')[array_search($row->status, Config::read('order.status'))] . '">' . $row->statusText . '</span>';
            $result[] = $newResultLine;
        }
        return $result;
    }
Example #21
0
 /**
  * 删除订单
  *
  * @param xml string $request
  * @return xml string
  */
 private function orderDelete($request)
 {
     try {
         $id = $request["body"]["id"];
         if (!$id) {
             return $this->createResult($request["head"]["type"], -3, 'not a valid action');
         }
         $model = new OrderModel();
         $result = $model->where("id = {$id} and status = 0")->delete();
         if (!$result) {
             return $this->createResult($request["head"]["type"], -1, 'delete error');
         }
         return $this->createResult($request["head"]["type"], 1, 'success', 1);
     } catch (Exception $e) {
         return $this->createResult($request["head"]["type"], -1, 'error in order delete');
     }
 }
Example #22
0
 function sendOrderAdmin($order_id)
 {
     $objEmailer = new Emailer();
     $objLayout = new LayoutModel();
     $objTemplate = new TemplatesModel();
     $objOrder = new OrderModel();
     $objUser = new UserModel();
     $objSettings = Settings::getInstance();
     $adminEmail = $objSettings->getEntry('admin', 'admin-email');
     $layoutInfo = $objLayout->loadLayout(28);
     $template = $objTemplate->loadTemplateFromKeyname('email-order');
     // load order
     $orderInfo = $objOrder->getOrder($order_id);
     $objUser->setUserId($orderInfo['user_id']);
     $userInfo = $objUser->getInfo();
     // assign to template
     $this->view->assign('adminView', true);
     $this->view->assign('orderInfo', $orderInfo);
     $this->view->assign('userInfo', $userInfo);
     // render template
     $this->view->assign('content', $this->view->fetch('fromstring:' . $template['content']));
     $this->view->assign('sidebar_left', $this->view->fetch('fromstring:' . $template['left_sidebar']));
     $this->view->assign('sidebar_right', $this->view->fetch('fromstring:' . $template['right_sidebar']));
     // send email
     $objEmailer->setFrom('*****@*****.**');
     $objEmailer->addTo($adminEmail, "Parks Associates");
     $objEmailer->setSubject('NEW PURCHASE');
     $objEmailer->setBody($this->view->fetch('fromstring:' . $layoutInfo['code']), true);
     $objEmailer->sendMail();
     // see if we also need to send webcast registration email
     if (!empty($orderInfo['webcasts'])) {
         foreach ($orderInfo['webcasts'] as $webcast) {
             // see if its in the future
             if (strtotime($webcast['eventDate']) > time()) {
                 // send them email
                 $this->sendWebcastRegistrationAdmin($orderInfo);
                 break;
                 // only need to send once
             }
         }
     }
     return true;
 }
Example #23
0
 public function order()
 {
     $orderid = $this->orderid ? $this->orderid : 0;
     $orderModel = OrderModel::find($orderid);
     return isset($orderModel) ? $orderModel : '';
 }
Example #24
0
 public function __construct()
 {
     parent::__construct();
 }
Example #25
0
    //获取订单号
    $trade_no = $_GET['trade_no'];
    //获取支付宝交易号
    $total_fee = $_GET['price'];
    //获取总价格
    if ($_GET['trade_status'] == 'WAIT_SELLER_SEND_GOODS') {
        //判断该笔订单是否在商户网站中已经做过处理(可参考“集成教程”中“3.4返回数据处理”)
        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
        //如果有做过处理,不执行商户的业务程序
    } else {
        echo "trade_status=" . $_GET['trade_status'];
    }
    echo "验证成功<br />";
    echo "trade_no=" . $trade_no;
    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
    require_once '../configs/run.inc.php';
    $_order = new OrderModel();
    $_order->updateOrderNum();
    echo "<script>location.href='../?a=member&m=order';</script>";
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} else {
    //验证失败
    //如要调试,请看alipay_notify.php页面的verifyReturn函数,比对sign和mysign的值是否相等,或者检查$responseTxt有没有返回true
    echo "验证失败";
}
?>
        <title>支付宝担保交易</title>
	</head>
    <body>
    </body>
</html>
Example #26
0
 function handleCreateOrder()
 {
     $order_info = NEnvironment::getSession('user_order_info');
     $values = $order_info['values'];
     //		dump($values);exit;
     //presmerovanie ak nieco nieje v poriadku
     $session = NEnvironment::getSession('cart');
     if (empty($session->products)) {
         $this->redirect('default');
     }
     if (empty($order_info['values'])) {
         $this->redirect('step2');
     }
     //znama polick login na email
     $values['email'] = $values['login'];
     $values['id_lang'] = $this->id_lang;
     //odstranenie loginu
     unset($values['login']);
     //odstranenie terms_and_conditions
     unset($values['terms_and_conditions']);
     //odstranenie discount_hash
     //		$discount_hash = $values['discount_hash'];
     if ($values['type'] == NULL) {
         $values['type'] = 0;
     }
     $values['user_discount'] = 0;
     // ak je prihlaseny setni id_user
     if ($this->user->isLoggedIn()) {
         $values['id_user'] = $this->user->getIdentity()->data['user_id'];
         $values['user_discount'] = $this->user->getIdentity()->data['discount'];
     }
     $cart_info = OrderModel::getCartInfo($session->products, $order_info['values']['id_delivery'], $order_info['values']['id_payment'], $this->context, false);
     $values['total_price'] = $cart_info['total_sum'];
     $values['total_price_with_tax'] = $cart_info['total_sum_with_tax'];
     $values['delivery_title'] = $cart_info['delivery_title'];
     $values['delivery_price'] = $cart_info['delivery_price']['price'];
     $values['delivery_tax'] = $cart_info['delivery_price']['tax'];
     $values['payment_title'] = $cart_info['payment_title'];
     $values['payment_price'] = $cart_info['payment_price']['price'];
     $values['payment_tax'] = $cart_info['payment_price']['tax'];
     //odstranenie id_delivery
     unset($values['id_delivery']);
     //odstranenie id_payment
     unset($values['id_payment']);
     $values['rate'] = Lang::get($this->id_lang)->rate;
     try {
         $id_order = OrderModel::createOrder($values, $session->products, $this->id_lang, $this->user);
         $conf = $this->context->parameters;
         $template = $this->template;
         $template->setFile(APP_DIR . '/FrontModule/templates/Order/OrderEmail.phtml');
         $template->discount = false;
         $template->o = OrderModel::get($id_order);
         $mail = new MyMail();
         $mail->addTo($values['email']);
         $mail->addBcc($conf['client_email']);
         $mail->setSubject(_('Objednávka č. ') . $id_order);
         $mail->setTemplate($template);
         $mail->send();
         if ($conf['HEUREKA']['ENABLE'] == 1) {
             try {
                 $overeno = new HeurekaOvereno($conf['HEURELA']['API_KEY'], HeurekaOvereno::LANGUAGE_SK);
                 $overeno->setEmail($values['email']);
                 foreach ($session->products as $id_product_param => $p) {
                     $product = ProductModel::getProductIdentifyByParam($id_product_param, $this->id_lang, $this->user);
                     $overeno->addProduct($product->name);
                 }
                 $overeno->send();
             } catch (Exception $e) {
             }
         }
         //vymazanie z kosika
         $session = NEnvironment::getSession('cart');
         unset($session->products);
         //vymazanie info o uzivatelovi
         unset($order_info['values']);
         $this->redirect('Cart:success');
     } catch (OrderException $e) {
         $form->addError($e);
     }
 }
Example #27
0
 /**
  *
  * Create reservation records
  * @param $orderId
  * @param $item
  *
  */
 static function createReservations($orderId, $item)
 {
     $order = new OrderModel();
     $sql = "INSERT INTO `reservations` VALUES (NULL, :Running_films, :Cinema_Name, :Cinema_Address\n                                          ,:Run_Time,:Room_Name,:Room_id,:Seats_Numbers,:Order_Id,:Price)";
     $param = ["Running_films" => $item->Film_Name, "Cinema_Name" => $item->Cinema, "Cinema_Address" => $item->Cinema_Address, "Run_Time" => $item->Run_Time, "Room_Name" => $item->Room, "Room_id" => $item->Room_ID, "Seats_Numbers" => $item->Seats, "Order_Id" => $orderId, "Price" => $item->TotalPrice];
     $order->modifyOrder($param, $sql);
 }
Example #28
0
 public function acceptComplain()
 {
     $view = new ViewModel('admin/index');
     $orderModel = new OrderModel();
     try {
         $orderModel->acceptComplain($_POST['id_reklamacji']);
     } catch (PDOException $e) {
         $view->assign('message-type', 'error');
         $view->assign('message', 'Nie można zaakceptować!');
         $view->display();
         return;
     }
     $view->assign('message-type', 'info');
     $view->assign('message', 'Zaakceptowano!');
     $view->display();
 }
 function transferPaySave()
 {
     $id = $_GET['id'];
     //$id=4;
     $val = $_GET['val'];
     //$val="shun";
     $orderOb = new OrderModel();
     //var_dump($orderOb);
     $arr = array("id" => $id, "transferPay" => $val);
     $re = $orderOb->updOrder($arr);
     //var_dump($re);
     if ($re !== false) {
         echo "1";
         exit;
     }
 }
    BookGenreModel::create(array('book_id' => 7, 'genre_id' => 10));
    BookGenreModel::create(array('book_id' => 8, 'genre_id' => 13));
    BookGenreModel::create(array('book_id' => 9, 'genre_id' => 12));
    BookGenreModel::create(array('book_id' => 10, 'genre_id' => 12));
    BookGenreModel::create(array('book_id' => 11, 'genre_id' => 12));
    BookGenreModel::create(array('book_id' => 12, 'genre_id' => 3));
    BookGenreModel::create(array('book_id' => 13, 'genre_id' => 4));
    BookGenreModel::create(array('book_id' => 14, 'genre_id' => 2));
    BookGenreModel::create(array('book_id' => 15, 'genre_id' => 8));
    BookGenreModel::create(array('book_id' => 16, 'genre_id' => 9));
    BookGenreModel::create(array('book_id' => 17, 'genre_id' => 10));
    BookGenreModel::create(array('book_id' => 18, 'genre_id' => 11));
    BookGenreModel::create(array('book_id' => 19, 'genre_id' => 13));
    BookGenreModel::create(array('book_id' => 20, 'genre_id' => 12));
    BookGenreModel::create(array('book_id' => 21, 'genre_id' => 13));
    BookGenreModel::create(array('book_id' => 22, 'genre_id' => 3));
    BookGenreModel::create(array('book_id' => 23, 'genre_id' => 4));
    BookGenreModel::create(array('book_id' => 24, 'genre_id' => 2));
    BookGenreModel::create(array('book_id' => 25, 'genre_id' => 8));
    BookGenreModel::create(array('book_id' => 26, 'genre_id' => 9));
    BookGenreModel::create(array('book_id' => 27, 'genre_id' => 10));
    BookGenreModel::create(array('book_id' => 28, 'genre_id' => 11));
    BookGenreModel::create(array('book_id' => 29, 'genre_id' => 12));
    BookGenreModel::create(array('book_id' => 30, 'genre_id' => 12));
}
if (!$db->tableExists('order')) {
    OrderModel::create(array('user_id' => 1, 'datetime' => "2014-11-11 11:11:11"));
}
if (!$db->tableExists('position')) {
    PositionModel::create(array('order_id' => 1, 'book_id' => 1, 'amount' => 1, 'price' => 12.5));
}