We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    Quote from: Eminos at Oct 17, 2011, 08:05 AM
    First: Thanks for a great plugin! Very useful.

    I have a little problem with using a variable inside the where-json-string.
    I'm running a MIGX getImageList inside an other MIGX getImageList -template.

    [[getImageList? 
    &tvname=`migxProducts` 
    &where=`{"productGroupName:=":"[[+productGroupName]]","productItemType:=":"product"}` 
    &tpl=`migxProductsListRowTpl`]]


    It's seems that it's the
    [[+productGroupName]] 
    that breaks it all. I need to use that variable in the where string.

    Any clue of what's wrong or if there's a solution?

    Thanks in advance.

    Could test your scenario succesfully on mine.
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 23491 ☆ A M B ☆
      • 1,056 Posts
      Quote from: Bruno17 at Oct 18, 2011, 01:24 AM
      Also, for MIGX + Revo 2.2 compatibility this patch came in handy: https://gist.github.com/1266540
      added this patch with the last github-commit, but didn't test it myself.
      https://github.com/Bruno17/multiItemsGridTV/commit/e2c41d409732515dfb50a37298129745e559ddad

      Thanks!

      Thanks so much, Bruno17.

      BTW, what are your thoughts on this comment: https://forums.modx.com/thread/41006/migx---multiitemsgridtv-for-modx---revolution?page=18#dis-post-396298

      Basically, if you remove all items from a MIGX-Tv, you are left with "[]" in the database. What this does, unfortunately, is prevent the TV Default Value from being applied (even when no MIGX data is set...after being deleted), in addition to the original issue of failing to trigger output modifiers such as :empty / :default like you might expect.

      Would you see any issue with simply deleting the entry from `modx_site_tmplvar_contentvalues` to prevent these unwanted side effects?
        Mike Reid - www.pixelchutes.com
        MODx Ambassador / Contributor
        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
        ________________________________
        Where every pixel matters.
        • 4172
        • 5,888 Posts
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 8830
          • 98 Posts
          Quote from: Bruno17 at Oct 18, 2011, 01:50 AM
          Quote from: Eminos at Oct 17, 2011, 08:05 AM
          First: Thanks for a great plugin! Very useful.

          I have a little problem with using a variable inside the where-json-string.
          I'm running a MIGX getImageList inside an other MIGX getImageList -template.

          [[getImageList? 
          &tvname=`migxProducts` 
          &where=`{"productGroupName:=":"[[+productGroupName]]","productItemType:=":"product"}` 
          &tpl=`migxProductsListRowTpl`]]


          It's seems that it's the
          [[+productGroupName]] 
          that breaks it all. I need to use that variable in the where string.

          Any clue of what's wrong or if there's a solution?

          Thanks in advance.

          Could test your scenario succesfully on mine.

          I'm running MODx 2.1.2-pl on that site. Could it be something with that version of MODx? I'm guessing you're running the latest version 2.1.3?
          Is there a way to find out what's wrong without trying to replicate the problem in different versions of MODx? Error log isn't giving me anything useful.

          EDIT: I deleted all resources and chunks and started over. Then it worked. Very very wierd. .. Great plugin smiley [ed. note: Eminos last edited this post 14 years, 11 months ago.]
            • 36760
            • 136 Posts
            Hopefully this is a good place for this.

            I'm looking to remove the comma from the last item in a MIGX list. I've found a few ways of doing it in PHP, I'm just not sure how to put it all together.

            Below is my frontend MIGX call, it's used for an existing jQuery image slider I was asked to integrate with Modx. Usually I don't use these types of sliders because of this issue, but now seemed like a good time to figure out if there's a way to do it.

            [[!getImageList? &tvname=`imageSlider` &tpl=`@CODE:["[[+image]]"],`]]


            I just need the last line to not have a comma after the final closing bracket.

            I appreciate any help.
              • 14951
              • 151 Posts
              @firebot6... Try this.. Untested but I think it should work.
              [[!getImageList? &tvname=`imageSlider` &tpl=`@CODE:["[[+image]]"][[+_last:ne=`1`:then=`,`]]`]]


              EDIT: Come to think of it....This "might" work too.. and less code:
              [[!getImageList? &tvname=`imageSlider` &tpl=`@CODE:["[[+image]]"][[+_last:default=`,`]]`]]
                • 4172
                • 5,888 Posts
                try this:
                [[!getImageList? 
                &tvname=`imageSlider` 
                &tpl=`@CODE:["[[+image]]"]`
                &outputSeparator=`,`
                ]]
                

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

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 36760
                  • 136 Posts
                  &outputSeperator did the trick. Not sure why that didn't hit me when I was looking through the documentation.

                  Thank you both for your help.
                    • 8830
                    • 98 Posts
                    Is there a way to get a unique ID for every list item in MIGX? Like [[+idx]] but not the ID for every item in the OUTPUT but every item in the MIGX list. I could just create a column in the MIGX list for the ID, but then I have to manage all the IDs my self.
                      • 14951
                      • 151 Posts
                      Hey @Eminos,

                      I'm sure that @Bruno17 has a much more intelligent response than I, but I try to help as often as I can just to reduce the workload he has keeping up with all this.

                      If I'm understanding you correctly... you're using a "where" clause to remove certain items from the output, but you'd like all items to have a unique ID regardless of whether or not they are in the output?

                      There are a couple of ways I think.... that you could accomplish this depending upon what you are going to do with the ID information.

                      One would be to modify the getImageList snippet just before the "where" filter and use a foreach loop to add an ID to each item.

                      If you wanted to take an "upgrade safe" approach...albeit a little more clunkity.. The second possibility would be to create a custom TV input type that auto increments. I imagine that this would either require a custom db table or some time of flat file db to keep track.

                      Now... for Bruno to come in with a thousand times better and easier approach smiley

                      This discussion is closed to further replies. Keep calm and carry on.