Вопрос про сниппет msProducts в другом сниппете

Пишу аякс фильтр для товаров minishop2 и вот проблеммы, подскажите пожалуйста как решить
1. Если выводить через msProducts внутри pdoPage то отображается пагинация правильно
т.е. так пагинация работает
[[!pdoPage? &element=`msProducts` 
&tpl=`productsgridTpl` 
&limit=`21` 
]] 
<div class="clearfix"></div>
[[!+page.nav]]
</div>

а если через свой сниппет то пагинации нет, на месте [[!+page.nav]] — пустота
[[!pdoPage? &element=`catalogFilter` 
				&tpl=`productsgridTpl` 
				&limit=`3` 
				&parents=`[[*id]]`
				]] 
				<div class="clearfix"></div>
				[[!+page.nav]]
Вот код сниппета catalogFilter

<?php

//Filter Fields Settings
$filter = array();

//Radio, Select & Text Fields Type
if($_GET['code']) {
	$filter[] = 'article='.$_GET['code'];
}

//Two Text Fields From To
if($_GET['price_from']) {
	$filter[] = 'price>='.$_GET['price_from'];
}
if($_GET['price_to']) {
	$filter[] = 'price<='.$_GET['price_to'];
}



//End Settings

//Sort
if($_GET['sortby']) {
	$sortby = $_GET['sortby'];
} else {
	$sortby = 'pagetitle';
}
if($_GET['sortdir']) {
	$sortdir = $_GET['sortdir'];
} else {
	$sortdir = 'asc';
}
//End Sort

//Offset
$offset = 0;
if($_GET['offset']){
	$offset = $_GET['offset'];
}

if($filter) {
	$filter[] = 'isfolder=0';
	$where = $modx->toJSON($filter);

} else {
	$where = '';
}




$params_count = array(
	'parents' => $parents,
	'limit' => 0,
	'tpl' => '@INLINE ,',
	'select' => 'id',
	'includeTVs' => $fields,
	'showHidden' => '1',
	'where' => $where,

	);

$count = $modx->runSnippet('msProducts',$params_count);
$count = count(explode(',',$count))-1;
$modx->setPlaceholder('count',$count);



$params = array(
	'parents' => $parents,
	'limit' => $limit,
	'offset' => $offset,
	'tpl' => $tpl,
	'select' => 'id,pagetitle,introtext,content',
	'includeTVs' => $fields,
	'showHidden' => '1',
	'sortby' => $sortby,
	'sortdir' => $sortdir,
	'where' => $where,
	'showLog'=>'1'
	);

$more = $count - $offset - $limit;
$lim = $more > $limit ? $limit : $more;

$button = '';
if($more > 0){
	$button = '<div class="ajax-filter-count" data-count="'.$count.'"><a href="#" class="ajax-more">Загрузить еще '.$lim.' из '.$more.'</a></div>';
}

return $modx->runSnippet('msProducts',$params).$button;
2. Как объеденить условия выборки для нескольких checkbox
так работает но выдает только по одному параметру
if(!empty($_GET['brands'])) {
	$brs = array();
	$brs = implode(',',$_GET['brands']);
	$filter[] = array('vendor.id:IN' => array($brs));
	
}
Вот логи

