daily pastebin goal
47%
SHARE
TWEET

Hook to Edit Data Being Sent to FoxyCart

sparkweb Sep 3rd, 2011 143 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Function to add your own data to the array being sent to FoxyCart when creating a new user
  2. function my_sso_user_update($foxy_data, $user_id, $act) {
  3.        
  4.         //This Will Only Run When Users Are Added
  5.         if ($act == "add") {
  6.  
  7.  
  8.         //This Will Only Run When Users Are Updated
  9.         } elseif ($act == "update") {
  10.  
  11.  
  12.         }
  13.        
  14.         //These Will Run Any Time And Are All The Fields that the FoxyCart Customer API Will Support
  15.         if (isset($_POST['customer_first_name'])) $foxy_data['customer_first_name'] = $_POST['customer_first_name'];
  16.         if (isset($_POST['customer_last_name'])) $foxy_data['customer_last_name'] = $_POST['customer_last_name'];
  17.         if (isset($_POST['customer_address1'])) $foxy_data['customer_address1'] = $_POST['customer_address1'];
  18.         if (isset($_POST['customer_address2'])) $foxy_data['customer_address2'] = $_POST['customer_address2'];
  19.         if (isset($_POST['customer_city'])) $foxy_data['customer_city'] = $_POST['customer_city'];
  20.         if (isset($_POST['customer_state'])) $foxy_data['customer_state'] = $_POST['customer_state'];
  21.         if (isset($_POST['customer_postal_code'])) $foxy_data['customer_postal_code'] = $_POST['customer_postal_code'];
  22.         if (isset($_POST['customer_country'])) $foxy_data['customer_country'] = $_POST['customer_country'];
  23.         if (isset($_POST['customer_phone'])) $foxy_data['customer_phone'] = $_POST['customer_phone'];
  24.         if (isset($_POST['shipping_first_name'])) $foxy_data['shipping_first_name'] = $_POST['shipping_first_name'];
  25.         if (isset($_POST['shipping_last_name'])) $foxy_data['shipping_last_name'] = $_POST['shipping_last_name'];
  26.         if (isset($_POST['shipping_address1'])) $foxy_data['shipping_address1'] = $_POST['shipping_address1'];
  27.         if (isset($_POST['shipping_address2'])) $foxy_data['shipping_address2'] = $_POST['shipping_address2'];
  28.         if (isset($_POST['shipping_city'])) $foxy_data['shipping_city'] = $_POST['shipping_city'];
  29.         if (isset($_POST['shipping_state'])) $foxy_data['shipping_state'] = $_POST['shipping_state'];
  30.         if (isset($_POST['shipping_postal_code'])) $foxy_data['shipping_postal_code'] = $_POST['shipping_postal_code'];
  31.         if (isset($_POST['shipping_country'])) $foxy_data['shipping_country'] = $_POST['shipping_country'];
  32.         if (isset($_POST['shipping_phone'])) $foxy_data['shipping_phone'] = $_POST['shipping_phone'];
  33.        
  34.         //If passing in CC numbers, your server should be secure
  35.         if (isset($_POST['cc_number'])) $foxy_data['cc_number'] = $_POST['cc_number'];
  36.         if (isset($_POST['cc_exp_month'])) $foxy_data['cc_exp_month'] = $_POST['cc_exp_month'];
  37.         if (isset($_POST['cc_exp_year'])) $foxy_data['cc_exp_year'] = $_POST['cc_exp_year'];
  38.  
  39.         //Always return $foxy_data, even if nothing has been updated
  40.         return $foxy_data;
  41. }
  42. add_filter('foxyshop_save_sso_to_foxycart', 'my_sso_user_update', 10, 3);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top