Announcement

Collapse
No announcement yet.

Spend ? More ...

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

    Spend ? More ...

    Hi,

    Can anyone tell me how to use javascript to display an amount that needs to be spent before delivery is free? For example, I offer free delivery over £25 and want to say something like "Spend £8.37 More for free delivery!".

    var freedelivery = 25 - getCartItem(1);

    I then use freedelivery in my javascript but I get NaN coming up instead of the actual amount. Where am I going wrong?

    Thanks,
    Paul.

    #2
    You are re-inventing the wheel. Actinic already does a spend x more to get y message, you just need to set up where it displays.

    See Help | Help Topics - Discounts, Discounts based on order value
    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
      Hi Bill,

      Unfortunately its not what I need - I need a variable so I can do other things with it (if its possible with this, please let me know).

      I think I know what the problem is, its the leading £. Any idea how I can remove that, or even better, tell actinic to not insert it when writing the cookie in the first place?

      Thanks,
      Paul.

      Comment


        #4
        You'll need a regex line to strip off all non-numerics - don't forget GBP25.00 is represented as 2500 in Actinic speak.

        Norman has posted code several times which show the javascript stripping technique, but it's probably easier just to a web search on javascript and regex.
        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


          #5
          Thanks bill, off I go!

          Comment


            #6
            Assuming cost contains the Actinic formatted string

            Code:
             cost = cost.replace(/£|,|$/g,"");	// strip pound, dollar, and any commas
             cost = cost.replace(/./,".") - 0;		// fix decimal point and make numeric
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Thanks Norman, that worked a treat

              Paul.

              Comment

              Working...
              X