Forums / Templates, Stylesheets, Page Layout / Customizing Checkout Success Page Note based on Payment Method?

Customizing Checkout Success Page Note based on Payment Method?

Locked

Views: 9,054

Results 1 to 20 of 23
This thread is locked. New replies are disabled.
14 Aug 2007, 11:47 AM
#1
dcmall avatar

dcmall

New Zenner

Join Date:
Jul 2007
Posts:
14
Plugin Contributions:
0

Customizing Checkout Success Page Note based on Payment Method?

Hi, wonder if anyone have any clue how to customize the checkout_sucess page so that different messages can be display upon completing final step - Confirm the Order - based on the payment method processed.

E.g.

  1. If the Payment Method = Cheque / Money Order
    Message: Your order has been received. Please note that your order will be delivered upon confirmation of payment. Please ensure you quote your order number when making payment.

  2. If the Payment Method = Express Check out with Paypal
    Message: Your order has been received and payment confirmed. Your order will be processed for shipment the next working day.

  3. If the Payment Method = Cash on Delivery
    Message: Your order has been received. We will be in touch with you by the next working day to arrange your delivery appointment.

Thanks in advance.

dcmall

14 Aug 2007, 7:00 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Customizing Checkout Success Page Note based on Payment Method?

You'd need to set a session variable in the checkout_process header_php.php before the unset() of session-payment information.

Then read that session variable in the checkout_success header_php.php, and then unset that session variable after reading its value.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

15 Aug 2007, 3:42 PM
#3
dcmall avatar

dcmall

New Zenner

Join Date:
Jul 2007
Posts:
14
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

DrByte,

How to I set a session variable in checkout_process header_php.php and how do I read the session variable in the checkout_success header_php.php?

I know where to open the two files, but when it comes to coding, I really do not know how to set and read the session variable for the above said purpose.

I know nuts of php. Appreciate if you could give some guidance.

Looking forward to your prompt guidance...

30 Aug 2007, 8:41 AM
#4
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

I also need to do the same. I have searched the forum and found 10 different threads about this topic, but none of them has a real answer. Dr Byte's answer above is the closest I have found, but it sounds very technical, i.e. over my head! :D

Any help on this would be greatly appreciated. Please explain in terms suitable for IQ80 reader such as myself. :wink:

Thanks

31 Aug 2007, 8:59 AM
#5
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

Well, I guess I should have just stopped, but I decided to try Dr Byte's instructions. I tried to add a register variable command in the checkout_process header file and an unregister in the checkout_success header file. It did not seem to work since the success page would not appear then. So then I restored my original files, BUT the cart now seems to be broken! The success page will simply not appear (although it worked perfectly before my attempted changes).

I really am in a state of panic and simultaneous depression now. I just don't know what to do to fix this. The order still is placed and the email is received by both the store owner and the customer and the order is logged into the databse, BUT the success page will not appear.

Could it be something has been messed up in the database due to my experiments???

I have a backup of the database and could restore it if I knew how. But I am afraid to even try this for fear of making things even worse.

