Announcement

Collapse
No announcement yet.

Custom Fields on the Checkout page

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

    Custom Fields on the Checkout page

    This question has two parts that I need help with
    1. I need to add a custom field to collect some information from the customer that is unique to his order. I had Miva add the field to the checkout page and you can enter information into the field, but the input is never sent to the invoice as is the customers name and address. We need this input to determine what custom part is needed for his vehicle.

    2. I am playing around with my dev site and have added the field to the checkout page but am having problems getting it to line up with the rest of the fields

    Please can you send me some code to get this working?
    I got the field on the check out page. But now I still need to call the input to the invoice page and to the miva store order processing page
    Last edited by DHESS; 07-29-15, 05:01 PM.

    #2
    Re: Custom Fields on the Checkout page

    I found this the other day and implemented it successfully:

    https://gist.github.com/dandaron/ee3ea0b4d8636e5a57a0

    The layout will of course depend on your site. Can you provide a link to your dev store?

    I hope this helps.

    Regards,

    Eldon
    Last edited by eldon99; 07-30-15, 12:21 PM.

    Comment


      #3
      Re: Custom Fields on the Checkout page

      Does the addendum module not do what you are looking for?

      http://apps.miva.com/addendum-checkout-questions.html

      Comment


        #4
        I am trying to convert from the EmporiumPlus Addendum module (forgive me Bill) to the custom fields. I went to look for copy & paste coding samples like Bill had to help me implement a set of radio button questions. The link Eldon shared is now a 404. The Miva Docs page is screenshots http://docs.miva.com/reference-guide...om-bask-fields The reference guide only tells you how to create the custom field in the admin without mention to editing code http://docs.miva.com/reference-guide/custom-fields, maybe page 527 has them. I did find the developer code snippets but it's still not as simplified as http://www.emporiumplus.com/v4/addendumtokens.txt - is there anything as simple as this out there?
        Leslie Kirk
        Miva Certified Developer
        Miva Merchant Specialist since 1997
        Previously of Webs Your Way
        (aka Leslie Nord leslienord)

        Email me: [email protected]
        www.lesliekirk.com

        Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

        Comment


          #5
          Well, let me give it a shot:

          If, we are asking the questions on OPAY, you'd create the input fields like this:
          Code:
          <input type="text" name="addQuestion1" value=""/>
          <input type="text" name="addQuestion2" value=""/>
          <select name="addQuestion3">
          <option value="this">This</option>
          <option value="that">That</option>
          </select>
          and place it inside the web post form

          Then, on the INVC screen, (I put them in the INVC header cause nothing else is in there) you'd add:

          Code:
          <mvt:item name="customfields" param="Write_Order( l.settings:order:id, 'addQuestion1, g.addQuestion1 )" />
          <mvt:item name="customfields" param="Write_Order( l.settings:order:id, 'addQuestion2, g.addQuestion2 )" />
          <mvt:item name="customfields" param="Write_Order( l.settings:order:id, 'addQuestion3, g.addQuestion3 )" />
          Now, you can use the read functions to call that data back (for example, in a templated email)

          Code:
          <mvt:item name="customfields" param="Read_Order( l.settings:order:id, 'addQuestion1', g.the_result_of_the_Read )" />
          To use the variables on the INVC screen, just use the globals created by CGI (i.e., g.addQuestion1)

          Notes:
          the l.settings:order:id might need to change depending on the scope of their use.
          to do this on OSEL, you'll move the Write functions to OPAY and then use the Read functions on the INVC page.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            Originally posted by lesliekirk View Post
            I am trying to convert from the EmporiumPlus Addendum module (forgive me Bill) to the custom fields. I went to look for copy & paste coding samples like Bill had to help me implement a set of radio button questions. The link Eldon shared is now a 404. The Miva Docs page is screenshots http://docs.miva.com/reference-guide...om-bask-fields The reference guide only tells you how to create the custom field in the admin without mention to editing code http://docs.miva.com/reference-guide/custom-fields, maybe page 527 has them. I did find the developer code snippets but it's still not as simplified as http://www.emporiumplus.com/v4/addendumtokens.txt - is there anything as simple as this out there?
            Leslie, can once accomplish everything old man Weiland's Addendum module can than without it?
            Thank you, Bill Davis

            Comment


              #7
              Originally posted by William Davis View Post

              Leslie, can once accomplish everything old man Weiland's Addendum module can than without it?
              I "think" so, but I haven't been able to fully implement everything I want to try to do yet. Again, Bill gave us examples for all of the form field types.
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

              Comment


                #8
                Originally posted by lesliekirk View Post

                I "think" so, but I haven't been able to fully implement everything I want to try to do yet. Again, Bill gave us examples for all of the form field types.
                Well, according to his documentation his module had many features (check it out here http://www.emporiumplus.com/SFNT.html -what a beast!).
                Thank you, Bill Davis

                Comment


                  #9
                  I am trying to accomplish a similar task as Leslie and move off of the Addendum module and relying on the Miva Custom Order Fields. (I'm also hoping Bill would approve - I have relied on his modules and forum posts for years)

                  I followed Bruce's suggested coding. However, our questions are better suited to sit on the OSEL page:
                  Code:
                  <input type="text" name="addQuestion1" value=""/>
                  <input type="text" name="addQuestion2" value=""/>
                  <select name="addQuestion3">
                  <option value="this">This</option>
                  <option value="that">That</option>
                  </select>
                  On the OPAY page I tried writing the values to the Order custom fields, but couldn't get that to work. I realized that I have no Order yet (duh), so I am writing to the Basket custom fields on the OPAY page

                  Code:
                  <mvt:item name="customfields" param="Write_Basket( 'addQuestion1, g.addQuestion1 )" />
                  Once the user completes checkout, the Basket custom fields are automatically written to the Order custom fields (no coding required ).

                  The problem I am seeing is when there is a payment error on the OPAY page. I was testing with check payment method and forgot to put the check # in on the OPAY screen. The custom field data is not getting written in this case.

                  To troubleshoot I decided to have the values display on the OPAY screen
                  Code:
                  &mvt:global:addQuestion1;   
                  etc
                  etc
                  These values disappear off the screen when I repeated the payment error.

                  What am I missing ? How do I hold these values?


                  I made it this far, but would appreciate if anyone has a suggestion!

                  Shannon


                  Shannon Wright
                  Xact Xpressions, Inc.

                  Comment


                    #10
                    Well, I had a great thought. My OPAY code to Write_Basket is inside the <form> tag, so I moved that statement to the header. Still didn't fix the problem. Gaaaah.
                    Shannon Wright
                    Xact Xpressions, Inc.

                    Comment


                      #11
                      Just place the values you are getting from your custom input fields in 'hidden" fields like so

                      <input type="hidden" name="name-of-field" value="&mvte:global:name-of-field;" />

                      and make sure they appear with the <form></form> of the page.
                      Bruce Golub
                      Phosphor Media - "Your Success is our Business"

                      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                      phosphormedia.com

                      Comment


                        #12
                        The purpose of this very long post is to assist others who want to replace their Emporium Plus Addendum module with the Miva Custom Fields. This is done in tribute to Bill Weiland who always provided great snippets of code so we could learn how to use Miva without being a full time developer. I have also learned how difficult documenting code can be, so I apologize for anything I ever thought about Bill's documentation.

                        First, Create your custom fields under Utilities > Install Custom Fields Module, then > Custom Fields > Add Field > Be sure to select type = "ORDER Field" and field type = either "text" or "textarea".
                        ***I got this example to work with a text field (question1 = Event Date) and textarea (question2 = Special Instructions)

                        Second, Be sure to enable "customfields" on the Items tab of the appropriate pages. In my case OSEL, OPAY, INVC, ORDP (printable confirmation), the email templates EMAIL_ORDERCONF_CUSTOMER , and EMAIL_ORDERCONF_MERCHANT, and Order Status ORDS. Also, if you use the Printable Invoice ORDER_INVOICE (Order Processing > Batch Actions > Batch Report > Printable Invoice)

                        I wanted to replicate use of Weiland's Addendum tokens like %question1%, which will retain the responses for the user if they leave or reload the page.

                        Assumption: I am asking my questions on OSEL and passing them along through checkout. If you start on a different page, this probably won't work exactly the same.

                        OSEL page code goes anywhere inside the <form> tag.
                        I used &mvte to prevent execution of any malicious code a hacker might enter into the text fields. I think I am using this correctly.
                        Code:
                        <mvt:item name="customfields" param="Read_Basket( 'question1', l.settings:custom_basket_question1 )" />
                        <label>Event Date</label><input type="text" name="question1" value="&mvte:custom_basket_question1;" >
                        
                        <mvt:item name="customfields" param="Read_Basket( 'question2', l.settings:custom_basket_question2 )" />
                        <label>Special Instructions</label><textarea name="question2">&mvte:custom_basket_question2;</textarea>
                        On OPAY, I will
                        1) evaluate the value and if it exists
                        2) display the value for the customer to see
                        3) Write the value to the BASKET custom fields
                        4) Put the value into hidden fields in the case of the page being reloaded

                        Code goes anywhere inside the<form> tag
                        Code:
                        <mvt:if expr="NOT ISNULL g.question1">
                            <label>Event Date:</label>&mvt:global:question1;
                            <br />
                            <input type="hidden" name="question1" value="&mvte:global:question1;">
                            <mvt:item name="customfields" param="Write_Basket( 'question1', g.question1 )" />
                        </mvt:if>
                        <mvt:if expr="NOT ISNULL g.question2">
                            <label>Special Instructions:</label>&mvt:global:question2;
                            <input type="hidden" name="question2" value="&mvte:global:question2;">
                            <mvt:item name="customfields" param="Write_Basket( 'question2', g.question2 )" />
                        </mvt:if>
                        In my testing I noticed that after the OPAY page is submitted, the BASKET custom field values are automatically written to the ORDER custom fields, so please correct me if I should be forcing a Write_Order here.

                        INVC page, I put this in the FOOTER
                        Code:
                        <mvt:item name="customfields" param="Read_Basket('question1', g.question1 )" />
                        <mvt:if expr="NOT ISNULL g.question1">
                            <label>Event Date:</label>&mvte:global:question1;
                            <br />
                        </mvt:if>
                        <mvt:item name="customfields" param="Read_Basket('question2', g.question2 )" />
                        <mvt:if expr="NOT ISNULL g.question2">
                            <label>Special Instructions:</label>&mvte:global:question2;
                        </mvt:if>
                        ORDP (printable confirmation, find the link on the invoice page)
                        Code:
                        <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'question1', g.order )" />
                        <mvt:if expr="NOT ISNULL g.order:question1">
                            <label>Event Date:</label>&mvte:global:order:question1;
                        </mvt:if>
                        <br />
                        <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'question2', g.order )" />
                        <mvt:if expr="NOT ISNULL g.order:question2">
                            <label>Special Instructions:</label>&mvte:global:order:question2;
                        </mvt:if>
                        EMAIL_ORDERCONF_CUSTOMER and EMAIL_ORDERCONF_MERCHANT (Customer and Merchant emails)
                        Code:
                        <!-- Code executes when order is placed -->
                        <mvt:item name="customfields" param="Read_Basket('question1', g.question1 )" />
                        <mvt:if expr="NOT ISNULL g.question1">
                            <label>Event Date:</label>&mvte:global:question1;
                            <br />
                        </mvt:if>
                        <mvt:item name="customfields" param="Read_Basket('question2', g.question2 )" />
                        <mvt:if expr="NOT ISNULL g.question2">
                            <label>Special Instructions:</label>&mvte:global:question2;
                        </mvt:if>
                        
                        <!-- Code executes when resending emails in Order Processing -->
                        <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'question1', l.settings:customfields)" />
                        <mvt:if expr="NOT ISNULL l.settings:customfields:question1">
                            <label>Event Date:</label>&mvt:customfields:question1;
                            <br />
                        </mvt:if>
                        <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'question2', l.settings:customfields)" />
                        <mvt:if expr="NOT ISNULL l.settings:customfields:question2">
                            <label>Special Instructions:</label>&mvt:customfields:question2;
                        </mvt:if>
                        ORDS page, I put this in the FOOTER
                        Code:
                        <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'question1', g.order )" />
                        <mvt:if expr="NOT ISNULL g.order:question1">
                            <label>Event Date:</label>&mvte:global:order:question1;
                        </mvt:if>
                        <br />
                        <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'question2', g.order )" />
                        <mvt:if expr="NOT ISNULL g.order:question2">
                            <label>Special Instructions:</label>&mvte:global:order:question2;
                        </mvt:if>
                        ORDER_INVOICE page (Printable Invoice-printed in Order Management), I put this before the closing </body> tag
                        Code:
                        <div class="purple-box order">
                            <h2>Additional Information</h2>
                            <hr />
                            <table>
                            <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'question1', l.settings:customfields)" />
                            <mvt:if expr="NOT ISNULL l.settings:customfields:question1">
                                <tr><th>Event Date:</th><td>&mvt:customfields:question1;</td></tr>
                                <br />
                            </mvt:if>
                            <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'question2', l.settings:customfields)" />
                            <mvt:if expr="NOT ISNULL l.settings:customfields:question2">
                                <tr><th>Special Instructions:</th><td>&mvt:customfields:question2;</td></tr>
                            </mvt:if>
                            </table>
                        </div>
                        I also found a similar post http://www.miva.com/forums/forum/online-merchants/miva-merchant-9/117445-order-custom-field titled Order Custom Field dated 08-11-15, 09:54 AM which could be of help to others.

                        One missing item I couldn't tackle --It looks like the Standard Batch Report is a MODULE, so we can't make changes. It does NOT automatically add custom order fields to the report.

                        Shannon Wright
                        Xact Xpressions, Inc.

                        Comment


                          #13
                          I just sucessfully implemented the above that Shannon was so kind to have laid out - works great, EXCEPT, When I run a batch report on the order_invoice, the "Additional Information" line shows up on the invoice, but no information from the note field the customer has typed in. I came across this thread: https://www.miva.com/forums/forum/ge...ithin-an-order

                          Made it sound like it's not possible to write to the batch report for the printable invoice? Brennan had said something was coming back in June - any way to write to a printable invoice? I guess we can print the emails for now since it shows in that, but would like to have it from the admin panel.
                          Thanks!

                          Comment


                            #14
                            Originally posted by danceman View Post
                            I just sucessfully implemented the above that Shannon was so kind to have laid out - works great, EXCEPT, When I run a batch report on the order_invoice, the "Additional Information" line shows up on the invoice, but no information from the note field the customer has typed in. I came across this thread: https://www.miva.com/forums/forum/ge...ithin-an-order

                            Made it sound like it's not possible to write to the batch report for the printable invoice? Brennan had said something was coming back in June - any way to write to a printable invoice? I guess we can print the emails for now since it shows in that, but would like to have it from the admin panel.
                            Thanks!
                            Are you working in a MM5 store? This stuff is really, really old.
                            Leslie Kirk
                            Miva Certified Developer
                            Miva Merchant Specialist since 1997
                            Previously of Webs Your Way
                            (aka Leslie Nord leslienord)

                            Email me: [email protected]
                            www.lesliekirk.com

                            Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                            Comment


                              #15
                              If you are referring to one of the Templated Batch Reports, make sure that 1) you've selected that custom field. 2) That the custom field item is enabled for that template.
                              Bruce Golub
                              Phosphor Media - "Your Success is our Business"

                              Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                              phosphormedia.com

                              Comment

                              Working...
                              X