We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36632
    • 202 Posts
    Try the code attached above. It came from my host who got it from a MODX dev AFAIK.
      • 3749
      • 24,544 Posts
      Quote from: frogabog at Aug 11, 2012, 04:27 PM
      In tools-> property sets it shows up like a container for the existing DefaultResourceGroup plugin. Not editable.

      You might want to add a comment to this bug report I filed a while ago (or, probably better, create a new one) :http://tracker.modx.com/issues/8037

      You might also want to try deleting the property set and recreating it in Tools->Property Sets. Then attach it to the element there and save it again.



      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        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
        • 36632
        • 202 Posts
        Quote from: ultrasef at Jul 16, 2012, 12:23 PM
        I too thought this was the answer but the Snippet+PropertySet calls didn't function. They didn't display the sortby, limit nor resource properties as specified by the PS.

        My host provided me with this patch (code below) for the
        core/model/modx/processors/element/propertyset/get.php

        This affected 2 of my Revo sites.



        <?php
        /**
         * Grabs a property set
         *
         * @package modx
         * @subpackage processors.element.propertyset
         * @var modX $modx
         */
        if (!$modx->hasPermission('view_propertyset')) return $modx->error->failure($modx->lexicon('permission_denied'));
        $modx->lexicon->load('propertyset');
        
        /* if getting properties for an element as well */
        if (!empty($scriptProperties['elementId']) && !empty($scriptProperties['elementType'])) {
            /** @var modElement $element */
            $element = $modx->getObject($scriptProperties['elementType'],$scriptProperties['elementId']);
            if ($element) {
                $default = $element->get('properties');
                if (!is_array($default)) $default = array();
            }
        }
        
        /* if no id specified */
        if (!isset($scriptProperties['id']) || $scriptProperties['id'] == '') {
            return $modx->error->failure($modx->lexicon('propertyset_err_ns'));
        }
        /* if grabbing a modPropertySet */
        if ($scriptProperties['id'] != 0) {
            /** @var modPropertySet $set */
            $set = $modx->getObject('modPropertySet',$scriptProperties['id']);
        
        } elseif (isset($default)) {
            /* if grabbing default properties for an element */
            $isDefault = true;
            $set = $modx->newObject('modPropertySet');
            $set->set('id',0);
            $set->set('name',$modx->lexicon('default'));
            $set->set('properties',$default);
        }
        
        if (empty($set)) {
            return $modx->error->failure($modx->lexicon('propertyset_err_nfs',array('id' => $scriptProperties['id'])));
        }
        
        
        /* get set properties */
        $properties = $set->get('properties');
        if (!is_array($properties)) $properties = array();
        
        /* first create temporary array to store in */
        $data = array();
        
        /* put in default properties for element */
        if (isset($default)) {
            foreach ($default as $property) {
                if (!empty($property['options']) && is_array($property['options'])) {
                    foreach ($property['options'] as &$option) {
                        if (empty($option['text']) && !empty($option['name'])) $option['text'] = $option['name'];
                        $option['text'] = !empty($property['lexicon']) ? $modx->lexicon($option['text']) : $option['text'];
                    }
                }
        
                $data[$property['name']] = array(
                    $property['name'],
                    $property['desc'],
                    !empty($property['type']) ? $property['type'] : 'textfield',
                    !empty($property['options']) ? $property['options'] : array(),
                    $property['value'],
                    !empty($property['lexicon']) ? $property['lexicon'] : '',
                    false,
                    $property['desc_trans'],
                    !empty($property['area']) ? $property['area'] : '',
                    !empty($property['area_trans']) ? $property['area_trans'] : '',
                );
            }
        }
        
        /* now put in set properties */
        foreach ($properties as $property) {
            $overridden = false;
            /* if overridden, set flag */
            if (isset($data[$property['name']]) && !isset($isDefault)) {
                $overridden = 1;
            }
            /* if completely new value, unique to set */
            if (!isset($data[$property['name']]) && !empty($scriptProperties['elementId'])) {
                $overridden = 2;
            }
        
            foreach($property['options'] as &$option) {
                if (empty($option['text']) && !empty($option['name'])) $option['text'] = $option['name'];
                $option['text'] = !empty($property['lexicon']) ? $modx->lexicon($option['text']) : $option['text'];
            }
        
            $data[$property['name']] = array(
                $property['name'],
                $property['desc'],
                !empty($property['type']) ? $property['type'] : 'textfield',
                !empty($property['options']) ? $property['options'] : array(),
                $property['value'],
                !empty($property['lexicon']) ? $property['lexicon'] : '',
                $overridden,
                $property['desc_trans'],
                !empty($property['area']) ? $property['area'] : '',
                !empty($property['area_trans']) ? $property['area_trans'] : '',
            );
        }
        
        /* reformat data array for store */
        $props = array();
        foreach ($data as $key => $d) {
            $props[] = $d;
        }
        $set->set('data','(' . $modx->toJSON($props) . ')');
        
        return $modx->error->success('',$set);
        

          • 10208 ☆ A M B ☆
          • 1,780 Posts
          I think I've figured out what my particular problem is...

          I'm looking for the new property set in the wrong place. It seems the dropdown is no longer at the upper left of the grid, but rather in the middle. So, I was seeing it (as noted above), and could select it but since the name in the grid itself (drg_groups) did not change I assumed I was still looking at the original/default set.

          Bob, in your defaultResourceGroup instructions, this should be changed:

          "7. You should see the Property Set name at the upper left of the grid"

          I was looking in the grid itself. I needed to be looking above the grid at the dropdown button. The property itself is the same as it was under default, I didn't realize that. I was thinking I would be also creating a new drg_groups property for the new set.
            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
            • 3749
            • 24,544 Posts
            Done. Thank you. Sorry for the confusion.


            ------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using.
            MODX info for everyone: http://bobsguides.com/modx.html
              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
              • 1343 ☆ A M B ☆
              • 2,213 Posts
              This fix has already been merged into the main branch (see: https://github.com/modxcms/revolution/pull/333)
                Patrick | Server Wrangler
                About Me: Website | Tweets |  MODX Hosting