Description
This plugin links your Magento installation and WordPress by instantiating the Magento’s Mage object. It is done by using PHP require_once
of the file Mage.php
supplied by Magento. By doing this, the administrator will be able to pull and push information to/from the Magento. This requires a working Magento setup prior to installation of this plugin. At the moment, Mage object can be used to non-admin pages such as themes.
Is this plugin for you?
If you know how to program using PHP with basic knowledge of object oriented programming and familiar with Magento, then yes, this plugin is for you. The plugin, once activated, gives you a raw access to the Mage object which you can use to access Magento methods within WordPress and do stuff like single login, pull templates from Magento, display categories, products and checkout from your blog and many more. It’s basically extending the ecommerce function of Magento to your WordPress blog.
This plugin is not for you if:
- You want to display your WordPress blog within your Magento shop (Go to Magento Connect instead)
- You don’t know how to program using PHP
- You have no idea what Magento is
Please do take some time to rate the plugin as well as fill in the information needed in the compatibility section. It would be great if you can share your site (only if you’re allowed to do so) which uses this plugin but it is optional though.
Screenshots
Installation
-
Fix the function collision problem between Magento and WordPress by doing the following:
Copy the file
functions.php
from your Magento core folder which can be found in:/magento/app/code/core/Mage/Core/functions.php
and paste it in the directory below (create the directory if necessary) and open the file for editing.
/magento/app/code/local/Mage/Core/functions.php
Locate the
function __()
or go to line 93. The function is similar to the one below:function __() { return Mage::app()->getTranslator()->translate(func_get_args()); }
replace it with this:
if (!function_exists('__')) { function __() { return Mage::app()->getTranslator()->translate(func_get_args()); } }
Save the file and close it.
- Upload
mage-enabler
folder to the/wp-content/plugins/
directory or use theAdd New -> Upload
option in the Administration panel. - If you use FTP to upload the plugin, activate the plugin through the ‘Plugins’ menu in WordPress. If you use the
Add New -> Upload
option, just click the Activate link provided after the plugin’s installation. A menu will be added underSettings
tab labeled asMage Enabler
. - Go to the Mage Enabler admin page in WordPress and supply the absolute URL of the file
Mage.php
from Magento - Click Save button. One of the messages below will shows upon saving the settings:
- Invalid URL – This means your file
Mage.php
can’t be found using the URL you entered. - File is accessible! – You have supplied a valid URL.
- Mage object not found! – Check your cookie settings. Your browser should be configured to accept cookies.
- Invalid URL – This means your file
FAQ
- How to use this plugin?
-
Check my blog for an example here
- What Magento methods can I use?
-
Check the Magento documentation
- My website appears blank after I turn on the plugin
-
It means there’s an error in your code. Set your PHP error_reporting to E_ALL and refresh the page so you can see what’s causing the error.
- I already set my PHP error reporting to display all errors in .htaccess but still my page remains blank
-
Try placing the
error_reporting(E_ALL)
without quotes at the top of the actual file you’re working on then reload the page. - I get ‘Cannot send session cookie – headers already sent by…’ error
-
Try placing your
Mage::getSingleton(...)
call at the top of your PHP file to prevent this error from taking place. - I’m getting the ‘The plugin does not have a valid header’ error
-
Check the screenshots area on how to setup the folder structure properly
- I’m getting a ‘Decoding failed: Syntax error’ or ‘An error occurred while saving the attribute set’
-
You might wanna take a look at what John LeBlanc did here.
Thanks John ?? - My question isn’t answered here
-
Please post it to the WordPress support forum and tag your post with “mage-enabler”.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Mage Enabler” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Mage Enabler” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.2.2
- Fixed: Fatal error or blank screen (for those with error_reporting turned off) when determining the plugin url in
view.php
file.
1.2.1
- Fixed: Sample and Related Posts not appearing due to
simplexml_load_file()
not allowed by default server configuration.
1.2
- Changed: Moved the Mage Enabler tab to
Settings -> Mage Enabler
- Fixed: Fatal error when no ‘default’ store code is configured see comment #659
- Updated: Page layout and added reference for examples and related posts
- Added: Auto-detect store configuration
1.1.1
- Fixed fatal error during xmlrpc calls see comment #417. Thanks mik for the feedback.
1.1
- Fixed fatal error when URL value provided is a directory
- Added WordPress 3.0 screenshot-5.png sample output
1.0
- Initial commit for Mage Enabler plugin