WPPizza – A Restaurant Plugin for WordPress › Support › General Support › List how many items in cart
- AuthorPosts
- 6 January, 2015 at 2:44 am #6827
echo string of total items in cart i.e. 3 items
(used to overlay over a shopping cart icon.)
6 January, 2015 at 1:39 pm #6832> overlay over a shopping cart icon
what shopping cart icon ?
6 January, 2015 at 5:29 pm #6833I am making a shopping cart icon that has a notification of how many items are in the cart.
trying to figure out how to echo a string of the number of items.
6 January, 2015 at 5:52 pm #6834and what’s wrong with this shortcode instead then ?
[wppizza type=’totals’ value=’items’ itemcount=’right’ checkout=’1′]
https://www.wp-pizza.com/topic/wppizza-shortcodes/
just add some css to put a cart icon there somewhere (or whatever else you want to do with it)
6 January, 2015 at 7:43 pm #6835I just need the item count no totals or $ etc.
I just tried it and even tried css display none on those elements that kind of gets me to where I need to be.
would it be tough to add this functionality to the totals shortcode?
6 January, 2015 at 8:17 pm #6836display:none seems to be just fine then.
you are not asking to add functionality , but take it away ….
6 January, 2015 at 8:30 pm #6837I was trying to figure out the styling cause there is a bunch of css included with that shortcake i.e. it does not output just a regular number its wrapped in styles.
6 January, 2015 at 8:35 pm #6838>its wrapped in styles
just overwrite them then…6 January, 2015 at 8:48 pm #6839ok for others that are interested in this –
I added this to my code for a shopping cart glyphicon with notification of cart items
<span class="cart-notation noIbar"><?php echo do_shortcode( "[wppizza type='totals' itemcount='left']" ) ?></span>
then I applied some css
.cart-notation{ position:absolute; font-size: 20px; color: white; top: 2px; left: -5px; } .wppizza-total, .wppizza-totals-currency { display: none; } .noIbar { pointer-events: none; }
this gives you a nice little cart icon you can put in your nav or wherever you like – then it shows an ajax updated number over the cart signifying how many items are in the cart.
it also has pointer-events: none; what this does is make the numbers “transparent” to the mouse events so your mouse pointer dosnt change to that I when hovering over text.
Thank you Olly for providing the means to make this possible even though I didnt know it had this capability at first 🙂
6 January, 2015 at 8:55 pm #6840ok I forgot to use code tags…
<a id="show-quick-cart" class="glyphicon glyphicon-shopping-cart" style="text-decoration: none; font-size:30px; margin-top: 10px; margin-right: 10px; color: orange;"> <span class="cart-notation noIbar"><?php echo do_shortcode( "[wppizza type='totals' itemcount='left']" ) ?></span> </a>
6 January, 2015 at 9:11 pm #6841not sure i understand why it’s wrapped in an a tag with all those style declarations, but if it works (and as a starting point anyway) that’s cool by be..
i will probably – in an update – add a filter [ wppizza_filter_shortcode_totals ] one could use to selectively not output some of those elements (rather than using display:none), but that’s for another day
- AuthorPosts
- The topic ‘List how many items in cart’ is closed to new replies.