We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49261
    • 18 Posts
    That's legit! Thanks a million! *whew* that helps a lot



    That's for everyone who replied. Thanks!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I'm sure BobRay will come up with the perfect snippet code for you.

      I was working with databases in dBase and FoxPro, even taught a class on building your own database with QuickBasic, so I tend to think in terms of raw database access in the case of one-off applications like this.
        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
        • 49261
        • 18 Posts
        I totally agree. It just makes sense.
          • 3749
          • 24,544 Posts
          The reason I put in the original criterion is so that the snippet wouldn't change the class_key fields of SymLinks, WebLinks, and Static Resources.

          To do that and specify a parent, it would look like this:

          $parent = 12; // Set to desired parent ID.
          $docs = $modx->getCollection('modResource', array('class_key' => 'modDocument', 'parent' => $parent));
          $newValue = 'Taxonomy';
           
          foreach($docs as $doc) {
             $doc->set('fieldName', $newValue);
             $doc->save();
          }
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting