View Single Post
  #60  
Old 10-06-2007, 08:15 AM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: Printing 'Customer Notes' on invoices

Quote:
Originally Posted by cherie
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.
With my brother's programming help we have fixed this problem.

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:
else { # # Not enough money # func_header_location($current_location.DIR_CUSTOMER."/cart.php?mode=checkout"); } } ?>
Replace with this code:
Code:
else { # # Not enough money # # NOTE - appended "gc_notes1" variable (Gift Certificate Notes) onto the end of the URL to pass along the Customer Comments/Notes func_header_location($current_location.DIR_CUSTOMER."/cart.php?mode=checkout&gc_notes1=".urlencode($Customer_Comment)); } } ?>

Step 2:
Locate this File: cart.php - (about line 797):
Find this code:
Code:
func_header_location("cart.php?paymentid=".$payment_methods[0]["paymentid"]."&mode=checkout");
Replace with this code: (added just above to assign variable to Smarty)
Code:
$smarty->assign("gc_notes", $gc_notes1); func_header_location("cart.php?paymentid=".$payment_methods[0]["paymentid"]."&mode=checkout");

Step 3:
Locate this File: skin1/customer/main/checkout.tpl - (about line 133) - to append variable to 2nd Checkout URL

Find this code:
Code:
<INPUT type="hidden" name="mode" value="checkout">
Replace with this code: (added just below)
Code:
<INPUT type="hidden" name="mode" value="checkout"> {if $gc_notes ne ""} <INPUT type="hidden" name="gc_notes" value="{$gc_notes}"> {/if}

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:
<TEXTAREA cols="45" rows="6" name="Customer_Comment"></TEXTAREA>
Replace with this code: (variable inserted into textarea)
Code:
<TEXTAREA cols="45" rows="6" name="Customer_Comment">{php} if($_GET['gc_notes'] > ""){echo $_GET['gc_notes'];} {/php}</TEXTAREA>

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
Reply With Quote