Answer the question
In order to leave comments, you need to log in
How to select resources in Fenom without a snippet?
Friends! Please tell me what I'm doing wrong.
I want to make a selection of the last added resources - goods.
There is a tree of resources - goods minishop2
-Main (1)
-Catalog (3)
---Category of goods (4)
-------Product()
......
......
---Category goods (5)
-------Product()
......
......
On the main page I call like this, I still use the snippet
{set $newproducts = $_modx->runSnippet('!msProducts', [
'parents' => 3,
'includeThumbs' => 'small,mobilesmall',
'showHidden' => 0,
'showUnpublished' => 0,
'limit' => 4,
'where' => [
'class_key:=' => 'msProduct',
]
])}
{foreach $newproducts as $item}
{$item['menutitle']}
{/foreach}
{var $newproduct = $_modx->getResources(
[
'parents' => 3,
'published' => 1,
'deleted' => 0,
'showHidden' => 0,
'showUnpublished' => 0,
'sortby' => 'menuindex',
'select' => 'id,menutitle'
])
}
{foreach $newproduct as $item}
{$item.menutitle}
{/foreach}
Answer the question
In order to leave comments, you need to log in
Why no snippet, what's the difference?
Type design
{set $products = '!pdoResources' | snippet : [
'return' => 'json',
....
] | json_decode : true}
{foreach $products as $product}
...
{/foreach}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question