Announcement

Collapse
No announcement yet.

Displaying Stock Level

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

    Displaying Stock Level

    I Curently use the advanced user guid option of dispatched in X days javascript option (with some customisation), but I would like to let customers know how many are available as well but only when that item is in stock. I have tried the following

    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    function Levels(pItem)
    <!--
    {
    var strIDs = 'Stock Message: '
    {
    if (pItem >= 1)
    {
    strIDs = ' NETUOTEVAR:STOCKLEVEL available for <br>dispatch in 24 Hours'
    }
    else if (pItem <= -998)
    {
    strIDs = 'Out of stock from<br>supplier'
    }
    else
    {
    strIDs = 'Normally Dispatched in<br>CUSTOMVAR:LEAD'
    }
    }
    return strIDs
    }
    //-->
    </script>


    But this produces the folowing for Items in stock

    NETQUOTEVAR:STOCKLEVEL available for
    dispatch in 24 Hours

    I think that the javascript dose not like the NETQUOTEVAR as it is already in use.

    Any clever bods out there who can help!
    Chris Lawton
    http://www.theworkbasket.co.uk/
    Cross Stitch & Craft Store

    #2
    I'm not much good with javascript, but you appear to be calling the javascript as a function with (pItem) as a variable, but where is that variable defined? Does this mean the javascript isn't defined in the product template because then the netquotevar won't be valid.

    If pItem is the netquotevar stockitem, then you should be using pItem in the text to display rather than the netquotevar.

    Mike
    -----------------------------------------

    First Tackle - Fly Fishing and Game Angling

    -----------------------------------------

    Comment


      #3
      NETUOTEVAR:STOCKLEVEL
      Also - is that code copied and pasted from your templates? Becasue you are missing a 'Q'

      Comment


        #4
        Thanks Chris the Q was missing but has the same effect when replaced.
        Chris Lawton
        http://www.theworkbasket.co.uk/
        Cross Stitch & Craft Store

        Comment


          #5
          Mike's right, by the way.

          Try:
          Code:
          <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
          function Levels(pItem)
          <!--
          {
          var strIDs = 'Stock Message: '
          {
          if (pItem >= 1)
          {
          strIDs = pItem + ' available for <br>dispatch in 24 Hours'
          }
          else if (pItem <= -998)
          {
          strIDs = 'Out of stock from<br>supplier'
          }
          else
          {
          strIDs = 'Normally Dispatched in<br>CUSTOMVAR:LEAD'
          }
          }
          return strIDs
          }
          //-->
          </script>

          Comment


            #6
            Thanks that did the trick.
            Chris Lawton
            http://www.theworkbasket.co.uk/
            Cross Stitch & Craft Store

            Comment

            Working...
            X