Announcement

Collapse
No announcement yet.

Cart quantity/items variable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Cart quantity/items variable

    Hi,

    I can't seem to find a variable for cart quantity/no. of items.

    I'm basically just trying to test if there is anything in the users shopping cart and display something appropriately.

    Anyone know of a variable I can use to test on?
    Web . Design . Multimedia . Branding

    #2
    HTML Code:
    <script language="javascript" type="text/javascript">
    <!--
    document.write(getCartItem(3));
    // -->
    </script>


    Bikster
    SellerDeck Designs and Responsive Themes

    Comment


      #3
      I use this effect on http://www.bumpbirthandbeyond.co.uk/ which adds a toy to the cart when something is added.

      The code I use is

      HTML Code:
      <script language="javascript" type="text/javascript">
      var nItems = Number(getCartItem(3));
      var nValue = getCartItem(1);
      if (nItems == 0) {
      document.write ("<div id=\"cartEMPTY\"><img src=\"bbb-cart-empty.gif\"/></div>");
      } 
      </script>
      HTH


      Bikster
      SellerDeck Designs and Responsive Themes

      Comment


        #4
        Thank you so much. Works like a treat!

        I have also added an else statement:
        Code:
        <script language="javascript" type="text/javascript">
        var nItems = Number(getCartItem(3));
        var nValue = getCartItem(1);
        if (nItems == 0) {
        document.write ("<div id=\"cart-empty\" class=\"floatr\"></div>");
        }
        else {
        document.write ("<div id=\"cart-full\" class=\"floatr\"></div>");
        }
        </script>
        Web . Design . Multimedia . Branding

        Comment


          #5
          Good one Jonty - I thought this was going to be more complex and perhaps directly involve perl and cookies etc.

          Comment

          Working...
          X