Ecommerce Developer
 
 

Platforms & Shopping Carts

WordPress Integration for Magento with FishPig's Extension

 

Magento is one of the best ecommerce platforms. WordPress is one of the best blogging platforms. Put the two together, and you have a powerful combination for ecommerce and ecommerce marketing.

Unfortunately, getting the Magento and WordPress platforms working together and using a single set of theme files can be complicated. A demonstration of how to do this from scratch would take a lot of episodes. Fortunately, developers can use a free Magento extension from FishPig to have WordPress working inside of a Magento site in a snap.

In this tutorial, I am going to describe how to use FishPig's awesome extension to add a WordPress-powered blog to your Magento-powered ecommerce store.

Step No. 1: Create a MySQL Database

Like Magento, WordPress uses a database to manage just about everything. So begin by creating a new, and empty, MySQL database.

Step No. 2: Download WordPress

Since I am coming at this from the ecommerce-first perspective, I am going to assume that you're already familiar with Magento and how to install it. So I will be working to add WordPress to Magento, not the other way around.

Thus, I need to download WordPress.

Shows WordPress Download

Step No. 3: Extract and Copy WordPress

Next, I need to extract the WordPress download and copy it to my web server—nothing new or surprising here.

Shows extracting WP

Shows copying WP

Step No. 4: Install WordPress

Installing WordPress is simple, and, in fact, any developer should be able to do it easily. The important step to remember is to configure WordPress before navigating to it in your browser.

Open the WordPress file structure and look for a file named, wp-config-sample.php. Open that file in your favorite code editor.

In the file, you should see several lines of code that look like the following:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Replace all of the sections that read, 'something_here,' with the appropriate database settings—these should match the database we created in Step No. 1.

Here is what my file looked like after I made the changes.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'fishpig_wordpress');

/** MySQL database username */
define('DB_USER', 'test');

/** MySQL database password */
define('DB_PASSWORD', 'test');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Next, save this file as wp-config.php rather than wp-config-sample.php.

Now use your web browser to navigate to the WordPress folder on your server. Doing so should start the WordPress' installation wizard. Just fill out the form on screen, and you will have a successfully installed blog platform in a few seconds.

Shows WP installed

I also want to log in to my WordPress administration panel, since I will need to make some changes there later.

Step No. 5: Get the FishPig WordPress Integration Extension

I point my browser to the Magento site, search for the FishPig WordPress Integration extension, and get the extension key.

You will need Magento site credentials to access a key.

Shows extension page

Next, I head over to my Magento administration panel, navigating to System > Magento Connect. If you're following along, you will need to log in to Magento Connect, using your Magento administration panel credentials—not to be confused with your Magento site credentials which you just used to get the extension key.

With Magento Connect open, paste the extension key in place and click install.

Shows Magento Connect

Shows completed install

Step No. 6: Configure the FishPig Extension

For the FishPig WordPress Integration extension to work, it needs some basic information from you. To provide this configuration information, you will first need to log out of Magento and then log back in again. I know, it seems odd, but trust me.

Once you have logged back in, navigate to the WordPress tab. (Yes, your Magento administration panel now has a WordPress tab.) In this tab, select Settings > Database/Integration.

Shows establishing database connection

First, I need to change "Same/Separate Database" to "Mage/WP are installed in different databases." Next, add the database name—this is the database created in step one—the username for this database, and the associated password. Unless you changed the default settings for your database or for WordPress, you should be done with the database section.

Shows database configuration

In the "Integration" section, set the "Integration Level" to "Fully Integrated," and set a blog route.

Shows integration levels

Save this configuration. The FishPig extension will tell you that two things failed. Don't worry. We expected this.

To fix these known issues, we need to head to the WordPress administration panel and navigate to Settings > General.

Change the "Site address" to match the blog route created in Magento.

Shows changing the WP site URL

In my example, that blog route was http://localhost/custom-templates/magento1/index.php/blog. Your route will, of course, be different, but this should demonstrate the pattern.

Save this change, and navigate to the blog route in your web browser. You will see your WordPress blog integrated into your Magento install.

Shows WP in side Magento

You have just one more thing to do. Go back to the WordPress administration panel, navigate to Settings > Permalinks and click save changes. You don't have to actually change anything, although I would recommend selecting "Day and name" for your permalink options, but saving this—even when nothing changes—fixes a tiny bug that makes your blog title link to the wrong place.

Summing Up

Thanks to FishPig's great Magento extension, you can use one of the best blogging platforms, WordPress, with one of the best ecommerce platforms, Magento.

You get all of the features and flexibility that Magento offers right along with WordPress' user-friendly interface.

Related Articles

Search Terms

13 Comments

Rss-sm