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


PHP OrderHistory::saveLog方法代码示例

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


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

示例1: updateAddress

 /**
  * @role update
  */
 public function updateAddress()
 {
     $validator = $this->createUserAddressFormValidator();
     if ($validator->isValid()) {
         $order = CustomerOrder::getInstanceByID((int) $this->request->get('orderID'), true, array('ShippingAddress' => 'UserAddress', 'BillingAddress' => 'UserAddress', 'State'));
         $address = UserAddress::getInstanceByID('UserAddress', (int) $this->request->get('ID'), true, array('State'));
         $history = new OrderHistory($order, $this->user);
         $address->loadRequestData($this->request);
         $address->save();
         $history->saveLog();
         if (!$this->request->get('ID')) {
             if (!$order->billingAddress->get()) {
                 $order->billingAddress->set($address);
             }
             if (!$order->shippingAddress->get()) {
                 $order->shippingAddress->set($address);
             }
             $order->save();
         }
         return new JSONResponse(array('address' => $address->toArray()), 'success', $this->translate('_order_address_was_successfully_updated'));
     } else {
         return new JSONResponse(array('errors' => $validator->getErrorList()), 'failure', $this->translate('_error_updating_order_address'));
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:27,代码来源:CustomerOrderController.php

示例2: delete

 /**
  * @role update
  */
 public function delete()
 {
     $shipment = Shipment::getInstanceByID('Shipment', (int) $this->request->get('id'), true, array('Order' => 'CustomerOrder'));
     $shipment->order->get()->loadAll();
     $history = new OrderHistory($shipment->order->get(), $this->user);
     $shipment->delete();
     $shipment->order->get()->updateStatusFromShipments();
     $shipment->order->get()->save();
     $history->saveLog();
     return new JSONResponse(array('deleted' => true), 'success');
 }
开发者ID:saiber,项目名称:www,代码行数:14,代码来源:ShipmentController.php

示例3: changeCount

 public function changeCount()
 {
     if ($id = (int) $this->request->get("id", false)) {
         $count = (int) $this->request->get("count");
         $price = (double) $this->request->get("price");
         $item = OrderedItem::getInstanceByID('OrderedItem', $id, true, array('Shipment', 'Order' => 'CustomerOrder', 'ShippingService', 'Currency', 'ShippingAddress' => 'UserAddress', 'Product', 'Category'));
         $item->customerOrder->get()->loadAll();
         $history = new OrderHistory($item->customerOrder->get(), $this->user);
         $item->count->set($count);
         if ($item->price->get() != $price) {
             $item->price->set($item->getCurrency()->round($item->reduceBaseTaxes($price)));
         }
         $shipment = $item->shipment->get();
         $shipment->loadItems();
         if ($shipment->getShippingService()) {
             $shipmentRates = $shipment->getDeliveryZone()->getShippingRates($shipment);
             $shipment->setAvailableRates($shipmentRates);
             $shipment->setRateId($shipment->getShippingService()->getID());
         }
         $shipment->recalculateAmounts();
         $item->customerOrder->get()->save(true);
         $item->save();
         $shipment->save();
         $history->saveLog();
         return new JSONResponse(array('ID' => $item->getID(), 'Shipment' => array('ID' => $shipment->getID(), 'Order' => $item->customerOrder->get()->toFlatArray(), 'isDeleted' => $item->isDeleted(), 'amount' => $shipment->amount->get(), 'downloadable' => !$shipment->isShippable(), 'shippingAmount' => $shipment->shippingAmount->get(), 'total' => (double) $shipment->shippingAmount->get() + (double) $shipment->amount->get() + (double) $shipment->taxAmount->get(), 'taxAmount' => $shipment->taxAmount->get(), 'prefix' => $shipment->getCurrency()->pricePrefix->get(), 'suffix' => $shipment->getCurrency()->priceSuffix->get())), 'success');
     } else {
         return new JSONResponse(false, 'failure', $this->translate('_error_updating_item_quantity'));
     }
 }
开发者ID:GregerA,项目名称:livecart,代码行数:29,代码来源:OrderedItemController.php


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