Magento WordPress Integration Associating Products and Posts

One key feature that is only available in WordPress when using FishPig's WordPress Integration is Magento product and WordPress post associations. Using the extension, it is possible to relate products with posts and have them cross linked on both the product and blog post pages! This has obvious SEO and usability benefits and is so easy to implement, that your only excuse not for already doing is that you don't know how (hence this article)!

Creating Associations

To associate some WordPress posts with a Magento Product, login to your Magento Admin and find the product you wish to use. Next, select the tab labelled 'Associated Blog Posts' from near the bottom. This tab should reveal a product grid that works identically to the related products grid. By default, the grid will show all posts currently linked to the product. If this is the first time you have been on this tab, it will display nothing as you have not yet made any associations. To associate posts, follow these steps:

  1. Modify the grid to show all posts. To do this, change the select field from 'Yes' to 'Any' and click the orange 'Search' button. This should now reveal all WordPress posts.
  2. Using the checkbox to the left of each post, select which posts you want to associate.
  3. When you have made your selection, select 'Save' from the top right hand corner.

Displaying Associations

By default, the related product block will show in the left column of your blog post page. To change this, you will need to change the block reference, which can be found in wordpress.xml. On your product page, related posts will be listed in the product.info.additional block. Again, this can be changed in wordpress.xml

Category Associations

Associating a Magento product with a WordPress category is a quick way to associate that product will all WordPress blog posts in that category and does not directly relate products and blog categories.

SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user

This error occurs when you user WordPress and Magento installed in separate databases.

In later versions of the extensions, the internals of the associations system has changed to allow for more efficient retrieval of data. As a result, the WordPress DB user needs access to the association tables, which are stored in Magento. To fix this error, either merge your 2 databases into one, or grant the WordPress database user SELECT access to the Magento tables that start with wordpress_.