| @@ 470-512 (lines=43) @@ | ||
| 467 | /** |
|
| 468 | * お届け先変更がクリックされた場合の処理 |
|
| 469 | */ |
|
| 470 | public function shippingChange(Application $app, Request $request, $id) |
|
| 471 | { |
|
| 472 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 473 | if (!$Order) { |
|
| 474 | $app->addError('front.shopping.order.error'); |
|
| 475 | return $app->redirect($app->url('shopping_error')); |
|
| 476 | } |
|
| 477 | ||
| 478 | if ('POST' !== $request->getMethod()) { |
|
| 479 | return $app->redirect($app->url('shopping')); |
|
| 480 | } |
|
| 481 | ||
| 482 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 483 | ||
| 484 | $event = new EventArgs( |
|
| 485 | array( |
|
| 486 | 'builder' => $builder, |
|
| 487 | 'Order' => $Order, |
|
| 488 | ), |
|
| 489 | $request |
|
| 490 | ); |
|
| 491 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_CHANGE_INITIALIZE, $event); |
|
| 492 | ||
| 493 | $form = $builder->getForm(); |
|
| 494 | ||
| 495 | $form->handleRequest($request); |
|
| 496 | ||
| 497 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 498 | $data = $form->getData(); |
|
| 499 | $message = $data['message']; |
|
| 500 | $Order->setMessage($message); |
|
| 501 | // 受注情報を更新 |
|
| 502 | $app['orm.em']->flush(); |
|
| 503 | ||
| 504 | // お届け先設定一覧へリダイレクト |
|
| 505 | return $app->redirect($app->url('shopping_shipping', array('id' => $id))); |
|
| 506 | } |
|
| 507 | ||
| 508 | return $app->render('Shopping/index.twig', array( |
|
| 509 | 'form' => $form->createView(), |
|
| 510 | 'Order' => $Order, |
|
| 511 | )); |
|
| 512 | } |
|
| 513 | ||
| 514 | /** |
|
| 515 | * お届け先の設定一覧からの選択 |
|
| @@ 599-641 (lines=43) @@ | ||
| 596 | /** |
|
| 597 | * お届け先の設定(非会員)がクリックされた場合の処理 |
|
| 598 | */ |
|
| 599 | public function shippingEditChange(Application $app, Request $request, $id) |
|
| 600 | { |
|
| 601 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 602 | if (!$Order) { |
|
| 603 | $app->addError('front.shopping.order.error'); |
|
| 604 | return $app->redirect($app->url('shopping_error')); |
|
| 605 | } |
|
| 606 | ||
| 607 | if ('POST' !== $request->getMethod()) { |
|
| 608 | return $app->redirect($app->url('shopping')); |
|
| 609 | } |
|
| 610 | ||
| 611 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 612 | ||
| 613 | $event = new EventArgs( |
|
| 614 | array( |
|
| 615 | 'builder' => $builder, |
|
| 616 | 'Order' => $Order, |
|
| 617 | ), |
|
| 618 | $request |
|
| 619 | ); |
|
| 620 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_EDIT_CHANGE_INITIALIZE, $event); |
|
| 621 | ||
| 622 | $form = $builder->getForm(); |
|
| 623 | ||
| 624 | $form->handleRequest($request); |
|
| 625 | ||
| 626 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 627 | $data = $form->getData(); |
|
| 628 | $message = $data['message']; |
|
| 629 | $Order->setMessage($message); |
|
| 630 | // 受注情報を更新 |
|
| 631 | $app['orm.em']->flush(); |
|
| 632 | ||
| 633 | // お届け先設定一覧へリダイレクト |
|
| 634 | return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id))); |
|
| 635 | } |
|
| 636 | ||
| 637 | return $app->render('Shopping/index.twig', array( |
|
| 638 | 'form' => $form->createView(), |
|
| 639 | 'Order' => $Order, |
|
| 640 | )); |
|
| 641 | } |
|
| 642 | ||
| 643 | /** |
|
| 644 | * お届け先の設定(非会員でも使用する) |
|
| @@ 981-1023 (lines=43) @@ | ||
| 978 | /** |
|
| 979 | * 複数配送処理がクリックされた場合の処理 |
|
| 980 | */ |
|
| 981 | public function shippingMultipleChange(Application $app, Request $request) |
|
| 982 | { |
|
| 983 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 984 | if (!$Order) { |
|
| 985 | $app->addError('front.shopping.order.error'); |
|
| 986 | return $app->redirect($app->url('shopping_error')); |
|
| 987 | } |
|
| 988 | ||
| 989 | if ('POST' !== $request->getMethod()) { |
|
| 990 | return $app->redirect($app->url('shopping')); |
|
| 991 | } |
|
| 992 | ||
| 993 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 994 | ||
| 995 | $event = new EventArgs( |
|
| 996 | array( |
|
| 997 | 'builder' => $builder, |
|
| 998 | 'Order' => $Order, |
|
| 999 | ), |
|
| 1000 | $request |
|
| 1001 | ); |
|
| 1002 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_MULTIPLE_CHANGE_INITIALIZE, $event); |
|
| 1003 | ||
| 1004 | $form = $builder->getForm(); |
|
| 1005 | ||
| 1006 | $form->handleRequest($request); |
|
| 1007 | ||
| 1008 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 1009 | $data = $form->getData(); |
|
| 1010 | $message = $data['message']; |
|
| 1011 | $Order->setMessage($message); |
|
| 1012 | // 受注情報を更新 |
|
| 1013 | $app['orm.em']->flush(); |
|
| 1014 | ||
| 1015 | // 複数配送設定へリダイレクト |
|
| 1016 | return $app->redirect($app->url('shopping_shipping_multiple')); |
|
| 1017 | } |
|
| 1018 | ||
| 1019 | return $app->render('Shopping/index.twig', array( |
|
| 1020 | 'form' => $form->createView(), |
|
| 1021 | 'Order' => $Order, |
|
| 1022 | )); |
|
| 1023 | } |
|
| 1024 | ||
| 1025 | ||
| 1026 | /** |
|