Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    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
    66,446
    Plugin Contributions
    81

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

    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
    66,446
    Plugin Contributions
    81

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

  5. #5
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    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: [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 //):

    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!

 

 

Similar Threads

  1. Replies: 6
    Last Post: 24 Nov 2022, 08:51 PM
  2. Replies: 4
    Last Post: 15 Apr 2014, 04:13 PM
  3. Can I have text showing inside an attribute text field
    By jcrewe in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 4 Jan 2012, 10:48 PM
  4. 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
  5. Customising 'order comments' text input box
    By blackmafia in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 19 Jul 2010, 01:50 PM

Posting Permissions

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