Help! :(

www.westec-beauty dot com/shop/

31 Aug 2007, 2:43 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Customizing Checkout Success Page Note based on Payment Method?

How exactly did you make your changes?
Did you add any new files?
How exactly did you "undo" the changes?
Did you delete any new files you added?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

31 Aug 2007, 3:35 PM
#7
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

First, I tried this:

in includes/modules/pages/checkout_process/header_php.php
I added a line like this: session_register("payment");
before the unset section

in includes/modules/pages/checkout_success/header_php.php
I added a line like this: session_unregister("payment");
near the end of the file.

in includes/templates/theme027/templates/tpl_checkout_success_default.php
I added a line to try display this value...I forget now how I wrote this, but it was some sort of simple php echo type line.

That didn't work, so then I tried this:

in includes/modules/pages/checkout_process/header_php.php
I took out the session_register line that I had added before, and then
I commented out this line: unset($_SESSION['payment']);

I don't remember if I did anything to checkout_success/header_php.php this time or if I just left the unregister command in there as before.

Well...that didn't work either, so I tried to put everything back as I found it, but still the final success page would not display.

I then went back to my latest backup files (from that same morning) and copied over the files with the backed up versions which previously worked perfectly. Still the success page would not display.

One possible clue: A payment module (called Alipay in China; similar to Paypal in the USA) that I had already installed and confirmed was working, now is not working properly and gives me an error code "ILLEGAL_SIGN" when I jump to their page after order confirmation. Of course, it never jumps to the success page because of this error.

Thanks for your help!

31 Aug 2007, 3:51 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Customizing Checkout Success Page Note based on Payment Method?

thomasw98:

Well...that didn't work either, so I tried to put everything back as I found it, but still the final success page would not display.

I then went back to my latest backup files (from that same morning) and copied over the files with the backed up versions which previously worked perfectly. Still the success page would not display.Did you DELETE any ADDED files that you created by trying all your changes?

The cause of a page not displaying is 95% because of a PHP syntax error created in one of your files. Usually it's a language file or a template file.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

31 Aug 2007, 3:52 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Customizing Checkout Success Page Note based on Payment Method?

thomasw98:

One possible clue: A payment module (called Alipay in China; similar to Paypal in the USA) that I had already installed and confirmed was working, now is not working properly and gives me an error code "ILLEGAL_SIGN" when I jump to their page after order confirmation. Of course, it never jumps to the success page because of this error.

I'm inclined to say that this problem is unrelated to your other one ... unless that's the only payment module you're using ... in which case it could very well be the exact cause.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

31 Aug 2007, 4:24 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Customizing Checkout Success Page Note based on Payment Method?

dcmall:

Hi, wonder if anyone have any clue how to customize the checkout_sucess page so that different messages can be display upon completing final step - Confirm the Order - based on the payment method processed.

E.g.

  1. If the Payment Method = Cheque / Money Order
    Message: Your order has been received. Please note that your order will be delivered upon confirmation of payment. Please ensure you quote your order number when making payment.

  2. If the Payment Method = Express Check out with Paypal
    Message: Your order has been received and payment confirmed. Your order will be processed for shipment the next working day.

  3. If the Payment Method = Cash on Delivery
    Message: Your order has been received. We will be in touch with you by the next working day to arrange your delivery appointment.

Thanks in advance.

dcmall

DrByte:

You'd need to set a session variable in the checkout_process header_php.php before the unset() of session-payment information.

Then read that session variable in the checkout_success header_php.php, and then unset that session variable after reading its value.

dcmall:

DrByte,

How to I set a session variable in checkout_process header_php.php and how do I read the session variable in the checkout_success header_php.php?

I know where to open the two files, but when it comes to coding, I really do not know how to set and read the session variable for the above said purpose.

I know nuts of php. Appreciate if you could give some guidance.

Looking forward to your prompt guidance...

Perhaps you'll consider making a donation to the Zen Cart project for this custom code:

  1. edit /includes/modules/pages/checkout_process/header_php.php
    Add the slashes, as shown:```
    [B]//[/B] unset($_SESSION['payment']);

2. edit /includes/modules/pages/checkout_success/header_php.php
after this:```
// if the customer is not logged on, redirect them to the shopping cart page
if (!$_SESSION['customer_id']) {
  zen_redirect(zen_href_link(FILENAME_TIME_OUT));
}
```SCRATCH THAT ... look for this instead:```
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
```and add this below it:```
  $payment_instructions_message = 'Thank you for your order';
  if (defined('TEXT_PAYMENT_MESSAGE_' . strtoupper($_SESSION['payment']) ))  $payment_instructions_message = constant('TEXT_PAYMENT_MESSAGE_' . strtoupper($_SESSION['payment']) );
  unset($_SESSION['payment']);
  1. Edit /includes/languages/english/YOURTEMPLATE/checkout_success.php
    Add new defines for each of your required payment modules, following the pattern:
define('TEXT_PAYMENT_MESSAGE_MONEYORDER', 'Your order has been received. Please note that your order will be delivered upon confirmation of payment. Please ensure you quote your order number when making payment.');
define('TEXT_PAYMENT_MESSAGE_PAYPALWPP', 'Your order has been received and payment confirmed. Your order will be processed for shipment the next working day.');
define('TEXT_PAYMENT_MESSAGE_COD', 'Your order has been received. We will be in touch with you by the next working day to arrange your delivery appointment.');
  1. edit /includes/templates/YOURTEMPLATE/templates/tpl_checkout_success_default.php
    find this:```
<div id="checkoutSuccessOrderNumber"><?php echo TEXT_YOUR_ORDER_NUMBER . $zv_orders_id; ?></div> ```add this on a line below it:``` <div id="checkoutSuccessMessage"><?php echo $payment_instructions_message; ?></div> ```

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Sep 2007, 1:07 AM
#11
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

DrByte:

Did you DELETE any ADDED files that you created by trying all your changes?

The cause of a page not displaying is 95% because of a PHP syntax error created in one of your files. Usually it's a language file or a template file.

I was just about to say "no" on this when suddenly the name "filenames.php" popped vaguely into my head. I looked inside and thought there was no way I would change anything in there, but decided to upload a clean version just to be on the safe side...you have already guessed how this ends, right?....and now the cart works fine. So either it is a random coincidence, or I must have changed something in that file.

The Alipay system is still not working, so it looks like you are right. Unrelated.

Thanks for the custom code. I will give it a try and definitely make a donation to the team. How do I do this?

1 Sep 2007, 1:11 AM
#12
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,684
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

1 Sep 2007, 1:20 AM
#13
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

Paypal!!!!!!!!!!:yuck:

Paypal is a total disaster in China. Nearly unusable. Even worse to try to make international payments via their system. I predict they will soon fail and exit China just like Ebay did.

So I will send a personal check for $100 to the Oregon address (No need to send me the zencart hat since the postage to China is too much of a hassle).

Thanks to all the zencart gurus for this great software!:clap:

2 Sep 2007, 12:24 AM
#14
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

The custom coding is not working for me...it just shows the default text "Thank you for your order". It seems as if the "if" statement in checout_success/header_php.php is never satisfied.

I have checked all the files and code and have confirmed that they match Dr Bytes suggestion. But still, it just shows the default response.

Not sure where to even start looking to solve this problem or to test it step by step. Any ideas?

2 Sep 2007, 2:46 AM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Customizing Checkout Success Page Note based on Payment Method?

thomasw98:

The custom coding is not working for me...it just shows the default text "Thank you for your order". It seems as if the "if" statement in checout_success/header_php.php is never satisfied.

I have checked all the files and code and have confirmed that they match Dr Bytes suggestion. But still, it just shows the default response.

Not sure where to even start looking to solve this problem or to test it step by step. Any ideas?

Hmmm ... Slight change to step #2 ... instead of putting it near the top, put it down around line 38 ... specifically after this line:```
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

2 Sep 2007, 6:47 AM
#16
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

DrByte:

Hmmm ... Slight change to step #2 ... instead of putting it near the top, put it down around line 38 ... specifically after this line:```
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));


