Forums / General Questions / Default text in Order Comments Text Field?

Default text in Order Comments Text Field?

Locked

Started by steven300 on 29 Feb 2008, 6:04 PM · Views: 2,765

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
29 Feb 2008, 6:23 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: Default text in Order Comments Text Field?

Why? If your customer doesn't change the default text, that default text will show up on your orders ... the same for everyone ... is that what you want?

To set it ...
/includes/modules/pages/checkout_shipping/header_php.php

Find this:

  if (isset($_SESSION['comments'])) {
    $comments = $_SESSION['comments'];
  }
```add this on a new line below it:```
  if (!isset($comments) && defined('TEXT_DEFAULT_ORDER_COMMENTS')) $comments = TEXT_DEFAULT_ORDER_COMMENTS;
```and then edit your checkout_shipping.php language file and add a new define for TEXT_DEFAULT_ORDER_COMMENTS, containing whatever default text you want to show.

.
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.

29 Feb 2008, 6:52 PM
#3
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
1

Re: Default text in Order Comments Text Field?

Thanks for your reply DrByte. The reason I want this is because I'm planning to offer an optional free product with every order. This product will be a PDF. I'm going to set this product up as document-general so it can't be added to cart and state on its product page that if you would like this, then to request it in the order comments field at checkout. So I thought I would put some default text in there and they can always remove it if they don't want the PDF. Then after their order is done, I'll email them the PDF if they requested it. Hope that makes sense.
Basically I just want to offer customers a free downloadable product with their orders but I want them to have to go through checkout in order to get it. I'm hoping it will prove to be an incentive to buy something. If you can think of a better method to do this, PLEASE let me know. Thanks.

29 Feb 2008, 9:27 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: Default text in Order Comments Text Field?

Go ahead and see how well it works.

.
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.

18 May 2009, 8:45 PM
#6
lensrent avatar

lensrent

New Zenner

Join Date:
May 2009
Posts:
6
Plugin Contributions:
0

Re: Default text in Order Comments Text Field?

Ok, somehow I managed to break the checkout cart when I tried this. Now when I select "Go to Checkout" from the shopping cart I end up with a blank page.

Anyone got any ideas? www.lensrent.ca

login: [email protected]
password:test1

I duplicated the files before I made the code changes -- tried the code and it didn't work so I deleted altered files and renamed the duplicates back to the originals.

Just to be clear, I made the following code changes:

includes/modules/pages/checkout_shipping/header_php.php

Removed (actually I commented it out with //):

  if (isset($_SESSION['comments'])) {
    $comments = $_SESSION['comments'];
  }

Added:

if (!isset($comments) && defined('TEXT_DEFAULT_ORDER_COMMENTS')) {
$comments = TEXT_DEFAULT_ORDER_COMMENTS;
}

and

includes/languages/english/MY_TEMPLATE/checkout_shipping.php

Added:

define('TEXT_DEFAULT_ORDER_COMMENTS', 'Please enter your requested rental dates here');

Seemed simple enough.

Zen Cart v1.3.8a/v1.3.8 with pure_black template.

BTW - first post but I have been reading everyone's posts --- YOU GUYS/GALS ROCK!

18 May 2009, 9:31 PM
#8
lensrent avatar

lensrent

New Zenner

Join Date:
May 2009
Posts:
6
Plugin Contributions:
0

Re: Default text in Order Comments Text Field?

:oops: That was an ADD not replace -- DAMN. Thank you.

And I found the source of the error -- I checked the server logs (using CPanel) and for some reason I was saying the css file didn't exist -- I SWEAR I never touched it.

File does not exist: http://lensrent.ca/includes/templates/pure_black/css/stylesheet.css

Overwrote it with a backup copy and all is fine now, go figure.

Anyway just for others the Pinned tip at the top of the page is the key for these problems...

Getting a BLANK PAGE? Here's the answer ...
[
https://www.zen-cart.com/tutorials/index.php?article=82](http://www.zen-cart.com/forum/announcement.php?f=128&a=12)

18 May 2009, 10:09 PM
#9
lensrent avatar

lensrent

New Zenner

Join Date:
May 2009
Posts:
6
Plugin Contributions:
0

Re: Default text in Order Comments Text Field?

FWIW - I have tried this every way I can figure. Adding the code to includes/modules/pages/checkout_shipping/header_php.php kills the page too.

19 May 2009, 2:19 AM
#10
lensrent avatar

lensrent

New Zenner

Join Date:
May 2009
Posts:
6
Plugin Contributions:
0

Re: Default text in Order Comments Text Field?

OK - I did get it to work and it wasn't a "code" issue it was an operator issue. When I duplicated the files I used Cyberduck's duplicate function and simple accepted the appended file name. So something like header_php.php became header_php (18:05:09 6:43 PM).php

Apparently this didn't work out so well. After some testing I found that the appended file name was being pulled... my solution -- I did something like zzz_header_php.php -- worked like a charm.:smile: