本文整理汇总了PHP中Customization::getOrderedCustomizations方法的典型用法代码示例。如果您正苦于以下问题:PHP Customization::getOrderedCustomizations方法的具体用法?PHP Customization::getOrderedCustomizations怎么用?PHP Customization::getOrderedCustomizations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customization
的用法示例。
在下文中一共展示了Customization::getOrderedCustomizations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkEnoughProduct
public function checkEnoughProduct($order_detail_list, $product_qty_list, $customization_ids, $customization_qty_input)
{
$order = new Order((int) $this->id_order);
if (!Validate::isLoadedObject($order)) {
die(Tools::displayError());
}
$products = $order->getProducts();
/* Products already returned */
$order_return = OrderReturn::getOrdersReturn($order->id_customer, $order->id, true);
foreach ($order_return as $or) {
$order_return_products = OrderReturn::getOrdersReturnProducts($or['id_order_return'], $order);
foreach ($order_return_products as $key => $orp) {
$products[$key]['product_quantity'] -= (int) $orp['product_quantity'];
}
}
/* Quantity check */
if ($order_detail_list) {
foreach (array_keys($order_detail_list) as $key) {
if ($qty = (int) $product_qty_list[$key]) {
if ($products[$key]['product_quantity'] - $qty < 0) {
return false;
}
}
}
}
/* Customization quantity check */
if ($customization_ids) {
$ordered_customizations = Customization::getOrderedCustomizations((int) $order->id_cart);
foreach ($customization_ids as $customizations) {
foreach ($customizations as $customization_id) {
$customization_id = (int) $customization_id;
if (!isset($ordered_customizations[$customization_id])) {
return false;
}
$quantity = isset($customization_qty_input[$customization_id]) ? (int) $customization_qty_input[$customization_id] : 0;
if ((int) $ordered_customizations[$customization_id]['quantity'] - $quantity < 0) {
return false;
}
}
}
}
return true;
}
示例2: checkEnoughProduct
public function checkEnoughProduct($orderDetailList, $productQtyList, $customizationIds, $customizationQtyInput)
{
$order = new Order(intval($this->id_order));
if (!Validate::isLoadedObject($order)) {
die(Tools::displayError());
}
$products = $order->getProducts();
/* Products already returned */
$order_return = self::getOrdersReturn($order->id_customer, $order->id, true);
foreach ($order_return as $or) {
$order_return_products = self::getOrdersReturnProducts($or['id_order_return'], $order);
foreach ($order_return_products as $key => $orp) {
$products[$key]['product_quantity'] -= intval($orp['product_quantity']);
}
}
/* Quantity check */
if ($orderDetailList) {
foreach ($orderDetailList as $key => $orderDetail) {
if ($qty = intval($productQtyList[$key])) {
if ($products[$key]['product_quantity'] - $qty < 0) {
return false;
}
}
}
}
/* Customization quantity check */
if ($customizationIds) {
$orderedCustomizations = Customization::getOrderedCustomizations(intval($order->id_cart));
foreach ($customizationIds as $productId => $customizations) {
foreach ($customizations as $customizationId) {
$customizationId = intval($customizationId);
if (!isset($orderedCustomizations[$customizationId])) {
return false;
}
$quantity = (isset($returnedCustomizations[$customizationId]) ? $returnedCustomizations[$customizationId]['product_quantity'] : 0) + (isset($customizationQtyInput[$customizationId]) ? intval($customizationQtyInput[$customizationId]) : 0);
if (intval($orderedCustomizations[$customizationId]['quantity']) - $quantity < 0) {
return false;
}
}
}
}
return true;
}