Announcement

Collapse
No announcement yet.

Estimated Delivery Times Out Of Stock Messages

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

    #16
    With Norman's keen eye and input the solution should be

    In your Primary template your stock level javascript function should be
    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>
    In your product line template the code should read
    Code:
        <script language="Javascript">
    	document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL,"CUSTOMVAR:PRODUCTDELIVERYMESSAGE")) 
        </script>
    For the above example you will need to create 2 Custom properties.

    DELIVERYMESSAGE - this is a default delivery message that displays when out of stock AND no product specificdelivery message has been specified. (specified at "Design | Options" in site default)

    PRODUCTDELIVERYMESSAGE - this is the product specific delivery message that displays when a product is out of stock. (specified for each product)

    Please note Norman's point about "no quote characters in customvar value field" and ensure you have the "USE AS CUSTOMVAR" option checked for each customvar you create.

    Hope this helps
    Fergus Weir - teclan ltd
    Ecommerce Digital Marketing

    SellerDeck Responsive Web Design

    SellerDeck Hosting
    SellerDeck Digital Marketing

    Comment


      #17
      Here's the entire thing made more compact and all in one post so it will be of use to everyone.

      Put this in Act_Primary.html just above the </HEAD> tag.
      Code:
      <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
      <!--
      function StockLevels(pItem,strMessage){
       document.write(pItem >= 1 ? 'Usually despatched next working day' : strMessage);
      }
      //-->
      </script>
      Put this in Act_ProductLine.html
      Code:
      <script language="Javascript">
      <!--
       StockLevels(NETQUOTEVAR:STOCKLEVEL, "CUSTOMVAR:DELIVERY");
      //--> 
      </script>
      Now create a Custom Property called DELIVERY. Then in Design / Options / Site Defaults set DELIVERY to a default message (this will be used if you don't set DELIVERY at the product level). This will save you time amending products as perhaps many products share the same default time. You can also set DELIVERY at the section level if the majority of that page's products share the same message. You can still override this per product if required.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #18
        Nearly (but not quite!)?

        Norman

        Now I'm really puzzled. I think I've followed your instructions faithfully. The result is that it works for a product that is in stock (http://www.reallycleverhomes.co.uk/a...g/MK_K182.html but reports "undefined" both for a product that is out of stock and doesn't have DELIVERY defined (http://www.reallycleverhomes.co.uk/a.../MK_K3520.html) and for one that is out of stock and does have DELIVERY defined (http://www.reallycleverhomes.co.uk/a.../MK_K3523.html

        At first sight, even the generated html looks ok to me for each of the above 3 cases.

        Any thoughts?
        Martin Durham

        ReallyCleverHomes - your one-stop-shop for home technology

        Comment


          #19
          You have code in Act_ProductPrice.html and NETQUOTEVAR:STOCKLEVEL isn't valid there. Remove all that and only put the patch in Act_ProductLine.html.

          Also replace the outdated JavaScript that's in Act_ProductLine.html.

          It's always best to test JavaScript patches in Firefox and do Tools / JavaScript Console to get meaningful error messages.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #20
            Sorted!

            Thanks Norman. That's sorted it.
            Martin Durham

            ReallyCleverHomes - your one-stop-shop for home technology

            Comment


              #21
              That Was Quick

              Right suppose since I started all thia I'd best get my website sorted out then!
              Andy McCallum

              The Craft Shop

              www.thecraftshoponline.co.uk

              Comment


                #22
                Confused again

                Gents

                I have done what I thought but I cant get rid of the 'undefined' where is the problem. I have posted the website so you can have a look. It works OK where I have defined the custom VAR but when the custom VAR is not defined then I get undefined on the layout.

                Do I need to know more about HTML to resolve this or is it Java?
                Andy McCallum

                The Craft Shop

                www.thecraftshoponline.co.uk

                Comment


                  #23
                  Originally posted by Andy_Mac
                  Gents

                  I have done what I thought but I cant get rid of the 'undefined' where is the problem. I have posted the website so you can have a look. It works OK where I have defined the custom VAR but when the custom VAR is not defined then I get undefined on the layout.

                  Do I need to know more about HTML to resolve this or is it Java?
                  Think i've sorted it, but would appreciate you giving it a once over

                  Thanks
                  Andy McCallum

                  The Craft Shop

                  www.thecraftshoponline.co.uk

                  Comment

                  Working...
                  X