| @@ 494-536 (lines=43) @@ | ||
| 491 | /** |
|
| 492 | * お届け先変更がクリックされた場合の処理 |
|
| 493 | */ |
|
| 494 | public function shippingChange(Application $app, Request $request, $id) |
|
| 495 | { |
|
| 496 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 497 | if (!$Order) { |
|
| 498 | $app->addError('front.shopping.order.error'); |
|
| 499 | return $app->redirect($app->url('shopping_error')); |
|
| 500 | } |
|
| 501 | ||
| 502 | if ('POST' !== $request->getMethod()) { |
|
| 503 | return $app->redirect($app->url('shopping')); |
|
| 504 | } |
|
| 505 | ||
| 506 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 507 | ||
| 508 | $event = new EventArgs( |
|
| 509 | array( |
|
| 510 | 'builder' => $builder, |
|
| 511 | 'Order' => $Order, |
|
| 512 | ), |
|
| 513 | $request |
|
| 514 | ); |
|
| 515 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_INDEX_INITIALIZE, $event); |
|
| 516 | ||
| 517 | $form = $builder->getForm(); |
|
| 518 | ||
| 519 | $form->handleRequest($request); |
|
| 520 | ||
| 521 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 522 | $data = $form->getData(); |
|
| 523 | $message = $data['message']; |
|
| 524 | $Order->setMessage($message); |
|
| 525 | // 受注情報を更新 |
|
| 526 | $app['orm.em']->flush(); |
|
| 527 | ||
| 528 | // お届け先設定一覧へリダイレクト |
|
| 529 | return $app->redirect($app->url('shopping_shipping', array('id' => $id))); |
|
| 530 | } |
|
| 531 | ||
| 532 | return $app->render('Shopping/index.twig', array( |
|
| 533 | 'form' => $form->createView(), |
|
| 534 | 'Order' => $Order, |
|
| 535 | )); |
|
| 536 | } |
|
| 537 | ||
| 538 | /** |
|
| 539 | * お届け先の設定一覧からの選択 |
|
| @@ 620-662 (lines=43) @@ | ||
| 617 | /** |
|
| 618 | * お届け先の設定(非会員)がクリックされた場合の処理 |
|
| 619 | */ |
|
| 620 | public function shippingEditChange(Application $app, Request $request, $id) |
|
| 621 | { |
|
| 622 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 623 | if (!$Order) { |
|
| 624 | $app->addError('front.shopping.order.error'); |
|
| 625 | return $app->redirect($app->url('shopping_error')); |
|
| 626 | } |
|
| 627 | ||
| 628 | if ('POST' !== $request->getMethod()) { |
|
| 629 | return $app->redirect($app->url('shopping')); |
|
| 630 | } |
|
| 631 | ||
| 632 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 633 | ||
| 634 | $event = new EventArgs( |
|
| 635 | array( |
|
| 636 | 'builder' => $builder, |
|
| 637 | 'Order' => $Order, |
|
| 638 | ), |
|
| 639 | $request |
|
| 640 | ); |
|
| 641 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_INDEX_INITIALIZE, $event); |
|
| 642 | ||
| 643 | $form = $builder->getForm(); |
|
| 644 | ||
| 645 | $form->handleRequest($request); |
|
| 646 | ||
| 647 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 648 | $data = $form->getData(); |
|
| 649 | $message = $data['message']; |
|
| 650 | $Order->setMessage($message); |
|
| 651 | // 受注情報を更新 |
|
| 652 | $app['orm.em']->flush(); |
|
| 653 | ||
| 654 | // お届け先設定一覧へリダイレクト |
|
| 655 | return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id))); |
|
| 656 | } |
|
| 657 | ||
| 658 | return $app->render('Shopping/index.twig', array( |
|
| 659 | 'form' => $form->createView(), |
|
| 660 | 'Order' => $Order, |
|
| 661 | )); |
|
| 662 | } |
|
| 663 | ||
| 664 | /** |
|
| 665 | * お届け先の設定(非会員でも使用する) |
|
| @@ 1008-1050 (lines=43) @@ | ||
| 1005 | /** |
|
| 1006 | * 複数配送処理がクリックされた場合の処理 |
|
| 1007 | */ |
|
| 1008 | public function shippingMultipleChange(Application $app, Request $request) |
|
| 1009 | { |
|
| 1010 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 1011 | if (!$Order) { |
|
| 1012 | $app->addError('front.shopping.order.error'); |
|
| 1013 | return $app->redirect($app->url('shopping_error')); |
|
| 1014 | } |
|
| 1015 | ||
| 1016 | if ('POST' !== $request->getMethod()) { |
|
| 1017 | return $app->redirect($app->url('shopping')); |
|
| 1018 | } |
|
| 1019 | ||
| 1020 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 1021 | ||
| 1022 | $event = new EventArgs( |
|
| 1023 | array( |
|
| 1024 | 'builder' => $builder, |
|
| 1025 | 'Order' => $Order, |
|
| 1026 | ), |
|
| 1027 | $request |
|
| 1028 | ); |
|
| 1029 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_INDEX_INITIALIZE, $event); |
|
| 1030 | ||
| 1031 | $form = $builder->getForm(); |
|
| 1032 | ||
| 1033 | $form->handleRequest($request); |
|
| 1034 | ||
| 1035 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 1036 | $data = $form->getData(); |
|
| 1037 | $message = $data['message']; |
|
| 1038 | $Order->setMessage($message); |
|
| 1039 | // 受注情報を更新 |
|
| 1040 | $app['orm.em']->flush(); |
|
| 1041 | ||
| 1042 | // 複数配送設定へリダイレクト |
|
| 1043 | return $app->redirect($app->url('shopping_shipping_multiple')); |
|
| 1044 | } |
|
| 1045 | ||
| 1046 | return $app->render('Shopping/index.twig', array( |
|
| 1047 | 'form' => $form->createView(), |
|
| 1048 | 'Order' => $Order, |
|
| 1049 | )); |
|
| 1050 | } |
|
| 1051 | ||
| 1052 | ||
| 1053 | /** |
|