Mage Enabler
[resolved] Mage Enabler customer session data not showing in wp (7 posts)

  1. patnz
    Posted 5 years ago #

    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().'';

  2. Richard Feraro
    Plugin Author

    Posted 5 years ago #

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


  3. patnz
    Posted 5 years ago #

    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.

  4. Richard Feraro
    Plugin Author

    Posted 5 years ago #

    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.

  5. davepyro
    Posted 4 years ago #

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

  6. microkid
    Posted 4 years ago #

    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 /

  7. kevinfilteau
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Mage Enabler
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic