Announcement

Collapse
No announcement yet.

Showing Stock Level

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

    Showing Stock Level

    Hi

    I have come up against a problem with changing the way stock levels are shown on my site.

    I implemented the solution on page 13 of the Advanced users guide 6 months ago, but now wish to change it, so it shows actuall stock only if it is 1 or more.

    To show you what I mean my first thought was that I could just show pItem like so
    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    function StockLevels(pItem)
    <!--
    {
    var strIDs = 'Stock Message: '
    {
    if (pItem <= -1)
    {
    strIDs = ''
    }
    if (pItem == 0)
    {
    strIDs = 'Out of Stock.'
    }
    if (pItem >= 1)
    {
    strIDs = pItem ' in stock'
    }

    }
    return strIDs

    }

    I was thinking if pItem is a number because it is tested in the if statement is would just be shown. That doesn't work.

    If I place an additional NETQUOTEVAR:Stocklevels in Act_Productline as such:

    NETQUOTEVAR:TEMPLATEENDXML<br>NETQUOTEVAR:STOCKLEVEL<script language="Javascript"> document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL))</script>
    </td>

    This works for product in stock, but I don't want the stock figure to be shown if 0 or less.

    Any ideas?

    Regards

    Martin

    #2
    OK... So only show a stock message if you have more than zero in stock, otherwise - 'say nothing':

    So, within HEAD add:

    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    function StockLevels(pItem)
    <!--
    {
    var strIDs = ' '
    {
    if (pItem >= 1)
    {
    strIDs = 'Stock Message: In Stock'
    }
    else
    {
    strIDs = ''
    }
    }
    return strIDs
    }
    //-->
    </script>

    Then place the:

    <script language="Javascript">
    document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL))
    </script>


    Where you want the stock message to appear only when stock is 1 or more.

    Have I understood correctly?

    Comment


      #3
      Nearly there on that stock issue

      I have just gone through this thread and it's so close to what i'm actually looking for.. All i would like to do is show a In Stock Message when the goods are over 10 or more and Delivered By Manufacturer message when it's 5 or less.. I can get the messages right, but i can't seem to get rid of the number before the message.. any1 have any ideas how to hide the number so that only a message displays..

      Thanks For the Help
      Shannon
      Shannon
      Big Game Hunters
      Trampoline Specialists - Etoyszone Trampolines
      Trampolines and Outdoor Toys - Garden Games
      Table Tennis Table - Table Tennis Specialist Shop
      Trampoline Brand Information - Trampolines 4 Sale
      Climbing Frames - Wooden Climbing Frames
      Trampoline Specialist Blog
      Table Tennis Blog

      Comment


        #4
        Post your code and let's have a look

        Alan Compton
        www.greenknightgames.co.uk
        Great board games and cards games you won't find in the High Street

        Comment


          #5
          code

          Code:
          <!-- saved from url=(0022)http://internet.e-mail -->
          <!-- saved from url=(0022)http://internet.e-mail -->
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          
          <html xmlns="http://www.w3.org/1999/xhtml">
          <HEAD>
          
          <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
          </script>
          <script type="text/javascript">
          _uacct = "UA-115227-1";
          urchinTracker();
          </script>
          
          <TITLE>NETQUOTEVAR:PAGETITLE</TITLE>
          
          <Actinic:BASEHREF VALUE="NETQUOTEVAR:BASEHREF"/>
          <META NAME="ACTINICTITLE" CONTENT="NETQUOTEVAR:PAGEHEADER">
          <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
          <!--@act NETQUOTEVAR:HEADERMETA -->
          <!--@act NETQUOTEVAR:LOADFUNCTION -->
          <!--@act NETQUOTEVAR:SUBMITFUNCTION -->
          <!--@act NETQUOTEVAR:P3PFULLPOLICYLINK -->
          
          <link rel="stylesheet" type="text/css" href="../css/screen.css" media="screen" />
          
          <SCRIPT LANGUAGE="JavaScript" SRC="actiniccore.js" TYPE="text/javascript"></SCRIPT>
          <SCRIPT LANGUAGE="JavaScript" SRC="upsellsupport.js" TYPE="text/javascript"></SCRIPT>
          <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
          function StockLevels(pItem)
          <!--
          {
          var strIDs = ' '
          {
          if (pItem >= 1)
          {
          strIDs = 'Stock Message: In Stock'
          }
          else
          {
          strIDs = ''
          }
          }
          return strIDs
          }
          //-->
          </script>
          </head>
          
          <body OnLoad="NETQUOTEVAR:ONLOAD">
          
          <table id="container" cellpadding="0" cellspacing="0">
            <tr>
              <td id="header"><a href="http://www.gardengames.co.uk/index.html"><img src="header.jpg" alt="Trampolines, Climbing Frames, Above Ground Pools, Giant Chess Sets" width="750" height="118" border="0" /></a></td>
            </tr>
            <tr>
              <td id="nav"><a href="http://www.gardengames.co.uk/index.html">Home</a> | <a href="http://www.gardengames.co.uk/aboutus.html">About Us</a> | <a href="http://www.gardengames.co.uk/acatalog/index.html">Shopping</a> | <a href="http://www.gardengames.co.uk/acatalog/search.html">Search</a> | <a href="http://www.gardengames.co.uk/contactus.html">Contact</a></td>
            </tr>
            <tr>
              <td><!-- start main table -->
                <table id="main" cellpadding="0" cellspacing="0">
                  <tr>
                    <td height="338" valign="top" id="menu"><a href="http://www.gardengames.co.uk/cgi-bin/ca000001.pl?ACTION=SHOWCART"><img src="shoppingcart.gif" alt="Shopping Cart" width="31" height="31" border="0" /></a><a href="http://www.gardengames.co.uk/cgi-bin/ca000001.pl?ACTION=SHOWCART" class="style1">Items in Basket</a><br />
                      <div id="free_delivery"><a href="http://www.gardengames.co.uk/index.html"><img src="free_delivery2.gif" alt="Trampolines, Climbing Frames, Above Ground Pools, Giant Chess Sets" width="175" height="116" border="0" /></a></div>
                      <!-- Browse products menu-->
                      <div class="box">
                        <div class="header">
                          <!-- fix IE-->
                        </div>
                        <div class="title">Browse Products:</div>
                        <ul class="content">
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Trampolines_9.html">Trampolines</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Climbing_Frames.html">Climbing Frames </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Water_Fun__8.html">Above Ground Pools </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Garden_Games_1.html">Garden Games</a> </li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Croquet__7.html">Croquet Sets</a> </li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Table_Games_4.html">Table Games</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Giant_Chess_5.html">Giant Chess</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Ride_On_Toys.html">Ride on Toys</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Sledges_18.html">Sledges</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Remote_Control.html">Remote Control Toys</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Party_Games.html">Party Games </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_New_Products_19.html">New Games </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Special_Offers_12.html">Special Offers</a></li>
                        </ul>
                        <div class="footer">
                          <!-- fix IE-->
                        </div>
                      </div>
                      <!-- Browse information menu-->
                      <div class="box">
                        <div class="header">
                          <!-- fix IE-->
                        </div>
                        <div class="title">Top Sellers :</div>
                        <ul class="content">
                          <li><a href="http://www.gardengames.co.uk/acatalog/Pool_Table.html">Pool Tables</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Snooker_Table.html">Snooker Tables </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Table_Tennis.html">Outdoor Table Tennis </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Air_Hockey_Tables.html">Air Hockey Tables </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Football_Tables.html">Table Football </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Round_Trampolines.html">Round Trampolines </a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Trampoline_Pads.html">Trampoline Padding</a> </li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Ride_On_Toys.html">Ride on Toys</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Garden_Games_Sledges_18.html">Sledges</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Remote_Control.html">Remote Control Toys</a></li>
                          <li><a href="http://www.gardengames.co.uk/acatalog/Sports.html"> Basketball Nets</a></li>
                          <li>&nbsp;</li>
                        </ul>
                        <div class="footer">
                          <!-- fix IE-->
                        </div>
                      </div></td>
                    <td valign="top" id="content"><!-- start content cell -->
                     <div class="divwrap"> <p><font size="2">NETQUOTEVAR:FORMBEGIN <A NAME="top">
                        <INPUT TYPE=HIDDEN NAME=RANDOM VALUE="NETQUOTEVAR:RANDOM">
                        </A> NETQUOTEVAR:HIDDENFIELDS
                        <!-- If customer accounts are in operation following two lines allow displaying -->
                        <!-- User name and customer account name on every page -->
                        <!-- NETQUOTEVAR:LOGINLINK -->
                        <!--<Actinic:NOWSERVING/><Actinic:CURRACCOUNT/><Actinic:LOGOUT_SIMPLE/><br>-->
                        <!--<span class="actxsmall">NETQUOTEVAR:HEADERTEXT<br><br>NETQUOTEVAR:FOOTER</span>-->
                        <!-- ********************************************************** -->
                        <!-- START MAIN CATALOG CONTENT-->
                    NETQUOTEVAR:BULK</font></p></div></td>
                  </tr>
                </table>
                <!-- end main table -->
              </td>
            </tr>
            <tr>
              <td id="footer"><img src="footer.gif" alt="Trampolines, Climbing Frames, Above Ground Pools, Giant Chess Sets" />
                <div id="links"><a href="http://www.gardengames.co.uk/termsandconditions.htm">Terms &amp; Conditions</a> | <a href="http://www.gardengames.co.uk/affiliate.html">Affiliate Scheme</a> | <a href="http://www.gardengames.co.uk/advice.htm"> Outdoor Toys Advice Guide</a> | <a href="http://www.gardengames.co.uk/Trampoline_Buying_Guide.html">Trampoline Buying Guide</a></div>
                <div id="copyright">Big Game Hunters &copy; 2005</div></td>
            </tr>
          </table>
          </body>
          </html>
          That was the actprimary page.. now the product line:

          Code:
          <!-- ProductLine HTML begin -->
          <!-- Insert HTML for the top of the individual product -->
          NETQUOTEVAR:INCLUDE Act_ProductSeparator.html
          NETQUOTEVAR:ENDSEPARATOR
          NETQUOTEVAR:PRODUCTFORMBEGIN
            <tr>
              <td rowspan="2" colspan="2" valign="TOP" align="CENTER"> NETQUOTEVAR:TEMPLATEBEGINXML NETQUOTEVAR:PRODUCTIMAGE </td>
              <td valign="TOP" align="LEFT">  
                <a name="NETQUOTEVAR:PRODUCTANCHOR"><span class="actregular"><b>NETQUOTEVAR:PRODUCTNAME</b></span></a>
                <span class="actxsmall">NETQUOTEVAR:PRODUCTREF <br>
                NETQUOTEVAR:PRODUCTDESCRIPTION&nbsp;NETQUOTEVAR:EXTINFOLINK</span>NETQUOTEVAR:EXTINFOBUTTON
                <br>
                <span class="actxsmall">NETQUOTEVAR:PRODUCTBEGINLINKNETQUOTEVAR:PRODUCTLINKTEXTNETQUOTEVAR:PRODUCTENDLINK
                NETQUOTEVAR:PRICEEXPLANATION </span><br>
                <b>NETQUOTEVAR:PRODUCTPRICE</b><br>NETQUOTEVAR:STOCKLEVEL <script language="Javascript">
          document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL)) 
          </script>
                <span class="actxsmall">NETQUOTEVAR:DISCOUNTINFO </span>
                <span class="actxsmall">NETQUOTEVAR:OTHERINFOPROMPT </span>
                <span class="actxsmall">NETQUOTEVAR:DATEPROMPT </span>
              </td>
            </tr>
            <tr>
              <td align="LEFT"><span class="actxsmall">
          			NETQUOTEVAR:CARTERRORXMLNETQUOTEVAR:PRODUCTQUANTITY<br>
          			<Actinic:ACTIONS>NETQUOTEVAR:ADDTOCARTBUTTON</Actinic:ACTIONS>
          		    </span>
          	NETQUOTEVAR:TEMPLATEENDXML
                 </td>
            </tr>
          NETQUOTEVAR:PRODUCTFORMEND
          NETQUOTEVAR:NEXT<!-- Insert HTML for the bottom of the individual product --><!-- ProductLine HTML end -->
          Cheers
          Shannon
          Big Game Hunters
          Trampoline Specialists - Etoyszone Trampolines
          Trampolines and Outdoor Toys - Garden Games
          Table Tennis Table - Table Tennis Specialist Shop
          Trampoline Brand Information - Trampolines 4 Sale
          Climbing Frames - Wooden Climbing Frames
          Trampoline Specialist Blog
          Table Tennis Blog

          Comment


            #6
            Here's the problem:
            Code:
            <br>NETQUOTEVAR:STOCKLEVEL <script language="Javascript">
            document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL)) 
            </script>
            Remember that when the page is generated, NETQUOTEVAR:STOCKLEVEL is replaced with the actual stock level value, so
            Code:
            NETQUOTEVAR:STOCKLEVEL
            will insert a number into the page, and
            Code:
            <script language="Javascript">
            document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL)) 
            </script>
            will insert your stock message into the page

            You probably want to remove the first NETQUOTEVAR:STOCKLEVEL.
            Don't remove the <br> though, its doing some formatting.

            Alan

            Comment


              #7
              Will Give It A Try

              EXCELLENT.. Thank you for getting back so quicky.. i will give that a go and let you know..
              Shannon
              Big Game Hunters
              Trampoline Specialists - Etoyszone Trampolines
              Trampolines and Outdoor Toys - Garden Games
              Table Tennis Table - Table Tennis Specialist Shop
              Trampoline Brand Information - Trampolines 4 Sale
              Climbing Frames - Wooden Climbing Frames
              Trampoline Specialist Blog
              Table Tennis Blog

              Comment


                #8
                quicky
                Oo, err.
                More tea vicar?

                Comment


                  #9
                  Bloody Spelling Hey

                  Man invented spell check for a reason didn't they ?

                  Thank you fopr helping me out with that script, it works a treat..

                  I do however have another question. We have to messages i would like to display as we have 2 delivery messages. one is : In Stock and the other : Delivered Directly By The Manufacturer. Now if you taking the stock below the specified number the message changes wchich is perfect. But then, a great big Out Of Stock appears.. Does anyone know a way of getting around this ?

                  Thank You
                  Shannon
                  Shannon
                  Big Game Hunters
                  Trampoline Specialists - Etoyszone Trampolines
                  Trampolines and Outdoor Toys - Garden Games
                  Table Tennis Table - Table Tennis Specialist Shop
                  Trampoline Brand Information - Trampolines 4 Sale
                  Climbing Frames - Wooden Climbing Frames
                  Trampoline Specialist Blog
                  Table Tennis Blog

                  Comment


                    #10
                    Hi,

                    I've been following your thread as I was trying to do exaxtly the same as you. The large OUT OF STOCK comment comes from the Design, Text area - Website (cont) - General info tab at the top you will see out of stock - if you just delete the text on the right this will stop it coming up.

                    Hope this helps and thanks for posting the thread originally as it helped me get around my problem too. As an aside you can also save images in the java script instead of comments so can show trafic lights etc... something I'm playing with at the moment.

                    Myles

                    Comment


                      #11
                      Fantastic

                      Myles...

                      Fantastic.. Thank you that tip.. Only a happy to be of some help.. Will let you know if i come right..

                      That image idea is an intresting prospect.. I'm going to look into that..

                      Thanks Again
                      Shannon
                      Shannon
                      Big Game Hunters
                      Trampoline Specialists - Etoyszone Trampolines
                      Trampolines and Outdoor Toys - Garden Games
                      Table Tennis Table - Table Tennis Specialist Shop
                      Trampoline Brand Information - Trampolines 4 Sale
                      Climbing Frames - Wooden Climbing Frames
                      Trampoline Specialist Blog
                      Table Tennis Blog

                      Comment


                        #12
                        great big Out Of Stock appears
                        If this message is in red, then I get it too. I've learned to live with it.
                        I think this message is replacing the Add to Cart button and is being generated from this in Act_ProductLine.html
                        Code:
                        <span class="actxsmall">
                          NETQUOTEVAR:CARTERRORXMLNETQUOTEVAR:PRODUCTQUANTITY<br>
                          <Actinic:ACTIONS>NETQUOTEVAR:ADDTOCARTBUTTON</Actinic:ACTIONS>
                        </span>

                        Comment


                          #13
                          Idea ?

                          Myles

                          That works perfectly.. Thank you for your help..

                          Another question/idea now.. Does anyone know if it's possible to write 3 variables for the stocks eg:

                          0 = Delivered Directly By Manufacturer
                          Anything Below 10 = OUT OF STOCK
                          Anything Above 500 = In Stock

                          I am busy fiddling with the script now, but if anyones got this running already. Any info would be appreciated..

                          Cheers
                          Shannon
                          Shannon
                          Big Game Hunters
                          Trampoline Specialists - Etoyszone Trampolines
                          Trampolines and Outdoor Toys - Garden Games
                          Table Tennis Table - Table Tennis Specialist Shop
                          Trampoline Brand Information - Trampolines 4 Sale
                          Climbing Frames - Wooden Climbing Frames
                          Trampoline Specialist Blog
                          Table Tennis Blog

                          Comment


                            #14
                            I can mod. the script easily enough.
                            What happens in between 10 and 500?
                            As you have specified it - no message is produced
                            (typical programmer's reply)

                            Code:
                            <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                            function StockLevels(pItem)
                            <!--
                            {
                              var strIDs = ' '
                              {
                                if (pItem == 0) 
                                {
                                  strIDs = 'Delivered Directly By Manufacturer'
                                }
                                else if (pItem < 10) 
                                {
                                  strIDs = 'OUT OF STOCK'
                                }
                                else if (pItem > 500)
                                {
                                  strIDs = 'In Stock'
                                }
                              }
                              return strIDs
                            }
                            //-->
                            </script>
                            Alan

                            Comment


                              #15
                              Hi,

                              This is the code that I am using at the moment - still work in progress but shows text and image for three variables:

                              <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                              function StockLevels(pItem)
                              <!--
                              {
                              var strIDs = ' '
                              {
                              if (pItem <= 2)
                              {
                              strIDs = 'Out of Stock <img border=0 src="redlight.gif">'
                              }
                              else
                              if (pItem >= 5)
                              {
                              strIDs = 'In Stock <img border=0 src="greenlight.gif">'
                              }
                              else
                              {
                              strIDs = 'Low stock <img border=0 src="yellowlight.gif">'
                              }
                              }
                              return strIDs
                              }
                              //-->
                              </script>

                              Myles

                              Comment

                              Working...
                              X