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


PHP OrderItem::isStockStatusHandleByDepot方法代码示例

本文整理汇总了PHP中OrderItem::isStockStatusHandleByDepot方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderItem::isStockStatusHandleByDepot方法的具体用法?PHP OrderItem::isStockStatusHandleByDepot怎么用?PHP OrderItem::isStockStatusHandleByDepot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OrderItem的用法示例。


在下文中一共展示了OrderItem::isStockStatusHandleByDepot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createPromisedDeliveryDate

 /**
  * Check if we need to create promised delivery date (pdd) for this order
  * if yes, calculate and save it, then send to customer
  * @return boolean True if PDD is needed and successfully created
  */
 public function createPromisedDeliveryDate()
 {
     $pdd_created = false;
     //ONLY FOR ORDER WITH A VALID EMAIL ADDRESS AND PRODUCTS
     if ($this->customer_email_is_valid && $this->items_notcanceled_total > 0) {
         $order_use_depot_stock = true;
         $ids = $this->getIDItemsNotCanceled();
         foreach ($ids as $item_id) {
             $i = $this->getItem($item_id);
             if (!OrderItem::isStockStatusHandleByDepot($i->stock_status)) {
                 $order_use_depot_stock = false;
                 break;
             }
         }
         $config = load_config('open-orders');
         $delivery_dates = $this->getPromisedDeliveryDate();
         $delivery_dates_total = count($delivery_dates);
         $pdd_start = null;
         $pdd_buffer = null;
         $pdd_exist = false;
         if ($delivery_dates_total > 0) {
             //PDD already exist, use delay mode
             //But only for MTO order
             $pdd_exist = true;
             if (!$order_use_depot_stock) {
                 $pdd_start = $config['promised-delivery-date-mto-delay'];
                 $pdd_buffer = $config['promised-delivery-date-mto-buffer'];
             }
         } else {
             //PDD not exist yet, use normal mode
             if ($order_use_depot_stock) {
                 $pdd_start = $config['promised-delivery-date-dso'];
                 $pdd_buffer = $config['promised-delivery-date-dso-buffer'];
             } else {
                 $pdd_start = $config['promised-delivery-date-mto'];
                 $pdd_buffer = $config['promised-delivery-date-mto-buffer'];
             }
         }
         if (!is_null($pdd_start) && !is_null($pdd_buffer)) {
             //Exclude weekend from promised delivery date - start
             $pdd_start_day = date('N', strtotime("+{$pdd_start} days"));
             $skip_weekend_day = 0;
             if ($pdd_start_day == 6) {
                 $skip_weekend_day = 2;
             } elseif ($pdd_start_day == 7) {
                 $skip_weekend_day = 1;
             }
             $pdd_start += $skip_weekend_day;
             //Exclude weekend from promised delivery date - end
             $pdd_end = $pdd_start + $pdd_buffer;
             $pdd_start_string = " +{$pdd_start} days";
             $pdd_end_string = " +{$pdd_end} days";
             $sda = array();
             $sda['order_type'] = $this->order_type;
             $sda['order_id'] = $this->order_id;
             $sda['create_time'] = date('Y-m-d H:i:s');
             $sda['use_depot_stock'] = $order_use_depot_stock ? '1' : '0';
             $sda['pdd_start'] = date('Y-m-d', strtotime($pdd_start_string));
             $sda['pdd_end'] = date('Y-m-d', strtotime($pdd_end_string));
             tep_db_perform('promised_delivery_date', $sda);
             if ($pdd_exist) {
                 $this->sendDelayNotification($pdd_start_string, $pdd_end_string);
             } else {
                 $this->sendPromisedDeliveryDate($pdd_start_string, $pdd_end_string);
             }
             $pdd_created = true;
         }
     }
     return $pdd_created;
 }
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:75,代码来源:Order.php


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