Page 1 of 1

How To Make Payment Checkout Comments Required

Posted: Sat Jun 01, 2019 3:30 am
by Favored1
In the Payment Checkout area, I Added Text to (Add Comments About Your Order). How Do I Make that Box Required? ::)

Re: How To Make Payment Checkout Comments Required

Posted: Sat Jun 01, 2019 4:32 am
by DigitCart
Hi
what is your OpenCart version?
are you using default checkout and default theme?

Re: How To Make Payment Checkout Comments Required

Posted: Sat Jun 01, 2019 4:39 am
by DigitCart
For OpenCart 3.0, default checkout

Edit this file:
catalog\controller\checkout\payment_method.php

Find:
if (!$json) {

Add before it:

Code: Select all

if (empty(trim($this->request->post['comment']))) {
	$json['error']['warning'] = 'Comment is required!';
}

Re: How To Make Payment Checkout Comments Required

Posted: Sat Jun 01, 2019 4:59 am
by Favored1
Newest Version - I do my Custom Editing in the Admin Panel Via (Design > Theme Editor > Checkout > payment_method.twig). In there, I Don't seem to see if (!$json) {. I Need a Break, but Plan to Check Back a Bit Later. ::)

Re: How To Make Payment Checkout Comments Required

Posted: Sat Jun 01, 2019 10:03 am
by straightlight
Favored1 wrote:
Sat Jun 01, 2019 4:59 am
Newest Version - I do my Custom Editing in the Admin Panel Via (Design > Theme Editor > Checkout > payment_method.twig). In there, I Don't seem to see if (!$json) {. I Need a Break, but Plan to Check Back a Bit Later. ::)
In the above instructions, it does not indicate to go to a TWIG file. It rather indicates to go to a PHP file which is not available from the theme editor but rather from FTP or cPanel's file manager console.

Re: How To Make Payment Checkout Comments Required

Posted: Sat Jun 01, 2019 11:00 am
by Favored1
Yes, but All the other custom changes, I've made in the .twig Files. I Started Out Editing In the site cPanel, but Changes Weren't Saving. I Could Test Again. ::)

Re: How To Make Payment Checkout Comments Required

Posted: Sat Jun 01, 2019 3:28 pm
by Favored1
Otay, I Assume that the Payment Checkout Box Is Now Required! I Had to Add a Red *. ::)

Re: How To Make Payment Checkout Comments Required

Posted: Sun Jun 16, 2019 2:35 pm
by Favored1
A Few Weeks Ago, I Did Exactly what some of you Suggested in cPanel, and the Comments Box Isn't Always Answered. So Tonight I Looked In cPanel, and the Added Required Code Was Gone. How Do I Get the Required Code to Not Disappear?! ::)

Re: How To Make Payment Checkout Comments Required

Posted: Sun Jun 16, 2019 7:42 pm
by straightlight
How Do I Get the Required Code to Not Disappear?!
By not editing the cached files and, to notice the change live, see the FAQ: viewtopic.php?f=176&t=200804#p718325

Re: How To Make Payment Checkout Comments Required

Posted: Sun Jun 16, 2019 8:36 pm
by Favored1
I Refreshed Modifications. But I'm Away from My Computer for Possibly a Day. I'll Check My cPanel Edit Again Soon! ::)