Announcement

Collapse
No announcement yet.

One for the clever scripters I guess

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

    One for the clever scripters I guess

    Hi

    I use the javascript "Including the Stock Level into the Store Pages" script from the AUG and have modified it to give 3 levels "Stock level High","Stock level Low" and "Out of stock".

    What I want to be able to do is display the actual number in stock but only when the stock level is low.

    I have tried to achive this but not sucessfully.

    Anyone got and good idea's

    Thanks
    Richard
    www.dj-online.co.uk
    Products for DJs and the entertainment industry

    #2
    I don't know of that script in the AUG and i guess because it is a script it is doing something outside of the normal, but i will say so anyway. You can do all you want via blockifs, you don't need scripts. The 3 stock level values are available at product level, all you need is to run calcs on them for when you want them to show. I have successfully added blockifs, which show nothing, limited stock' or 'out of stock, can be back ordered'.

    As ever though stock levels only count online when site is uploaded.

    Comment


      #3
      I thought block if's were v8 only, this is v7

      Richard
      www.dj-online.co.uk
      Products for DJs and the entertainment industry

      Comment


        #4
        Originally posted by leehack
        I don't know of that script in the AUG and i guess becuase it is a script it is doing something outside of the normal, but i will say so anyway. You can do all you want via blockifs, you don't need scripts. The 3 stock level values are available at product level, all you need is to run calcs on them for when you want them to show. I have successfully added blockifs, which show nothing, limited stock' or 'out of stock, can be back ordered'.

        As ever though stock levels only count online when site is uploaded.
        except to use this method, of course, you would need to upgrade to V8
        Tracey

        Comment


          #5
          FFS, sorry.

          Comment


            #6
            I haven't tested it, but I pasted this together based on my own stock level message:
            Code:
            <script language="JavaScript">
            <!--
            	document.write("Stock Level: ");
             	if (NETQUOTEVAR:STOCKLEVEL == 0)
            	{
            	  document.write("out of stock");
            	}
            	else if (NETQUOTEVAR:STOCKLEVEL < 10)
            	{
            	  document.write("Low (");
            	  document.write(NETQUOTEVAR:STOCKLEVEL);
            	  document.write(")");
            	}
            	else if ((NETQUOTEVAR:STOCKLEVEL >= 10) && (NETQUOTEVAR:STOCKLEVEL < 50))
            	{
            	  document.write("Medium");
            	}
            	else
            	{
            	  document.write("High");
            	}
            // -->
            </script>

            Comment


              #7
              looks good I will try it out.

              Thanks
              www.dj-online.co.uk
              Products for DJs and the entertainment industry

              Comment


                #8
                HTML Code:
                document.write(NETQUOTEVAR:STOCKLEVEL);
                Will this work without speechmarks?

                edit: ignore me, i realise looking at the thing, that its a number you're spitting out, v7.

                Comment


                  #9
                  Thanks Alan

                  With a bit of tweaking your code is now working perfectly on my site.

                  Again I don't know where I would be without this forum

                  Richard
                  www.dj-online.co.uk
                  Products for DJs and the entertainment industry

                  Comment


                    #10
                    Originally posted by acompton
                    I haven't tested it, but I pasted this together based on my own stock level message:
                    Code:
                    <script language="JavaScript">
                    <!--
                        document.write("Stock Level: ");
                         if (NETQUOTEVAR:STOCKLEVEL == 0)
                        {
                          document.write("out of stock");
                        }
                        else if (NETQUOTEVAR:STOCKLEVEL < 10)
                        {
                          document.write("Low (");
                          document.write(NETQUOTEVAR:STOCKLEVEL);
                          document.write(")");
                        }
                        else if ((NETQUOTEVAR:STOCKLEVEL >= 10) && (NETQUOTEVAR:STOCKLEVEL < 50))
                        {
                          document.write("Medium");
                        }
                        else
                        {
                          document.write("High");
                        }
                    // -->
                    </script>
                    Yep this works, great stuff.
                    one thing, is it possible so that when it displays this on the product page you can have for eg.

                    Black text shoving "STOCK LEVELS" and the value (high, low, out of stock) as Red Text?

                    and/or ...

                    the high, low, out of stock, displayed as images for example, a progress bar - full if its high stock, etc

                    Comment


                      #11
                      That is what I have done on my site.

                      I have a traffic light system for High stock , Low Stock and Out of stock. The number in stock is only shown when there is low stock

                      Have a look at my site and see if that is what you are after.

                      Richard
                      www.dj-online.co.uk
                      Products for DJs and the entertainment industry

                      Comment


                        #12
                        Originally posted by GAViN™©
                        Yep this works, great stuff.
                        one thing, is it possible so that when it displays this on the product page you can have for eg.

                        Black text shoving "STOCK LEVELS" and the value (high, low, out of stock) as Red Text?

                        and/or ...

                        the high, low, out of stock, displayed as images for example, a progress bar - full if its high stock, etc
                        Gavin,

                        Those document.write() commands are just spitting out HTML that is inserted in the page at the point at which the javascript is located in the page, so you can put any HTML tags etc. into a document.write(). You can even put an <IMG> tag to do a progress bar.

                        Comment


                          #13
                          Originally posted by DJ Dicky View Post
                          Thanks Alan

                          With a bit of tweaking your code is now working perfectly on my site.

                          Again I don't know where I would be without this forum

                          Richard
                          Did you get this to work on V7 ?
                          Richard
                          www.worldofenvelopes.com

                          Comment

                          Working...
                          X