Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore General Questions › Number of items in eStore Shopping Cart
- This topic has 16 replies, 5 voices, and was last updated 14 years, 3 months ago by amin007.
-
AuthorPosts
-
July 28, 2010 at 9:48 pm #1576singhiMember
Hi, i wann have a link on my page “Shoppingcart (3 items)” showing the number of items in the cart and linking to my shopping-cart-site. Is there a tag to get the number of items?
And is it there a way to link to my shopping-cart-site with clicking “add to cart”.
I have already searched a long time for answers.
Appreciate you help!
July 29, 2010 at 3:09 am #22854amin007ParticipantUse the following shortcode to display the number of items in the shopping cart:
[wp_eStore_total_items_in_cart]
Make sure you have the latest version of the eStore Extra Shortcodes plugin:
http://www.tipsandtricks-hq.com/ecommerce/wp-estore-shortcodes-and-functions-reference-460
July 29, 2010 at 11:43 am #22855singhiMemberThanks it is working now with extra-shortcode plugin.
Is it there a way to link to my shopping-cart-site with clicking the “add to cart” button?
Im using this Shortcode to show the button [wp_eStore:product_id:1:end] but it just adding the item and reloading the page. I wanna have it linked to my cart.
July 30, 2010 at 1:11 am #22856wpCommerceModeratorYou can specify a button link for your product which once clicked will take the customer to your shopping cart site. “Button link” field is under “Additional Product Details” of “Add/Edit Products”.
July 30, 2010 at 4:58 am #22857amin007Participantcheck the “Automatic redirection to checkout page” option in the settings menu so it automatically takes the customer to the checkout page after they hit the “Add to Cart” button.
July 30, 2010 at 4:15 pm #22858singhiMemberThanks, that helped.
Another Issue
My sidebar-text-widget with the Shortcode [wp_eStore_total_items_in_cart] is creating a warning in case of a new session with zero items in cart:
“Warning: Invalid argument supplied for foreach() in /WWWROOT/173195/htdocs/wp-content/plugins/wp-cart-for-digital-products/eStore_cart.php on line 25”
Have a look on my testsite:
http://www.soma-christi.eu/fotogallerien/
Never ending story;-) Cheers again!
July 30, 2010 at 11:59 pm #22859wpCommerceModeratorYou can use the shortcode on a post or page. If you want to use it in a widget you need to only call the PHP function for that. Try calling the following PHP function from your widget and see how it goes –
<?php echo eStore_get_total_cart_item_qty(); ?>
July 31, 2010 at 10:31 am #22860singhiMemberTried both shortcodes on a page but the warning is still there. Its not even “not working”. The count (0) of the cart shows up but creating the warning when the session is new. When i put a item in cart or deleting it again the warning disappears. You can try the shoppping cart on this site: http://www.soma-christi.eu/fotogalerien/lichtfotografie/sonnelicht/
August 1, 2010 at 12:28 am #22861IvyMemberHi Singhi, I tested this issue on the page you posted but I am not getting the warning. Can you please test this and let me know if you are still getting the warning?
August 2, 2010 at 10:04 pm #22862singhiMemberHi Ivy, yes still getting the warning. Have a look on this screenshot: http://www.soma-christi.eu/screenshot.png
The warning is just coming up if the session is new, meaning after you have added a item to cart the warning disappears and the cart works fine. You can see that by deleting your session-cookie.
August 3, 2010 at 1:36 am #22863amin007ParticipantPlease find the following code in the “eStore_cart.php” file:
$total_items = 0;
foreach ($_SESSION['eStore_cart'] as $item)Once you find it modify it to the following and that should do the trick:
$total_items = 0;
if(empty($_SESSION['eStore_cart']))
{
return $total_items;
}
foreach ($_SESSION['eStore_cart'] as $item)August 3, 2010 at 6:51 am #22864mudit.agarwalMemberHi amin007
Will you be updating this <b>trick</b> in the next update also? OR do we have to add this manually?
August 3, 2010 at 8:00 am #22865mudit.agarwalMemberHi,
i want to show the number of item in the cart as a WordPress3.0 Menu Item. So i am setting following text as the navigation label.
<br />
<b><?php echo eStore_get_total_cart_item_qty(); ?></b> Item(s) in cart<br />But it is not working, it is only showing “Item(s) in cart” as the link( there is no number(items))
August 3, 2010 at 1:12 pm #22866amin007Participantyes, I will be adding this to the plugin so you don’t have to manually edit it.
Open the “eStore_cart.php” file and search for the following function in that file:
eStore_get_total_cart_item_qty()
If you can’t find that function that means you need to get an updated version of eStore for this cart item quantity feature.
August 3, 2010 at 3:18 pm #22867singhiMemberThat was Helpful! Merci!
-
AuthorPosts
- You must be logged in to reply to this topic.