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(); }
/** * (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'); }
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); } }