Announcement

Collapse
No announcement yet.

Displaying a Message that Counts Down to Free Shipping

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

    Displaying a Message that Counts Down to Free Shipping

    Hi,

    I have followed the instructions in the AUG in order to include a message that tells people how much more they have to spend to qualify for free shipping.

    i.e. 'You need to spend £10 to obtain inclusive delivery!'

    I have followed the instructions correctly but for some reason, as soon as a product is added to the cart, the message displays as follows:

    'You need to spend £NaN to obtain inclusive delivery!'

    I can't understand where the 'NaN' is coming from. Does anybody have any ideas/suggestions?

    Thanks,
    Jules

    #2
    NaN stands for Not a Number - which means there is an error in your coding. You will need to very, very carefully proofread your changes. You are missing some punctuation or something.
    Bill
    www.egyptianwonders.co.uk
    Text directoryWorldwide Actinic(TM) shops
    BC Ness Solutions Support services, custom software
    Registered Microsoft™ Partner (ISV)
    VoIP UK: 0131 208 0605
    Located: Alexandria, EGYPT

    Comment


      #3
      Thanks Bill.

      I cut and pasted the text into my outer layout (created in Dreamweaver) directly from the AUG. I have double checked to make sure that there are no mistakes and it is the same as the AUG apart from the value being £10 instead of £100.

      Regards,
      Jules

      Comment


        #4
        Julie, whenever something doesn't work, everyone is sure they have done it correctly, when in reality 99.99% of the time thay have in fact done something wrong. I would suggest reading the code backwards so that you do not just brush past without noticing it. It will be a minor miracle if this is not down to a mistake by you. Mistakes in the AUG are like rocking horse doodah, too many people use it for errors not to have been noticed.

        Comment


          #5
          Just to reconfirm, you have this code, in full, in the Shopping cart page
          Code:
          <script language="javascript" type="text/javascript">
          function de(prc) {
          	var data, endata;
          	data = new String(prc);
          	data = data.split("& # 3 2 ;");
          	endata = cut(data[0]);
          	return endata;
          }
          function cut(dpt) {
          	stng = dpt.replace("& # 1 6 3 ;", "");
          	stang = stng.replace("& # 4 6 ;", ".");
          	return stang;
          }
          var left;
          price = de(getCartItem(1));
          if (price >= 10) {
          	document.write("You have qualified for free shipping!");
          }
          else {
          	left = 10 - price;
          	document.write("You need to spend £"+left+" to obtain free shipping!");
          }
          </script>
          note - original 100 changed to 10 = £10.

          If your prices are not in £ - then this line

          stng = dpt.replace("& # 1 6 3 ;", "");

          will need amended. Replace "& # 1 6 3;" with the correct ASCII code for your currency symbol.
          Bill
          www.egyptianwonders.co.uk
          Text directoryWorldwide Actinic(TM) shops
          BC Ness Solutions Support services, custom software
          Registered Microsoft™ Partner (ISV)
          VoIP UK: 0131 208 0605
          Located: Alexandria, EGYPT

          Comment


            #6
            Hi Bill,

            Yes, I have exactly the same code apart from the words are different:

            e.g. 'You need to spend £10 to obtain inclusive delivery!'

            Prices are in £s only.

            The code is in my outer layout which I created in Dreamweaver. Therefore, it appears on every page. The AUG does not specify that it has to be on the shopping cart page. Do you think this could be the problem? i.e. It should only be on the shopping cart page?

            I don't think for one minute that the AUG is incorrect but something somewhere seems to be causing a conflict.

            Thanks for your help.
            Jules

            Comment


              #7
              The fragments

              "& # 3 2 ;"
              "& # 1 6 3 ;"
              "& # 4 6 ;"

              need edited to remove the spaces between the characters.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                As well as the above I see a potential bug where this patch will fail if your price is above £999. Actinic will stick a comma in and this needs removed.

                Replace

                Code:
                	stang = stng.replace("& # 4 6 ;", ".");
                	return stang;
                with

                Code:
                	stang = stng.replace("& # 4 6 ;", ".");
                	stang = stang.replace("& # 4 4 ;", "");
                	return stang;
                and again remove all spaces that are between the "&...".
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  Thank you very much Norman.

                  Norman,

                  That's done the trick, it's working fine now. Thanks for your help.

                  I will let the helpdesk know so they can amend the AUG.

                  Looks like a minor miracle has occurred today, eh, Lee?!
                  Jules

                  Comment


                    #10
                    Hehe. Not one, but two errors in a single AUG article. Of course it wasn't one I wrote - mine have more
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #11
                      Originally posted by JulesRS
                      Looks like a minor miracle has occurred today, eh, Lee?!
                      WOW, looks like you are right. Well that is the first time i've ever personally seen the AUG with an error, let alone two, if it's true of course. How many selfish gits must have installed this and never highlighted the issue?

                      Comment


                        #12
                        The error with the spaces was detailed in the original V8 AUG thread, however It appears the error was detected after the code was inserted into the guide ...Think I'll mention this in the said thread

                        How many selfish gits must have installed this and never highlighted the issue?
                        I wonder how many people have installed without testing properly too!!
                        Ladies Swimwear
                        www.li-fi.co.uk

                        Comment


                          #13
                          Norman,

                          I've just noticed something else with this. I have a minimum order of £5 on my website and everything seems to countdown as it should do until I add the product which takes the value over the £5 minimum order. Then this happens:

                          'You need to spend £2.6100000000000003 to obtain inclusive delivery!'

                          It should just read £2.61 but seems to be getting a bit zero happy! Do you know what could be causing this?

                          I've fiddled about with it and it only seems to spin out with the product that takes the total value over the minimum order value.

                          Very odd.
                          Jules

                          Comment


                            #14
                            That'll be the 3rd bug appearing then.

                            You might need to amend the JavaScript to use the .toFixed method.

                            Change

                            left = 10 - price;

                            to

                            left = (10 - price).toFixed(2);
                            Norman - www.drillpine.biz
                            Edinburgh, U K / Bitez, Turkey

                            Comment


                              #15
                              lol! ok, I'm going to try this out now once I've sorted out my other script problem. Will let you now how I get on.

                              Thanks again.
                              Jules

                              Comment

                              Working...
                              X