We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24865
    • 289 Posts
    As the topic suggests, Extension Packages (extension_packages) still don’t work. We’ve created a key under the lexicon system named extension_packages which, in all fairness, works fine. The old format suggested we needed to submit the following format:
    visioncart:{core_path}components/visioncart/model/

    Now, the new manual says that in 2.0.5 the Extension Packages has been revamped and the new format is as follows:
    [{"visioncart":"{core_path}components/visioncart/model/"}]

    Which translates to:
    array[
    	object{
    		"visioncart": string"{core_path}components/visioncart/model/"
    	}
    ]


    So the question remains, is this option still glitched? We can’t seem to get it to work. Not on a fresh, local installation or the VisionCart development site.

    We assume the main class (visioncart.class.php in /model/) is executed uppon init and thus the default __construct or initialize function is called. In both cases, no cigar. Even when we put a little simple but slightly cute "exit(’Hello World");" in the top of the file, still no party.

    Do we need to manually still execute the class or what?
      @MarkGHErnst

      Developer at Adwise Internetmarketing, the Netherlands.
      • 24865
      • 289 Posts
      As it would seem, {core_path} (placeholders for that matter) aren’t parsed by the xPDO addPackage function.

      We’ve followed the path from the extension_packages fetch (getOption) to the xPDO addPackage functions and no where in between does MODx parse any placeholders.

      /edit
      We’ve replaced the placeholder with a temp str_replace function inside the MODx class, and still no luck. We assume xPDO might be at fault not adding the package as it should. If we print $this->packages, it’s there but when we check out the loadClass and _loadClass function, it’s suddenly gone with the wind.
        @MarkGHErnst

        Developer at Adwise Internetmarketing, the Netherlands.
        • 28215
        • 4,149 Posts
        The format isn’t {"name":"path"}, it’s:

        [{"package_name":{"path":"package_path"}}]


        You can see the correct format here. That should cause your packages to load correctly.

        And yes, placeholders are not yet supported in extension_packages (they weren’t prior to 2.0.5 btw); could you file a feature request for them here: http://bugs.modx.com/

        For now, you can just put the absolute path. If you’re wanting it in an extra, you could just do a resolver to calculate the server’s absolute path.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 2611
          • 394 Posts
          Ah, we tried that format also...the error was in the fact that we didn’t use an absolute path wink

          Thanks.
            Follow me on twitter: @b03tz
            Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
            CodeMaster
            • 31724
            • 24 Posts
            Quote from: splittingred at Dec 10, 2010, 07:45 AM

            And yes, placeholders are not yet supported in extension_packages (they weren’t prior to 2.0.5 btw); could you file a feature request for them here: http://bugs.modx.com/

            For now, you can just put the absolute path. If you’re wanting it in an extra, you could just do a resolver to calculate the server’s absolute path.

            In 2.0.4 I was using setting like this:
            hsed:{core_path}components/hsed/model/
            so I could use placeholder {core_path}. Now it does not work - only absolute path e.g.
            [{"hsed":{"path":"C:/wamp/www/newsite/core/components/hsed/model"}}]
              • 22303 MODX Staff
              • 10,725 Posts
              Placeholders did indeed work prior to the changes to the extension_packages format. This is a critical bug IMO, as it prevents extension_packages from being set with portable values.
                • 24865
                • 289 Posts
                Seconded! If I remember tomorrow, I’ll make it a feature request.
                  @MarkGHErnst

                  Developer at Adwise Internetmarketing, the Netherlands.
                  • 24865
                  • 289 Posts
                  We’ve now got:

                  [{"visioncart":{"path":"C:/wamp/www/core/components/visioncart/model/"}}]


                  Which still doesn’t work. This is in fact the absolute path of the server but still no cigar.
                    @MarkGHErnst

                    Developer at Adwise Internetmarketing, the Netherlands.
                    • 28215
                    • 4,149 Posts
                    Fixed in https://github.com/modxcms/revolution/tree/release-2.0.6-pl

                    Added "serviceName" and "serviceClass" params, which can be used like:

                    [{"experience":{"path":"[[++core_path]]components/experience/model/","serviceName":"experience","serviceClass":"Experience"}}]

                    Which would load the "experience" package, and then load the "Experience" class from [[++core_path]]components/experience/model/experience.class.php. serviceClass is the PHP name of the class, where serviceName relates to the filename that it is found in.

                    Just remember that if you use extension_packages in this way, it will only work in 2.0.6+ installs. So you’d restrict whatever you’re building (in this case I assume VisionCart) to 2.0.6+ only.
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                      • 24865
                      • 289 Posts
                      Got it. Tho we also want people to stay up to date with MODx, since every release simply makes it that much better.
                        @MarkGHErnst

                        Developer at Adwise Internetmarketing, the Netherlands.