Esempio n. 1
0
 /**
  * Has global filtered attributes flag
  *
  * @return boolean
  */
 protected function hasGlobalFilteredAttributes()
 {
     $cnd = new \XLite\Core\CommonCell();
     $cnd->productClass = null;
     $cnd->product = null;
     $cnd->type = \XLite\Model\Attribute::getFilteredTypes();
     return 0 < \XLite\Core\Database::getRepo('\\XLite\\Model\\Attribute')->search($cnd, true);
 }
Esempio n. 2
0
 /**
  * Find filtered product classes
  *
  * @param \XLite\Core\CommonCell $cnd Search condition
  *
  * @return array
  */
 public function findFilteredProductClasses(\XLite\Core\CommonCell $cnd)
 {
     $result = array();
     $data = $this->createQueryBuilderCnd($cnd)->innerJoin('p.productClass', 'class')->innerJoin('class.attributes', 'attr')->andWhere('attr.type IN (\'' . implode('\',\'', \XLite\Model\Attribute::getFilteredTypes()) . '\')')->andWhere('p.productClass is not null')->addSelect('COUNT(DISTINCT p.product_id)')->GroupBy('p.productClass')->getSingleResult();
     if ($data && $data[1] == $this->search($cnd, true)) {
         $result[] = $data[0]->getProductClass();
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * Get attributes list conditions 
  * 
  * @param boolean $countOnly Countr only flag
  *  
  * @return \XLite\Core\CommonCell
  */
 protected function getAttributesListConditions($countOnly)
 {
     $cnd = new \XLite\Core\CommonCell();
     $cnd->attributeGroup = $this->getAttributeGroup();
     if (!$cnd->attributeGroup) {
         $classes = $this->getProductClasses();
         $productClasses = array_filter(is_array($classes) ? $classes : $classes->toArray());
         $cnd->productClass = !empty($productClasses) ? $productClasses : null;
     }
     $cnd->product = null;
     $cnd->type = \XLite\Model\Attribute::getFilteredTypes();
     return $cnd;
 }