private function _call_print_label($print_label, $transaction_id, $order_id, $track_code) { try { $wsdl_url = $this->config->item('wsdl_url'); $client = new SoapClient($wsdl_url); $response = $client->PrintEPacketLabel(array('PrintLabelRequest' => $print_label)); $result = $response->PrintEPacketLabelResult; if ($result->Ack == 'Success') { $label = $result->Label; $pdf_path = $this->_pdf_path(); file_put_contents($pdf_path . '/' . $transaction_id . '.pdf', $label); $this->epacket_model->update_print_label($transaction_id); // everything is ok now! update the order status $order = $this->order_model->get_order($order_id); if (isset($order->ship_confirm_user)) { $user_name = $order->ship_confirm_user; } else { $user_name = 'script'; } unset($order); $remark = $this->order_model->get_sys_remark($order_id); $remark .= sprintf(lang('confirm_shipped_remark'), date('Y-m-d H:i:s'), $user_name); $data = array('track_number' => $track_code, 'ship_confirm_date' => date('Y-m-d H:i:s'), 'order_status' => $this->order_statuses['wait_for_feedback'], 'sys_remark' => $remark); $this->order_model->update_order_information($order_id, $data); /* $type_extra = $user_name . '/' . date('Y-m-d H:i:s'); $this->product_model->update_product_stock_count_by_order_id($order_id, 'order_outstock', $type_extra); */ // notify customer with email in another process $this->events->trigger('shipping_confirmation_after', array('order_id' => $order_id)); } else { var_dump($result); $this->epacket_model->save_failure_message($transaction_id, $result->Message); return false; } } catch (SOAPFault $exception) { print $exception; } }