Post by cahb52 » Thu May 17, 2018 2:05 am

i need add custom fields in the checkout page, someone who knows how to do this?
thanks

Newbie

Posts

Joined
Wed May 16, 2018 11:43 pm

Post by Johnathan » Thu May 17, 2018 5:34 am

You can add custom fields to the Customer info or Address info, by going to Customers > Custom Fields in your admin panel. You can then set up a field in there, which customers will have to fill in when inputting their customer info or address.

If you want a shipping option as part of the shipping process, then what you should probably do is find a shipping extension that can display different rates, one with the option and one without. I have extensions that can do that, or if you want it separate from the shipping system, I have an Optional Fee/Discount extension that can add an optional fee to the order.

If you don't need a fee attached to the response, and just want to ask a question, I also have a Checkout Survey extension that can do that.

Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by cahb52 » Thu May 17, 2018 12:17 pm

hi, thanks for your reply, i follow this tutorial
viewtopic.php?f=182&t=172521
bu i have the following problem
Image
the data in the input fields are not saved into the $this->session->data
the only change I made was to edit the .twig instead of the .tpl
any suggestions?

Newbie

Posts

Joined
Wed May 16, 2018 11:43 pm

Post by sw!tch » Thu May 17, 2018 12:30 pm

cahb52 wrote:
Thu May 17, 2018 12:17 pm
hi, thanks for your reply, i follow this tutorial
viewtopic.php?f=182&t=172521
bu i have the following problem
the data in the input fields are not saved into the $this->session->data
the only change I made was to edit the .twig instead of the .tpl
any suggestions?
If those are text inputs you added and not textareas or radios then you might want to have a look at the Ajax data: in checkout.twig. I think you will find your answer there. Further you can view the request payload in chrome inspector to see if the post vars are even being sent which I assume they are not.

For reference ...

Code: Select all

$(document).delegate('#button-shipping-method', 'click', function() {
    $.ajax({
        url: 'index.php?route=checkout/shipping_method/save',
        type: 'post',
        data: $('#collapse-shipping-method input[type=\'radio\']:checked, #collapse-shipping-method textarea'),
        dataType: 'json',
and append with something like #collapse-shipping-method input[type=\'text\']

(e.g

Code: Select all

$(document).delegate('#button-shipping-method', 'click', function() {
    $.ajax({
        url: 'index.php?route=checkout/shipping_method/save',
        type: 'post',
        data: $('#collapse-shipping-method input[type=\'radio\']:checked, #collapse-shipping-method textarea, #collapse-shipping-method input[type=\'text\']'),
        dataType: 'json',
I am not going to post up the full code, but you can get the idea.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by Johnathan » Thu May 17, 2018 9:10 pm

I think sw!tch has hit on the right answer for why it's not working.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by cahb52 » Fri May 18, 2018 2:10 am

you are Great!! it works!
Thanks for your help.

Newbie

Posts

Joined
Wed May 16, 2018 11:43 pm
Who is online

Users browsing this forum: Amazon [Bot] and 409 guests