Need help with INCV page url

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SidFeyDesigns
    Mighty Mivite








    • Jan 2012
    • 598

    #1

    Need help with INCV page url

    Is there a way to make sure that when checking out with Amazon pay or using the regular checkout and the customer is brought to the INVC page that the URL in the address bar reads https://www.example.com/INVC.html instead of https://www.example.com/mm5/merchant.mvc?

    We use the Toolkit Shortlinks (Legacy Shortlinks)

    The code for the OPAY page form:

    Code:
                <form method="post" action="&mvt:payment:url;" id="js-opay-form" class="clearfix">
                    <input type="hidden" name="Action" value="AUTH" />
                    <input type="hidden" name="Screen" value="INVC" />
                    <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" />
                    <mvt:item name="payment" />
                    <input type="hidden" name="PaymentMethod" value="&mvte:global:PaymentMethod;" />
                    <input type="hidden" name="SplitPaymentData" value="&mvte:global:SplitPaymentData;" />
                    <input type="hidden" name="PaymentDescription" value="&mvte:payment:desc;" />
                    <div>
                        <p class="column whole h4 fields-heading" style="background:#e8e8e8;margin-bottom:0"><span class="icon-icon_lock"></span> Payment Method: &mvt:payment:desc;</p>
                    </div>
                    <div class="column whole bg-lt-gray ptp1 pbm1 mbm1-25">
                        <div class="column whole medium-half">
                            <mvt:if expr="NOT ISNULL l.settings:payment:desc">
                                <span class="bold"></span>
                            </mvt:if>
                            <mvt:if expr="NOT ISNULL l.settings:payment:message">
                                <p class="column whole">&mvt:payment:message;</p>
                            </mvt:if>
                            <mvt:if expr="l.settings:paymentsettings:mivapay:enabled AND ( l.settings:mivapay:paymentcardtype:id OR l.settings:mivapay:paymentcard:id )">
                                <div class="form-row">
                                    <mvt:item name="mivapay" />
                                </div>
                            <mvt:elseif expr="'brain' CIN g.PaymentMethod">
                                <mvt:foreach array="payment:fields" iterator="field">
                                    <div class="form-row">
                                        <mvt:item name="payment" param="field:code" />
                                    </div>
                                </mvt:foreach>
                            <mvt:else>
                                <mvt:foreach array="payment:fields" iterator="field">
                                    <div id="js-&mvt:field:code;" class="form-row">
                                        <mvt:if expr="l.settings:field:invalid">
                                            <label class="required error">&mvt:field:prompt;</label>
                                        <mvt:else>
                                            <label class="required">&mvt:field:prompt;</label>
                                        </mvt:if>
                                        <div class="&mvt:field:code;"><mvt:item name="payment" param="field:code" /></div>
                                    </div>
                                </mvt:foreach>
                            </mvt:if>
                            <mvt:if expr="l.settings:payment:capabilities:split">
                                <div class="form-row">
                                    <mvt:if expr="g.Amount_Invalid">
                                        <label class="required error">Payment Amount:</label>
                                    <mvt:else>
                                        <label class="required">Payment Amount:</label>
                                    </mvt:if>
                                    <div id="payment-amount-fields">
                                        <mvt:if expr="( NOT l.settings:payment:capabilities:balance ) OR ( l.settings:payment:balance GE l.settings:splitpayment:remaining )">
                                            <mvt:if expr="NOT g.UI_Exception">
                                                <mvt:assign name="g.AmountType" value="'total'" />
                                                <mvt:assign name="g.Amount" value="l.settings:splitpayment:remaining ROUND 2" />
                                            </mvt:if>
                                            <mvt:if expr="g.AmountType EQ 'total'">
                                                <input type="radio" name="AmountType" value="total" onclick="AmountType_Changed( this.value );" checked />
                                            <mvt:else>
                                                <input type="radio" name="AmountType" value="total" onclick="AmountType_Changed( this.value );" />
                                            </mvt:if>
                                            <mvt:if expr="NOT ISNULL l.settings:payment:split_data">
                                                Remaining Order Total (&mvt:payment:formatted_remaining;)<br />
                                            <mvt:else>
                                                Entire Order Total (&mvt:basket:formatted_total;)<br />
                                            </mvt:if>
                                        <mvt:else>
                                            <mvt:if expr="NOT g.UI_Exception">
                                                <mvt:assign name="g.AmountType" value="'balance'" />
                                                <mvt:assign name="g.Amount" value="l.settings:payment:balance ROUND 2" />
                                            </mvt:if>
                                            <mvt:if expr="g.AmountType EQ 'balance'">
                                                <input type="radio" name="AmountType" value="balance" onclick="AmountType_Changed( this.value );" checked />
                                                <input type="hidden" id="payment-balance-amount" name="Amount" value="&mvte:payment:balance;" />
                                            <mvt:else>
                                                <input type="radio" name="AmountType" value="balance" onclick="AmountType_Changed( this.value );" />
                                                <input type="hidden" id="payment-balance-amount" name="Amount" value="&mvte:payment:balance;" disabled />
                                            </mvt:if>
                                            Available Balance (&mvt:payment:formatted_balance;)<br />
                                        </mvt:if>
                                        <mvt:if expr="g.AmountType EQ 'partial'">
                                            <input type="radio" name="AmountType" value="partial" onclick="AmountType_Changed( this.value );" checked />
                                            Partial: <input type="text" id="payment-amount" name="Amount" value="&mvte:global:Amount;" />
                                        <mvt:else>
                                            <input type="radio" name="AmountType" value="partial" onclick="AmountType_Changed( this.value );" />
                                            Partial: <input type="text" id="payment-amount" name="Amount" value="&mvte:global:Amount;" disabled />
                                        </mvt:if>
                                    </div>
                                </div>
                                <mvt:if expr="g.AmountType EQ 'total'">
                                    <mvt:assign name="g.totalPayment" value="'display: none;'" />
                                </mvt:if>
                                <div id="payment-additional" style="&mvt:global:totalPayment;">
                                    <div class="form_row">
                                        <label class="required">Pay Additional Balance With:</label>
                                        <select name="AdditionalPaymentMethod">
                                            <mvt:foreach array="paymentmethods" iterator="method">
                                                <mvt:if expr="(l.settings:method:module NE 'customercredit') OR ((g.PaymentMethod NE 'customercredit:credit') AND  (NOT miva_array_search(l.settings:splitpayment:splits, 1, l.split, 'l.split:module:code EQ l.settings:method:module')))">
                                                    <mvt:if expr="l.settings:method:paymentcard:id">
                                                        <option value="paymentcard:&mvte:method:paymentcard:id;">&mvt:method:name;</option>
                                                    <mvt:elseif expr="l.settings:method:paymentcardtype:id">
                                                        <option value="paymentcardtype:&mvte:method:paymentcardtype:id;">&mvt:method:name;</option>
                                                    <mvt:else>
                                                        <option value="&mvte:method:module;:&mvte:method:code;">&mvt:method:name;</option>
                                                    </mvt:if>
                                                </mvt:if>
                                            </mvt:foreach>
                                        </select>
                                    </div>
                                </div>
                            </mvt:if>
                        </div>
                    </div>
                    <div class="breaker"></div>
                    <div>
                        <div class="column whole align-center np">
                            <mvt:if expr="l.settings:paymentsettings:mivapay:enabled AND ( l.settings:mivapay:paymentcardtype:id OR l.settings:mivapay:paymentcard:id )">
                                <script>
                                    var onclick_submit = function( event ) {
                                        if ( MivaPay && ( typeof MivaPay.Submit === 'function' ) ) {
                                            MivaPay.Submit( function() {
                                                var form;
    
                                                form = document.getElementById( 'js-opay-form' );
                                                form.submit();
                                            } );
                                        }
                                    }
                                </script>
                                <span onclick="onclick_submit(); return false;">
                                    <input class="button button-large-font corners bg-sky" type="submit" value="Complete Order" title="Complete Order">
                                    <p class="ptp1"><span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal&#63;sealID=O77iPdMF08ACXGhM5cEzqTjCiEH72r6dwXCQDC3RAcc0NWC6cK"></script></span></p>
                                    <p><script src="https://sealserver.trustwave.com/seal.js?style=invert&amp;size=65x36&amp;code=f6e634926e664239a5a4daf7f9938bee"></script></span></p>
                                </span>
                            <mvt:elseif expr="'brain' CIN g.PaymentMethod">
                                <input class="button button-large-font corners bg-sky" type="submit" value="Complete Order" title="Complete Order">
                                <p class="ptp1"><span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal&#63;sealID=O77iPdMF08ACXGhM5cEzqTjCiEH72r6dwXCQDC3RAcc0NWC6cK"></script></span></p>
                                <p><script src="https://sealserver.trustwave.com/seal.js?style=invert&amp;size=65x36&amp;code=f6e634926e664239a5a4daf7f9938bee"></script></span></p>
                            <mvt:else>
                                <input class="button button-large-font corners bg-sky" type="submit" value="Complete Order" title="Complete Order">
                                <p class="ptp1"><span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal&#63;sealID=O77iPdMF08ACXGhM5cEzqTjCiEH72r6dwXCQDC3RAcc0NWC6cK"></script></span></p>
                                <p><script src="https://sealserver.trustwave.com/seal.js?style=invert&amp;size=65x36&amp;code=f6e634926e664239a5a4daf7f9938bee"></script></span></p>
                            </mvt:if>
                        </div>
                    </div>
                    <div class="breaker"></div>
                </form>
    Code for AMAZONPAY_OPAY form:

    Code:
                <form method="post" action="&mvt:global:secure_sessionurl;" id="js-opay-form" class="clearfix">
                    <input type="hidden" name="Action" value="AUTH" />
                    <input type="hidden" name="Screen" value="INVC" />
                    <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" />
                    <div class="column whole medium-half mbm1-25">
                    <p class="h4 fields-heading"><span class="icon-icon_lock"></span> Select Amazon Payment Method Below</p>
                        <mvt:item name="amazonpay_wallet" />
                    </div>
                    <div class="column whole medium-half mbm1-25">
                    <p class="h4 fields-heading">Amazon Shipping Address</p>
                        <mvt:item name="amazonpay_address" />
                    </div>
                    <input type="hidden" name="PaymentMethod" value="&mvte:global:PaymentMethod;" />
                    <input type="hidden" name="PaymentAuthorizationToken" value="&mvte:global:Basket:auth_token;" />
                    <div class="column whole align-center np">
                        <input class="button button-large-font corners bg-sky" type="submit" value="Complete Order" title="Complete Order">
                        <p class="ptp1"><span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal&#63;sealID=O77iPdMF08ACXGhM5cEzqTjCiEH72r6dwXCQDC3RAcc0NWC6cK"></script></span></p>
                        <p><script src="https://sealserver.trustwave.com/seal.js?style=invert&amp;size=65x36&amp;code=f6e634926e664239a5a4daf7f9938bee"></script></span></p>
                    </div>
                </form>
    Just want to make sure our google analytics / adwords transactions are being recorded accurately.

    Thanks!
    Nick Harkins
    www.loveisarose.com
  • 216justin
    Mini Mivite

    • May 2018
    • 37

    #2
    Depending on your exact needs and your reason for needing this, adding the following to your INVC page may or may not be sufficient:

    Code:
    <script>
       window.history.pushState("INVC.html", "Invoice Page", '/INVC.html');
    </script>
    That JavaScript will update the URL in the browser's address bar once it's processed. This approach might be ideal if all you care about is showing that URL to the customer. (There would be some period of time in between the user submitting the OPAY form and that JavaScript being processed where the browser would reflect the current URL.On the off chance that the motivation behind this change is related to Google Analytics, conversion tracking, or some other tracking scripts, the previously mentioned JavaScript snippet won't get you the desired result.

    The alternative would involve updating the form actions on those pages, but that can introduce some problems. Assuming that the form action's were updated to point to INVC.html, the server would still have to do an internal redirect to route the request to the merchant.mvc script. With apache, redirects typically result in the request's POST body (the form data) being dropped, unless it's done with a proxy. Some additional details about that can be seen at: https://stackoverflow.com/questions/...in-post-params


    Justin Sims
    216digital
    Cleveland Area - Code and Design
    https://216digital.com/

    Comment

    • SidFeyDesigns
      Mighty Mivite








      • Jan 2012
      • 598

      #3
      We would be doing it more so for google analytics/conversion tracking. Just want to make sure its tracking correctly

      Would it make sense to do the java code mixed with editing the analytics tracking code?

      add this to the INVC page

      Code:
       
       <script>    window.history.pushState("INVC.html", "Invoice Page", '/INVC.html'); </script>
      and then make the tracking code look like this

      Code:
      <mvt:miva compresswhitespace="off" />
      <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      
      ga('create', '<mvt:item name="ga_jsencode" param="ga_tracking:google_id_unencoded" />', 'auto');
      <mvt:if expr="l.settings:page:code EQ 'SFNT'">
          ga( 'send', 'pageview', { 'page':'/' } );
      <mvt:elseif expr="l.settings:page:code EQ 'INVC'">
          ga( 'send', 'pageview', { 'page':'/INVC.html' } );
      <mvt:else>
          ga( 'send', 'pageview', { 'page':'/<mvt:item name="ga_jsencode" param="ga_tracking:url_override_unencoded" />' } );
      </mvt:if>
      </script>
      Nick Harkins
      www.loveisarose.com

      Comment

      • 216justin
        Mini Mivite

        • May 2018
        • 37

        #4
        In that case, I would say forget about the first snippet. The second snippet (The Analytics Tracking Code Template) should give you the desired effect.
        Justin Sims
        216digital
        Cleveland Area - Code and Design
        https://216digital.com/

        Comment

        • SidFeyDesigns
          Mighty Mivite








          • Jan 2012
          • 598

          #5
          Awesome, Thank you for the help!
          Nick Harkins
          www.loveisarose.com

          Comment

          Working...
          X