Announcement

Collapse
No announcement yet.

Document.write in price page

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

    Document.write in price page

    We have set up delivery to be free over £300 and I was hoping to use a document.write script to tell people if delivery would be free on the product they were viewing. Am I have problem, I think it is because the NETQUOTEVAR for the product includes the £ sign. Is there a different variable I can use or a way around this? I have included the type of script I was hoping to use in Act_ProductPrice.html

    <script type="text/javascript">
    var cost = NETQUOTEVAR:COST

    if (cost > 300)
    {
    document.write("& Free Delivery")
    }
    </script>

    Any help appreciated.

    Wyn
    www.firesonline.co.uk
    The wood burning stove specialists.

    #2
    Try
    Code:
    <script language=JavaScript>
    <!--
     var cost = 'NETQUOTEVAR:COST';			// get cost as string
     cost = cost.replace(/&#38;#163;|&#38;#44;|&#38;#36;/g,"");	// strip pound, dollar, and any commas
     cost = cost.replace(/&#38;#46;/,".") - 0;		// fix decimal point and make numeric
     if (cost > 300) 
      {
      document.write("& Free Delivery")
      }
    // -->
    </script>
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Wow - you know some stuff Norman.

      Thanks a lot, it's saved me ages of messing.

      Wyn
      www.firesonline.co.uk
      The wood burning stove specialists.

      Comment


        #4
        You may want to make your pages a bit smaller by moving most of the JavaScript into Act_Primary.html as a function - delcharge - and simply calling it via

        <script language=JavaScript>
        <!--
        delcharge('NETQUOTEVAR:COST');
        // -->
        </script>
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment

        Working...
        X