How to list resources published in particular month of the year and also else than this, between two particular dates?

Hi can anyone guide me the way to list resources ( Products in my case ) published in one particular month of the year or between two particular dates ? I see, it would be somewhere near by sortby / sortByTV or publishedon properties but am unable to achieve the results … below is my current getPage Call.

                        [[getPage?
                        &element=`getResources`
                        &parents=`[[*id]]`
                        &limit=`6`
                        &includeContent=`1`
                        &includeTVs=`1`
                        &processTVs=`1`
                        &showHidden=`1`
                        &sortby=`publishedon`
                       	&tvFilters=`[[tv.publishedon]]<<[[!getDate:date=`%Y-%m`]]` 
                        &sortdir=`DESC`
                        &tpl=`news-list`
                        &totalVar=`total`
                        &pagePrevTpl=`<li class="pagination-prev"><a href="[[+href]]"><span class="zn_icon" data-zniconfam="glyphicons_halflingsregular" data-zn_icon=""></span></a></li>`
                        &pageNextTpl=`<li class="pagination-next"><a href="[[+href]]"><span class="zn_icon" data-zniconfam="glyphicons_halflingsregular" data-zn_icon=""></span></a></li>`
                        &pageActiveTpl=`<li class="active" class="page-[[+pageNo]]"><span style="display: inline-block;">[[+pageNo]]</span></li>`
                        &pageNavTpl=`<li><a href="[[+href]]"><span>[[+pageNo]]</span></a></li>`
                        &pageNavOuterTpl=`[[+prev]][[+pages]][[+next]]`
                        ]]

Also, pagination is not working in the above last call.

Thanks,
Ronak

This older Thread should help you out.

In regards to your pagination, do you call it below the getPage call with something like this?

[[!+page.nav:notempty=`
   <div class='paging'>
      <ul class='pageList'>
         [[!+page.nav]]
      </ul>
   </div>
`]]

Also if your shop has a significant amount of products to list, I would suggest switching to pdoPage and pdoResources (both part of the pdoTools Extra) which have much better performance and use almost the same syntax. I just switched to pdoTools in my Shop as well an noticed a clear improvement in the loading time of my products.

Hi, I tried following property in getPage call to get items between two particular dates but super confused …

&where=`{"publishedon:>":1385769600}` - Working
&where=`{"publishedon:>":1385769600, "AND:publishedon:>":1401494400}` - Working
&where=`{"publishedon:>":1385769600, "AND:publishedon:<":1401494400}` - Failed

The problem is coming from ‘<’ in the last statement.

It seems like modx cosiders ‘<’ in a different manner, may be as start of html tag but I am not sure, but because of this, I am not able to make it work. Anyone has any update ?

Thanks,
Ronak

Syntax looks fine to me, are you sure you have resources that were published between those times? Or are you getting errors in the MODX log?

The listing issue is resolved … dont know but hard refreshing two to three times resolved the issue. @markh thanks for your reply.

1 Like

Hey,

Pagination also got resolved. Thanks guys for your help !!

Thanks,
Ronak

1 Like