public function all() { // Do things // Use models to do all the heavy lifting // Return the results for the view to present require 'models/products.php'; $products_model = new Products_Model(); return $products_model->all(); }
public function SearchAction($search) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $data = Products_Model::GetSearchProducts($_POST['search']); $res['Content'] = Products_View::GetProductsPage($data, ceil($r / 4), $c); return $res; } }
public static function GetPageCart() { $tpl = new Template(); if (isset($_SESSION['cart'])) { $items = Products_Model::GetCartProducts(array_keys($_SESSION['cart']['products_id'])); } $tpl->SetParam('products', $items); return $tpl->Fetch('templates/cart/cart.tpl'); }
public function feedback($id = null) { if ($_SERVER['REQUEST_METHOD'] == "DELETE") { return Feedback_Model::DeleteFeedback($id); } if (isset($id)) { return Products_Model::GetProductById($id); } return Feedback_Model::GetAllFeedback(); }
public function DeleteAction($route) { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $t = Products_Model::GetProductById($route[0]); $s = $_SESSION['cart']['products_id'][$route[0]]; $_SESSION['cart']['count'] -= $s; $_SESSION['cart']['price'] -= $t['price'] * $s; unset($_SESSION['cart']['products_id'][$route[0]]); header("Location: " . $_SERVER['HTTP_REFERER']); die; } }