| @@ 522-564 (lines=43) @@ | ||
| 519 | /** |
|
| 520 | * お届け先変更がクリックされた場合の処理 |
|
| 521 | */ |
|
| 522 | public function shippingChange(Application $app, Request $request, $id) |
|
| 523 | { |
|
| 524 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 525 | if (!$Order) { |
|
| 526 | $app->addError('front.shopping.order.error'); |
|
| 527 | ||
| 528 | return $app->redirect($app->url('shopping_error')); |
|
| 529 | } |
|
| 530 | ||
| 531 | if ('POST' !== $request->getMethod()) { |
|
| 532 | return $app->redirect($app->url('shopping')); |
|
| 533 | } |
|
| 534 | ||
| 535 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 536 | ||
| 537 | $event = new EventArgs( |
|
| 538 | array( |
|
| 539 | 'builder' => $builder, |
|
| 540 | 'Order' => $Order, |
|
| 541 | ), |
|
| 542 | $request |
|
| 543 | ); |
|
| 544 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_INDEX_INITIALIZE, $event); |
|
| 545 | ||
| 546 | $form = $builder->getForm(); |
|
| 547 | ||
| 548 | $form->handleRequest($request); |
|
| 549 | ||
| 550 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 551 | $data = $form->getData(); |
|
| 552 | $message = $data['message']; |
|
| 553 | $Order->setMessage($message); |
|
| 554 | // 受注情報を更新 |
|
| 555 | $app['orm.em']->flush(); |
|
| 556 | ||
| 557 | // お届け先設定一覧へリダイレクト |
|
| 558 | return $app->redirect($app->url('shopping_shipping', array('id' => $id))); |
|
| 559 | } |
|
| 560 | ||
| 561 | return $app->render( |
|
| 562 | 'Shopping/index.twig', |
|
| 563 | array( |
|
| 564 | 'form' => $form->createView(), |
|
| 565 | 'Order' => $Order, |
|
| 566 | ) |
|
| 567 | ); |
|
| @@ 654-696 (lines=43) @@ | ||
| 651 | /** |
|
| 652 | * お届け先の設定(非会員)がクリックされた場合の処理 |
|
| 653 | */ |
|
| 654 | public function shippingEditChange(Application $app, Request $request, $id) |
|
| 655 | { |
|
| 656 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 657 | if (!$Order) { |
|
| 658 | $app->addError('front.shopping.order.error'); |
|
| 659 | ||
| 660 | return $app->redirect($app->url('shopping_error')); |
|
| 661 | } |
|
| 662 | ||
| 663 | if ('POST' !== $request->getMethod()) { |
|
| 664 | return $app->redirect($app->url('shopping')); |
|
| 665 | } |
|
| 666 | ||
| 667 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 668 | ||
| 669 | $event = new EventArgs( |
|
| 670 | array( |
|
| 671 | 'builder' => $builder, |
|
| 672 | 'Order' => $Order, |
|
| 673 | ), |
|
| 674 | $request |
|
| 675 | ); |
|
| 676 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_INDEX_INITIALIZE, $event); |
|
| 677 | ||
| 678 | $form = $builder->getForm(); |
|
| 679 | ||
| 680 | $form->handleRequest($request); |
|
| 681 | ||
| 682 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 683 | $data = $form->getData(); |
|
| 684 | $message = $data['message']; |
|
| 685 | $Order->setMessage($message); |
|
| 686 | // 受注情報を更新 |
|
| 687 | $app['orm.em']->flush(); |
|
| 688 | ||
| 689 | // お届け先設定一覧へリダイレクト |
|
| 690 | return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id))); |
|
| 691 | } |
|
| 692 | ||
| 693 | return $app->render( |
|
| 694 | 'Shopping/index.twig', |
|
| 695 | array( |
|
| 696 | 'form' => $form->createView(), |
|
| 697 | 'Order' => $Order, |
|
| 698 | ) |
|
| 699 | ); |
|
| @@ 1060-1102 (lines=43) @@ | ||
| 1057 | /** |
|
| 1058 | * 複数配送処理がクリックされた場合の処理 |
|
| 1059 | */ |
|
| 1060 | public function shippingMultipleChange(Application $app, Request $request) |
|
| 1061 | { |
|
| 1062 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 1063 | if (!$Order) { |
|
| 1064 | $app->addError('front.shopping.order.error'); |
|
| 1065 | ||
| 1066 | return $app->redirect($app->url('shopping_error')); |
|
| 1067 | } |
|
| 1068 | ||
| 1069 | if ('POST' !== $request->getMethod()) { |
|
| 1070 | return $app->redirect($app->url('shopping')); |
|
| 1071 | } |
|
| 1072 | ||
| 1073 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 1074 | ||
| 1075 | $event = new EventArgs( |
|
| 1076 | array( |
|
| 1077 | 'builder' => $builder, |
|
| 1078 | 'Order' => $Order, |
|
| 1079 | ), |
|
| 1080 | $request |
|
| 1081 | ); |
|
| 1082 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_INDEX_INITIALIZE, $event); |
|
| 1083 | ||
| 1084 | $form = $builder->getForm(); |
|
| 1085 | ||
| 1086 | $form->handleRequest($request); |
|
| 1087 | ||
| 1088 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 1089 | $data = $form->getData(); |
|
| 1090 | $message = $data['message']; |
|
| 1091 | $Order->setMessage($message); |
|
| 1092 | // 受注情報を更新 |
|
| 1093 | $app['orm.em']->flush(); |
|
| 1094 | ||
| 1095 | // 複数配送設定へリダイレクト |
|
| 1096 | return $app->redirect($app->url('shopping_shipping_multiple')); |
|
| 1097 | } |
|
| 1098 | ||
| 1099 | return $app->render( |
|
| 1100 | 'Shopping/index.twig', |
|
| 1101 | array( |
|
| 1102 | 'form' => $form->createView(), |
|
| 1103 | 'Order' => $Order, |
|
| 1104 | ) |
|
| 1105 | ); |
|