if(isset($_POST['btn-edit-order'])){ /* # ---------------------------------------------------------------------- # DEFINED VARIABLE # ---------------------------------------------------------------------- */ $set_fulfilment_date = date("Y-m-d H:i:s"); $get_order_id = get_order_detail_by_number($order_number); $order_detail = get_order_detail($get_order_id['order_id']); $order_item = order_item($order_detail['order_id']); $data_header_method = $_POST['order_payment_method']; $data_header_name = escape_quote($_POST['order_confirm_name']); $data_header_amount = clean_price($_POST['order_confirm_amount']); $data_purchase_amount = $_POST['hidden_total_purchase']; $data_shipping = $_POST['hidden_order_shipping_amount']; $data_order_id = $_POST['hidden_order_id']; $ship_address = ltrim(escape_quote($_POST['order_shipping_address'])); $ship_country = $_POST['order_shipping_country']; $ship_province = $_POST['order_shipping_province']; $ship_city = $_POST['order_shipping_city']; /* # ---------------------------------------------------------------------- # CALL FUNCTION # ---------------------------------------------------------------------- */ $courier = get_shipping($_POST['hidden_order_shipping_method'], 'Active');
$international = international($ship_id); if ($service == "Local Only") { $title = "Local"; } else { if ($service == "International Only") { $title = "International"; } else { $title = "Local"; } } $country = get_country(); if (isset($_POST['btn-edit-shipping'])) { // DEFINED VARIABLE $courier_ids = $_REQUEST['sid']; $courier_name = $_POST['courier_name']; $courier_description = $_POST['description']; $courier_service = $_POST['courier_service']; $courier_weight = $_POST['courier_weight']; $courier_id = $_POST['city_name']; $courier_rate = clean_price($_POST['courier_rate']); if ($_POST['btn-edit-shipping'] != "Delete") { update_local_courier($courier_name, $courier_description, $courier_service, 'Active', $courier_weight, $courier_ids); // RATE foreach ($courier_id as $index => $courier_id) { update_local_rate($courier_rate[$index], $courier_weight, $courier_id); } $_SESSION['alert'] = "success"; $_SESSION['msg'] = "Changes have been successfully saved."; } else { } }
$_update->insertCourierRate($courier_id->latest_id, $provinces, $city->city_name, '0', $weight); } } $rate = $_POST['courier_Rate']; $courier_rate_id = $_get->get_min_courier($courier_id->latest_id); $initial_id = $courier_rate_id->latest_id; foreach ($rate as $rate) { $rate = filter_var($rate, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $_update->update_rate($initial_id, $courier_id->latest_id, $rate); $initial_id++; } /* --- INTERNATIONAL --- */ $courier_name = $courier_id['latest_id']; $courier_province = "international"; $courier_city = $_POST['international_id']; $courier_rate = clean_price($_POST['international_rate']); $courier_weight = $_POST['weight']; $courier_rate_id = $_get->get_min_courier($courier_id->latest_id); $initial_id = $courier_rate_id->latest_id; foreach ($courier_city as $key => $city) { $_update->insertCourierRate($courier_name, $courier_province, $city, $courier_rate[$key], $courier_weight); } foreach ($courier_rate as $rate) { $_update->update_rate($initial_id, $courier_id->latest_id, $rate); $initial_id++; } } } } $type = 'success'; $msg = 'Item successfully saved';
function get_amazon_price($book) { $amazon_url = "http://www.amazon.fr/s/ref=sr_nr_p_76_0?rh=i%3Aaps%2Ck%3A1591843030%2Cp_76%3A1&ie=UTF8&qid=1343918498"; $amazon_url .= "&keywords=" . $book; $snoopy = new Snoopy(); $snoopy->fetch($amazon_url); $html = $snoopy->results; $html = str_get_html($html); $new_price = 0; $results = $html->find('#atfResults', 0); if (isset($results)) { $new_price = $results->find('.newPrice', 0)->find('span', 0)->innertext; $new_price = clean_price($new_price); } $html->clear(); unset($html); return $new_price; }