Support » Fixing WordPress » [Plugin: eShop] Display Contents of Shopping Cart anywhere?

  • 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…

Viewing 15 replies - 1 through 15 (of 17 total)
  • 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.

    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

    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.

    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.

    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.


    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?


    display what in the header?

    like how many items you have in your shopping cart?


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

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

    Look up the WordPress function do_shortcode.

    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.

    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.

    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.

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

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘[Plugin: eShop] Display Contents of Shopping Cart anywhere?’ is closed to new replies.