Well, that sorta works but not quite...here's what happens now:

Test order a product. Select payment method (for this example, COD), continue, then confirm the order, wait while it tries to reach success..but no, it errors out. Can not display page. But the order has been booked into the system properly and the email to the store owner and the customer are both successfully sent.

Go back to index page. Cart is empty. Pick a product and checkout. On the select payment type page, the radio button for COD is already selected! click continue, then confirm order. Wait. Yes, it is successful...but only sometimes (that's the part that annoys me...inconsistent error behavior :smile:). Either way, whether success page is displayed or not, the order has been recorded and emails sent out properly.

Cycling through it again and again, sometimes the radio button is already selected (it is always the same as your last order) and sometimes not.

Pretty weird behavior :unsure:
2 Sep 2007, 1:39 PM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Customizing Checkout Success Page Note based on Payment Method?

thomasw98:

...wait while it tries to reach success..but no, it errors out. Can not display page. But the order has been booked into the system properly and the email to the store owner and the customer are both successfully sent.

Go back to index page. Cart is empty. Pick a product and checkout. On the select payment type page, the radio button for COD is already selected!That's normal behaviour if the order didn't complete properly due to a server/PHP error.

The "cannot display page" suggests that you've made an error in your PHP editing.
What's in the server errorlog this time?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 Sep 2007, 12:24 AM
#18
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

DrByte:

That's normal behaviour if the order didn't complete properly due to a server/PHP error.

The "cannot display page" suggests that you've made an error in your PHP editing.
What's in the server errorlog this time?

Errorlog: I use a Chinese virtual server, and they do not give me access to error logs. Their services are very limited in many ways like that, plus they are expensive. What a great deal!:(

Now I am at my office and the script seems to run perfectly, so I guess it was an internet connection problem that was creating the unreliable results yesterday.

Only problem I have left is that some payment types work perfectly, and give the proper message on the success page, but one of them does not ("Postal Transfer"...a way of transferring money via the post office here in China). For some reason it always gives the default response. I will check the payment type name to be sure I am using the correct matching text variable name.

So, it seems I am nearly there. Thanks again for all your help! I think this code will also be of use to many other people using Zencart.

3 Sep 2007, 12:36 AM
#19
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Customizing Checkout Success Page Note based on Payment Method?

What's the filename of your payment transfer module ? that's what you need to use in the new language definition.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

4 Sep 2007, 3:14 AM
#20
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Customizing Checkout Success Page Note based on Payment Method?

DrByte:

What's the filename of your payment transfer module ? that's what you need to use in the new language definition.

This turns out to be a very high-tech problem which I am proud to announce that I have solved using my massive intellectual powers (you may have noticed the lights dim in your house last night...that was me thinking): I adjusted the spelling of the word "tranfer" to a new high-tech version: "transfer". That solved the problem right away.

Genius! :smartalec: