/** * getProductCollection function. * -- gets Magento product collection * @access private * @param mixed $_collectionType * @return void */ private function getProductCollection($_collectionType) { $_storeID = $this->get('storeid'); // -- Load Magento -- $_obj = new MagentoCollection($_storeID); $_collectionPage = $this->get('collectionpage'); $_categoryID = $this->get('categoryid'); $_collectionLimit = $this->get('productlimit'); switch ($_collectionType) { case 'newfromdate': $_obj->getNewProducts($_storeID, (int) $_collectionPage, (int) $_collectionLimit); $this->set('selectedcollectionname', $this->__t->__('New Products')); break; case 'allproducts': $_obj->getAllProducts($_storeID, (int) $_collectionPage, (int) $_collectionLimit); $this->set('selectedcollectionname', $this->__t->__('All Products')); break; case 'categoryproducts': $_obj->getCategoryProducts($_storeID, (int) $_categoryID, (int) $_collectionPage, (int) $_collectionLimit); $this->set('selectedcollectionname', $this->__t->__('Category Products')); break; case 'bestselling': $_obj->getBestsellingProducts($_storeID); $this->set('selectedcollectionname', $this->__t->__('Bestselling Products')); break; default: throw new Exception('Invalid collection type.'); } // -- load Magento Product Collection $_collection = $_obj->get('collection'); $_imageBaseURL = $_obj->get('baseurlmedia') . 'catalog/product'; $this->set('imagebaseurl', $_imageBaseURL); $this->set('collection', $_collection); // load categories and category product count used for menu if ($this->get('showmenu')) { $this->set('categories', $_obj->get('categories')); $this->set('categoriesproductcount', $_obj->get('categoriesproductcount')); } // -- Unload Magento unset($_collection); unset($_obj); }