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


PHP EnmasseHelper::orderItemRefunded方法代码示例

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


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

示例1: save

 function save()
 {
     $status = JRequest::getVar('status', '', 'post');
     $partial = JRequest::getVar('partial', 0, 'method', 'int');
     $orderData = new JObject();
     $orderData->id = JRequest::getInt('id', '', 'post');
     $orderData->description = JRequest::getVar('description', '', 'post', 'text', JREQUEST_ALLOWRAW);
     //
     $orderData->buyerid = JRequest::getInt('buyerid', '', 'post');
     $model = JModel::getInstance('order', 'enmasseModel');
     if (empty($status)) {
         if ($model->store($orderData)) {
             $msg = JText::_('SAVE_SUCCESS_MSG');
             if ($partial) {
                 $this->setRedirect('index.php?option=com_enmasse&controller=partialOrder', $msg);
             } else {
                 $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller'), $msg);
             }
         } else {
             $msg = JText::_('SAVE_ERROR_MSG') . ": " . $model->getError();
             if ($orderData->id == null) {
                 $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller') . '&task=add', $msg, 'error');
             } else {
                 $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller') . '&task=edit&cid[0]=' . $orderData->id . '&partial=' . $partial, $msg, 'error');
             }
         }
     } else {
         //------------------------------
         //  send email and update total sold qty for each case of when change status of order
         if ($status == EnmasseHelper::$ORDER_STATUS_LIST["Paid"]) {
             EnmasseHelper::doNotify($orderData->id);
             $msg = JTEXT::_('SAVE_SUCCESS_MSG_AND_SEND_RECEIPT');
         } else {
             if ($status == EnmasseHelper::$ORDER_STATUS_LIST["Cancelled"]) {
                 $orderId = $orderData->id;
                 $order = JModel::getInstance('order', 'enmasseModel')->getById($orderId);
                 JModel::getInstance('order', 'enmasseModel')->updateStatus($order->id, 'Cancelled');
                 $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($orderId);
                 for ($count = 0; $count < count($orderItemList); $count++) {
                     $orderItem = $orderItemList[$count];
                     JModel::getInstance('orderItem', 'enmasseModel')->updateStatus($orderItem->id, 'Unpaid');
                     JModel::getInstance('invty', 'enmasseModel')->freeCouponByOrderItemId($orderItem->id, 'Free');
                 }
                 $msg = JTEXT::_('SAVE_SUCCESS_MSG');
             } else {
                 if ($status == EnmasseHelper::$ORDER_STATUS_LIST["Waiting_For_Refund"]) {
                     $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($orderData->id);
                     foreach ($orderItemList as $orderItem) {
                         EnmasseHelper::orderItemWaitingForRefund($orderItem);
                         sleep(1);
                     }
                     $msg = JTEXT::_('SAVE_SUCCESS_MSG_AND_SEND_REFUND');
                 } else {
                     if ($status == EnmasseHelper::$ORDER_STATUS_LIST["Refunded"]) {
                         $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($orderData->id);
                         foreach ($orderItemList as $orderItem) {
                             // reduce deal quality sold
                             // only reduce when order item was delivered
                             $isDelivered = intVal($orderItem->is_delivered);
                             if ($isDelivered) {
                                 JModel::getInstance('deal', 'enmasseModel')->reduceQtySold($orderItem->pdt_id, $orderItem->qty);
                             }
                             EnmasseHelper::orderItemRefunded($orderItem);
                             sleep(1);
                         }
                         $msg = JTEXT::_('SAVE_SUCCESS_MSG');
                     } else {
                         if ($status == 'Delivered') {
                             $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($orderData->id);
                             //update paid_amount of coupon to 100%
                             $model->updateToFullPaid($orderData->id);
                             JModel::getInstance("orderDeliverer", 'EnmasseModel')->updateStatus($orderData->id, "Delivered");
                             foreach ($orderItemList as $orderItem) {
                                 // update deal quality sold
                                 JModel::getInstance('deal', 'enmasseModel')->addQtySold($orderItem->pdt_id, $orderItem->qty);
                                 EnmasseHelper::orderItemDelivered($orderItem);
                                 sleep(1);
                             }
                             $msg = JTEXT::_('SAVE_SUCCESS_MSG_AND_SEND_DELIVERY');
                         }
                     }
                 }
             }
         }
         if ($partial) {
             $this->setRedirect('index.php?option=com_enmasse&controller=partialOrder', $msg);
         } else {
             $this->setRedirect('index.php?option=com_enmasse&controller=order', $msg);
         }
     }
 }
开发者ID:marsa1985,项目名称:kazabiz,代码行数:91,代码来源:order.php


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