Announcement

Collapse
No announcement yet.

PayPal Express, Custom fields on Payment and Shipping Options page

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

    PayPal Express, Custom fields on Payment and Shipping Options page

    Hi,
    We are using some custom fields on the Payment and Shipping Options page. This works great except for when a customer uses PayPal Express for their payment method. When they use PayPal Express then they go directly to PayPal and the custom fields are never captured. Is there any way to capture the custom field information before they go to PayPal.com?

    Thank you

    #2
    Re: PayPal Express, Custom fields on Payment and Shipping Options page

    You need to save the custom fields to the database before they leave to go to paypal. Most likely you need some JavaScript to add an onClick event to the submit button so that the custom fields can be saved before they are taken to PayPal.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Re: PayPal Express, Custom fields on Payment and Shipping Options page

      forget it. I misspoke.
      Larry
      Last edited by wajake41; 06-16-15, 06:42 AM.
      Larry
      Luce Kanun Web Design
      www.facebook.com/wajake41
      www.plus.google.com/116415026668025242914/posts?hl=en


      Comment


        #4
        Re: PayPal Express, Custom fields on Payment and Shipping Options page

        Thank you. I have added some javascript to run when the Continue button is clicked. I can verify that it is working because I put a pop up in the function and that works, but I do not know how to put the miva custom fields write and read code into javascript. I have tried the below code but it does not work:

        function ContinueFunction() {
        <mvt:item name="customfields" param="Write_Basket( 'order_notes', g.order_notes )" />
        <mvt:item name="customfields" param="Read_Basket( 'order_notes', g.order_notes )" />
        }

        Comment


          #5
          Re: PayPal Express, Custom fields on Payment and Shipping Options page

          Javascript runs clientside (in the browser) while the template language runs on the server. In order to do what you want, you will need to make a request back to the server to save the fields. This can be done with an AJAX request.

          Here is some sample code:

          Code:
          <script>
          function saveCustomFields() {
              var special_instructions = $("#special_instructions").val();
              if (special_instructions != '') {
                  var url = "/mm5/merchant.mvc?Screen=SAVECUSTOM&Store_Code=CODE&data=" + encodeURIComponent(special_instructions);
                  $.get(url, function(data) {
                      document.forms["osel-form"].submit();
                  });
              } else {
                  document.forms["osel-form"].submit();
              }
          } 
          < /script>
          This is looking for a form input with an id of "special_instructions"

          Then in Miva you need to create a page called SAVECUSTOM and add your template code to save the values.

          <mvt:item name="customfields" param="Write_Basket( 'order_notes', g.order_notes )" />

          Last to call the function above add this onClick event to the continue button:

          onclick="saveCustomFields(); return false;"
          Brennan Heyde
          VP Product
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment


            #6
            Re: PayPal Express, Custom fields on Payment and Shipping Options page

            Perfect, thanks!

            Comment


              #7
              Hi Brennan,

              I'm applying Levels Readytheme to a new store which has the custom order field "order_instructions" on the OSEL page.

              Testing with PayPal didn't save this field so I searched the problem here and that's how I got to this thread.

              1. Does the code you suggest above still apply (apart from changing "special_instructions" to "order_instructions".)?

              2. As you are now shipping Levels Readytheme with this custom field, would it make sense to include the code/process above into the Readytheme itself? (With PayPal becoming evermore present, more and more people will run into this problem.)


              cheers,
              Michael

              Comment

              Working...
              X