Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Printing 'Customer Notes' on invoices

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 02-01-2005, 03:38 PM
 
Loon Loon is offline
 

Member
  
Join Date: Feb 2004
Location: MN, USA
Posts: 19
 

Default

Matthew, Hail Canada !! from a neighbor. Thanks, and I have since gone through all of the code searching for anything that calls func_place_order to make sure the extra argument had been added or was able to handle it if it didn't have any value. Even though we just use, in production, what I had way back originally posted, there are lots of other payment methods that needed to be touched.

If anyone needs the additional changes, please post here and I'll add those, although others have done most of them I think.

Glad it helped. It's certainly made our lives easier. Jean
__________________
Linux / Apache 1.3.31
PHP 4.3.3
MySQL 4.0.18
X-Cart 3.5.4 in production Mar 08, 2004
X-Cart 3.5.4 Win2k SP4 for development
Reply With Quote
  #22  
Old 02-06-2005, 11:10 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default

Excellent info, PHPDev! Here's my variation but it was inspired by your excellent and detailed information.

The store owner wanted customers to indicate during checkout if this was their first order. I was pushing this into the Customer Notes field with Javascript, but this isn't convenient since those notes are encrypted as part of the payment info. I just wanted the info to be stored with the order, so I used order_extras.

This is with x-cart 4. "First_Time" is the name of the form field the user is selecting from on the checkout form. Also, I'm using Javascript to validate to ensure the user is selecting something in this new menu.

In include/func.php, add the new field (order_first) to function func_place_order:

