-
- 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?
-
- 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.
-
- 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.
-
- 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?
-
- 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
-
- 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,