public function indexAction() { // Get products $products = \Product::Find(['limit' => 9, 'featured' => 1, 'status' => 1]); // Get collections $collections = \Collection::Find(['status' => 1]); // Get currencies $currencies = \Currency::Find(['status' => 1]); //echo "<pre>"; //print_r($products); //exit; $this->render('Views/Home', ['title' => 'Home', 'products' => $products['result'], 'collections' => $collections['result'], 'currencies' => $currencies['result']]); }
public function indexAction($slug) { try { $product = \Product::Find(['slug' => $slug, 'status' => 1]); if (!empty($product['result'][0])) { } else { $this->app->redirect('404'); } } catch (\Exception $e) { exit($e->getMessage()); } // Build page $this->render('Views/Product', $product['result'][0]); }
public function indexAction($slug, $offset = 0) { try { // Get category $category = \Category::Find(['slug' => $slug, 'status' => 1]); if ($category['result'][0]) { // Get products $products = \Product::Find(['limit' => $this->app->config['app_per_page'], 'offset' => $offset, 'category' => $category['result'][0]['id']]); // Assign products $category['products'] = $products['result']; } else { $this->app->redirect('404'); } } catch (\Exception $e) { exit($e->getMessage()); } // Build page $this->render('Views/Category', $category); }