<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Customize\Controller\Mypage;
use Eccube\Controller\AbstractController;
use Eccube\Entity\BaseInfo;
use Eccube\Entity\Customer;
use Eccube\Entity\Order;
use Eccube\Entity\Product;
use Eccube\Event\EccubeEvents;
use Eccube\Event\EventArgs;
use Eccube\Exception\CartException;
use Eccube\Form\Type\Front\CustomerLoginType;
use Eccube\Repository\BaseInfoRepository;
use Eccube\Repository\CustomerFavoriteProductRepository;
use Eccube\Repository\OrderRepository;
use Eccube\Repository\ProductRepository;
use Customize\Repository\SchoolRepository;
use Customize\Repository\DeliveryPeriodRepository;
use Customize\Service\CartService;
use Eccube\Service\PurchaseFlow\PurchaseContext;
use Eccube\Service\PurchaseFlow\PurchaseFlow;
use Knp\Component\Pager\PaginatorInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Customize\Repository\ProductStoreRepository;
use Customize\Repository\OrderItemRepository;
use Eccube\Repository\Master\OrderStatusRepository;
use Eccube\Repository\ProductClassRepository;
use Eccube\Repository\DeliveryFeeRepository;
use Eccube\Repository\Master\CustomerOrderStatusRepository;
class MyPageController extends AbstractController
{
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var CustomerFavoriteProductRepository
*/
protected $customerFavoriteProductRepository;
/**
* @var BaseInfo
*/
protected $BaseInfo;
/**
* @var CartService
*/
protected $cartService;
/**
* @var OrderRepository
*/
protected $orderRepository;
/**
* @var SchoolRepository
*/
protected $schoolRepository;
/**
* @var DeliveryPeriodRepository
*/
protected $deliveryPeriodRepository;
/**
* @var PurchaseFlow
*/
protected $purchaseFlow;
/**
* @var productStoreRepository
*/
protected $productStoreRepository;
/**
* @var orderStatusRepository
*/
protected $orderStatusRepository;
/**
* @var customerOrderStatusRepository
*/
protected $customerOrderStatusRepository;
/**
* @var ProductClassRepository
*/
protected $productClassRepository;
/**
* @var OrderItemRepository
*/
protected $orderItemRepository;
/**
* @var DeliveryFeeRepository
*/
protected $deliveryFeeRepository;
/**
* MypageController constructor.
*
* @param OrderRepository $orderRepository
* @param CustomerFavoriteProductRepository $customerFavoriteProductRepository
* @param CartService $cartService
* @param BaseInfoRepository $baseInfoRepository
* @param PurchaseFlow $purchaseFlow
* @param SchoolRepository $schoolRepository
* @param DeliveryPeriodRepository $deliveryPeriodRepository
* @param ProductStoreRepository $productStoreRepository
* @param OrderStatusRepository $orderStatusRepository
*/
public function __construct(
OrderRepository $orderRepository,
CustomerFavoriteProductRepository $customerFavoriteProductRepository,
CartService $cartService,
BaseInfoRepository $baseInfoRepository,
PurchaseFlow $purchaseFlow,
SchoolRepository $schoolRepository,
DeliveryPeriodRepository $deliveryPeriodRepository,
ProductStoreRepository $productStoreRepository,
OrderStatusRepository $orderStatusRepository,
CustomerOrderStatusRepository $customerOrderStatusRepository,
ProductRepository $productRepository,
ProductClassRepository $productClassRepository,
OrderItemRepository $orderItemRepository,
DeliveryFeeRepository $deliveryFeeRepository
) {
$this->orderRepository = $orderRepository;
$this->customerFavoriteProductRepository = $customerFavoriteProductRepository;
$this->BaseInfo = $baseInfoRepository->get();
$this->cartService = $cartService;
$this->purchaseFlow = $purchaseFlow;
$this->schoolRepository = $schoolRepository;
$this->deliveryPeriodRepository = $deliveryPeriodRepository;
$this->productStoreRepository = $productStoreRepository;
$this->orderStatusRepository = $orderStatusRepository;
$this->productRepository = $productRepository;
$this->productClassRepository = $productClassRepository;
$this->orderItemRepository = $orderItemRepository;
$this->deliveryFeeRepository = $deliveryFeeRepository;
$this->customerOrderStatusRepository = $customerOrderStatusRepository;
}
/**
* ログイン画面.
*
* @Route("/mypage/login", name="mypage_login", methods={"GET", "POST"})
* @Template("Mypage/login.twig")
*/
public function login(Request $request, AuthenticationUtils $utils)
{
if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {
log_info('認証済のためログイン処理をスキップ');
return $this->redirectToRoute('mypage');
}
/* @var $form \Symfony\Component\Form\FormInterface */
$builder = $this->formFactory
->createNamedBuilder('', CustomerLoginType::class);
$builder->get('login_memory')->setData((bool) $request->getSession()->get('_security.login_memory'));
if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
$Customer = $this->getUser();
if ($Customer instanceof Customer) {
$builder->get('login_email')
->setData($Customer->getEmail());
}
}
$event = new EventArgs(
[
'builder' => $builder,
],
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_LOGIN_INITIALIZE);
$form = $builder->getForm();
return [
'error' => $utils->getLastAuthenticationError(),
'form' => $form->createView(),
'store_id' => $request->get('store_id', null),
'school_id' => $request->get('school_id', null)
];
}
/**
* マイページ.
*
* @Route("/mypage/", name="mypage", methods={"GET"})
* @Template("Mypage/index.twig")
*/
public function index(Request $request, PaginatorInterface $paginator)
{
$Customer = $this->getUser();
// 購入処理中/決済処理中ステータスの受注を非表示にする.
$this->entityManager
->getFilters()
->enable('incomplete_order_status_hidden');
// paginator
$qb = $this->orderRepository->getQueryBuilderByCustomer($Customer);
$event = new EventArgs(
[
'qb' => $qb,
'Customer' => $Customer,
],
$request
);
// $this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_INDEX_SEARCH);
$pagination = $paginator->paginate(
$qb,
$request->get('pageno', 1),
$this->eccubeConfig['eccube_search_pmax']
);
return [
'pagination' => $pagination,
'order_temporary' => $this->eccubeConfig['order_temporary']
];
}
/**
* 購入履歴詳細を表示する.
*
* @Route("/mypage/history/{order_no}", name="mypage_history", methods={"GET"})
* @Template("Mypage/history.twig")
*/
public function history(Request $request, $order_no)
{
if (!$this->session->get('is_from_history', false)) {
$this->entityManager->getFilters()
->enable('incomplete_order_status_hidden');
}
$this->session->set('is_temporary_order', false);
$this->session->set('temporary_order_id', null);
$Order = $this->orderRepository->findOneBy(
[
'id' => $order_no,
'Customer' => $this->getUser(),
]
);
$event = new EventArgs(
[
'Order' => $Order,
],
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_HISTORY_INITIALIZE);
/** @var Order $Order */
$Order = $event->getArgument('Order');
if (!$Order) {
throw new NotFoundHttpException();
}
if ($this->session->get('is_from_history', false)) {
$OrderStatus = $this->orderStatusRepository->find($this->eccubeConfig['order_temporary']);
$Order->setOrderStatus($OrderStatus);
$Order->setCustomerOrderStatus($this->customerOrderStatusRepository->find($this->eccubeConfig['order_temporary']));
$this->entityManager->persist($Order);
$this->entityManager->flush($Order);
foreach ($Order->getOrderItems() as $OrderDetail) {
try {
if ($OrderDetail->getProduct() &&
$OrderDetail->getProductClass()) {
for ($i = 0; $i < $OrderDetail->getQuantity(); $i++) {
$this->cartService->removeProduct($OrderDetail->getProductClass()->getId(), $OrderDetail->getSetProductClass());
}
$Carts = $this->cartService->getCarts();
$this->execPurchaseFlow($Carts);
}
} catch (CartException $e) {
log_info($e->getMessage());
$this->addRequestError($e->getMessage());
}
}
}
$DeliveryPeriodIdArr = [];
foreach ($Order['OrderItems'] as $OrderDetail) {
if($OrderDetail->getDeliveryPeriod())
$DeliveryPeriodIdArr[] = $OrderDetail->getDeliveryPeriod()->getDeliveryPeriodId();
}
$DeliveryPeriodIdArr = array_unique($DeliveryPeriodIdArr);
// 手数料取得
$charge = $Order->getCharge();
$shippings = $Order->getShippings();
/** @var DeliveryFee|null $DeliveryFee */
$DeliveryFee = $this->deliveryFeeRepository->findOneBy([
'Delivery' => $shippings[0]->getDelivery(),
'Pref' => $shippings[0]->getPref(),
]);
$shipping = is_object($DeliveryFee) ? $DeliveryFee->getFee() : 0;
$deliveryPriceTotal = 0;
$deliveryAmountTotal = 0;
$deliveryPriceTotalPer = 0;
$deliveryAmountTotalPer = 0;
$school = $this->getUser()->getSchool();
$perDeliveryPeriodPrice = [];
foreach ($DeliveryPeriodIdArr as $DeliveryPeriodId) {
foreach($Order['OrderItems'] as $OrderDetail){
if($OrderDetail->getDeliveryPeriod() && $OrderDetail->getDeliveryPeriod()->getDeliveryPeriodId() === $DeliveryPeriodId){
$deliveryPriceTotal += $OrderDetail->getPrice() * $OrderDetail->getQuantity();
$deliveryAmountTotal += $OrderDetail->getQuantity();
$deliveryPriceTotalPer += $OrderDetail->getPrice() * $OrderDetail->getQuantity();
$deliveryAmountTotalPer += $OrderDetail->getQuantity();
}
}
$DeliveryPeriod = $this->deliveryPeriodRepository->find($DeliveryPeriodId);
if($school['delivery_free_type'] === 2){
$DeliveryPeriod = $this->deliveryPeriodRepository->find($DeliveryPeriodId);
if($DeliveryPeriod['delivery_free_amount'] <= $deliveryPriceTotalPer || $DeliveryPeriod['delivery_free_quantity'] <= $deliveryAmountTotalPer){
$perDeliveryPeriodPrice[] = array(
'delivery_period_id' => $DeliveryPeriod['delivery_period_id'],
'product_label_name' => $DeliveryPeriod['product_label_name'],
'delivery_label_name' => $DeliveryPeriod['delivery_label_name'],
'totalPrice' => intval($deliveryPriceTotalPer),
'deliveryFeeTotal' => intval(0 + $charge),
'sum_label_name' => $DeliveryPeriod['sum_label_name'],
);
}else {
$perDeliveryPeriodPrice[] = array(
'delivery_period_id' => $DeliveryPeriod['delivery_period_id'],
'product_label_name' => $DeliveryPeriod['product_label_name'],
'delivery_label_name' => $DeliveryPeriod['delivery_label_name'],
'totalPrice' => intval($deliveryPriceTotalPer),
'deliveryFeeTotal' => intval($shipping + $charge),
'sum_label_name' => $DeliveryPeriod['sum_label_name'],
);
}
} else if($school['delivery_free_type'] === 1) {
// 配送無料条件が決済ごと
if($school['delivery_free_amount'] <= $deliveryPriceTotal || $school['delivery_free_quantity'] <= $deliveryAmountTotal){
$perDeliveryPeriodPrice[] = array(
'delivery_period_id' => $DeliveryPeriod['delivery_period_id'],
'product_label_name' => $DeliveryPeriod['product_label_name'],
'delivery_label_name' => $DeliveryPeriod['delivery_label_name'],
'totalPrice' => intval($deliveryPriceTotalPer),
intval(0 + $charge),
'sum_label_name' => $DeliveryPeriod['sum_label_name'],
);
} else {
$perDeliveryPeriodPrice[] = array(
'delivery_period_id' => $DeliveryPeriod['delivery_period_id'],
'product_label_name' => $DeliveryPeriod['product_label_name'],
'delivery_label_name' => $DeliveryPeriod['delivery_label_name'],
'totalPrice' => intval($deliveryPriceTotalPer),
'deliveryFeeTotal' => intval($shipping + $charge),
'sum_label_name' => $DeliveryPeriod['sum_label_name'],
);
}
} else {
$perDeliveryPeriodPrice[] = array(
'delivery_period_id' => $DeliveryPeriod['delivery_period_id'],
'product_label_name' => $DeliveryPeriod['product_label_name'],
'delivery_label_name' => $DeliveryPeriod['delivery_label_name'],
'totalPrice' => intval($deliveryPriceTotalPer),
'deliveryFeeTotal' => intval($shipping + $charge),
'sum_label_name' => $DeliveryPeriod['sum_label_name'],
);
}
$deliveryPriceTotalPer = 0;
$deliveryAmountTotalPer = 0;
}
$delivery_period = $this->deliveryPeriodRepository->findAll();
$sort = array();
foreach ((array) $perDeliveryPeriodPrice as $key => $value) {
$sort[$key] = $value['delivery_period_id'];
}
array_multisort($sort, SORT_ASC, $perDeliveryPeriodPrice);
// $stockOrder = true;
// foreach ($Order->getOrderItems() as $orderItem) {
// if ($orderItem->isProduct() && $orderItem->getQuantity() < 0) {
// $stockOrder = false;
// break;
// }
// }
$order_items = $Order->getOrderItems();
$setProductClassArr = [];
foreach ($order_items as $OrderDetail) {
if($OrderDetail->getDeliveryPeriod())
$DeliveryPeriodIdArr[] = $OrderDetail->getDeliveryPeriod()->getDeliveryPeriodId();
if(!empty($OrderDetail->getSetProductClass()))
{
$setProductClassArr[$OrderDetail->getId()] = $this->orderItemRepository->getSetProductClass($OrderDetail);
}
}
return [
'Order' => $Order,
// 'stockOrder' => $stockOrder,
'order_temporary' => $this->eccubeConfig['order_temporary'],
'delivery_period' => $delivery_period,
'perDeliveryPeriodPrice' => $perDeliveryPeriodPrice,
'OrderSetProductClass' => $setProductClassArr
];
}
/**
* 再購入を行う.
*
* @Route("/mypage/order/{order_no}", name="mypage_order", methods={"PUT"})
*/
public function order(Request $request, $order_no)
{
$this->isTokenValid();
log_info('再注文開始', [$order_no]);
$Customer = $this->getUser();
/* @var $Order \Eccube\Entity\Order */
$Order = $this->orderRepository->findOneBy(
[
'id' => $order_no,
'Customer' => $Customer,
]
);
// /* @var $Order \Eccube\Entity\Order */
// $Order = $this->orderRepository->findOneBy(
// [
// 'order_no' => $order_no,
// 'Customer' => $Customer,
// ]
// );
$event = new EventArgs(
[
'Order' => $Order,
'Customer' => $Customer,
],
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_ORDER_INITIALIZE);
if (!$Order) {
log_info('対象の注文が見つかりません', [$order_no]);
throw new NotFoundHttpException();
}
// エラーメッセージの配列
$errorMessages = [];
foreach ($Order->getOrderItems() as $OrderItem) {
try {
if ($OrderItem->getProduct() && $OrderItem->getProductClass()) {
$this->cartService->addProduct($OrderItem->getProductClass(), $OrderItem->getQuantity(), $OrderItem->getSetProductClass(), null, $OrderItem->getBrother());
// 明細の正規化
$Carts = $this->cartService->getCarts();
foreach ($Carts as $Cart) {
$result = $this->purchaseFlow->validate($Cart, new PurchaseContext($Cart, $this->getUser()));
// 復旧不可のエラーが発生した場合は追加した明細を削除.
if ($result->hasError()) {
$this->cartService->removeProduct($OrderItem->getProductClass());
foreach ($result->getErrors() as $error) {
$errorMessages[] = $error->getMessage();
}
}
foreach ($result->getWarning() as $warning) {
$errorMessages[] = $warning->getMessage();
}
}
$this->cartService->save();
}
} catch (CartException $e) {
log_info($e->getMessage(), [$order_no]);
$this->addRequestError($e->getMessage());
}
}
foreach ($errorMessages as $errorMessage) {
$this->addRequestError($errorMessage);
}
$event = new EventArgs(
[
'Order' => $Order,
'Customer' => $Customer,
],
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_ORDER_COMPLETE);
if ($event->getResponse() !== null) {
return $event->getResponse();
}
log_info('再注文完了', [$order_no]);
if($request->get('temporary')){
$Order = $this->orderRepository->find($order_no);
$OrderStatus = $this->orderStatusRepository->find($this->eccubeConfig['order_processing']);
$Order->setOrderStatus($OrderStatus);
$this->entityManager->persist($Order);
$this->entityManager->flush($Order);
}
return $this->redirect($this->generateUrl('cart'));
}
/**
* @param $Carts
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|null
*/
protected function execPurchaseFlow($Carts)
{
/** @var PurchaseFlowResult[] $flowResults */
$flowResults = array_map(function ($Cart) {
$purchaseContext = new PurchaseContext($Cart, $this->getUser());
return $this->purchaseFlow->validate($Cart, $purchaseContext);
}, $Carts);
// 復旧不可のエラーが発生した場合はカートをクリアして再描画
$hasError = false;
foreach ($flowResults as $result) {
if ($result->hasError()) {
$hasError = true;
foreach ($result->getErrors() as $error) {
$this->addRequestError($error->getMessage());
}
}
}
if ($hasError) {
$this->cartService->clear();
return $this->redirectToRoute('cart');
}
$this->cartService->save();
foreach ($flowResults as $index => $result) {
foreach ($result->getWarning() as $warning) {
if ($Carts[$index]->getItems()->count() > 0) {
$cart_key = $Carts[$index]->getCartKey();
$this->addRequestError($warning->getMessage(), "front.cart.${cart_key}");
} else {
// キーが存在しない場合はグローバルにエラーを表示する
$this->addRequestError($warning->getMessage());
}
}
}
return null;
}
/**
* お気に入り商品を表示する.
*
* @Route("/mypage/favorite", name="mypage_favorite", methods={"GET"})
* @Template("Mypage/favorite.twig")
*/
public function favorite(Request $request, PaginatorInterface $paginator)
{
if (!$this->BaseInfo->isOptionFavoriteProduct()) {
throw new NotFoundHttpException();
}
$Customer = $this->getUser();
// paginator
$qb = $this->customerFavoriteProductRepository->getQueryBuilderByCustomer($Customer);
$event = new EventArgs(
[
'qb' => $qb,
'Customer' => $Customer,
],
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_FAVORITE_SEARCH);
$pagination = $paginator->paginate(
$qb,
$request->get('pageno', 1),
$this->eccubeConfig['eccube_search_pmax'],
['wrap-queries' => true]
);
return [
'pagination' => $pagination,
];
}
/**
* お気に入り商品を削除する.
*
* @Route("/mypage/favorite/{id}/delete", name="mypage_favorite_delete", methods={"DELETE"}, requirements={"id" = "\d+"})
*/
public function delete(Request $request, Product $Product)
{
$this->isTokenValid();
$Customer = $this->getUser();
log_info('お気に入り商品削除開始', [$Customer->getId(), $Product->getId()]);
$CustomerFavoriteProduct = $this->customerFavoriteProductRepository->findOneBy(['Customer' => $Customer, 'Product' => $Product]);
if ($CustomerFavoriteProduct) {
$this->customerFavoriteProductRepository->delete($CustomerFavoriteProduct);
} else {
throw new BadRequestHttpException();
}
$event = new EventArgs(
[
'Customer' => $Customer,
'CustomerFavoriteProduct' => $CustomerFavoriteProduct,
], $request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_DELETE_COMPLETE);
log_info('お気に入り商品削除完了', [$Customer->getId(), $CustomerFavoriteProduct->getId()]);
return $this->redirect($this->generateUrl('mypage_favorite'));
}
/**
* 仮注文→購入手続きを進める
*
* @Route("/mypage/temporary_order/{id}", name="mypage_order_temporary", methods={"POST"}, requirements={"id" = "\d+"})
*/
public function orderTemporary(Request $request, $id)
{
$Customer = $this->getUser();
$schoolId = $Customer->getSchool()->getSchoolId();
$temporaryOrder = false;
if($schoolId !== null){
$school = $this->schoolRepository->find($schoolId);
$this->session->set('storeMeasuringFlag', $school->getStoreMeasuringFlag());
$this->session->set('schoolMeasuringFlag', $school->getSchoolMeasuringFlag());
$this->session->set('onlineFlag', $school->getOnlineFlag());
if($school->getOnlineFlag() == 0){
$temporaryOrder = true;
}
else{
$temporaryOrder = false;
}
}
$this->session->set('is_temporary_order', $temporaryOrder);
$this->isTokenValid();
log_info('購入手続きを進める開始', array($id));
$Customer = $this->getUser();
/* @var $Order \Eccube\Entity\Order */
$Order = $this->orderRepository->findOneBy(array(
'id' => $id,
'Customer' => $Customer,
));
$event = new EventArgs(
array(
'Order' => $Order,
'Customer' => $Customer,
),
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_ORDER_INITIALIZE);
if (!$Order) {
log_info('対象の注文が見つかりません', array($id));
throw new NotFoundHttpException();
}
$productId = 0;
$is_product_deleted = false;
foreach ($Order->getOrderItems() as $OrderDetail) {
try {
if ($OrderDetail->isProduct()) {
if ($OrderDetail->getProduct() && $OrderDetail->getProductClass()) {
$productId = $OrderDetail->getProduct()->getId();
$this->cartService->addProduct($OrderDetail->getProductClass()->getId(), $OrderDetail->getQuantity(), $OrderDetail->getSetProductClass());
$Carts = $this->cartService->getCarts();
/** @var PurchaseFlowResult[] $flowResults */
$flowResults = array_map(function ($Cart) {
$purchaseContext = new PurchaseContext($Cart, $this->getUser());
return $this->purchaseFlow->validate($Cart, $purchaseContext);
}, $Carts);
$this->cartService->save();
}
else {
if(!$is_product_deleted)
$this->addRequestError('cart.product.delete');
$is_product_deleted = true;
}
}
} catch (CartException $e) {
log_info($e->getMessage(), array($id));
$this->addRequestError($e->getMessage());
}
}
$event = new EventArgs(
array(
'Order' => $Order,
'Customer' => $Customer,
),
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_MYPAGE_MYPAGE_ORDER_COMPLETE);
if ($event->getResponse() !== null) {
return $event->getResponse();
}
log_info('購入手続きを進める', array($id));
// FRONT_CART_BUYSTEP_INITIALIZE
$event = new EventArgs(
array(),
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_CART_BUYSTEP_INITIALIZE);
$this->cartService->save();
// FRONT_CART_BUYSTEP_COMPLETE
$event = new EventArgs(
array(),
$request
);
$this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_CART_BUYSTEP_COMPLETE);
//「対応状況」を「新規受付」にする (本注文状態にする)
// $OrderStatus = $this->orderStatusRepository->find($this->eccubeConfig['order_processing']);
// $OrderData = $this->orderRepository->find($Order->getId());
// $OrderData->setOrderStatus($OrderStatus);
// $this->entityManager->persist($OrderData);
// $this->entityManager->flush($OrderData);
$this->session->set('temporary_order_id', $id);
//product_type_idを取得する
if($productId > 0){
$productStore = $this->productStoreRepository->findOneBy(array(
'Product' => $this->productRepository->findOneBy(['id'=>$productId])
));
if($productStore)
$this->session->set('store_id_order',$productStore->getStore()->getStoreId());
}
$this->session->set('is_from_history', true);
if($temporaryOrder) {
return $this->redirectToRoute('shopping_temporary');
}
else {
return $this->redirectToRoute('shopping');
}
}
}