WordPress.org

Forums

[Plugin: eShop] Display Contents of Shopping Cart anywhere? (18 posts)

  1. saltypigeon
    Member
    Posted 5 years ago #

    Hi, I am setting up a site to use eshop.

    I am interested to know if there is a way to call the function display_cart() anywhere in a template to display the shopping cart there?

    What are the arguements I need to pass to the function? I am new at WordPress, so what WP functions would be needed to provide those arguements?

    Alternatively, a more general question is how do I display the data of a WP Page within a single <div>? I suppose thats another way to display the cart...

  2. elfin
    Moderator
    Posted 5 years ago #

    I'm not sure what you are trying to accomplish. But the display_cart functionality is currently not designed to be just used anywhere. However if you explain what you want then I may be able to help.

  3. saltypigeon
    Member
    Posted 5 years ago #

    I am trying to put the shopping cart in a div in my header. I tried putting this code into the header.php for my theme:

    <?php echo display_cart($_SESSION['shopcart'.$blog_id],'true', get_option('eshop_checkout')) ?>

    And it does display the cart, except it gives an error if the cart is empty:

    Warning: Invalid argument supplied for foreach() in /home/fashion/www/www/wp-content/plugins/eshop/cart-functions.php on line 25

  4. elfin
    Moderator
    Posted 5 years ago #

    So you want to replicate the cart in your header. Do you really want to display the full cart? as it appears on the Shopping cart page?

    Without testing you could try wrapping what you have done with a simple if(isset($_SESSION['shopcart'.$blog_id])) but if that doesn't work, let me know and I'll look at creating something for a future release.

  5. alecgrossman
    Member
    Posted 5 years ago #

    I have a similar question. I would like to display how many items are in the cart in the header and have it link to the actual cart when there are items in it, like the sidebar widget does. I tried adding:

    <?php eshop_widget('Shopping Cart') ?>

    To the header, but I keep getting this error on my site:

    Warning: extract() [function.extract]: First argument should be an array in (my website url)/wp-content/plugins/eshop/eshop_widget.php on line 20

    Is there something else I need to add to the code to get it to work without the error message? Everything else about it seems to be working fine.

  6. elfin
    Moderator
    Posted 5 years ago #

    You can't use widgets in the that way. Though there is nothing to stop you creating an extra sidebar area to utilise the existing widget.

  7. eeyakc
    Member
    Posted 5 years ago #

    Hi,

    I was just wondering if it's possible to display something in the header like what the widget display in the side bar (because i am not using widget on my site)? Is there a php code i can use?

    thanks.

  8. elfin
    Moderator
    Posted 5 years ago #

    display what in the header?

  9. eeyakc
    Member
    Posted 5 years ago #

    like how many items you have in your shopping cart?

    thanks.

  10. elfin
    Moderator
    Posted 5 years ago #

    check the help page within the plugin - specifically look for: [eshop_cart_items]

  11. triplemoons
    Member
    Posted 5 years ago #

    My question is identical to eeyakc's. I looked at the Help page and no php code is available, just short code.

  12. elfin
    Moderator
    Posted 5 years ago #

    Look up the WordPress function do_shortcode.

  13. triplemoons
    Member
    Posted 5 years ago #

    It does nothing but show a zero. I'm sure I'm not the only one who has questioned this (obviously not as someone just posted on this thread 3-4 weeks ago). Most plug-ins have this available in the readme file.

  14. elfin
    Moderator
    Posted 5 years ago #

    and how many items were in the cart? That shortcode does just that, literally the number of items in your cart and nothing else.

    Most plugins have what in the readme? there is already an included help page, which explains all the shortcodes.

  15. triplemoons
    Member
    Posted 5 years ago #

    Ahh. So then it was operating correctly then. I didn't realize all's it would do is show a number. I thought it would provide something more. Essentially what you're saying is that to create a decent sidebar mini cart like thing seen on most eCommerce sites I have to figure it out on my own. I was expecting a plug-and-play PHP script that could just be inserted into the sidebar. I understand now. That was what I was referring to already being available in the readme.

  16. elfin
    Moderator
    Posted 5 years ago #

    eShop does not feature a mini cart for the sidebar at the moment.

  17. Menucha
    Member
    Posted 5 years ago #

    Hi, I don't know how to post a new question, so I'm going to have to leap frog off this one.

    I, too, am trying to set up a site to use eshop. What I want to be able to do is have the Merchant Gateway become our virtual merchant, but it's not listed as one of the supported companies. How do I get it supported?

    If that is not possible, then is it possible to get around that by writing code into the Cforms section so that at the end of filling it out and clicking submit, it redirects to our virtual merchant site?

    I've seen some pretty seemless sites doing very easy to fill out forms linked to their virtual merchant that way, I just don't know what's behind making it work.

  18. elfin
    Moderator
    Posted 5 years ago #

    you can email me regarding adding merchant gateways, elfin@elfden.co.uk

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags