We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12512
    • 42 Posts
    The question was raised in another thread if Magento can be integrated into MODx.

    I recently investigated this option for a project and wrote a prototype of a snippet called "magentoVirtual" which embeds a Magento front-end into a single MODx page. It is astonishingly simple and requires only a few lines of PHP code.

    The concept works in principal and I thought I share it here as it may be useful for other people.

    The only thing I could not get to work yet is combining the session management of Magento with MODx. The issue simply is that at the time MODx loads the sessions the Magento classes are not yet loaded and once Magento is instantiated the session objects are incomplete.

    As this snippet is only a prototype, I simply disabled the MODx session init by uncommenting startCMSSession in index.php. I am sure a proper solution will be found soon.

    Please note, this code is experimental and it’s use requires knowledge of Magento and how it is configured.
    For basic installation instructions, refer to the snippet.
    • If you were to use the same session names (config.inc.php sets a unique session name for MODx; this is generated on installation) for both MODx and Magento, might it work better?
        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
        • 12512
        • 42 Posts
        It’s not so much a matter of session names but an issue that at the time the session is is loaded (which is very early in MODx’s index.php) the Magento class definitions are not yet loaded. This results in incomplete PHP objects.

        In an ideal world MODx should have an event handler before starting a session so class definitions can be loaded. If that would be the case I could move loading of the Magento classes into a plugin and the magento interface would consist of a snippet and a plugin.

        Another work-around is wrapping MODx index.php with a PHP file called index-mage.php which includes magento/app/Mage.php and then MODx’s own index.php. This would not require modifications to the core index.php file.
          • 36582
          • 463 Posts
          Many thanks for sharing this - now all I need to do is find the time to have a play with it - as soon as I do, I will let you know how I got on.

          Thanks again.
            Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
            • 15083
            • 697 Posts
            Thanks for sharing this.
            A little confused, what are we getting here? The Magento backend in MODx?
            How do you list products in your MODx templates etc?
              • 12512
              • 42 Posts
              Quote from: jusmeig at Oct 30, 2009, 03:28 PM

              Thanks for sharing this.
              A little confused, what are we getting here? The Magento backend in MODx?
              How do you list products in your MODx templates etc?
              Read the first post. It says "...which embeds a Magento front-end into a single MODx page".

              If you are after showing Magento objects in MODx, this can be done as well but using the Magento API snippet but it is of very little use as you need the shopping cart to checkout and Magento has not yet an API to access the shopping cart and checkout process.
                • 22856
                • 4 Posts
                I use MODx and Magento.

                I would love the ability to add CMS pages using MODx. far more comprehensive and useful then the (non) CMS that Magento has.

                Or.. is it easy to do for a non-coder like me?

                Thanks, Paul
                  • 12512
                  • 42 Posts
                  Quote from: paul_d at Nov 10, 2009, 03:21 AM


                  Or.. is it easy to do for a non-coder like me?


                  What I published is just a proof of concept, nothing to be readily used and it requires some PHP experience to fine tune it. There are still open issue like the sessions. Until that has been resolved the status remains "proof of concept".

                  As I decided to osCommerce for the current project instead of Magento I will not continue to work on this snippet for a while.
                    • 3784
                    • 4 Posts
                    This snippet would be great. Therefore i propose to gather a small team in order to develop it properly.

                    Currently, Magento has on its own Enterprise version a document handling system based on Revisions and i think this would be a great improvement for Modx as well ( although the CMS part from Magento is not so friendly ) .

                    So anyone that is interested , give a sign.
                    Greets,
                      • 33990
                      • 23 Posts
                      This sounds like it could be the "killer app" for MODx (or Magento depending on where you’re coming from)!

                      A decent e-commerce plugin is the only thing that seems to be missing from MODx. Similarly, Magento seems like it has everything covered for e-commerce but it’s really lacking in the CMS department.

                      I would be happy to get involved with this project, say on a user testing/documentation basis. I will leave the PHP to others wink