コード例 #1
0
 private function getHeader()
 {
     $products = Services::get('products');
     $favs = '0';
     $carts = '0';
     if (UID::isLoggedIn()) {
         $orbit = new Orbit();
         $favRequest = $orbit->get('client/countfav', 1, 1, array('id' => UID::get('id')));
         $favs = $favRequest['fav'];
     }
     $cart = Services::get('cart');
     $carts = $cart->updateCounter(true);
     $this->newView('header');
     $this->view('header')->loadTemplate('header');
     $this->view('header')->setVariable('favs', $favs);
     $this->view('header')->setVariable('carts', $carts);
     $categories = $products->getCategories();
     $this->view('header')->setVariable('categories', $categories['items']);
     return $this->view('header')->render();
 }
コード例 #2
0
 public function orders()
 {
     if (!UID::isLoggedIn()) {
         $this->loginPage();
         return;
     }
     $orbit = new Orbit();
     $result = $orbit->get('client/orders/' . UID::get('id'));
     $orders = $result['orders'];
     $this->view()->loadTemplate('orders');
     $this->view()->setVariable('orders', $orders);
     $this->commitReplace($this->view()->render(), '#content');
 }
コード例 #3
0
 public function addFavourite()
 {
     if (!UID::isLoggedIn()) {
         $client = Services::get('client');
         $client->register();
         return;
     }
     $orbit = new Orbit();
     $favs = $orbit->post('client/favourites/' . UID::get('id'), array('product_id' => $this->getQueryString('id')));
     #debug($favs);
     $favRequest = $orbit->get('client/countfav', 1, 1, array('id' => UID::get('id')));
     $countfavs = $favRequest['fav'];
     $this->commitReplace(intval($countfavs), '#favitems');
     $this->view()->loadTemplate('favlink');
     $this->commitReplace($this->view()->render(), '#addfav');
 }
コード例 #4
0
 public function addAddress()
 {
     $post = $this->getPost();
     $post['address_type'] = 'Residencial';
     $address = $post;
     if (UID::isLoggedIn()) {
         $orbit = new Orbit();
         $result = $orbit->post('client/addclientaddr/' . UID::get('id'), $post);
     } else {
         Session::append('address', $post);
         $result['address_id'] = count(Session::get('address'));
     }
     $address['id'] = $result['address_id'];
     $this->commitReplace('', '#resultzip');
     $asOption = $this->getQueryString('asoption');
     if ($asOption) {
         $tpl = 'addressoption';
     } else {
         $tpl = 'addressitem';
     }
     $this->view()->loadTemplate($tpl);
     $this->view()->setVariable('address', $address);
     $this->commitAdd($this->view()->render(), '#addresslist');
 }