/** * Fill the object's arrProducts array * @param array|null * @return array */ protected function findProducts($arrCacheIds = null) { $time = time(); $arrCategories = $this->findCategories($this->iso_category_scope); list($arrFilters, $arrSorting, $strWhere, $arrValues) = $this->getFiltersAndSorting(); $objProductData = $this->Database->prepare(IsotopeProduct::getSelectStatement() . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE p1.language=''" . (BE_USER_LOGGED_IN === true ? '' : " AND p1.published='1' AND (p1.start='' OR p1.start<{$time}) AND (p1.stop='' OR p1.stop>{$time})") . "AND (p1.id IN (SELECT pid FROM tl_iso_product_categories WHERE page_id IN (" . implode(',', $arrCategories) . "))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tOR p1.pid IN (SELECT pid FROM tl_iso_product_categories WHERE page_id IN (" . implode(',', $arrCategories) . ")))" . (is_array($arrCacheIds) ? "AND (p1.id IN (" . implode(',', $arrCacheIds) . ") OR p1.pid IN (" . implode(',', $arrCacheIds) . "))" : '') . ($this->iso_list_where == '' ? '' : " AND {$this->iso_list_where}") . "{$strWhere} GROUP BY p1.id ORDER BY c.sorting")->execute($arrValues); return IsotopeFrontend::getProducts($objProductData, IsotopeFrontend::getReaderPageId(null, $this->iso_reader_jumpTo), true, $arrFilters, $arrSorting); }
/** * Find all products we need to list. * @return array */ protected function findProducts() { $strAlias = $this->Input->get('product'); $arrIds = array(0); $arrJumpTo = array(); $objCategories = $this->Database->prepare("SELECT *, (SELECT jumpTo FROM tl_iso_related_categories WHERE id=category) AS jumpTo FROM tl_iso_related_products WHERE pid IN (SELECT id FROM tl_iso_products WHERE " . (is_numeric($strAlias) ? 'id' : 'alias') . "=?" . ($this->iso_list_where != '' ? ' AND ' . $this->iso_list_where : '') . ") AND category IN (" . implode(',', $this->iso_related_categories) . ") ORDER BY id=" . implode(' DESC, id=', $this->iso_related_categories) . " DESC")->execute($strAlias); while ($objCategories->next()) { $ids = deserialize($objCategories->products); if (is_array($ids) && count($ids)) { $arrIds = array_unique(array_merge($arrIds, $ids)); if ($objCategories->jumpTo) { $arrJumpTo = array_fill_keys($ids, $objCategories->jumpTo) + $arrJumpTo; } } } return IsotopeFrontend::getProducts($arrIds, IsotopeFrontend::getReaderPageId(null, $this->iso_reader_jumpTo)); }
/** * Generate module * @return void */ protected function compile() { $objProduct = IsotopeFrontend::getProductByAlias($this->Input->get('product'), IsotopeFrontend::getReaderPageId()); if (!$objProduct) { $this->Template = new FrontendTemplate('mod_message'); $this->Template->type = 'empty'; $this->Template->message = $GLOBALS['TL_LANG']['MSC']['invalidProductInformation']; return; } $this->Template->product = $objProduct->generate(strlen($this->iso_reader_layout) ? $this->iso_reader_layout : $objProduct->reader_template, $this); $this->Template->referer = 'javascript:history.go(-1)'; $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack']; global $objPage; $objPage->pageTitle = strip_insert_tags($objProduct->name); $objPage->description = $this->prepareMetaDescription($objProduct->description_meta); $GLOBALS['TL_KEYWORDS'] .= (strlen($GLOBALS['TL_KEYWORDS']) ? ', ' : '') . $objProduct->keywords_meta; }
/** * Generate products from database result or array of IDs * @deprecated * @see IsotopeFrontend::getProducts() */ protected function getProducts($objProductData, $blnCheckAvailability = true, array $arrFilters = array(), array $arrSorting = array()) { trigger_error('Using ModuleIsotope::getProducts() is deprecated. Please use IsotopeFrontend::getProducts()', E_USER_NOTICE); return IsotopeFrontend::getProducts($objProductData, IsotopeFrontend::getReaderPageId(null, $this->iso_reader_jumpTo), $blnCheckAvailability, $arrFilters, $arrSorting); }