views:

39

answers:

1

Using the code below in the index.php file of a WP template:

require_once '/Users/xxx/Documents/Projects/honora/trunk/app/Mage.php';
umask(0);
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'frontend'));
Mage::log(Mage::helper('checkout/cart')->getCart()->getItemsCount());

should in theory give me the number of items in my cart in a Wordpress blog in the Mage log. After adding an item to my cart in one version of Magento I have, the log of when I arrive at my blog shows that I correctly have 1 item. However, in a completely different version of Magento, this isn't the case, and instead logs 0.

Now I know that this is a pretty vague question, but can anyone throw out some possible solutions or ways to check into what's going on? I don't believe it's necessarily an issue with WP, instead believing it's something that's happening between Mage::app() and the call to the session model.

Any help would be appreciated.

A: 

May want to try this in your Wordpress, instead of the code you posted. Working fine for me in 1.4.x

http://wordpress.org/extend/plugins/mage-enabler/

B00MER