Announcement

Collapse
No announcement yet.

Display product quantity in stock

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

  • Display product quantity in stock

    How can we display product quantity available.

    We use this code on anther platform (please ignor the ss tags)
    Code:
    <ss:if test="$product.quantity >= '10'">
         <b><FONT COLOR="#00ae00">[In Stock]</FONT></b>
    <ss:else/>
        <b><FONT COLOR="#ff0000">[Hurry! Only <ss:value source="$product.quantity"/> Available]</FONT></b>
    </ss:if>
    Thanks for your help!
    Rock on!
    Last edited by Go Live; 12-10-2010, 02:17 PM.
    .
    Clayton
    Go Live Industries

  • #2
    Here is another thread that goes over this:

    http://forums.3dcart.com/general-con...ting-page.html

    Hope that helps. There is also a KB article on how to do this if you use advanced options: https://support.3dcart.com/index.php...barticleid=462
    Laura Z
    Brass & Silver Traditions
    www.brassandsilvertraditions.com

    Comment


    • #3
      Originally posted by Go Live View Post
      How can we display product quantity available.

      We use this code on anther platform (please ignor the ss tags)
      Code:
      <ss:if test="$product.quantity >= '10'">
           <b><FONT COLOR="#00ae00">[In Stock]</FONT></b>
      <ss:else/>
          <b><FONT COLOR="#ff0000">[Hurry! Only <ss:value source="$product.quantity"/> Available]</FONT></b>
      </ss:if>
      Thanks for your help!
      Rock on!
      Does anyone know how to implement this on 3dcart? Getting the stock level to show was no problem but I would love to get something like Go Live has here to work.

      Comment


      • #4
        Originally posted by discpb View Post
        Does anyone know how to implement this on 3dcart? Getting the stock level to show was no problem but I would love to get something like Go Live has here to work.
        You got it 10 and under will display, else in stock
        Code:
        <script type="text/javascript">
        
        if ([stock] < 11)
        {
        document.write("<b>Hurry! Only [stock] Available</FONT></b>");
        }
        else
        {
        document.write("<b>In Stock</b>");
        }
        </script>
        Enjoy.....
        .
        Clayton
        Go Live Industries

        Comment


        • #5
          ?? conditional if

          Thank you Go Live
          However the if statement needs to be [stock]>0 and [stock]<11, otherwise, 0 items also display the Hurry message!
          I tried every permutation but I cannot get it to work. Any ideas?

          Also, I commented out the Availability cell and replaced the "else" statement with
          else
          {
          document.write("<b>[availability]</b>")

          Comment


          • #6
            Here it is

            Note that the first line below is existing, only commented out

            code:
            <!-- <td class="price-info"><div id="availability">[availability]</div></td> -->
            <td class="price-info">
            <!-- Begin Hurry stock code -->
            <script type="text/javascript">

            if ([stock] > 0 && [stock] < 11)
            {
            document.write("<b>Hurry! Only [stock] Available</FONT></b>");
            }
            else
            {
            document.write("[availability]");
            }
            </script>
            <!-- End Hurry stock code -->
            </td>
            Last edited by elightbox; 03-25-2011, 03:33 PM.

            Comment


            • #7
              I'm also a ss:tag guy and script idiot. I could do (have done) this in SSML but no clue in script.

              I'd like to have the price wording and the buy it button on the product list to change if the product has options.

              Based on the above code for quantity it sounds doable.

              Price wording

              If options
              "base price" $xxx
              else
              "Price" $xxx

              Buy it button

              If options
              "See options"
              else
              "Buy it"


              Any help?

              Thanks!
              Last edited by mondo; 03-25-2011, 05:55 PM.

              Comment


              • #8
                Hey Guys sorry been out of town doing a trade show.
                Glad to see some interest though.

                Originally posted by elightbox View Post
                Thank you Go Live
                However the if statement needs to be [stock]>0 and [stock]<11, otherwise, 0 items also display the Hurry message!
                Yes you are correct. The code I listed was intended for those that are set to not display when inventory is 0.

                I'm not a programmer but have seen alot (i know that one can do = and =>. Now no time to test but on the top of my head you can add a catch all else that will cover the 0 stock issue for you. Here is the code as I use it on my site. You should easily be able to customize to your liking. Enjoy.....
                Code:
                <tr>
                <td>
                <div align="center">
                <FONT COLOR="#00ae00">
                <script type="text/javascript">
                var inventory = [stock];
                
                if (inventory > 0 && inventory < 6)
                {
                document.write("<b>( Hurry! Only [stock] Available )</b>");
                }
                else if (inventory > 5)
                {
                document.write("<b>( In Stock )</b>");
                }
                else
                {
                document.write(<b>(<a href="product.asp?itemid=[catalogid]" class="item">View Details</a>)</b>);
                }
                </script>
                </font>
                </div>
                </tr>
                </td>
                .
                Clayton
                Go Live Industries

                Comment


                • #9
                  Originally posted by mondo View Post
                  Buy it button

                  If options
                  "See options"
                  else
                  "Buy it"

                  Any help?

                  Thanks!
                  Hi Mondo I wish I had a answer for you as you have been a great asset to myself and the PSs community. It seems that a greater force does not want us to have the answers that we need.
                  I too am looking for two closely related features:

                  One being to change the "Add to Cart" button to "View Details" for waiting list and I'm sure I could do that one should I decide to give it a shot.

                  The other Would be to test for "extra_field_?" and if so then display......
                  in your case test for options.

                  Maybe if enough interest the Gods from above will provide some assistance.

                  Good luck Mondo and sorry I wasn't much help.
                  .
                  Clayton
                  Go Live Industries

                  Comment


                  • #10
                    Stinks being a SSML guy in a script world and I don't seem as willing or able to grasp code like when I was in my forties.
                    I think I will play with this as it's the first thing I really, really would like to try.
                    Relatively speaking so much here seems to be done through admin or just minor easy changes haven't needed much.
                    Last edited by mondo; 03-27-2011, 12:06 PM.

                    Comment


                    • #11
                      Mondo SSML is much like PHP.
                      and PHP is a no go on a windows server.
                      This is my first time on Windows so I'm kinda at a loss without seeing an example.
                      .
                      Clayton
                      Go Live Industries

                      Comment


                      • #12
                        elightbox
                        If you like try
                        Code:
                        if ([stock]==0)
                        Either way you should get the result you've looking for.
                        .
                        Clayton
                        Go Live Industries

                        Comment

                        Working...
                        X