Support » Plugin: Mage Enabler » Mage Enabler customer session data not showing in wp

  • Resolved patnz


    Hey, I’m trying to get mage-enabler to share topLinks with my wp cms. Im getting some session data showing up no problems, but the cart items data and login/out link data (isLoggedIn) are not coming through.

    Here’s my code:

    //called at the top of header.php before any output
    Mage::getSingleton(‘core/session’, array(‘name’ => ‘frontend’));
    $session = Mage::getSingleton(“customer/session”);
    $magento_block = Mage::getSingleton(‘core/layout’);

    <?php magelinks($session,$magento_block); ?>

    function magelinks($session,$magento_block){


    # Initiate Blocks
    $linksBlock = $magento_block->createBlock(“page/template_links”);

    $checkoutLinksBlock = $magento_block->createBlock(“checkout/links”);

    # Add Links
    $linksBlock->addLink($linksBlock->__(‘My Account’), ‘store/customer/account’, $linksBlock->__(‘My Account’), true, array(), 10, ‘class=”first”‘);

    if ($session->isLoggedIn()) {
    $linksBlock->addLink($linksBlock->__(‘Log Out’), ‘store/customer/account/logout’, $linksBlock->__(‘Log Out’), true, array(), 100, ‘class=”last”‘);
    } else {
    $linksBlock->addLink($linksBlock->__(‘Log In’), ‘store/customer/account/login’, $linksBlock->__(‘Log In’), true, array(), 100, ‘class=”last”‘);

    echo $magento_message.”.$linksBlock->renderView().”;

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Richard Feraro


    Add the code below right after $session = Mage::getSingleton("customer/session");


    Hey Thanks Richard,

    I gave that a go but it gives a fatal error:
    Fatal error: Uncaught exception ‘Mage_Core_Exception’ with message ‘Invalid login or password.’ in myfile.php…

    Should I be replacing those <customer-email>’,'<customer-password> values with something.

    Thanks again.

    Plugin Author Richard Feraro


    Of course yes 🙂 Use an active Magento customer credentials.
    If the username/email and password is wrong, a fatal error will occur with invalid login message.

    so how do you set it to pull in the username and password from the magento site?

    If Magento is not running in your root / directory, make sure the session cookie is available in the directory where WordPress is running. Go to System > Configuration > Web > Session Cookie Management. You probably want to set the cookie path to /

    I’m stuck with the same problem here. Can’t get any session info. Using Magento 1.4.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Mage Enabler customer session data not showing in wp’ is closed to new replies.