public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $categories = array(); $where = array('id:in' => $this->getCategories((int) $this->getProperty('category_id'), $categories)); $c->where($where); return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $alias = $c->getAlias(); $where = array("parent" => 80, "template" => 4); // Только для главной if ($this->getProperty('show_on_pain_page')) { $c->innerJoin('modTemplateVarResource', "tv_main_only", "tv_main_only.contentid = {$alias}.id AND tv_main_only.tmplvarid = 22 AND tv_main_only.value = '1'"); } $c->where($where); return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $alias = $c->getAlias(); # if($this->getProperty('parent_joining_type') == 'inner'){ # $c->innerJoin('modResource', "Parent"); # } # else{ # $c->leftJoin('modResource', "Parent"); # } $c->innerJoin('modUser', 'Author', "Author.id = {$alias}.createdby"); $where = array("template" => 2); $c->where($where); # $c->select(array( # "{$alias}.id", # "{$alias}.pagetitle", # )); # $c->prepare(); # print $c->toSQL(); # exit; return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $alias = $c->getAlias(); $c->innerJoin('ShopmodxProduct', 'Product'); if ($this->getProperty('hot')) { $c->innerJoin('modTemplateVarResource', 'hot', "hot.contentid = {$alias}.id AND hot.tmplvarid = 8 AND hot.value='1'"); } // Поиск товаров в категории и подкатегориях if ($category_id = $this->getProperty('category_id')) { $categories = array(); $this->getCategories($category_id, $categories); $c->where(array("parent:IN" => $categories)); } // Курс валюты $base_currency_id = (int) $this->getProperty('base_currency_id'); $c->leftJoin('modResource', "base_currency_doc", "base_currency_doc.id = {$base_currency_id}"); $c->leftJoin('modResource', "currency_doc", "currency_doc.id = Product.sm_currency"); $c->leftJoin('modTemplateVarResource', "course_tv", "course_tv.contentid = Product.sm_currency"); $c->select(array("Product.*", "course_tv.value as course", "if({$base_currency_id} != Product.sm_currency && course_tv.value, round(Product.sm_price * course_tv.value, 2), Product.sm_price) as sm_price", "if({$base_currency_id} != Product.sm_currency && course_tv.value, {$base_currency_id}, Product.sm_currency) as sm_currency", "if({$base_currency_id} != Product.sm_currency && course_tv.value, base_currency_doc.pagetitle, currency_doc.pagetitle) as currency_code")); return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $c->where(array("parent:in" => array(80))); return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $c->where(array('class_key' => 'ShopmodxResourceCurrency')); return $c; }