Announcement

Collapse
No announcement yet.

pass cart total to custom form

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

    pass cart total to custom form

    From my order 01 page...(the page where they fillin their address etc)...i have button which links to another page with a form in it.....they fill out the form then submit it to us.

    what i need is to pass their order total from the page where they fillin their address details to a pre-named input field in my form page.

    is this simple?

    #2
    JavaScript might do this. Add an id="gtotal" taglet to the existing grand total fields surrounding SPAN or DIV. Then in your new page use some JavaScript

    <input name="mytotal" id="mytotal" type="hidden">
    <script type="text/javascript">
    <!--
    document.getElementById('mytotal').value = opener.document.getElementById('gtotal').innerHTML;
    // -->
    </script>

    Another way would be to look in the Actinic cookie for the stored total (using getCartItem(1) ) but you'd need to load actiniccore.js and actinicextras.js into that page for these routines to work and the page would have to come from the same domain as the Actinıc site..
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Hi Norman, thx for the reply, the only thing im not sure about is that the order total is generated by a netquotevar in the Act_shoppingCart.xml file

      so where would i apply this taglet to?

      thx in advance

      Comment


        #4
        Act_ShoppingCartXML.html is the template to add the Javascript into, as this is the only template that displays the shopping cart. NETQUOTEVAR:TOTAL is the variable you need.

        It won't do any harm that this template will be used on all cart/checkout pages - as you can just add Norman's code into Act_Order01.html - just underneath where it says NETQUOTEVAR:THEORDERDETAILS

        Comment


          #5
          Hi Chris, the thing i was puzzled about was that the grand total field is generated from the NETQUOTEVAR:TOTAL as there is no physical tag to apply the I.D to where does the id="gtotal" get applied to..norman suggested using a taglet.
          would that just be <taglet id="gtotal">NETQUOTEVAR:TOTAL</taglet> along with the script

          then put the hidden input in my custom form?

          Comment


            #6
            Try replacing NETQUOTEVAR:TOTAL with
            <div id="gtotal">NETQUOTEVAR:TOTAL</div>

            and change the JavaScript to be

            Code:
            <input name="mytotal" id="mytotal" type="hidden">
            <script type="text/javascript">
            <!--
            document.getElementById('mytotal').value = opener.document.getElementById('gtotal').innerHTML;
            // -->
            </script>
            You may need some additional JavaScript to remove currency symbols, commas, etc from this price.

            You may find it useful to change the type="hidden" to type="text" for debugging as this will let you see what's happening.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              No idea I'm afraid. I don't thing 'taglet' is a valid HTML tag - I think it's just an expression.

              Norman - if you're about - could you clarify how the id="gtotal" would be added around NETQUOTEVAR:TOTAL?

              Comment


                #8
                Hi agen guys....thx for the help....im getting the error....is null or not an object....ive tried the js in both the xml page and my custom form page but get the error on both.....?

                Comment


                  #9
                  I just tested this and it works OK.

                  In Act_ShoppingCartXML.html I replaced

                  NETQUOTEVAR:TOTAL

                  with

                  <div id="gtotal">NETQUOTEVAR:TOTAL</div>

                  And in ActOrder01.html I added

                  <a href="javascript:ShowPopUp('TotalTest.html',500,500)">TOTAL TEST</a>

                  and made the small file TotalTest.html (which I added to Advanced / Additional Files) containing
                  Code:
                  <html>
                  <head>
                  <title>Popup Total Test</title>
                  </head>
                  <body>
                  <h1>Popup Total Test</h1>
                  
                  <input name="mytotal" id="mytotal" type="text">
                  <script type="text/javascript">
                  <!--
                  document.getElementById('mytotal').value = opener.document.getElementById('gtotal').innerHTML;
                  // -->
                  </script>
                  </body>
                  </html>
                  And it displays
                  Popup Total Test
                  £50.83 / $101.66
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    My order 01 page has an input button which changes the parent llocation to my form page....it doesnt open in a popup window.

                    so i tried taking off the opener....which i am guessing means for the popup window....i dont get any errors....but i just end up with an empty input field in my form page.....

                    Comment


                      #11
                      also the page i need to pass it to with my own form in is a secure https page......just im also gettin an access denied error....dont know wether thats stopping it working or not

                      Comment

                      Working...
                      X