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 14 years, 6 months ago by Athena.
-
AuthorPosts
-
February 15, 2010 at 6:34 am #798amin007Participant
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”:
function simple_cart_total()
{
foreach ($_SESSION['simpleCart'] as $item)
{
$total += $item['price'] * $item['quantity'];
$item_total_shipping += $item['shipping'] * $item['quantity'];
}
$grand_total = $total + $item_total_shipping;
return $grand_total;
}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 #18028TatiMaiaMemberHi, Admin…
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
Hugs,
Tati
April 23, 2010 at 12:01 pm #18029TatiMaiaMemberOh, I think I solved the problem!
I added the (array) inside the foreach….
Like this:
” 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 #18030AthenaMemberHi, 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?
Thanks
April 29, 2010 at 8:41 pm #18031AthenaMemberI 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 #18032amin007ParticipantYou can download the latest version from the plugin page here:
http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768
April 30, 2010 at 2:25 am #18033AthenaMemberHi, 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 #18034amin007ParticipantFrom 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 #18035AthenaMemberHi, Thanks, okay I will put in a request with them now. Thanks
May 1, 2010 at 2:37 am #18036AthenaMemberMy 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? Thanks
May 1, 2010 at 5:04 am #18037amin007ParticipantWhere are you placing the following line?
echo simple_cart_total();
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 #18038AthenaMemberHi,
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 #18039amin007ParticipantI 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 #18040AthenaMemberHi, 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
-
AuthorPosts
- You must be logged in to reply to this topic.