CubeCart and WordPress Integration

Following my 100% CubeCart orientated posts, here’s another late night hack.

It integrates a WordPress blog into your store’s homepage.
You need a working WordPress installation to start with, I installed mine in the standard /wordpress/ folder, none of your customers will see it anyway.

You will also need SimplePie which is a very fast and simple RSS Parser for PHP. Just download and place in any directory.

First off, edit includes/content/index.inc.php and put this about line 55

>require('LOCATION TO SIMPLE PIE/simplepie.inc');$feed = new SimplePie('LOCATION TO WORDPRESS FEED');

$feed->handle_content_type();$i = 1;

$posts = Array();

foreach ($feed->get_items() as $item) {

$posts[$i]['LINK'] = $item->get_permalink();

$posts[$i]['TITLE'] = $item->get_title();

$posts[$i]['CONTENT'] = $item->get_content();

$posts[$i]['DATE'] = $item->get_date('j F Y | g:i a');

// assign array data

$index->assign('DATA', $posts[$i]);

$index->assign('ROW_NR', $i);

// parse a row

$index->parse('index.table.row');

$i++;

}

$index->parse('index.table');
Make sure you replace "LOCATION TO SIMPLE PIE" with the correct page.
Make sure you replace "LOCATION TO WORDPRESS FEED" with your wordpress feed. Don't know what this is? Goto your WordPress blog and hit the RSS icon in the location bar to go to the feed location.

Next, edit yourskin/styleTemplates/content/index.tpl. I replaced the following

>

{HOME_TITLE}

{HOME_CONTENT}

with

>

{DATA.TITLE}

{DATA.CONTENT} {DATA.DATE}

This will replace the "Home Page" text with your blog entries.

Simple, huh?

If any one needs any help, customisation etc, contact me.

6 thoughts on “CubeCart and WordPress Integration”

  1. i have been trying to your wordpress integration but i get this error:

    Parse error: syntax error, unexpected ‘&’ in /home/ourspot/public_html/includes/content/index.inc.php on line 60

    s

  2. ok so i sorted that bit out by replacing > with > but unfortunatley now i get this in the space where the blog should be

    [XTemplate]

    * parse: blockname [index.welcome_note] does not exist

    * parse: blockname [index.table] does not exist

    * parse: blockname [index] does not exist

  3. This is very out dated technique and does not help (you can’t even find index.inc.php anymore…)

    The latest code would be appriciated.

    Thanks a lot,
    KrishSai

Comments are closed.