X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Gift Certificate Auto Generate (https://forum.x-cart.com/showthread.php?t=51317)

mrerotic 12-15-2009 01:09 AM

Gift Certificate Auto Generate
 
Is there anyway to auto generate a gift certificate for the amount of an order that is refunded? This would be a great way to give the customer a store credit, at the same time you change the order status to refund.

jcorneli 12-20-2009 08:05 AM

Re: Gift Certificate Auto Generate
 
I would be instrested in this as well. Anyone have an idea?

mrerotic 12-21-2009 01:15 PM

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.


All times are GMT -8. The time now is 04:30 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.