app/Customize/Controller/AnerosPageController.php line 487

Open in your IDE?
  1. <?php
  2. namespace Customize\Controller;
  3. use Eccube\Controller\AbstractController;
  4. use Eccube\Entity\BaseInfo;
  5. use Eccube\Entity\Master\ProductStatus;
  6. use Eccube\Entity\Product;
  7. use Eccube\Event\EccubeEvents;
  8. use Eccube\Event\EventArgs;
  9. use Eccube\Form\Type\AddCartType;
  10. use Eccube\Form\Type\Master\ProductListMaxType;
  11. use Eccube\Form\Type\Master\ProductListOrderByType;
  12. use Eccube\Form\Type\SearchProductType;
  13. use Eccube\Repository\BaseInfoRepository;
  14. use Eccube\Repository\CustomerFavoriteProductRepository;
  15. use Eccube\Repository\Master\ProductListMaxRepository;
  16. use Eccube\Repository\ProductRepository;
  17. use Eccube\Service\CartService;
  18. use Eccube\Service\PurchaseFlow\PurchaseContext;
  19. use Eccube\Service\PurchaseFlow\PurchaseFlow;
  20. use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
  21. use Knp\Component\Pager\Paginator;
  22. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  23. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  24. use Symfony\Component\HttpFoundation\Request;
  25. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  26. use Symfony\Component\Routing\Annotation\Route;
  27. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  28. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  29. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  30. class AnerosPageController extends AbstractController
  31. {
  32.     /**
  33.      * @var PurchaseFlow
  34.      */
  35.     protected $purchaseFlow;
  36.     /**
  37.      * @var CustomerFavoriteProductRepository
  38.      */
  39.     protected $customerFavoriteProductRepository;
  40.     /**
  41.      * @var CartService
  42.      */
  43.     protected $cartService;
  44.     /**
  45.      * @var ProductRepository
  46.      */
  47.     protected $productRepository;
  48.     /**
  49.      * @var BaseInfo
  50.      */
  51.     protected $BaseInfo;
  52.     /**
  53.      * @var AuthenticationUtils
  54.      */
  55.     protected $helper;
  56.     /**
  57.      * @var ProductListMaxRepository
  58.      */
  59.     protected $productListMaxRepository;
  60.     private $title '';
  61.     /**
  62.      * ProductController constructor.
  63.      *
  64.      * @param PurchaseFlow $cartPurchaseFlow
  65.      * @param CustomerFavoriteProductRepository $customerFavoriteProductRepository
  66.      * @param CartService $cartService
  67.      * @param ProductRepository $productRepository
  68.      * @param BaseInfoRepository $baseInfoRepository
  69.      * @param AuthenticationUtils $helper
  70.      * @param ProductListMaxRepository $productListMaxRepository
  71.      */
  72.     public function __construct(
  73.         PurchaseFlow $cartPurchaseFlow,
  74.         CustomerFavoriteProductRepository $customerFavoriteProductRepository,
  75.         CartService $cartService,
  76.         ProductRepository $productRepository,
  77.         BaseInfoRepository $baseInfoRepository,
  78.         AuthenticationUtils $helper,
  79.         ProductListMaxRepository $productListMaxRepository,
  80.         ParameterBagInterface $params
  81.     ) {
  82.         $this->purchaseFlow $cartPurchaseFlow;
  83.         $this->customerFavoriteProductRepository $customerFavoriteProductRepository;
  84.         $this->cartService $cartService;
  85.         $this->productRepository $productRepository;
  86.         $this->BaseInfo $baseInfoRepository->get();
  87.         $this->helper $helper;
  88.         $this->productListMaxRepository $productListMaxRepository;
  89.         $this->params $params;
  90.     }
  91.     /**
  92.      * 商品詳細画面.
  93.      *
  94.      * @Route("/sample", name="sample", methods={"GET"})
  95.      * @Template("Category/prostate-massagers.twig")
  96.      *
  97.      * @param Request $request
  98.      *
  99.      * @return array
  100.      */
  101.     public function detail(Request $request)
  102.     {
  103.         
  104.         $Product $this->productRepository->findWithSortedClassCategories(43);
  105.         
  106.         if (!$this->checkVisibility($Product)) {
  107.             throw new NotFoundHttpException();
  108.         }
  109.         $builder $this->formFactory->createNamedBuilder(
  110.             '',
  111.             AddCartType::class,
  112.             null,
  113.             [
  114.                 'product' => $Product,
  115.                 'id_add_product_id' => false,
  116.             ]
  117.         );
  118.         $event = new EventArgs(
  119.             [
  120.                 'builder' => $builder,
  121.                 'Product' => $Product,
  122.             ],
  123.             $request
  124.         );
  125.         $this->eventDispatcher->dispatch(EccubeEvents::FRONT_PRODUCT_DETAIL_INITIALIZE$event);
  126.         $is_favorite false;
  127.         if ($this->isGranted('ROLE_USER')) {
  128.             $Customer $this->getUser();
  129.             $is_favorite $this->customerFavoriteProductRepository->isFavorite($Customer$Product);
  130.         }
  131.         return [
  132.             'title' => $this->title,
  133.             'subtitle' => $Product->getName(),
  134.             'form' => $builder->getForm()->createView(),
  135.             'Product' => $Product,
  136.             'is_favorite' => $is_favorite,
  137.         ];
  138.     }
  139.     /**
  140.      * @Route("/forcelogin", name="forcelogin")
  141.      */
  142.     public function redirectToCartAndForceLogin()
  143.     {
  144.         $params = array('utm_source' => 'dc-mail''utm_medium' => 'email''utm_campaign' => 'dc-1''utm_content' => 'cart-check');
  145.         if ($this->isGranted('ROLE_USER')) {
  146.             // すでにログインしているときはカートページにリダイレクト
  147.             return $this->redirectToRoute('cart'$params);
  148.         } else {
  149.             // ログインされていないときは、ログイン後にカートへリダイレクト
  150.             $this->setLoginTargetPath($this->generateUrl('cart', [], UrlGeneratorInterface::ABSOLUTE_URL));
  151.             return $this->redirectToRoute('mypage_login'$params);
  152.         }
  153.     }
  154.     /**
  155.      * @Route("/forcelogin-2", name="forcelogin-2")
  156.      */
  157.     public function redirectToCartAndForceLogin2()
  158.     {
  159.         $params = array('utm_source' => 'dc-mail''utm_medium' => 'email''utm_campaign' => 'dc-1''utm_content' => 'cart-check-end');
  160.         if ($this->isGranted('ROLE_USER')) {
  161.             // すでにログインしているときはカートページにリダイレクト
  162.             return $this->redirectToRoute('cart'$params);
  163.         } else {
  164.             // ログインされていないときは、ログイン後にカートへリダイレクト
  165.             $this->setLoginTargetPath($this->generateUrl('cart', [], UrlGeneratorInterface::ABSOLUTE_URL));
  166.             return $this->redirectToRoute('mypage_login'$params);
  167.         }
  168.     }
  169.     /**
  170.      * 前立腺マッサージ器.
  171.      *
  172.      * @Route("/prostate-massagers", name="prostate-massagers", methods={"GET"})
  173.      * @Template("Category/prostate-massagers.twig")
  174.      *
  175.      * @param Request $request
  176.      *
  177.      * @return array
  178.      */
  179.     public function prostateMassagers(Request $request)
  180.     {
  181.         return [];
  182.     }
  183.     /**
  184.      * アネロスアクセサリー.
  185.      *
  186.      * @Route("/accessories", name="accessories", methods={"GET"})
  187.      * @Template("Category/accessories.twig")
  188.      *
  189.      * @param Request $request
  190.      *
  191.      * @return array
  192.      */
  193.     public function accessories(Request $request)
  194.     {
  195.         return [];
  196.     }
  197.     /**
  198.      * 男性用商品.
  199.      *
  200.      * @Route("/sex-toys-for-men", name="sex-toys-for-men", methods={"GET"})
  201.      * @Template("Category/sex-toys-for-men.twig")
  202.      *
  203.      * @param Request $request
  204.      *
  205.      * @return array
  206.      */
  207.     public function sextoysformen(Request $request)
  208.     {
  209.         return [];
  210.     }
  211.     /**
  212.      * 女性用商品.
  213.      *
  214.      * @Route("/sex-toys-for-women", name="sex-toys-for-women", methods={"GET"})
  215.      * @Template("Category/sex-toys-for-women.twig")
  216.      *
  217.      * @param Request $request
  218.      *
  219.      * @return array
  220.      */
  221.     public function sextoysforwomen(Request $request)
  222.     {
  223.         return [];
  224.     }
  225.     /**
  226.      * カップル用商品.
  227.      *
  228.      * @Route("/sex-toys-for-couples", name="sex-toys-for-couples", methods={"GET"})
  229.      * @Template("Category/sex-toys-for-couples.twig")
  230.      *
  231.      * @param Request $request
  232.      *
  233.      * @return array
  234.      */
  235.     public function sextoysforcouples(Request $request)
  236.     {
  237.         return [];
  238.     }
  239.     /**
  240.      * ローション.
  241.      *
  242.      * @Route("/lubricants", name="lubricants", methods={"GET"})
  243.      * @Template("Category/lubricants.twig")
  244.      *
  245.      * @param Request $request
  246.      *
  247.      * @return array
  248.      */
  249.     public function lubricants(Request $request)
  250.     {
  251.         return [];
  252.     }
  253.     /**
  254.      * マスターベーション.
  255.      *
  256.      * @Route("/masturbators", name="masturbators", methods={"GET"})
  257.      * @Template("Category/masturbators.twig")
  258.      *
  259.      * @param Request $request
  260.      *
  261.      * @return array
  262.      */
  263.     public function masturbators(Request $request)
  264.     {
  265.         return [];
  266.     }
  267.     /**
  268.      * お買い得セット.
  269.      *
  270.      * @Route("/special-offers", name="special-offers", methods={"GET"})
  271.      * @Template("Category/special-offers.twig")
  272.      *
  273.      * @param Request $request
  274.      *
  275.      * @return array
  276.      */
  277.     public function specialoffers(Request $request)
  278.     {
  279.         return [];
  280.     }
  281.     /**
  282.      * アネロス トライデント シリーズ.
  283.      *
  284.      * @Route("/trident-series", name="trident-series", methods={"GET"})
  285.      * @Template("Category/trident-series.twig")
  286.      *
  287.      * @param Request $request
  288.      *
  289.      * @return array
  290.      */
  291.     public function tridentseries(Request $request)
  292.     {
  293.         return [];
  294.     }
  295.     /**
  296.      * プロガスムシリーズ.
  297.      *
  298.      * @Route("/progasm-products", name="progasm-products", methods={"GET"})
  299.      * @Template("Category/progasm-products.twig")
  300.      *
  301.      * @param Request $request
  302.      *
  303.      * @return array
  304.      */
  305.     public function progasmproducts(Request $request)
  306.     {
  307.         return [];
  308.     }
  309.     /**
  310.      * セッションズ.
  311.      *
  312.      * @Route("/sessions", name="sessions", methods={"GET"})
  313.      * @Template("Category/sessions.twig")
  314.      *
  315.      * @param Request $request
  316.      *
  317.      * @return array
  318.      */
  319.     public function sessions(Request $request)
  320.     {
  321.         return [];
  322.     }
  323.     /**
  324.      * アネロス講座.
  325.      *
  326.      * @Route("/learning-center", name="learning-center", methods={"GET"})
  327.      * @Template("learning-center/index.twig")
  328.      *
  329.      * @param Request $request
  330.      *
  331.      * @return array
  332.      */
  333.     public function learningcenter(Request $request)
  334.     {
  335.         return [];
  336.     }
  337.     /**
  338.      * アネロス講座-メンズ(複数URL).
  339.      *
  340.      * @Route("/learning-center/men/{rt}", name="learning-center-men", methods={"GET"})
  341.      * @Template("learning-center/men/index.twig")
  342.      *
  343.      * @param Request $request
  344.      *
  345.      * @return array
  346.      */
  347.     public function learningcentermen(Request $request$rt)
  348.     {
  349.         
  350.         //$tmpl_path = $this->container->getParameter('eccube_theme_front_dir');
  351.         $tmpl_path $this->params->get('eccube_theme_front_dir');
  352.         $r file_exists($tmpl_path.'/learning-center/men/'.$rt.'.twig');
  353.         if($r){
  354.             $builder $this->formFactory->createBuilder();
  355.             $form $builder->getForm();
  356.             $form->handleRequest($request);
  357.             return $this->render('learning-center/men/'.$rt.'.twig', [
  358.                 'form' => $form->createView(),
  359.             ]);
  360.         }
  361.         return $this->redirectToRoute('error404');
  362. //        throw new NotFoundHttpException();
  363.     }
  364.     /**
  365.      * アネロス講座-レディース.
  366.      *
  367.      * @Route("/learning-center/women/pelvic-floor-training", name="learning-center-women", methods={"GET"})
  368.      * @Template("learning-center/women/pelvic-floor-training.twig")
  369.      *
  370.      * @param Request $request
  371.      *
  372.      * @return array
  373.      */
  374.     public function learningcenterwomen(Request $request)
  375.     {
  376.         return [];
  377.     }
  378.     /**
  379.      * アネロス講座-ユニセックス.
  380.      *
  381.      * @Route("/learning-center/unisex/unisex-anal-stimulation", name="learning-center-unisex", methods={"GET"})
  382.      * @Template("learning-center/unisex/unisex-anal-stimulation.twig")
  383.      *
  384.      * @param Request $request
  385.      *
  386.      * @return array
  387.      */
  388.     public function learningcenterunisex(Request $request)
  389.     {
  390.         return [];
  391.     }
  392.     /**
  393.      * ドクターズボイス.
  394.      *
  395.      * @Route("/dr-voice", name="dr-voice", methods={"GET"})
  396.      * @Template("other/dr-voice.twig")
  397.      *
  398.      * @param Request $request
  399.      *
  400.      * @return array
  401.      */
  402.     public function drvoice(Request $request)
  403.     {
  404.         return [];
  405.     }
  406.     /**
  407.      * ご挨拶.
  408.      *
  409.      * @Route("/greeting", name="greeting", methods={"GET"})
  410.      * @Template("other/greeting.twig")
  411.      *
  412.      * @param Request $request
  413.      *
  414.      * @return array
  415.      */
  416.     public function greeting(Request $request)
  417.     {
  418.         return [];
  419.     }
  420.     /**
  421.      * 会社概要.
  422.      *
  423.      * @Route("/company", name="company", methods={"GET"})
  424.      * @Template("other/company.twig")
  425.      *
  426.      * @param Request $request
  427.      *
  428.      * @return array
  429.      */
  430.     public function company(Request $request)
  431.     {
  432.         return [];
  433.     }
  434.     /**
  435.      * 特許.
  436.      *
  437.      * @Route("/patent", name="patent", methods={"GET"})
  438.      * @Template("other/patent.twig")
  439.      *
  440.      * @param Request $request
  441.      *
  442.      * @return array
  443.      */
  444.     public function patent(Request $request)
  445.     {
  446.         return [];
  447.     }
  448.     /**
  449.      * 免責事項.
  450.      *
  451.      * @Route("/disclaimer", name="disclaimer", methods={"GET"})
  452.      * @Template("other/disclaimer.twig")
  453.      *
  454.      * @param Request $request
  455.      *
  456.      * @return array
  457.      */
  458.     public function disclaimer(Request $request)
  459.     {
  460.         return [];
  461.     }
  462.     /**
  463.      * プライバシーポリシー.
  464.      *
  465.      * @Route("/privacy", name="privacy", methods={"GET"})
  466.      * @Template("other/privacy.twig")
  467.      *
  468.      * @param Request $request
  469.      *
  470.      * @return array
  471.      */
  472.     public function privacy(Request $request)
  473.     {
  474.         return [];
  475.     }
  476.     /**
  477.      * ご利用条件.
  478.      *
  479.      * @Route("/terms", name="terms", methods={"GET"})
  480.      * @Template("other/terms.twig")
  481.      *
  482.      * @param Request $request
  483.      *
  484.      * @return array
  485.      */
  486.     public function terms(Request $request)
  487.     {
  488.         return [];
  489.     }
  490.     /**
  491.      * 返金保証.
  492.      *
  493.      * @Route("/refund-policy", name="refund-policy", methods={"GET"})
  494.      * @Template("other/refund-policy.twig")
  495.      *
  496.      * @param Request $request
  497.      *
  498.      * @return array
  499.      */
  500.     public function refundpolicy(Request $request)
  501.     {
  502.         return [];
  503.     }
  504.     /**
  505.      * 保証.
  506.      *
  507.      * @Route("/warranty-policy", name="warranty-policy", methods={"GET"})
  508.      * @Template("other/warranty-policy.twig")
  509.      *
  510.      * @param Request $request
  511.      *
  512.      * @return array
  513.      */
  514.     public function warrantypolicy(Request $request)
  515.     {
  516.         return [];
  517.     }
  518.     /**
  519.      * お支払方法.
  520.      *
  521.      * @Route("/payment", name="payment", methods={"GET"})
  522.      * @Template("other/payment.twig")
  523.      *
  524.      * @param Request $request
  525.      *
  526.      * @return array
  527.      */
  528.     public function payment(Request $request)
  529.     {
  530.         return [];
  531.     }
  532.     /**
  533.      * 発送方法・配達状況.
  534.      *
  535.      * @Route("/shipping", name="shipping", methods={"GET"})
  536.      * @Template("other/shipping.twig")
  537.      *
  538.      * @param Request $request
  539.      *
  540.      * @return array
  541.      */
  542.     public function shipping(Request $request)
  543.     {
  544.         return [];
  545.     }
  546.     /**
  547.      * よくある質問.
  548.      *
  549.      * @Route("/faqs", name="faqs", methods={"GET"})
  550.      * @Template("other/faqs.twig")
  551.      *
  552.      * @param Request $request
  553.      *
  554.      * @return array
  555.      */
  556.     public function faqs(Request $request)
  557.     {
  558.         return [];
  559.     }
  560.     /**
  561.      * アネロス 購入ガイド.
  562.      *
  563.      * @Route("/buyers-guide", name="buyers-guide", methods={"GET"})
  564.      * @Template("other/buyers-guide.twig")
  565.      *
  566.      * @param Request $request
  567.      *
  568.      * @return array
  569.      */
  570.     public function buyersguide(Request $request)
  571.     {
  572.         return [];
  573.     }
  574.     /**
  575.      * 【アネロス】取扱店.
  576.      *
  577.      * @Route("/shop-list", name="shop-list", methods={"GET"})
  578.      * @Template("other/shop-list.twig")
  579.      *
  580.      * @param Request $request
  581.      *
  582.      * @return array
  583.      */
  584.     public function shoplist(Request $request)
  585.     {
  586.         return [];
  587.     }
  588.     /**
  589.      * 404.
  590.      *
  591.      * @Route("/404", name="error404", methods={"GET"})
  592.      * @Template("other/error404.twig")
  593.      *
  594.      * @param Request $request
  595.      *
  596.      * @return array
  597.      */
  598.     public function error404(Request $request)
  599.     {
  600.         return [];
  601.     }
  602.     /**
  603.      * 【アネロス】取扱店.
  604.      *
  605.      * @Route("/aneros-members", name="aneros-members", methods={"GET"})
  606.      * @Template("other/aneros-members.twig")
  607.      *
  608.      * @param Request $request
  609.      *
  610.      * @return array
  611.      */
  612.     public function anerosmembers(Request $request)
  613.     {
  614.         return [];
  615.     }
  616.     
  617.     /**
  618.      * 通知メール購読解除完了.
  619.      *
  620.      * @Route("/remind-unsubscribe", name="remind-unsubscribe", methods={"GET"})
  621.      * @Template("other/remind-unsubscribe.twig")
  622.      *
  623.      * @param Request $request
  624.      *
  625.      * @return array
  626.      */
  627.     public function remindunsubscribe(Request $request)
  628.     {
  629.         return [];
  630.     }
  631.     
  632.     /**
  633.      * ANEROSタイムセール2024
  634.      *
  635.      * @Route("/timesale2024", name="timesale2024", methods={"GET"})
  636.      * @Template("Category/timesale2024.twig")
  637.      *
  638.      * @param Request $request
  639.      *
  640.      * @return array
  641.      */
  642.     public function timesale2024(Request $request)
  643.     {
  644.         return [];
  645.     }
  646.     /**
  647.      * ANEROSクリスマスセール2024
  648.      *
  649.      * @Route("/2024-xmas-sale", name="2024-xmas-sale", methods={"GET"})
  650.      * @Template("Category/2024-xmas-sale.twig")
  651.      *
  652.      * @param Request $request
  653.      *
  654.      * @return array
  655.      */
  656.     public function xmassale2024(Request $request)
  657.     {
  658.         return [];
  659.     }
  660.     
  661.     /**
  662.      * アネロスバレンタインセール2025
  663.      *
  664.      * @Route("/2025-vday-sale", name="2025-vday-sale", methods={"GET"})
  665.      * @Template("Category/2025-vday-sale.twig")
  666.      *
  667.      * @param Request $request
  668.      *
  669.      * @return array
  670.      */
  671.     public function vdaysale2025(Request $request)
  672.     {
  673.         return [];
  674.     }
  675.     
  676.     /**
  677.      * ANEROSステップアップセール2025
  678.      *
  679.      * @Route("/2025-gw-sale", name="2025-gw-sale", methods={"GET"})
  680.      * @Template("Category/2025-gw-sale.twig")
  681.      *
  682.      * @param Request $request
  683.      *
  684.      * @return array
  685.      */
  686.     public function gwsale2025(Request $request)
  687.     {
  688.         return [];
  689.     }
  690.     /**
  691.      * ANEROS SUMMER SALE 2025
  692.      *
  693.      * @Route("/2025-summer-sale", name="2025-summer-sale", methods={"GET"})
  694.      * @Template("Category/2025-summer-sale.twig")
  695.      *
  696.      * @param Request $request
  697.      *
  698.      * @return array
  699.      */
  700.     public function summersale2025(Request $request)
  701.     {
  702.         return [];
  703.     }
  704.     
  705.     /**
  706.      * アネロスタイムセール2025
  707.      *
  708.      * @Route("/2025-time-sale", name="2025-time-sale", methods={"GET"})
  709.      * @Template("Category/2025-time-sale.twig")
  710.      *
  711.      * @param Request $request
  712.      *
  713.      * @return array
  714.      */
  715.     public function timesale2025(Request $request)
  716.     {
  717.         return [];
  718.     }
  719.     
  720.     /**
  721.      * アネロスブラックフライデー2025
  722.      *
  723.      * @Route("/2025-black-friday-sale", name="2025-black-friday-sale", methods={"GET"})
  724.      * @Template("Category/2025-black-friday-sale.twig")
  725.      *
  726.      * @param Request $request
  727.      *
  728.      * @return array
  729.      */
  730.     public function bf2025(Request $request)
  731.     {
  732.         return [];
  733.     }
  734.     
  735.     /**
  736.      * アネロスクリスマスセール2025
  737.      *
  738.      * @Route("/2025-xmas-sale", name="2025-xmas-sale", methods={"GET"})
  739.      * @Template("Category/2025-xmas-sale.twig")
  740.      *
  741.      * @param Request $request
  742.      *
  743.      * @return array
  744.      */
  745.     public function xmas2025(Request $request)
  746.     {
  747.         return [];
  748.     }
  749.     
  750.     /**
  751.      * 前立腺健康LP
  752.      *
  753.      * @Route("/lp/prostate-care", name="prostate-care", methods={"GET"})
  754.      * @Template("lp/prostate-care.twig")
  755.      *
  756.      * @param Request $request
  757.      *
  758.      * @return array
  759.      */
  760.     public function prostatecare(Request $request)
  761.     {
  762.         return [];
  763.     }
  764.     /**
  765.      * @Route("/{rt}", name="aneros_product", requirements={"rt": "^(?=([0-9a-zA-Z_\-]+\/?)+(?<!\/))(?!logout|products/add_cart|plugin|product_review|review|auth0|cart/clear|%eccube_admin_route%|install|mypage|token|api|api/oauth|shopping|gmo_payment_gateway|paidy|paidy_confirm|paidy_back|paidy_complete|paidy_cancel|introduce_friend|auth0|block|StripePaymentGateway|AmazonPayV2_42|AmazonPayV2_42/Resource/key|amazon_checkout_review|amazon_instant_payment_notifications|cart_force_login|plg_AmazonPaymentsV2_ipn_receiver.php|mail_magazine).*$"})
  766.      */
  767.     public function AnerosPageRouteMethod($rt)
  768.     {
  769.         switch ($rt) {
  770.             case 'tenga-egg':
  771.                 return $this->redirectToRoute('product_detail', array('id' => 35));
  772.                 break;
  773.             case 'tenga-soft-tube-cup':
  774.                 return $this->redirectToRoute('product_detail', array('id' => 34));
  775.                 break;
  776.             case 'tenga-deep-throat':
  777.                 return $this->redirectToRoute('product_detail', array('id' => 33));
  778.                 break;
  779.             case 'peridise-complete-set':
  780.                 return $this->redirectToRoute('product_detail', array('id' => 51));
  781.                 break;
  782.             case 'peridise':
  783.                 return $this->redirectToRoute('product_detail', array('id' => 50));
  784.                 break;
  785.             case 'tempo':
  786.                 return $this->redirectToRoute('product_detail', array('id' => 45));
  787.                 break;
  788.             case 'syn-couples-set':
  789.                 return $this->redirectToRoute('product_detail', array('id' => 52));
  790.                 break;
  791.             case 'muze':
  792.                 return $this->redirectToRoute('product_detail', array('id' => 47));
  793.                 break;
  794.             case 'evi-starter-set':
  795.                 return $this->redirectToRoute('product_detail', array('id' => 49));
  796.                 break;
  797.             case 'evi':
  798.                 return $this->redirectToRoute('product_detail', array('id' => 5));
  799.                 break;
  800.             case 'luna-beads':
  801.                 return $this->redirectToRoute('product_detail', array('id' => 32));
  802.                 break;
  803.             case 'jo-lotion-135ml':
  804.                 return $this->redirectToRoute('product_detail', array('id' => 28));
  805.                 break;
  806.             case 'jo-lotion-75ml':
  807.                 return $this->redirectToRoute('product_detail', array('id' => 27));
  808.                 break;
  809.             case 'lotion-applicator':
  810.                 return $this->redirectToRoute('product_detail', array('id' => 26));
  811.                 break;
  812.             case 'id-moments-130ml':
  813.                 return $this->redirectToRoute('product_detail', array('id' => 25));
  814.                 break;
  815.             case 'id-lotion-250ml':
  816.                 return $this->redirectToRoute('product_detail', array('id' => 24));
  817.                 break;
  818.             case 'id-lotion-130ml':
  819.                 return $this->redirectToRoute('product_detail', array('id' => 22));
  820.                 break;
  821.             case 'id-lotion-60ml':
  822.                 return $this->redirectToRoute('product_detail', array('id' => 21));
  823.                 break;
  824.             case 'id-lotion-30ml':
  825.                 return $this->redirectToRoute('product_detail', array('id' => 20));
  826.                 break;
  827.             case 'sessions-255ml':
  828.                 return $this->redirectToRoute('product_detail', array('id' => 19));
  829.                 break;
  830.             case 'sessions-125ml':
  831.                 return $this->redirectToRoute('product_detail', array('id' => 17));
  832.                 break;
  833.             case 'sessions-3-set':
  834.                 return $this->redirectToRoute('product_detail', array('id' => 15));
  835.                 break;
  836.             case 'marksman':
  837.                 return $this->redirectToRoute('product_detail', array('id' => 14));
  838.                 break;
  839.             case 'aneros-marksman-6pk':
  840.                 return $this->redirectToRoute('product_detail', array('id' => 14));
  841.                 break;
  842.             case 'syn-select-set':
  843.                 return $this->redirectToRoute('product_detail', array('id' => 48));
  844.                 break;
  845.             case 'syn-lotion-set':
  846.                 return $this->redirectToRoute('product_detail', array('id' => 31));
  847.                 break;
  848.             case 'syn-starter-set':
  849.                 return $this->redirectToRoute('product_detail', array('id' => 63));
  850.                 break;
  851.             case 'starter-set':
  852.                 return $this->redirectToRoute('product_detail', array('id' => 29));
  853.                 break;
  854.             case 'okamoto-003':
  855.                 return $this->redirectToRoute('product_detail', array('id' => 13));
  856.                 break;
  857.             case 'mini-syringe':
  858.                 return $this->redirectToRoute('product_detail', array('id' => 12));
  859.                 break;
  860.             case 'aneros-official-t-shirt':
  861.                 return $this->redirectToRoute('product_detail', array('id' => 11));
  862.                 break;
  863.             case 'antibacterial-cleaner':
  864.                 return $this->redirectToRoute('product_detail', array('id' => 10));
  865.                 break;
  866.             case 'higginson-syringe':
  867.                 return $this->redirectToRoute('product_detail', array('id' => 9));
  868.                 break;
  869.             case 'aneros-gift-bag':
  870.                 return $this->redirectToRoute('product_detail', array('id' => 8));
  871.                 break;
  872.             case 'device':
  873.                 return $this->redirectToRoute('product_detail', array('id' => 23));
  874.                 break;
  875.             case 'vice':
  876.                 return $this->redirectToRoute('product_detail', array('id' => 4));
  877.                 break;
  878.             case 'sgx-classic':
  879.                 return $this->redirectToRoute('product_detail', array('id' => 39));
  880.                 break;
  881.             case 'progasm-jr':
  882.                 return $this->redirectToRoute('product_detail', array('id' => 43));
  883.                 break;
  884.             case 'progasm-classic':
  885.                 return $this->redirectToRoute('product_detail', array('id' => 42));
  886.                 break;
  887.             case 'progasm-ice':
  888.                 return $this->redirectToRoute('product_detail', array('id' => 41));
  889.                 break;
  890.             case 'progasm-black-ice':
  891.                 return $this->redirectToRoute('product_detail', array('id' => 40));
  892.                 break;
  893.             case 'mgx-classic':
  894.                 return $this->redirectToRoute('product_detail', array('id' => 39));
  895.                 break;
  896.             case 'maximus-classic':
  897.                 return $this->redirectToRoute('product_detail', array('id' => 38));
  898.                 break;
  899.             case 'helix-syn':
  900.                 return $this->redirectToRoute('product_detail', array('id' => 3));
  901.                 break;
  902.             case 'helix-classic':
  903.                 return $this->redirectToRoute('product_detail', array('id' => 37));
  904.                 break;
  905.             case 'eupho-syn':
  906.                 return $this->redirectToRoute('product_detail', array('id' => 36));
  907.                 break;
  908.             case 'eupho-classic':
  909.                 return $this->redirectToRoute('product_detail', array('id' => 18));
  910.                 break;
  911.             case 'progasm-red-ice':
  912.                 return $this->redirectToRoute('product_detail', array('id' => 54));
  913.                 break;
  914.             case 'progasm-red':
  915.                 return $this->redirectToRoute('product_detail', array('id' => 53));
  916.                 break;
  917.             case 'aneros-wipes':
  918.                 return $this->redirectToRoute('product_detail', array('id' => 59));
  919.                 break;
  920.             case 'pouch':
  921.                 return $this->redirectToRoute('product_detail', array('id' => 60));
  922.                 break;
  923.             case 'sessions-wipes-set':
  924.                 return $this->redirectToRoute('product_detail', array('id' => 64));
  925.                 break;
  926.             case 'helix-trident':
  927.                 return $this->redirectToRoute('product_detail', array('id' => 66));
  928.                 break;
  929.             case 'maximus-trident':
  930.                 return $this->redirectToRoute('product_detail', array('id' => 67));
  931.                 break;
  932.             case 'eupho-trident':
  933.                 return $this->redirectToRoute('product_detail', array('id' => 68));
  934.                 break;
  935.             case 'mgx-trident':
  936.                 return $this->redirectToRoute('product_detail', array('id' => 69));
  937.                 break;
  938.             case 'helix-syn-trident':
  939.                 return $this->redirectToRoute('product_detail', array('id' => 70));
  940.                 break;
  941.             case 'vivi':
  942.                 return $this->redirectToRoute('product_detail', array('id' => 71));
  943.                 break;
  944.             case 'vice-2':
  945.                 return $this->redirectToRoute('product_detail', array('id' => 72));
  946.                 break;
  947.             case 'mgx-syn-trident':
  948.                 return $this->redirectToRoute('product_detail', array('id' => 73));
  949.                 break;
  950.             case 'eupho-syn-trident':
  951.                 return $this->redirectToRoute('product_detail', array('id' => 74));
  952.                 break;
  953.         }
  954.         return $this->redirectToRoute('error404');
  955. //        throw new NotFoundHttpException();
  956.     }
  957.     /**
  958.      * ページタイトルの設定
  959.      *
  960.      * @param  null|array $searchData
  961.      *
  962.      * @return str
  963.      */
  964.     protected function getPageTitle($searchData)
  965.     {
  966.         if (isset($searchData['name']) && !empty($searchData['name'])) {
  967.             return trans('front.product.search_result');
  968.         } elseif (isset($searchData['category_id']) && $searchData['category_id']) {
  969.             return $searchData['category_id']->getName();
  970.         } else {
  971.             return trans('front.product.all_products');
  972.         }
  973.     }
  974.     /**
  975.      * 閲覧可能な商品かどうかを判定
  976.      *
  977.      * @param Product $Product
  978.      *
  979.      * @return boolean 閲覧可能な場合はtrue
  980.      */
  981.     protected function checkVisibility(Product $Product)
  982.     {
  983.         $is_admin $this->session->has('_security_admin');
  984.         // 管理ユーザの場合はステータスやオプションにかかわらず閲覧可能.
  985.         if (!$is_admin) {
  986.             // 在庫なし商品の非表示オプションが有効な場合.
  987.             // if ($this->BaseInfo->isOptionNostockHidden()) {
  988.             //     if (!$Product->getStockFind()) {
  989.             //         return false;
  990.             //     }
  991.             // }
  992.             // 公開ステータスでない商品は表示しない.
  993.             if ($Product->getStatus()->getId() !== ProductStatus::DISPLAY_SHOW) {
  994.                 return false;
  995.             }
  996.         }
  997.         return true;
  998.     }
  999. }