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

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