function estore_check_and_reapply_area_specific_tax() { if (WP_ESTORE_APPLY_TAX_FOR_CERTAIN_AREA !== '0') { if (isset($_SESSION['eStore_area_specific_total_tax'])) { $_SESSION['eStore_area_specific_total_tax'] = eStore_calculate_total_cart_tax(); } } }
function eStore_get_cart_tax() { $total_tax = 0; if (empty($_SESSION['eStore_cart'])) { return $total_tax; } if (get_option('eStore_enable_tax')) { $total_tax = eStore_calculate_total_cart_tax(); } $_SESSION['eStore_cart_total_tax'] = $total_tax; if (isset($_SESSION['eStore_area_specific_total_tax'])) { $_SESSION['eStore_cart_total_tax'] += $_SESSION['eStore_area_specific_total_tax']; } return $total_tax; }
function eStore_gateway_specific_buy_now_submit_listener() { if (isset($_REQUEST['eStore_gs_buy_now_submit'])) { $wp_eStore_config = WP_eStore_Config::getInstance(); $cookie_domain = eStore_get_top_level_domain(); setcookie("cart_in_use", "true", time() + 21600, "/", $cookie_domain); if (function_exists('wp_cache_serve_cache_file')) { //WP Super cache workaround setcookie("comment_author_", "eStore", time() + 21600, "/", $cookie_domain); } unset($_SESSION['eStore_last_action_msg']); unset($_SESSION['eStore_last_action_msg_2']); unset($_SESSION['eStore_last_action_msg_3']); unset($_SESSION['eStore_gs_bn_co_error_msg']); if (isset($_SESSION['eStore_cart'])) { unset($_SESSION['eStore_cart']); } //sanitize data $_REQUEST['product'] = strip_tags($_REQUEST['product']); //for PHP5.2 use filter_var($_REQUEST['product'], FILTER_SANITIZE_STRING); $_REQUEST['add_qty'] = strip_tags($_REQUEST['add_qty']); $_REQUEST['item_number'] = strip_tags($_REQUEST['item_number']); if (isset($_REQUEST['custom_price'])) { $_REQUEST['custom_price'] = strip_tags($_REQUEST['custom_price']); } if (isset($_REQUEST['price'])) { $_REQUEST['price'] = strip_tags($_REQUEST['price']); } isset($_REQUEST['shipping']) ? $_REQUEST['shipping'] = strip_tags($_REQUEST['shipping']) : ($_REQUEST['shipping'] = ''); isset($_REQUEST['cartLink']) ? $_REQUEST['cartLink'] = strip_tags($_REQUEST['cartLink']) : ($_REQUEST['cartLink'] = ''); isset($_REQUEST['thumbnail_url']) ? $_REQUEST['thumbnail_url'] = strip_tags($_REQUEST['thumbnail_url']) : ($_REQUEST['thumbnail_url'] = ''); isset($_REQUEST['tax']) ? $_REQUEST['tax'] = strip_tags($_REQUEST['tax']) : ($_REQUEST['tax'] = ''); if (isset($_REQUEST['digital_flag'])) { $_REQUEST['digital_flag'] = strip_tags($_REQUEST['digital_flag']); } else { $_REQUEST['digital_flag'] = ''; } $gateway = strip_tags($_REQUEST['eStore_gsbn_gateway']); $products = array(); $eStore_gs_buy_now_checkout_error = false; $count = 1; if ($count == 1) { $item_addittion_permitted = true; $quantity_available = is_quantity_availabe($_REQUEST['item_number'], $_REQUEST['add_qty']); if (!$quantity_available) { //Requested qty not available $_REQUEST['add_qty'] = 1; //Add one by default $eStore_gs_buy_now_checkout_error = true; } if (isset($_SESSION['eStore_last_action_msg'])) { $_SESSION['eStore_gs_bn_co_error_msg'] = $_SESSION['eStore_last_action_msg']; } if ($item_addittion_permitted) { if (!empty($_REQUEST[$_REQUEST['product']])) { $price = $_REQUEST[$_REQUEST['product']]; } else { if (isset($_REQUEST['custom_price'])) { global $wpdb; $products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME; $id = $_REQUEST['item_number']; $retrieved_product = $wpdb->get_row("SELECT * FROM {$products_table_name} WHERE id = '{$id}'", OBJECT); if ($_REQUEST['custom_price'] < $retrieved_product->price) { $price = $retrieved_product->price; $currSymbol = get_option('cart_currency_symbol'); $eStore_gs_buy_now_checkout_error = true; $_SESSION['eStore_gs_bn_co_error_msg'] = '<p style="color: red;">' . WP_ESTORE_MINIMUM_PRICE_YOU_CAN_ENTER . $currSymbol . $retrieved_product->price . '</p>'; } else { $price = $_REQUEST['custom_price']; } } else { $price = $_REQUEST['price']; } } $product = array('name' => stripslashes($_REQUEST['product']), 'price' => $price, 'quantity' => $_REQUEST['add_qty'], 'shipping' => $_REQUEST['shipping'], 'item_number' => $_REQUEST['item_number'], 'cartLink' => $_REQUEST['cartLink'], 'thumbnail_url' => $_REQUEST['thumbnail_url'], 'tax' => $_REQUEST['tax'], 'digital_flag' => $_REQUEST['digital_flag']); array_push($products, $product); } } if (!$eStore_gs_buy_now_checkout_error) { $_SESSION['eStore_cart'] = $products; $_SESSION['eStore_url'] = WP_ESTORE_URL; $_SESSION['eStore_cart_sub_total'] = eStore_get_cart_total(); $_SESSION['eStore_cart_postage_cost'] = eStore_get_cart_shipping(); $_SESSION['eStore_cart_total_tax'] = eStore_calculate_total_cart_tax(); wp_eStore_check_cookie_flag_and_store_values(); if (WP_ESTORE_ENABLE_NEW_CHECKOUT_REDIRECTION === '1') { $redirect_page = WP_ESTORE_WP_SITE_URL . '/?eStore_checkout=process&eStore_gateway=' . $gateway; } else { $redirect_page = WP_ESTORE_URL . '/eStore_payment_submission.php?eStore_gateway=' . $gateway; } eStore_redirect_to_url($redirect_page); } } }
if (isset($_REQUEST['estore_pagination_go'])) { //Pagination go request $target_page_no = sanitize_text_field($_REQUEST['estore_pagination_page_no']); $parameter_name = sanitize_text_field($_REQUEST['estore_pagination_parameter_name']); $page_url = esc_url($_REQUEST['estore_pagination_raw_url']); $target_page = eStore_append_http_get_data_to_url($page_url, $parameter_name, $target_page_no); eStore_redirect_to_url($target_page); } eStore_download_now_button_request_handler(); } if (isset($_POST['eStore_shipping_variation'])) { $_SESSION['eStore_shipping_variation_updated_once'] = '1'; } if (isset($_POST['eStore_area_tax_submitted'])) { if (WP_ESTORE_APPLY_TAX_FOR_CERTAIN_AREA !== '0') { $_SESSION['eStore_area_specific_total_tax'] = eStore_calculate_total_cart_tax(); } } if (isset($_POST['eStore_apply_discount'])) { //sanitize data $_POST['coupon_code'] = strip_tags($_POST['coupon_code']); $coupon = $_POST['coupon_code']; eStore_apply_discount($coupon); } if (isset($_POST['eStore_apply_aff_id'])) { if (function_exists('wp_aff_platform_install')) { $_POST['estore_aff_id'] = strip_tags($_POST['estore_aff_id']); record_click_for_eStore_cart($_POST['estore_aff_id']); $_SESSION['eStore_last_action_msg'] = '<p style="color: green;">' . ESTORE_AFFILIATE_ID_SET . '</p>'; if (get_option('eStore_aff_link_coupon_aff_id') == 1) { eStore_apply_discount($_POST['estore_aff_id']);