<?php $games = array(); $items = new Products(); $games = $items->listProducts(); if (isset($_GET['id'])) { $document['template'] = 'game'; $game = $items->getProduct($_GET['id']); $product = Gameservices::validateGame($game); $smarty->assign('game', $product); } else { $document['template'] = 'games'; /*********Games For View************/ foreach ($games as $value) { $products[] = Gameservices::validateGameList($value); } /********************************/ $smarty->assign('games', $products); } ?>
<?php if (isset($_SESSION['products_id'])) { $document['template'] = 'cart'; $items = new Products(); foreach ($_SESSION['products_id'] as $value) { $products[] = Gameservices::validateCartGames($items->getProduct($value)); } $total = count($products) . "Games"; $smarty->assign('total', $total); $smarty->assign('products', $products); } else { //$products = 'Server Error'; $document['template'] = 'emptycart'; }