| @@ 506-548 (lines=43) @@ | ||
| 503 | /** |
|
| 504 | * お届け先変更がクリックされた場合の処理 |
|
| 505 | */ |
|
| 506 | public function shippingChange(Application $app, Request $request, $id) |
|
| 507 | { |
|
| 508 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 509 | if (!$Order) { |
|
| 510 | $app->addError('front.shopping.order.error'); |
|
| 511 | return $app->redirect($app->url('shopping_error')); |
|
| 512 | } |
|
| 513 | ||
| 514 | if ('POST' !== $request->getMethod()) { |
|
| 515 | return $app->redirect($app->url('shopping')); |
|
| 516 | } |
|
| 517 | ||
| 518 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 519 | ||
| 520 | $event = new EventArgs( |
|
| 521 | array( |
|
| 522 | 'builder' => $builder, |
|
| 523 | 'Order' => $Order, |
|
| 524 | ), |
|
| 525 | $request |
|
| 526 | ); |
|
| 527 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_CHANGE_INITIALIZE, $event); |
|
| 528 | ||
| 529 | $form = $builder->getForm(); |
|
| 530 | ||
| 531 | $form->handleRequest($request); |
|
| 532 | ||
| 533 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 534 | $data = $form->getData(); |
|
| 535 | $message = $data['message']; |
|
| 536 | $Order->setMessage($message); |
|
| 537 | // 受注情報を更新 |
|
| 538 | $app['orm.em']->flush(); |
|
| 539 | ||
| 540 | // お届け先設定一覧へリダイレクト |
|
| 541 | return $app->redirect($app->url('shopping_shipping', array('id' => $id))); |
|
| 542 | } |
|
| 543 | ||
| 544 | return $app->render('Shopping/index.twig', array( |
|
| 545 | 'form' => $form->createView(), |
|
| 546 | 'Order' => $Order, |
|
| 547 | )); |
|
| 548 | } |
|
| 549 | ||
| 550 | /** |
|
| 551 | * お届け先の設定一覧からの選択 |
|
| @@ 641-683 (lines=43) @@ | ||
| 638 | /** |
|
| 639 | * お届け先の設定(非会員)がクリックされた場合の処理 |
|
| 640 | */ |
|
| 641 | public function shippingEditChange(Application $app, Request $request, $id) |
|
| 642 | { |
|
| 643 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 644 | if (!$Order) { |
|
| 645 | $app->addError('front.shopping.order.error'); |
|
| 646 | return $app->redirect($app->url('shopping_error')); |
|
| 647 | } |
|
| 648 | ||
| 649 | if ('POST' !== $request->getMethod()) { |
|
| 650 | return $app->redirect($app->url('shopping')); |
|
| 651 | } |
|
| 652 | ||
| 653 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 654 | ||
| 655 | $event = new EventArgs( |
|
| 656 | array( |
|
| 657 | 'builder' => $builder, |
|
| 658 | 'Order' => $Order, |
|
| 659 | ), |
|
| 660 | $request |
|
| 661 | ); |
|
| 662 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_EDIT_CHANGE_INITIALIZE, $event); |
|
| 663 | ||
| 664 | $form = $builder->getForm(); |
|
| 665 | ||
| 666 | $form->handleRequest($request); |
|
| 667 | ||
| 668 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 669 | $data = $form->getData(); |
|
| 670 | $message = $data['message']; |
|
| 671 | $Order->setMessage($message); |
|
| 672 | // 受注情報を更新 |
|
| 673 | $app['orm.em']->flush(); |
|
| 674 | ||
| 675 | // お届け先設定一覧へリダイレクト |
|
| 676 | return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id))); |
|
| 677 | } |
|
| 678 | ||
| 679 | return $app->render('Shopping/index.twig', array( |
|
| 680 | 'form' => $form->createView(), |
|
| 681 | 'Order' => $Order, |
|
| 682 | )); |
|
| 683 | } |
|
| 684 | ||
| 685 | /** |
|
| 686 | * お届け先の設定(非会員でも使用する) |
|
| @@ 1048-1090 (lines=43) @@ | ||
| 1045 | /** |
|
| 1046 | * 複数配送処理がクリックされた場合の処理 |
|
| 1047 | */ |
|
| 1048 | public function shippingMultipleChange(Application $app, Request $request) |
|
| 1049 | { |
|
| 1050 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 1051 | if (!$Order) { |
|
| 1052 | $app->addError('front.shopping.order.error'); |
|
| 1053 | return $app->redirect($app->url('shopping_error')); |
|
| 1054 | } |
|
| 1055 | ||
| 1056 | if ('POST' !== $request->getMethod()) { |
|
| 1057 | return $app->redirect($app->url('shopping')); |
|
| 1058 | } |
|
| 1059 | ||
| 1060 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 1061 | ||
| 1062 | $event = new EventArgs( |
|
| 1063 | array( |
|
| 1064 | 'builder' => $builder, |
|
| 1065 | 'Order' => $Order, |
|
| 1066 | ), |
|
| 1067 | $request |
|
| 1068 | ); |
|
| 1069 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_MULTIPLE_CHANGE_INITIALIZE, $event); |
|
| 1070 | ||
| 1071 | $form = $builder->getForm(); |
|
| 1072 | ||
| 1073 | $form->handleRequest($request); |
|
| 1074 | ||
| 1075 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 1076 | $data = $form->getData(); |
|
| 1077 | $message = $data['message']; |
|
| 1078 | $Order->setMessage($message); |
|
| 1079 | // 受注情報を更新 |
|
| 1080 | $app['orm.em']->flush(); |
|
| 1081 | ||
| 1082 | // 複数配送設定へリダイレクト |
|
| 1083 | return $app->redirect($app->url('shopping_shipping_multiple')); |
|
| 1084 | } |
|
| 1085 | ||
| 1086 | return $app->render('Shopping/index.twig', array( |
|
| 1087 | 'form' => $form->createView(), |
|
| 1088 | 'Order' => $Order, |
|
| 1089 | )); |
|
| 1090 | } |
|
| 1091 | ||
| 1092 | ||
| 1093 | /** |
|