We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14730
    • 34 Posts
    Hi,

    I want to use a form to select an area and property type to display properties.
    Results on the same page.
    It’s not working out so far...

    In the form you can pick an area and a property type.
    After form submission (and page reload), the normal [[+fi.propertytype]] and [[+fi.area]] placeholders are populated.
    However, it doesn’t work with tvFilters:
    [[!getResources?
       &parents=`19`
       &tpl=`PropertyList`
       &tplFirst=`PropertyListFirst`
       &includeTVs=`1`
       &processTVs=`1`
       &showHidden=`1`
       &limit=`0`
       &tvFilters=`area==[[+fi.area]],propertytype==[[+fi.propertytype]]`
    ]]


    Without the tvFilters, all my properties are shown.
    If I manually replace the placeholders with valid values, the resources come up properly filtered.

    Anyone knows how to populated the placeholders before they’re being processed by getResources?
    (Or how to just get this working!)
      • 28215
      • 4,149 Posts
      Give this a shot:

      &tvFilters=`area==[[!+fi.area]],propertytype==[[!+fi.propertytype]]`
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 14730
        • 34 Posts
        Quote from: splittingred at Nov 04, 2010, 03:09 PM

        Give this a shot:

        &tvFilters=`area==[[!+fi.area]],propertytype==[[!+fi.propertytype]]`

        It didn’t work...
          • 12066
          • 48 Posts
          Hi,
          so my first post regarding issues with modx. Up to now everything’s great!

          But now I’m stuck, having the same issue as Jorik:

          [[!getResources? &parents=`[[*id]]` &tpl=`newsListOverviewItem` &tplFirst=`newsListOverviewFirstItem` &tplLast=`newsListOverviewLastItem` &limit=`6` &idx=`0` &showHidden=`1` &includeTVs=`1` &processTVs=`1` &hideContainers=`1` &includeContent=`1` &tvFilters=`tvRound==[[!+round]]`]]


          [[+round]] works fine when outside of [[!getResources]], if I replace it with an INT it works fine as well. Just when in [[!getResources]] it’s not working. The TV type is ’number’...

          Anybody got a solution?

          Thanks!
            • 14730
            • 34 Posts
            Hi,

            I think it has something to do with parsing order.
            I got it working by writing a custom snippet. I’m no php star, so there’s probably more elegant ways to do this.
            It worked with formit and formit retriever, so you might have to tweak it a bit...

            <?php
            /* grab the values of "id" and "round" */
            $id = $hook->getValue('id')
            $round = $hook->getValue('round');
            
            /* We're gonna parse our getResources, cut it up first
               I've put your "*id" and "round" at the end */
            // getResources head
            $grHead = '[[!getResources? &tpl=`newsListOverviewItem` &tplFirst=`newsListOverviewFirstItem` &tplLast=`newsListOverviewLastItem` &limit=`6` &idx=`0` &showHidden=`1` &includeTVs=`1` &processTVs=`1` &hideContainers=`1` &includeContent=`1` &parents=`';
            [[*id]]
            // Part after the "id"
            $grMid = '` &tvFilters=`tvRound==';
            [[!+round]]
            // Part after the "round"
            $grTail = '`]]';
            
            // Combine the grabbed values with getResources
            $combineVars = $grHead.$id.$grMid.$round.$grTail;
            
            // Echo the results and close the snippet
            echo $combineVars;
            return true;
            
            /* Instead of the echo, you can set a placeholder
               Place this snippet on your page and output wherever you put your placeholder
               $modx->setPlaceholder('placeholderName',$combineVars); */
            
            

            Good luck!