当前位置: 首页>>代码示例>>PHP>>正文


PHP Customization::getOrderedCustomizations方法代码示例

本文整理汇总了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;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:43,代码来源:OrderReturn.php

示例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;
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:43,代码来源:OrderReturn.php


注:本文中的Customization::getOrderedCustomizations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。