Announcement

Collapse
No announcement yet.

Estimated Delivery Times Out Of Stock Messages

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

    Estimated Delivery Times Out Of Stock Messages


    I Have set up the products on my site to display an estimated delivery time dependant upon stock levels using teh stocklevel and if then statements as shown in the advanced user guide.

    What I would like to do now is if a product goes out of stock put an estimated restock time so that I can keep taking orders but say something like "out of stock usually despatched in 4 weeks".

    The problem I have is that the restock time is dependant upon product as different products have different lead times. Any ideas????
    Andy McCallum

    The Craft Shop

    www.thecraftshoponline.co.uk

    #2
    Andy_Mac,
    You could create a CUSTOMVAR that holds the "out of stock usually despatched in 4 weeks" message for each individual product.

    You would then change one of your javascript lines to something like:
    if (pItem <= 0)
    {
    strIDs = CUSTOMVAR:OUTOFSTOCKMESSAGE
    }

    for example.

    This would enable you to control the message for each product AND/OR have a global default for the site!
    Fergus Weir - teclan ltd
    Ecommerce Digital Marketing

    SellerDeck Responsive Web Design

    SellerDeck Hosting
    SellerDeck Digital Marketing

    Comment


      #3
      Tried that and .....



      Ok tried that but i am getting syntax errors when i run it.

      the script is in the Default Overall Layout Template.

      //-->
      </SCRIPT>

      <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
      function StockLevels(pItem)
      <!--
      {
      var strIDs = 'Stock Message: '
      {
      if (pItem >= 900)
      {
      strIDs = 'Why Not Pre-order We Will Send It To You When We Receive It'
      }
      else if (pItem >= 2 )
      {
      strIDs = 'Normally Ships In 24 Hours'
      }
      else if (pItem > 0 )
      {
      strIDs = CUSTOMVAR:PRESUSPSTOCKMESSAGE
      }
      else
      {
      strIDs = 'Currently Out Of Stock'
      }
      }
      return strIDs
      }
      Andy McCallum

      The Craft Shop

      www.thecraftshoponline.co.uk

      Comment


        #4
        This line looks wrong:

        strIDs = CUSTOMVAR:PRESUSPSTOCKMESSAGE

        try

        strIDs = 'CUSTOMVAR:PRESUSPSTOCKMESSAGE'

        I presume you're using this code within a Product Template as that's the only place that a product level Customvar will be exposed.

        Also when posting javaScript snippets enclose them between [ c o d e ] and [ / c o d e ] tags (typed without the spacing) as that will preserve the layout. It hurts my head to look at non-indented code and makes it very difficult to see the program flow.

        If you still get JavaScript errors then look at your page with Firefox ( www.mozilla.org ) with Tools / JavaScript Console turned on. You get really useful error messages compared with IE's useless ones.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          OK so far

          Unfortunatly my knowledge of Java and HTML is very limited......

          I have done the modification in the product template and it runs without errors, however I can't get it to display the info from the cutomvar in the shop, and I can't work out what the correct script should be to make it work.

          Help please
          Andy McCallum

          The Craft Shop

          www.thecraftshoponline.co.uk

          Comment


            #6
            We'd need to see a page to comment further. Do you have a live sites URL?
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              I've been trying to work through a similar situation on my site today. I can get it to dispay a message saying that we normally despatch next day if stock >= 1, or that we normally despatch within 7 days if stock = 0 by adding the following javascript to Act_Primary.html:
              Code:
              <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
              function StockLevels(pItem)
              <!--
              	{
              	var strIDs = 'Stock Message: '
              	{
              	if (pItem >= 1)
              		{
              		strIDs = 'Usually despatched next working day'
              		}
              	else
              		{
              		strIDs = 'Usually despatched within 7 working days'
              		}
              	}
              	return strIDs
              }
              //-->
              </script>
              So far so good! I've then set up a CUSTOMVAR called DELIVERY so that I can enter a different delivery lead time for each product when it is out of stock (so the content of DELIVERY might be 'Usually despatched within 7 working days' for one product but might be 'Usually despatched within 4-6 weeks' for something else.
              nts
              I had hoped that all I'd have to do now was replace the text for one of the strIDs statement with my new customvar. My problem is that neither of the following display anything (i.e. completely blank):
              Code:
              		strIDs = 'CUSTOMVAR:DELIVERY'
              Code:
              		strIDs = CUSTOMVAR:DELIVERY
              This seems to be the point reached when this thread stopped. I'd be grateful for any suggestions!
              Martin Durham

              ReallyCleverHomes - your one-stop-shop for home technology

              Comment


                #8
                Product level Custom Properties only show up in Product Templates (not Primary Templates).
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  So whats the solution



                  How do we get round this problem as I gave up with it due to lack of time and knowledge.

                  The actinic solution in the manual puts one bit of code (javascript?) in the primary template and a second bit of code (HTML?)in the product template.

                  As the custom VAR appears to only be visable in the producy template how do we get the initial javascript, which appears to drive the whole thing, into the product template.

                  Is the stock level variable available in the product template?

                  Andrew


                  ps I'm glad its not just me..........
                  Andy McCallum

                  The Craft Shop

                  www.thecraftshoponline.co.uk

                  Comment


                    #10
                    What I've been doing up to now is simply to include the customvar in Act_ProductPrice.html - this has worked fine (but I have had to edit the customvar content manually if a product goes out of stock).

                    On that basis my theory was that putting the following in Act_ProductPrice.html should also work:
                    Code:
                        <script language="Javascript">
                    	document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL)) 
                        </script>
                    It works in so far as it displays the text version correctly - but it gives a blank response for the customvar version.

                    You can see it working correctly without the customvar at http://reallycleverhomes.co.uk/acatalog/MK_K182.html

                    Now all I need to do is get it to show the content of the customvar rather than the text. Any ideas?
                    Martin Durham

                    ReallyCleverHomes - your one-stop-shop for home technology

                    Comment


                      #11
                      You pass the customvar's value in the Product Templates JavaScript call to the subroutine in Act_Primary.

                      I can't say exactly how as you've not posted both bits of code that you're using. If you post both the Act_Primary and Act_ProductLine stuff I'll try to amend it. Please post code snippets between [ c o d e ] and [ / c o d e ] tags (type these tags without the spaces) as it's very difficult to understand if you don't.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        One way round this would be to amend the function in the parent primary template to take two parameters instead of 1.
                        i.e.
                        Code:
                        <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                        function StockLevels(pItem,strMessage)
                        <!--
                        	{
                        	var strIDs = 'Stock Message: '
                        	{
                        	if (pItem >= 1)
                        		{
                        		strIDs = 'Usually despatched next working day'
                        		}
                        	else
                        		{
                        		strIDs = strMessage
                        		}
                        	}
                        	return strIDs
                        }
                        //-->
                        </script>
                        you could then call this function at the product level with
                        Code:
                        StockLevels(NETQUOTEVAR:STOCKLEVEL,CUSTOMVAR:DELIVERYMESSAGE)
                        where the DELIVERYMESSAGE customvar will pass the message to be displayed if the product is out of stock.
                        NOTE - remember and check your customvars to ensure they are "Use as CUSTOMVAR" enabled.

                        This is untested.
                        Perhaps someone else can indicate if this should/does work or not.
                        Fergus Weir - teclan ltd
                        Ecommerce Digital Marketing

                        SellerDeck Responsive Web Design

                        SellerDeck Hosting
                        SellerDeck Digital Marketing

                        Comment


                          #13
                          That's it. You'd need to quote that customvar though e.g.
                          Code:
                          StockLevels(NETQUOTEVAR:STOCKLEVEL, "CUSTOMVAR:DELIVERYMESSAGE");
                          and remember that the double quote character is not allwed in that Customvars value.
                          Norman - www.drillpine.biz
                          Edinburgh, U K / Bitez, Turkey

                          Comment


                            #14
                            And this bit for Act_Primary would show a default message (which you can set into at the Design / Option / Shop Defaults or section level) if you haven't defined a message for that product.
                            Code:
                            <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                            <!--
                            function StockLevels(pItem,strMessage){
                                    if (strMessage == '') strMessage = "CUSTOMVAR:DELIVERYMESSAGE"; 
                            	if (pItem >= 1)
                            		{
                            		strIDs = 'Usually despatched next working day';
                            		}
                            	else
                            		{
                            		strIDs = strMessage;
                            		}
                            	return strIDs;
                            }
                            //-->
                            </script>
                            Norman - www.drillpine.biz
                            Edinburgh, U K / Bitez, Turkey

                            Comment


                              #15
                              Sorry guys – I’m still struggling with this.

                              To summarise. I currently have the following in Act_Primary.html:
                              Code:
                              <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                              function StockLevels(pItem)
                              <!--
                              	{
                              	var strIDs = 'Stock Message: '
                              	{
                              	if (pItem >= 1)
                              		{
                              		strIDs = 'Usually despatched next working day'
                              		}
                              	else
                              		{
                              		strIDs = 'Usually despatched within 7 working days'
                              		}
                              	}
                              	return strIDs
                              }
                              //-->
                              </script>
                              and the following in Act_ProductPrice.html:
                              Code:
                                  <script language="Javascript">
                              	document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL)) 
                                  </script>
                              This works fine as you can see at http://reallycleverhomes.co.uk/acatalog/MK_K182.html

                              I then have a customvar called DELIVERY which contains text giving a more accurate estimate of delivery lead time for a product that has a stock level of zero. On this basis I edited the code in Act_Primary.html as follows:
                              Code:
                              <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                              function StockLevels(pItem)
                              <!--
                              	{
                              	var strIDs = 'Stock Message: '
                              	{
                              	if (pItem >= 1)
                              		{
                              		strIDs = 'Usually despatched next working day'
                              		}
                              	else
                              		{
                              		strIDs = 'CUSTOMVAR:DELIVERY'
                              		}
                              	}
                              	return strIDs
                              }
                              //-->
                              </script>
                              My problem is that the content of this customvar doesn’t display (but it does display if I code it directly into Act_ProductPrice.html rather than calling it via javascript.

                              Is there something wrong with my logic?

                              (P.S. I tried Fergus' suggestion but got "undefined" for my product availability rather than the content of my customvar?)
                              Martin Durham

                              ReallyCleverHomes - your one-stop-shop for home technology

                              Comment

                              Working...
                              X