| @@ 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 | * お届け先の設定(非会員でも使用する) |
|
| @@ 999-1041 (lines=43) @@ | ||
| 996 | /** |
|
| 997 | * 複数配送処理がクリックされた場合の処理 |
|
| 998 | */ |
|
| 999 | public function shippingMultipleChange(Application $app, Request $request) |
|
| 1000 | { |
|
| 1001 | $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']); |
|
| 1002 | if (!$Order) { |
|
| 1003 | $app->addError('front.shopping.order.error'); |
|
| 1004 | return $app->redirect($app->url('shopping_error')); |
|
| 1005 | } |
|
| 1006 | ||
| 1007 | if ('POST' !== $request->getMethod()) { |
|
| 1008 | return $app->redirect($app->url('shopping')); |
|
| 1009 | } |
|
| 1010 | ||
| 1011 | $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order); |
|
| 1012 | ||
| 1013 | $event = new EventArgs( |
|
| 1014 | array( |
|
| 1015 | 'builder' => $builder, |
|
| 1016 | 'Order' => $Order, |
|
| 1017 | ), |
|
| 1018 | $request |
|
| 1019 | ); |
|
| 1020 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_INDEX_INITIALIZE, $event); |
|
| 1021 | ||
| 1022 | $form = $builder->getForm(); |
|
| 1023 | ||
| 1024 | $form->handleRequest($request); |
|
| 1025 | ||
| 1026 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 1027 | $data = $form->getData(); |
|
| 1028 | $message = $data['message']; |
|
| 1029 | $Order->setMessage($message); |
|
| 1030 | // 受注情報を更新 |
|
| 1031 | $app['orm.em']->flush(); |
|
| 1032 | ||
| 1033 | // 複数配送設定へリダイレクト |
|
| 1034 | return $app->redirect($app->url('shopping_shipping_multiple')); |
|
| 1035 | } |
|
| 1036 | ||
| 1037 | return $app->render('Shopping/index.twig', array( |
|
| 1038 | 'form' => $form->createView(), |
|
| 1039 | 'Order' => $Order, |
|
| 1040 | )); |
|
| 1041 | } |
|
| 1042 | ||
| 1043 | ||
| 1044 | /** |
|