Post by GazzaBJ » Mon Dec 06, 2021 11:22 pm

Hi,
OC 3.0.3.7
I am adding a date textbox to the "Payment Method" standard checkout. This is above the "Comment" textbox.

<input type="text" name="my_order_date" value="{{ my_order_date }}" placeholder="{{ entry_my_order_date }}" data-date-format="YYYY-MM-DD" class="form-control" />

However, when I reference the textbox from the controller code:
$this->request->post['my_order_date']

It gives me an Undefined index: my_order_date

However, the same code works for the existing "Comment" field within the same page with no issues. I'm obviously missing something just not sure what?

Happy to supply more information if required.

Any ideas would be gratefully received.

Newbie

Posts

Joined
Fri Feb 21, 2020 10:47 pm

Post by straightlight » Mon Dec 06, 2021 11:28 pm

GazzaBJ wrote:
Mon Dec 06, 2021 11:22 pm
Hi,
OC 3.0.3.7
I am adding a date textbox to the "Payment Method" standard checkout. This is above the "Comment" textbox.

<input type="text" name="my_order_date" value="{{ my_order_date }}" placeholder="{{ entry_my_order_date }}" data-date-format="YYYY-MM-DD" class="form-control" />

However, when I reference the textbox from the controller code:
$this->request->post['my_order_date']

It gives me an Undefined index: my_order_date

However, the same code works for the existing "Comment" field within the same page with no issues. I'm obviously missing something just not sure what?

Happy to supply more information if required.

Any ideas would be gratefully received.
Vague. More info is needed.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mikeinterserv » Mon Dec 06, 2021 11:32 pm

Well you need to look more closely at the code.
Your new variable is undefined and not being picked up by the ARRAY.
Look again at ALL the code related to the comment box and you will find your errors.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by GazzaBJ » Fri Dec 10, 2021 5:37 pm

So I managed a workaround for this...

No markup "input" of type "text" would be posted back, but all other types ie checkbox, textarea would and as I couldn't figure out the reason why I did the following:
I created a hidden textarea that copied the value from "my_order_date" on the fly, to the hidden textarea which is then posted back and made available in my code.

Not ideal, but it works and may help anyone else that has the same issue.

Newbie

Posts

Joined
Fri Feb 21, 2020 10:47 pm

Post by by mona » Fri Dec 10, 2021 8:00 pm

GazzaBJ wrote:
Mon Dec 06, 2021 11:22 pm
Hi,
OC 3.0.3.7
I am adding a date textbox to the "Payment Method" standard checkout. This is above the "Comment" textbox.

<input type="text" name="my_order_date" value="{{ my_order_date }}" placeholder="{{ entry_my_order_date }}" data-date-format="YYYY-MM-DD" class="form-control" />

However, when I reference the textbox from the controller code:
$this->request->post['my_order_date']

It gives me an Undefined index: my_order_date

However, the same code works for the existing "Comment" field within the same page with no issues. I'm obviously missing something just not sure what?

Happy to supply more information if required.

Any ideas would be gratefully received.
That is because of the way the ajax call javascript picks up the form fields.
If you want to mess with checkout, better to get familiar with the ajax code.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am
Who is online

Users browsing this forum: ravikumar22, Semrush [Bot] and 83 guests