app/Customize/Twig/Extension/CustomExtension.php line 372

Open in your IDE?
  1. <?php
  2. namespace Customize\Twig\Extension;
  3. use Customize\Entity\CacheTrait;
  4. use Customize\Service\GoodsPriceService;
  5. use Customize\Service\ReviewService;
  6. use Eccube\Entity\BaseInfo;
  7. use Eccube\Repository\BaseInfoRepository;
  8. use Eccube\Repository\PageRepository;
  9. use Lm\Engine\EC\Entity\GoodsWithRelated;
  10. use Lm\Entity\Goods;
  11. use Symfony\Component\HttpFoundation\RequestStack;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Twig\Environment as Twig;
  14. use Twig\Extension\AbstractExtension;
  15. use Twig\TwigFunction;
  16. use Twig\TwigFilter;
  17. use Symfony\Component\Security\Core\Security;
  18. use Eccube\Service\CartService;
  19. use Customize\Service\CartService as CartServiceCustomize;
  20. use Eccube\Common\EccubeConfig;
  21. use Customize\Service\CommonService;
  22. use Customize\Service\LmHelper;
  23. use Customize\Converter\DynamicConverter;
  24. use Customize\Service\RecentGoodsService;
  25. use Customize\Service\GoodsService;
  26. class CustomExtension extends AbstractExtension
  27. {
  28.     use CacheTrait;
  29.     /**
  30.      * @var Security
  31.      */
  32.     private $security;
  33.     /**
  34.      * @var CartService
  35.      */
  36.     protected $cartService;
  37.     protected $cartServiceCustomize;
  38.     protected $commonService;
  39.     /**
  40.      * @var DynamicConverter
  41.      */
  42.     protected $dynamicConverter;
  43.     const DISPLAY_ITEM_COUNT_LOW 20;
  44.     const DISPLAY_ITEM_COUNT_MID 50;
  45.     const DISPLAY_ITEM_COUNT_HI 100;
  46.     const DISPLAY_ITEM_COUNT_DEFAULT self::DISPLAY_ITEM_COUNT_MID;
  47.     /**
  48.      * @var EccubeConfig
  49.      */
  50.     protected $eccubeConfig;
  51.     /**
  52.      * @var Twig
  53.      */
  54.     protected $twig;
  55.     /**
  56.      * @var Request
  57.      */
  58.     protected $request;
  59.     /**
  60.      * @var LmHelper
  61.      */
  62.     protected $lmHelper;
  63.     /**
  64.      * @var ReviewService
  65.      */
  66.     protected $reviewService;
  67.     /**
  68.      * @var GoodsPriceService
  69.      */
  70.     private $goodsPriceService;
  71.     /**
  72.      * @var PageRepository
  73.      */
  74.     private $pageRepository;
  75.     /**
  76.      * @var BaseInfo
  77.      */
  78.     private $baseInfo;
  79.     protected $GoodsService;
  80.     public function __construct(Security         $security,
  81.                                 RequestStack     $requestStack,
  82.                                 Twig             $twig,
  83.                                 EccubeConfig     $eccubeConfig,
  84.                                 CartService      $cartService,
  85.                                 CommonService    $commonService,
  86.                                 LmHelper         $lmHelper,
  87.                                 DynamicConverter $dynamicConverter,
  88.                                 ReviewService    $reviewService,
  89.                                 GoodsPriceService $goodsPriceService,
  90.                                 PageRepository $pageRepository,
  91.                                 BaseInfoRepository $baseInfoRepository,
  92.                                 RecentGoodsService $RecentGoodsService,
  93.                                 CartServiceCustomize $cartServiceCustomize,
  94.                                 GoodsService     $goodService
  95.     )
  96.     {
  97.         $this->security $security;
  98.         $this->request $requestStack->getCurrentRequest();
  99.         $this->twig $twig;
  100.         $this->eccubeConfig $eccubeConfig;
  101.         $this->cartService $cartService;
  102.         $this->commonService $commonService;
  103.         $this->lmHelper $lmHelper;
  104.         $this->dynamicConverter $dynamicConverter;
  105.         $this->reviewService $reviewService;
  106.         $this->goodsPriceService $goodsPriceService;
  107.         $this->pageRepository $pageRepository;
  108.         $this->baseInfo $baseInfoRepository->get();
  109.         $this->RecentGoodsService $RecentGoodsService;
  110.         $this->cartServiceCustomize $cartServiceCustomize;
  111.         $this->GoodsService $goodService;
  112.     }
  113.     public function getFilters()
  114.     {
  115.         return [
  116.             new TwigFilter('header4_css', [$this'renderHeader4Css']),
  117.             new TwigFilter('check_mcMcName', [$this'checkMcName']),
  118.             new TwigFilter('display_text', [$this'displayText']),
  119.             new TwigFilter('lm_sashikomi', [$this'LM_sashikomi']),
  120.             new TwigFilter('replace_item_image_root', [$this'replaceItemImageRoot']),
  121.             new TwigFilter('lm_sashikomi_main_category', [$this'LM_displaySashikomi_mainCategory']),
  122.             new TwigFilter('slider_filter', [$this'sliderFilter']),
  123.             new TwigFilter('display_form_text', [$this'display_form_text']),
  124.             new TwigFilter('json_decode', [$this'twigJsonDecode']),
  125.         ];
  126.     }
  127.     public function getFunctions()
  128.     {
  129.         return [
  130.             new TwigFunction('formatDescriptionForEstimate', [$this'handleFormatDescriptionForEstimate']),
  131.             new TwigFunction('footer_main_category', [$this'getFooterMainCategory']),
  132.             new TwigFunction('left_fbnrs', [$this'getLeftFbnrs']),
  133.             new TwigFunction('right_fbnrs', [$this'getRightFbnrs']),
  134.             new TwigFunction('toe_messages', [$this'getToeMessages']),
  135.             new TwigFunction('message_categories_count', [$this'getMessageCategoriesCount']),
  136.             new TwigFunction('lmenu_css', [$this'getLMenuCss']),
  137.             new TwigFunction('totalDailyRanking', [$this'getTotalDailyRanking']),
  138.             new TwigFunction('topics_data', [$this'getTopics']),
  139.             new TwigFunction('get_s3_lm_doc_path', [$this'getS3LmDocPath']),
  140.             new TwigFunction('months', [$this'getMonths']),
  141.             new TwigFunction('days', [$this'getDays']),
  142.             new TwigFunction('render_category_list', [$this'renderCategoryList']),
  143.             new TwigFunction('preg_match', [$this'pregMatch']),
  144.             new TwigFunction('lm_detailLink2', [$this'LM_detailLink2']),
  145.             new TwigFunction('default_sp_other_category_pulldown_map', [$this'getDefaultSpOtherCategoryPulldownMap']),
  146.             new TwigFunction('sp_header', [$this'renderSpHeader']),
  147.             new TwigFunction('makeImageURL', [$this'makeImageURL']),
  148.             new TwigFunction('sashikomi', [$this'sashikomi']),
  149.             new TwigFunction('session_data', [$this'getSessionData']),
  150.             new TwigFunction('showGoodsLabelList', [$this'renderGoodsLabelList']),
  151.             new TwigFunction('render_product_item', [$this'renderProductItem']),
  152.             new TwigFunction('lm_category_filter', [$this'lm_category_filter']),
  153.             new TwigFunction('custom_parse_url', [$this'custom_parse_url']),
  154.             new TwigFunction('echoImageURL', [$this'echoImageURL']),
  155.             new TwigFunction('echoVirtualImages', [$this'echoVirtualImages']),
  156.             new TwigFunction('get_updated_at', [$this'get_updated_at']),
  157.             new TwigFunction('LM_displaySashikomi_detailGoods', [$this'LM_displaySashikomi_detailGoods']),
  158.             new TwigFunction('LM_insertFile', [$this'LM_insertFile']),
  159.             new TwigFunction('createGetParamater', [$this'createGetParamater']),
  160.             new TwigFunction('LM_displayTogetherBuyDetail_new3', [$this'LM_displayTogetherBuyDetail_new3']),
  161.             new TwigFunction('hoge', [$this'hoge']),
  162.             new TwigFunction('display_item_pulldown', [$this'display_item_pulldown']),
  163.             new TwigFunction('display_order_pulldown', [$this'display_order_pulldown']),
  164.             new TwigFunction('sp_common_contents_map', [$this'getCommonContentsMap']),
  165.             new TwigFunction('get_calendar_info', [$this'getCalendarInfo']),
  166.             new TwigFunction('get_holiday_info', [$this'getHolidayInfo']),
  167.             new TwigFunction('you_may_also_like', [$this'getYouMayAlsoLike']),
  168.             new TwigFunction('get_koe_count', [$this'getKoeCount']),
  169.             new TwigFunction('get_category_order_type', [$this'getCategoryOrderType']),
  170.             new  TwigFunction('isShowSpHeader', [$this'isShowSpHeader']),
  171.             new  TwigFunction('showSizeTable', [$this'getSizeTable']),
  172.             new TwigFunction('get_carts_total_quantity', [$this'get_carts_total_quantity']),
  173.             new TwigFunction('getCampaignFlags', [$this'getCampaignFlags']),
  174.             new TwigFunction('getMatomeCampaignInfo', [$this'getMatomeCampaignInfo']),
  175.             new TwigFunction('getYoridoriCampaignInfo', [$this'getYoridoriCampaignInfo']),
  176.         ];
  177.     }
  178.     public function handleFormatDescriptionForEstimate(string $text) {
  179.         if (empty($text)) {
  180.             return "";
  181.         }
  182.         $result "";
  183.         $text preg_replace('/\s+/'' '$text);
  184.         $lines explode('・'$text);
  185.         $step 1;
  186.         if (in_array('多色向き/写真等 '$lines)) {
  187.             $step 0;
  188.         }
  189.         for ($i $step$i count($lines); $i++) {
  190.             $result .= '・' $lines[$i] . "<br />";
  191.         }
  192.         return $result;
  193.     }
  194.     public function renderHeader4Css($uri)
  195.     {
  196.         $uri $_SERVER['REQUEST_URI'];
  197.         if (preg_match("/^\/polo\//"$uri)) echo "#header-menu-1-1 { background-position: -108px 0 !important; }";
  198.         if (preg_match("/^\/shirt\//"$uri) and !preg_match("/^\/shirt\/aloha\//"$uri)) echo "#header-menu-1-2 { background-position: -108px -106px !important; }";
  199.         if (preg_match("/^\/tshirt\//"$uri)) echo "#header-menu-1-3 { background-position: -108px -212px !important; }";
  200.         if (preg_match("/^\/staff\//"$uri)) echo "#header-menu-1-4 { background-position: -108px -318px !important; }";
  201.         if (preg_match("/^\/vest\//"$uri)) echo "#header-menu-1-5 { background-position: -108px -424px !important; }";
  202.         if (preg_match("/^\/warm\//"$uri)) echo "#header-menu-1-6 { background-position: -108px -530px !important; }";
  203.         if (preg_match("/^\/sweat\//"$uri)) echo "#header-menu-1-7 { background-position: -108px -636px !important; }";
  204.         if (preg_match("/^\/pants\//"$uri)) echo "#header-menu-1-8 { background-position: -108px -742px !important; }";
  205.         if (preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#header-menu-1-9 { background-position: -108px -848px !important; }";
  206.         if (preg_match("/^\/apron\//"$uri)) echo "#header-menu-2-1 { background-position: -108px -27px !important; }";
  207.         if (preg_match("/^\/shirt\/aloha\//"$uri)) echo "#header-menu-2-2 { background-position: -108px -133px !important; }";
  208.         if (preg_match("/^\/happi\//"$uri)) echo "#header-menu-2-3 { background-position: -108px -239px !important; }";
  209.         if (preg_match("/^\/cap\//"$uri)) echo "#header-menu-2-4 { background-position: -108px -345px !important; }";
  210.         if (preg_match("/^\/overall\//"$uri)) echo "#header-menu-2-5 { background-position: -108px -451px !important; }";
  211.         if (preg_match("/^\/anzengutsu\//"$uri)) echo "#header-menu-2-6 { background-position: -108px -557px !important; }";
  212.         if (preg_match("/^\/towel\//"$uri)) echo "#header-menu-2-7 { background-position: -108px -663px !important; }";
  213.         if (preg_match("/^\/scrub\//"$uri)) echo "#header-menu-2-8 { background-position: -108px -769px !important; }";
  214.         if (preg_match("/^\/bag\//"$uri)) echo "#header-menu-2-9 { background-position: -108px -875px !important; }";
  215.         if (preg_match("/^\/work\//"$uri)) echo "#header-menu-3-1 { background-position: -108px -54px !important; }";
  216.         if (preg_match("/^\/jimufuku\//"$uri)) echo "#header-menu-3-2 { background-position: -108px -160px !important; }";
  217.         if (preg_match("/^\/hakui\//"$uri) and !preg_match("/^\/hakui\/scrub\//"$uri)) echo "#header-menu-3-3 { background-position: -108px -266px !important; }";
  218.         if (preg_match("/^\/food-uniform\//"$uri) and !preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#header-menu-3-4 { background-position: -108px -372px !important; }";
  219.         if (preg_match("/^\/esthe-uniform\//"$uri) and !preg_match("/^\/towel\//"$uri)) echo "#header-menu-3-5 { background-position: -108px -478px !important; }";
  220.         if (preg_match("/^\/election-item\//"$uri)) echo "#header-menu-3-6 { background-position: -108px -584px !important; }";
  221.         if (preg_match("/^\/care-wear\//"$uri)) echo "#header-menu-3-7 { background-position: -108px -690px !important; }";
  222.         if (preg_match("/^\/patrol\//"$uri)) echo "#header-menu-3-8 { background-position: -108px -796px !important; }";
  223.         if (preg_match("/^\/food-uniform\/formal-vest\//"$uri)) echo "#header-menu-3-9 { background-position: -108px -902px !important; }";
  224.         if (preg_match("/^\/guide\//"$uri) and !preg_match("/^\/guide\/print-shurui\//"$uri) and !preg_match("/^\/guide\/price-silk\//"$uri) and !preg_match("/^\/guide\/henpin\//"$uri) and !preg_match("/^\/guide\/shiharai\//"$uri)) echo "#header-menu-4-1 { background-position: -108px -81px !important; }";
  225.         if (preg_match("/^\/guide\/print-shurui\//"$uri)) echo "#header-menu-4-2 { background-position: -108px -187px !important; }";
  226.         if (preg_match("/^\/guide\/price-silk\//"$uri)) echo "#header-menu-4-3 { background-position: -108px -293px !important; }";
  227.         if (preg_match("/^\/print\/font-menu\//"$uri)) echo "#header-menu-4-4 { background-position: -108px -399px !important; }";
  228.         if (preg_match("/^\/guide\/henpin\//"$uri)) echo "#header-menu-4-5 { background-position: -108px -505px !important; }";
  229.         if (preg_match("/^\/guide\/shiharai\//"$uri)) echo "#header-menu-4-6 { background-position: -108px -611px !important; }";
  230.         if (preg_match("/^\/faq\//"$uri)) echo "#header-menu-4-7 { background-position: -108px -717px !important; }";
  231.         if (preg_match("/^\/sample-order\//"$uri)) echo "#header-menu-4-8 { background-position: -108px -823px !important; }";
  232.         if (preg_match("/^\/company\//"$uri)) echo "#header-menu-4-9 { background-position: -108px -929px !important; }";
  233.         return "";
  234.     }
  235.     public function getFooterMainCategory()
  236.     {
  237.         // TODO: MainCategoryページのFooterで ページDescription取得
  238.         /**
  239.          * [
  240.          *  [
  241.          *    name: 'description',
  242.          *    content: 'TEST'
  243.          *  ]
  244.          *  ...
  245.          * ]
  246.          */
  247.         $response = [
  248.             [
  249.                 'name' => 'description',
  250.                 'content' => 'TEST'
  251.             ]
  252.         ];
  253.         return $response;
  254.     }
  255.     public function getLeftFbnrs()
  256.     {
  257.         $viewCacheKey $this->lmHelper->getCacheKey('getLeftFbnrs', []);
  258.         return $this->getCacheByKey($viewCacheKey, function() {
  259.             $result = [];
  260.             $fbnrs array_values(array_filter($this->dynamicConverter->getFbnrs(), function ($fbnr) {
  261.                 return !empty($fbnr['fbnr_content']);
  262.             }));
  263.             $result[] = array_shift($fbnrs);
  264.             return $result;
  265.         });
  266.     }
  267.   public function displayText($text)
  268.   {
  269.     return nl2br(str_replace(">","&gt;",str_replace("<","&lt;",stripslashes($text))));
  270.   }
  271.   public function LM_sashikomi($srcHtml)
  272.   {
  273.     $CFIMG_URL $this->eccubeConfig['CFIMG_URL'] . '/';
  274.     $BACKIMG_URL $this->eccubeConfig['BACKIMG_URL'];
  275.         $dstHtml $srcHtml;
  276.         $dstHtml str_replace('"img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  277.         $dstHtml str_replace('"/img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  278.         $dstHtml str_replace('"./img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  279.         $dstHtml str_replace('"../img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  280.         $dstHtml str_replace('http://www.l-m.co.jp/img/',$CFIMG_URL."public_img/",$dstHtml);
  281.         $dstHtml str_replace('https://www.l-m.co.jp/img/',$CFIMG_URL."public_img/",$dstHtml);
  282.         $dstHtml str_replace('"images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  283.         $dstHtml str_replace('"/images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  284.         $dstHtml str_replace('"./images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  285.         $dstHtml str_replace('"../images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  286.         $dstHtml str_replace('http://www.l-m.co.jp/images/',$CFIMG_URL."public_images/",$dstHtml);
  287.         $dstHtml str_replace('https://www.l-m.co.jp/images/',$CFIMG_URL."public_images/",$dstHtml);
  288.         $dstHtml str_replace('url(images/','url('.$CFIMG_URL.'public_images/',$dstHtml);
  289.         $dstHtml str_replace('url(/images/','url('.$CFIMG_URL.'public_images/',$dstHtml);
  290.         $dstHtml str_replace('url(\'images/','url(\''.$CFIMG_URL.'public_images/',$dstHtml);
  291.         $dstHtml str_replace('url(\'/images/','url(\''.$CFIMG_URL.'public_images/',$dstHtml);
  292.         $dstHtml str_replace('url("images/','url("'.$CFIMG_URL.'public_images/',$dstHtml);
  293.         $dstHtml str_replace('url("/images/','url("'.$CFIMG_URL.'public_images/',$dstHtml);
  294.         $dstHtml str_replace('"item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  295.         $dstHtml str_replace('"/item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  296.         $dstHtml str_replace('"./item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  297.         $dstHtml str_replace('"../item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  298.         $dstHtml str_replace('http://www.l-m.co.jp/item/kihon/',$BACKIMG_URL."public_item/kihon/",$dstHtml);
  299.         $dstHtml str_replace('https://www.l-m.co.jp/item/kihon/',$BACKIMG_URL."public_item/kihon/",$dstHtml);
  300.         $dstHtml str_replace('url(item/kihon/','url('.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  301.         $dstHtml str_replace('url(/item/kihon/','url('.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  302.         $dstHtml str_replace('url(\'item/kihon/','url(\''.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  303.         $dstHtml str_replace('url(\'/item/kihon/','url(\''.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  304.         $dstHtml str_replace('url("item/kihon/','url("'.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  305.     $dstHtml str_replace('url("/item/kihon/','url("'.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  306.     return $dstHtml;
  307.   }
  308.   public function renderCategoryList($mcMcName$mcName$data$canonicalMcData$categoryData$dataItem$subCategoryList$ctId)
  309.   {
  310.       // 配下カテゴリ
  311.       $canonicalMcName $mcName;
  312.       if (!empty($mcMcName)) {
  313.           $canonicalMcName "{$mcMcName}/{$mcName}";
  314.       } else if (!empty($data['main_category_main_category_webname'])) {
  315.           $canonicalMcName "{$data['main_category_main_category_webname']}/{$mcName}";
  316.       }
  317.       if (!empty($canonicalMcData)) {
  318.           $data $canonicalMcData;
  319.           $canonicalMcName $data['main_category_webname'];
  320.           if (!empty($data['main_category_main_category_webname'])) {
  321.               $canonicalMcName "{$data['main_category_main_category_webname']}/{$canonicalMcName}";
  322.           }
  323.       } else if ($categoryData == null) {
  324.           $data $data;
  325.       } else {
  326.           $data $categoryData;
  327.       }
  328.       // 件数リスト
  329.       $categoryCntList = array();
  330.       if (isset($dataItem)) {
  331.           foreach ($dataItem as $_item) {
  332.               $categoryCntList[$_item['category_id']] = $_item['cnt'] ?? 0;
  333.           }
  334.       }
  335.   }
  336.     public function getRightFbnrs()
  337.     {
  338.         $viewCacheKey $this->lmHelper->getCacheKey('getRightFbnrs', []);
  339.         $fbnrs array_values(array_filter($this->dynamicConverter->getFbnrs(), function ($fbnr) {
  340.             return !empty($fbnr['fbnr_content2']);
  341.         }));
  342.         $result = [];
  343.         $result[] = array_shift($fbnrs);
  344.         $pageType $this->lmHelper->getPageType();
  345.         if ($pageType['value'] === 'print-shurui') {
  346.             $shuruiSideMenu[]['fbnr_content2'] = '
  347.             <div id="print-shurui-side-nav">
  348.                 <dl>
  349.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_anchor">シルクプリント</a></dt>
  350.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_k" class="allsale_h">価格</a></dd>
  351.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_kd">├型代</a></dd>
  352.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_pd">├プリント代</a></dd>
  353.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_im">└色見本</a></dd>
  354.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#staff_anchor">STAFF無料型</a></dt>
  355.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#magic_anchor">マジックプリント</a></dt>
  356.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#transfer_anchor">転写</a></dt>
  357.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#embroidery_anchor">刺繍</a></dt>
  358.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_k" class="allsale_h">価格</a></dd>
  359.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_sya">├社名刺繍</a></dd>
  360.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_logo">├ロゴマーク</a></dd>
  361.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_im">└色見本</a></dd>
  362.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#threedimensional_anchor">立体刺繍</a></dt>
  363.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#rehem_anchor">ズボンの裾直し</a></dt>
  364.                 </dl>
  365.             </div>';
  366.             return $shuruiSideMenu;
  367.         }
  368.         return $result;
  369.     }
  370.     public function getToeMessages()
  371.     {
  372.         $messages = (array)$this->dynamicConverter->getMessageList('cm_id, title, add_datetime'10);
  373.         $response = [
  374.             'total_count' => sizeof((array)$this->dynamicConverter->getMessageList()),
  375.             'data' => $messages
  376.         ];
  377.         return $response;
  378.     }
  379.     public function getMessageCategoriesCount()
  380.     {
  381.         $messages $this->dynamicConverter->getMessageCountByCategory();
  382.         return $messages;
  383.     }
  384.     public function getLMenuCss()
  385.     {
  386.         $uri $_SERVER['REQUEST_URI'];
  387.         if (preg_match("/^\/work\//"$uri)) echo "#side-nav.top-use #fixed-menu-1 { background-position: -165px 0 !important; }";
  388.         if (preg_match("/^\/anzengutsu\//"$uri)) echo "#side-nav.top-category #fixed-menu-2 { background-position: -165px -43px !important; }";
  389.         if (preg_match("/^\/jimufuku\//"$uri)) echo "#side-nav.top-use #fixed-menu-3 { background-position: -165px -86px !important; }";
  390.         if (preg_match("/^\/hakui\//"$uri) and !preg_match("/^\/hakui\/scrub\//"$uri)) echo "#side-nav.top-use #fixed-menu-4 { background-position: -165px -129px !important; }";
  391.         if (preg_match("/^\/scrub\//"$uri)) echo "#side-nav.top-use #fixed-menu-5 { background-position: -165px -172px !important; }";
  392.         if (preg_match("/^\/food-uniform\//"$uri) and !preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#side-nav.top-use #fixed-menu-6 { background-position: -165px -215px !important; }";
  393.         if (preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#side-nav.top-use #fixed-menu-7 { background-position: -165px -258px !important; }";
  394.         if (preg_match("/^\/esthe-uniform\//"$uri) and !preg_match("/^\/towel\//"$uri)) echo "#side-nav.top-use #fixed-menu-8 { background-position: -165px -301px !important; }";
  395.         if (preg_match("/^\/care-wear\//"$uri)) echo "#side-nav.top-use #fixed-menu-9 { background-position: -165px -344px !important; }";
  396.         if (preg_match("/^\/patrol\//"$uri)) echo "#side-nav.top-use #fixed-menu-10 { background-position: -165px -387px !important; }";
  397.         if (preg_match("/^\/formal\//"$uri)) echo "#side-nav.top-use #fixed-menu-11 { background-position: -165px -430px !important; }";
  398.         if (preg_match("/^\/polo\//"$uri)) echo "#side-nav.top-category #fixed-menu-1 { background-position: -165px 0 !important; }";
  399.         if (preg_match("/^\/apron\//"$uri)) echo "#side-nav.top-category #fixed-menu-2 { background-position: -165px -43px !important; }";
  400.         if (preg_match("/^\/shirt\//"$uri) and !preg_match("/^\/shirt\/aloha\//"$uri)) echo "#side-nav.top-category #fixed-menu-3 { background-position: -165px -86px !important; }";
  401.         if (preg_match("/^\/tshirt\//"$uri)) echo "#side-nav.top-category #fixed-menu-4 { background-position: -165px -129px !important; }";
  402.         if (preg_match("/^\/staff\//"$uri)) echo "#side-nav.top-category #fixed-menu-5 { background-position: -165px -172px !important; }";
  403.         if (preg_match("/^\/vest\//"$uri)) echo "#side-nav.top-category #fixed-menu-6 { background-position: -165px -215px !important; }";
  404.         if (preg_match("/^\/warm\//"$uri)) echo "#side-nav.top-category #fixed-menu-7 { background-position: -165px -258px !important; }";
  405.         if (preg_match("/^\/sweat\//"$uri)) echo "#side-nav.top-category #fixed-menu-8 { background-position: -165px -301px !important; }";
  406.         if (preg_match("/^\/pants\//"$uri)) echo "#side-nav.top-category #fixed-menu-9 { background-position: -165px -344px !important; }";
  407.         if (preg_match("/^\/shirt\/aloha\//"$uri)) echo "#side-nav.top-category #fixed-menu-10 { background-position: -165px -387px !important; }";
  408.         if (preg_match("/^\/happi\//"$uri)) echo "#side-nav.top-category #fixed-menu-11 { background-position: -165px -430px !important; }";
  409.         if (preg_match("/^\/cap\//"$uri)) echo "#side-nav.top-category #fixed-menu-12 { background-position: -165px -473px !important; }";
  410.         if (preg_match("/^\/overall\//"$uri)) echo "#side-nav.top-category #fixed-menu-13 { background-position: -165px -516px !important; }";
  411.         if (preg_match("/^\/towel\//"$uri)) echo "#side-nav.top-category #fixed-menu-14 { background-position: -165px -559px !important; }";
  412.         if (preg_match("/^\/bag\//"$uri)) echo "#side-nav.top-category #fixed-menu-15 { background-position: -165px -602px !important; }";
  413.         return "";
  414.     }
  415.     public function checkMcName($mcMcName$type)
  416.     {
  417.         $datas = [$mcMcName$type];
  418.         $viewCacheKey $this->lmHelper->getCacheKey("checkMcName"$datas);
  419.         return $this->getCacheByKey($viewCacheKey, function() use ($mcMcName$type) {
  420.             if ($type == 1) {
  421.                 return (
  422.                     $mcMcName != "polo" and
  423.                     $mcMcName != "shirt" and
  424.                     $mcMcName != "tshirt" and
  425.                     $mcMcName != "staff" and
  426.                     $mcMcName != "vest" and
  427.                     $mcMcName != "warm" and
  428.                     $mcMcName != "sweat" and
  429.                     $mcMcName != "pants" and
  430.                     $mcMcName != "cook-coat" and
  431.                     $mcMcName != "apron" and
  432.                     $mcMcName != "happi" and
  433.                     $mcMcName != "cap" and
  434.                     $mcMcName != "overall" and
  435.                     $mcMcName != "anzengutsu" and
  436.                     $mcMcName != "towel" and
  437.                     $mcMcName != "scrub" and
  438.                     $mcMcName != "bag" and
  439.                     $mcMcName != "work" and
  440.                     $mcMcName != "jimufuku" and
  441.                     $mcMcName != "hakui" and
  442.                     $mcMcName != "food-uniform" and
  443.                     $mcMcName != "esthe-uniform" and
  444.                     $mcMcName != "election-item" and
  445.                     $mcMcName != "care-wear" and
  446.                     $mcMcName != "patrol" and
  447.                     $mcMcName != "pachinko" and
  448.                     $mcMcName != "burtle" and
  449.                     $mcMcName != "tsdesign" and
  450.                     $mcMcName != "xebec" and
  451.                     $mcMcName != "aitoz" and
  452.                     $mcMcName != "jichodo" and
  453.                     $mcMcName != "jawin" and
  454.                     $mcMcName != "kurodaruma" and
  455.                     $mcMcName != "co-cos" and
  456.                     $mcMcName != "sowa" and
  457.                     $mcMcName != "joie" and
  458.                     $mcMcName != "bon" and
  459.                     $mcMcName != "boncierge" and
  460.                     $mcMcName != "enjoy" and
  461.                     $mcMcName != "selery" and
  462.                     $mcMcName != "mizuno" and
  463.                     $mcMcName != "folk" and
  464.                     $mcMcName != "lecoqsportif-nurse" and
  465.                     $mcMcName != "lumiere" and
  466.                     $mcMcName != "facemix" and
  467.                     $mcMcName != "arbe" and
  468.                     $mcMcName != "bonuni" and
  469.                     $mcMcName != "lecoqsportif-care" and
  470.                     $mcMcName != "heartgreen" and
  471.                     $mcMcName != "natural-smile" and
  472.                     $mcMcName != "pep" and
  473.                     $mcMcName != "printstar" and
  474.                     $mcMcName != "unitedathle" and
  475.                     $mcMcName != "maximum" and
  476.                     $mcMcName != "calala" and
  477.                     $mcMcName != "bspa" and
  478.                     $mcMcName != "counterbiz" and
  479.                     $mcMcName != "glimmer" and
  480.                     $mcMcName != "daluc" and
  481.                     $mcMcName != "triumph" and
  482.                     $mcMcName != "sunpex" and
  483.                     $mcMcName != "formal" and
  484.                     $mcMcName != "whisel" and
  485.                     $mcMcName != "work-ladies" and
  486.                     $mcMcName != "work-gekiyasu" and
  487.                     $mcMcName != "work-stretch" and
  488.                     $mcMcName != "work-seiden" and
  489.                     $mcMcName != "work-cotton" and
  490.                     $mcMcName != "work-menpoli" and
  491.                     $mcMcName != "work-coolbiz" and
  492.                     $mcMcName != "work-warmbiz" and
  493.                     $mcMcName != "work-bouen" and
  494.                     $mcMcName != "work-nannen" and
  495.                     $mcMcName != "office-cute" and
  496.                     $mcMcName != "office-adult" and
  497.                     $mcMcName != "office-stock" and
  498.                     $mcMcName != "office-gekiyasu" and
  499.                     $mcMcName != "office-muji" and
  500.                     $mcMcName != "office-check" and
  501.                     $mcMcName != "office-stripe" and
  502.                     $mcMcName != "office-border" and
  503.                     $mcMcName != "office-jacquard"
  504.                 );
  505.             } else if ($type == 2) { // 限定非表示したいエリアをここに入れる 2015.5.1 複数のとき、!= and
  506.                 return (
  507.                     $mcMcName != "pants" and
  508.                     $mcMcName != "cook-coat" and
  509.                     $mcMcName != "anzengutsu" and
  510.                     $mcMcName != "scrub" and
  511.                     $mcMcName != "bag" and
  512.                     $mcMcName != "work" and
  513.                     $mcMcName != "jimufuku" and
  514.                     $mcMcName != "hakui" and
  515.                     $mcMcName != "food-uniform" and
  516.                     $mcMcName != "esthe-uniform" and
  517.                     $mcMcName != "pachinko" and
  518.                     $mcMcName != "burtle" and
  519.                     $mcMcName != "tsdesign" and
  520.                     $mcMcName != "xebec" and
  521.                     $mcMcName != "aitoz" and
  522.                     $mcMcName != "jichodo" and
  523.                     $mcMcName != "jawin" and
  524.                     $mcMcName != "kurodaruma" and
  525.                     $mcMcName != "co-cos" and
  526.                     $mcMcName != "sowa" and
  527.                     $mcMcName != "joie" and
  528.                     $mcMcName != "bon" and
  529.                     $mcMcName != "boncierge" and
  530.                     $mcMcName != "enjoy" and
  531.                     $mcMcName != "selery" and
  532.                     $mcMcName != "mizuno" and
  533.                     $mcMcName != "folk" and
  534.                     $mcMcName != "lecoqsportif-nurse" and
  535.                     $mcMcName != "lumiere" and
  536.                     $mcMcName != "facemix" and
  537.                     $mcMcName != "arbe" and
  538.                     $mcMcName != "bonuni" and
  539.                     $mcMcName != "lecoqsportif-care" and
  540.                     $mcMcName != "heartgreen" and
  541.                     $mcMcName != "natural-smile" and
  542.                     $mcMcName != "pep" and
  543.                     $mcMcName != "calala" and
  544.                     $mcMcName != "bspa" and
  545.                     $mcMcName != "counterbiz"
  546.                 );
  547.             }
  548.             return false;
  549.         });
  550.     }
  551.     public function getTotalDailyRanking()
  552.     {
  553.         $goods = (array)$this->dynamicConverter->getRankingList();
  554.         $response = [
  555.             'all' => array(),
  556.             'sagyoufuku' => array(),
  557.             'jimufuku' => array(),
  558.             'hakui' => array(),
  559.             'inshoku' => array()
  560.         ];
  561.         foreach ($goods as $good) {
  562.             $good['image_url'] = $this->makeImageURL('goods.img'$good['goods_id']);
  563.             switch ($good['goods_genre_text']) {
  564.                 case '':
  565.                     $good['goods_genre_text'] = '総合';
  566.                     $response['all'][$good['ranking_no']] = $good;
  567.                     break;
  568.                 case '作業服':
  569.                     $response['sagyoufuku'][$good['ranking_no']] = $good;
  570.                     break;
  571.                 case '事務服':
  572.                     $response['jimufuku'][$good['ranking_no']] = $good;
  573.                     break;
  574.                 case '白衣':
  575.                     $response['hakui'][$good['ranking_no']] = $good;
  576.                     break;
  577.                 case '飲食':
  578.                     $response['inshoku'][$good['ranking_no']] = $good;
  579.                     break;
  580.             }
  581.         }
  582.         foreach ($response as $key => $dummy) {
  583.             ksort($response[$key]);
  584.         }
  585.         return $response;
  586.     }
  587.     public function getTopics()
  588.     {
  589.         $results $this->dynamicConverter->getTopicData();
  590.         return $results;
  591.     }
  592.     public function getS3LmDocPath()
  593.     {
  594.         $path ''// $this->eccubeConfig['S3_LM_DOC_PATH'];
  595.         return $path;
  596.     }
  597.     public function getMonths()
  598.     {
  599.         $months = array();
  600.         for ($i 1$i <= 12$i++) {
  601.             $months[] = $i;
  602.         }
  603.         return $months;
  604.     }
  605.     public function getDays()
  606.     {
  607.         $days = array();
  608.         for ($i 1$i <= 31$i++) {
  609.             $days[] = $i;
  610.         }
  611.         return $days;
  612.     }
  613.     public function replaceItemImageRoot($html)
  614.     {
  615.         $dstHtml $html;
  616.         return $dstHtml;
  617.     }
  618.     public function LM_displaySashikomi_mainCategory($value)
  619.     {
  620.         if ($value != "") {
  621.             if (file_exists($filename "files/insert/{$value}")) {
  622.                 $file implode(""file($filename));
  623.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  624.                 $tmp explode("<body>"$file);
  625.                 if (count($tmp) > 1) {
  626.                     $tmp explode("</body>"$tmp[1]);
  627.                 } else {
  628.                     $tmp explode("</body>"$tmp[0]);
  629.                 }
  630.                 $tmp $this->replaceItemImageRoot($tmp[0]);
  631.                 return "<div style='line-height:12px'><br /></div>" $tmp;
  632.             }
  633.         }
  634.         return "";
  635.     }
  636.     private function addAttrRegexp($src$attrname, array $dst)
  637.     {
  638.         $attrs preg_replace_callback("/{$attrname}=\"([^\"]+)\"/", function ($matches) {
  639.             return $matches[1];
  640.         }, $src);
  641.         $attrs explode(' '$attrs);
  642.         $attrs $dst $attrs;
  643.         $attrs implode(' '$attrs);
  644.         return $attrs;
  645.     }
  646.     public function sliderFilter($value)
  647.     {
  648.         //
  649.         if (preg_match('/class="swiper-wrapper/'$value)) {
  650.             return $value;
  651.         }
  652.         // bxSlider
  653.         $value preg_replace_callback('/<ul([^<>]*(?:bxslider|foobar)[^<>]*)>(.*?)<\/ul>/s', function ($matches) {
  654.             //
  655.             $org $matches[0];
  656.             //
  657.             $classes $this->addAttrRegexp($matches[1], 'class', [
  658.                 'swiper-wrapper',
  659.             ]);
  660.             // echo $classes, PHP_EOL;
  661.             // TODO: その他の属性の対応
  662.             $attrs " class=\"{$classes}\"";
  663.             $li preg_replace_callback('/<li([^<>]*)>/', function ($matches) {
  664.                 //
  665.                 $classes $this->addAttrRegexp($matches[1], 'class', [
  666.                     'swiper-slide',
  667.                 ]);
  668.                 // echo $classes, PHP_EOL;
  669.                 //
  670.                 return "<li class=\"{$classes}\">";
  671.             }, $matches[2]);
  672.             //
  673.             $swiper "<div class=\"swiper-container\">
  674.                 <ul{$attrs}>{$li}</ul>
  675.                 <div class=\"swiper-pagination\"></div>
  676.                 <div class=\"swiper-button-prev\"></div>
  677.                   <div class=\"swiper-button-next\"></div>
  678.                 <div class=\"swiper-scrollbar\"></div>
  679.             </div>";
  680.             // var_dump(compact('matches', 'attrs', 'li', 'swiper'));
  681.             //
  682.             return $swiper;
  683.         }, $value);
  684.         //
  685.         return $value;
  686.     }
  687.     public function pregMatch($pattern$value$result)
  688.     {
  689.         return preg_match($pattern$value$result);
  690.     }
  691.     public function LM_detailLink2($data$mcName ""$ctName ""$useItemUrlDuplicated true)
  692.     {
  693.         $item_id = !empty($data['goods_canonical_hinban']) ? $data['goods_canonical_hinban'] : $data['goods_id'];
  694.         if (!$useItemUrlDuplicated) {
  695.             $url "/item/{$item_id}.html";
  696.         } else if ($mcName === 'nagaileben') {
  697.             // ナガイレーベンの場合のみ、プレーンURLとする
  698.             $url "/item/{$item_id}.html";
  699.         } else if ($mcName != "" && $ctName == "") {
  700.             $url "/item/{$item_id}/{$mcName}.html";
  701.         } else if ($mcName != "" && $ctName != "") {
  702.             $url "/item/{$item_id}/{$mcName}/{$ctName}.html";
  703.         }
  704.         echo $url;
  705.     }
  706.     public function getDefaultSpOtherCategoryPulldownMap()
  707.     {
  708.         return $this->commonService->getSpOtherCategoryPulldownMap();
  709.     }
  710.     public function renderSpHeader($main_h1$category_h1$h1_comment$data$custom_menu$recentviews$custom_frequently_searched_word$other_category_path_map = [])
  711.     {
  712.         $html '';
  713.             $cartCount $this->get_carts_total_quantity();
  714.             if (!strstr($_SERVER["REQUEST_URI"], "/estimate")) {
  715.                 $html '<nav id="ut-sp-global-navi">';
  716.                 // キャッシュが無効(通常通り出力)
  717.                 $temp $this->sp_h1($main_h1$category_h1$h1_comment$data);
  718.                 $html "{$html}{$temp}";
  719.                 $html $html '<ul>
  720.           <li class="navi-home"><a href="/" data-ajax="false"><i class="material-icons">home</i><span>ホーム</span></a></li>
  721.           <li class="navi-tel"><a href="tel:0120115116" class="cv-tel" data-ajax="false"><i class="material-icons">phone</i><span>電話</span></a></li>
  722.           <li class="navi-cart"><a href="/cart/" data-ajax="false"><i class="material-icons">shopping_cart</i><span>カート<div class="cart-item-badge' . (isset($_SESSION['cart']['type']) && $_SESSION['cart']['type'] == "sample" ' sample' '') . '"><b>' $cartCount '</b></div></span></a></li>
  723.           <li class="navi-search"><a href="#" data-ajax="false" data-slide-panel="search"><i class="material-icons">search</i><span>検索</span></a></li>
  724.           <li class="navi-menu"><a href="#" data-ajax="false" data-slide-panel="menu"><i class="material-icons">menu</i><span>メニュー</span></a></li>
  725.         </ul>';
  726.                 $html "{$html}</nav>";
  727.                 $temp $this->slide_panel_menu($custom_menu$recentviews$other_category_path_map);
  728.                 $html "{$html}{$temp}";
  729.                  $temp $this->slide_panel_search($data$custom_frequently_searched_word$custom_menu$other_category_path_map$recentviews);
  730.                 $html "{$html}{$temp}";
  731.             }
  732.         $allowedNewCss = ['/mypage/history/''/mypage/mhistory/''/mypage/chistory/''/mypage/contact/''/mypage/update/'];
  733.         $currentURI parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
  734.         if (!in_array($currentURI$allowedNewCss)) {
  735.             $html $html '<div id="logo">
  736.                                 <a href="/" data-ajax="false"><img src="https://img0.land-mark.biz/ut_img/public_images/header/site_logo_mini.jpg" alt="ユニフォームタウン" /></a>
  737.                             </div>';
  738.         } else {
  739.             $html $html '<div id="logo">
  740.                             <a href="/" data-ajax="false"><img src="/stylesheets/images/icons-svg/union.svg" alt="ユニフォームタウン" /></a>
  741.                         </div>
  742.                         <div id="working-time-wrapper">
  743.                             <img class="working-hour" src="/stylesheets/images/icons-svg/working_hour.svg" />
  744.                             <img src="/stylesheets/images/icons-svg/day_off.svg" />
  745.                         </div>
  746.                         ';
  747.         }
  748.         echo $html;
  749.     }
  750.     private function sp_h1($main_h1$category_h1$h1_comment$data)
  751.     {
  752.         if (isset($main_h1) && $main_h1 != "") {
  753.             return "<h1>" $main_h1 "</h1>";
  754.         } elseif (isset($category_h1) && $category_h1 != "") {
  755.             return "<h1>" $category_h1 "</h1>";
  756.         } elseif (isset($h1_comment) && $h1_comment trim($h1_comment)) {
  757.             return "<h1>" $h1_comment "</h1>";
  758.         } elseif (isset($data['goods_h1']) && $data['goods_h1'] != "") {
  759.             // if (isset($data['goods'])) return str_replace('品番', '', $data['kataban'] ?? '') . " {$data['goods']['goods_maker_name_text']} {$data['goods']['goods_name']}";
  760.             // return "<h1>" . ($data['main_h1_tag'] ?? '') . "</h1>";
  761.             return "<h1>" . ($data['goods_h1'] ?? '') . "</h1>";
  762.         } else if ($h1 $this->getTitleStr($_SERVER["REQUEST_URI"])) {
  763.             return "<h1>{$h1}</h1>";
  764.         }
  765.         return "";
  766.     }
  767.     private function getTitleStr($urlStr)
  768.     {
  769.         // 2014.06.24 update : main-category, itemコントローラは個別layout内で解決する。
  770. //        $obj = new BaseLibraryModel();
  771. //        $db = $obj->dbConnection();
  772.         if (strpos($urlStr'?')) {
  773.             $urlStr substr($urlStr0strpos($urlStr'?'));
  774.         }
  775.         if (substr($urlStr01) == "/") {
  776.             $urlStr substr($urlStr1);
  777.         }
  778.         $h1_comment "";
  779.         $tmpArray = array();
  780.         $tmpArrays preg_split("(\/)"$urlStr);
  781. //        if ($tmpArrays[2] != "") {
  782. //            include FRONT_PATH . "an_ct/" . $tmpArray[1] . "/" . $tmpArray[2] . ".inc";
  783. //            $h1_comment = $this->displayText($data['category_data']['category_h1_tag'] != "" ? $data['category_data']['category_h1_tag'] : "");
  784. //        } elseif ($tmpArrays[1] != "") {
  785. //            include FRONT_PATH . "an_mc/" . $tmpArray[1] . ".inc";
  786. //            $h1_comment = $this->displayText($data['main_h1_tag'] != "" ? $data['main_h1_tag'] : "");
  787. //        }
  788.         if (substr($urlStr01) == "/") {
  789. //            $urlStr = substr($urlStr, 1, mb_strlen($urlStr));
  790.         }
  791.         if (trim($h1_comment) == "") {
  792.             $tmpArray['index'] = "ユニフォームのプリント専門店 UniformTownへようこそ";
  793.             $tmpArray['sitemap'] = "サイトマップ";
  794.             $tmpArray['sitemap/detail'] = "商品カテゴリ別サイトマップ";
  795.             $tmpArray['guide'] = "ユニフォームタウンを初めてご利用になられる方へ";
  796.             $tmpArray['print'] = "ユニフォームタウンの加工サービスについて";
  797.             $tmpArray['sample-order'] = "ユニフォームタウンのカタログ請求ページです。";
  798.             $tmpArray['mail'] = "メール問い合わせ";
  799.             $tmpArray['estimate'] = "ユニフォームタウンの見積りシミュレーション";
  800.             $tmpArray['login'] = "ユニフォームタウンのログインページ";
  801.             $tmpArray['login/sendinfo'] = "パスワードを忘れた方はこのページでお手続きをお願いします。";
  802.             $tmpArray['regi/thanks'] = "ユニフォームタウンの会員登録完了";
  803.             $tmpArray['regi'] = "ユニフォームタウンの会員登録";
  804.             $tmpArray['mypage/mhistory'] = "ユニフォームタウンでご購入いただいた履歴です";
  805.             $tmpArray['mypage/chistory'] = "ユニフォームタウンでサンプルのご請求頂いた履歴です";
  806.             $tmpArray['mypage/history'] = "ユニフォームタウンで購入いただいた履歴です";
  807.             $tmpArray['mypage/designlist'] = "デザインシミュレーションしていただいた履歴です";
  808.             $tmpArray['mypage/contact'] = "デザインデータの送付、領収書の発行などができます";
  809.             $tmpArray['mypage/update'] = "ユニフォームタウンの登録情報を更新できるページです";
  810.             $tmpArray['mypage/mylist'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  811.             $tmpArray['mypage/yoyaku'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  812.             $tmpArray['mypage'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  813.             $tmpArray['samplecart'] = "ユニフォームタウンのサンプル商品ショッピングカートページです。";
  814.             $tmpArray['samplecheck'] = "ユニフォームタウンでのサンプル申込み内容をご確認ください。";
  815.             $tmpArray['item/by-product'] = "ユニフォームタウン - すべての商品";
  816.             $tmpArray['company/'] = "ユニフォームタウンの会社案内のページです。";
  817.             $tmpArray['company/showroom'] = "ショールームのご案内";
  818.             $tmpArray['company/use'] = "ユニフォームタウンをご利用するにあたっての環境について";
  819.             $tmpArray['company/agree/'] = "利用規約|ユニフォームの通販・プリント専門店 UniformTown";
  820.             $tmpArray['company/privacy'] = "ユニフォームタウンでの個人情報の保護方針と取扱いについて";
  821.             $tmpArray['company/law'] = "ユニフォームタウンの特定商取引法に基づく通販の表記ページです。";
  822.             $tmpArray['company/access'] = "ユニフォームタウンのショップ・アクセスへのページです。";
  823.             $tmpArray['company/china-factory'] = "ランドマークの中国工場";
  824.             $tmpArray['mail/backnumber'] = "バックナンバー";
  825.             $tmpArray['company/link'] = "ユニフォームタウンの相互リンク";
  826.             $tmpArray['company/link-detail'] = "相互リンク";
  827.             $tmpArray['company/link-form'] = "相互リンクお申し込みフォーム";
  828.             $tmpArray['company/idea'] = "ご意見・ご要望をお聞かせください";
  829.             $tmpArray['company/recruit'] = "ユニフォームタウンの求人情報のページです。";
  830.             $tmpArray['company/dictionary'] = "ユニフォームタウンの用語集のページです。";
  831.             $strArray $tmpArray;
  832.             foreach ($tmpArray as $key => $value) {
  833.                 $tmpAry preg_split("(\/)"$key);
  834.                 if ($urlStr == $key) {
  835.                     $h1_comment $strArray[$key];
  836.                 } elseif (strstr($urlStr"print") and $tmpAry[0] == "print") {
  837.                     $h1_comment $strArray[$key];
  838.                 } elseif (strstr($urlStr"guide") and $tmpAry[0] == "guide") {
  839.                     $h1_comment $strArray[$key];
  840.                 } elseif (strstr($urlStr"sample-order") and $tmpAry[0] == "sample-order") {
  841.                     $h1_comment $strArray[$key];
  842.                 } elseif ($urlStr == $tmpAry[0] and $h1_comment == "") {
  843.                     $h1_comment $strArray[$key];
  844.                 }
  845.             }
  846. //            $obj->closeConnection($db);
  847.         }
  848.         if (trim($h1_comment) == "") {
  849.             if (in_array($urlStr, ['shopping''shopping/confirm''shopping/checkout''shopping/complete''shopping/error'])) {
  850.                 $route str_replace('/''_'$urlStr);
  851.                 $page $this->pageRepository->getPageByRoute($route);
  852.                 $h1_comment "{$this->baseInfo->getShopName()}{$page->getName()}";
  853.             } else {
  854.                 $h1_comment "ユニフォームのプリント専門店 UniformTownへようこそ";
  855.             }
  856.         }
  857.         return $h1_comment;
  858.     }
  859.     public function get_carts_total_quantity()
  860.     {
  861.         if ($this->cartService->getCartType() == CartServiceCustomize::CartTypeCatalog) {
  862.             $catalogOrderList $this->commonService->GetLmOrderOption(CommonService::Lm_Option_Catalog);
  863.             $totalQuantity is_array($catalogOrderList) ? count($catalogOrderList) : 0;
  864.         } else {
  865.             $Carts $this->cartService->getCarts();
  866.             $totalQuantity array_reduce($Carts, function ($total$Cart) {
  867.                 $total += $Cart->getTotalQuantity();
  868.                 return $total;
  869.             }, 0);
  870.         }
  871.         return $totalQuantity;
  872.     }
  873.     function build_custom_menu($menu_list$is_top false)
  874.     {
  875.         if (empty($menu_list)) return '';
  876.         foreach ($menu_list as $menu) {
  877.             echo '<li class="menu-item ' . (($is_top && !empty($menu->children)) ? ' category-menu ' '') . ((!empty($menu->children)) ? ' has-child ' '') . '">';
  878.             if (empty($menu->children) && !empty($menu->url)) {
  879.                 echo '<a href="' htmlentities($menu->url) . '"><span>' htmlentities($menu->label) . '</span></a>';
  880.             } else {
  881.                 echo '<a><span>' htmlentities($menu->label) . '</span></a>';
  882.             }
  883.             if (!empty($menu->children)) {
  884.                 echo '<ul class="category-list">';
  885.                 echo $this->build_custom_menu($menu->children);
  886.                 echo '</ul>';
  887.             }
  888.             echo '</li>';
  889.         }
  890.     }
  891.     private function slide_panel_menu($custom_menu$recentviews$other_category_path_map = [])
  892.     {
  893.         if (empty($recentviews)) {
  894.             $cookies $this->RecentGoodsService->getRecentView();
  895.             $recentviews = !empty($cookies) ? $this->RecentGoodsService->LM_getRecentViews2($cookies) : array();
  896.         }
  897.         //
  898.         if (empty($other_category_path_map)) {
  899.             $other_category_path_map $this->getDefaultSpOtherCategoryPulldownMap();
  900.         }
  901.         $CFIMG_DOMAIN "img0.land-mark.biz";
  902.         $user $this->security->getUser();
  903.         echo '<style>
  904.         #recentviews .recentviews-item * {
  905.             max-width: none;
  906.         }
  907.         </style>';
  908.         echo '<div class="slide-panel-wrapper" data-slide-type="menu" style="display: none;">
  909.     <div id="slide-panel-menu" class="slide-panel">
  910.                 <ul>
  911.                     <li class="customer-info">
  912.                         <span class="youkoso">ようこそ</span><span class="customer_user_name">' . (isset($user) ? $user->getFullName() : 'ゲスト') . '</span><span class="san">さん</span>
  913.           </li>';
  914.         if (empty($custom_menu)) {
  915.             echo '<li class="menu-item menu-item-label">
  916.               <span>カテゴリーから探す</span>
  917.             </li>';
  918.             foreach ($other_category_path_map as $type => $type_data) {
  919.                 echo '<li class="menu-item category-menu has-child">';
  920.                 echo '<a><span>' $this->displayText($type_data['group_label']) . '</span></a>';
  921.                 if (!empty($type_data['map'])) {
  922.                     echo '<ul class="category-list">';
  923.                     foreach ($type_data['map'] as $path => $label) {
  924.                         echo '<li class="menu-item"><a href="' LmHelper::display_form_text($path) . '"><span>' $this->displayText($label) . '</span></a></li>';
  925.                     }
  926.                     echo '</ul>';
  927.                 }
  928.                 echo '</li>';
  929.             }
  930.         } else {
  931.             echo '<li class="menu-item menu-item-label">
  932.         <span>カテゴリーから探す</span>
  933.       </li>';
  934.             echo $this->build_custom_menu($custom_menutrue);
  935.         }
  936.         if (isset($user)) {
  937.             echo '<li class="menu-item"><a href="/mypage/"><span>マイページ</span></a></li>
  938.                     <li class="menu-item"><a href="/logout/"><span>ログアウト</span></a></li>';
  939.         } else {
  940.             echo '<li class="menu-item"><a href="/mypage/login/"><span>ログイン</span></a></li>
  941.                     <li class="menu-item"><a href="/regi/"><span>新規会員登録</span></a></li>';
  942.         }
  943.         $cartCount $this->get_carts_total_quantity();
  944.         echo '<li class="menu-item"><a href="/cart/" data-ajax="false"><span>カートの商品(<b>' number_format($cartCount) . '</b>点)を見る</span></a></li>
  945.                     <li class="menu-item recentviews-menu has-child opened">
  946.                         <a><span>閲覧履歴</span></a>
  947.                         <div class="recentviews ajax" style="margin-top:10px;">';
  948.         echo '<div id="recentviews" style="overflow: hidden; margin: 0;">
  949.     <div style="margin-left: 0;display:flex;overflow-x:scroll;-webkit-overflow-scrolling: touch;">';
  950.         foreach ($recentviews as $item) {
  951.             echo '<div class="recentviews-item" style="width: 105px; float: left;margin: 0 6px;margin-bottom: 15px;">
  952.           <div>
  953.             <a href="/item/' $this->displayText($item['item_id']) . '.html"><img class="recommend-images" style="height: auto; display: inline-block; border: 1px solid rgb(204, 204, 204); padding: 0; width: 105px;" src="' $this->makeImageURL("goods.img"$item['id']) . '" border="0" name="" alt="' $this->displayText($item['goods_name']) . '"></a>
  954.           </div>
  955.           <div style="margin-top: 5px; font-size: 11px;line-height:1.3em;">
  956.             <a href="/item/' $this->displayText($item['item_id']) . '.html">' $this->displayText($item['goods_name']) . '</a>
  957.           </div>
  958.           <div style="font-size: 11px; color: #666;">
  959.           <span class="recent_item_price">' number_format($item['min_gp_price']) . '円(税込)</span> ~ ' .
  960.           ((isset($item['review']) && $item['review'] > 0) ? ('<div class="recommend-average">' $item['average_img'] . '<span class="recommend-average-bracket">(</span><span class="recommend-average-point">' number_format($item['review']) . '</span><span class="recommend-average-bracket">)</span></div>') : '') . '</div></div>';
  961.         }
  962.         echo '</div></div>';
  963.         echo '</div>
  964.                     </li>
  965.                     <li class="menu-item"><a href="/mail/"><span>メール問合せ</span></a></li>
  966.                     <li class="menu-item"><a href="/cart/add_catalog"><span>カタログ請求する</span></a></li>
  967.                     <li class="menu-item menu-item-label"><span>ご案内</span></li>
  968.                     <li class="menu-item"><a href="/sp/pages/guide/"><span>初めての方へ</span></a></li>
  969.                     <li class="menu-item"><a href="/sp/pages/order/"><span>ご注文方法</span></a></li>
  970.                     <li class="menu-item"><a href="/guide/print-shurui/"><span>プリント・刺繍について</span></a></li>
  971.                     <li class="menu-item"><a href="/sp/pages/pay/"><span>お支払い方法</span></a></li>
  972.                     <li class="menu-item"><a href="/sp/pages/souryou/"><span>送料</span></a></li>
  973.                     <li class="menu-item"><a href="/sp/pages/nouki/" data-ajax="false"><span>納期</span></a></li>
  974.                     <li class="menu-item"><a href="/sp/pages/sample/" data-ajax="false"><span>貸出サンプル</span></a></li>
  975.                     <li class="menu-item"><a href="/sp/pages/oguchi/" data-ajax="false"><span>大口割引</span></a></li>
  976.                     <li class="menu-item"><a href="/sp/pages/henpin/" data-ajax="false"><span>返品・交換</span></a></li>
  977.                     <li class="menu-item"><a href="/sp/pages/faq/" data-ajax="false"><span>よくあるご質問</span></a></li>
  978.                     <li class="menu-item"><a href="/sp/pages/company_profile/" data-ajax="false"><span>会社概要</span></a></li>
  979.                     <li class="menu-item"><a href="/sp/pages/syozaiti/" data-ajax="false"><span>会社所在地</span></a></li>
  980.                     <li class="menu-item menu-footer-tel">
  981.                         <a href="tel:0120115116">
  982.                             <div class="tel-number"><img class="tel-icon" src="https://img0.land-mark.biz/ut_img/public_images/sp/icon_tel.svg" alt="電話"><span>0120-115-116</span></div>
  983.                             <div class="bussines-hour">(平日 9:00〜18:00)</div>
  984.                         </a>
  985.           </li>
  986.           <li class="menu-footer">
  987.                         <ul class="menu-footer-sns">
  988.                             <li class="tw"><a href="https://twitter.com/uniformtown" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_tw.svg);"></a></li>
  989.                             <li class="instagram"><a href="https://www.instagram.com/uniformtown/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_instagram.svg);"></a></li>
  990.                             <li class="fb"><a href="https://www.facebook.com/uniformtown91/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_fb.svg);"></a></li>
  991.                             <li class="youtube"><a href="https://www.youtube.com/channel/UCkSwlrLc4G-y_35KddreLxQ" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_youtube.svg);"></a></li>
  992.                         </ul>
  993.                         <button type="button">✕ メニューを閉じる</button>
  994.                     </li>
  995.                 </ul>
  996.             </div>
  997.         </div>';
  998.     }
  999.     private function slide_panel_search($data$custom_frequently_searched_word$custom_menu$other_category_path_map$recentviews)
  1000.     {
  1001.         $CFIMG_DOMAIN "img0.land-mark.biz";
  1002.         echo '<style>
  1003.         .searchpop_result {
  1004.             overflow: hidden;
  1005.             width: 100%;
  1006.             text-align: left;
  1007.         }
  1008.         .searchpop_result_thumb {
  1009.             float: left;
  1010.             width: 90px;
  1011.             height: 83px;
  1012.             padding-top: 7px;
  1013.         }
  1014.         .searchpop_result_description p {
  1015.             line-height: 1.5;
  1016.         }
  1017.         .searchpop_result_description_goodsName {
  1018.             font-weight: bold;
  1019.             font-size: 14px;
  1020.             padding-top: 1px;
  1021.             margin-bottom: 3px !important;
  1022.             height: 18px;
  1023.             overflow: hidden;
  1024.         }
  1025.         .searchpop_result_description_goodsDetail {
  1026.             overflow: hidden;
  1027.             height: 1.5rem;
  1028.         }
  1029.     </style>';
  1030.         echo '<div class="slide-panel-wrapper" data-slide-type="search" style="display: none;">
  1031.       <div id="slide-panel-search" class="slide-panel">
  1032.         <ul>
  1033.           <li class="search-header">
  1034.             <span>詳細検索</span>
  1035.           </li>
  1036.           <li id="search-area" class="menu-item">
  1037.             <div id="search-area-search">
  1038.               <form method="get" action="/item/searchlist" method="get" accept-charset="UTF-8" id="search_form">
  1039.                 <input type="hidden" name="hantei" value="検索" />
  1040.                 <div>
  1041.                   <div id="search-word-input-wrapper">
  1042.                     <div id="search-word-input-area">
  1043.                       <input class="searchpop" id="search_string" name="searchtext" type="text" placeholder="商品名・品番で検索" value="" autocomplete="off">
  1044.                     </div>
  1045.                     <div><button id="search-button-on-slide-menu"><i class="material-icons">search</i></button></div>
  1046.                   </div>
  1047.                 </div>
  1048.               </form>
  1049.             </div>';
  1050.             //$this->displayText($data['searchtext']);
  1051.             if (!empty($custom_frequently_searched_word)) {
  1052.             echo '<div id="search-area-frequently-searched-words">
  1053.               <span>▼よく検索されているワード</span>
  1054.               <ul class="word-list">';
  1055.             foreach ($custom_frequently_searched_word as $search_word) {
  1056.                 echo '<li><a href="' $this->displayText($search_word->url) . '">' $this->displayText($search_word->label) . '</a></li>';
  1057.             }
  1058.             echo '</ul></div>';
  1059.         }
  1060.         echo '</li>';
  1061.         if (empty($custom_menu)) {
  1062.             echo '<li class="menu-item menu-item-label">
  1063.               <span>カテゴリーから探す</span>
  1064.             </li>';
  1065.             foreach ($other_category_path_map as $type => $type_data) {
  1066.                 echo '<li class="menu-item category-menu has-child">';
  1067.                 echo '<a><span>' $this->displayText($type_data['group_label']) . '</span></a>';
  1068.                 if (!empty($type_data['map'])) {
  1069.                     echo '<ul class="category-list">';
  1070.                     foreach ($type_data['map'] as $path => $label) {
  1071.                         echo '<li class="menu-item"><a href="' LmHelper::display_form_text($path) . '"><span>' $this->displayText($label) . '</span></a></li>';
  1072.                     }
  1073.                     echo '</ul>';
  1074.                 }
  1075.                 echo '</li>';
  1076.             }
  1077.         } else {
  1078.             echo '<li class="menu-item menu-item-label">
  1079.         <span>カテゴリーから探す</span>
  1080.       </li>';
  1081.             echo $this->build_custom_menu($custom_menutrue);
  1082.         }
  1083.         echo '<li class="menu-footer">
  1084.             <ul class="menu-footer-sns">
  1085.               <li class="tw"><a href="https://twitter.com/uniformtown" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_tw.svg);"></a></li>
  1086.               <li class="instagram"><a href="https://www.instagram.com/uniformtown/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_instagram.svg);"></a></li>
  1087.               <li class="fb"><a href="https://www.facebook.com/uniformtown91/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_fb.svg);"></a></li>
  1088.               <li class="youtube"><a href="https://www.youtube.com/channel/UCkSwlrLc4G-y_35KddreLxQ" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_youtube.svg);"></a></li>
  1089.             </ul>
  1090.             <button type="button">✕ メニューを閉じる</button>
  1091.           </li>
  1092.         </ul>
  1093.       </div>
  1094.     </div>';
  1095.     }
  1096.     function makeImageURL($folder$id)
  1097.     {
  1098.         $filename substr($id, -11) . "/" $id "/main.jpg";
  1099.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1100.         $t $filename;
  1101.         $url "https://" $CFIMG_DOMAIN "/";
  1102.         $ret $url $folder "/" $filename;
  1103.         return $ret;
  1104.     }
  1105.     function display_form_text($text)
  1106.     {
  1107.         // //return stripslashes( htmlspecialchars($text,ENT_QUOTES) ); 20100609
  1108.         //return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  1109.         return LmHelper::display_form_text($text);
  1110.     }
  1111.     function sashikomi($srcHtml$vw 805)
  1112.     {
  1113.         $dstHtml $srcHtml;
  1114.         // 画像の処理
  1115.         $dstHtml $this->LM_sashikomi($dstHtml);
  1116.         /*
  1117.         $dstHtml = preg_replace('@(<img[^>]+?src="('.CFIMG_URL.'public_images)/([^\'">\s]+)\.([^\.\'">\s]+)"[\s\S]*?>)@', '<picture><source media="(max-width: 320px)" type="image/webp" srcset="$2_320/$3.webp"><source media="(max-width: 640px)" type="image/webp" srcset="$2_640/$3.webp"><source media="(max-width: 320px)" srcset="$2_320/$3.$4"><source media="(max-width: 640px)" srcset="$2_640/$3.$4"><source type="image/webp" srcset="$2/$3.webp">$1</picture>', $dstHtml);
  1118.         */
  1119.         // スタイルタグの削除
  1120.         $dstHtml preg_replace_callback('/<style[\s\S]+?\/style>/', function ($matches) {
  1121.             if (preg_match('/<style[^>]+responsive/'$matches[0])) {
  1122.                 return $matches[0];
  1123.             } else {
  1124.                 return '';
  1125.             }
  1126.         }, $dstHtml);
  1127.         // 特定のインラインスタイルを削除
  1128.         // $dstHtml = preg_replace('/\s*(?:(?:margin|padding)(?:-(?:top|left|bottom|right))?|font-size)\s*:[^;]+;/', '', $dstHtml);
  1129.         // $dstHtml = preg_replace('/(style="[^">]*)(?:width)\s*:[^;]+;/', '$1', $dstHtml);
  1130.         // $dstHtml = preg_replace('/(style="[^">]*)(?:height)\s*:[^;]+;/', '$1', $dstHtml);
  1131.         // インラインスタイルでのpx指定は calc() に置換し、デバイスの画面幅を基準に計算させる
  1132.         $dstHtml preg_replace_callback('/\s*(?:(?:margin|padding)(?:-(?:top|left|bottom|right))?|font-size|top|left|bottom|right)\s*:[^;]+;/', function ($matches) use ($vw) {
  1133.             $dst $src $matches[0];
  1134.             $dst preg_replace('/-[0-9.]+px/'"0"$dst);
  1135.             $dst preg_replace('/([0-9.]+)px/'"calc($1 * (100vw / {$vw}))"$dst);
  1136.             return $dst;
  1137.         }, $dstHtml);
  1138.         $dstHtml preg_replace_callback('/(style="[^">]*)(?:width|height)\s*:[^;]+;/', function ($matches) use ($vw) {
  1139.             return preg_replace('/(width|height)[:\s]+([0-9.-]+)px/'"$1: calc($2 * (100vw / {$vw}))"$matches[0]);
  1140.         }, $dstHtml);
  1141.         // 特定の属性を削除
  1142.         $dstHtml preg_replace('/ width="?[^"\s>]+"?/'''$dstHtml);
  1143.         $dstHtml preg_replace('/ height="?[^"\s>]+"?/'''$dstHtml);
  1144.         // インライン要素間の余白を詰める
  1145.         $dstHtml preg_replace('/(\/a>)[\s]+?(<a)/''$1$2'$dstHtml);
  1146.         // 試しに<br>をSPでも出力してみる
  1147.         // // <br>はSPでは不要
  1148.         // if (!preg_match('@^/sp/owabi/@', $_SERVER['REQUEST_URI'])) // SPのお詫びページのみ<br>を削除せず
  1149.         // $dstHtml = preg_replace('/((?:\s*<br(?:[\s\/]*?)>)+)/', '', $dstHtml);
  1150.         //縮小画像取得エラー時のjsイベント処理
  1151.         $dstHtml preg_replace('/(\<img)[\s]+/''$1 onerror="replaceImg(this)"'$dstHtml);
  1152.         //
  1153.         $dstHtml $this->goodsPriceService->embedGoodsPrice($dstHtml);
  1154.         echo $dstHtml;
  1155.     }
  1156.     public function display_item_pulldown()
  1157.     {
  1158.         $base_link preg_replace('!/*(?:\?.+)?$!'''$_SERVER['REQUEST_URI']);
  1159.         $display_item_count_list $this->commonService->GetYaml('DisplayItem.yaml');
  1160.         /**
  1161.          * 表示件数プルダウン
  1162.          */
  1163.         $order_type_param = isset($_GET['type']) ? 'type=' . (int)$_GET['type'] . '&' '';
  1164.         $display_count_pulldown = array(
  1165.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'] . '件''link' => $base_link "/?{$order_type_param}disp=" $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'], 'selected' => false),
  1166.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM'] . '件''link' => $base_link "/?{$order_type_param}disp=" self::DISPLAY_ITEM_COUNT_MID'selected' => false),
  1167.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'] . '件''link' => $base_link "/?{$order_type_param}disp=" $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'], 'selected' => false),
  1168.         );
  1169.         // 表示件数プルダウン選択処理
  1170.         if (isset($_SESSION['display_max'])) {
  1171.             switch ((int)$_SESSION['display_max']) {
  1172.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW']:
  1173.                     $display_count_pulldown[0]->selected true;
  1174.                     break;
  1175.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM']:
  1176.                     $display_count_pulldown[1]->selected true;
  1177.                     break;
  1178.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH']:
  1179.                     $display_count_pulldown[2]->selected true;
  1180.                     break;
  1181.                 default:
  1182.                     $display_count_pulldown[1]->selected true;
  1183.                     break;
  1184.             }
  1185.         } else {
  1186.             if (isset($_GET['disp'])) {
  1187.                 switch ((int)$_GET['disp']) {
  1188.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW']:
  1189.                         $display_count_pulldown[0]->selected true;
  1190.                         break;
  1191.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM']:
  1192.                         $display_count_pulldown[1]->selected true;
  1193.                         break;
  1194.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH']:
  1195.                         $display_count_pulldown[2]->selected true;
  1196.                         break;
  1197.                     default:
  1198.                         $display_count_pulldown[1]->selected true;
  1199.                         break;
  1200.                 }
  1201.             } else {
  1202.                 foreach ($display_count_pulldown as $option) {
  1203.                     if ($option->count === $display_item_count_list['DISPLAY_ITEM_COUNT_DEFAULT']) $option->selected true;
  1204.                 }
  1205.             }
  1206.         }
  1207.         return $display_count_pulldown;
  1208.     }
  1209.     /**
  1210.      * Decode JSON string in Twig templates.
  1211.      * Returns associative array on success, otherwise empty array.
  1212.      *
  1213.      * @param mixed $value
  1214.      * @return array
  1215.      */
  1216.     public function twigJsonDecode($value)
  1217.     {
  1218.         if (is_array($value)) {
  1219.             return $value;
  1220.         }
  1221.         if (!is_string($value) || $value === '') {
  1222.             return [];
  1223.         }
  1224.         $decoded json_decode($valuetrue);
  1225.         return (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) ? $decoded : [];
  1226.     }
  1227.     public function display_order_pulldown($useRecommendedItemOrder)
  1228.     {
  1229.         $base_link preg_replace('!/*(?:\?.+)?$!'''$_SERVER['REQUEST_URI']);
  1230.         $display_order_list $this->commonService->GetYaml('DisplayOrder.yaml')['DISPLAY_ORDER_ITEM'];
  1231.         /**
  1232.          * 表示順プルダウン
  1233.          */
  1234.         $display_count_param = isset($_GET['disp']) ? '&disp=' . (int)$_GET['disp'] : '';
  1235.         $display_order_pulldown = array(
  1236.             (object)array('label' => $display_order_list[0], 'link' => $base_link '/?type=6' $display_count_param'selected' => false),
  1237.             (object)array('label' => $display_order_list[1], 'link' => $base_link '/?type=0' $display_count_param'selected' => false),
  1238.             (object)array('label' => $display_order_list[2], 'link' => $base_link '/?type=5' $display_count_param'selected' => false),
  1239.             (object)array('label' => $display_order_list[3], 'link' => $base_link '/?type=1' $display_count_param'selected' => false),
  1240.             (object)array('label' => $display_order_list[4], 'link' => $base_link '/?type=3' $display_count_param'selected' => false),
  1241.         );
  1242.         // 表示順プルダウン選択処理
  1243.         //$order_param = '';
  1244.         if (isset($_SESSION['order_type'])) {
  1245.             switch ((int)$_SESSION['order_type']) {
  1246.                 case 0:
  1247.                     $display_order_pulldown[1]->selected true;
  1248.                     break;
  1249.                 case 1:
  1250.                     $display_order_pulldown[3]->selected true;
  1251.                     break;
  1252.                 case 3:
  1253.                     $display_order_pulldown[4]->selected true;
  1254.                     break;
  1255.                 case 5:
  1256.                     $display_order_pulldown[2]->selected true;
  1257.                     break;
  1258.                 case 6:
  1259.                     $display_order_pulldown[0]->selected true;
  1260.                     break;
  1261.                 default:
  1262.                     break;
  1263.             }
  1264.         } else {
  1265.             if (isset($_GET['type'])) {
  1266.                 switch ((int)$_GET['type']) {
  1267.                     case 0:
  1268.                         $display_order_pulldown[1]->selected true;
  1269.                         break;
  1270.                     case 1:
  1271.                         $display_order_pulldown[3]->selected true;
  1272.                         break;
  1273.                     case 3:
  1274.                         $display_order_pulldown[4]->selected true;
  1275.                         break;
  1276.                     case 5:
  1277.                         $display_order_pulldown[2]->selected true;
  1278.                         break;
  1279.                     case 6:
  1280.                         $display_order_pulldown[0]->selected true;
  1281.                         break;
  1282.                     default:
  1283.                         break;
  1284.                 }
  1285.             }
  1286.         }
  1287.         // おすすめ順が無効なときはプルダウンから外す
  1288.         if (!$useRecommendedItemOrderarray_shift($display_order_pulldown);
  1289.         return $display_order_pulldown;
  1290.     }
  1291.     public function getSessionData()
  1292.     {
  1293.         return $_SESSION;
  1294.     }
  1295.     /**
  1296.      * @param GoodsWithRelated $goods
  1297.      * @return string
  1298.      */
  1299.     public function renderGoodsLabelList(GoodsWithRelated $goods)
  1300.     {
  1301.         //
  1302.         $labelList $goods->getLabelList();
  1303.         //
  1304.         return $this->twig->render('Item/Parts/goods_label_list.twig', [
  1305.             'labelList' => $labelList,
  1306.         ]);
  1307.     }
  1308.     public function renderProductItem($item_data$useCache$average$col_count$vendingStatusMap = [])
  1309.     {
  1310.         // TODO: CFIMG_URL, BACKIMG_URLの変更
  1311.         $CFIMG_URL 'https://img0.land-mark.biz/ut_img/';
  1312.         $CATEGORY_LIST_ICON_ID_NO_SHOW 0;        // アイコンなし
  1313.         $CATEGORY_LIST_ICON_ID_SS 1;        // 春夏
  1314.         $CATEGORY_LIST_ICON_ID_AW 2;        // 秋冬
  1315.         $CATEGORY_LIST_ICON_ID_ALL 3;        // 通年
  1316.         $CATEGORY_LIST_ICON_ID_BOUKAN 4;        // 防寒
  1317.         // ジェンダーマップ
  1318.         $GENDER_ICON_MAP = array(
  1319.             => array('label' => '男性用''class' => 'goods-icon-male'),
  1320.             => array('label' => '女性用''class' => 'goods-icon-female'),
  1321.             => array('label' => '男女兼用''class' => 'goods-icon-unisex'),
  1322.             => array('label' => '子供用''class' => 'goods-icon-kids')
  1323.         );
  1324.         // アイコンマップ
  1325.         $CATEGORY_LIST_ICON_MAP = array(
  1326.             $CATEGORY_LIST_ICON_ID_SS => array('label' => '春夏''class' => 'goods-icon-ss'),
  1327.             $CATEGORY_LIST_ICON_ID_AW => array('label' => '秋冬''class' => 'goods-icon-aw'),
  1328.             $CATEGORY_LIST_ICON_ID_ALL => array('label' => '通年''class' => 'goods-icon-all'),
  1329.             $CATEGORY_LIST_ICON_ID_BOUKAN => array('label' => '防寒''class' => 'goods-icon-boukan')
  1330.         );
  1331.         $color_tip_max 30;
  1332.         $color_tip_break_at $color_tip_max 2;
  1333.         // アイコン
  1334.         if (
  1335.             (int)$item_data['goods_target_gender'] !== ||
  1336.             // (int)$item_data['color_count'] !== 0 ||
  1337.             (int)$item_data['goods_category_list_icon_id'] !== $CATEGORY_LIST_ICON_ID_NO_SHOW
  1338.         ) {
  1339.             echo '<div class="goods-icon-wrapper"><ul>';
  1340.             if (isset($GENDER_ICON_MAP[$item_data['goods_target_gender']])) {
  1341.                 echo '<li class="' $GENDER_ICON_MAP[$item_data['goods_target_gender']]['class'] . '">' $GENDER_ICON_MAP[$item_data['goods_target_gender']]['label'] . '</li>';
  1342.             }
  1343.            if ((int)$item_data['color_count'] !== 0) {
  1344.                echo '<li class="goods-icon goods-icon-color">' $item_data['color_count'] . '色</li>';
  1345.            }
  1346.             if (isset($CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']])) {
  1347.                 echo '<li class="' $CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']]['class'] . '">' $CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']]['label'] . '</li>';
  1348.             }
  1349.             echo '</ul></div>';
  1350.         }
  1351.         // // カラーチップ
  1352.         echo '<div class="item-color-tip"><ul>';
  1353.         foreach ($item_data['color_list'] as $color_idx => $rgb) {
  1354.             if ($color_idx === $color_tip_max) break;
  1355.             if ($color_idx !== && ($color_idx) % $color_tip_break_at === 0) {
  1356.                 echo '</ul><ul>';
  1357.             }
  1358.             echo '<li style="background-color: ' $rgb ';"></li>';
  1359.         }
  1360.         echo '</ul></div>';
  1361.         $goods_name_with_vending_status $this->getGoodsNameWithVendingStatusTo($item_data$vendingStatusMap);
  1362.         echo '<div class="gcont2"><div class="gname cat-list"><h3>';
  1363.         echo $this->displayText(!empty($goods_name_with_vending_status) ? $goods_name_with_vending_status $item_data['goods_name']);
  1364.         echo '<span>&nbsp;</span></h3></div>';
  1365.         echo '<div class="item-info">
  1366.                     <table>
  1367.                         <tr class="item-info-kataban">
  1368.                             <th><span>商品番号:</span></th><td><span>' $this->displayText($item_data['kataban']) . '</span></td>
  1369.                         </tr>';
  1370. //var_dump($item_data);
  1371. //        if (!$useCache) {
  1372.         if ($item_data['teika']) {
  1373.             echo '<tr class="item-info-list-price">
  1374.                             <th><span>定価:</span></th>';
  1375.             echo '<td><span>' number_format($item_data['teika']) . '</span><span>円 (税込)</span></td>';
  1376.             echo '</tr>';
  1377.         } else  {
  1378.             echo '<tr class="item-info-list-price">
  1379.                             <th></th>';
  1380.             echo '<td></td>';
  1381.             echo '</tr>';
  1382.         }
  1383.             echo '            <tr class="item-info-price">
  1384.                             <th><span>売価:</span></th>
  1385.                             <td><span style="font-size:24px;">' number_format($item_data['price']*1.10) . '</span><span>円(税込)</span></td></tr>';
  1386. /*        } else {
  1387.             echo '<tr class="item-info-list-price">
  1388.                             <th><span>定価:</span></th>
  1389.                             <td><span class="gprice_teika fbt-lazy"></span></td>
  1390.                         </tr>
  1391.                         <tr class="item-info-price">
  1392.                             <th><span>売価:</span></th>
  1393.                             <td><span class="gprice fbt-lazy price"></span><span class="yen_txt">円 (税込)</span></td>
  1394.                         </tr>';
  1395.         }*/
  1396.         echo '</table></div>';
  1397.         echo '<div class="gtest">';
  1398.         if (!empty($item_data['average'])) {
  1399.             $average_for_image = (int)($item_data['average'] * 2) / 2;
  1400.             echo '<div class="item-review-star">
  1401.         <img alt="お客様からの口コミレビュー評価の星の数' $average_for_image '" src="' $CFIMG_URL 'public_images/review/star_m' . ($average_for_image 10) . '.gif"><span class="item-review-star-average"></span><span class="item-review-star-review-count">(' $item_data['review_count'] . '<span class="item-review-star-review-count-unit"></span>)</span>
  1402.       </div>';
  1403.         }
  1404.         if ($item_data['goods_caption'] != "") {
  1405.             echo '<p class="item-caption">' mb_eregi_replace(" """$item_data['goods_caption']) . '<span>&nbsp;</span></p>';
  1406.         }
  1407.         echo '</div><!-- /.gtest -->';
  1408.         echo '</div>';
  1409.     }
  1410.     public function getGoodsNameWithVendingStatusTo($goods_data$vendingStatusMap)
  1411.     {
  1412.         if (!isset($goods_data['goods_id']) || !isset($goods_data['goods_name'])) return null;
  1413.         $VENDING_STATUS_MAP $vendingStatusMap;
  1414.         $GOODS_VENDING_STATUS_IS_VENDING 1;    // 販売中
  1415.         $GOODS_VENDING_STATUS_IS_SOLD_OUT 2;    // 完売
  1416.         $GOODS_VENDING_STATUS_IS_DISCONTINUED 3;    // 廃番
  1417.         $GOODS_VENDING_STATUS_EXCLUDE_MANUFACTURER_STOCK 4// メーカー在庫連携除外(バートルのみ対応)
  1418.         $GOODS_VENDING_STATUS_LABEL_MAP = [
  1419.             $GOODS_VENDING_STATUS_IS_VENDING => '販売継続中',
  1420.             $GOODS_VENDING_STATUS_IS_SOLD_OUT => '完売',
  1421.             $GOODS_VENDING_STATUS_IS_DISCONTINUED => '廃番',
  1422.             $GOODS_VENDING_STATUS_EXCLUDE_MANUFACTURER_STOCK => 'メーカー在庫連携除外(バートルのみ対応)'
  1423.         ];
  1424.         // キャッシュがなければ生成
  1425.         if (empty($VENDING_STATUS_MAP)) {
  1426.             //
  1427.             $rows $this->getGoodsVendingStatusListCache();
  1428.             //
  1429.             foreach ($rows as $row) {
  1430.                 $VENDING_STATUS_MAP[(int)$row['goods_id']] = (int)$row['goods_vending_status'];
  1431.             }
  1432.         }
  1433.         $vending_status $VENDING_STATUS_MAP[(int)$goods_data['goods_id']] ?? null;
  1434.         $prefix '';
  1435.         if (empty($vending_status)) {
  1436.             $createNewFlg true;
  1437.             $this->GoodsService->getGoodsVendingStatusMap($createNewFlg);
  1438.         }
  1439.         switch ($vending_status) {
  1440.             case $GOODS_VENDING_STATUS_IS_SOLD_OUT:
  1441.                 $prefix '[' $GOODS_VENDING_STATUS_LABEL_MAP[$GOODS_VENDING_STATUS_IS_SOLD_OUT] . '] ';
  1442.                 break;
  1443.             case $GOODS_VENDING_STATUS_IS_DISCONTINUED:
  1444.                 $prefix '[' $GOODS_VENDING_STATUS_LABEL_MAP[$GOODS_VENDING_STATUS_IS_DISCONTINUED] . '] ';
  1445.                 break;
  1446.         }
  1447.         $goods_data['goods_name'] = $prefix $goods_data['goods_name'];
  1448.         if (isset($goods_data['goods_new_name'])) $goods_data['goods_new_name'] = $prefix $goods_data['goods_new_name'];
  1449.         return $goods_data['goods_name'];
  1450.     }
  1451.     public function getGoodsVendingStatusListCache()
  1452.     {
  1453.         if (file_exists($filename 'files/goods/goods_vending_status_list.json')) {
  1454.             $json file_get_contents($filename);
  1455.             $goodsVendingStatusList json_decode($json);
  1456.         } else {
  1457.             $goodsVendingStatusList $this->dynamicConverter->getGoodsVendingStatusList();
  1458.         }
  1459.         return $goodsVendingStatusList;
  1460.     }
  1461.     function lm_category_filter($mcName$categoryData$data$items$subCategoryList$canonicalSubCategoryList$leftmenuForCategoryData$canonicalMcName$ctName)
  1462.     {
  1463.         $BACK_URL $this->eccubeConfig['BACK_URL'];
  1464. //        if ($categoryData == null) {
  1465. //            $data = $data;
  1466. //        } else {
  1467. //            // TODO: とりあえずコメントアウト
  1468. //             $data = $categoryData['main_category'];
  1469. //            return null;
  1470. //        }
  1471.         // SEO用のキーワード設定
  1472. //        if (in_array($data['main_category_name'], array("作業服・作業着", "作業服バートル", "医療白衣", "エプロン", "防寒服", "スタッフジャンパー", "メディカルウェア", "エステユニフォーム"))) {
  1473. //            $seoKeyword = "";
  1474. //        } else {
  1475. //            $seoKeyword = $data['main_category_name'] . " ";
  1476. //        }
  1477.         for ($i 1$i <= count($items); $i++) {
  1478.             $anImgUrl $this->displayText(str_replace(array('backoffice/''main_bsum'), array($BACK_URL'main_45x45'), $items[$i 1]['image']));
  1479.             $goodsImgUrl $this->displayText(str_replace(array('backoffice/''main_bsum'), array($BACK_URL'main_45x45'), $items[$i 1]['goods_image']));
  1480.             if ($items[$i 1]['category_id'] != "coordinate" and $items[$i 1]['category_id'] != "allitem") {
  1481.                 if (isset($leftmenuForCategoryData[$items[$i 1]['category_id']])) {
  1482.                     echo "<li class=\"sepa\">{$leftmenuForCategoryData[$items[$i 1]['category_id']]['category_name']}</li><br>";
  1483.                 }
  1484.                 if (!empty($subCategoryList[$items[$i 1]['category_id']])) {
  1485.                     if ($ctName === $subCategoryList[$items[$i 1]['category_id']]['category_webname']) {
  1486.                         echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;">';
  1487.                         echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1488.                         echo "</li>";
  1489.                     } else {
  1490.                         if (!empty($subCategoryList[$items[$i 1]['category_id']]['category_webname'])) {
  1491.                             echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;"><a href="/' $canonicalMcName "/" $subCategoryList[$items[$i 1]['category_id']]['category_webname'] . '/">';
  1492.                             echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1493.                             echo "</a></li>";
  1494.                         } elseif (!empty($canonicalSubCategoryList[$items[$i 1]['category_id']]['category_webname'])) {
  1495.                             echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;"><a href="/' $canonicalMcName "/" $canonicalSubCategoryList[$items[$i 1]['category_id']]['category_webname'] . '/">';
  1496.                             echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1497.                             echo "</a></li>";
  1498.                         }
  1499.                     }
  1500.                 }
  1501.             }
  1502.         }
  1503.     }
  1504.     public function custom_parse_url($value)
  1505.     {
  1506.         return parse_url($valuePHP_URL_QUERY);
  1507.     }
  1508.     public function echoImageURL($imgUrl)
  1509.     {
  1510.         $IMG_HOST_NAME $this->eccubeConfig['IMG_HOST_NAME'];
  1511.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1512.         $CFIMG_URL $this->eccubeConfig['CFIMG_URL'];
  1513.         $imgUrl "{$CFIMG_URL}/{$imgUrl}";
  1514.         //ドメインが「www.l-m.co.jp」 or 「images.l-m.co.jp」の場合
  1515.         if (strpos($imgUrl"images.l-m.co.jp") !== false or strpos($imgUrl$IMG_HOST_NAME) !== false) {
  1516.             //ドメインが「www.l-m.co.jp」の場合
  1517.             if (strpos($imgUrl$IMG_HOST_NAME) !== false) {
  1518.                 //httpsの時、httpへ変換
  1519.                 if (!((isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == "on") or $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) {
  1520.                     $newImgUrl str_replace("https://""http://"$imgUrl);
  1521.                 } else {
  1522.                     //httpの時、「images.l-m.co.jp」へ変換
  1523.                     $newImgUrl str_replace($IMG_HOST_NAME"images.l-m.co.jp"$imgUrl);
  1524.                 }
  1525.                 //ドメインが「images.l-m.co.jp」の場合
  1526.             } elseif (strpos($imgUrl"images.l-m.co.jp") !== false) {
  1527.                 //httpsの時、httpへ変換
  1528.                 if (!((isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == "on") or $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) {
  1529.                     $newImgUrl str_replace("https://""http://"$imgUrl);
  1530.                 } else {
  1531.                     $newImgUrl $imgUrl;
  1532.                 }
  1533.             }
  1534.             return $imgUrl;
  1535.         } else {
  1536.             $newImgUrl $imgUrl;
  1537.             //相対パスの場合
  1538.             if (strstr($imgUrl"images") !== false and strstr($imgUrl"public") === false) {
  1539.                 $strurl strstr($imgUrl"images");
  1540.                 $imgUrl "https://" $CFIMG_DOMAIN "/ut_img/" str_replace("images""public_images"$strurl);
  1541.             }
  1542.             return $imgUrl;
  1543.         }
  1544.     }
  1545.     public function echoVirtualImages($imgUrl)
  1546.     {
  1547.         $IMG_HOST_NAME $this->eccubeConfig['IMG_HOST_NAME'];
  1548.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1549.         $CFIMG_URL $this->eccubeConfig['CFIMG_URL'];
  1550.         $imgUrl "{$CFIMG_URL}/{$imgUrl}";
  1551.         if (strstr($imgUrl"images") !== false and strstr($imgUrl"virtual_images") === false) {
  1552.             $strurl strstr($imgUrl"images");
  1553.             $imgUrl "https://" $CFIMG_DOMAIN "/ut_img/" str_replace("images""virtual_images"$strurl);
  1554.         }
  1555.         return $imgUrl;
  1556.     }
  1557.     public function get_updated_at()
  1558.     {
  1559.         $week_day_list = array('日''月''火''水''木''金''土');
  1560.         return sprintf('%s (%s)%d時%d分'date('Y年n月j日'), $week_day_list[date('w')], date('H'), date('i'));
  1561.     }
  1562.     public function LM_displaySashikomi_detailGoods($data$noEcho false)
  1563.     {
  1564.         if ($data['goods_top_sashikomi'] != "") {
  1565.             $sashikomi_top $this->replaceItemImageRoot($data['goods_top_sashikomi']);
  1566.             if ($noEcho) return $sashikomi_top;
  1567.             echo $sashikomi_top;
  1568.         } elseif ($data['goods_top_html'] != "") {
  1569.             if (file_exists("files/insert/" $data['goods_top_html'])) {
  1570.                 $file implode(""file("files/insert/" $data['goods_top_html']));
  1571.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  1572.                 $tmp explode("<body>"$file);
  1573.                 if (count($tmp) > 1) {
  1574.                     $tmp explode("</body>"$tmp[1]);
  1575.                 } else {
  1576.                     $tmp explode("</body>"$tmp[0]);
  1577.                 }
  1578.                 $tmp $tmp[0];
  1579.                 $tmp $this->replaceItemImageRoot($tmp);
  1580.                 if ($noEcho) return "<div style='line-height:5px'></div>" $tmp;
  1581.                 echo "<div style='line-height:5px'></div>" $tmp;
  1582.             }
  1583.         }
  1584.         echo "";
  1585.     }
  1586.     function LM_insertFile($data)
  1587.     {
  1588.         if ($data['goods_bottom_sashikomi'] != "") {
  1589.             echo $this->replaceItemImageRoot($data['goods_bottom_sashikomi']);
  1590.         } elseif ($data['goods_html'] != "") {
  1591.             if (file_exists("files/insert/" $data['goods_html'])) {
  1592.                 $file implode(""file("files/insert/" $data['goods_html']));
  1593.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  1594.                 $tmp explode("<body>"$file);
  1595.                 if (count($tmp) > 1) {
  1596.                     $tmp explode("</body>"$tmp[1]);
  1597.                 } else {
  1598.                     $tmp explode("</body>"$tmp[0]);
  1599.                 }
  1600.                 $tmp $tmp[0];
  1601.                 $tmp $this->replaceItemImageRoot($tmp);
  1602.                 echo $tmp;
  1603.             }
  1604.         }
  1605.     }
  1606.     public function createGetParamater($moji "?"$expect ""$and "&"$equal "=")
  1607.     {
  1608.         $getVar $_GET;
  1609.         $form "";
  1610.         $array explode(","$expect);
  1611.         while (!is_null($key key($getVar))) {
  1612.             if (!in_array($key$array)) {
  1613.                 if ($form != "") {
  1614.                     //$form .= $and . $key . $equal . urlencode( LmHelper::display_form_text($getVar[$key]) ); 20110104 /の変換処理修正
  1615.                     $form .= $and $key $equal str_replace("%2F""%252F"urlencode(LmHelper::display_form_text($getVar[$key])));
  1616.                     urlencode($getVar[$key]);
  1617.                 } else {
  1618.                     //$form = $moji . $key . $equal . urlencode( LmHelper::display_form_text($getVar[$key]) ); 20110104 /の変換処理修正
  1619.                     $form $moji $key $equal str_replace("%2F""%252F"urlencode(LmHelper::display_form_text($getVar[$key])));
  1620.                 }
  1621.             }
  1622.             next($getVar);
  1623.         }
  1624.         return $form;
  1625.     }
  1626.     public function LM_displayTogetherBuyDetail_new3($id$is_secret true$count false)
  1627.     {
  1628.         $rs $this->dynamicConverter->getGoodsLinkSelect($id$is_secret$count);
  1629.         $result = array();
  1630.         if (isset($rs)) {
  1631.             foreach ($rs as $row) {
  1632.                 $goodsId $row['goods_id'];
  1633.                 $result[$goodsId] = $row;
  1634.                 $average $this->dynamicConverter->getReviewAverage($goodsId);
  1635.                 $average = (!empty($average[$row['goods_id']])) ? $average[$row['goods_id']] : 0;
  1636.                 $image_name = (int)($average 2) / 10;
  1637.                 $result[$goodsId]['average'] = $average;
  1638.                 $result[$goodsId]['average_img'] = "<img class=\"history-average-img\" alt=\"お客様からの口コミレビュー評価の星の数{$average}\" src=\"/images/review/star_m{$image_name}.gif\">";
  1639.                 //$tempRow = $this->dynamicConverter->getReview($id, $is_secret);
  1640.                 //$result[$goodsId]['review_count'] = count($tempRow);
  1641.                 $result[$goodsId]['img'] = $this->makeImageURL("goods.img"$goodsId);
  1642.             }
  1643.         }
  1644.         return $result;
  1645.     }
  1646.     /**
  1647.      * Use this instead of `include 'Common/hoge.twig'`.
  1648.      *
  1649.      * @param string $hoge
  1650.      * @param string|null $piyo
  1651.      * @return string
  1652.      * @throws \Twig\Error\LoaderError
  1653.      * @throws \Twig\Error\RuntimeError
  1654.      * @throws \Twig\Error\SyntaxError
  1655.      */
  1656.     function hoge(string $hogestring $piyo null)
  1657.     {
  1658.         //
  1659.         $route $this->request->get('_route');
  1660.         $url $this->request->getPathInfo();
  1661.         //
  1662.         $context compact('hoge''piyo''route''url');
  1663.         //
  1664.         return $this->twig->render('Common/hoge.twig'$context);
  1665.     }
  1666.     public function getCommonContentsMap()
  1667.     {
  1668.         $common_contents_map $this->dynamicConverter->getCommonContentsMap($this->eccubeConfig['CommonContents']['SITE_TYPE_UT'], $this->eccubeConfig['CommonContents']['DEVICE_TYPE_SP'], $this->eccubeConfig['CommonContents']['IS_NOT_SUPER_CATEGORY_ID']);
  1669.         $common_header_contents_all '';
  1670.         $common_header_contents '';
  1671.         $uri $_SERVER['REQUEST_URI'];
  1672.         $webname trim($uri'/');
  1673.         if (isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_ALL']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']])) {
  1674.             $common_header_contents_all $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_ALL']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']];
  1675.         }
  1676.         if ($uri == '/' && isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_TOP']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']])) {
  1677.             $common_header_contents $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_TOP']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']];
  1678.         }
  1679.         else if (isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_SUPER_CATEGORY']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']][$webname])) {
  1680.             $common_header_contents $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_SUPER_CATEGORY']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']][$webname];
  1681.         }
  1682.         return [
  1683.             'common_header_contents_all' => $common_header_contents_all,
  1684.             'common_header_contents' => $common_header_contents
  1685.         ];
  1686.     }
  1687.     public function getCalendarInfo()
  1688.     {
  1689.         $week_array explode(",""7,1,2,3,4,5,6");
  1690.         //現在月を判別
  1691.         $now_array explode("-"date("Y-m-d"));
  1692.         //翌月を表示する
  1693.         $now_array array_merge($now_arrayexplode("-"date("Y-m-d"mktime(000intval($now_array[1]) + 11intval($now_array[0])))));
  1694.         //当日日付
  1695.         $today date("Ymd");
  1696.         $meyasun_date 0;    //お届け日の目安フラグ
  1697.         $add 1;
  1698.         if (date("Hi") >= "1200") {
  1699.             $add 2;
  1700.         }
  1701.         $prefecture 0;
  1702.         $options "";
  1703.         //加工
  1704.         $url "https://www.l-m.co.jp/index/check-holiday?date=" date("Y-m-d") . "&add=" $add "&kakou=1&area=0";
  1705.         $output file_get_contents($url);
  1706.         $obj json_decode($outputtrue);
  1707.         $date $obj['result'];
  1708.         $kakou_date substr($date04) . "-" ltrim(substr($date42), 0) . "-" ltrim(substr($date62), 0);
  1709.         //無地
  1710.         $url "https://www.l-m.co.jp/index/check-holiday?date=" date("Y-m-d") . "&add=" $add "&kakou=0&area=0";
  1711.         $output file_get_contents($url);
  1712.         $obj json_decode($outputtrue);
  1713.         $date $obj['result'];
  1714.         $muji_date substr($date04) . "-" ltrim(substr($date42), 0) . "-" ltrim(substr($date62), 0);
  1715.         return [
  1716.             'week_array' => $week_array,
  1717.             'now_array' => $now_array,
  1718.             'kakou_date' => $kakou_date,
  1719.             'muji_date' => $muji_date,
  1720.             'today' => $today
  1721.         ];
  1722.     }
  1723.     public function getHolidayInfo($year$month$day$week$count)
  1724.     {
  1725.         return $this->dynamicConverter->getHolidayInfo(intval($year), intval($month), intval($day), intval($week), intval($count));
  1726.     }
  1727.     /**
  1728.      * カート内の商品のIDを取得する
  1729.      * TODO: 現状、最初の1件のみを取得。
  1730.      *
  1731.      * @return int|void
  1732.      */
  1733.     protected function getGoodsIdFromCart()
  1734.     {
  1735.         //
  1736.         foreach ($this->cartService->getCarts() as $cart) {
  1737.             foreach ($cart->getCartItems() as $item) {
  1738.                 return $item->getProductClass()->getProduct()->getId();
  1739.             }
  1740.         }
  1741.     }
  1742.     public function getYouMayAlsoLike($goodsId null$count false)
  1743.     {
  1744.         //
  1745.         if (($goodsId !== null) || ($goodsId $this->getGoodsIdFromCart())) {
  1746.             //
  1747.             $displayTogether $this->reviewService->LM_displayTogetherBuyDetail_new3($goodsId$count);
  1748.             if (empty($displayTogether)) {
  1749.                 return null;
  1750.             }
  1751.             //
  1752.             $context compact('displayTogether');
  1753.             //
  1754.             return $this->twig->render('Review/recentview.twig'$context);
  1755.         }
  1756.         //
  1757.         return null;
  1758.     }
  1759.     /**
  1760.      * Get count of koe for template
  1761.      *
  1762.      * @return $koe_count
  1763.      */
  1764.     public function getKoeCount()
  1765.     {
  1766.         $viewCacheKey $this->lmHelper->getCacheKey('getKoeCount', []);
  1767.         return $this->getCacheByKey($viewCacheKey, function() {
  1768.             $koe_count $this->dynamicConverter->LM_get_koe_count();
  1769.             return $koe_count;
  1770.         });
  1771.     }
  1772.     /**
  1773.      * カテゴリページの表示順(order_type)を返す。
  1774.      *
  1775.      * @return int $order_type 表示順
  1776.      */
  1777.     public function getCategoryOrderType(){
  1778.         if( !is_null($this->request->get('type')) ){
  1779.             return (int)$this->request->get('type');
  1780.         }
  1781.         else {
  1782.             $session $this->request->getSession();
  1783.             if( $session->has('order_type') ){
  1784.                 return (int)$session->get('order_type');
  1785.             }
  1786.         }
  1787.         return null;
  1788.     }
  1789.     /**
  1790.      * @return bool
  1791.      */
  1792.     public function isShowSpHeader()
  1793.     {
  1794.         //
  1795.         $_route $this->request->get('_route');
  1796.         $cartCount $this->get_carts_total_quantity();
  1797.         //
  1798.         if ($_route === 'cart') {
  1799.             // カート(STEP 1)
  1800.             if ($cartCount == 0) {
  1801.                 // カート内の商品が1点も無い時だけ表示
  1802.                 return true;
  1803.             } else {
  1804.                 //
  1805.                 return true;
  1806.             }
  1807.         } else if (preg_match('@(?:shopping|estimate)@'$_route)) {
  1808.             // ショッピング(STEP 2-5)、見積シミュは非表示
  1809.             return true;
  1810.         } else {
  1811.             // それ以外はOK
  1812.             return true;
  1813.         }
  1814.     }
  1815.     /**
  1816.      * @param Goods $goods
  1817.      * @return string
  1818.      * @throws \Twig\Error\LoaderError
  1819.      * @throws \Twig\Error\RuntimeError
  1820.      * @throws \Twig\Error\SyntaxError
  1821.      */
  1822.     public function getSizeTable(Goods $goods)
  1823.     {
  1824.         //
  1825.         list($SizeList,$SizePosition) = $this->dynamicConverter->LM_displaySizeMatrix_cross2($goods->getGoodsId());
  1826.         //
  1827.         return $this->twig->render('Common/SizeTable.twig'compact('goods''SizeList''SizePosition'));
  1828.     }
  1829.     /**
  1830.      * Get campaign flags for a product
  1831.      * 
  1832.      * @param int $productId
  1833.      * @return array
  1834.      */
  1835.     public function getCampaignFlags($productId)
  1836.     {
  1837.         try {
  1838.             $sqlService = new \Lm\Service\Db\SqlService();
  1839.             $goodsData $sqlService
  1840.                 ->Table('goods_table')
  1841.                 ->Where('goods_id = :goods_id')
  1842.                 ->Param(':goods_id'$productId)
  1843.                 ->Find();
  1844.             
  1845.             if ($goodsData) {
  1846.                 return [
  1847.                     'yoridori' => (int)($goodsData['campaign_yoridori'] ?? 0),
  1848.                     'matome' => (int)($goodsData['campaign_matome'] ?? 0)
  1849.                 ];
  1850.             }
  1851.         } catch (\Throwable $e) {
  1852.             // Skip error
  1853.         }
  1854.         
  1855.         return [
  1856.             'yoridori' => 0,
  1857.             'matome' => 0
  1858.         ];
  1859.     }
  1860.     /**
  1861.      * Get active Matome campaign info for a product (percent and min count)
  1862.      * Only returns data if the product has campaign_matome=1 and there is at least one active Matome campaign.
  1863.      *
  1864.      * @param int $productId
  1865.      * @return array|null [ 'percent' => int, 'min' => int, 'name' => string ] or null if none
  1866.      */
  1867.     public function getMatomeCampaignInfo($productId)
  1868.     {
  1869.         try {
  1870.             $sqlService = new \Lm\Service\Db\SqlService();
  1871.             $goods $sqlService
  1872.                 ->Table('goods_table')
  1873.                 ->Where('goods_id = :gid')
  1874.                 ->Param(':gid', (int)$productId)
  1875.                 ->Find();
  1876.             if (empty($goods) || (int)($goods['campaign_matome'] ?? 0) !== 1) {
  1877.                 return null;
  1878.             }
  1879.             $now = (new \DateTime())->format('Y-m-d H:i:s');
  1880.             $campaigns $sqlService
  1881.                 ->Table('campaign_table')
  1882.                 ->Where('campaign_ddate IS NULL')
  1883.                 ->Where('campaign_type = 2')
  1884.                 ->Where('campaign_start <= :now')
  1885.                 ->Where('campaign_end >= :now')
  1886.                 ->Param(':now'$now)
  1887.                 ->FindAll();
  1888.             if (empty($campaigns)) {
  1889.                 return null;
  1890.             }
  1891.             // Pick the campaign with the highest percent
  1892.             $best null;
  1893.             foreach ($campaigns as $c) {
  1894.                 $percent = (float)($c['discount_percent'] ?? 0);
  1895.                 $min = (int)($c['min_product_count'] ?? 0);
  1896.                 if ($percent <= 0) { continue; }
  1897.                 if ($best === null || $percent $best['percent']) {
  1898.                     $best = [
  1899.                         'percent' => (int)round($percent),
  1900.                         'min' => $min,
  1901.                         'name' => (string)($c['campaign_name'] ?? ''),
  1902.                     ];
  1903.                 }
  1904.             }
  1905.             return $best;
  1906.         } catch (\Throwable $e) {
  1907.             return null;
  1908.         }
  1909.     }
  1910.     /**
  1911.      * Get active Yoridori campaign info for a product
  1912.      * Only returns data if the product has campaign_yoridori=1 and there is at least one active Yoridori campaign.
  1913.      *
  1914.      * @param int $productId
  1915.      * @return array|null [ 'percent' => int, 'name' => string ] or null if none
  1916.      */
  1917.     public function getYoridoriCampaignInfo($productId)
  1918.     {
  1919.         try {
  1920.             $sqlService = new \Lm\Service\Db\SqlService();
  1921.             $goods $sqlService
  1922.                 ->Table('goods_table')
  1923.                 ->Where('goods_id = :gid')
  1924.                 ->Param(':gid', (int)$productId)
  1925.                 ->Find();
  1926.             if (empty($goods) || (int)($goods['campaign_yoridori'] ?? 0) !== 1) {
  1927.                 return null;
  1928.             }
  1929.             $now = (new \DateTime())->format('Y-m-d H:i:s');
  1930.             $campaigns $sqlService
  1931.                 ->Table('campaign_table')
  1932.                 ->Where('campaign_ddate IS NULL')
  1933.                 ->Where('campaign_type = 1')
  1934.                 ->Where('campaign_start <= :now')
  1935.                 ->Where('campaign_end >= :now')
  1936.                 ->Param(':now'$now)
  1937.                 ->FindAll();
  1938.             if (empty($campaigns)) {
  1939.                 return null;
  1940.             }
  1941.             // Pick the campaign with the highest percent
  1942.             $best null;
  1943.             foreach ($campaigns as $c) {
  1944.                 $percent = (float)($c['discount_percent'] ?? 0);
  1945.                 $min = (int)($c['min_product_count'] ?? 0);
  1946.                 if ($percent <= 0) { continue; }
  1947.                 if ($best === null || $percent $best['percent']) {
  1948.                     $best = [
  1949.                         'percent' => (int)round($percent),
  1950.                         'min' => $min,
  1951.                         'name' => (string)($c['campaign_name'] ?? ''),
  1952.                     ];
  1953.                 }
  1954.             }
  1955.             return $best;
  1956.         } catch (\Throwable $e) {
  1957.             return null;
  1958.         }
  1959.     }
  1960. }