Drupento aims to integrate two of the most powerful open source systems available - Drupal and Magento. The goal of this project is to provide an lightweight static caching layer between the two systems. Drupento allows each system to operate independently, letting the developer or themer choose the points of integration.
Drupento consists of 2 parts - the Drupal module, and the Magento extension. The Magento extension is required if you are using the Drupento Auth add-on module. It is optional otherwise, however, there are some API enhancements included that are useful when using the Drupento cache layer as well.
Drupento is developed and maintained by Context (http://contextllc.com). This project came out of necessity when a client specifically requested Drupal and Magento, and the layout required elements of both systems on many pages.
The primary issue that prompted the development of Drupento was that the Magento theme on our client's site needed to share the same menu as the Drupal theme. We also needed to do this WITHOUT bootstrapping Drupal on each page load inside Magento, for obvious performance reasons.
Drupento makes this easy with a single, static method: This static method does a lot, making it the primary component of the module. The method and its parameters are explained in detail in the Usage section.
NOTE: The server must have a copy of the Simple HTML DOM library somewhere that is accessible by the user account running the site. There is a configuration option for the path to the library. Normally, you will want to put this in /sites/all/libraries, which is the default location Drupento looks for.
http://simplehtmldom.sourceforge.net/
NOTE: These instructions assume your Magento install lives within your Drupal base directory. This is no longer a requirement for usage of the module, but depending on where Magento lives in relationship to where Drupal is installed, you may experience permissions issues.
Typically (for us, at least), a Drupento project's directory layout looks something like:
TO INSTALL:
Configuration of Drupento is done via the settings page at: http://domain.tld/admin/settings/drupento These configuration options are shared between both the Magento and Drupal installations through a config file that gets written upon saving the form.
Working with Drupento requires a bit of knowledge about how exactly it accomplishes it's task. From start to finish, here is an example of a 'dom_element' cache request made by Drupento.
As mentioned previously, most of the functionality of Drupento on the Magento side stems from the Drupento::Output method. The output method can cache the following:
This method is overloaded in a sense - for ease of use, we allow Output() to be called with only two parameters, even though the first parameter is sometimes a cache type (e.g. 'callback'), and other times it is a uri path (e.g. 'home').
If the first param is not a cache type of either 'callback' or 'node', Drupento will assume you are trying to cache a path/element.
This is useful both on the Magento side AND the Drupal side. Callback caching allows us to generate any markup, and cache it to a file. The primary example of this, and the reason callback caching exists, is for use with the API:
Say you wanted to generate a menu of Magento categories and use it on your Drupal homepage. The Magento API is sometimes a reasonable option for getting data, but the overhead of making a SOAP or XML-RPC call on every load makes this less-than-ideal in our case.
In your callback config file (which is specified in the configuration), you can write functions to generate the required markup.
Additionally, Drupento provides a simple API wrapper to manage the client and session transport.
You can then invoke this callback and cache/output the return by calling:
If the node is not already cached, Drupento will bootstrap Drupal, perform a node_load, and then cache the serialized $node object. Otherwise, the $node object will be loaded from the cached copy. You can then work with the node object just as you would inside of Drupal.
Whenever a node is updated in Drupal, Drupento will check to see if there is a cached copy. If one exists, Drupento will re-cache it to keep the Magento side up to date ***
The Drupento Auth module provided with Drupento allows you to use shared credentials for users on your site. Drupento Auth modifies the login form to use email addresses rather than a username.
The only step needed to enable SSO is to enable the module. Assuming all of your settings are correct, the authentication routines of both systems should then be synced.
NOTES: