salesforce createprofile
This commit is contained in:
@@ -47,8 +47,6 @@ add_action('wp_logout', function () {
|
||||
session_destroy();
|
||||
});
|
||||
|
||||
// $_SESSION values are set on the cart page
|
||||
|
||||
/**
|
||||
* Allow only one coupon per order in WooCommerce.
|
||||
*/
|
||||
@@ -77,10 +75,9 @@ function get_current_shipping_comment() {
|
||||
// Get the chosen shipping methods from the cart
|
||||
$chosen_shipping_methods = WC()->session->get('chosen_shipping_methods');
|
||||
if (empty($chosen_shipping_methods)) {
|
||||
return null; // No shipping methods selected
|
||||
return null;
|
||||
}
|
||||
|
||||
// Loop through chosen shipping methods to find their settings
|
||||
foreach ($chosen_shipping_methods as $chosen_method) {
|
||||
$method_parts = explode(':', $chosen_method); // Split method ID and instance ID
|
||||
$shipping_method_id = $method_parts[0];
|
||||
@@ -182,19 +179,6 @@ function generateCartSummary($showCheckoutButton = true) {
|
||||
$couponDescription[] = $coupon->get_description();
|
||||
}
|
||||
|
||||
$chosen_method = WC()->session->get('chosen_shipping_methods')[0] ?? '';
|
||||
error_log('Chosen Method: ' . $chosen_method);
|
||||
|
||||
|
||||
$shipping_comment = get_current_shipping_comment();
|
||||
if ($shipping_comment) {
|
||||
error_log('Current shipping comment (Salesforce ID): ' . $shipping_comment);
|
||||
} else {
|
||||
error_log('No shipping comment found for the currently applied shipping method.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Render with original structure and components
|
||||
return site()->render("cart_summary", array_merge($product, [
|
||||
"variation" => $ratePlan,
|
||||
@@ -420,18 +404,8 @@ function calculateTotalCart($basePrice, $activationFee, $finalShippingCost, $rat
|
||||
$rateMultiplier = 6;
|
||||
}
|
||||
|
||||
// Calculate the variable price adjusted for the rate plan
|
||||
$variablePrice = $basePrice * $rateMultiplier;
|
||||
//error_log("Adjusted Variable Price for Rate Plan ($ratePlan): " . $variablePrice);
|
||||
|
||||
// Calculate the total cart value
|
||||
$totalCart = $variablePrice + $activationFee + $finalShippingCost;
|
||||
//error_log("Total Cart Before Calculation: " . $totalCart);
|
||||
|
||||
// Apply additional discounts or fees if necessary
|
||||
// ...
|
||||
|
||||
//error_log("Total Cart After Calculation: " . $totalCart);
|
||||
|
||||
return $totalCart;
|
||||
}
|
||||
@@ -550,7 +524,7 @@ function get_title_shipping_method_from_method_id( $method_rate_id = '' ){
|
||||
$method_key_id = str_replace( ':', '_', $method_rate_id );
|
||||
$option_name = 'woocommerce_'.$method_key_id.'_settings';
|
||||
return get_option( $option_name, true )['title'];
|
||||
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -1121,16 +1095,13 @@ function createOrderRequest($order) {
|
||||
|
||||
// Create the expiration date in the required format (e.g., "MM/YYYY")
|
||||
$expiration_date = sprintf('%02d/%s', $expiration_month, $expiration_year);
|
||||
|
||||
// Generate the request header
|
||||
$header = createRequestHeader();
|
||||
|
||||
// Get billing and shipping information from the order
|
||||
$billing = $order->get_address('billing');
|
||||
$shipping = $order->get_address('shipping');
|
||||
$payment_type = "Credit Card"; // Assuming credit card
|
||||
$payment_type = "Credit Card";
|
||||
|
||||
// Format phone number (example: XXX-XXX-XXXX)
|
||||
$billing_phone = preg_replace('/(\d{3})(\d{3})(\d{4})/', '$1-$2-$3', $billing['phone']);
|
||||
$shipping_phone = !empty($shipping['phone']) ? preg_replace('/(\d{3})(\d{3})(\d{4})/', '$1-$2-$3', $shipping['phone']) : $billing_phone;
|
||||
|
||||
@@ -1233,6 +1204,7 @@ if (!class_exists("SalesforceSync")) {
|
||||
class SalesforceSync {
|
||||
|
||||
const kACTION_ORDER_CREATE = "CreateOrder";
|
||||
const kACTION_PROFILE_CREATE ="CreateProfile";
|
||||
const kAPPEND_URL = "?brand=MedicalAlert";
|
||||
|
||||
private $url;
|
||||
|
||||
Reference in New Issue
Block a user