WordPress.org

Forums

eShop
Display shopping cart in sidebar WITHOUT using widgets (12 posts)

  1. jtimar
    Member
    Posted 4 years ago #

    Hello,

    I was wondering if there is anyway to display the shopping cart in my template without using the widget. I am talking the full cart, as in the way the "new improved SC widget" is displayed.

    I am a bit of a control freak, and I dislike using widgets for this reason, however the functionality of having the cart in the sidebar could be quite useful. Having a way to call this function without using a widget would be very helpful.

    Thanks again for the awesome and unbelievably free plugin.

  2. jtimar
    Member
    Posted 4 years ago #

    After some digging around I found some advice that I mangled into a wordpress function as follows:

    // eShop Cart
    function limelight_eshopcart()
    {
    echo display_cart($_SESSION['shopcart'.$blog_id],'true', get_option('eshop_checkout'));
    }

    Very basic, and it did work to display the cart, but it would be much better if I could make it so the cart only appeared when it had something in it. I tried this, as I saw suggested in another thread:

    // eShop Cart
    function limelight_eshopcart()
    {
    if(isset($_SESSION['shopcart'.$blog_id]))
    {
    echo display_cart($_SESSION['shopcart'.$blog_id],'true', get_option('eshop_checkout'));
    }
    }

    but that caused it to not display at all. Any suggestions?

  3. elfin
    Moderator
    Plugin Author

    Posted 4 years ago #

    I would have thought control freaks would love widgets, as it gives them more control!

    No widgets cannot be used other than via the widget interface, and this one in particular would be difficult to include by any other means, sorry.

  4. jtimar
    Member
    Posted 4 years ago #

    What about my second post above? It's working, sort of, as in it does display the cart....

  5. elfin
    Moderator
    Plugin Author

    Posted 4 years ago #

    set the 4th variable to 'widget' and see if that helps.

  6. jtimar
    Member
    Posted 4 years ago #

    Sorry, but I'm pretty dumb with things like this, which is the fourth variable?

  7. elfin
    Moderator
    Plugin Author

    Posted 4 years ago #

    display_cart($_SESSION['shopcart'.$blog_id],'true', get_option('eshop_checkout'),'widget')

  8. jtimar
    Member
    Posted 4 years ago #

    Unfortunately that didn't make a difference. Oh well.

  9. elfin
    Moderator
    Plugin Author

    Posted 4 years ago #

    well you are trying to do something it wasn't coded for ;)

  10. sfraser657
    Member
    Posted 3 years ago #

    Hey,

    The mistake in the code is pretty obvious, if anyone is still interested in this. You haven't defined $blog_id; just add "global $blog_id;" to the beginning of your function and it works great.

    Peace,
    Steve

  11. elfin
    Moderator
    Plugin Author

    Posted 3 years ago #

    LOL, so simple I missed it.

  12. jtimar
    Member
    Posted 3 years ago #

    I tired to follow this thread and edited my code so it looks like this:

    // eShop Cart
    function limelight_eshopcart()
    {
    global $blog_id;
    if(isset($_SESSION['shopcart'.$blog_id]))
    {
    echo display_cart($_SESSION['shopcart'.$blog_id],'true', get_option('eshop_checkout'),'widget');
    }
    }

    but still nothing is displayed with that code.

    This version still works, though of course it displays the cart at all times, not just when it has something in it, which is not the desired behaviour.

    // eShop Cart
    function limelight_eshopcart()
    {
    echo display_cart($_SESSION['shopcart'.$blog_id],'true', get_option('eshop_checkout'));
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • eShop
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags