Фильтрация по TV в pdoResources

Здравствуйте!

У меня есть TV акция типа переключатели (радио):
Да==1||Нет==0
Значение по умолчанию — 0
И два ресурса — один с акцией, другой без.
Не работает вызов pdoResources:
[[!AjaxSnippet?
                &snippet=`pdoPage`
                &propertySet=`blog`
                &element=`pdoResources`
                &parents=`[[*id]]`
                &tpl=`blogTpl`
                &includeTVs=`isAction,actionDate,imageOnMain,textOnMain`
                &prepareTVs=`1`
                &processTVs=`1`
             &where=`{"isAction":"0"}`
                &limit=`1`
                &page=`[[!geturi]]`
                &pageVarKey=`page2`
                &as_mode=`onload`   
                &wrapper=`tpl.ajax`
                &showLog=`1`
                ]]
Ничего не выводит. Притом если указать
&where=`{"isAction":"1"}`
то выведет правильный ресурс или оба, если и второму тоже поставить акцию.
Лог такой (если не акция):
0.0001621: pdoTools loaded
0.0000410: xPDO query object created
0.0032070: Included list of tvs: <b>actionDate, imageOnMain, isAction, textOnMain</b>
0.0043399: leftJoined <i>modTemplateVarResource</i> as <b>TVactiondate</b>
0.0004411: leftJoined <i>modTemplateVarResource</i> as <b>TVimageonmain</b>
0.0004909: leftJoined <i>modTemplateVarResource</i> as <b>TVisaction</b>
0.0003319: leftJoined <i>modTemplateVarResource</i> as <b>TVtextonmain</b>
0.0005219: Added selection of <b>modResource</b>: <small>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`</small>
0.0000150: Added selection of <b>modTemplateVarResource</b>: <small>IFNULL(`value`, '') AS `tv.actionDate`</small>
0.0000122: Added selection of <b>modTemplateVarResource</b>: <small>IFNULL(`value`, '') AS `tv.imageOnMain`</small>
0.0000100: Added selection of <b>modTemplateVarResource</b>: <small>IFNULL(`value`, '0') AS `tv.isAction`</small>
0.0000110: Added selection of <b>modTemplateVarResource</b>: <small>IFNULL(`value`, '') AS `tv.textOnMain`</small>
0.0000491: Replaced TV conditions
0.0007021: Processed additional conditions
0.0011911: Added where condition: <b>`TVisaction`.`value`=0, modResource.parent:IN(256,257,258), modResource.published=1, modResource.deleted=0</b>
0.0000350: Replaced TV conditions
0.0001531: Sorted by <b>modResource.publishedon</b>, <b>DESC</b>
0.0000041: Limited to <b>1</b>, offset <b></b>
0.0003650: SQL prepared <small>"SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, IFNULL(`TVactiondate`.`value`, '') AS `tv.actionDate`, IFNULL(`TVimageonmain`.`value`, '') AS `tv.imageOnMain`, IFNULL(`TVisaction`.`value`, '0') AS `tv.isAction`, IFNULL(`TVtextonmain`.`value`, '') AS `tv.textOnMain` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVactiondate` ON `TVactiondate`.`contentid` = `modResource`.`id` AND `TVactiondate`.`tmplvarid` = 38 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVimageonmain` ON `TVimageonmain`.`contentid` = `modResource`.`id` AND `TVimageonmain`.`tmplvarid` = 36 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVisaction` ON `TVisaction`.`contentid` = `modResource`.`id` AND `TVisaction`.`tmplvarid` = 40 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVtextonmain` ON `TVtextonmain`.`contentid` = `modResource`.`id` AND `TVtextonmain`.`tmplvarid` = 39 WHERE  ( `TVisaction`.`value` = '0' AND `modResource`.`parent` IN (256,257,258) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 )  ORDER BY modResource.publishedon DESC LIMIT 1 "</small>
0.0005929: SQL executed
0.0000889: Total rows: <b>0</b>
0.0000119: Rows fetched
0.0000219: Prepared and processed TVs
0.0000012: Returning processed chunks
0.0122540: <b>Total time</b>
13 631 488: <b>Memory usage</b>
Помогите, пожалуйста, разобраться в чем проблема.
Спасибо!

UPD:как оказалось, не работает значение по умолчанию. Если его не указывать, то
&where=`{"isAction:!=":"1"}`
не отрабатывает (я так понимаю из-за того, что оно вообще не указано в бд...)
Кто-то знает, в чем может быть причина?
Игорь Козлов
06 апреля 2014, 18:10
modx.pro
7 747
0

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

Илья Уткин
07 апреля 2014, 09:35
0
В MODX значения по умолчанию в бд не записываются. Такой вот механизм ТВ-параметров. Автор pdoTools уже в курсе, как бедет время, сделает. А пока — используйте
&where=`{"isAction:!=":"1"}
UPD. Сорри, не заметил, что такой вариант не работает…
    Игорь Козлов
    07 апреля 2014, 11:59
    0
    Да, пробовал.
    Смотрю nv filters в getresources, может оттуда скопирую… А пока что использую просто getresources
    Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
    2