View Single Post
  #3  
Old 12-21-2009, 01:15 PM
 
mrerotic mrerotic is offline
 

eXpert
  
Join Date: Feb 2009
Posts: 264
 

Default Re: Gift Certificate Auto Generate

Ok I figured out how to make this possible, but you need to incorporate the 'Order Status - Refund' mod someone came up with on this site shown here:
http://forum.x-cart.com/showthread.php?t=33007&highlight=order+refund

Then do the following:

Open /include/func/func_orders.php and add the following to the other mod:
Code:
elseif ($status == "R" && $order["status"] != "R") { // Return products to stock func_update_quantity($order_data["products"],false); // Generate Gift Certificate $db_gc['gcid'] = $gcid = strtoupper(md5(uniqid(rand()))); $db_gc['status'] = 'A'; $db_gc['add_date'] = time(); $db_gc['purchaser'] = 'Your Company Name'; $db_gc['recipient'] = $order_data["userinfo"]['firstname']." ".$order_data["userinfo"]['lastname']; $db_gc['recipient_email'] = $order_data["userinfo"]['email']; $db_gc['message'] = stripslashes('There was an issue with your order either a specific item was not available or you have decided to cancel your order. A store credit has been issued by gift certificate for the amount of your initial order. If you have any questions or concerns, please feel free to contact us.'); $db_gc['amount'] = $order_data["order"]["total"]; $db_gc['debit'] = $order_data["order"]["total"]; func_array2insert('giftcerts', $db_gc); // Send Gift Certificate Via Email $mail_smarty->assign("giftcert", $db_gc); func_send_mail($db_gc["recipient_email"], "mail/giftcert_subj.tpl", "mail/giftcert.tpl", $config["Company"]["orders_department"], false); func_send_mail($config["Company"]["orders_department"], "mail/giftcert_notification_subj.tpl", "mail/giftcert_notification.tpl", $config["Company"]["orders_department"], false); # Send notification to customer $userinfo = $order_data["userinfo"]; $mail_smarty->assign("customer",$userinfo); func_send_mail($userinfo["email"], "mail/order_refunded_subj.tpl", "mail/order_customer_refunded.tpl", $config["Company"]["orders_department"], false); }

This will automatically generate an in store credit for the amount of their original order that was refunded including shipping and taxes. This is a great mod for store owners that want to only refund customers with a store credit by providing the customer with a Gift Certificate.
__________________
x-cart 4.2.3
AlteredCart Smart Search
Auto Featured Products Mod (Personal Mod)
BCSE Product Importer Pro & Drop Shipper Pro
CDSEO Pro
CMS EZRecommends
EE slider login (Personal Mod)
Next Prev Link Mod (Customized)
ShadowBox Detailed Images (Personal Mod)
Shop By Price (Customized)
Social Media (Personal Mod)
Switch Layout View (Personal Mod)
Special Offers
Testimonials (Personal Mod)
Whats New (Customized)
Reply With Quote