<?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 Customize\Entity\JewelLocation;
use Customize\Event\CustomizeEvents;
use Customize\Repository\AdjusterRepository;
use Customize\Repository\BreathredRepository;
use Customize\Repository\BroochRepository;
use Customize\Repository\CatchyRepository;
use Customize\Repository\CustomBreathredRepository;
use Customize\Repository\CustomBroochRepository;
use Customize\Repository\CustomEarringRepository;
use Customize\Repository\CustomNecklaceRepository;
use Customize\Repository\CustomPendantRepository;
use Customize\Repository\CustomPierceRepository;
use Customize\Repository\CustomProductRepository;
use Customize\Repository\CustomRingRepository;
use Customize\Repository\CustomShippoRingRepository;
use Customize\Repository\EarringRepository;
use Customize\Repository\HikiwaRepository;
use Customize\Repository\JewelLocationRepository;
use Customize\Repository\JewelPartRepository;
use Customize\Repository\JewelRepository;
use Customize\Repository\NecklaceRepository;
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\Service\CartService;
use Customize\Repository\OrderItemRepositoryExtension;
use Customize\Repository\PendantRepository;
use Customize\Repository\PierceRepository;
use Customize\Repository\ProductClassRepository;
use Customize\Repository\RakuwaRepository;
use Customize\Repository\RepairRepository;
use Customize\Repository\RingRepository;
use Customize\Repository\ShippoRingRepository;
use Eccube\Service\PurchaseFlow\PurchaseContext;
use Eccube\Service\PurchaseFlow\PurchaseFlow;
use Exception;
use Knp\Component\Pager\PaginatorInterface;
use phpDocumentor\Reflection\Types\Null_;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\JsonResponse;
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;
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 PurchaseFlow
*/
protected $purchaseFlow;
/**
* @var OrderItemRepositoryExtension
*/
protected $orderItemRepositoryExtension;
/**
* @var CustomRingRepository
*/
protected $customRingRepository;
/**
* @var CustomPierceRepository
*/
protected $customPierceRepository;
/**
* @var RingRepository
*/
protected $ringRepository;
/**
* @var PierceRepository
*/
protected $pierceRepository;
/**
* @var BroochRepository
*/
protected $broochRepository;
/**
* @var CustomBroochRepository
*/
protected $customBroochRepository;
/**
* @var JewelRepository
*/
protected $jewelRepository;
/**
* @var JewelLocationRepository
*/
protected $jewelLocationRepository;
/**
* @var JewelPartRepository
*/
protected $jewelPartRepository;
/**
* @var CatchyRepository
*/
protected $catchyRepository;
/**
* @var AdjusterRepository
*/
protected $adjusterRepository;
/**
* @var ShippoRingRepository
*/
protected $shippoRingRepository;
/**
* @var CustomShippoRingRepository
*/
protected $customShippoRingRepository;
/**
* @var EarringRepository
*/
protected $earringRepository;
/**
* @var CustomEarringRepository
*/
protected $customEarringRepository;
/**
* @var RepairRepository
*/
protected $repairRepository;
/**
* @var ProductClassRepository
*/
protected $productClassRepository;
/**
* @var CustomProductRepository
*/
protected $customProductRepository;
/**
* @var PendantRepository
*/
protected $pendantRepository;
/**
* @var CustomPendantRepository
*/
protected $customPendantRepository;
/**
* @var BreathredRepository
*/
protected $breathredRepository;
/**
* @var CustomBreathredRepository
*/
protected $customBreathredRepository;
/**
* @var NecklaceRepository
*/
protected $necklaceRepository;
/**
* @var CustomNecklaceRepository
*/
protected $customNecklaceRepository;
/**
* @var HikiwaRepository
*/
protected $hikiwaRepository;
/**
* @var RakuwaRepository
*/
protected $rakuwaRepository;
/**
* MypageController constructor.
*
* @param OrderRepository $orderRepository
* @param CustomerFavoriteProductRepository $customerFavoriteProductRepository
* @param CartService $cartService
* @param BaseInfoRepository $baseInfoRepository
* @param PurchaseFlow $purchaseFlow
* @param OrderItemRepositoryExtension $orderItemRepositoryExtension
* @param CustomRingRepository $customRingRepository
* @param RingRepository $ringRepository
* @param JewelPartRepository $jewelPartRepository
* @param JewelRepository $jewelRepository
* @param PierceRepository $pierceRepository
* @param CustomPierceRepository $customPierceRepository
* @param CatchyRepository $catchyRepository
* @param RepairRepository $repairRepository
* @param CustomProductRepository $customProductRepository
* @param ProductClassRepository $productClassRepository
* @param JewelLocationRepository $jewelLocationRepository
* @param ShippoRingRepository $shippoRingRepository
* @param CustomShippoRingRepository $customShippoRingRepository
* @param BroochRepository $broochRepository
* @param CustomBroochRepository $customBroochRepository
* @param CustomPendantRepository $customPendantRepository
* @param PendantRepository $pendantRepository
* @param NecklaceRepository $necklaceRepository
* @param EarringRepository $earringRepository
* @param CustomEarringRepository $customEarringRepository
* @param BreathredRepository $breathredRepository
* @param CustomBreathredRepository $customBreathredRepository
* @param HikiwaRepository $hikiwaRepository
* @param AdjusterRepository $adjusterRepository
* @param CustomNecklaceRepository $customNecklaceRepository
* @param RakuwaRepository $rakuwaRepository
*/
public function __construct(
OrderRepository $orderRepository,
CustomerFavoriteProductRepository $customerFavoriteProductRepository,
CartService $cartService,
BaseInfoRepository $baseInfoRepository,
PurchaseFlow $purchaseFlow,
OrderItemRepositoryExtension $orderItemRepositoryExtension,
CustomRingRepository $customRingRepository,
RingRepository $ringRepository,
JewelRepository $jewelRepository,
JewelPartRepository $jewelPartRepository,
PierceRepository $pierceRepository,
CustomPierceRepository $customPierceRepository,
CatchyRepository $catchyRepository,
RepairRepository $repairRepository,
CustomProductRepository $customProductRepository,
ProductClassRepository $productClassRepository,
JewelLocationRepository $jewelLocationRepository,
ShippoRingRepository $shippoRingRepository,
CustomShippoRingRepository $customShippoRingRepository,
BroochRepository $broochRepository,
CustomBroochRepository $customBroochRepository,
PendantRepository $pendantRepository,
CustomPendantRepository $customPendantRepository,
NecklaceRepository $necklaceRepository,
EarringRepository $earringRepository,
CustomEarringRepository $customEarringRepository,
BreathredRepository $breathredRepository,
CustomBreathredRepository $customBreathredRepository,
HikiwaRepository $hikiwaRepository,
AdjusterRepository $adjusterRepository,
CustomNecklaceRepository $customNecklaceRepository,
RakuwaRepository $rakuwaRepository
) {
$this->orderRepository = $orderRepository;
$this->customerFavoriteProductRepository = $customerFavoriteProductRepository;
$this->BaseInfo = $baseInfoRepository->get();
$this->cartService = $cartService;
$this->purchaseFlow = $purchaseFlow;
$this->orderItemRepositoryExtension = $orderItemRepositoryExtension;
$this->customRingRepository = $customRingRepository;
$this->ringRepository = $ringRepository;
$this->jewelPartRepository = $jewelPartRepository;
$this->jewelRepository = $jewelRepository;
$this->pierceRepository = $pierceRepository;
$this->customPierceRepository = $customPierceRepository;
$this->catchyRepository = $catchyRepository;
$this->repairRepository = $repairRepository;
$this->customProductRepository = $customProductRepository;
$this->productClassRepository = $productClassRepository;
$this->jewelLocationRepository = $jewelLocationRepository;
$this->shippoRingRepository = $shippoRingRepository;
$this->customShippoRingRepository = $customShippoRingRepository;
$this->broochRepository = $broochRepository;
$this->customBroochRepository = $customBroochRepository;
$this->pendantRepository = $pendantRepository;
$this->customPendantRepository = $customPendantRepository;
$this->necklaceRepository = $necklaceRepository;
$this->earringRepository = $earringRepository;
$this->customEarringRepository = $customEarringRepository;
$this->breathredRepository = $breathredRepository;
$this->customBreathredRepository = $customBreathredRepository;
$this->hikiwaRepository = $hikiwaRepository;
$this->adjusterRepository = $adjusterRepository;
$this->customNecklaceRepository = $customNecklaceRepository;
$this->rakuwaRepository = $rakuwaRepository;
}
/**
* ログイン画面.
*
* @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(EccubeEvents::FRONT_MYPAGE_MYPAGE_LOGIN_INITIALIZE, $event);
$form = $builder->getForm();
return [
'error' => $utils->getLastAuthenticationError(),
'form' => $form->createView(),
];
}
/**
* マイページ.
*
* @Route("/mypage/", name="mypage", methods={"GET"})
* @Template("Mypage/index.twig")
*/
public function index(Request $request, PaginatorInterface $paginator)
{
$session = $request->getSession();
$session->remove('customize_base');
$session->remove('customize_type');
$session->remove('customize_jewel1');
$session->remove('customize_jewel1_shape');
$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(EccubeEvents::FRONT_MYPAGE_MYPAGE_INDEX_SEARCH, $event);
$pagination = $paginator->paginate(
$qb,
$request->get('pageno', 1),
$this->eccubeConfig['eccube_search_pmax']
);
//custom ringのイメージ
$order_item = [];
$items = $pagination->getItems();
foreach($items as $item){
$orders = $this->orderItemRepositoryExtension->CustomFindWithID($item['id']);
$items_list = [];
foreach($orders as $order){
$item_name = $order->getProductName();
$custom = $order['product_code'];
if($item_name != '手数料' && $item_name != '送料'){
if(strpos($item_name,'カスタム') !== false || strpos($item_name,'七宝リング') !== false ){
$is_repair = false;
if($item_name == 'カスタム修理'){
$repair = $this->repairRepository->repairFindWithID($custom)[0];
$product_id = $repair->getProductId();
$prod = $this->customProductRepository->customProductFind($product_id)[0];
$item_name = $prod->getName();
if(str_contains($item_name,'カスタム') || str_contains($item_name,'七宝リング')){
$custom = $repair->getCustomId();
$is_repair = true;
}
else{
$item_id = $repair->getOriginalProductClassId();
$item = $this->productClassRepository->find($item_id);
// $temp = null;
$is_repair = true;
// $temp['output_image'] = $item->getProduct()->getProductImage()[0];
// $temp['base'] = null;
// $temp['repair'] = $is_repair;
// $temp['prod'] = $item->getProduct();
//array_push($items_list,$temp);
//break;
}
}
switch($item_name){
case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_RING):
$custom = $this->customRingRepository->CustomFindWithID($custom)[0];
$ring = $this->ringRepository->CustomFindWithID($custom->getRingBaseId())[0];
$socket = $ring->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
if($custom->getEmpty() != null){
$t = unserialize($custom->getEmpty());
}
else{
$t = null;
}
if($t){
$temp['empty'] = $t;
}
else{
$temp['empty'] = null;
}
$temp['output_image'] = 'customOutput/customRing/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/ring/'.$ring->getRingShape() .'/'. $ring->getRingType() .'/'. $ring->getImageName();
$temp['base_name'] = $ring->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
}
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_PIERCE):
$custom = $this->customPierceRepository->CustomFindWithID($custom)[0];
$pierce = $this->pierceRepository->CustomFindWithID($custom->getPierceBaseId())[0];
$socket = $pierce->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
if($custom->getEmpty() != null){
$t = unserialize($custom->getEmpty());
}
else{
$t = null;
}
if($t){
$temp['empty'] = $t;
}
else{
$temp['empty'] = null;
}
$catchy = $this->catchyRepository->CustomFindWithID($custom->getCatchyId())[0];
$temp['output_image'] = 'customOutput/customPierce/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/pierce/'.$pierce->getPierceShape() .'/'. $pierce->getPierceType() .'/list/'. $pierce->getImageName();
$temp['base_name'] = $pierce->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
}
$temp['catchy'] = 'customRing/catchy/'.$catchy->getImageName();
$temp['catchy_name'] = $catchy->getName();
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_BROOCH):
$custom = $this->customBroochRepository->CustomFindWithID($custom)[0];
$brooch = $this->broochRepository->CustomFindWithID($custom->getBroochBaseId())[0];
$socket = $brooch->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($custom->getEmpty() != null){
$t = unserialize($custom->getEmpty());
}
else{
$t = null;
}
if($t){
$temp['empty'] = $t;
}
else{
$temp['empty'] = null;
}
$temp['output_image'] = 'customOutput/customBrooch/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/brooch/'.$brooch->getBroochShape() .'/'. $brooch->getBroochType() .'/list/'. $brooch->getImageName();
$temp['base_name'] = $brooch->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_SHIPPORING):
$custom = $this->customShippoRingRepository->CustomFindWithID($custom)[0];
$shippoRing = $this->shippoRingRepository->CustomFindWithID($custom->getRingBaseId())[0];
$temp['empty'] = null;
$temp['output_image'] = 'customOutput/ShippoRing/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/shippoRing/'.$shippoRing->getShippoRingShape() .'/'. $shippoRing->getShippoRingType() .'/'. $shippoRing->getShippoRingColor() .'/' . $shippoRing->getImageName();
$temp['base_name'] = $shippoRing->getShippoRingName();
$temp['jewel1_path'] = null;
$temp['jewel1_name'] = null;
$temp['jewel_part1_path'] = null;
$temp['jewel_part1_name'] = null;
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_PENDANT):
$custom = $this->customPendantRepository->CustomFindWithID($custom)[0];
$pendant = $this->pendantRepository->CustomFindWithID($custom->getPendantBaseId())[0];
$socket = $pendant->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($custom->getEmpty() != null){
$t = unserialize($custom->getEmpty());
}
else{
$t = null;
}
if($t){
$temp['empty'] = $t;
}
else{
$temp['empty'] = null;
}
$chain = $this->necklaceRepository->CustomFindWithID($custom->getPendantChainId())[0];
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
$adjuster =$this->adjusterRepository->CustomFindWithID($custom->getAdjusterId())[0];
$temp['output_image'] = 'customOutput/customPendant/' . $custom->getOutputImage();
$temp['pendant'] = 'customRing/pendant/'.$pendant->getPendantShape() .'/'. $pendant->getPendantType() .'/list/'. $pendant->getImageName();
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/necklace/'.$chain->getNecklaceShape() .'/'. $chain->getNecklaceType() .'/list/'. $chain->getImageName();
$temp['base_name'] = $chain->getNecklaceName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
$temp['adjuster'] = 'customRing/adjuster/' . $adjuster->getAdjusterShape() . '/' . $adjuster->getAdjusterType() . '/' . $adjuster->getImageName();
$temp['adjuster_name'] = $adjuster->getAdjusterName();
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_NECKLACE):
$custom = $this->customNecklaceRepository->CustomFindWithID($custom)[0];
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($custom->getEmpty() != null){
$t = unserialize($custom->getEmpty());
}
else{
$t = null;
}
if($t){
$temp['empty'] = $t;
}
else{
$temp['empty'] = null;
}
$chain = $this->necklaceRepository->CustomFindWithID($custom->getNecklaceBaseId())[0];
if($custom->getHikiwaId() != 0){
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
}
else{
$rakuwa = $this->rakuwaRepository->CustomFindWithID($custom->getRakuwaId())[0];
$temp['hikiwa'] = 'customRing/rakuwa/' . $rakuwa->getRakuwaShape() . '/'. $rakuwa->getRakuwaType() . '/'. $rakuwa->getImageName();
$temp['hikiwa_name'] = $rakuwa->getRakuwaName();
}
$temp['output_image'] = 'customOutput/customNecklace/' . $custom->getOutputImage();
$temp['pendant'] =null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/necklace/'.$chain->getNecklaceShape() .'/'. $chain->getNecklaceType() .'/list/'. $chain->getImageName();
$temp['base_name'] = $chain->getNecklaceName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_EARRING):
$custom = $this->customEarringRepository->CustomFindWithID($custom)[0];
$earring = $this->earringRepository->CustomFindWithID($custom->getEarringBaseId())[0];
$socket = $earring->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
if($custom->getEmpty() != null){
$t = unserialize($custom->getEmpty());
}
else{
$t = null;
}
if($t){
$temp['empty'] = $t;
}
else{
$temp['empty'] = null;
}
$custom = $this->customEarringRepository->CustomFindWithID($custom)[0];
$earring = $this->earringRepository->CustomFindWithID($custom->getEarringBaseId())[0];
$socket = $earring->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$temp['output_image'] = 'customOutput/customEarring/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/earring/'.$earring->getEarringShape() .'/'. $earring->getEarringType() .'/list/'. $earring->getImageName();
$temp['base_name'] = $earring->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
}
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_BREATHED):
$custom = $this->customBreathredRepository->CustomFindWithID($custom)[0];
$breathred = $this->breathredRepository->CustomFindWithID($custom->getBreathredBaseId())[0];
$socket = $breathred->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
if($custom->getEmpty() != null){
$t = unserialize($custom->getEmpty());
}
else{
$t = null;
}
if($t){
$temp['empty'] = $t;
}
else{
$temp['empty'] = null;
}
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
$adjuster =$this->adjusterRepository->CustomFindWithID($custom->getAdjusterId())[0];
$temp['output_image'] = 'customOutput/customBreathred/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/breathred/'.$breathred->getBreathredShape() .'/'. $breathred->getBreathredType() .'/list/'. $breathred->getImageName();
$temp['base_name'] = $breathred->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
}
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();;
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
$temp['adjuster'] = 'customRing/adjuster/' . $adjuster->getAdjusterShape() . '/' . $adjuster->getAdjusterType() . '/' . $adjuster->getImageName();
$temp['adjuster_name'] = $adjuster->getAdjusterName();
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
default:
$temp['output_image'] = $item->getProduct()->getProductImage()[0];
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = null;
$temp['base_name'] = null;
$temp['jewel1_path'] = null;
$temp['jewel1_name'] = null;
$temp['jewel_part1_path'] = null;
$temp['jewel_part1_name'] = null;
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($items_list,$temp);
break;
}
}
else{
array_push($items_list, NULL);
}
}
else{
array_push($items_list, NULL);
}
}
array_push($order_item, $items_list);
}
return [
'pagination' => $pagination,
'order_item' => $order_item
];
}
// /**
// * マイページ.
// *
// * @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(EccubeEvents::FRONT_MYPAGE_MYPAGE_INDEX_SEARCH, $event);
// $pagination = $paginator->paginate(
// $qb,
// $request->get('pageno', 1),
// $this->eccubeConfig['eccube_search_pmax']
// );
// //custom ringのイメージ
// $order_item = [];
// $items = $pagination->getItems();
// foreach($items as $item){
// $orders = $this->orderItemRepositoryExtension->CustomFindWithID($item['id']);
// $items_list = [];
// foreach($orders as $order){
// $item_name = $order->getProductName();
// $code = $order['product_code'];
// if($item_name != '手数料' && $item_name != '送料'){
// if(strpos($item_name,'カスタム') !== false || strpos($item_name,'七宝リング') !== false ){
// $is_repair = false;
// if($item_name == 'カスタム修理'){
// $repair = $this->repairRepository->repairFindWithID($code)[0];
// $product_id = $repair->getProductId();
// $prod = $this->customProductRepository->customProductFind($product_id)[0];
// $item_name = $prod->getName();
// if(str_contains($item_name,'カスタム')){
// $code = $repair->getCustomId();
// $is_repair = true;
// }
// else{
// $item_id = $repair->getOriginalProductClassId();
// $item = $this->productClassRepository->find($item_id);
// $temp = null;
// $is_repair = true;
// $temp['base'] = null;
// $temp['repair'] = $is_repair;
// $temp['prod'] = $item->getProduct();
// array_push($items_list,$temp);
// break;
// }
// }
// else if(str_contains($item_name, '七宝リング')){
// $custom = $this->customShippoRingRepository->CustomFindWithID(intval($code))[0];
// $shippo = $this->shippoRingRepository->CustomFindWithID($custom->getRingBaseId())[0];
// $temp['base'] = $shippo;
// $temp['repair'] = $is_repair;
// array_push($items_list,$temp);
// break;
// }
// switch($item_name){
// case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_RING):
// $custom = $this->customRingRepository->CustomFindWithID(intval($code));
// $custom = $custom[0];
// $base = $this->ringRepository->CustomFindWithID($custom->getRingBaseId());
// $base = $base[0];
// $base_image = 'customRing/ring/'.$base->getRingShape().'/'.$base->getRingType().'/'.$base->getImageName();
// $catchy = NULL;
// $hikiwa = NULL;
// $adjuster = NULL;
// $item_type = 'ring';
// $jewel_location = $this->jewelLocationRepository->CustomFindWithShapeAndSocket($base->getRingShape(), $base->getSocket(), $base->getProductId())[0];
// $base_type = $base->getRingType();
// $base_shape = $base->getRingShape();
// break;
// case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_PIERCE):
// $custom = $this->customPierceRepository->CustomFindWithID(intval($code));
// $custom = $custom[0];
// $base = $this->pierceRepository->CustomFindWithID($custom->getPierceBaseId());
// $base = $base[0];
// $base_image = 'customRing/pierce/'.$base->getPierceShape().'/'.$base->getPierceType().'/main/'.$base->getImageName();
// $catchy = $this->catchyRepository->CustomFindWithID($custom->getCatchyId());
// $catchy = $catchy[0];
// $hikiwa = NULL;
// $adjuster = NULL;
// $item_type = 'pierce';
// $jewel_location = $this->jewelLocationRepository->CustomFindWithShapeAndSocket($base->getPierceShape(), $base->getSocket(), $base->getProductId())[0];
// $base_type = $base->getPierceType();
// $base_shape = $base->getPierceShape();
// break;
// case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_BROOCH):
// $custom = $this->customBroochRepository->CustomFindWithID(intval($code));
// $custom = $custom[0];
// $base = $this->broochRepository->CustomFindWithID($custom->getBroochBaseId());
// $base = $base[0];
// $base_image = 'customRing/brooch/'.$base->getBroochShape().'/'.$base->getBroochType().'/main/'.$base->getImageName();
// $catchy = NULL;
// $hikiwa = NULL;
// $adjuster = NULL;
// $item_type = 'brooch';
// $jewel_location = $this->jewelLocationRepository->CustomFindWithShapeAndSocket($base->getBroochShape(), $base->getSocket(), $base->getProductId())[0];
// $base_type = $base->getBroochType();
// $base_shape = $base->getBroochShape();
// break;
// case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_PENDANT):
// $custom = $this->customPendantRepository->CustomFindWithID(intval($code));
// $custom = $custom[0];
// $pendant = $this->pendantRepository->CustomFindWithID($custom->getPendantBaseId());
// $pendant = $pendant[0];
// #$base_image = 'customRing/pendant/'.$pendant->getPendantShape().'/'.$pendant->getPendantType().'/'.$pendant->getImageName();
// $catchy = NULL;
// $adjuster = NULL;
// $hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
// #$hikiwa = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/' . $hikiwa->getHikiwaType() .'/'. $hikiwa->getImageName();
// $item_type = 'pendant';
// $base = $this->necklaceRepository->CustomFindWithID($custom->getPendantChainId())[0];
// $jewel_location = $this->jewelLocationRepository->CustomFindWithShapeAndSocket($base->getNecklaceShape(), $base->getSocket(), $base->getProductId())[0];
// $base_type = $pendant->getPendantType();
// $base_shape = $pendant->getPendantShape();
// $base_image = 'customRing/necklace/'.$base->getNecklaceShape().'/'.$base->getNecklaceType().'/main/'.$base->getImageName();
// $temp['pendant'] = $pendant;
// break;
// case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_EARRING):
// $custom = $this->customEarringRepository->CustomFindWithID(intval($code));
// $custom = $custom[0];
// $base = $this->earringRepository->CustomFindWithID($custom->getEarringBaseId());
// $base = $base[0];
// $base_image = 'customRing/earring/'.$base->getEarringShape().'/'.$base->getEarringType().'/main/'.$base->getImageName();
// $catchy = NULL;
// $hikiwa = NULL;
// $adjuster = NULL;
// $item_type = 'earring';
// $jewel_location = $this->jewelLocationRepository->CustomFindWithShapeAndSocket($base->getEarringShape(), $base->getSocket(), $base->getProductId())[0];
// $base_type = $base->getEarringType();
// $base_shape = $base->getEarringShape();
// break;
// case $item_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_BREATHED):
// $custom = $this->customBreathredRepository->CustomFindWithID(intval($code));
// $custom = $custom[0];
// $base = $this->breathredRepository->CustomFindWithID($custom->getBreathredBaseId());
// $base = $base[0];
// $base_image = 'customRing/breathred/'.$base->getBreathredShape().'/'.$base->getBreathredType().'/main/'.$base->getImageName();
// $catchy = NULL;
// $hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
// $adjuster = $this->adjusterRepository->CustomFindWithID($custom->getAdjusterId())[0];
// $item_type = 'breathred';
// $jewel_location = $this->jewelLocationRepository->CustomFindWithShapeAndSocket($base->getBreathredShape(), $base->getSocket(), $base->getProductId())[0];
// $base_type = $base->getBreathredType();
// $base_shape = $base->getBreathredShape();
// break;
// default:
// throw new NotFoundHttpException();
// }
// //jewelのイメージ
// $jewel1 = $this->jewelRepository->CustomFindWithID($custom['jewel_id']);
// $jewel1 = $jewel1[0];
// //jewel part のイメージ
// $jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom['jewel_part_id']);
// $jewel_part1 = $jewel_part1[0];
// if($base->getSocket() == 2 && $item_type != 'pendant'){
// $jewel_id2 = $custom->getJewelId2();
// $jewel2 = $this->jewelRepository->CustomFindWithID($jewel_id2);
// $jewel2 = $jewel2[0];
// $jewel_part_id2 = $custom->getJewelPartId2();
// $jewel_part2 = $this->jewelPartRepository->CustomFindWithID($jewel_part_id2);
// $jewel_part2 = $jewel_part2[0];
// }else{
// $jewel2 = NULL;
// $jewel_part2 = NULL;
// }
// $temp['hikiwa'] = $hikiwa;
// $temp['base'] = $base;
// $temp['base_type'] = $base_type;
// $temp['base_shape'] = $base_shape;
// $temp['jewel1'] = $jewel1;
// $temp['jewel2'] = $jewel2;
// $temp['jewel_part1'] = $jewel_part1;
// $temp['jewel_part2'] = $jewel_part2;
// $temp['catchy'] = $catchy;
// $temp['adjuster'] = $adjuster;
// $temp['base_image'] = $base_image;
// $temp['type'] = $item_type;
// $temp['location'] = $jewel_location;
// $temp['rotation1'] = $custom->getJewelRotation();
// $temp['rotation2'] = $custom->getJewelRotation2();
// $temp['repair'] = $is_repair;
// array_push($items_list, $temp);
// }
// else{
// array_push($items_list, NULL);
// }
// }
// else{
// array_push($items_list, NULL);
// }
// }
// array_push($order_item, $items_list);
// }
// return [
// 'pagination' => $pagination,
// 'order_item' => $order_item
// ];
// }
/**
* 購入履歴詳細を表示する.
*
* @Route("/mypage/history/{order_no}", name="mypage_history", methods={"GET"})
* @Template("Mypage/history.twig")
*/
public function history(Request $request, $order_no)
{
$this->entityManager->getFilters()
->enable('incomplete_order_status_hidden');
$Order = $this->orderRepository->findOneBy(
[
'order_no' => $order_no,
'Customer' => $this->getUser(),
]
);
$event = new EventArgs(
[
'Order' => $Order,
],
$request
);
$this->eventDispatcher->dispatch(EccubeEvents::FRONT_MYPAGE_MYPAGE_HISTORY_INITIALIZE, $event);
/** @var Order $Order */
$Order = $event->getArgument('Order');
if (!$Order) {
throw new NotFoundHttpException();
}
$stockOrder = true;
foreach ($Order->getOrderItems() as $orderItem) {
if ($orderItem->isProduct() && $orderItem->getQuantity() < 0) {
$stockOrder = false;
break;
}
}
$orders = $this->orderItemRepositoryExtension->CustomFindWithID($Order['id']);
$custom_images = array();
foreach($orders as $item ){
if(str_contains($item->getProductName(), 'カスタム') || str_contains($item->getProductName(), '七宝リング')){
$code = $item->getProductCode();
$product_name = $item->getProductName();
$is_repair = false;
if($product_name == 'カスタム修理'){
$repair = $this->repairRepository->repairFindWithID($code)[0];
$product_id = $repair->getProductId();
$prod = $this->customProductRepository->customProductFind($product_id)[0];
$product_name = $prod->getName();
if(str_contains($product_name,'カスタム') || str_contains($product_name,'七宝リング')){
$code = $repair->getCustomId();
$is_repair = true;
}
else{
$item_id = $repair->getOriginalProductClassId();
$item = $this->productClassRepository->find($item_id);
//$temp = null;
$is_repair = true;
// $temp['base'] = null;
// $temp['repair'] = $is_repair;
// $temp['prod'] = $item->getProduct();
// array_push($custom_images,$temp);
// break;
}
}
switch($product_name){
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_RING):
$custom = $this->customRingRepository->CustomFindWithID($code)[0];
$ring = $this->ringRepository->CustomFindWithID($custom->getRingBaseId())[0];
$socket = $ring->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel2_name = $jewel2->getJewelName();
$jewel2_image = $jewel2->getImageName();
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
$jewel_part2_name = $jewel_part2->getJewelPartName();
$jewel_part2_image = $jewel_part2->getImageName();
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$temp['output_image'] = 'customOutput/customRing/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/ring/'.$ring->getRingShape() .'/'. $ring->getRingType() .'/'. $ring->getImageName();
$temp['base_name'] = $ring->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
}
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_PIERCE):
$custom = $this->customPierceRepository->CustomFindWithID($code)[0];
$pierce = $this->pierceRepository->CustomFindWithID($custom->getPierceBaseId())[0];
$socket = $pierce->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$catchy = $this->catchyRepository->CustomFindWithID($custom->getCatchyId())[0];
$temp['output_image'] = 'customOutput/customPierce/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/pierce/'.$pierce->getPierceShape() .'/'. $pierce->getPierceType() .'/'. $pierce->getImageName();
$temp['base_name'] = $pierce->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
}
$temp['catchy'] = 'customRing/catchy/'.$catchy->getImageName();
$temp['catchy_name'] = $catchy->getName();
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_BROOCH):
$custom = $this->customBroochRepository->CustomFindWithID($code)[0];
$brooch = $this->broochRepository->CustomFindWithID($custom->getBroochBaseId())[0];
$socket = $brooch->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
$temp['output_image'] = 'customOutput/customBrooch/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/brooch/'.$brooch->getBroochShape() .'/'. $brooch->getBroochType() .'/list/'. $brooch->getImageName();
$temp['base_name'] = $brooch->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_SHIPPORING):
$custom = $this->customShippoRingRepository->CustomFindWithID($code)[0];
$shippoRing = $this->shippoRingRepository->CustomFindWithID($custom->getRingBaseId())[0];
$temp['output_image'] = 'customOutput/ShippoRing/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/shippoRing/'.$shippoRing->getShippoRingShape() .'/'. $shippoRing->getShippoRingType() .'/'. $shippoRing->getShippoRingColor() .'/' . $shippoRing->getImageName();
$temp['base_name'] = $shippoRing->getShippoRingName();
$temp['jewel1_path'] = null;
$temp['jewel1_name'] = null;
$temp['jewel_part1_path'] = null;
$temp['jewel_part1_name'] = null;
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_PENDANT):
$custom = $this->customPendantRepository->CustomFindWithID($code)[0];
$pendant = $this->pendantRepository->CustomFindWithID($custom->getPendantBaseId())[0];
$socket = $pendant->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
$adjuster =$this->adjusterRepository->CustomFindWithID($custom->getAdjusterId())[0];
$chain = $this->necklaceRepository->CustomFindWithID($custom->getPendantChainId())[0];
if($custom->getHikiwaId() != 0){
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
}
else{
$rakuwa = $this->rakuwaRepository->CustomFindWithID($custom->getRakuwaId())[0];
$temp['hikiwa'] = 'customRing/rakuwa/' . $rakuwa->getRakuwaShape() . '/'. $rakuwa->getRakuwaType() . '/'. $rakuwa->getImageName();
$temp['hikiwa_name'] = $rakuwa->getRakuwaName();
}
$temp['output_image'] = 'customOutput/customPendant/' . $custom->getOutputImage();
$temp['pendant'] = 'customRing/pendant/'.$pendant->getPendantShape() .'/'. $pendant->getPendantType() .'/list/'. $pendant->getImageName();
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/necklace/'.$chain->getNecklaceShape() .'/'. $chain->getNecklaceType() .'/list/'. $chain->getImageName();
$temp['base_name'] = $chain->getNecklaceName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['adjuster'] = 'customRing/adjuster/' . $adjuster->getAdjusterShape() . '/' . $adjuster->getAdjusterType() . '/' . $adjuster->getImageName();
$temp['adjuster_name'] = $adjuster->getAdjusterName();
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_NECKLACE):
$custom = $this->customNecklaceRepository->CustomFindWithID($code)[0];
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
$chain = $this->necklaceRepository->CustomFindWithID($custom->getNecklaceBaseId())[0];
if($custom->getHikiwaId() != 0){
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
}
else{
$rakuwa = $this->rakuwaRepository->CustomFindWithID($custom->getRakuwaId())[0];
$temp['hikiwa'] = 'customRing/rakuwa/' . $rakuwa->getRakuwaShape() . '/'. $rakuwa->getRakuwaType() . '/'. $rakuwa->getImageName();
$temp['hikiwa_name'] = $rakuwa->getRakuwaName();
}
$temp['output_image'] = 'customOutput/customNecklace/' . $custom->getOutputImage();
$temp['pendant'] =null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/necklace/'.$chain->getNecklaceShape() .'/'. $chain->getNecklaceType() .'/list/'. $chain->getImageName();
$temp['base_name'] = $chain->getNecklaceName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_EARRING):
$custom = $this->customEarringRepository->CustomFindWithID($code)[0];
$earring = $this->earringRepository->CustomFindWithID($custom->getEarringBaseId())[0];
$socket = $earring->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$custom = $this->customEarringRepository->CustomFindWithID($custom)[0];
$earring = $this->earringRepository->CustomFindWithID($custom->getEarringBaseId())[0];
$socket = $earring->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$temp['output_image'] = 'customOutput/customEarring/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/earring/'.$earring->getEarringShape() .'/'. $earring->getEarringType() .'/list/'. $earring->getImageName();
$temp['base_name'] = $earring->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
}
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_BREATHED):
$custom = $this->customBreathredRepository->CustomFindWithID($code)[0];
$breathred = $this->breathredRepository->CustomFindWithID($custom->getBreathredBaseId())[0];
$socket = $breathred->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
$adjuster =$this->adjusterRepository->CustomFindWithID($custom->getAdjusterId())[0];
$temp['output_image'] = 'customOutput/customBreathred/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/breathred/'.$breathred->getBreathredShape() .'/'. $breathred->getBreathredType() .'/list/'. $breathred->getImageName();
$temp['base_name'] = $breathred->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
}
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();;
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
$temp['adjuster'] = 'customRing/adjuster/' . $adjuster->getAdjusterShape() . '/' . $adjuster->getAdjusterType() . '/' . $adjuster->getImageName();
$temp['adjuster_name'] = $adjuster->getAdjusterName();
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
default:
$temp['output_image'] = $item->getProduct()->getProductImage()[0];
$temp['pendant'] =null;
$temp['pendant_name'] = null;
$temp['base_path'] = null;
$temp['base_name'] = null;
$temp['jewel1_path'] = null;
$temp['jewel1_name'] = null;
$temp['jewel_part1_path'] = null;
$temp['jewel_part1_name'] = null;
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['repair'] = $is_repair;
array_push($custom_images,$temp);
break;
}
}
}
return [
'Order' => $Order,
'stockOrder' => $stockOrder,
'order_item' => $custom_images
];
}
/**
* 再購入を行う.
*
* @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(
[
'order_no' => $order_no,
'Customer' => $Customer,
]
);
$event = new EventArgs(
[
'Order' => $Order,
'Customer' => $Customer,
],
$request
);
$this->eventDispatcher->dispatch(EccubeEvents::FRONT_MYPAGE_MYPAGE_ORDER_INITIALIZE, $event);
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());
// 明細の正規化
$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(EccubeEvents::FRONT_MYPAGE_MYPAGE_ORDER_COMPLETE, $event);
if ($event->getResponse() !== null) {
return $event->getResponse();
}
log_info('再注文完了', [$order_no]);
return $this->redirect($this->generateUrl('cart'));
}
/**
* お気に入り商品を表示する.
*
* @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(EccubeEvents::FRONT_MYPAGE_MYPAGE_FAVORITE_SEARCH, $event);
$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(EccubeEvents::FRONT_MYPAGE_MYPAGE_DELETE_COMPLETE, $event);
log_info('お気に入り商品削除完了', [$Customer->getId(), $CustomerFavoriteProduct->getId()]);
return $this->redirect($this->generateUrl('mypage_favorite'));
}
/**
*
*
* @Route("/mypage/start_customize", name="start_customize", methods={"POST"})
*/
public function customize(Request $request)
{
if ($request->isXmlHttpRequest()) {
$doct = $this->getDoctrine()->getManager();
$product_id = intval($request->request->get('product_id'));
$custom_id = intval($request->request->get('product_code'));
$product = $this->customProductRepository->customProductFind($product_id)[0];
$product_name = $product->getName();
switch($product_name){
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_RING):
$custom = $this->customRingRepository->CustomFindWithID($custom_id)[0];
$ring = $this->ringRepository->CustomFindWithID($custom->getRingBaseId())[0];
$socket = $ring->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$t = $custom->getEmpty();
if($t){
$t = unserialize($t);
$temp['empty'] = $t;
}else{
$temp['empty'] = null;
}
$temp['output_image'] = 'customOutput/customRing/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/ring/'.$ring->getRingShape() .'/'. $ring->getRingType() .'/'. $ring->getImageName();
$temp['base_name'] = $ring->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
$temp['jewel2_id'] = $jewel2->getId();
$temp['jewel_part2_id'] = $jewel_part2->getId();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['jewel2_id'] = null;
$temp['jewel_part2_id'] = null;
}
$temp['size'] = $ring->getSize();
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['pendant_id'] = null;
$temp['base_id'] = $ring->getId();
$temp['base_type'] = 'ring';
$temp['jewel1_id'] = $jewel1->getId();
$temp['jewel_part1_id'] = $jewel_part1->getId();
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_PIERCE):
$custom = $this->customPierceRepository->CustomFindWithID($custom_id)[0];
$pierce = $this->pierceRepository->CustomFindWithID($custom->getPierceBaseId())[0];
$socket = $pierce->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$t = $custom->getEmpty();
if($t){
$t = unserialize($t);
$temp['empty'] = $t;
}else{
$temp['empty'] = null;
}
$catchy = $this->catchyRepository->CustomFindWithID($custom->getCatchyId())[0];
$temp['output_image'] = 'customOutput/customPierce/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/pierce/'.$pierce->getPierceShape() .'/'. $pierce->getPierceType() .'/'. $pierce->getImageName();
$temp['base_name'] = $pierce->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
$temp['jewel2_id'] = $jewel2->getId();
$temp['jewel_part2_id'] = $jewel_part2->getId();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['jewel2_id'] = null;
$temp['jewel_part2_id'] = null;
}
$temp['size'] = null;
$temp['catchy'] = 'customRing/catchy/'.$catchy->getImageName();
$temp['catchy_name'] = $catchy->getName();
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['pendant_id'] = null;
$temp['base_id'] = $pierce->getId();
$temp['base_type'] = 'pierce';
$temp['jewel1_id'] = $jewel1->getId();
$temp['jewel_part1_id'] = $jewel_part1->getId();
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_BROOCH):
$custom = $this->customBroochRepository->CustomFindWithID($custom_id)[0];
$brooch = $this->broochRepository->CustomFindWithID($custom->getBroochBaseId())[0];
$socket = $brooch->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
$t = $custom->getEmpty();
if($t){
$t = unserialize($t);
$temp['empty'] = $t;
}else{
$temp['empty'] = null;
}
$temp['output_image'] = 'customOutput/customBrooch/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/brooch/'.$brooch->getBroochShape() .'/'. $brooch->getBroochType() .'/list/'. $brooch->getImageName();
$temp['base_name'] = $brooch->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['jewel2_id'] = null;
$temp['jewel_part2_id'] = null;
$temp['size'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['pendant_id'] = null;
$temp['base_id'] = $brooch->getId();
$temp['base_type'] = 'brooch';
$temp['jewel1_id'] = $jewel1->getId();
$temp['jewel_part1_id'] = $jewel_part1->getId();
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_SHIPPORING):
$custom = $this->customShippoRingRepository->CustomFindWithID($custom_id)[0];
$shippoRing = $this->shippoRingRepository->CustomFindWithID($custom->getRingBaseId())[0];
$temp['output_image'] = 'customOutput/ShippoRing/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/shippoRing/'.$shippoRing->getShippoRingShape() .'/'. $shippoRing->getShippoRingType() .'/'. $shippoRing->getShippoRingColor() .'/' . $shippoRing->getImageName();
$temp['base_name'] = $shippoRing->getShippoRingName();
$temp['jewel1_path'] = null;
$temp['jewel1_name'] = null;
$temp['jewel_part1_path'] = null;
$temp['jewel_part1_name'] = null;
$temp['jewel2_id'] = null;
$temp['jewel_part2_id'] = null;
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['size'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['pendant_id'] = null;
$temp['base_id'] = $shippoRing->getId();
$temp['base_type'] = 'shippoRing';
$temp['jewel1_id'] =null;
$temp['jewel_part1_id'] = null;
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_PENDANT):
$custom = $this->customPendantRepository->CustomFindWithID($custom_id)[0];
$pendant = $this->pendantRepository->CustomFindWithID($custom->getPendantBaseId())[0];
$socket = $pendant->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
$t = $custom->getEmpty();
if($t){
$t = unserialize($t);
$temp['empty'] = $t;
}else{
$temp['empty'] = null;
}
$adjuster =$this->adjusterRepository->CustomFindWithID($custom->getAdjusterId())[0];
$chain = $this->necklaceRepository->CustomFindWithID($custom->getPendantChainId())[0];
if($custom->getHikiwaId() != 0){
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
}else{
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getRakuwaId())[0];
}
$temp['output_image'] = 'customOutput/customPendant/' . $custom->getOutputImage();
$temp['pendant'] = 'customRing/pendant/'.$pendant->getPendantShape() .'/'. $pendant->getPendantType() .'/list/'. $pendant->getImageName();
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/necklace/'.$chain->getNecklaceShape() .'/'. $chain->getNecklaceType() .'/list/'. $chain->getImageName();
$temp['base_name'] = $chain->getNecklaceName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['jewel2_id'] = null;
$temp['jewel_part2_id'] = null;
$temp['size'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
$temp['adjuster'] = 'customRing/adjuster/' . $adjuster->getAdjusterShape() . '/' . $adjuster->getAdjusterType() . '/' . $adjuster->getImageName();
$temp['adjuster_name'] = $adjuster->getAdjusterName();
$temp['pendant_id'] = $pendant->getId();
$temp['base_id'] = $chain->getId();
$temp['base_type'] = 'necklace';
$temp['jewel1_id'] = $jewel1->getId();
$temp['jewel_part1_id'] = $jewel_part1->getId();
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_NECKLACE):
$custom = $this->customNecklaceRepository->CustomFindWithID($custom_id)[0];
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
$t = $custom->getEmpty();
if($t){
$t = unserialize($t);
$temp['empty'] = $t;
}else{
$temp['empty'] = null;
}
$chain = $this->necklaceRepository->CustomFindWithID($custom->getNecklaceBaseId())[0];
if($custom->getHikiwaId() != 0){
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
}else{
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getRakuwaId())[0];
}
$temp['output_image'] = 'customOutput/customNecklace/' . $custom->getOutputImage();
$temp['pendant'] =null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/necklace/'.$chain->getNecklaceShape() .'/'. $chain->getNecklaceType() .'/list/'. $chain->getImageName();
$temp['base_name'] = $chain->getNecklaceName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['jewel2_id'] = null;
$temp['jewel_part2_id'] = null;
$temp['size'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['pendant_id'] = null;
$temp['base_id'] = $chain->getId();
$temp['base_type'] = 'necklace';
$temp['jewel1_id'] = $jewel1->getId();
$temp['jewel_part1_id'] = $jewel_part1->getId();
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_EARRING):
$custom = $this->customEarringRepository->CustomFindWithID($custom_id)[0];
$earring = $this->earringRepository->CustomFindWithID($custom->getEarringBaseId())[0];
$socket = $earring->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
$t = $custom->getEmpty();
if($t){
$t = unserialize($t);
$temp['empty'] = $t;
}else{
$temp['empty'] = null;
}
$temp['output_image'] = 'customOutput/customEarring/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/earring/'.$earring->getEarringShape() .'/'. $earring->getEarringType() .'/list/'. $earring->getImageName();
$temp['base_name'] = $earring->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
$temp['jewel2_id'] = $jewel2->getId();
$temp['jewel_part2_id'] = $jewel_part2->getId();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['jewel2_id'] = null;
$temp['jewel_part2_id'] = null;
}
$temp['size'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['pendant_id'] = null;
$temp['base_id'] = $earring->getId();
$temp['base_type'] = 'earring';
$temp['jewel1_id'] = $jewel1->getId();
$temp['jewel_part1_id'] = $jewel_part1->getId();
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
case $product_name == trans(CustomizeEvents::ADMIN_PRODUCT_CUSTOM_BREATHED):
$custom = $this->customBreathredRepository->CustomFindWithID($custom_id)[0];
$breathred = $this->breathredRepository->CustomFindWithID($custom->getBreathredBaseId())[0];
$socket = $breathred->getSocket();
$jewel1 = $this->jewelRepository->CustomFindWithID($custom->getJewelId())[0];
$jewel_part1 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId())[0];
if($jewel1->getJewelShape() == 'Only'){
$jewel_part1_shape = 'only';
}
else{
$jewel_part1_shape = '11';
}
if($socket == 2){
$jewel2 = $this->jewelRepository->CustomFindWithID($custom->getJewelId2())[0];
$jewel_part2 = $this->jewelPartRepository->CustomFindWithID($custom->getJewelPartId2())[0];
if($jewel2->getJewelShape() == 'Only'){
$jewel_part2_shape = 'only';
}
else{
$jewel_part2_shape = '11';
}
}
if($custom->getHikiwaId() != 0){
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getHikiwaId())[0];
}else{
$hikiwa = $this->hikiwaRepository->CustomFindWithID($custom->getRakuwaId())[0];
}
$adjuster =$this->adjusterRepository->CustomFindWithID($custom->getAdjusterId())[0];
$t = $custom->getEmpty();
if($t){
$t = unserialize($t);
$temp['empty'] = $t;
}else{
$temp['empty'] = null;
}
$temp['output_image'] = 'customOutput/customBreathred/' . $custom->getOutputImage();
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = 'customRing/breathred/'.$breathred->getBreathredShape() .'/'. $breathred->getBreathredType() .'/list/'. $breathred->getImageName();
$temp['base_name'] = $breathred->getName();
$temp['jewel1_path'] = 'customRing/jewel/list/'.$jewel1->getImageName();
$temp['jewel1_name'] = $jewel1->getName();
$temp['jewel_part1_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part1_shape.'/'.$jewel_part1->getImageName();
$temp['jewel_part1_name'] = $jewel_part1->getname();
if($socket == 2){
$temp['jewel2_path'] = 'customRing/jewel/list/'.$jewel2->getImageName();
$temp['jewel_part2_path'] = 'customRing/jewel/jewelPart/list/'.$jewel_part2_shape.'/'.$jewel_part2->getImageName();
$temp['jewel2_name'] = $jewel2->getName();
$temp['jewel_part2_name'] = $jewel_part2->getname();
$temp['jewel2_id'] = $jewel2->getId();
$temp['jewel_part2_id'] = $jewel_part2->getId();
}
else{
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['jewel2_id'] = null;
$temp['jewel_part2_id'] = null;
}
$temp['size'] = null;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = 'customRing/hikiwa/' . $hikiwa->getHikiwaShape() . '/'. $hikiwa->getHikiwaType() . '/'. $hikiwa->getImageName();;
$temp['hikiwa_name'] = $hikiwa->getHikiwaName();
$temp['adjuster'] = 'customRing/adjuster/' . $adjuster->getAdjusterShape() . '/' . $adjuster->getAdjusterType() . '/' . $adjuster->getImageName();
$temp['adjuster_name'] = $adjuster->getAdjusterName();
$temp['pendant_id'] = null;
$temp['base_id'] = $breathred->getId();
$temp['base_type'] = 'breathred';
$temp['jewel1_id'] = $jewel1->getId();
$temp['jewel_part1_id'] = $jewel_part1->getId();
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
default:
$product_class = $this->productClassRepository->FindWithID($product_class_id);
$product_class = $product_class[0];
if($product_class->getClassCategory1() != null){
$class_id = $product_class->getClassCategory1()->getId();
$class = $this->classCategoryRepository->FindWithID($class_id);
$class = $class[0];
$ring_size = 0.5;
try{
$ring_size = floatval($class->getBackendName());
} catch( Exception $ex ){
}
}
else{
$ring_size = 0.5;
}
$temp['output_image'] = $product->getProductImage()[0];
$temp['pendant'] = null;
$temp['pendant_name'] = null;
$temp['base_path'] = null;
$temp['base_name'] = $product->getName();
$temp['jewel1_path'] = null;
$temp['jewel1_name'] = null;
$temp['jewel_part1_path'] = null;
$temp['jewel_part1_name'] = null;
$temp['jewel2_path'] = null;
$temp['jewel2_name'] = null;
$temp['jewel_part2_path'] = null;
$temp['jewel_part2_name'] = null;
$temp['size'] = $ring_size;
$temp['catchy'] = null;
$temp['catchy_name'] = null;
$temp['hikiwa'] = null;
$temp['hikiwa_name'] = null;
$temp['adjuster'] = null;
$temp['adjuster_name'] = null;
$temp['product_name'] = $product_name;
$temp['custom_id'] = $custom_id;
break;
}
return new JsonResponse(array('status' => 'done', 'custom' => $temp ),200);
#$session->set('jewel_rotation', $rotation);
#return new JsonResponse(array('status' => 'done'), 200);
}
return new JsonResponse(array('status' => 'Error'), 400);
}
/**
*
*
* @Route("/mypage/customize_selected", name="customize_selected", methods={"POST"})
*/
public function customizeSelected(Request $request)
{
if ($request->isXmlHttpRequest()) {
$session = $request->getSession();
$customize_id = $request->request->get('customize_part_id');
$customize_type = $request->request->get('customize_part_type');
$customize_product_name = $request->request->get('customize_product_name');
$customize_custom_id = $request->request->get('customize_custom_id');
$customize_jewel = $request->request->get('customize_jewel');
$session->set('customize_part_id', $customize_id);
$session->set('customize_part_type', $customize_type);
$session->set('customize_product_name', $customize_product_name);
$session->set('customize_custom_id', $customize_custom_id);
$session->set('customize_jewel', $customize_jewel);
return new JsonResponse(array('status' => 'done'),200);
#return new JsonResponse(array('status' => 'done'), 200);
}
return new JsonResponse(array('status' => 'Error'), 400);
}
}