本文整理汇总了PHP中Hook::updateQuantity方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::updateQuantity方法的具体用法?PHP Hook::updateQuantity怎么用?PHP Hook::updateQuantity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::updateQuantity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
示例2: addStockMvt
public function addStockMvt($quantity, $id_reason, $id_product_attribute = null, $id_order = null, $id_employee = null)
{
$stockMvt = new StockMvt();
$stockMvt->id_product = (int) $this->id;
$stockMvt->id_product_attribute = (int) $id_product_attribute;
$stockMvt->id_order = (int) $id_order;
$stockMvt->id_employee = (int) $id_employee;
$stockMvt->quantity = (int) $quantity;
$stockMvt->id_stock_mvt_reason = (int) $id_reason;
// adding stock mouvement, this action update the sotck of product in database only
if ($stockMvt->add()) {
// update quantity in object after adding the stock movement
$this->quantity = $this->getStockAvailable();
Hook::updateQuantity($this, null);
return true;
}
return false;
}
示例3: addStockMvt
public function addStockMvt($quantity, $id_reason, $id_product_attribute = NULL, $id_order = NULL, $id_employee = NULL)
{
$stockMvt = new StockMvt();
$stockMvt->id_product = (int) $this->id;
$stockMvt->id_product_attribute = (int) $id_product_attribute;
$stockMvt->id_order = (int) $id_order;
$stockMvt->id_employee = (int) $id_employee;
$stockMvt->quantity = (int) $quantity;
$stockMvt->id_stock_mvt_reason = (int) $id_reason;
$result = $stockMvt->add();
$last_quantity = $this->quantity;
// Increase or decrease current product quantity value
if ($id_reason == 1) {
$this->quantity += abs($quantity);
} else {
if ($id_reason == 2) {
$this->quantity -= abs($quantity);
}
}
Hook::updateQuantity($this, null);
//reindex the updated product
if ($this->quantity < 1 || $last_quantity < 1 && $this->quantity > 0) {
SolrSearch::updateProduct($this->id);
}
return $result;
}
示例4: validateOrder
/**
* Validate an order in database
* Function called from a payment module
*
* @param integer $id_cart Value
* @param integer $id_order_state Value
* @param float $amountPaid Amount really paid by customer (in the default currency)
* @param string $paymentMethod Payment method (eg. 'Credit cart')
* @param string $message Message to attach to order
*/
function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false)
{
global $cart;
$cart = new Cart(intval($id_cart));
// Does order already exists ?
if (Validate::isLoadedObject($cart) and $cart->OrderExists() === 0) {
// Copying data from cart
$order = new Order();
$order->id_carrier = intval($cart->id_carrier);
$order->id_customer = intval($cart->id_customer);
$order->id_address_invoice = intval($cart->id_address_invoice);
$order->id_address_delivery = intval($cart->id_address_delivery);
$vat_address = new Address(intval($order->id_address_delivery));
$id_zone = Address::getZoneById(intval($vat_address->id));
$order->id_currency = $currency_special ? intval($currency_special) : intval($cart->id_currency);
$order->id_lang = intval($cart->id_lang);
$order->id_cart = intval($cart->id);
$customer = new Customer(intval($order->id_customer));
$order->secure_key = pSQL($customer->secure_key);
$order->payment = Tools::substr($paymentMethod, 0, 32);
if (isset($this->name)) {
$order->module = $this->name;
}
$order->recyclable = $cart->recyclable;
$order->gift = intval($cart->gift);
$order->gift_message = $cart->gift_message;
$currency = new Currency($order->id_currency);
$amountPaid = !$dont_touch_amount ? Tools::ps_round(floatval($amountPaid), 2) : $amountPaid;
$order->total_paid_real = $amountPaid;
$order->total_products = floatval($cart->getOrderTotal(false, 1));
$order->total_products_wt = floatval($cart->getOrderTotal(true, 1));
$order->total_discounts = floatval(abs($cart->getOrderTotal(true, 2)));
$order->total_shipping = floatval($cart->getOrderShippingCost());
$order->total_wrapping = floatval(abs($cart->getOrderTotal(true, 6)));
$order->total_paid = floatval(Tools::ps_round(floatval($cart->getOrderTotal(true, 3)), 2));
$order->invoice_date = '0000-00-00 00:00:00';
$order->delivery_date = '0000-00-00 00:00:00';
// Amount paid by customer is not the right one -> Status = payment error
if ($order->total_paid != $order->total_paid_real) {
$id_order_state = _PS_OS_ERROR_;
}
// Creating order
if ($cart->OrderExists() === 0) {
$result = $order->add();
} else {
die(Tools::displayError('An order has already been placed using this cart'));
}
// Next !
if ($result and isset($order->id)) {
// Optional message to attach to this order
if (isset($message) and !empty($message)) {
$msg = new Message();
$message = strip_tags($message, '<br>');
if (!Validate::isCleanHtml($message)) {
$message = $this->l('Payment message is not valid, please check your module!');
}
$msg->message = $message;
$msg->id_order = intval($order->id);
$msg->private = 1;
$msg->add();
}
// Insert products from cart into order_detail table
$products = $cart->getProducts();
$productsList = '';
$db = Db::getInstance();
$query = 'INSERT INTO `' . _DB_PREFIX_ . 'order_detail`
(`id_order`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_in_stock`, `product_price`, `reduction_percent`, `reduction_amount`, `product_quantity_discount`, `product_ean13`, `product_reference`, `product_supplier_reference`, `product_weight`, `tax_name`, `tax_rate`, `ecotax`, `discount_quantity_applied`, `download_deadline`, `download_hash`)
VALUES ';
$customizedDatas = Product::getAllCustomizedDatas(intval($order->id_cart));
Product::addCustomizationPrice($products, $customizedDatas);
foreach ($products as $key => $product) {
$outOfStock = false;
$productQuantity = intval(Product::getQuantity(intval($product['id_product']), $product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL));
$quantityInStock = $productQuantity - intval($product['cart_quantity']) < 0 ? $productQuantity : intval($product['cart_quantity']);
if ($id_order_state != _PS_OS_CANCELED_ and $id_order_state != _PS_OS_ERROR_) {
if (($updateResult = Product::updateQuantity($product)) === false or $updateResult === -1) {
$outOfStock = true;
}
if (!$outOfStock) {
$product['stock_quantity'] -= $product['cart_quantity'];
}
Hook::updateQuantity($product, $order);
}
$price = Product::getPriceStatic(intval($product['id_product']), false, $product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL, 6, NULL, false, true, $product['cart_quantity'], false, intval($order->id_customer), intval($order->id_cart), intval($order->id_address_delivery));
$price_wt = Product::getPriceStatic(intval($product['id_product']), true, $product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL, 2, NULL, false, true, $product['cart_quantity'], false, intval($order->id_customer), intval($order->id_cart), intval($order->id_address_delivery));
// Add some informations for virtual products
$deadline = '0000-00-00 00:00:00';
$download_hash = NULL;
if ($id_product_download = ProductDownload::getIdFromIdProduct(intval($product['id_product']))) {
$productDownload = new ProductDownload(intval($id_product_download));
//.........这里部分代码省略.........
示例5: postProcess
//.........这里部分代码省略.........
if ($order_detail->product_quantity - $customization_quantity - $order_detail->product_quantity_refunded - $order_detail->product_quantity_return < $qtyCancelProduct) {
$this->_errors[] = Tools::displayError('Invalid quantity selected for product.');
}
}
}
if ($customizationList) {
$customization_quantities = Customization::retrieveQuantitiesFromIds(array_keys($customizationList));
foreach ($customizationList as $id_customization => $id_order_detail) {
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
$customization_quantity = $customization_quantities[$id_customization];
if (!$qtyCancelProduct) {
$this->_errors[] = Tools::displayError('No quantity selected for product.');
}
if ($qtyCancelProduct > $customization_quantity['quantity'] - ($customization_quantity['quantity_refunded'] + $customization_quantity['quantity_returned'])) {
$this->_errors[] = Tools::displayError('Invalid quantity selected for product.');
}
}
}
if (!sizeof($this->_errors) and $productList) {
foreach ($productList as $key => $id_order_detail) {
$qtyCancelProduct = abs($qtyList[$key]);
$orderDetail = new OrderDetail((int) $id_order_detail);
// Reinject product
if (!$order->hasBeenDelivered() or $order->hasBeenDelivered() and Tools::isSubmit('reinjectQuantities')) {
$reinjectableQuantity = (int) $orderDetail->product_quantity - (int) $orderDetail->product_quantity_reinjected;
$quantityToReinject = $qtyCancelProduct > $reinjectableQuantity ? $reinjectableQuantity : $qtyCancelProduct;
if (!Product::reinjectQuantities($orderDetail, $quantityToReinject)) {
$this->_errors[] = Tools::displayError('Cannot re-stock product') . ' <span class="bold">' . $orderDetail->product_name . '</span>';
} else {
$updProductAttributeID = !empty($orderDetail->product_attribute_id) ? (int) $orderDetail->product_attribute_id : NULL;
$newProductQty = Product::getQuantity((int) $orderDetail->product_id, $updProductAttributeID);
$product = get_object_vars(new Product((int) $orderDetail->product_id, false, (int) $cookie->id_lang));
if (!empty($orderDetail->product_attribute_id)) {
$updProduct['quantity_attribute'] = (int) $newProductQty;
$product['quantity_attribute'] = $updProduct['quantity_attribute'];
} else {
$updProduct['stock_quantity'] = (int) $newProductQty;
$product['stock_quantity'] = $updProduct['stock_quantity'];
}
Hook::updateQuantity($product, $order);
}
}
// Delete product
if (!$order->deleteProduct($order, $orderDetail, $qtyCancelProduct)) {
$this->_errors[] = Tools::displayError('An error occurred during deletion of the product.') . ' <span class="bold">' . $orderDetail->product_name . '</span>';
}
Module::hookExec('cancelProduct', array('order' => $order, 'id_order_detail' => $id_order_detail));
}
}
if (!sizeof($this->_errors) and $customizationList) {
foreach ($customizationList as $id_customization => $id_order_detail) {
$orderDetail = new OrderDetail((int) $id_order_detail);
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
if (!$order->deleteCustomization($id_customization, $qtyCancelProduct, $orderDetail)) {
$this->_errors[] = Tools::displayError('An error occurred during deletion of product customization.') . ' ' . $id_customization;
}
}
}
// E-mail params
if ((isset($_POST['generateCreditSlip']) or isset($_POST['generateDiscount'])) and !sizeof($this->_errors)) {
$customer = new Customer((int) $order->id_customer);
$params['{lastname}'] = $customer->lastname;
$params['{firstname}'] = $customer->firstname;
$params['{id_order}'] = $order->id;
}
// Generate credit slip
if (isset($_POST['generateCreditSlip']) and !sizeof($this->_errors)) {
if (!OrderSlip::createOrderSlip($order, $full_product_list, $full_quantity_list, isset($_POST['shippingBack']))) {
$this->_errors[] = Tools::displayError('Cannot generate credit slip');
} else {
Module::hookExec('orderSlip', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list));
@Mail::Send((int) $order->id_lang, 'credit_slip', Mail::l('New credit slip regarding your order', $order->id_lang), $params, $customer->email, $customer->firstname . ' ' . $customer->lastname, NULL, NULL, NULL, NULL, _PS_MAIL_DIR_, true);
}
}
// Generate voucher
if (isset($_POST['generateDiscount']) and !sizeof($this->_errors)) {
if (!($voucher = Discount::createOrderDiscount($order, $full_product_list, $full_quantity_list, $this->l('Credit Slip concerning the order #'), isset($_POST['shippingBack'])))) {
$this->_errors[] = Tools::displayError('Cannot generate voucher');
} else {
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);
$params['{voucher_num}'] = $voucher->name;
@Mail::Send((int) $order->id_lang, 'voucher', Mail::l('New voucher regarding your order'), $params, $customer->email, $customer->firstname . ' ' . $customer->lastname, NULL, NULL, NULL, NULL, _PS_MAIL_DIR_, true);
}
}
} else {
$this->_errors[] = Tools::displayError('No product or quantity selected.');
}
// Redirect if no errors
if (!sizeof($this->_errors)) {
Tools::redirectAdmin($currentIndex . '&id_order=' . $order->id . '&vieworder&conf=24&token=' . $this->token);
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} elseif (isset($_GET['messageReaded'])) {
Message::markAsReaded((int) $_GET['messageReaded'], (int) $cookie->id_employee);
}
parent::postProcess();
}
示例6: postProcess
//.........这里部分代码省略.........
$customization_quantities = Customization::retrieveQuantitiesFromIds(array_keys($customizationList));
foreach ($customizationList as $id_customization => $id_order_detail) {
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
$customization_quantity = $customization_quantities[$id_customization];
if (!$qtyCancelProduct) {
$this->_errors[] = Tools::displayError('No quantity selected for product.');
}
if ($qtyCancelProduct > $customization_quantity['quantity'] - ($customization_quantity['quantity_refunded'] + $customization_quantity['quantity_returned'])) {
$this->_errors[] = Tools::displayError('Invalid quantity selected for product.');
}
}
}
if (!sizeof($this->_errors) and $productList) {
foreach ($productList as $key => $id_order_detail) {
$qtyCancelProduct = abs($qtyList[$key]);
$orderDetail = new OrderDetail((int) $id_order_detail);
// Reinject product
if (!$order->hasBeenDelivered() or $order->hasBeenDelivered() and Tools::isSubmit('reinjectQuantities')) {
$reinjectableQuantity = (int) $orderDetail->product_quantity - (int) $orderDetail->product_quantity_reinjected;
$quantityToReinject = $qtyCancelProduct > $reinjectableQuantity ? $reinjectableQuantity : $qtyCancelProduct;
if (!Product::reinjectQuantities($orderDetail, $quantityToReinject)) {
$this->_errors[] = Tools::displayError('Cannot re-stock product') . ' <span class="bold">' . $orderDetail->product_name . '</span>';
} else {
$updProductAttributeID = !empty($orderDetail->product_attribute_id) ? (int) $orderDetail->product_attribute_id : NULL;
$newProductQty = Product::getQuantity((int) $orderDetail->product_id, $updProductAttributeID);
$product = get_object_vars(new Product((int) $orderDetail->product_id, false, (int) $cookie->id_lang));
if (!empty($orderDetail->product_attribute_id)) {
$updProduct['quantity_attribute'] = (int) $newProductQty;
$product['quantity_attribute'] = $updProduct['quantity_attribute'];
} else {
$updProduct['stock_quantity'] = (int) $newProductQty;
$product['stock_quantity'] = $updProduct['stock_quantity'];
}
Hook::updateQuantity($product, $order);
}
}
// Delete product
if (!$order->deleteProduct($order, $orderDetail, $qtyCancelProduct)) {
$this->_errors[] = Tools::displayError('An error occurred during deletion of the product.') . ' <span class="bold">' . $orderDetail->product_name . '</span>';
}
Module::hookExec('cancelProduct', array('order' => $order, 'id_order_detail' => $id_order_detail));
}
}
if (!sizeof($this->_errors) and $customizationList) {
foreach ($customizationList as $id_customization => $id_order_detail) {
$orderDetail = new OrderDetail((int) $id_order_detail);
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
if (!$order->deleteCustomization($id_customization, $qtyCancelProduct, $orderDetail)) {
$this->_errors[] = Tools::displayError('An error occurred during deletion of product customization.') . ' ' . $id_customization;
}
}
}
// E-mail params
if ((isset($_POST['generateCreditSlip']) or isset($_POST['generateDiscount'])) and !sizeof($this->_errors)) {
$customer = new Customer((int) $order->id_customer);
$params['{lastname}'] = $customer->lastname;
$params['{firstname}'] = $customer->firstname;
$params['{id_order}'] = $order->id;
}
// Generate credit slip
if (isset($_POST['generateCreditSlip']) and !sizeof($this->_errors)) {
if (!OrderSlip::createOrderSlip($order, $full_product_list, $full_quantity_list, isset($_POST['shippingBack']))) {
$this->_errors[] = Tools::displayError('Cannot generate credit slip');
} else {
Module::hookExec('orderSlip', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list));
@Mail::Send((int) $order->id_lang, 'credit_slip', Mail::l('New credit slip regarding your order'), $params, $customer->email, $customer->firstname . ' ' . $customer->lastname);
示例7: validateOrder
/**
* Validate an order in database
* Function called from a payment module
*
* @param integer $id_cart Value
* @param integer $id_order_state Value
* @param float $amountPaid Amount really paid by customer (in the default currency)
* @param string $paymentMethod Payment method (eg. 'Credit card')
* @param string $message Message to attach to order
*/
public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
{
global $cart;
$cart = new Cart((int) $id_cart);
// Does order already exists ?
if (Validate::isLoadedObject($cart) and $cart->OrderExists() === 0) {
if ($secure_key !== false and $secure_key != $cart->secure_key) {
die(Tools::displayError());
}
// Copying data from cart
$order = new Order();
$order->id_carrier = (int) $cart->id_carrier;
$order->id_customer = (int) $cart->id_customer;
$order->id_address_invoice = (int) $cart->id_address_invoice;
$order->id_address_delivery = (int) $cart->id_address_delivery;
$vat_address = new Address((int) $order->id_address_delivery);
$order->id_currency = $currency_special ? (int) $currency_special : (int) $cart->id_currency;
$order->id_lang = (int) $cart->id_lang;
$order->id_cart = (int) $cart->id;
$customer = new Customer((int) $order->id_customer);
$order->secure_key = $secure_key ? pSQL($secure_key) : pSQL($customer->secure_key);
$order->payment = Tools::substr($paymentMethod, 0, 32);
if (isset($this->name)) {
$order->module = $this->name;
}
$order->recyclable = $cart->recyclable;
$order->gift = (int) $cart->gift;
$order->gift_message = $cart->gift_message;
$currency = new Currency($order->id_currency);
$order->conversion_rate = $currency->conversion_rate;
$amountPaid = !$dont_touch_amount ? Tools::ps_round((double) $amountPaid, 2) : $amountPaid;
$order->total_paid_real = $amountPaid;
$order->total_products = (double) $cart->getOrderTotal(false, Cart::ONLY_PRODUCTS);
$order->total_products_wt = (double) $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS);
$order->total_discounts = (double) abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
$order->total_shipping = (double) $cart->getOrderShippingCost();
$order->carrier_tax_rate = (double) Tax::getCarrierTaxRate($cart->id_carrier, (int) $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$order->total_wrapping = (double) abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING));
$order->total_paid = (double) Tools::ps_round((double) $cart->getOrderTotal(true, Cart::BOTH), 2);
$order->invoice_date = '0000-00-00 00:00:00';
$order->delivery_date = '0000-00-00 00:00:00';
// Amount paid by customer is not the right one -> Status = payment error
if ($order->total_paid != $order->total_paid_real) {
$id_order_state = _PS_OS_ERROR_;
}
// Creating order
if ($cart->OrderExists() === 0) {
$result = $order->add();
} else {
$errorMessage = Tools::displayError('An order has already been placed using this cart.');
Logger::addLog($errorMessage, 4, '0000001', 'Cart', intval($order->id_cart));
die($errorMessage);
}
// Next !
if ($result and isset($order->id)) {
if (!$secure_key) {
$message .= $this->l('Warning : the secure key is empty, check your payment account before validation');
}
// Optional message to attach to this order
if (isset($message) and !empty($message)) {
$msg = new Message();
$message = strip_tags($message, '<br>');
if (!Validate::isCleanHtml($message)) {
$message = $this->l('Payment message is not valid, please check your module!');
}
$msg->message = $message;
$msg->id_order = (int) $order->id;
$msg->private = 1;
$msg->add();
}
// Insert products from cart into order_detail table
$products = $cart->getProducts();
$productsList = '';
$db = Db::getInstance();
$query = 'INSERT INTO `' . _DB_PREFIX_ . 'order_detail`
(`id_order`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_in_stock`, `product_price`, `reduction_percent`, `reduction_amount`, `group_reduction`, `product_quantity_discount`, `product_ean13`, `product_upc`, `product_reference`, `product_supplier_reference`, `product_weight`, `tax_name`, `tax_rate`, `ecotax`, `ecotax_tax_rate`, `discount_quantity_applied`, `download_deadline`, `download_hash`)
VALUES ';
$customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice($products, $customizedDatas);
$outOfStock = false;
foreach ($products as $key => $product) {
$productQuantity = (int) Product::getQuantity((int) $product['id_product'], $product['id_product_attribute'] ? (int) $product['id_product_attribute'] : NULL);
$quantityInStock = $productQuantity - (int) $product['cart_quantity'] < 0 ? $productQuantity : (int) $product['cart_quantity'];
if ($id_order_state != _PS_OS_CANCELED_ and $id_order_state != _PS_OS_ERROR_) {
if (Product::updateQuantity($product, (int) $order->id)) {
$product['stock_quantity'] -= $product['cart_quantity'];
}
if ($product['stock_quantity'] < 0 && Configuration::get('PS_STOCK_MANAGEMENT')) {
$outOfStock = true;
}
//.........这里部分代码省略.........