We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21414
    • 41 Posts
    Description of Problem:
    I'm using rowboat to return a list of categories for products within a site I'm working on, and I'm trying to use the &where parameter with the "IN" operator (similar to below) except it doesn't seem to be accepting it no matter how I attempt to format it.

    The DB table is simply two columns: "product_id" and "category_id"

    [[!Rowboat?
            &table=`modx_ms2_product_categories`
            &tpl=`categoryIds`
            &limit=`0`
            &where=`{"product_id":[1,2,3]}`
            ]]
    




    I have also attempted to use:

    &where=`{"product_id:=":1, "OR:product_id:=":2, "OR:product_id:=":3}`


    which does work, but if I try to pass more than say 5 or 6 OR's it returns unexpected results (only the results for the first two and ignoring the rest for example)

    Has anyone else experienced anything like this before, or know of a reason why the &where parameter is doesn't seem to accept "IN" properly?



    • MODX Version: MODX Revolution 2.2.14-pl (traditional)
    • PHP Version: 5.3.10-1ubuntu3.9
    • Database (MySQL, SQL Server, etc) Version: 5.5.31-0ubuntu0.12.04.2
      • 4172
      • 5,888 Posts
      what about:

      &where=`{"product_id:IN":[1,2,3]}`


      this would work with migxLoopCollection. Not sure, if with rowboat too.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 21414
        • 41 Posts
        Quote from: Bruno17 at May 23, 2014, 07:53 AM
        what about:

        &where=`{"product_id:IN":[1,2,3]}`


        this would work with migxLoopCollection. Not sure, if with rowboat too.


        Just noticed I left out the "IN" in my example... yeah that didn't work with rowboat... haven't tried the migxLoop, i'll check it out and give it a go.

        Thanks!

          • 21414
          • 41 Posts
          Thanks for the suggestion Bruno. migxLoopCollection worked great.