本文整理汇总了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;
}