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