| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Printing 'Customer Notes' on invoices | ||||
|
|
Thread Tools | Search this Thread |
#51
|
|||||||||
|
|||||||||
Re: Printing 'Customer Notes' on invoices
Quote:
Paypal uses payment_offline.php. Gift Certificates uses payment_giftcert.php. Modifying those should do the trick. |
|||||||||
#52
|
|||||||
|
|||||||
Re: Printing 'Customer Notes' on invoices
I got this to work on my version .19. A lot of the original code wasnt the same in my version - but its close enough to find your way around. Thanks to everone who put a lot of work into this.
Cheers Zane
__________________
Version 4.7.7 |
|||||||
#53
|
|||||||||
|
|||||||||
Re: Printing 'Customer Notes' on invoices
Quote:
Are you saying that notes are printed/included under 4.1.x? If not - has anyone coded this out for 4.1.x?
__________________
Carl Tice X-Cart 4.6.6 X-Payments 3.0 ReBOOT 3.4.1 PHP 5.6.30 MySQL 5.6.35 Linux 2.6.32-042stab120.18 ionCube PHP Loader v4.7.3 Perl 5.10.1 |
|||||||||
#54
|
|||||||
|
|||||||
Re: Printing 'Customer Notes' on invoices
Customer notes were not included on the invoice in 4.0.19. They are in 4.1.8 be default.
__________________
Version 4.7.7 |
|||||||
#55
|
|||||||||
|
|||||||||
Re: Printing 'Customer Notes' on invoices
had not realized that - just tested it out you are correct! Very nice!
__________________
Carl Tice X-Cart 4.6.6 X-Payments 3.0 ReBOOT 3.4.1 PHP 5.6.30 MySQL 5.6.35 Linux 2.6.32-042stab120.18 ionCube PHP Loader v4.7.3 Perl 5.10.1 |
|||||||||
#56
|
|||||||
|
|||||||
Re: Printing 'Customer Notes' on invoices
Below, I prepared a Step-by-Step install guide for those using X-Cart version 4.0.19
Thanks to Cheri and Lucent88 for the meat of the code and Roblen, PHPdev and Loon for getting us started on this great mod! I added additional details, line numbers and a few tweaks. It's a lot of files to change, but the changes are easy and this Mod will add this necessary element that was missing from the order management end. Plus, there's not a single SQL Patch! Just backup your site first, or work on a copy of the files involved. What this Mod does: When the customer goes to Checkout and enters something in "Customer Notes", like special shipping instructions, those notes are encrypted along with the credit card information and written to the database. This information is typically hidden from your order fulfillment staff and does not appear on the customer's invoice. Below is a way to make the Customer Notes data independent of the Credit Card encryption and easily accessible to all necessary parties. FYI: You can name the new field whatever you want to, just be consistent. Here's what 3 of us chose for the new field name: Cherie: order_first Lucent: order_comment Robert: customer_comments OPTIONAL: Change your language label via Admin-->Languages for "lbl_customer_notes" if you so desire... My old Value: Customer notes My new Value: <b>Customer Notes</b> 1. Locate File: include/func.php - add new field (customer_comments) to function: func_place_order (deep in code about line 2980+/-) Find this Code: Code:
Code:
2. Locate File: include/func.php (same file and function as above) - add "Customer_Comment" checkout form field name (about line 3160 +/-) Find this Code: Code:
Code:
3. Locate these 3 Files: payment/payment_cc.php (about line "78") AND payment/payment_offline.php (about line 46) AND payment_giftcert.php (about line 105 after "$order_details =$ship_to;") - (Note: to capture the user's input) (NOTE: Paypal uses payment_offline.php) Find this Code: Code:
Code:
4. Locate these 3 Files: payment/payment_cc.php AND payment/payment_offline.php AND payment/payment_giftcert.php (same files as above) Find the Code that starts with: (Note: 2 areas in payment_cc.php AND 1 area in payment_offline.php AND 1 area in payment_giftcert.php) Code:
Add the field ($customer_comments) after $order_details Code (payment_cc.php - around line "118"): Code:
Code (payment_cc.php - around line 156): Code:
Code (payment_offline.php - around line 64): Code:
Code (payment_giftcert.php - around line "108"): Code:
*** Now the new field, Customer_Comment, is stored with the order in the order_extras table. 5. Locate File: skin1/customer/main/checkout_notes.tpl (around line 10) Find this Code: Code:
Replace with this Code: Code:
6. Create a stripslashes smarty modifier: removes slashes directly from the template when extracting the Customer Comments/Notes. *** NOTE: if you don't add "|sslash" to the end of your string variables that call the Customer Comments/notes, then if there is a quote or apostrophe in the customer's comment it will look like this: customer\'s comment. First, create a new file and name it "modifier.sslash.php" save it to Smarty-2.6.9/plugins/ (note: I just duplicated the file, modifier.strip.php, then renamed it and replaced its contents with the new php code below) Include this Code: Code:
7. Locate these 3 Files: skin1/mail/html/order_invoice.tpl AND order_customer_complete.tpl AND order_customer_processed.tpl *** NOTE: code: {$order.extra.Customer_Comment|replace:"\n":" "|sslash} gets rid of customer line returns. To keep line returns use: {$order.extra.Customer_Comment|sslash}, but this will stretch out the invoice (horizontally) if there is a single long sentence from the customer. Locate File: skin1/mail/html/order_invoice.tpl (to include Customer Comments/notes in Order Invoice) Find this Code (around line 304): Code:
Replace with this Code (added just above): Code:
Optional: To include Customer Comments/notes in the Order Complete and Order Processed emails sent to the customer... Locate these 2 Files: order_customer_complete.tpl AND order_customer_processed.tpl Find this Code (around line 40): Code:
Replace with this Code (added just above): Code:
8. Locate File: skin1/main/history_order.tpl (around line 90) Find this Code: Code:
Code:
9. Locate File: admin/order.php - Make admin able to edit Customer's Comment/note in the status_change mode section before func_header_location. If you don't want the admin to be able to edit the Customer's Comments/notes, then add "readonly" (without quotes) to the end of the opening textarea tag in Step 8 (see Step 10 for an example). Find this Code (around line 134): Code:
If you go into Admin and change the Status of an order and add a Customer Comment/Note to an existing note, it works fine, but if there is NO existing note and therefore NO khash='Customer_Comment' field, then your new Admin note will NOT get added... here is the updated code to check if the 'Customer_Comment' field exists, if Yes, the updated comment is added to the Old (existing) Comments and Inserted into the DB table, if NO, the DB table is Updated to add the field and the comment: Replace with this Code (added just above): Code:
10. OPTIONAL: For AOM users only (to see notes), Locate File: skin1/modules/Advanced_Order_Management/preview.tpl Add this Code: Code:
11. OPTIONAL - Gift Cert Fix If you would like to integrate the additional code to fix the Gift Cert notes flaw, continue with my Post #60 below. That's it... good luck! Robert Note: Updated Steps 1, 3, 8 & 9 on Oct. 6, 2007
__________________
X-cart 4.1.10 |
|||||||
#57
|
|||||||||
|
|||||||||
Re: Printing 'Customer Notes' on invoices
Great recap! It all looks good!
|
|||||||||
#58
|
|||||||
|
|||||||
Re: Printing 'Customer Notes' on invoices
Quote:
We have been using this code with great success for the past few weeks, and it has been a huge help to the order processing department. So far, we have only encountered one quirk... If you pay via Gift Certificate and enter Customer Comments/Notes, but your GC doesn't cover the total amount and then you select Credit Card and finish the Checkout and add a 2nd set of Customer Comments/Notes on the Credit Card Checkout page, only the 2nd Set of notes will be saved and show on the invoice. Do you know how to adapt the code in this particular instance, that if a note exists, to append the 2nd note (from the same order id) onto the end of the 1st note, instead of overwriting it?
__________________
X-cart 4.1.10 |
|||||||
#59
|
|||||||||
|
|||||||||
Re: Printing 'Customer Notes' on invoices
Quote:
I think I've addressed that in the past but don't have the code handy. Basically what I did was keep the Customer Notes along and resubmit them (hidden) with the alternate payment method so the notes were still there. That's the direction I would head. This is actually a problem with the default X-Cart and not necessarily specific to this mod. Definitely something worth trying to improve. |
|||||||||
#60
|
|||||||
|
|||||||
Re: Printing 'Customer Notes' on invoices
Quote:
Before the fix: If a customer pays via Gift Certificate, enters a Customer Comment/Note, but the gift cert doesn't cover the total amount due, so another payment method is chosen, the notes are lost when you are taken to the 2nd payment method screen, because the order has not yet been completed, and therefore doesn't yet have an Order ID and hasn't yet had its info stored to the DataBase. After the fix: Basically, the notes from the first Gift Cert submission are stored in the variable gc_notes1 (which is set equal to $Customer_Comment). I then assign gc_notes to equal gc_notes1 (via Smarty) and later echo the gc_notes in the textarea (via PHP). To pass the variable (that holds the notes) involves a combination of PHP and Smarty code. Step 1: Locate this File: payment/payment_giftcert.php –(about line 137) - to pass variable to Cart.php in URL Find this code: (at the end of the file) Code:
Code:
Step 2: Locate this File: cart.php - (about line 797): Find this code: Code:
Code:
Step 3: Locate this File: skin1/customer/main/checkout.tpl - (about line 133) - to append variable to 2nd Checkout URL Find this code: Code:
Code:
Step 4: Locate this File: skin1/customer/main/checkout_notes.tpl - (about line 133) - to put GC notes in 2nd payment notes box: Find this code: Code:
Code:
NOTE: This is tested in X-Cart 4.0.19. I also made other updates to the code in my post #56 above. If you are going to integrate this MOD, follow post #56 first, then follow this post #60. Robert
__________________
X-cart 4.1.10 |
|||||||
|
|||
X-Cart forums © 2001-2020
|