コード例 #1
0
 /**
  * Fill the object's arrProducts array
  *
  * @param array|null $arrCacheIds
  *
  * @return array
  */
 protected function findProducts($arrCacheIds = null)
 {
     $t = Product::getTable();
     $arrColumns = array();
     $arrCategories = $this->findCategories();
     $arrProductIds = \Database::getInstance()->query("\n                SELECT pid\n                FROM tl_iso_product_category\n                WHERE page_id IN (" . implode(',', $arrCategories) . ")\n            ")->fetchEach('pid');
     $arrTypes = \Database::getInstance()->query("SELECT id FROM tl_iso_producttype WHERE variants='1'")->fetchEach('id');
     if (empty($arrProductIds)) {
         return array();
     }
     $queryBuilder = new FilterQueryBuilder(Isotope::getRequestCache()->getFiltersForModules($this->iso_filterModules));
     $arrColumns[] = "(\n            ({$t}.id IN (" . implode(',', $arrProductIds) . ") AND {$t}.type NOT IN (" . implode(',', $arrTypes) . "))\n            OR {$t}.pid IN (" . implode(',', $arrProductIds) . ")\n        )";
     if (!empty($arrCacheIds) && is_array($arrCacheIds)) {
         $arrColumns[] = Product::getTable() . ".id IN (" . implode(',', $arrCacheIds) . ")";
     }
     // Apply new/old product filter
     if ($this->iso_newFilter == 'show_new') {
         $arrColumns[] = Product::getTable() . ".dateAdded>=" . Isotope::getConfig()->getNewProductLimit();
     } elseif ($this->iso_newFilter == 'show_old') {
         $arrColumns[] = Product::getTable() . ".dateAdded<" . Isotope::getConfig()->getNewProductLimit();
     }
     if ($this->iso_list_where != '') {
         $arrColumns[] = $this->iso_list_where;
     }
     if ($queryBuilder->hasSqlCondition()) {
         $arrColumns[] = $queryBuilder->getSqlWhere();
     }
     $arrSorting = Isotope::getRequestCache()->getSortingsForModules($this->iso_filterModules);
     if (empty($arrSorting) && $this->iso_listingSortField != '') {
         $direction = $this->iso_listingSortDirection == 'DESC' ? Sort::descending() : Sort::ascending();
         $arrSorting[$this->iso_listingSortField] = $direction;
     }
     $objProducts = Product::findAvailableBy($arrColumns, $queryBuilder->getSqlValues(), array('order' => 'c.sorting', 'filters' => $queryBuilder->getFilters(), 'sorting' => $arrSorting));
     return null === $objProducts ? array() : $objProducts->getModels();
 }
コード例 #2
0
ファイル: ProductVariantList.php プロジェクト: Aziz-JH/core
 /**
  * Fill the object's arrProducts array
  * @param   array|null
  * @return  array
  */
 protected function findProducts($arrCacheIds = null)
 {
     $t = Product::getTable();
     $arrColumns = array();
     $arrCategories = $this->findCategories();
     $arrProductIds = \Database::getInstance()->query("SELECT pid FROM " . ProductCategory::getTable() . " WHERE page_id IN (" . implode(',', $arrCategories) . ")")->fetchEach('pid');
     $arrTypes = \Database::getInstance()->query("SELECT id FROM " . ProductType::getTable() . " WHERE variants='1'")->fetchEach('id');
     if (empty($arrProductIds)) {
         return array();
     }
     list($arrFilters, $arrSorting, $strWhere, $arrValues) = $this->getFiltersAndSorting();
     if (!is_array($arrValues)) {
         $arrValues = array();
     }
     $arrColumns[] = "(\n            ({$t}.id IN (" . implode(',', $arrProductIds) . ") AND {$t}.type NOT IN (" . implode(',', $arrTypes) . "))\n            OR {$t}.pid IN (" . implode(',', $arrProductIds) . ")\n        )";
     if (!empty($arrCacheIds) && is_array($arrCacheIds)) {
         $arrColumns[] = Product::getTable() . ".id IN (" . implode(',', $arrCacheIds) . ")";
     }
     // Apply new/old product filter
     if ($this->iso_newFilter == 'show_new') {
         $arrColumns[] = Product::getTable() . ".dateAdded>=" . Isotope::getConfig()->getNewProductLimit();
     } elseif ($this->iso_newFilter == 'show_old') {
         $arrColumns[] = Product::getTable() . ".dateAdded<" . Isotope::getConfig()->getNewProductLimit();
     }
     if ($this->iso_list_where != '') {
         $arrColumns[] = Haste::getInstance()->call('replaceInsertTags', $this->iso_list_where);
     }
     if ($strWhere != '') {
         $arrColumns[] = $strWhere;
     }
     $objProducts = Product::findAvailableBy($arrColumns, $arrValues, array('order' => 'c.sorting', 'filters' => $arrFilters, 'sorting' => $arrSorting));
     return null === $objProducts ? array() : $objProducts->getModels();
 }
コード例 #3
0
ファイル: ProductList.php プロジェクト: rpquadrat/core
 /**
  * Find all products we need to list.
  * @param   array|null
  * @return  array
  */
 protected function findProducts($arrCacheIds = null)
 {
     $arrColumns = array();
     $arrCategories = $this->findCategories();
     list($arrFilters, $arrSorting, $strWhere, $arrValues) = $this->getFiltersAndSorting();
     if (!is_array($arrValues)) {
         $arrValues = array();
     }
     $arrColumns[] = "c.page_id IN (" . implode(',', $arrCategories) . ")";
     if (!empty($arrCacheIds) && is_array($arrCacheIds)) {
         $arrColumns[] = Product::getTable() . ".id IN (" . implode(',', $arrCacheIds) . ")";
     }
     // Apply new/old product filter
     if ($this->iso_newFilter == 'show_new') {
         $arrColumns[] = Product::getTable() . ".dateAdded>=" . Isotope::getConfig()->getNewProductLimit();
     } elseif ($this->iso_newFilter == 'show_old') {
         $arrColumns[] = Product::getTable() . ".dateAdded<" . Isotope::getConfig()->getNewProductLimit();
     }
     if ($this->iso_list_where != '') {
         $arrColumns[] = Haste::getInstance()->call('replaceInsertTags', $this->iso_list_where);
     }
     if ($strWhere != '') {
         $arrColumns[] = $strWhere;
     }
     $objProducts = Product::findAvailableBy($arrColumns, $arrValues, array('order' => 'c.sorting', 'filters' => $arrFilters, 'sorting' => $arrSorting));
     return null === $objProducts ? array() : $objProducts->getModels();
 }
コード例 #4
0
 /**
  * Find all products we need to list.
  *
  * @param array|null $arrCacheIds
  *
  * @return array
  */
 protected function findProducts($arrCacheIds = null)
 {
     $arrColumns = array();
     $arrCategories = $this->findCategories();
     $queryBuilder = new FilterQueryBuilder(Isotope::getRequestCache()->getFiltersForModules($this->iso_filterModules));
     $arrColumns[] = "c.page_id IN (" . implode(',', $arrCategories) . ")";
     if (!empty($arrCacheIds) && is_array($arrCacheIds)) {
         $arrColumns[] = Product::getTable() . ".id IN (" . implode(',', $arrCacheIds) . ")";
     }
     // Apply new/old product filter
     if ($this->iso_newFilter == 'show_new') {
         $arrColumns[] = Product::getTable() . ".dateAdded>=" . Isotope::getConfig()->getNewProductLimit();
     } elseif ($this->iso_newFilter == 'show_old') {
         $arrColumns[] = Product::getTable() . ".dateAdded<" . Isotope::getConfig()->getNewProductLimit();
     }
     if ($this->iso_list_where != '') {
         $arrColumns[] = $this->iso_list_where;
     }
     if ($queryBuilder->hasSqlCondition()) {
         $arrColumns[] = $queryBuilder->getSqlWhere();
     }
     $arrSorting = Isotope::getRequestCache()->getSortingsForModules($this->iso_filterModules);
     if (empty($arrSorting) && $this->iso_listingSortField != '') {
         $direction = $this->iso_listingSortDirection == 'DESC' ? Sort::descending() : Sort::ascending();
         $arrSorting[$this->iso_listingSortField] = $direction;
     }
     $objProducts = Product::findAvailableBy($arrColumns, $queryBuilder->getSqlValues(), array('order' => 'c.sorting', 'filters' => $queryBuilder->getFilters(), 'sorting' => $arrSorting));
     return null === $objProducts ? array() : $objProducts->getModels();
 }