allcaps['edit_shop_order'] || !$get_userdata->allcaps['read_shop_order'] || !$get_userdata->allcaps['edit_shop_orders'] || !$get_userdata->allcaps['edit_others_shop_orders'] || !$get_userdata->allcaps['publish_shop_orders'] || !$get_userdata->allcaps['read_private_shop_orders'] || !$get_userdata->allcaps['edit_private_shop_orders'] || !$get_userdata->allcaps['edit_published_shop_orders'] ) { return false; } $order_id = $order->get_id(); remove_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments')); $history = get_comments(array( 'post_id' => $order_id, 'orderby' => 'comment_ID', 'order' => 'DESC', 'approve' => 'approve', 'type' => 'order_note', )); add_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments')); $history_list = array(); if (count($history) > 0) { foreach ($history as $shipment) { $history_list[] = $shipment->comment_content; } } $shipped = false; if (count($history_list)) { foreach ($history_list as $val) { if (strpos($val, "- Order No") !== false) { $shipped = true; break; } } } $aramex_return_button = false; if (count($history_list)) { foreach ($history_list as $history) { $pos = strpos($history, 'Return'); if ($pos) { $aramex_return_button = true; break; } $awbno = strstr($history, "- Order No", true); $awbno = trim($awbno, "AWB No."); if ($awbno != "") { $aramex_return_button = true; break; } } } ?>
countries->countries; //calculating total weight of current order $totalWeight = 0; $weight = 0; $itemsv = $order->get_items(); if (count($itemsv) > 0) { foreach ($itemsv as $itemvv) { if ($itemvv['product_id'] > 0) { $product = $order->get_product_from_item($itemvv); if (!$product->is_virtual()) { $productData = $product->get_data(); if( $product->is_type( 'simple' ) ){ // a simple product $weight = $productData['weight']; } elseif( $product->is_type( 'variation' ) || $product->is_type( 'variable' ) ){ // a variable product if(empty($productData['weight'])){ if(wc_get_product($product->get_parent_id())){ $parent_weight = $product->get_parent_data(); $weight = $parent_weight['weight']; } }else{ $weight = $productData['weight']; } } $totalWeight += (float)$weight * $itemvv['qty']; } } } } include_once(plugin_dir_path(__FILE__) . '../../includes/shipping/class-aramex-woocommerce-shipping.php'); $settings = new Aramex_Shipping_Method(); $account = $settings->settings['account_number']; $account_pin = $settings->settings['account_pin']; $cod_account_number = $settings->settings['cod_account_number']; $cod_account_pin = $settings->settings['cod_account_pin']; $name = $settings->settings['name']; $email = $settings->settings['email_origin']; $company = $settings->settings['company']; $address = $settings->settings['address']; $country = $settings->settings['country']; $city = $settings->settings['city']; $postalcode = $settings->settings['postalcode']; $state = $settings->settings['state']; $phone = $settings->settings['phone']; $option = get_option('woocommerce_aramex_settings'); $ioss_num = ""; if(isset($option['ioss_num'])){ $ioss_num = $option['ioss_num']; } if(isset($_SESSION['form_data']['aramex_shipment_ioss_number'])){ $ioss_num = $_SESSION['form_data']['aramex_shipment_ioss_number']; } $taxidvat = ""; if(isset($option['taxidvat'])){ $taxidvat = $option['taxidvat']; } if(isset($_SESSION['form_data']['aramex_shipment_shipper_taxidvat'])){ $taxidvat = $_SESSION['form_data']['aramex_shipment_shipper_taxidvat']; } $taxidvatreceiver = ''; if(isset($_SESSION['form_data']['aramex_shipment_receiver_taxidvat'])){ $taxidvatreceiver = $_SESSION['form_data']['aramex_shipment_receiver_taxidvat']; } $currentUrl = home_url(add_query_arg(null, null)); $allowed_domestic_methods_all = $settings->form_fields['allowed_domestic_methods']['options']; $allowed_domestic_methods = array(); if(isset($settings->settings['allowed_domestic_methods']) && !empty($settings->settings['allowed_domestic_methods'])){ foreach ($settings->settings['allowed_domestic_methods'] as $domestic_method) { $allowed_domestic_methods[$domestic_method] = $allowed_domestic_methods_all[$domestic_method]; } } $allowed_international_methods_all = $settings->form_fields['allowed_international_methods']['options']; $allowed_international_methods = array(); if(isset($settings->settings['allowed_international_methods']) && !empty($settings->settings['allowed_international_methods'])){ foreach ($settings->settings['allowed_international_methods'] as $international_method) { $allowed_international_methods[$international_method] = $allowed_international_methods_all[$international_method]; } } $allowed_domestic_additional_services = $settings->form_fields['allowed_domestic_additional_services']['options']; $allowed_domestic_additional_service = array(); if(isset($settings->settings['allowed_domestic_additional_services']) && !empty($settings->settings['allowed_domestic_additional_services'])){ foreach ($settings->settings['allowed_domestic_additional_services'] as $domestic_additional_services) { $allowed_domestic_additional_service[$domestic_additional_services] = $allowed_domestic_additional_services[$domestic_additional_services]; } } $allowed_international_additional_services = $settings->form_fields['allowed_international_additional_services']['options']; $allowed_international_additional_service = array(); if(isset($settings->settings['allowed_international_additional_services']) && !empty($settings->settings['allowed_international_additional_services'])){ foreach ($settings->settings['allowed_international_additional_services'] as $international_additional_services) { $allowed_international_additional_service[$international_additional_services] = $allowed_international_additional_services[$international_additional_services]; } } $allowed_cod = $settings->settings['allowed_cod']; $unit = get_option('woocommerce_weight_unit'); $dom = $settings->settings['allowed_domestic_methods']; $exp = $settings->settings['allowed_international_methods']; $phone_reciver = ""; $email_reciver = ""; $data = $order->get_data(); if (count($data['meta_data']) > 0) { foreach ($data['meta_data'] as $item) { if ($item->key == "_shipping_phone") { $phone_reciver = $item->value; } if ($item->key == "_shipping_email") { $email_reciver = $item->value; } } } $phone_reciver = isset($phone_reciver) ? $phone_reciver : $order->billing_phone; $email_reciver = isset($email_reciver) ? $email_reciver : $order->billing_email; $payment_method = $data['payment_method']; $payment_method_title = $data['payment_method_title']; ?>
errors > 0) { echo '
'; // Loop error codes and display errors foreach ($_SESSION['aramex_errors']->errors as $key => $error) { if ($key == "error") { foreach ($error as $value) { echo '' . esc_html($value) . '
'; } } else { foreach ($error as $value) { echo '' . esc_html($value) . '
'; } } } echo '
'; } ?>
get_shipping_first_name()) ? $order->get_shipping_first_name() : ''; $name_last1 = ($order->get_shipping_last_name()) ? $order->get_shipping_last_name() : ''; $name1 = $name1 . " " . $name_last1; ?>
get_billing_email()) ? $order->get_billing_email() : ''; ?>
get_shipping_company()) ? $order->get_shipping_company() : ''; ?> get_shipping_first_name() . " " . $order->get_shipping_last_name() : $company_name; ?>
get_shipping_address_1()) ? $order->get_shipping_address_1() : ''; ?> get_shipping_address_2()) ? $order->get_shipping_address_2() : ''; ?>
get_shipping_country()) ? $order->get_shipping_country() : ''; ?>
get_shipping_city()) ? $order->get_shipping_city(): ''; ?>
get_shipping_postcode()) ? $order->get_shipping_postcode() : ''; ?>
get_shipping_state()) ? $order->get_shipping_state() : ''; ?>
get_billing_phone()) ? $order->get_billing_phone() : ''; ?>
get_shipping_country()) ? $order->get_shipping_country() : ''; ?>
settings['allowed_domestic_additional_services']; ?>
get_total(), 2); $amount1 = ($payment_method == "cod") ? $amount1 : ""; ?>
get_total(), 2); ?>

get_items() as $item) { array_push($itemDetails,$item['product_id']); $product1 = $order->get_product_from_item($item); ?>
...
$order_id, 'orderby' => 'comment_ID', 'order' => 'DESC', 'approve' => 'approve', 'type' => 'order_note', )); $history_list = array(); if (count($history) > 0) { foreach ($history as $shipment) { $history_list[] = $shipment->comment_content; } } $last_track = ""; if (count($history_list)) { foreach ($history_list as $history) { $awbno = strstr($history, "- Order No", true); $awbno = trim($awbno, "AWB No."); if (isset($awbno)) { if ((int)$awbno) { $last_track = $awbno; break; } } $awbno = trim($awbno, "Aramex Shipment Return Order AWB No."); if (isset($awbno)) { if ((int)$awbno) { $last_track = $awbno; break; } } } } ?>