We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36613
    • 328 Posts
    I hava e form for research in front end the item of migx. I use blocX and i have this file config:
    <?php
    $contratto = $modx->getOption('contratto',$_REQUEST,'');
    $mentratura = $modx->getOption('mentratura',$_REQUEST,'');
    
    $wheres = array();
    if (!empty($contratto)){
    if($contratto!=''){
    $wheres[] = array('contratto'=>$contratto);
    }
    };
    
    
    if (!empty($mentratura)){
    if($mentratura!=''){
    
    $wheres[] = array(
    'mentratura' . '>' => $mentratura ,
        );
    
    }
    };
    
    $config['where'] = $modx->toJson($wheres); 


    But don't work whith $mentratura value.
    I want do this:

    Select * from MY_TABLE Where mentratura >= $mentratura


    Help me smiley




      • 4172
      • 5,888 Posts
      I think, it should look like that:

      <?php
      
      $contratto = $modx->getOption('contratto', $_REQUEST, '');
      $mentratura = $modx->getOption('mentratura', $_REQUEST, '');
      
      $wheres = array();
      if (!empty($contratto)) {
          $wheres[] = array('contratto' => $contratto);
      }
      
      if (!empty($mentratura)) {
          $wheres[] = array('mentratura:>=' => $mentratura);
      }
      
      $config['where'] = $modx->toJson($wheres);
      
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 36613
        • 328 Posts
        Wow thanks Bruno for very quick support smiley Where is I found the bloX documentation ? Beacause now i want do a pagination of my result but don't found any example of this.
          • 4172
          • 5,888 Posts
          the default getdatas - class does use its own pagination
          https://github.com/Bruno17/bloX/blob/master/core/components/blox/projects/blox/modTable/table/includes/getdatas.class.php

          you just need to set a limit and have the [[+pagination]] - placeholder in you outer - tpl like here:

          https://github.com/Bruno17/bloX/blob/master/core/components/blox/projects/blox/modTable/div/templates/bloxouterTpl.html

          but you can allways create your own custom getdatas-class to make it compatible with getpage, if you don't like the internal pagination
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 36613
            • 328 Posts
            I used [[+pagination]] but the link of pagination lost the get parameter of first page url. The url page of research is this: http://www.mysite.com/ads/?price=3&cat=45&mq=60
            the pagination html is this:

            <ul class="page-numbers">
             <li class="active"><a href="javascript:void(0)"><span id="page-numbers current">1</span></a></li> <li><a href[b]="ads/?page=2"[/b]>2</a></li> <li><a href[b]="ads/?page=3"[/b]>3</a></li> <li><a href[b]="ads/?page=2"[/b]>></a></li> 
            </ul>
            


            but should be:
            <ul class="page-numbers">
             <li class="active"><a href="javascript:void(0)"><span id="page-numbers current">1</span></a></li> <li><a href[b]="ads/?price=3&cat=45&mq=60&page=2"[/b]>2</a></li> <li><a href[b]="ads/?price=3&cat=45&mq=60&page=3"[/b]>3</a></li> <li><a href[b]="ads/?price=3&cat=45&mq=60&page=2"[/b]>></a></li> 
            </ul>
            


            you can help me ?
              • 36613
              • 328 Posts
              There isn't any solution ?
                • 4172
                • 5,888 Posts
                sure, there is a solution.
                you would need a custom getdatas.class.php

                where you put the needed query-string into the original_query_string - property

                https://github.com/Bruno17/bloX/blob/master/core/components/blox/projects/blox/modTable/div/includes/getdatas.class.php#L49

                        $p = new Pagination(array(
                            'per_page' => $this->bloxconfig['limit'],
                            'num_links' => $this->bloxconfig['numLinks'],
                            'cur_page' => $this->bloxconfig['page'],
                            'total_rows' => $numRows,
                            'page_query_string' => $this->bloxconfig['pageVarKey'],
                            'use_page_numbers' => true,
                            'original_query_string' => $yourOriginalQueryStringGoesHere
                    ));


                Do not hack the original getdatas.class, but create a new one under /projects/custom/yourtask/includes/
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 36613
                  • 328 Posts
                  Ok thanks you.