Tips and Tricks HQ Support Portal › Forums › Simple PayPal Shopping Cart › Simple Shopping Cart Tweaks › Display the shopping cart total only
- This topic has 13 replies, 3 voices, and was last updated 13 years, 1 month ago by Athena.
February 15, 2010 at 6:34 am #798
If you want to display the shopping cart total in the sidebar or somewhere similar then add the following function to the “wp_shopping_cart.php”:
foreach ($_SESSION['simpleCart'] as $item)
$total += $item['price'] * $item['quantity'];
$item_total_shipping += $item['shipping'] * $item['quantity'];
$grand_total = $total + $item_total_shipping;
Now you can simply call the “simple_cart_total” function and echo it out from your sidebar.php file:
echo simple_cart_total();April 23, 2010 at 10:43 am #18028TatiMaiaMember
Just to let you know:
“warning: invalid argument supplied for foreach() in …./wp-content/plugins/wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php on line 36”
But when I add something to cart, this warning disappears, and when I delete items and let the cart empty, everything is working well. But if I close my browser and open again, the warning is back.
If you want to take a look, my shop is: http://shop.tatimaia.com
TatiApril 23, 2010 at 12:01 pm #18029TatiMaiaMember
Oh, I think I solved the problem!
I added the (array) inside the foreach….
” foreach ((array) $_SESSION as $item)”
I’m sorry if I’m bothering you… but anyway, I hope I’m helping too.
Hugs again!April 29, 2010 at 7:49 pm #18030
Hi, I receive an error message when I add the code into the cart php file
Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/myinfohere/public_html/wp-content/plugins/wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php:2) in /home/myinfohere/public_html/wp-content/plugins/wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php on line 23
Is there a fix for this? Will this be added into future updates? Does eStore have this option?
ThanksApril 29, 2010 at 8:41 pm #18031
I discovered from reading in the forum there is version 2.8 out now, WordPress.org has version 2.6 only. I tried adding 2.8 myself, but it doesn’t show up on my front end in WordPress.April 30, 2010 at 12:48 am #18032
You can download the latest version from the plugin page here:
http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768April 30, 2010 at 2:25 am #18033
Hi, Thanks, but I tried it that way without doing it through wordpress, but it won’t show up in my wordpress front end, the only way it will if I download it through wordpress and they only have version 2.6. Does the 2.8 have the show shopping cart total option feature in it? Is there a way to fix my error code if it doesn’t? Is this an option available in eStore? Thanks.April 30, 2010 at 6:03 am #18034
From the error I can tell that the PHP session on your server is not working correctly. If you request your hosting provider to fix the PHP session issue then it won’t show that error anymore.April 30, 2010 at 6:45 pm #18035
Hi, Thanks, okay I will put in a request with them now. ThanksMay 1, 2010 at 2:37 am #18036
My host says its with the plugin I get this info when I add the above shortcode to display shopping cart total:
Removed by Admin.
This is completely messing up my site. Please is there way to fix this?
Does eStore have this feature in it or will this be a feature in wp simple in the future? ThanksMay 1, 2010 at 5:04 am #18037
Where are you placing the following line?
If you place it before the header is sent then it’s going to give you that warning. I am pretty sure you are placing it in the wrong part of your header. If you can tell me what you are trying to achieve then I should be able to tell you how to do it.May 1, 2010 at 4:34 pm #18038
I actually wasn’t able to get that far to enter echo simple_cart_total(); I entered the longer code given into my shopping cart php file and it immediately begins to mess up my site and give me error messages. I’m hoping to add the that line of code into a widget and have my shopping cart to just display the number of items and total without showing the complete contents of the cart because it takes up too much room. Thanks:)May 2, 2010 at 12:32 am #18039
I have a feeling when you are adding the function in the “wp_shopping_cart.php” file you are adding it before the session start command. Try adding it towards the bottom of the file rather than the top.May 2, 2010 at 2:39 am #18040
Hi, I had actually tried it on the top and on the very bottom both times I had to completely uninstall and reinstall though only 2.6 since wordpress.org has only 2.6 version each time to stop the error messages. Thanks
- You must be logged in to reply to this topic.