About "Special Instructions or Comments About Your Order"
Hi,
I have question about "Special Instructions or Comments About Your Order"
in both shipping and payment check out prcedure.
Can I configure this box as complusory? (*) So customer must enter something in the box. It is because I have add another option for them so they must provide additional information in the box.
Thanks,
Tk
Re: About "Special Instructions or Comments About Your Order"
Can anyone help me to sovle this question, I can find any answer of it.
Many thanks.
Re: About "Special Instructions or Comments About Your Order"
The best place for this is to start on Shipping so that the comments are done with, in theory, as the payment info will get tossed if the comments are missing there ...
Edit the file:
/includes/modules/pages/checkout_shipping/header_php.php
Around lines 119 ... change the code to read:
PHP Code:
// process the selected shipping method
if ( isset($_POST['action']) && ($_POST['action'] == 'process') ) {
if (zen_not_null($_POST['comments'])) {
$_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);
}
$comments = $_SESSION['comments'];
if (empty($comments)) {
$messageStack->add_session('header', ERROR_MISSING_COMMENT, 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
This forces the comment to be filled in or throw an error ...
The error message: ERROR_MISSING_COMMENT
Will need to be defined ... usually these extra things are best defined in a file in the directory:
/includes/languages/english/extra_definitions/something.php
These files auto load when english.php loads ...
That test on the comments should then be added to the header_php.php for the checkout_payment as well so that they don't erase everything ...
Re: About "Special Instructions or Comments About Your Order"
wow~ this is very cool, it works!
but i have a minor question is that the error message come at the top of webpage. How can i edit it to be shown on just on top of the comment box?
thanks. really appreciated with your work and kindly help.
Tk
Re: About "Special Instructions or Comments About Your Order"
I have checked that with the create_account. (because there are the error message i want to be shown in check_out_shipping)
I found:
<?php
if ($messageStack->size('create_account') > 0) {
?>
<tr>
<td class="main" colspan="2"><?php echo $messageStack->output('create_account'); ?></td>
</tr>
I think this is the way to show error message if required field is missing.
So how to integtate with the one I want for COMMENTS BOX WHEN CHECK OUT?
anyone's help is much appreciated.
Re: About "Special Instructions or Comments About Your Order"
is there anyone can help me? i am confused...
Re: About "Special Instructions or Comments About Your Order"
seems i have to get back this problem and need a solution for it... >.<
well, what i have changed is...
includes/modules/pages/checkout_shipping/header_php.php, i create:
if ($error == true) {
$messageStack->add('checkout_shipping', ERRPR_MISSING_COMMENT);
}
and
includes/templates/[custom]/templates/tpl_checkout_default.php, i create the error display at the place i wanted:
<?php
if ($messageStack->size('checkout_shipping') > 0) {
echo $messageStack->output('checkout_shipping');
}?>
nothing happen.... anyone can help ?
i did all these changes following the mechanism of the login / contact us / create account error....
hopeless =(