We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41647
    • 49 Posts
    thanks bruno!
    copied the processors into my component but now i got some errors in the childresources/update.php

    some variables aren't defined properly.
    when i try to ignore them the values still don't get saved.


    ... tried to copy them into the migx-directory but it doesn't work either :/



    (also the filter isn't working. may this has the same cause?)
      • 4172
      • 5,888 Posts
      if this errors are just enotices, set the system-setting debug to 0
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 41647
        • 49 Posts
        what I got as response from the controller:

        <b>Notice</b>:  Undefined variable: packageName in <b>D:\var\www\modx-default\core\components\migx\processors\mgr\childresources\update.php</b> on line <b>51</b><br />
        <br />
        <b>Notice</b>:  Undefined index: task in <b>D:\var\www\modx-default\core\components\migx\processors\mgr\childresources\update.php</b> on line <b>64</b><br />
        {"success":true,"message":"","total":0,"data":[],"object":{"id":23}}
          • 4172
          • 5,888 Posts
          this is one of my current childresources-update-processors

          <?php
          
          if (empty($scriptProperties['object_id'])) {
              $updateerror = true;
              $errormsg = $modx->lexicon('quip.thread_err_ns');
              return;
          }
          
          $config = $modx->migx->customconfigs;
          
          $includeTVList = $modx->getOption('includeTVList', $config, '');
          $includeTVList = !empty($includeTVList) ? explode(',', $includeTVList) : array();
          $includeTVs = $modx->getOption('includeTVs', $config, false);
          $classname = 'modResource';
          
          //$saveTVs = false;
          /*
          if ($modx->lexicon) {
          $modx->lexicon->load($packageName . ':default');
          }
          */
          if (isset($scriptProperties['data'])) {
              //$scriptProperties = array_merge($scriptProperties, $modx->fromJson($scriptProperties['data']));
              $data = $modx->fromJson($scriptProperties['data']);
          }
          
          $data['id'] = $modx->getOption('object_id', $scriptProperties, null);
          
          $parent = $modx->getOption('resource_id', $scriptProperties, false);
          $checkresponse = true;
          
          $task = $modx->getOption('task', $scriptProperties, '');
          
          switch ($task) {
              case 'publish':
                  $response = $modx->runProcessor('resource/publish', $data);
                  break;
              case 'unpublish':
                  $response = $modx->runProcessor('resource/unpublish', $data);
                  break;
              case 'delete':
                  $response = $modx->runProcessor('resource/delete', $data);
                  break;
              case 'recall':
                  $object = $modx->getObject($classname, $scriptProperties['object_id']);
                  $object->set('deleted', '0');
                  $object->save();
                  $checkresponse = false;
                  break;
          
              default:
          
                  //$modx->migx->loadConfigs();
                  //$tabs = $modx->migx->getTabs();
          
                  $data['context_key'] = $modx->getOption('context_key', $data, $scriptProperties['wctx']);
                  if ($includeTVs) {
                      $c = $modx->newQuery('modTemplateVar');
                      $collection = $modx->getCollection('modTemplateVar', $c);
                      foreach ($collection as $tv) {
                          $tvname = $tv->get('name');
                          if (isset($data[$tvname])) {
                              $value = $data[$tvname];
                              $data['tv' . $tv->get('id')] = $value;
                              unset($data[$tvname]);
                          }
                      }
          
                      $data['tvs'] = 1;
                  }
          
          
                  if ($scriptProperties['object_id'] == 'new') {
                      //$object = $modx->newObject($classname);
                      if (!empty($parent)) {
                          $data['parent'] = $parent;
                      }
                      $response = $modx->runProcessor('resource/create', $data);
                  } else {
                      //$object = $modx->getObject($classname, $scriptProperties['object_id']);
                      //if (empty($object)) return $modx->error->failure($modx->lexicon('quip.thread_err_nf'));
                      $response = $modx->runProcessor('resource/update', $data);
                  }
          }
          
          if ($checkresponse) {
              if ($response->isError()) {
                  $updateerror = true;
                  $errormsg = $response->getMessage();
              }
              $object = $response->getObject();
          }
          
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 41647
            • 49 Posts
            k, now the errors are gone.

            but my controller still has no data to save:
            {"success":true,"message":"","total":0,"data":[],"object":{"id":25}}


            so there has to be another mistake I do not see ...
              • 4172
              • 5,888 Posts
              Its working for me, I get:

              {"success":true,"message":"","total":0,"data":[],"object":{"id":82,"type":"document","contentType":"text\/html","alias":"","published":true,"pub_date":0,"unpub_date":0,"parent":81,"isfolder":false,"richtext":true,"template":16,"menuindex":0,"searchable":true,"cacheable":true,"createdby":1,"createdon":"2013-05-27 11:33:51","editedby":1,"editedon":"2013-05-27 14:23:09","deleted":false,"deletedon":0,"deletedby":0,"publishedon":"2013-05-27 11:33:51","publishedby":1,"donthit":false,"privateweb":false,"privatemgr":false,"content_dispo":0,"hidemenu":false,"class_key":"modDocument","context_key":"web","content_type":1,"uri":null,"uri_override":0,"hide_children_in_tree":0,"show_in_tree":1,"undefined":"","syncsite":1,"preview_url":"XXX"}}


              autoalias is on? may be you should generate an unique alias for each event.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 41647
                • 49 Posts
                have the same setting on both (the working and the not-working) installations.
                looked it up on the databse and all events have no alias.

                btw question: is it possible to use placeholder like [[+pagetitle]] in default value or anywhere else in the migx-configs? It is only said by the formcaption and I didn't want to try it everywhere ;-)
                  • 4172
                  • 5,888 Posts
                  same MODX - versions? same FURL - settings? etc?

                  there are only some fields which are processed.
                  I think not the default-value, but you can override all configurations in the
                  xxx.config.inc.php
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 41647
                    • 49 Posts
                    k, just updated the socond install from 2.2.6 to 2.2.7
                    but that didn't help either...
                    what makes me wonder is that the childresources/update.php never sent me an error on the first install?
                    so something has to different there...


                    @bruno: did it work for you when you followed just the steps in the readme? what migx-version did you have installed before? which modx-version? [ed. note: janein last edited this post 13 years, 4 months ago.]
                      • 41647
                      • 49 Posts
                      ok got it working now.
                      Seems like I just forgot to delete the database-tables between removing and reinstalling the package.
                      I changed the db-structure in the meantime.
                      or maybe it was something completely different - main thing is, that it works^^

                      thanks for your help!