Esempio n. 1
0
 public function actionBasket()
 {
     if ($this->request->action === "add") {
         $product = ProductDB::getProductForBasket($this->request->id);
         if ($product) {
             BasketData::add($product);
             $data = array();
             $data["summ"] = BasketData::getSumm();
             $data["product"] = $product;
             $this->jsonResponse($data);
         }
     } else {
         if ($this->request->action === "del") {
             echo BasketData::del($this->request->id);
         }
     }
 }
Esempio n. 2
0
 protected final function render($head, $content)
 {
     $params = array();
     $params["head"] = $head;
     $params["uri"] = $this->url_active;
     $params["link_search"] = URL::get("search");
     $params["link_delivery"] = URL::get("delivery", "");
     $params["link_contacts"] = URL::get("contacts", "");
     $params["link_basket"] = URL::get("basket", "");
     $params["link_opt"] = URL::get("opt", "");
     $params["summ"] = BasketData::getSumm();
     $params["menu_items"] = SectionDB::getAll();
     foreach ($params["menu_items"] as $item) {
         $item->link = URL::get("section", "", array("id" => $item->id));
     }
     $params["content"] = $content;
     $this->view->render(Config::LAYOUT, $params);
 }
Esempio n. 3
0
 public function actionOrder()
 {
     $name = $this->request->name;
     $email = $this->request->email;
     $phone = $this->request->phone;
     $address = $this->request->region . ", " . $this->request->index . ", " . $this->request->street . ", " . $this->request->home . ", квартира " . $this->request->float;
     $pay = new PayDB();
     $pay->load($this->request->pay);
     $pay_id = $pay->id;
     $delivery = new DeliveryDB();
     $delivery->load($this->request->delivery);
     $delivery_id = $delivery->id;
     $notice = $this->request->notice;
     $products = BasketData::getItems();
     $summ = BasketData::getSumm();
     $order_db = new OrderDB();
     $order_db->name = $name;
     $order_db->phone = $phone;
     $order_db->email = $email;
     $order_db->address = $address;
     $order_db->pay_id = $pay->id;
     $order_db->delivery_id = $delivery->id;
     $order_db->summ = $summ;
     $order_db->notice = $notice;
     if (!($order_id = $order_db->save())) {
         exit("error");
     }
     foreach ($products as $product) {
         $purchase_db = new PurchaseDB();
         $purchase_db->order_id = $order_id;
         $purchase_db->product_id = $product->id;
         $purchase_db->count = $product->count;
         $purchase_db->save();
     }
     $this->mail->send(Config::ADM_EMAIL, array("site" => Config::SITENAME, "name" => $name, "email" => $email, "phone" => $phone, "address" => $address, "pay" => $pay->title, "delivery" => $delivery->title, "products" => $products, "summ" => $summ, "notice" => $notice), "admin_order");
     $this->mail->send(Config::ADM_EMAIL2, array("site" => Config::SITENAME, "name" => $name, "email" => $email, "phone" => $phone, "address" => $address, "pay" => $pay->title, "delivery" => $delivery->title, "products" => $products, "summ" => $summ, "notice" => $notice), "admin_order");
     $this->mail->send(Config::ADM_EMAIL3, array("site" => Config::SITENAME, "name" => $name, "email" => $email, "phone" => $phone, "address" => $address, "pay" => $pay->title, "delivery" => $delivery->title, "products" => $products, "summ" => $summ, "notice" => $notice), "admin_order");
     $this->mail->send($this->request->email, array("site" => Config::SITENAME, "name" => $name, "products" => $products, "summ" => $summ), "client_order");
     echo "success";
 }
Esempio n. 4
0
 public function actionOrder()
 {
     $this->title = "Оформить заказ";
     $this->meta_desc = "В данном разделе Вы можете завершить оформление заказа";
     $this->meta_key = "оформление заказа, оформить заказ";
     $content = new Order();
     $content->header = "Оформить заказ";
     $hornav = $this->getHornav();
     $hornav->addData("Оформить заказ");
     $content->hornav = $hornav;
     $content->summ = BasketData::getSumm();
     $content->delivery = DeliveryDB::getAllShow();
     $content->pay = PayDB::getAllShow();
     $head = $this->getHead(array("/css/main.css"));
     $head->js = array("/js/main.js", "/js/order.js");
     $this->render($head, $content);
 }