We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24865
    • 289 Posts
    Hey guys,

    I’ve been working on a project that uses VisionCart in it’s core for extension purposes, but I don’t want it extending VisionCart, I want to use the functionaly. That’s all fine and good (and relatively simple), but here comes the kicker!

    Back in december I requested the Extension Packages and since then it has been upgraded with a serviceName and class, which is also great. Now the real problem starts at using the session and lexicons. They are not yet initialized! Plus, the scripts that you register with regClientStartupScript appear ABOVE the MODx JS init, so I can’t fetch MODx.siteId and MODx.config for my own class.

    So, I don’t know what future repercussions this could have for MODx or the extension packages (and those that are already out there), but I reckon this is a bit of a bug or rather an improvement.

    The current code is like this:
                $this->getCacheManager();
                $this->getConfig();
                $this->_initContext($contextKey);
                $this->_loadExtensionPackages();
                $this->_initSession();
                $this->_initErrorHandler();
                $this->_initCulture();
    
                $this->getService('registry', 'registry.modRegistry');
    
                if (is_array ($this->config)) {
                    $this->setPlaceholders($this->config, '+');
                }
    
                $this->_initialized= true;

    I need it to be like so:
                $this->getCacheManager();
                $this->getConfig();
                $this->_initContext($contextKey);
                $this->_initSession();
                $this->_initErrorHandler();
                $this->_initCulture();
    
                $this->getService('registry', 'registry.modRegistry');
    
                if (is_array ($this->config)) {
                    $this->setPlaceholders($this->config, '+');
                }
    
                // Over here would be the last place that you can manipulate the MODx bootup
                $this->_loadExtensionPackages();
                $this->_initialized= true;


    What do you guys think? Or am I now completely missing the point...
      @MarkGHErnst

      Developer at Adwise Internetmarketing, the Netherlands.
      • 28215
      • 4,149 Posts
      Would be a good suggestion for the bugtracker. smiley
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 24865
        • 289 Posts
        I thought it was more debatable, but I’ll send it in. ;-)
          @MarkGHErnst

          Developer at Adwise Internetmarketing, the Netherlands.