We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19967
    • 2 Posts
    hi creativejay

    ive installed tvexplorer , copied your code as you detailed above and this is my call

    [[tvExplorer?&dittoName=`ditt`&dittoSnippetParameters=`tpl:ProductSearchTpl|parents:128|depth:3|display:all|paginate:1|sortBy:pagetitle|sortDir:asc|hideFolders:1`&formTPL=`tveProductSearch`]]

    so im baffled, i have to close all the gaps up or i get a the following error

    PHP error debug
    Error: Invalid argument supplied for foreach()
    Error type/ Nr.: Warning - 2
    File: C:\xampp\htdocs\xampp\modxe\assets\modules\tvEditor\class\tveditor.class.php
    Line: 785
    Line 785 source: foreach($tvFormElements as $name => $element){


    then when i close the gaps i get

    dittoName is missing. This parameter is mandatory

    any ideas im baffled, if you could help me ill be very grateful, maybe you could go back to basics, iv been fiddling with tvexplorer for a while now with no luck...

    many thanks in advanced




      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I’m pretty sure you need a space between the ? and the leading &; either that or skip the leading & and have dittoName immediately follow the ? with no space.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 10357
        • 573 Posts
        This is such a great snippet, and its real shame that development stopped.

        Does anyone know how to fill a tvExplorer select box with template vars?

        I have got close, but no cigar:

        getModel snippet (Lists all entries for my model tv)
        <?php
        $result = $modx->db->query('SELECT DISTINCT `value` FROM `modx_site_tmplvar_contentvalues` WHERE `tmplvarid` = 3 ORDER BY `value` ASC');
        $models = $modx->db->makeArray( $result ); 
        foreach($models as $model){
        $output .=$model['value'].'=='.$model['value'].'||';
        }
        return $output;
        ?>


        cars chunk
        [[getModel]]



        tvExplorer place holder

        [+tve.model:#RANGE{tvtype->dropdown:label->Make & Model:elements->@Chunk cars:filter->9:blankLabel->(Any)}+]
        


        end result select box:


        If I manually put the values outputted by my getModel snippet into my car chunk it works as it should do.

        any ideas how to fix this?

        many thanks,
        Gareth

          • 5950
          • 44 Posts
          Are you just trying to get it to show a value other than the usual "Please select" message? Or are you trying to preselect a certain value?

          For the former, I think you can simply remove the ’blanklabel’ parameter. Whichever value you want to have listed first, just make sure it’s first in your values list in the associated tv.

          Edited: I’m noticing that what you’re trying to do may be more complex than I originally understood. Sorry if that’s the case!
            • 5950
            • 44 Posts
            Now I’ve got another issue of my own.

            Filters don’t seem to be displaying the appropriate lists, so I’m starting to think it has something to do with my values.

            I had changed my values from words (1==one||2==two||4==four||8==eight||...) back to numbers, adding zeros to create the appropriate length for a search (1==1000||2=2000||4==40000||8=8000||...).

            Then I tried to use filter->3 in my select placeholders. The results keep coming back wrong, or not at all. The only one that seems to work correctly using greater than/less than filters is filter->4. Filters 1, 7 and 9 also seem to work. Contrariwise, their counterparts 2 and 8, do not.

            Are my zeros throwing off the way the values are read? Are they still not ’numbers’ in the eyes of ditto?
              • 5950
              • 44 Posts
              Quote from: creativejay at Apr 19, 2010, 03:32 PM


              Filters don’t seem to be displaying the appropriate lists, so I’m starting to think it has something to do with my values.

              Are my zeros throwing off the way the values are read? Are they still not ’numbers’ in the eyes of ditto?

              I changed my numbers to not begin or end in zero (thinking of how once an e-commerce cart dropped the leading 0 in my zip code), but that had no effect.

              So I went into tvExplorer in the manager and saw this error:

              Warning: htmlspecialchars() expects parameter 1 to be string, array given in [redacted]/assets/snippets/ditto/classes/ditto.class.inc.php on line 1040

              That line is:

              					$query[htmlspecialchars($param, ENT_QUOTES)] = htmlspecialchars($value, ENT_QUOTES);
              


              Is this the source of my headache?
                • 11975
                • 2,542 Posts
                Hi,

                sorry for non answering ealier but I’m missing time sad
                I’m not sure that your issue is related to the ditto code.
                I posted long time ago a fix to apply to the function.
                It should be in this thread or in tveditor one.
                (Found => http://modxcms.com/forums/index.php/topic,16456.msg123881.html#msg123881)

                About filtering numbers, it’s a bit harsh because every number is converted to string( don’t remeber why but this is not related to tvexplorer).
                You sould also consider that filter reference in ditto have changed in the latest version and tvexplorer is based on the ditto 2 version so the opposite filter could be wrong.

                :)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 5950
                  • 44 Posts
                  Thanks for taking the time to answer me, Heliotrope. smiley

                  Quote from: heliotrope at Apr 20, 2010, 11:55 AM

                  I posted long time ago a fix to apply to the function.
                  It should be in this thread or in tveditor one.
                  (Found => http://modxcms.com/forums/index.php/topic,16456.msg123881.html#msg123881)


                  Does that apply to Ditto 2.1.0? I added/changed the lines and get a Parse/syntax error on any page with a ditto call. (edited: Solved, I accidentally commented out a necessary ’}’)

                  Quote from: heliotrope at Apr 20, 2010, 11:55 AM

                  About filtering numbers, it’s a bit harsh because every number is converted to string( don’t remeber why but this is not related to tvexplorer).
                  You sould also consider that filter reference in ditto have changed in the latest version and tvexplorer is based on the ditto 2 version so the opposite filter could be wrong.

                  I’m taking my filter numbers from http://ditto.modxcms.com/tutorials/basic_filtering.html

                  I might consider downgrading to Ditto 2.0.2 because this is pretty mission critical for this site.. Unfortunately I have MANY ditto calls across the site and I worry how the version might affect them. But if I can’t figure this out then changing calls for an older version would probably be faster than wrestling with this!
                    • 11975
                    • 2,542 Posts
                    You should first try to disable the opposite filter.
                    Add the right param, it should be listed in my first post

                    :)
                      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                      • 10357
                      • 573 Posts
                      Hi heliotrope,

                      I love this snippet smiley Is there anyway to create a drop down select box from a list of tv entries? You can see my attempt a few posts back.

                      thanks,
                      G