renderResources Problems after Upgrade to Modx 3

Hello,

i upgrade my Modx to Modx 3.0.3. My primary problem is, in my template i load/use a chunk with renderResources, but on the website i got no output. i found out without &parents and use &resources ID1,ID2 itworks.

doesent work

[[renderResources?
&showHidden=`1`
&parents=`105`
&sortby=`{"menuindex":"ASC","createdon":"DESC"}` 
&limit=`12`
]]

works

[[renderResources?
&showHidden=`1`
&resources=`308,309`
&sortby=`{"menuindex":"ASC"}` 
&limit=`12`
]]

with Modx 2.8.4 all works fine…

My error Logs shows this. Strange other IDs, used also rednerressource & getpage

[2023-04-20 15:09:51] (ERROR @ /var/www/domain.de/cms/pub_neu/core/cache/includes/elements/modx/revolution/modsnippet/32.include.cache.php : 170) context for 105 is stage
[2023-04-20 15:09:51] (ERROR @ /var/www/domain.de/cms/pub_neu/core/cache/includes/elements/modx/revolution/modsnippet/32.include.cache.php : 389) SELECT `modResource`.`id` AS `modResource_id`, `modResource`.`type` AS `modResource_type`, `modResource`.`pagetitle` AS `modResource_pagetitle`, `modResource`.`longtitle` AS `modResource_longtitle`, `modResource`.`description` AS `modResource_description`, `modResource`.`alias` AS `modResource_alias`, `modResource`.`link_attributes` AS `modResource_link_attributes`, `modResource`.`published` AS `modResource_published`, `modResource`.`pub_date` AS `modResource_pub_date`, `modResource`.`unpub_date` AS `modResource_unpub_date`, `modResource`.`parent` AS `modResource_parent`, `modResource`.`isfolder` AS `modResource_isfolder`, `modResource`.`introtext` AS `modResource_introtext`, `modResource`.`content` AS `modResource_content`, `modResource`.`richtext` AS `modResource_richtext`, `modResource`.`template` AS `modResource_template`, `modResource`.`menuindex` AS `modResource_menuindex`, `modResource`.`searchable` AS `modResource_searchable`, `modResource`.`cacheable` AS `modResource_cacheable`, `modResource`.`createdby` AS `modResource_createdby`, `modResource`.`createdon` AS `modResource_createdon`, `modResource`.`editedby` AS `modResource_editedby`, `modResource`.`editedon` AS `modResource_editedon`, `modResource`.`deleted` AS `modResource_deleted`, `modResource`.`deletedon` AS `modResource_deletedon`, `modResource`.`deletedby` AS `modResource_deletedby`, `modResource`.`publishedon` AS `modResource_publishedon`, `modResource`.`publishedby` AS `modResource_publishedby`, `modResource`.`menutitle` AS `modResource_menutitle`, `modResource`.`donthit` AS `modResource_donthit`, `modResource`.`privateweb` AS `modResource_privateweb`, `modResource`.`privatemgr` AS `modResource_privatemgr`, `modResource`.`content_dispo` AS `modResource_content_dispo`, `modResource`.`hidemenu` AS `modResource_hidemenu`, `modResource`.`class_key` AS `modResource_class_key`, `modResource`.`context_key` AS `modResource_context_key`, `modResource`.`content_type` AS `modResource_content_type`, `modResource`.`uri` AS `modResource_uri`, `modResource`.`uri_override` AS `modResource_uri_override`, `modResource`.`hide_children_in_tree` AS `modResource_hide_children_in_tree`, `modResource`.`show_in_tree` AS `modResource_show_in_tree`, `modResource`.`properties` AS `modResource_properties`, `modResource`.`alias_visible` AS `modResource_alias_visible` FROM `modx_site_content` AS `modResource` JOIN `modx_content_type` `ContentType` ON  ( `ContentType`.`binary` = '' AND ContentType.id = modResource.content_type )  WHERE  ( modResource.parent IN (105,285,481,463,259,480) AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 AND `modResource`.`class_key` IN ('modDocument','modStaticResource') )  ORDER BY menuindex ASC, createdon DESC LIMIT 12

This line in the snippet code

has to be changed to this

$criteria['class_key:IN'] = array('modDocument', 'MODX\\Revolution\\modStaticResource');

to account for the (new) namespace in the class_key.

1 Like

Hello @halftrainedharry,

thx for your support. i change it in Elements > Snippts > renderresources, same problem.
further i change it on core/components/renderresources/snippet.renderresources.php with no result.
i also cleared the cache

have I implemented it incorrectly, or misconception on my site? :frowning:

Yes, this is what I meant.

This file is only used when the extra gets installed to create the snippet. (No need to change the code here.)


When you use the property &debug=`1` in the snippet call, has the SQL query changed, that gets logged in the MODX error log (from the one you posted above)?

Maybe you can use this SQL query in phpMyAdmin (or similar tool) to figure out, what part of the query prevents it from returning a result.

yes, but this Problem from the log was fixed. log file is empty, debug=1 is active. this solution i also tryed the last days.
can i assign/hire you for my modx 3 problems? :slight_smile:

I don’t understand. With &debug=`1` the SQL query should get logged every time the snippet runs (regardless if it returns some output or not).

So does the snippet “renderResources” just return nothing, or is the complete page blank?

No!

return notthing. normaly it shows visibile slides from the child resources. parent resource got the chunk with [[renderResources? &parents=297

with &ressources and IDs it will show the picked RES.

i got the same Error like my first Post from the ID=297 (resource with renderresource script)

> [2023-04-21 10:00:13] (ERROR @ /var/www/domain/cms/pub_neu/core/cache/includes/elements/modx/revolution/modsnippet/32.include.cache.php : 170) context for 297 is Dev
> [2023-04-21 10:00:13] (ERROR @ /var/www/domain.de/cms/pub_neu/core/cache/includes/elements/modx/revolution/modsnippet/32.include.cache.php : 389) SELECT `modResource`.`id` AS `modResource_id`, `modResource`.`type` AS `modResource_type`, `modResource`.`pagetitle` AS `modResource_pagetitle`, `modResource`.`longtitle` AS `modResource_longtitle`, `modResource`.`description` AS `modResource_description`, `modResource`.`alias` AS `modResource_alias`, `modResource`.`link_attributes` AS `modResource_link_attributes`, `modResource`.`published` AS `modResource_published`, `modResource`.`pub_date` AS `modResource_pub_date`, `modResource`.`unpub_date` AS `modResource_unpub_date`, `modResource`.`parent` AS `modResource_parent`, `modResource`.`isfolder` AS `modResource_isfolder`, `modResource`.`introtext` AS `modResource_introtext`, `modResource`.`content` AS `modResource_content`, `modResource`.`richtext` AS `modResource_richtext`, `modResource`.`template` AS `modResource_template`, `modResource`.`menuindex` AS `modResource_menuindex`, `modResource`.`searchable` AS `modResource_searchable`, `modResource`.`cacheable` AS `modResource_cacheable`, `modResource`.`createdby` AS `modResource_createdby`, `modResource`.`createdon` AS `modResource_createdon`, `modResource`.`editedby` AS `modResource_editedby`, `modResource`.`editedon` AS `modResource_editedon`, `modResource`.`deleted` AS `modResource_deleted`, `modResource`.`deletedon` AS `modResource_deletedon`, `modResource`.`deletedby` AS `modResource_deletedby`, `modResource`.`publishedon` AS `modResource_publishedon`, `modResource`.`publishedby` AS `modResource_publishedby`, `modResource`.`menutitle` AS `modResource_menutitle`, `modResource`.`donthit` AS `modResource_donthit`, `modResource`.`privateweb` AS `modResource_privateweb`, `modResource`.`privatemgr` AS `modResource_privatemgr`, `modResource`.`content_dispo` AS `modResource_content_dispo`, `modResource`.`hidemenu` AS `modResource_hidemenu`, `modResource`.`class_key` AS `modResource_class_key`, `modResource`.`context_key` AS `modResource_context_key`, `modResource`.`content_type` AS `modResource_content_type`, `modResource`.`uri` AS `modResource_uri`, `modResource`.`uri_override` AS `modResource_uri_override`, `modResource`.`hide_children_in_tree` AS `modResource_hide_children_in_tree`, `modResource`.`show_in_tree` AS `modResource_show_in_tree`, `modResource`.`properties` AS `modResource_properties`, `modResource`.`alias_visible` AS `modResource_alias_visible` FROM `modx_site_content` AS `modResource` JOIN `modx_content_type` `ContentType` ON  ( `ContentType`.`binary` = '' AND ContentType.id = modResource.content_type )  WHERE  ( modResource.parent IN (297,309,308) AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 AND `modResource`.`class_key` IN ('modDocument','MODX\\Revolution\\modStaticResource') )  ORDER BY menuindex ASC, createdon DESC LIMIT 12

Sorry, my mistake.

The changed line in the snippet should be

$criteria['class_key:IN'] = array('MODX\\Revolution\\modDocument', 'MODX\\Revolution\\modStaticResource');

instead of the line I posted above.

this edit works.
“play: In da Club” :man_dancing:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.