We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27302
    • 154 Posts
    Recently I asked on these forums about creating a Ditto call based upon a TV selection from a drop down menu. The resulting snippet works brilliantly and goes as follows
    <?php
    global $modx;
    $filter="";
    if (!empty($_POST['directorytype'])) $filter .= (empty($filter)?"":"|")."tvdirectorytype,".mysql_escape_string($_POST['directorytype']).",1";
    if (!empty($_POST['county'])) $filter .= (empty($filter)?"":"|")."tvcounty,".mysql_escape_string($_POST['county']).",1";
    return $modx->runSnippet('Ditto', array('parents'=>'146', 'depth'=>'4','id'=>'directory', 'tpl'=>'DirectoryTpl', 'tplFirst'=>'DirectoryTplFirst','sortBy'=>'createdon', 'dateSource'=>'createdon', 'dateFormat'=>'%d.%m.%Y', 'paginate'=>'1', 'display'=>'10', 'tplPaginatePage'=>'pageSplitter', 'tplPaginateCurrentPage'=>'currentPageSplitter', 'paginateAlwaysShowLinks'=>'1', 'filter'=>$filter, 'seeThruUnpub'=>'1','noResults'=>'no results'));
    ?>


    The problem is with pagination. This is the page in question http://ukactive.5ep.co.uk/uk-active-outdoors-directory

    If for example you select Campsites in Devon from the selectors at the top of the page and click on "Filter" the correct results are shown, and the pagination at the bottom of the screen correctly shows the number of pages for that particular search query.

    The problem is that when you clock on page 2, or Next and go to the next page of results the results shown are no longer based upon the filter criteria, and instead it now displays all documents. Is there something I need to add to the pagination placeholders to keep the filter selection for all following pages?
      • 36502 ☆ A M B ☆
      • 491 Posts
      I had a similar problem calling Ditto after a form submit.

      I resolved changing the form method from method="post" to method="get".

      I don’t know if it can help you...
        TilliLab | MODX Ambassador
        website