Multiple Page Type filters within a Page List block

Hi all,

I've run into a challenge where by I could do with creating a page list block that filters not just by one Page Type but rather two, so that the resultant list of pages are of either Page Type X or Page Type Y.

I've delved into the core page_list code and can see where the filterByCollectionTypeID function is used to set a filter on the query but I get a little lost as this transitions into the executable code within the core database_item_list.php.

From my limited knowledge, I'm not quite sure as to how I should override the code to include this logical OR into this filter.

Any guidance or help would be appreciated.



View Replies: View Best Answer
tofraser replied on at Permalink Best Answer Reply
This is an abbreviated version of what can be found here:

  $pl = new PageList();
 //Filters by page type handles. $ctHandle can be array of page type handles.
  // Get the page List Results 
  $pages = $pl->getPage(); //Get all pages that match filter/sort criteria.
// Display Page Name and Description
  foreach ($pages as $page){
    echo $page->getCollectionName();
    echo $page->getCollectionDescription();
dbaggs replied on at Permalink Reply
Thanks Tim,

It was right under my nose I guess. I've now overridden the Page List Block controller getPageList method and utilised the filterByCollectionTypeHandle method instead of the filterByCollectionTypeID for the scenario where I needed to handle it differently.

Works great.


tofraser replied on at Permalink Reply
wbargent replied on at Permalink Reply
What file did you place the code in?
tofraser replied on at Permalink Reply
Something like this could be placed into a page template.