M
M
medvedgoff2021-03-12 14:05:20
MODX
medvedgoff, 2021-03-12 14:05:20

In pdoResources, sampling from different TVs (or condition)?

Resources have a number of TV parameters, on each page you need to display a list of similar pages, with a match for one of two, three different TVs, and also remove the same page from the selection.

For example
-QUESTIONS --Question1
(TV1value:hello;) (TV2value:paper;)
--Question2 (TV1value:bye;) (TV2value:paper;)
--Question3 (TV1value:hello;) (TV1value:sheet;)
-- Question4 (TV1value: cheers;) (TV1value:carnadash;)

And it turns out that you need to show similar questions on the Question1 page, these will be
Question2 (because TV2 matches paper)
Question3 (because TV1 matches hello)


I set all sorts of different conditions, more or less the worker turned out this one, displays it as it should, but I can’t remove the same page from the selection, it still displays it. Maybe there are other solutions to this issue?



If the parent is removed in the condition, then it displays all the site resources that match the selection conditions (there are resources with the same TV parameters in other sections of the site), and if the parent parameter is removed, it will display only this resource. As if the resources parameter with a minus is ignored, because in the log it shows in the sql query that `modResource`.`id` NOT IN (3891)

Here is the log
0.0002031: pdoTools loaded
0.0000370: xPDO query object created
0.0009511: Included list of tvs: ib-cel, ib-pokrytye, ib-pomesheniye, ib-product, ib-teplypol, img, proizv, tp-type-konstruktion
0.0003929: leftJoined modTemplateVarResource as TVib-cel
0.0003431: leftJoined modTemplateVarResource as TVib-pokrytye
0.0003161: leftJoined modTemplateVarResource as TVib-pomesheniye
0.0003359: leftJoined modTemplateVarResource as TVib-product
0.0003631: leftJoined modTemplateVarResource as TVib-teplypol
0.0003319: leftJoined modTemplateVarResource as TVimg
0.0003121: leftJoined modTemplateVarResource as TVproizv
0.0003290: leftJoined modTemplateVarResource as TVtp-type-konstruktion
0.0005040: Added selection of modResource: 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.0000160: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.ib-cel`
0.0000119: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.ib-pokrytye`
0.0000119: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.ib-pomesheniye`
0.0000112: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.ib-product`
0.0000110: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.ib-teplypol`
0.0000110: Added selection of modTemplateVarResource: IFNULL(`value`, '[{\"MIGX_id\":\"1\",\"image\":\"ico/no-foto.jpg\"}]') AS `tv.img`
0.0000110: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.proizv`
0.0000110: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.tp-type-konstruktion`
0.0000801: Replaced TV conditions
0.0008481: Processed additional conditions
0.0014110: Added where condition: 0=parent = '3890' AND `TVib-teplypol`.`value` = 'пленочный пол' OR `TVib-pokrytye`.`value` = 'плитка', modResource.id:NOT IN(3891), modResource.parent:IN(3890,3906,3891,3892,3907,3908,3909,3701,3875,3874), modResource.published=1, modResource.hidemenu=0, modResource.deleted=0, modResource.isfolder=0
0.0000489: Replaced TV conditions
0.0002091: Sorted by RAND(), DESC
0.0000041: Limited to 10, offset 0
0.0005581: SQL prepared "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(`TVib-cel`.`value`, '') AS `tv.ib-cel`, IFNULL(`TVib-pokrytye`.`value`, '') AS `tv.ib-pokrytye`, IFNULL(`TVib-pomesheniye`.`value`, '') AS `tv.ib-pomesheniye`, IFNULL(`TVib-product`.`value`, '') AS `tv.ib-product`, IFNULL(`TVib-teplypol`.`value`, '') AS `tv.ib-teplypol`, IFNULL(`TVimg`.`value`, '[{\"MIGX_id\":\"1\",\"image\":\"ico/no-foto.jpg\"}]') AS `tv.img`, IFNULL(`TVproizv`.`value`, '') AS `tv.proizv`, IFNULL(`TVtp-type-konstruktion`.`value`, '') AS `tv.tp-type-konstruktion` FROM `plan_site_content` AS `modResource` LEFT JOIN `plan_site_tmplvar_contentvalues` `TVib-cel` ON `TVib-cel`.`contentid` = `modResource`.`id` AND `TVib-cel`.`tmplvarid` = 149 LEFT JOIN `plan_site_tmplvar_contentvalues` `TVib-pokrytye` ON `TVib-pokrytye`.`contentid` = `modResource`.`id` AND `TVib-pokrytye`.`tmplvarid` = 150 LEFT JOIN `plan_site_tmplvar_contentvalues` `TVib-pomesheniye` ON `TVib-pomesheniye`.`contentid` = `modResource`.`id` AND `TVib-pomesheniye`.`tmplvarid` = 147 LEFT JOIN `plan_site_tmplvar_contentvalues` `TVib-product` ON `TVib-product`.`contentid` = `modResource`.`id` AND `TVib-product`.`tmplvarid` = 151 LEFT JOIN `plan_site_tmplvar_contentvalues` `TVib-teplypol` ON `TVib-teplypol`.`contentid` = `modResource`.`id` AND `TVib-teplypol`.`tmplvarid` = 148 LEFT JOIN `plan_site_tmplvar_contentvalues` `TVimg` ON `TVimg`.`contentid` = `modResource`.`id` AND `TVimg`.`tmplvarid` = 6 LEFT JOIN `plan_site_tmplvar_contentvalues` `TVproizv` ON `TVproizv`.`contentid` = `modResource`.`id` AND `TVproizv`.`tmplvarid` = 11 LEFT JOIN `plan_site_tmplvar_contentvalues` `TVtp-type-konstruktion` ON `TVtp-type-konstruktion`.`contentid` = `modResource`.`id` AND `TVtp-type-konstruktion`.`tmplvarid` = 20 WHERE  ( parent = '3890' AND `TVib-teplypol`.`value` = 'пленочный пол' OR `TVib-pokrytye`.`value` = 'плитка' AND `modResource`.`id` NOT IN (3891) AND `modResource`.`parent` IN (3890,3906,3891,3892,3907,3908,3909,3701,3875,3874) AND `modResource`.`published` = 1 AND `modResource`.`hidemenu` = 0 AND `modResource`.`deleted` = 0 AND `modResource`.`isfolder` = 0 )  ORDER BY RAND() DESC LIMIT 10 "
0.0023980: SQL executed
0.0000980: Total rows: 2
0.0000319: Rows fetched
0.0118310: Prepared and processed TVs
0.0017481: Loaded "modChunk" with name "spisok-vo"
0.0045700: Returning processed chunks
0.0259290: Total time
11 272 192: Memory usage

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Tarasov, 2021-03-12
@medvedgoff

But what if you just specify in the spisok-vo chunk :

показать содержимое чанка

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question