Setting up new error at checkout
I have a dropdown box enabled on my checkout page. When a customer hasn't selected something from the dropdown, I need to redirect them to the checkout payment page and show them an error message.
Here's what I have put for code in my checkout_confirmation header.php:
Code:
if (!isset($_SESSION['dropdown'])) {
$messageStack->add_session('dropdown', ERROR_DROP_DOWN, 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
It kicks it back to the payment page, but doesn't show the error message. Can anyone help me correct where I've gone wrong?
Re: Setting up new error at checkout
When you do a messageStack you have to add it to an existing output on the page ...
The tpl_checkout_payment.php has a few:
Code:
<?php if ($messageStack->size('redemptions') > 0) echo $messageStack->output('redemptions'); ?>
<?php if ($messageStack->size('checkout') > 0) echo $messageStack->output('checkout'); ?>
<?php if ($messageStack->size('checkout_payment') > 0) echo $messageStack->output('checkout_payment'); ?>
If you change your messageStack from:
Code:
$messageStack->add_session('dropdown', ERROR_DROP_DOWN, 'error');
to something like:
Code:
$messageStack->add_session('checkout_payment', ERROR_DROP_DOWN, 'error');
it should work better ...
Re: Setting up new error at checkout
Figured it out. OOPS.
Code:
if (!isset($_SESSION['dropdown'])) {
$messageStack->add_session('checkout_payment', ERROR_DROP_DOWN, 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
Re: Setting up new error at checkout
Yep. That was it. First time I had ever done it, so I wasn't sure about the coding. Learned something new today. :P
Quote:
Originally Posted by
Ajeh
When you do a messageStack you have to add it to an existing output on the page ...
The tpl_checkout_payment.php has a few:
Code:
<?php if ($messageStack->size('redemptions') > 0) echo $messageStack->output('redemptions'); ?>
<?php if ($messageStack->size('checkout') > 0) echo $messageStack->output('checkout'); ?>
<?php if ($messageStack->size('checkout_payment') > 0) echo $messageStack->output('checkout_payment'); ?>
If you change your messageStack from:
Code:
$messageStack->add_session('dropdown', ERROR_DROP_DOWN, 'error');
to something like:
Code:
$messageStack->add_session('checkout_payment', ERROR_DROP_DOWN, 'error');
it should work better ...
Re: Setting up new error at checkout
Thanks for the update that this is now working for you ... :smile: