Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2008
    Posts
    1,711
    Plugin Contributions
    7

    Default Default text in Order Comments Text Field?

    How can I get the order comments text box at checkout to have some text in it by default (but still be editable)?

  2. #2
    Join Date
    Jan 2004
    Posts
    58,262
    Blog Entries
    3
    Plugin Contributions
    106

    Default 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:
    Code:
      if (isset($_SESSION['comments'])) {
        $comments = $_SESSION['comments'];
      }
    add this on a new line below it:
    Code:
      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!
    Donations always welcome: www.zen-cart.com/donate

    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. #3
    Join Date
    Jan 2008
    Posts
    1,711
    Plugin Contributions
    7

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

  4. #4
    Join Date
    Jan 2004
    Posts
    58,262
    Blog Entries
    3
    Plugin Contributions
    106

    Default 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!
    Donations always welcome: www.zen-cart.com/donate

    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.

  5. #5
    Join Date
    Jan 2008
    Posts
    1,711
    Plugin Contributions
    7

    Default Re: Default text in Order Comments Text Field?

    Thanks doc, the code works great (providing a couple of braces are added):

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

  6. #6
    Join Date
    May 2009
    Posts
    6
    Plugin Contributions
    0

    application error 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: test1@test.com
    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 //):

    Code:
      if (isset($_SESSION['comments'])) {
        $comments = $_SESSION['comments'];
      }
    Added:
    Code:
    if (!isset($comments) && defined('TEXT_DEFAULT_ORDER_COMMENTS')) {
    $comments = TEXT_DEFAULT_ORDER_COMMENTS;
    }
    and

    includes/languages/english/MY_TEMPLATE/checkout_shipping.php

    Added:
    Code:
    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!

  7. #7
    Join Date
    Jan 2008
    Posts
    1,711
    Plugin Contributions
    7

    Default Re: Default text in Order Comments Text Field?

    Quote Originally Posted by lensrent View Post
    Removed (actually I commented it out with //):

    Code:
      if (isset($_SESSION['comments'])) {
        $comments = $_SESSION['comments'];
      }
    Why did you touch this part?

  8. #8
    Join Date
    May 2009
    Posts
    6
    Plugin Contributions
    0

    Idea or Suggestion Re: Default text in Order Comments Text Field?

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

    http://tutorials.zen-cart.com/index.php?article=82

  9. #9
    Join Date
    May 2009
    Posts
    6
    Plugin Contributions
    0

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

  10. #10
    Join Date
    May 2009
    Posts
    6
    Plugin Contributions
    0

    Idea or Suggestion 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.

 

 

Similar Threads

  1. Add Default Text in Comments in Admin?
    By webgaffer in forum Managing Customers and Orders
    Replies: 6
    Last Post: 3 Jan 2011, 08:11 PM
  2. Setting Order Comments field required, and making it drop-down?
    By davemehta in forum General Questions
    Replies: 8
    Last Post: 24 Nov 2008, 06:37 PM
  3. Getting rid of default text
    By isaiah36 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 17 Jan 2007, 01:25 PM
  4. Can anyone help delete default text?
    By raindark in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 13 Aug 2006, 01:06 PM
  5. Removing some default Text
    By pdxbray in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 5 Aug 2006, 01:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •