Community

getResources not working

Hi, I am absolutely new to MODX. I want to list featured products on my Home Page template and I am using but its absolutely giving me nothing. I do not know where is the issue. Anyone has any answer ? Please reply fast.

[[!getResources?
&tpl=featured-product-list
&parents=-1
&resources=[[*featured_products]]
&includeTVs=1
&processTVs=1
&includeContent=1
&limit=3
&toPlaceholder=featured_products
]]
[[+featured_products:neq=``:then=`

        <div class="eluidd541934e  col-md-12 col-sm-12    zn_sortable_content zn_content " data-droplevel="2">

            <div class="latest_posts acc-style eluid8245254c ">
                <h3 class="m_title"><span class="ff-alternative">[[*home_section8_title]]</span></h3>
                <a href="[[~6]]" class="viewall">VIEW ALL -</a>
                <div class="css3accordion">
                    <ul>
                        [[+featured_products]]
                    </ul>
                </div>
                <!-- end CSS3 Accordion -->
            </div>
            <!-- end acc-style -->

        </div>

    </div>
</div>

`]]

I even tried to find out when a product is declared as featured product but could not find anything out there in the community or in the documentation. Plus, whenever I try to edit getResources snippet code to debug, it allows me to save but as soon as I reload the page, the change is gone. It even does not show any message or anything as why it is behaving so. I checked online for community support and came to know that many other people have faced the same problem but solution has been different and each and every different person. I tried all those things but could not succeed.

There is a recent products list widget called through getResource is working in products page sidebar but as soon as I copy pasted it in my home page template, it does not work there. Why so ?

Hey ronaksmpt,

Welcome to the MODX forums :slight_smile:

If things aren’t working out too well I always suggest stripping things back to basics and building up from there until you hit a breaking point. What is the value that is being outputted by featured_products tv? The &resources= call expects a comma delimited list of resource ids eg: 1,2,3,4,5.

I’d suggest checking out this video that explains a little bit about fetching resource data, though the video uses pdoResources rather than getResources, but they are syntactically very similar.