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