Code:
function func_place_order($payment_method, $order_status, $order_details, $order_first, $extra = array(), $extras = array()) {

Also in include/func.php in the same function func_place_order, add the following:

Code:
$extras['First_Time'] = $order_first;

...just before:

Code:
if(!empty($extras)) {

In payment/payment_cc.php, add the new field just below $order_details = "";, around line 78, to capture the user's input:

Code:
$order_details = ""; $order_first = $First_Time;

In the same file, add the new field to $orderids = func_place_order around line 109 and again around line 140 so they look like the following, respectively:

Code:
$orderids = func_place_order("$payment_method (".$module_params["module_name"].(get_cc_in_testmode($module_params)?", in test mode":"").")", "I", $order_details, $order_first);

Code:
$orderids = func_place_order($payment_method." (manual processing)","Q",$order_details,$order_first);

Now the field is stored with the order in the order_extras table. You should be able to pull this data as part of the order wherever you need it, such as on the invoice, for example:

Code:
<TR> <TD>First order?</TD> <TD>{$order.extra.First_Time}</TD> </TR>
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #23  
Old 03-05-2005, 08:19 AM
 
TWS Accessories TWS Accessories is offline
 

eXpert
  
Join Date: Sep 2004
Posts: 236
 

Default

wow thank you! I had another cart and they always posted notes on the receipt pages, it was easy to tell what the customer wanted us to do on special instrucitons or just "birthday thank you's" to friends and families when sending them gifts but with x-cart I always wondered why it was never included.

I will get on this right away!!!! btw, I use 4.05, hope it works.

thanks!
Reply With Quote
  #24  
Old 04-27-2005, 07:48 AM
 
summitmn summitmn is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Manitou Springs, CO USA
Posts: 105
 

Default

I am trying to make this same mod, but am a neophite when it comes to programing. Has anyone done this for version 4.0? I see that some 4.0 users have ammended the steps from the original post, but I am not getting anything to line up. I am searching for line that dont seem to exist.
__________________
Using 4.4.0
Reply With Quote
  #25  
Old 07-02-2005, 01:01 PM
 
hfwd hfwd is offline
 

Newbie
  
Join Date: Aug 2004
Posts: 8
 

Default

Hello,

If you want the customer note and cc details to be included in the email sent to the store admin, and NOT to the customer, you can do this:

1. Duplicate mail/html/order_invoice.tpl, call it order_invoice_admin.tpl.
2. Next, in the original file mail/html/order_invoice.tpl, delete these lines:

Quote:
{if $config.Email.show_cc_info eq "Y" and $show_order_details eq "Y"}

<TR>
<TD colspan="3"></TD>
</TR>

<TR>
<TD width="45%" height="25">{$lng.lbl_order_payment_details}</TD>
<TD colspan="2" width="55%"></TD>
</TR>

<TR>
<TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
<TD colspan="2">[img]{$ImagesDir}/spacer.gif[/img]</TD>
<TR>
<TD colSpan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD>
</TR>

<TR>
<TD colspan="3">{$order.details|replace:"\n":"
"}</TD>
</TR>

{/if}

3. Next, edit mail/html/order_notification_admin.tpl.

Change:

Quote:

{include file="mail/html/order_invoice.tpl" to_admin="Y"}

To:

Quote:
{include file="mail/html/order_invoice_admin.tpl" to_admin="Y"}

If you use non-HTML email, simply do the same thing to mail/order_invoice.tpl and mail/order_notification_admin.tpl

Remember to use encryption, since you are still sending cc info in email to the store admin.

Alex
P.S. My first post
__________________
X-Cart 4.0.13
PHP 4.3.10
Reply With Quote
  #26  
Old 07-02-2005, 02:21 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Separate Customer Notes on Checkout

Great first post hfwd!

I did some more playing with my attempt to store information during the checkout process. I needed to simply separate the customer notes from the cc details. I wanted to get at them and use them independent of each other.

So I tried roblen's simple suggestion and it really is easy. But a word of warning: it still includes the cc details and they are now stored in the database a second time and unencrypted.

I don't need the cc details, just the customer notes. So here's what I came up with.

1. I used my previous instructions posted here for adding additional fields to the checkout, calling my new field Extra_Notes.

2. Changed skin1/customer/main/checkout_notes.tpl to capture the Customer Notes separate from the details. From:

Code:
<TEXTAREA cols="45" rows="6" name="Customer_Notes"></TEXTAREA>

...to:

Code:
<TEXTAREA cols="45" rows="6" name="Extra_Notes"></TEXTAREA>

3. Created a stripslashes smarty modifier so I can remove slashes directly from the template when extracting the Customer Notes. This was very simple. I created a new file in Smarty-X.X.X/plugins called modifier.sslash.php which contained the following:

Code:
<?php function smarty_modifier_sslash($string) { return stripslashes($string); } ?>

4. Added the notes viewable on the invoice in skin1/mail/html/order_invoice.tpl:

Code:
{$order.extra.Extra_Notes|replace:"\n":" "|sslash}

5. Added the notes viewable on the order (order history) in skin1/main/history_order.tpl:

Code:
<textarea name="Extra_Notes" cols="60" rows="5">{$order.extra.Extra_Notes|sslash}</textarea>

6. If you don't want the admin to be able to edit the customer's notes, then add readonly to the textarea. But if you do want to allow changes to this field, add to admin/order.php in the status_change mode section before func_header_location is called:

Code:
$extra_notes = addslashes($Extra_Notes); db_query("update $sql_tbl[order_extras] set value='$extra_notes' where orderid=$orderid and khash='Extra_Notes'");

7. If you use AOM then you probably want to be able to see the customer notes there too. Add to skin1/modules/Advanced_Order_Management/preview.tpl:

Code:
<textarea name="Extra_Notes" cols="60" rows="5" readonly>{$order.extra.Extra_Notes|sslash}</textarea>

This was done with x-cart 4.0.12. I imagine it should work with 4.0.14 with little/no changes.

The steps for payment_cc.php will probably need to be done with other payment methods you support. Is there a central place this could be done to cover all payment methods?

If there's a better way to do any of this, please share.

UPDATE: payment/payment_offline.php will need the same treatment as payment_cc.php if you accept payment methods other than cc.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #27  
Old 07-20-2005, 04:13 PM
 
bobbyftk bobbyftk is offline
 

Senior Member
  
Join Date: Jun 2005
Posts: 167
 

Default

anyone have this working on 4.0.14?

i want to try and tackle this mod, but a little confused on which set of instructions to follow.

i only accept Credit Cards (through verisign)
and just want the customer notes to print on the invoice.
__________________
4.2.2
Reply With Quote
  #28  
Old 07-25-2005, 03:34 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

Another question....X-cart have already modified my checkout sequence to include extra details but they only print out on the order email i.e. the values are not stored in any table. I was thinking of using the code that's been provided to store these fields in the orders_extra table but I notice that the fields I want to use look like this when I view HTML:

Code:
extra[FREE CATALOGUE1] extra[FREE CATALOGUE2]

not sure how this affects the coding required or how I would add that field to func_place_order. I'm assuming that:

Code:
$extras['extra[FREE CATALOGUE1]'] = $catalogue1

isn't going to work?

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #29  
Old 07-25-2005, 07:18 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default

Quote:
Originally Posted by bobbyftk
anyone have this working on 4.0.14?

i want to try and tackle this mod, but a little confused on which set of instructions to follow.

i only accept Credit Cards (through verisign)
and just want the customer notes to print on the invoice.

I don't see why these instructions shouldn't work on .14. Do the most recently posted set of instructions seem applicable for what you are trying to accomplish?
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #30  
Old 07-25-2005, 07:52 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default

Quote:
Originally Posted by DanUK
Another question....X-cart have already modified my checkout sequence to include extra details but they only print out on the order email i.e. the values are not stored in any table. I was thinking of using the code that's been provided to store these fields in the orders_extra table but I notice that the fields I want to use look like this when I view HTML:

Code:
extra[FREE CATALOGUE1] extra[FREE CATALOGUE2]

not sure how this affects the coding required or how I would add that field to func_place_order. I'm assuming that:

Code:
$extras['extra[FREE CATALOGUE1]'] = $catalogue1

isn't going to work?

That might work:

Code:
$extras['extra["FREE CATALOGUE1"]'] = $catalogue1;

(Note the extra set of quotes) I'm never quite sure how to deal with those variables. They seem odd to me. Search for "posted_data" in /include to see how another similar variable is used. Hopefully someone who knows can help us out.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:28 PM.

   

 
X-Cart forums © 2001-2020