public function indexAction() { $this->_helper->layout()->setLayout('redesign-2014'); $Page = new Model_Page(); if ($this->_getParam('pid') == 'index') { //$this->_redirect('/'); } $pagedata = $Page->Display($this->_getParam('pid')); if (!$pagedata) { //check if product url $products = new Model_Products(); $product = $products->ListProductByURL($this->_getParam('pid')); if ($product) { $this->_helper->layout()->setLayout('redesign-2014-product'); $product_id = $product['ProductID']; $this->view->data = $product; $this->view->images = $products->DisplayProductImages($product_id); $this->view->pagetype = "product"; $this->view->product_page = 1; $this->view->site_title = $product['Name']; $this->view->product_categories = $products->DisplayProductCategories($product_id); $this->view->product_attributes = $products->DisplayProductAttributes($product_id); $this->render('product'); } else { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } } else { $this->view->pagetype = "page"; $this->view->data = $pagedata; } if ($pagedata['PageType'] == 'About') { $site = new Model_Site(); $this->view->blurb_1 = $site->widget_blurb("Who We Are"); $this->view->blurb_2 = $site->widget_blurb("Our Mission"); $this->render('about'); } if ($pagedata['PageType'] == 'Contact') { $this->render('contact'); } }
public function init() { parent::init(); $site = new Model_Site(); $page = new Model_Page(); $categories = new Model_Categories(); $products = new Model_Products(); $all_menus = $site->AllMenus(); foreach ($all_menus as $menu_id => $menu) { $menu_key = 'menu_' . $menu_id; $this->view->{$menu_key} = $menu; } $this->view->category_menu = $site->categoryMenu(); $categoryTree = $categories->listCategoryTree(); $this->view->categoryTree = $categoryTree; $this->view->widget_blurb = $site->widget_blurb(); //@todo to be removed soon $this->view->categories = $page->displayCategories(null, 12); $this->view->Brands = $site->ListBrands(); $this->view->best_sellers = $products->bestSeller(); $this->view->featured_products = $products->featuredProducts(); }