0.0000370: xPDO query object created
0.0001650: leftJoined msProductData as Data
0.0001478: leftJoined msVendor as Vendor
0.0000031: Grouped by msProduct.id
0.0000620: Added selection of msProduct: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`
0.0000219: Added selection of msProductData: `article`, `price`, `old_price`, `weight`, `image`, `thumb`, `vendor`, `made_in`, `new`, `popular`, `favorite`, `tags`, `color`, `size`, `source`
0.0000210: Added selection of msVendor: `name` AS `vendor.name`, `resource` AS `vendor.resource`, `country` AS `vendor.country`, `logo` AS `vendor.logo`, `address` AS `vendor.address`, `phone` AS `vendor.phone`, `fax` AS `vendor.fax`, `email` AS `vendor.email`, `description` AS `vendor.description`, `properties` AS `vendor.properties`
0.0006959: Processed additional conditions
0.0010560: Added where condition: class_key=msProduct, vendor.id:IN(3,2), 1=isfolder=0, msProduct.parent:IN(22,35,38,39,40,41), msProduct.published=1, msProduct.deleted=0
0.0000720: Sorted by msProduct.pagetitle, asc
0.0000038: Limited to 3, offset 0
0.0005009: SQL prepared «SELECT SQL_CALC_FOUND_ROWS `msProduct`.`id`, `msProduct`.`type`, `msProduct`.`contentType`, `msProduct`.`pagetitle`, `msProduct`.`longtitle`, `msProduct`.`description`, `msProduct`.`alias`, `msProduct`.`link_attributes`, `msProduct`.`published`, `msProduct`.`pub_date`, `msProduct`.`unpub_date`, `msProduct`.`parent`, `msProduct`.`isfolder`, `msProduct`.`introtext`, `msProduct`.`richtext`, `msProduct`.`template`, `msProduct`.`menuindex`, `msProduct`.`searchable`, `msProduct`.`cacheable`, `msProduct`.`createdby`, `msProduct`.`createdon`, `msProduct`.`editedby`, `msProduct`.`editedon`, `msProduct`.`deleted`, `msProduct`.`deletedon`, `msProduct`.`deletedby`, `msProduct`.`publishedon`, `msProduct`.`publishedby`, `msProduct`.`menutitle`, `msProduct`.`donthit`, `msProduct`.`privateweb`, `msProduct`.`privatemgr`, `msProduct`.`content_dispo`, `msProduct`.`hidemenu`, `msProduct`.`class_key`, `msProduct`.`context_key`, `msProduct`.`content_type`, `msProduct`.`uri`, `msProduct`.`uri_override`, `msProduct`.`hide_children_in_tree`, `msProduct`.`show_in_tree`, `msProduct`.`properties`, `Data`.`article`, `Data`.`price`, `Data`.`old_price`, `Data`.`weight`, `Data`.`image`, `Data`.`thumb`, `Data`.`vendor`, `Data`.`made_in`, `Data`.`new`, `Data`.`popular`, `Data`.`favorite`, `Data`.`tags`, `Data`.`color`, `Data`.`size`, `Data`.`source`, `Vendor`.`name` AS `vendor.name`, `Vendor`.`resource` AS `vendor.resource`, `Vendor`.`country` AS `vendor.country`, `Vendor`.`logo` AS `vendor.logo`, `Vendor`.`address` AS `vendor.address`, `Vendor`.`phone` AS `vendor.phone`, `Vendor`.`fax` AS `vendor.fax`, `Vendor`.`email` AS `vendor.email`, `Vendor`.`description` AS `vendor.description`, `Vendor`.`properties` AS `vendor.properties` FROM `modx_site_content` AS `msProduct` LEFT JOIN `modx_ms2_products` `Data` ON `msProduct`.`id`=`Data`.`id` LEFT JOIN `modx_ms2_vendors` `Vendor` ON `Data`.`vendor`=`Vendor`.`id` WHERE ( `msProduct`.`class_key` = 'msProduct' AND `vendor`.`id` IN (3) AND isfolder=0 AND `msProduct`.`parent` IN (22,35,38,39,40,41) AND `msProduct`.`published` = 1 AND `msProduct`.`deleted` = 0 ) GROUP BY msProduct.id ORDER BY msProduct.pagetitle asc LIMIT 3 „
0.0044920: SQL executed
0.0001390: Total rows: 2
0.0000420: Rows fetched
0.0000780: Returning raw data
0.0006061: Checked the active modifiers
0.0026960: Loaded “modChunk» with name «productsgridTpl»
0.0012312: Loaded options for products
0.0000081: Returning processed chunks
0.0140769: Total time
13 893 632: Memory usage

Что ему не нравится в этом условии не пойму....? Почему если Added where condition: vendor.id:IN(3,2)
В запросе — AND `vendor`.`id` IN (3)
Женя Бровцын
30 марта 2017, 18:53
modx.pro
1
2 270
0

Комментарии: 1

Женя Бровцын
31 марта 2017, 11:35
0
С пагинацией разобрался, помогло прменение в сниппете объединение массивов
$newparams = array(
	'sortby' => $sortby,
	'sortdir' => $sortdir,
	'where'=>$where,
	'showLog'=>'1'
	);

return $modx->runSnippet('msProducts',array_merge($scriptProperties,$newparams));

Остался вопрос по объединению чекбоксов.
Что ему не нравится в этом условии не пойму....? Почему если Added where condition: vendor.id:IN(3,2)
В запросе — AND `vendor`.`id` IN (3)
    Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
    1