We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22244
    • 144 Posts
    Does it work together with simplesearch?

    If so, is there a small example to get me started.

    Thanks and good job.. this is a very cool plugin!
      • 34120
      • 236 Posts
      Thanks for the great snippet!

      I’m running the following snippet:
      [[!Rowboat?
         &table=`bacat_products`
         &tpl=`baProducts`
         &where=`{"category_id":[[*id]], "subcategory_id":[[+subCatId]]}`
         &sortBy=`id`
      ]]

      This works fine and as intended for the likes of the following request eg.
      products.html?subcatid=3


      The problem is when I first arrive on products.html (ie. no subcatid is defined) then rowboat still runs and displays all records. So I need something like ’if subcatid isnotset then do nothing’

      Any help much appreciated.
        • 28215
        • 4,149 Posts
        [[!+subcat:notempty=`[[!Rowboat?
           &table=`bacat_products`
           &tpl=`baProducts`
           &where=`{"category_id":[[*id]], "subcategory_id":[[+subCatId]]}`
           &sortBy=`id`
        ]]`]]
        


        should work.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 34120
          • 236 Posts
          Thanks for the reply, this seems to solve the notempty problem but breaks the subcatid query, all records are displayed regardless of subcatid. I’m wondering if it’s a caching issue?
          [[!getId]] //sets subCatId placeholder 
          [[!+subCatId:notempty=`[[!Rowboat?
             &table=`bacat_products`
             &tpl=`baProducts`
             &where=`{"category_id":[[*id]], "subcategory_id":[[+subCatId]]}`
             &sortBy=`id`
          ]]`]]


          Edit: Just found this http://bugs.modx.com/issues/3857 is this a confirmed bug? Seems similar to the problem I’m having.
          Sorry this is going a bit off the rowboat topic.
            • 34120
            • 236 Posts
            I’m trying out runSnippet to hopefully give me more control but I’ve hit a problem with the where clause.
            $products_subnav = $modx->runSnippet('Rowboat',array(
               'table' => 'bacat_subcategories',
               'tpl' => 'baSubcategory',
               'where' => '{"parent":"[[*id]]"}',
               'sortBy' => 'id',
               'debug' => '1'
            ));

            This doesn’t return any records but the debug outputs says the correct parent id value is being passed. If I replace [[*id]] with a numeric value the relevant records are returned. The debug output is identical for both, stumped.

            MODx Revolution 2.0.8-pl (traditional) | xampp 1.7.4 | PHP: 5.3.5

            Edit: Solved this with a workaround:
            //Added the following line
            $id = $modx->resource->get('id');
            
            and changed the following
            'where' => '{"parent":"' . $id . '"}',
            
            This avoids using a placeholder which seemed to be the cause of the problem.
              • 22244
              • 144 Posts
              The strange thing is that I have a table brands. I have created 4 rows with my module. (adjusted Doodles module)

              I can see this table in the database with the 4 rows.

              Now when I use the rowboat call like this:

              [[!Rowboat?
              &table=`modx_brands`
              &tpl=`brandsTpl`
              &limit=`10`
              &sortBy=`name`
              ]]

              I only see 2 results in the output.
              This should be 4 according to the table. Removing the limit 10 resolves the issue but that doesn’t make sense.

              The limit should count the rows and show at least the 4 available rows. So somehow the limit is not working.
                • 27733
                • 99 Posts
                I am using rowboat in another snippet to return a single value from a custom table. I’m just looking for the value and thus am not using the tpl param in my call. Using debug mode, I see that the query is working fine and getting the correct value. The documentation claims that if you omit the tpl param, rowboat should return an array. However, it’s returning a string representation of an array [ i.e., what you would see if you’d run print_r($result) ]. Is this intentional, or essentially a TBD item for the snippet? If I go in and alter rowboat to return an actual array, will that negate some other functionality of the snippet? Thanks for your input!
                  ------
                  Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.
                  • 28215
                  • 4,149 Posts
                  Snippets in MODX Revolution can only return strings.
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 27733
                    • 99 Posts
                    OK, that answers that question wink

                    Now, conceivably might it be more useful to return a json-encoded string instead ... so it can be more easily decoded (thus not requiring so much processing of the string via explode to get it back into a real array)? This could be set via a new param (e.g., "returnJSON"). I realize this would be limited to the php 5.2+ crowd, but that could be tested for before attempting to encode. Could this be a desirable alteration to the rb snip?
                      ------
                      Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.
                      • 28215
                      • 4,149 Posts
                      Quote from: smg6511 at Apr 19, 2011, 02:11 PM

                      OK, that answers that question wink

                      Now, conceivably might it be more useful to return a json-encoded string instead ... so it can be more easily decoded (thus not requiring so much processing of the string via explode to get it back into a real array)? This could be set via a new param (e.g., "returnJSON"). I realize this would be limited to the php 5.2+ crowd, but that could be tested for before attempting to encode. Could this be a desirable alteration to the rb snip?
                      Sure. Can you file a feature request for it?

                      http://bugs.modx.com/projects/rowboat/issues
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com