本文整理汇总了PHP中Hook::updateOrderStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::updateOrderStatus方法的具体用法?PHP Hook::updateOrderStatus怎么用?PHP Hook::updateOrderStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::updateOrderStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changeIdOrderState
public function changeIdOrderState($new_order_state = NULL, $id_order)
{
if ($new_order_state != NULL) {
Hook::updateOrderStatus(intval($new_order_state), intval($id_order));
/* Best sellers */
$newOS = new OrderState(intval($new_order_state));
$oldOrderStatus = OrderHistory::getLastOrderState(intval($id_order));
$cart = Cart::getCartByOrderId($id_order);
$isValidated = $this->isValidated();
if (Validate::isLoadedObject($cart)) {
foreach ($cart->getProducts() as $product) {
/* If becoming logable => adding sale */
if ($newOS->logable and (!$oldOrderStatus or !$oldOrderStatus->logable)) {
ProductSale::addProductSale($product['id_product'], $product['cart_quantity']);
} elseif (!$newOS->logable and ($oldOrderStatus and $oldOrderStatus->logable)) {
ProductSale::removeProductSale($product['id_product'], $product['cart_quantity']);
}
if (!$isValidated and $newOS->logable and isset($oldOrderStatus) and $oldOrderStatus and $oldOrderStatus->id == _PS_OS_ERROR_) {
Product::updateQuantity($product);
Hook::updateQuantity($product, $order);
}
}
}
$this->id_order_state = intval($new_order_state);
/* Change invoice number of order ? */
$newOS = new OrderState(intval($new_order_state));
$order = new Order(intval($id_order));
if (!Validate::isLoadedObject($newOS) or !Validate::isLoadedObject($order)) {
die(Tools::displayError('Invalid new order state'));
}
/* The order is valid only if the invoice is available and the order is not cancelled */
$order->valid = $newOS->logable;
$order->update();
if ($newOS->invoice and !$order->invoice_number) {
$order->setInvoice();
}
if ($newOS->delivery and !$order->delivery_number) {
$order->setDelivery();
}
Hook::postUpdateOrderStatus(intval($new_order_state), intval($id_order));
}
}