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(); }
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'); }
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'); }
public function remove() { $item_id = $this->getQueryString('item_id'); $orbit = new Orbit(); $orbit->delete('request/item/' . $item_id); $this->cartPage(); }