Daily Archives: May 20, 2014


MWI Plugin relative path to Mage.php

The MWI plugin http://www.mwi-plugin.com/ is a great plugin to integrate Magento and WordPress. It allows you to pull in Magento blocks, CSS, JS and other Magento functionality into a wordpress blog. However, one thing that bothered me with this wordpress plugin was it required you to enter the full path to the Mage.php file, starting from the server root. This does not allow for seamless movement of the website’s database between environments.

The below solution will allow you to enter a full path on the server if you’d like, or a relative path from the wordpress root to the Mage.php file. Open up file wp-content/plugins/magento-wordpress-integration/mwi.php and within function mwi_admin_page() just below the $magepath declaration right around line 134, add four lines to check for a relative path as below.

// Mage Path
$magepath = self::getValue('magepath');

//check for relative path from blog root
if(file_exists(ABSPATH . $magepath)) {
	$magepath = ABSPATH . $magepath;
}
//check for relative path from blog root

// notification/error messages