Announcement

Collapse
No announcement yet.

Using a Customvar as a stock level indicator

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

    Using a Customvar as a stock level indicator

    Hi Forum.

    I am hoping that there is a clever person out there can tell me how to modify the regular stock level script so that a customvar can be included which would give more range to the out of stock message... an indication of how long it will take for fresh stock to arrive from various suppliers. i.e. 1-3 days, 4-7 days etc.

    An example of what I want to do can be found on the overclockers website http://www.overclockers.co.uk. They use images as the stock indicator and unless they manage this manually, I presume that the various lead times are defined as a CUSTOMVAR.

    The script I have at the minute (from the AUG) reads:


    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    function StockLevels(pItem)
    <!--
    {
    var strIDs = 'Stock Message: '
    {
    if (pItem >= 10)
    {
    strIDs = 'Normally Ships in 24 Hours'
    }
    else
    {
    strIDs = 'Normally ships in 1-2 weeks'
    }
    }
    return strIDs
    }
    //-->
    </script>


    How, if possible, could I include the CUSTOMVAR in this?


    Thanks in advance!

    #2
    I thnk this was covered on the Forum recently.

    Anyway you can use CUSTOMVARS in JavaScript as long as that JavaScript is in a Product Template.

    e.g.

    Code:
    <script language=JavaScript>
    <!--
    // get the customvar
    var message="CUSTOMVAR:MYMESSAGE";
    // if it's blank or not defined use a default message
    if ( message == '' ) message = 'My default message...';
    // display the message
    document.write(message);
    // -->
    </script>
    Norman
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Many thanks Norman, just the job!


      Jonathan.

      Comment


        #4
        Is there a way to use this if a certain item is in the basket?

        OR

        Is there a way to set a global variable at the point a specific item is added to the basket? (and then use the if statement to query the global variable)
        John

        Comment


          #5
          Hi John

          I'm afraid this would require a bit of customisation, poss even in the perlscripts as well. If there is anyone who has done this, then please comment to this thread.

          Kind Regards
          Nadeem Rasool
          SellerDeck Development

          Comment

          Working...
          X