msProducts фильтрация товаров по размеру, цвету

Всем привет! Не могу отфильтровать товары в каталоге по размеру, цвету. По цене фильтрует легко. С чем это связано?
Собственно код:
{$_modx->runSnippet('!pdoPage', [
	'parents' => $_modx->resource.id,
	'element' => 'msProducts',
	'ajaxMode' => 'default',
	'limit' => '8',
	'where' => '{"Data.size:IN":["1200x600","213x313"]}',
	'tpl' => '@FILE chunks/productsMainRow.tpl',
])}
По цене и др. фильтрация работает:
{$_modx->runSnippet('!pdoPage', [
	'parents' => $_modx->resource.id,
	'element' => 'msProducts',
	'ajaxMode' => 'default',
	'limit' => '8',
	'where' => '{"Data.price:IN":["720","20"]}',
	'tpl' => '@FILE chunks/productsMainRow.tpl',
])}

Ответ:
Не уверен, что решение правильное, но оно точно работает и может кому пригодится.
{$_modx->runSnippet('!pdoPage', [
	'parents' => $_modx->resource.id,
	'element' => 'msProducts',
	'limit' => '2',
	'optionFilters' => '{"size:=":"1200x600","OR:size:=":"213x313","OR:size:=":"222x444"}',
	'tpl' => '@FILE chunks/productsMainRow.tpl',
])}
max.pevnev
29 августа 2017, 10:40
modx.pro
1
3 466
0

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

Володя
29 августа 2017, 14:37
+1
    max.pevnev
    29 августа 2017, 14:49
    0
    Попробовал, не работает. Выводит все товары. Ведь это не опция, а свойство товара, как и price и favorite, new и т.д.
      max.pevnev
      29 августа 2017, 14:54
      0
      Хотя, да, Вы правы! Работает если писать так
      'optionFilters' => '{"size:=":"1200x600"}'
      Спасибо!
      Не подскажете как сделать запрос из нескольких вариантов: 1200x600, 333х344 и т.д?
        snyadanak
        29 августа 2017, 15:21
        0
        {"size:=":["1200x600","333х344","и т.д"]}
        так подойдет?)
          max.pevnev
          29 августа 2017, 15:32
          0
          К сожалению ничего не выводит :(
          0.0000720: xPDO query object created
          0.0003772: leftJoined msProductData as Data
          0.0003080: leftJoined msVendor as Vendor
          0.0005398: leftJoined msProductOption as size
          0.0000060: Grouped by msProduct.id
          0.0001428: 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.0000479: Added selection of msProductData: `article`, `price`, `old_price`, `weight`, `image`, `thumb`, `vendor`, `made_in`, `new`, `popular`, `favorite`, `tags`, `color`, `size`, `source`
          0.0000489: 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.0014179: Processed additional conditions
          0.0022099: Added where condition: class_key=msProduct, 0(`size`.`value`=Array), msProduct.parent:IN(2,33,32,31,6,9,14,12,16,7,11,13,15,8,10), msProduct.published=1, msProduct.deleted=0
          0.0001359: Sorted by msProduct.id, ASC
          0.0000060: Limited to 8, offset 0
          0.0006771: 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` LEFT JOIN `modx_ms2_product_options` `size` ON `size`.`product_id`=`Data`.`id` AND `size`.`key`='size' WHERE  ( `msProduct`.`class_key` = 'msProduct' AND `size`.`value`=Array AND `msProduct`.`parent` IN (2,33,32,31,6,9,14,12,16,7,11,13,15,8,10) AND `msProduct`.`published` = 1 AND `msProduct`.`deleted` = 0 )  GROUP BY msProduct.id ORDER BY msProduct.id ASC LIMIT 8 "
          0.0009129: Could not process query, error #1054: Unknown column 'Array' in 'where clause'
          0.0074291: Total time
          9 437 184: Memory usage
      Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
      5