branko ajzele, senior developer / project manager

Posts / Articles

Magento plus some CMS, simple and quick integration tip

Sometimes due loosely, undefined, agreement around some feature and deadline that’s thrown upon us, developers need to look for the fastest solution around some requirement. Fastest but stable is the key word here.

Here is a practical example of one can easily connect Magento with some other system. In my case I had Magento plus WordPress integration in which I needed to pull some user data, such as latest users, from WordPress into Magento block.

Stuff like these can easily be done in two easy steps

  • Create custom Magento controller. This article shows you how you can create custom controller.
  • Use built in PHP function file_get_contents and pass it a full link to controller action that will return html string for given block. Using function like $htmlContent = @file_get_contents($someUrl); if($htmlContent) { echo $htmlContent; } will give you some error proof behaviour. Simple but useful for quick stuff.

That’s it. Later once you get on the milestone track you can easily convert these to AJAX calls.