We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    I’ve got a few template variables... wondering if I’m doing this correctly:

    [[!getResources? &parents=`35` &tpl=`my_tpl` &includeTVs=`1` &processTVs=`1` &tvFilters=`on_sale==1` &tvPrefix=``]]


    I’m trying to return all items that are on sale, but so far, I’ve been failing. My MySQL query is simple:

    select * from modx_site_tmplvar_contentvalues where contentid=37;


    But it’s baffling... the "checked" items still come through as an empty string... I’m baffled... how is MODx storing "checked" values?
      • 4172
      • 5,888 Posts
      To complete your post: some infos about your TV for us? for example input-option-values?

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        Good point, Bruno... my post was incomplete.

        It’s a Checkbox TV:

        Input Type: Checkbox
        Input Option Values: -- blank --
        Default Value: 0
        Output Type: Default

        It’s working for normal usage, but after looking at the database, I can’t figure out HOW it’s working... the value for that field doesn’t seem to change between the checked and unchecked states. The example document that uses this TV has a page ID of 37.

        Maybe I just need some sleep.... any ideas?

        Thanks!
          • 4172
          • 5,888 Posts
          well, I would say you need at least one input-option-value, for example: ’1’ or ’onsale==1’ - then you will have a value of 1 in the db, if checked

          I think your checkbox is working, because the default value is ’0’ - then with your blank input-option the value is blank, when checked.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 9207 ☆ A M B ☆
            • 2,475 Posts
            Thanks, Bruno. Good advice. Wow... when I added "1" as an input value (or more explicitly, "Is On Sale==1", my database query showed "1" as a value as soon as I saved the page. I’m still baffled as to how this was working before... perhaps it was using MySQL "IS NULL" or some such...

            I gotta update the docs on this because it’s really behaving in a way I didn’t expect:
            http://rtfm.modx.com/display/revolution20/Template+Variable+Input+Types