本文整理汇总了PHP中Toolbox::manageError方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::manageError方法的具体用法?PHP Toolbox::manageError怎么用?PHP Toolbox::manageError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::manageError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOrderNetEven
/**
* Set order NetEven
* @param $param
*/
public function setOrderNetEven($params)
{
if (!self::$send_order_state_to_neteven) {
return;
}
if ($res = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders_gateway` WHERE `id_order` = ' . (int) $params['id_order'])) {
$status = '';
$track = '';
$date_now = date('Y-m-d H:i:s');
if ($params['newOrderStatus']->id == (int) Configuration::get('PS_OS_PREPARATION')) {
$status = 'Confirmed';
}
if ($params['newOrderStatus']->id == (int) Configuration::get('PS_OS_CANCELED')) {
$status = 'Canceled';
}
if ($params['newOrderStatus']->id == (int) Configuration::get('PS_OS_DELIVERED')) {
$res_order = Db::getInstance()->getRow('SELECT `shipping_number` FROM `' . _DB_PREFIX_ . 'orders` WHERE `id_order` = ' . (int) $params['id_order']);
$status = 'Shipped';
$track = $res_order['shipping_number'];
}
if ($params['newOrderStatus']->id == (int) Configuration::get('PS_OS_REFUND')) {
$status = 'Refunded';
}
if ($status != '') {
$order1 = array('OrderID' => $res['id_order_neteven'], 'Status' => $status);
if (!empty($track)) {
$order1['TrackingNumber'] = $track;
}
$params_web = array('orders' => array($order1));
try {
$response = $this->_client->PostOrders($params_web);
$order_status = $response->PostOrdersResult->MarketPlaceOrderStatusResponse;
} catch (Exception $e) {
Toolbox::manageError($e, 'Update order statu in neteven');
$order_status = NULL;
}
if ($this->getValue('send_request_to_mail')) {
$this->sendDebugMail($this->getValue('mail_list_alert'), self::getL('Debug - Control request') . ' setOrderNetEven', $this->_client->__getLastRequest(), true);
}
if (!isset($order_status->StatusResponse) || isset($order_status->StatusResponse) && $order_status->StatusResponse != 'Updated' || is_null($order_status)) {
$complement = !is_array($order_status->StatusResponse) ? $order_status->StatusResponse : '';
$complement .= is_array($order_status->StatusResponse) ? '<pre>' . print_r($order_status->StatusResponse, true) . '</pre>' : '';
if ($this->getValue('send_request_to_mail')) {
$this->sendDebugMail($this->getValue('mail_list_alert'), self::getL('Fail for update order state'), self::getL('Order Id') . ' (' . (int) $params['id_order'] . '). ' . self::getL('NetEven response') . ' : ' . $complement);
}
}
if (!empty($order_status) && !is_null($order_status)) {
Toolbox::addLogLine(self::getL('Update order state') . ' ' . $status . ' ' . self::getL('NetEven Order Id') . ' ' . $res['id_order_neteven'] . ' ' . self::getL('Order Id') . ' ' . $res['id_order'] . ' - ' . $order_status->StatusResponse . '');
}
if (!Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'orders_gateway_order_state` (`id_order`, `id_order_state`, `date_add`, `date_upd`) VALUES (' . (int) $res['id_order'] . ', ' . (int) $params['newOrderStatus']->id . ', "' . pSQL($date_now) . '", "' . pSQL($date_now) . '")')) {
Toolbox::addLogLine(self::getL('Failed for save export NetEven order state Id') . ' ' . (int) $res['id_order']);
} else {
Toolbox::addLogLine(self::getL('Save export of NetEven order state Id') . ' ' . (int) $res['id_order']);
}
}
}
Toolbox::writeLog();
}
示例2: addProductInNetEven
/**
* Envoie des produits a NetEven.
* @param $t_retour
* @return mixed
*/
private function addProductInNetEven($neteven_products)
{
if (count($neteven_products) == 0) {
if ($this->getValue('debug')) {
Toolbox::displayDebugMessage(self::getL('No product to send !'));
}
return;
}
try {
Toolbox::addLogLine(self::getL('Number of product send to NetEven') . ' ' . count($neteven_products));
$params = array('items' => $neteven_products);
$response = $this->_client->PostItems($params);
$itemsStatus = $response->PostItemsResult->InventoryItemStatusResponse;
if ($this->getValue('debug')) {
Toolbox::displayDebugMessage(self::getL('Sends data to NetEven'));
}
} catch (Exception $e) {
if ($this->getValue('debug')) {
Toolbox::displayDebugMessage(self::getL('Failed to send data to Neteven'));
}
$erreur = '<pre>Last request:\\n' . $this->_client->__getLastRequest() . '</pre>\\n';
Toolbox::manageError($e, 'add product nombre => ' . count($neteven_products) . ' ' . $erreur);
$response = '';
$itemsStatus = '';
}
if ($this->getValue('send_request_to_mail')) {
$this->sendDebugMail($this->getValue('mail_list_alert'), self::getL('Debug - Control request') . ' addProductInNetEven', $this->_client->__getLastRequest(), true);
}
if ($response != '' && $itemsStatus != '') {
if (is_array($response->PostItemsResult->InventoryItemStatusResponse)) {
foreach ($response->PostItemsResult->InventoryItemStatusResponse as $rep) {
Toolbox::addLogLine($rep->ItemCode . ' ' . $rep->StatusResponse);
if ($this->getValue('debug')) {
Toolbox::displayDebugMessage(self::getL('Add product') . ' : ' . $rep->ItemCode . ' ' . $rep->StatusResponse);
}
}
} else {
Toolbox::addLogLine($response->PostItemsResult->InventoryItemStatusResponse->ItemCode . ' ' . $response->PostItemsResult->InventoryItemStatusResponse->StatusResponse);
if ($this->getValue('debug')) {
Toolbox::displayDebugMessage(self::getL('Add product') . ' : ' . $response->PostItemsResult->InventoryItemStatusResponse->ItemCode . ' ' . $response->PostItemsResult->InventoryItemStatusResponse->StatusResponse);
}
}
}
Toolbox::writeLog();
Configuration::updateValue('neteven_date_export_product', date('Y-m-d H:i:s'));
}
示例3: testConnection
/**
* Test of connection
* @return null|string
*/
private function testConnection()
{
try {
$response = $this->_client->TestConnection();
$message = $response->TestConnectionResult;
} catch (Exception $e) {
Toolbox::manageError($e, 'Test connection');
$message = null;
}
if (!is_null($message)) {
return $message;
}
return;
}