List how many items in cart

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #6827
    nostahl
    Participant

      echo string of total items in cart i.e. 3 items

      (used to overlay over a shopping cart icon.)

      #6832
      Olly
      Admin & Mod

        > overlay over a shopping cart icon

        what shopping cart icon ?

        #6833
        nostahl
        Participant

          I 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.

          #6834
          Olly
          Admin & Mod

            and 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)

            #6835
            nostahl
            Participant

              I 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?

              #6836
              Olly
              Admin & Mod

                display:none seems to be just fine then.

                you are not asking to add functionality , but take it away ….

                #6837
                nostahl
                Participant

                  I 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.

                  #6838
                  Olly
                  Admin & Mod

                    >its wrapped in styles
                    just overwrite them then…

                    #6839
                    nostahl
                    Participant

                      ok 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 🙂

                      #6840
                      nostahl
                      Participant

                        ok 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>
                        #6841
                        Olly
                        Admin & Mod

                          not 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

                        Viewing 11 posts - 1 through 11 (of 11 total)
                        • The topic ‘List how many items in cart’ is closed to new replies.