Answer the question
In order to leave comments, you need to log in
How to select from two categories through pdoResources?
Tortured to make the conditions of the sample.
It is required to select all resources from the parent + another category, the value of the tv-parameter of the children of which will be the id of the current resource) The example should make it clearer:
{'!mFilter2' | snippet : [
'parents' => '2, 100', // родителем будет текущий ресурс и ещё ресурс с id = 100
'suggestions' => 0,
'limit' => 10,
'includeTVs' => 'price, spec', // интересует spec
'tplPageWrapper' => '@INLINE <div class="mypagination"><ul></ul></div>',
'sortby' => ,
]}
'tvFilters' => 'spec==2||spec==0',
'where' => '{"spec":0, "OR:spec":2}'
Answer the question
In order to leave comments, you need to log in
It seems to have overcome the problem.
Long and persistent googling suggested that leftJoin would be indispensable. As a result, the following code was born:
{'!mFilter2' | snippet : [
'parents' => '2, 100', // Из текущего + 100
'suggestions' => 0,
'limit' => 10,
'includeTVs' => 'price, spec',
'tplPageWrapper' => '@INLINE <div class="pagination p10"><ul></ul></div>',
'leftJoin' => '{
"spec": {
"class":"modTemplateVarResource"
,"alias":"spec"
,"on": "modResource.id = spec.contentid AND spec.tmplvarid = 62"
}
}',
// Либо spec не указан (что сделано в дочерних ресурсах текущего), либо spec = id текужего ресурса (а может и нескольких)
'where' => '["(`spec`.`value` IS NULL OR `spec`.`value` IN (2))"]'
]}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question