添加订单和产品hook
This commit is contained in:
parent
6eeeea11cc
commit
65c65a11fb
|
|
@ -69,7 +69,7 @@ class OrderController extends Controller
|
|||
public function show(Request $request, Order $order)
|
||||
{
|
||||
$order->load(['orderTotals', 'orderHistories', 'orderShipments']);
|
||||
$data = hook_filter('admin_order_detail', ['order' => $order, 'html_items' => []]);
|
||||
$data = hook_filter('admin.order.show.data', ['order' => $order, 'html_items' => []]);
|
||||
$data['statuses'] = StateMachineService::getInstance($order)->nextBackendStatuses();
|
||||
|
||||
return view('admin::pages.orders.form', $data);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ class ProductRepo
|
|||
}
|
||||
$product->load('description', 'skus', 'masterSku', 'brand', 'relations');
|
||||
|
||||
hook_filter('repo.product.get_detail', $product);
|
||||
|
||||
return $product;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ class OrderController extends Controller
|
|||
{
|
||||
$customer = current_customer();
|
||||
$order = OrderRepo::getOrderByNumber($number, $customer);
|
||||
$html = hook_filter('account_order_detail', ['order' => $order, 'html_items' => []]);
|
||||
$data = hook_filter('account.order.show.data', ['order' => $order, 'html_items' => []]);
|
||||
|
||||
return view('account/order_info', $html);
|
||||
return view('account/order_info', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ class ProductController extends Controller
|
|||
'product' => (new ProductDetail($product))->jsonSerialize(),
|
||||
'relations' => ProductRepo::getProductsByIds($relationIds)->jsonSerialize(),
|
||||
];
|
||||
$data = hook_filter('product.show', $data);
|
||||
|
||||
$data = hook_filter('product.show.data', $data);
|
||||
|
||||
return view('product', $data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,11 +111,12 @@ class CheckoutService
|
|||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$order = OrderRepo::create($checkoutData);
|
||||
StateMachineService::getInstance($order)->changeStatus(StateMachineService::UNPAID, '', true);
|
||||
CartRepo::clearSelectedCartProducts($customer);
|
||||
|
||||
hook_action('checkout.order.confirm.after', ['order' => $order, 'cart' => $this->cart]);
|
||||
hook_action('service.checkout.confirm.after', ['order' => $order, 'cart' => $this->cart]);
|
||||
|
||||
DB::commit();
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue