function eStore_save_order_details($custId) { global $wpdb; $pending_payment_table_name = $wpdb->prefix . "wp_eStore_pending_payment_tbl"; $custom_field_val = eStore_get_custom_field_value(); $referrer = eStore_get_referrer(); $total_cart_shipping = $_SESSION['eStore_cart_postage_cost']; if (is_numeric($total_cart_shipping)) { $total_cart_shipping = number_format($total_cart_shipping, 2); } $total_cart_tax = number_format($_SESSION['eStore_cart_total_tax'], 2); $sub_total = $_SESSION['eStore_cart_sub_total']; foreach ($_SESSION['eStore_cart'] as $item) { $item_number = $item['item_number']; $name = esc_sql(htmlspecialchars($item['name'])); $price = round($item['price'], 2); $quantity = $item['quantity']; $shipping = $item['shipping']; $updatedb = "INSERT INTO {$pending_payment_table_name} (customer_id, item_number, name, price, quantity, shipping, custom, total_shipping, total_tax, subtotal) VALUES ('{$custId}', '{$item_number}', '{$name}','{$price}','{$quantity}','{$shipping}','{$custom_field_val}','{$total_cart_shipping}','{$total_cart_tax}','{$sub_total}')"; $results = $wpdb->query($updatedb); } }
function extract_manaul_co_general_payment_data($fname, $lname, $email, $address, $phone) { $custom = eStore_get_custom_field_value(); $unique_id = uniqid(); $num_cart_items = count($_SESSION['eStore_cart']); $coupon_code_used = ''; if (!empty($_SESSION['eStore_coupon_code'])) { $coupon_code_used = $_SESSION['eStore_coupon_code']; } $eMember_id = ''; if (function_exists('wp_eMember_install')) { $emember_auth = Emember_Auth::getInstance(); $user_id = $emember_auth->getUserInfo('member_id'); if (!empty($user_id)) { $eMember_id = $user_id; } } $total = $_SESSION['eStore_cart_sub_total'] + $_SESSION['eStore_cart_postage_cost'] + $_SESSION['eStore_cart_total_tax']; $payment_data = array('gateway' => 'manual', 'custom' => $custom, 'txn_id' => $unique_id, 'txn_type' => 'Shopping Cart', 'transaction_subject' => 'Shopping cart manual checkout', 'first_name' => $fname, 'last_name' => $lname, 'payer_email' => $email, 'num_cart_items' => $num_cart_items, 'subscr_id' => $unique_id, 'address' => $address, 'phone' => $phone, 'coupon_used' => $coupon_code_used, 'eMember_username' => $eMember_id, 'eMember_userid' => $eMember_id, 'mc_gross' => $total, 'mc_shipping' => $_SESSION['eStore_cart_postage_cost'], 'mc_tax' => $_SESSION['eStore_cart_total_tax'], 'address_street' => $_POST['address'], 'address_city' => $_POST['city'], 'address_state' => $_POST['state'], 'address_country' => $_POST['country']); return $payment_data; }
function wp_eStore_load_eStore_cart_class() { $eStore_cart = new WP_eStore_Cart(); $eStore_items = wp_eStore_load_items_to_eStore_item_class(); $eStore_cart->AddItems($eStore_items); $shipping = round($_SESSION['eStore_cart_postage_cost'], 2); $eStore_cart->SetCartShipping($shipping); if (get_option('eStore_enable_tax') != '') { $eStore_cart->SetCartTaxRate(get_option('eStore_global_tax_rate')); } $return_url = get_option('cart_return_from_paypal_url'); $eStore_currency = get_option('cart_payment_currency'); $eStore_cart->SetCartCurrency($eStore_currency); $eStore_cart->SetCartReturnUrl($return_url); $custom_field_val = eStore_get_custom_field_value(); $eStore_cart->SetCustomData($custom_field_val); //($_SESSION['eStore_custom_values']); if (isset($_SESSION['discount_applied_once'])) { $eStore_cart->SetDiscountAppliedFlag($_SESSION['discount_applied_once']); } if (isset($_SESSION['auto_discount_applied_once'])) { $eStore_cart->SetAutoDiscountAppliedFlag($_SESSION['auto_discount_applied_once']); } return $eStore_cart; }
function print_eStore_subscribe_button_form($id) { global $wpdb; $products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME; $ret_product = $wpdb->get_row("SELECT * FROM {$products_table_name} WHERE id = '{$id}'", OBJECT); $output = ""; if (is_numeric($ret_product->available_copies)) { if ($ret_product->available_copies < 1) { return eStore_get_sold_out_button(); } } if (!empty($ret_product->paypal_email)) { $paypal_email = $ret_product->paypal_email; } else { $paypal_email = get_option('cart_paypal_email'); } if (!empty($ret_product->currency_code)) { $paypal_currency = $ret_product->currency_code; } else { $paypal_currency = get_option('cart_payment_currency'); } //$paypal_currency = get_option('cart_payment_currency'); $return = get_option('cart_return_from_paypal_url'); // Find out if the product should be delivered automatically through a notify email if (get_option('eStore_auto_product_delivery') == '') { $notify = ''; } else { if (WP_ESTORE_ENABLE_NEW_CHECKOUT_REDIRECTION === '1') { $notify = WP_ESTORE_WP_SITE_URL . '/?estore_pp_ipn=process'; } else { $notify = WP_ESTORE_URL . '/paypal.php'; } } $urls = ""; if (!empty($notify)) { $urls .= '<input type="hidden" name="notify_url" value="' . $notify . '" />'; } if (!empty($ret_product->return_url)) { $urls .= '<input type="hidden" name="return" value="' . $ret_product->return_url . '" />'; } else { if (!empty($return)) { $urls .= '<input type="hidden" name="return" value="' . $return . '" />'; } } $cancel_url = get_option('cart_cancel_from_paypal_url'); if (!empty($cancel_url)) { $urls .= '<input type="hidden" name="cancel_return" value="' . $cancel_url . '" />'; } $button = $ret_product->button_image_url; $button_type = ""; if (!empty($button)) { $button_type .= '<input type="image" src="' . $button . '" class="eStore_subscribe_button" alt="' . WP_ESTORE_SUBSCRIBE . '"/>'; } else { $button_type .= '<input type="submit" class="eStore_subscribe_button" value="' . WP_ESTORE_SUBSCRIBE . '" />'; } $sandbox_enabled = get_option('eStore_cart_enable_sandbox'); if ($sandbox_enabled) { $form_submit_url = PAYPAL_SANDBOX_URL; } else { $form_submit_url = PAYPAL_LIVE_URL; } $form_submit_url = apply_filters('eStore_pp_subscribe_form_submit_url', $form_submit_url); //Subscribe button form $output = ""; $output .= '<div class="eStore_button_wrapper eStore_pp_subscribe_wrapper">'; $output .= '<form action="' . $form_submit_url . '" method="post" onsubmit="return ReadForm1(this, 3);">'; $line_break = true; //variation code $output .= get_variation_and_input_code($ret_product, $line_break, 3); //Custom price if ($ret_product->custom_price_option == '1') { $currSymbol = get_option('cart_currency_symbol'); $output .= WP_ESTORE_YOUR_PRICE . ': ' . $currSymbol . '<input type="text" name="custom_price" size="3" value="" /> '; if ($line_break) { $output .= '<br />'; } } $output .= '<input type="hidden" name="product_name_tmp1" value="' . htmlspecialchars($ret_product->name) . '" /><input type="hidden" name="price_tmp1" value="' . $ret_product->a3 . '" />'; if (defined('WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE') && WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE !== '0') { //Set the country/region preference by force. $output .= '<input type="hidden" name="lc" value="' . WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE . '" />'; } $output .= '<input type="hidden" name="cmd" value="_xclick-subscriptions" />'; $output .= '<input type="hidden" name="charset" value="utf-8" />'; $output .= "<input type=\"hidden\" name=\"business\" value=\"{$paypal_email}\" />"; $output .= '<input type="hidden" name="item_name" value="' . htmlspecialchars($ret_product->name) . '" />'; $output .= "<input type=\"hidden\" name=\"currency_code\" value=\"{$paypal_currency}\" />"; $output .= "<input type=\"hidden\" name=\"item_number\" value=\"{$id}\" />"; $output .= '<input type="hidden" name="rm" value="2" /><input type="hidden" name="no_note" value="1" />'; if (!empty($ret_product->p1)) { $output .= "<input type=\"hidden\" name=\"a1\" value=\"{$ret_product->a1}\" /><input type=\"hidden\" name=\"p1\" value=\"{$ret_product->p1}\" /><input type=\"hidden\" name=\"t1\" value=\"{$ret_product->t1}\" />"; } if (!empty($ret_product->p3)) { if (empty($ret_product->a3)) { $output .= "<div style='color:red;'>Looks like you did not specify a recurring amount in the subscription details. Please note that you must specify a value for the Recurring Billing Amount to create a working subscription payment button!</div>"; } else { $output .= "<input type=\"hidden\" name=\"a3\" value=\"{$ret_product->a3}\" /><input type=\"hidden\" name=\"p3\" value=\"{$ret_product->p3}\" /><input type=\"hidden\" name=\"t3\" value=\"{$ret_product->t3}\" />"; } } if ($ret_product->sra == '1') { $output .= '<input type="hidden" name="sra" value="1" />'; } if ($ret_product->srt > 1) { $output .= "<input type=\"hidden\" name=\"src\" value=\"1\" /><input type=\"hidden\" name=\"srt\" value=\"{$ret_product->srt}\" />"; } else { if ($ret_product->srt == '0') { $output .= "<input type=\"hidden\" name=\"src\" value=\"1\" />"; } } if (is_numeric($ret_product->shipping_cost) && $ret_product->shipping_cost == 0) { $output .= "<input type=\"hidden\" name=\"no_shipping\" value='1' />"; } $output .= $urls; $output .= '<input type="hidden" name="mrb" value="3FWGC6LFTMTUG" />'; $returnButtonText = get_option('eStore_paypal_return_button_text'); $output .= '<input type="hidden" name="cbt" value="' . $returnButtonText . '" />'; $page_style_name = get_option('eStore_paypal_co_page_style'); $output .= '<input type="hidden" name="page_style" value="' . $page_style_name . '" />'; if (empty($ret_product->ref_text)) { $output .= aff_add_custom_field(); } else { $custom_field_val = eStore_get_custom_field_value(); $subsc_ref_val = 'subsc_ref=' . $ret_product->ref_text; if (empty($custom_field_val)) { $custom_field_val = $subsc_ref_val; } else { $custom_field_val = $custom_field_val . '&' . $subsc_ref_val; } $output .= '<input type="hidden" name="custom" value="' . $custom_field_val . '" id="eStore_custom_values" />'; } if (get_option('eStore_show_t_c_for_buy_now')) { $output .= eStore_show_terms_and_cond(); } $output .= $button_type; $output .= '</form>'; $output .= '</div>'; return $output; }
function aff_add_custom_field() { $custom_field_val = eStore_get_custom_field_value(); $output = '<input type="hidden" name="custom" value="' . $custom_field_val . '" id="eStore_custom_values" />'; return $output; }