コード例 #1
0
 public function renderDefault()
 {
     $this->template->categories_count = mapper::categories()->countAll();
     $this->template->manufacturers_count = mapper::manufacturers()->countAll();
     $this->template->pages_count = mapper::pages()->countNotRef();
     $this->template->products_count = mapper::products()->countAll();
     $this->template->pictures_count = mapper::pictures()->countAll();
     $this->template->orders_count = mapper::orders()->countAll();
     $this->template->orders_initial_count = mapper::orders()->countWithInitialStatus();
 }
コード例 #2
0
 public function onChangeOrderStatusFormSubmit(Form $form)
 {
     if (!$form->isValid()) {
         return;
     }
     if ($status = mapper::order_statuses()->findById($form['status_id']->getValue())) {
         mapper::orders()->updateOne($form->getValues());
         adminlog::log(__('Changed status of order "%d" to "%s"'), $form['id']->getValue(), $status->getName());
     }
     $this->redirect('this');
     $this->terminate();
 }
コード例 #3
0
 /**
  * Commit
  */
 public function actionCommit()
 {
     $order = Environment::getSession(SESSION_ORDER_NS);
     $data = $order->data;
     unset($data['same_delivery']);
     $data['delivery_type'] = mapper::order_delivery_types()->findById($data['delivery_type']);
     $data['payment_type'] = mapper::order_payment_types()->findById($data['payment_type']);
     $data['status'] = mapper::order_statuses()->findInitial();
     $new = new order($data);
     if (mapper::orders()->save($new, $order->products, $order->visited)) {
         unset($order->products, $order->data, $order->visited);
         $this->template->ok = TRUE;
     } else {
         $this->template->ok = FALSE;
     }
 }