var/cache/dev/twig/74/748982afcd6e406888dc5d4af1eae82fc3a129eb124e25c909c58165e4f3379f.php line 53

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\SandboxExtension;
  6. use Twig\Markup;
  7. use Twig\Sandbox\SecurityError;
  8. use Twig\Sandbox\SecurityNotAllowedTagError;
  9. use Twig\Sandbox\SecurityNotAllowedFilterError;
  10. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  11. use Twig\Source;
  12. use Twig\Template;
  13. /* Product/list.twig */
  14. class __TwigTemplate_bef9dab78eb246ff81cb0084ef5ae32d4ccdad3d7561b2fda6b324d40f8004e5 extends \Eccube\Twig\Template
  15. {
  16.     private $source;
  17.     private $macros = [];
  18.     public function __construct(Environment $env)
  19.     {
  20.         parent::__construct($env);
  21.         $this->source $this->getSourceContext();
  22.         $this->blocks = [
  23.             'stylesheet' => [$this'block_stylesheet'],
  24.             'javascript' => [$this'block_javascript'],
  25.             'main' => [$this'block_main'],
  26.         ];
  27.     }
  28.     protected function doGetParent(array $context)
  29.     {
  30.         // line 11
  31.         return "default_frame.twig";
  32.     }
  33.     protected function doDisplay(array $context, array $blocks = [])
  34.     {
  35.         $macros $this->macros;
  36.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  37.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""Product/list.twig"));
  38.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  39.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""Product/list.twig"));
  40.         // line 13
  41.         $context["body_class"] = "product_page";
  42.         // line 11
  43.         $this->parent $this->loadTemplate("default_frame.twig""Product/list.twig"11);
  44.         $this->parent->display($contextarray_merge($this->blocks$blocks));
  45.         
  46.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  47.         
  48.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  49.     }
  50.     // line 16
  51.     public function block_stylesheet($context, array $blocks = [])
  52.     {
  53.         $macros $this->macros;
  54.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  55.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""stylesheet"));
  56.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  57.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""stylesheet"));
  58.         // line 17
  59.         echo "    <link rel=\"stylesheet\" href=\"";
  60.         echo twig_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("assets/css/product-list.css"), "html"nulltrue);
  61.         echo "\">
  62. ";
  63.         
  64.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  65.         
  66.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  67.     }
  68.     // line 20
  69.     public function block_javascript($context, array $blocks = [])
  70.     {
  71.         $macros $this->macros;
  72.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  73.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascript"));
  74.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  75.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascript"));
  76.         // line 21
  77.         echo "<script>
  78. (function() {
  79.     // Lấy URL hiện tại và tạo URLSearchParams
  80.     function getCurrentUrlParams() {
  81.         const urlParams = new URLSearchParams(window.location.search);
  82.         return urlParams;
  83.     }
  84.     // Cập nhật URL với category filters và reload
  85.     function updateCategoryFilters() {
  86.         const checkboxes = document.querySelectorAll('.filter-option__checkbox');
  87.         const urlParams = getCurrentUrlParams();
  88.         // Xóa tất cả category_filter[] cũ (có thể có nhiều giá trị)
  89.         const keysToDelete = [];
  90.         urlParams.forEach(function(value, key) {
  91.             if (key === 'category_filter[]' || key.startsWith('category_filter')) {
  92.                 keysToDelete.push(key);
  93.             }
  94.         });
  95.         keysToDelete.forEach(function(key) {
  96.             urlParams.delete(key);
  97.         });
  98.         // Thu thập các category IDs đã được chọn
  99.         const selectedCategoryIds = [];
  100.         checkboxes.forEach(function(checkbox) {
  101.             if (checkbox.checked) {
  102.                 selectedCategoryIds.push(checkbox.value);
  103.             }
  104.         });
  105.         // Chỉ thêm category_filter[] nếu có ít nhất một checkbox được chọn
  106.         if (selectedCategoryIds.length > 0) {
  107.             selectedCategoryIds.forEach(function(categoryId) {
  108.                 urlParams.append('category_filter[]', categoryId);
  109.             });
  110.         }
  111.         // Reset về trang 1 khi filter
  112.         urlParams.set('pageno', '1');
  113.         // Tạo URL mới
  114.         const queryString = urlParams.toString();
  115.         const newUrl = queryString
  116.             ? window.location.pathname + '?' + queryString
  117.             : window.location.pathname;
  118.         // Reload page với query params mới
  119.         window.location.href = newUrl;
  120.     }
  121.     // Khôi phục trạng thái checkbox từ URL và xử lý nút search
  122.     document.addEventListener('DOMContentLoaded', function() {
  123.         const checkboxes = document.querySelectorAll('.filter-option__checkbox');
  124.         const searchButton = document.querySelector('.btn-search');
  125.         // Khôi phục trạng thái checkbox từ URL
  126.         const urlParams = getCurrentUrlParams();
  127.         const selectedCategories = urlParams.getAll('category_filter[]');
  128.         checkboxes.forEach(function(checkbox) {
  129.             // Set checked nếu category ID có trong URL
  130.             if (selectedCategories.includes(checkbox.value)) {
  131.                 checkbox.checked = true;
  132.             }
  133.             // Không lắng nghe sự kiện change trên checkbox nữa
  134.         });
  135.         // Lắng nghe sự kiện click trên nút search
  136.         if (searchButton) {
  137.             searchButton.addEventListener('click', function() {
  138.                 updateCategoryFilters();
  139.             });
  140.         }
  141.     });
  142. })();
  143. </script>
  144. ";
  145.         
  146.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  147.         
  148.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  149.     }
  150.     // line 101
  151.     public function block_main($context, array $blocks = [])
  152.     {
  153.         $macros $this->macros;
  154.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  155.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""main"));
  156.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  157.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""main"));
  158.         // line 102
  159.         echo "
  160.  <body>
  161.   <!-- breadcrumb section -->
  162.   <div class=\"breadcrumb-section\">
  163.     <div class=\"container-1360 border-box px-40\">
  164.       <nav class=\"breadcrumb\">
  165.         <a href=\"#\" class=\"breadcrumb__item text-black\">ホーム</a>
  166.         <img src=\"";
  167.         // line 109
  168.         echo twig_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("assets/img/default/icons/icon-breadcrumb-arrow.svg"), "html"nulltrue);
  169.         echo "\" alt=\">\" class=\"breadcrumb__separator\">
  170.         <a href=\"#\" class=\"breadcrumb__item text-black\">商品一覧</a>
  171.       </nav>
  172.     </div>
  173.   </div>
  174.   <!-- product list section -->
  175.   <div class=\"container-1200\">
  176.     <div class=\"product-list-wrapper\">
  177.       <div class=\"product-list-left\">
  178.         ";
  179.         // line 119
  180.         if ((array_key_exists("searchable_categories"$context) && (twig_length_filter($this->env, (isset($context["searchable_categories"]) || array_key_exists("searchable_categories"$context) ? $context["searchable_categories"] : (function () { throw new RuntimeError('Variable "searchable_categories" does not exist.'119$this->source); })())) > 0))) {
  181.             // line 120
  182.             echo "          ";
  183.             $context['_parent'] = $context;
  184.             $context['_seq'] = twig_ensure_traversable((isset($context["searchable_categories"]) || array_key_exists("searchable_categories"$context) ? $context["searchable_categories"] : (function () { throw new RuntimeError('Variable "searchable_categories" does not exist.'120$this->source); })()));
  185.             foreach ($context['_seq'] as $context["_key"] => $context["group"]) {
  186.                 // line 121
  187.                 echo "            <div class=\"filter-group\">
  188.               <div class=\"filter-group__header\">";
  189.                 // line 122
  190.                 echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source$context["group"], "parent", [], "any"falsefalsefalse122), "name", [], "any"falsefalsefalse122), "html"nulltrue);
  191.                 echo "</div>
  192.               <div class=\"filter-group__options\">
  193.                 ";
  194.                 // line 124
  195.                 if ((twig_length_filter($this->envtwig_get_attribute($this->env$this->source$context["group"], "children", [], "any"falsefalsefalse124)) > 0)) {
  196.                     // line 125
  197.                     echo "                  ";
  198.                     $context['_parent'] = $context;
  199.                     $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env$this->source$context["group"], "children", [], "any"falsefalsefalse125));
  200.                     foreach ($context['_seq'] as $context["_key"] => $context["child"]) {
  201.                         // line 126
  202.                         echo "                    <label class=\"filter-option\">
  203.                       <input type=\"checkbox\"
  204.                              class=\"filter-option__checkbox\"
  205.                              name=\"category_filter[]\"
  206.                              value=\"";
  207.                         // line 130
  208.                         echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->source$context["child"], "id", [], "any"falsefalsefalse130), "html"nulltrue);
  209.                         echo "\"
  210.                              data-category-id=\"";
  211.                         // line 131
  212.                         echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->source$context["child"], "id", [], "any"falsefalsefalse131), "html"nulltrue);
  213.                         echo "\">
  214.                       <span class=\"filter-option__label\">";
  215.                         // line 132
  216.                         echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->source$context["child"], "name", [], "any"falsefalsefalse132), "html"nulltrue);
  217.                         echo "</span>
  218.                     </label>
  219.                   ";
  220.                     }
  221.                     $_parent $context['_parent'];
  222.                     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['child'], $context['_parent'], $context['loop']);
  223.                     $context array_intersect_key($context$_parent) + $_parent;
  224.                     // line 135
  225.                     echo "                ";
  226.                 } else {
  227.                     // line 136
  228.                     echo "                  ";
  229.                     // line 137
  230.                     echo "                  <label class=\"filter-option\">
  231.                     <input type=\"checkbox\"
  232.                            class=\"filter-option__checkbox\"
  233.                            name=\"category_filter[]\"
  234.                            value=\"";
  235.                     // line 141
  236.                     echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source$context["group"], "parent", [], "any"falsefalsefalse141), "id", [], "any"falsefalsefalse141), "html"nulltrue);
  237.                     echo "\"
  238.                            data-category-id=\"";
  239.                     // line 142
  240.                     echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source$context["group"], "parent", [], "any"falsefalsefalse142), "id", [], "any"falsefalsefalse142), "html"nulltrue);
  241.                     echo "\">
  242.                     <span class=\"filter-option__label\">";
  243.                     // line 143
  244.                     echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source$context["group"], "parent", [], "any"falsefalsefalse143), "name", [], "any"falsefalsefalse143), "html"nulltrue);
  245.                     echo "</span>
  246.                   </label>
  247.                 ";
  248.                 }
  249.                 // line 146
  250.                 echo "              </div>
  251.             </div>
  252.           ";
  253.             }
  254.             $_parent $context['_parent'];
  255.             unset($context['_seq'], $context['_iterated'], $context['_key'], $context['group'], $context['_parent'], $context['loop']);
  256.             $context array_intersect_key($context$_parent) + $_parent;
  257.             // line 149
  258.             echo "        ";
  259.         }
  260.         // line 150
  261.         echo "        <button class=\"btn-primary btn-search w-100\">
  262.             <span>検索する</span>
  263.             <svg class=\"btn-search-icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">
  264.             <rect width=\"24\" height=\"24\" rx=\"12\" fill=\"black\"/>
  265.             <path d=\"M16.252 12.001L16.249 12.0039L16.252 12.0068L11.7266 16.5312L10.5957 15.4004L13.1943 12.8027H7.72852V11.2031H13.1924L10.5957 8.60742L11.7266 7.47656L16.252 12.001Z\" fill=\"#FBE800\"/>
  266.             </svg>
  267.         </button>
  268.       </div>
  269.       <!-- bottom line -->
  270.       <div class=\"bottom-line container-mobile\"></div>
  271.       <!-- Product List Right -->
  272.       <div class=\"product-list-right\">
  273.         <div class=\"product-grid\" id=\"product-grid\">
  274.           ";
  275.         // line 163
  276.         if ((twig_get_attribute($this->env$this->source, (isset($context["pagination"]) || array_key_exists("pagination"$context) ? $context["pagination"] : (function () { throw new RuntimeError('Variable "pagination" does not exist.'163$this->source); })()), "totalItemCount", [], "any"falsefalsefalse163) > 0)) {
  277.             // line 164
  278.             echo "            ";
  279.             $context['_parent'] = $context;
  280.             $context['_seq'] = twig_ensure_traversable((isset($context["pagination"]) || array_key_exists("pagination"$context) ? $context["pagination"] : (function () { throw new RuntimeError('Variable "pagination" does not exist.'164$this->source); })()));
  281.             $context['loop'] = [
  282.               'parent' => $context['_parent'],
  283.               'index0' => 0,
  284.               'index'  => 1,
  285.               'first'  => true,
  286.             ];
  287.             if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
  288.                 $length count($context['_seq']);
  289.                 $context['loop']['revindex0'] = $length 1;
  290.                 $context['loop']['revindex'] = $length;
  291.                 $context['loop']['length'] = $length;
  292.                 $context['loop']['last'] = === $length;
  293.             }
  294.             foreach ($context['_seq'] as $context["_key"] => $context["Product"]) {
  295.                 // line 165
  296.                 echo "              <div class=\"product-item\">
  297.                 <a href=\"";
  298.                 // line 166
  299.                 echo twig_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("product_detail", ["id" => twig_get_attribute($this->env$this->source$context["Product"], "id", [], "any"falsefalsefalse166)]), "html"nulltrue);
  300.                 echo "\" class=\"product-card-small\">
  301.                   <div class=\"product-card-small__image\">
  302.                     <img src=\"";
  303.                 // line 168
  304.                 echo twig_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl($this->extensions['Eccube\Twig\Extension\EccubeExtension']->getNoImageProduct(twig_get_attribute($this->env$this->source$context["Product"], "main_list_image", [], "any"falsefalsefalse168)), "save_image"), "html"nulltrue);
  305.                 echo "\" alt=\"";
  306.                 echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->source$context["Product"], "name", [], "any"falsefalsefalse168), "html"nulltrue);
  307.                 echo "\" ";
  308.                 if ((twig_get_attribute($this->env$this->source$context["loop"], "index", [], "any"falsefalsefalse168) > 5)) {
  309.                     echo " loading=\"lazy\"";
  310.                 }
  311.                 echo ">
  312.                     <div class=\"product-card-small__arrow\">
  313.                         <img src=\"";
  314.                 // line 170
  315.                 echo twig_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("assets/img/default/icons/icon-heart.svg"), "html"nulltrue);
  316.                 echo "\" alt=\"Favorite\" loading=\"lazy\">
  317.                     </div>
  318.                   </div>
  319.                 </a>
  320.                 <div class=\"product-item__info\">
  321.                   <a href=\"";
  322.                 // line 175
  323.                 echo twig_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("product_detail", ["id" => twig_get_attribute($this->env$this->source$context["Product"], "id", [], "any"falsefalsefalse175)]), "html"nulltrue);
  324.                 echo "\">
  325.                     <h4 class=\"product-item__title\">";
  326.                 // line 176
  327.                 echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->source$context["Product"], "name", [], "any"falsefalsefalse176), "html"nulltrue);
  328.                 echo "</h4>
  329.                   </a>
  330.                   <div class=\"product-item__price\">
  331.                     <span class=\"price-symbol\">¥</span>
  332.                     <span class=\"price-amount\">
  333.                       ";
  334.                 // line 181
  335.                 if (twig_get_attribute($this->env$this->source$context["Product"], "hasProductClass", [], "any"falsefalsefalse181)) {
  336.                     // line 182
  337.                     echo "                        ";
  338.                     if ((twig_get_attribute($this->env$this->source$context["Product"], "getPrice02Min", [], "any"falsefalsefalse182) == twig_get_attribute($this->env$this->source$context["Product"], "getPrice02Max", [], "any"falsefalsefalse182))) {
  339.                         // line 183
  340.                         echo "                          ";
  341.                         echo twig_escape_filter($this->env$this->extensions['Eccube\Twig\Extension\EccubeExtension']->getPriceFilter(twig_get_attribute($this->env$this->source$context["Product"], "getPrice02IncTaxMin", [], "any"falsefalsefalse183)), "html"nulltrue);
  342.                         echo "
  343.                         ";
  344.                     } else {
  345.                         // line 185
  346.                         echo "                          ";
  347.                         echo twig_escape_filter($this->env$this->extensions['Eccube\Twig\Extension\EccubeExtension']->getPriceFilter(twig_get_attribute($this->env$this->source$context["Product"], "getPrice02IncTaxMin", [], "any"falsefalsefalse185)), "html"nulltrue);
  348.                         echo " ~ ";
  349.                         echo twig_escape_filter($this->env$this->extensions['Eccube\Twig\Extension\EccubeExtension']->getPriceFilter(twig_get_attribute($this->env$this->source$context["Product"], "getPrice02IncTaxMax", [], "any"falsefalsefalse185)), "html"nulltrue);
  350.                         echo "
  351.                         ";
  352.                     }
  353.                     // line 187
  354.                     echo "                      ";
  355.                 } else {
  356.                     // line 188
  357.                     echo "                        ";
  358.                     echo twig_escape_filter($this->env$this->extensions['Eccube\Twig\Extension\EccubeExtension']->getPriceFilter(twig_get_attribute($this->env$this->source$context["Product"], "getPrice02IncTaxMin", [], "any"falsefalsefalse188)), "html"nulltrue);
  359.                     echo "
  360.                       ";
  361.                 }
  362.                 // line 190
  363.                 echo "                    </span>
  364.                     <span class=\"price-tax\">(税込)</span>
  365.                   </div>
  366.                 </div>
  367.               </div>
  368.             ";
  369.                 ++$context['loop']['index0'];
  370.                 ++$context['loop']['index'];
  371.                 $context['loop']['first'] = false;
  372.                 if (isset($context['loop']['length'])) {
  373.                     --$context['loop']['revindex0'];
  374.                     --$context['loop']['revindex'];
  375.                     $context['loop']['last'] = === $context['loop']['revindex0'];
  376.                 }
  377.             }
  378.             $_parent $context['_parent'];
  379.             unset($context['_seq'], $context['_iterated'], $context['_key'], $context['Product'], $context['_parent'], $context['loop']);
  380.             $context array_intersect_key($context$_parent) + $_parent;
  381.             // line 196
  382.             echo "          ";
  383.         } else {
  384.             // line 197
  385.             echo "            <span>";
  386.             echo twig_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("front.product.search__product_not_found"), "html"nulltrue);
  387.             echo "</span>
  388.           ";
  389.         }
  390.         // line 199
  391.         echo "        </div>
  392.         <!-- Pagination -->
  393.         <div class=\"pagination-product-list-wrapper\">
  394.           <div class=\"pagination-product-list\" style=\"margin: 0 auto;\">
  395.             ";
  396.         // line 203
  397.         $this->loadTemplate("Block/_pagination.twig""Product/list.twig"203)->display(twig_array_merge($context, ["pages" => twig_get_attribute($this->env$this->source, (isset($context["pagination"]) || array_key_exists("pagination"$context) ? $context["pagination"] : (function () { throw new RuntimeError('Variable "pagination" does not exist.'203$this->source); })()), "paginationData", [], "any"falsefalsefalse203)]));
  398.         // line 204
  399.         echo "          </div>
  400.         </div>
  401.       </div>
  402.     </div>
  403.   </div>
  404.  </body>
  405. ";
  406.         
  407.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  408.         
  409.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  410.     }
  411.     public function getTemplateName()
  412.     {
  413.         return "Product/list.twig";
  414.     }
  415.     public function isTraitable()
  416.     {
  417.         return false;
  418.     }
  419.     public function getDebugInfo()
  420.     {
  421.         return array (  435 => 204,  433 => 203,  427 => 199,  421 => 197,  418 => 196,  399 => 190,  393 => 188,  390 => 187,  382 => 185,  376 => 183,  373 => 182,  371 => 181,  363 => 176,  359 => 175,  351 => 170,  340 => 168,  335 => 166,  332 => 165,  314 => 164,  312 => 163,  297 => 150,  294 => 149,  286 => 146,  280 => 143,  276 => 142,  272 => 141,  266 => 137,  264 => 136,  261 => 135,  252 => 132,  248 => 131,  244 => 130,  238 => 126,  233 => 125,  231 => 124,  226 => 122,  223 => 121,  218 => 120,  216 => 119,  203 => 109,  194 => 102,  184 => 101,  96 => 21,  86 => 20,  73 => 17,  63 => 16,  52 => 11,  50 => 13,  37 => 11,);
  422.     }
  423.     public function getSourceContext()
  424.     {
  425.         return new Source("{#
  426. This file is part of EC-CUBE
  427. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  428. http://www.ec-cube.co.jp/
  429. For the full copyright and license information, please view the LICENSE
  430. file that was distributed with this source code.
  431. #}
  432. {% extends 'default_frame.twig' %}
  433. {% set body_class = 'product_page' %}
  434. {# style #}
  435. {% block stylesheet %}
  436.     <link rel=\"stylesheet\" href=\"{{ asset('assets/css/product-list.css') }}\">
  437. {% endblock %}
  438. {% block javascript %}
  439. <script>
  440. (function() {
  441.     // Lấy URL hiện tại và tạo URLSearchParams
  442.     function getCurrentUrlParams() {
  443.         const urlParams = new URLSearchParams(window.location.search);
  444.         return urlParams;
  445.     }
  446.     // Cập nhật URL với category filters và reload
  447.     function updateCategoryFilters() {
  448.         const checkboxes = document.querySelectorAll('.filter-option__checkbox');
  449.         const urlParams = getCurrentUrlParams();
  450.         // Xóa tất cả category_filter[] cũ (có thể có nhiều giá trị)
  451.         const keysToDelete = [];
  452.         urlParams.forEach(function(value, key) {
  453.             if (key === 'category_filter[]' || key.startsWith('category_filter')) {
  454.                 keysToDelete.push(key);
  455.             }
  456.         });
  457.         keysToDelete.forEach(function(key) {
  458.             urlParams.delete(key);
  459.         });
  460.         // Thu thập các category IDs đã được chọn
  461.         const selectedCategoryIds = [];
  462.         checkboxes.forEach(function(checkbox) {
  463.             if (checkbox.checked) {
  464.                 selectedCategoryIds.push(checkbox.value);
  465.             }
  466.         });
  467.         // Chỉ thêm category_filter[] nếu có ít nhất một checkbox được chọn
  468.         if (selectedCategoryIds.length > 0) {
  469.             selectedCategoryIds.forEach(function(categoryId) {
  470.                 urlParams.append('category_filter[]', categoryId);
  471.             });
  472.         }
  473.         // Reset về trang 1 khi filter
  474.         urlParams.set('pageno', '1');
  475.         // Tạo URL mới
  476.         const queryString = urlParams.toString();
  477.         const newUrl = queryString
  478.             ? window.location.pathname + '?' + queryString
  479.             : window.location.pathname;
  480.         // Reload page với query params mới
  481.         window.location.href = newUrl;
  482.     }
  483.     // Khôi phục trạng thái checkbox từ URL và xử lý nút search
  484.     document.addEventListener('DOMContentLoaded', function() {
  485.         const checkboxes = document.querySelectorAll('.filter-option__checkbox');
  486.         const searchButton = document.querySelector('.btn-search');
  487.         // Khôi phục trạng thái checkbox từ URL
  488.         const urlParams = getCurrentUrlParams();
  489.         const selectedCategories = urlParams.getAll('category_filter[]');
  490.         checkboxes.forEach(function(checkbox) {
  491.             // Set checked nếu category ID có trong URL
  492.             if (selectedCategories.includes(checkbox.value)) {
  493.                 checkbox.checked = true;
  494.             }
  495.             // Không lắng nghe sự kiện change trên checkbox nữa
  496.         });
  497.         // Lắng nghe sự kiện click trên nút search
  498.         if (searchButton) {
  499.             searchButton.addEventListener('click', function() {
  500.                 updateCategoryFilters();
  501.             });
  502.         }
  503.     });
  504. })();
  505. </script>
  506. {% endblock %}
  507. {% block main %}
  508.  <body>
  509.   <!-- breadcrumb section -->
  510.   <div class=\"breadcrumb-section\">
  511.     <div class=\"container-1360 border-box px-40\">
  512.       <nav class=\"breadcrumb\">
  513.         <a href=\"#\" class=\"breadcrumb__item text-black\">ホーム</a>
  514.         <img src=\"{{ asset('assets/img/default/icons/icon-breadcrumb-arrow.svg') }}\" alt=\">\" class=\"breadcrumb__separator\">
  515.         <a href=\"#\" class=\"breadcrumb__item text-black\">商品一覧</a>
  516.       </nav>
  517.     </div>
  518.   </div>
  519.   <!-- product list section -->
  520.   <div class=\"container-1200\">
  521.     <div class=\"product-list-wrapper\">
  522.       <div class=\"product-list-left\">
  523.         {% if searchable_categories is defined and searchable_categories|length > 0 %}
  524.           {% for group in searchable_categories %}
  525.             <div class=\"filter-group\">
  526.               <div class=\"filter-group__header\">{{ group.parent.name }}</div>
  527.               <div class=\"filter-group__options\">
  528.                 {% if group.children|length > 0 %}
  529.                   {% for child in group.children %}
  530.                     <label class=\"filter-option\">
  531.                       <input type=\"checkbox\"
  532.                              class=\"filter-option__checkbox\"
  533.                              name=\"category_filter[]\"
  534.                              value=\"{{ child.id }}\"
  535.                              data-category-id=\"{{ child.id }}\">
  536.                       <span class=\"filter-option__label\">{{ child.name }}</span>
  537.                     </label>
  538.                   {% endfor %}
  539.                 {% else %}
  540.                   {# Nếu parent category cũng có is_searchable và không có children, hiển thị parent #}
  541.                   <label class=\"filter-option\">
  542.                     <input type=\"checkbox\"
  543.                            class=\"filter-option__checkbox\"
  544.                            name=\"category_filter[]\"
  545.                            value=\"{{ group.parent.id }}\"
  546.                            data-category-id=\"{{ group.parent.id }}\">
  547.                     <span class=\"filter-option__label\">{{ group.parent.name }}</span>
  548.                   </label>
  549.                 {% endif %}
  550.               </div>
  551.             </div>
  552.           {% endfor %}
  553.         {% endif %}
  554.         <button class=\"btn-primary btn-search w-100\">
  555.             <span>検索する</span>
  556.             <svg class=\"btn-search-icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">
  557.             <rect width=\"24\" height=\"24\" rx=\"12\" fill=\"black\"/>
  558.             <path d=\"M16.252 12.001L16.249 12.0039L16.252 12.0068L11.7266 16.5312L10.5957 15.4004L13.1943 12.8027H7.72852V11.2031H13.1924L10.5957 8.60742L11.7266 7.47656L16.252 12.001Z\" fill=\"#FBE800\"/>
  559.             </svg>
  560.         </button>
  561.       </div>
  562.       <!-- bottom line -->
  563.       <div class=\"bottom-line container-mobile\"></div>
  564.       <!-- Product List Right -->
  565.       <div class=\"product-list-right\">
  566.         <div class=\"product-grid\" id=\"product-grid\">
  567.           {% if pagination.totalItemCount > 0 %}
  568.             {% for Product in pagination %}
  569.               <div class=\"product-item\">
  570.                 <a href=\"{{ url('product_detail', {'id': Product.id}) }}\" class=\"product-card-small\">
  571.                   <div class=\"product-card-small__image\">
  572.                     <img src=\"{{ asset(Product.main_list_image|no_image_product, 'save_image') }}\" alt=\"{{ Product.name }}\" {% if loop.index > 5 %} loading=\"lazy\"{% endif %}>
  573.                     <div class=\"product-card-small__arrow\">
  574.                         <img src=\"{{ asset('assets/img/default/icons/icon-heart.svg') }}\" alt=\"Favorite\" loading=\"lazy\">
  575.                     </div>
  576.                   </div>
  577.                 </a>
  578.                 <div class=\"product-item__info\">
  579.                   <a href=\"{{ url('product_detail', {'id': Product.id}) }}\">
  580.                     <h4 class=\"product-item__title\">{{ Product.name }}</h4>
  581.                   </a>
  582.                   <div class=\"product-item__price\">
  583.                     <span class=\"price-symbol\">¥</span>
  584.                     <span class=\"price-amount\">
  585.                       {% if Product.hasProductClass %}
  586.                         {% if Product.getPrice02Min == Product.getPrice02Max %}
  587.                           {{ Product.getPrice02IncTaxMin|price }}
  588.                         {% else %}
  589.                           {{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
  590.                         {% endif %}
  591.                       {% else %}
  592.                         {{ Product.getPrice02IncTaxMin|price }}
  593.                       {% endif %}
  594.                     </span>
  595.                     <span class=\"price-tax\">(税込)</span>
  596.                   </div>
  597.                 </div>
  598.               </div>
  599.             {% endfor %}
  600.           {% else %}
  601.             <span>{{ 'front.product.search__product_not_found'|trans }}</span>
  602.           {% endif %}
  603.         </div>
  604.         <!-- Pagination -->
  605.         <div class=\"pagination-product-list-wrapper\">
  606.           <div class=\"pagination-product-list\" style=\"margin: 0 auto;\">
  607.             {% include \"Block/_pagination.twig\" with {'pages': pagination.paginationData} %}
  608.           </div>
  609.         </div>
  610.       </div>
  611.     </div>
  612.   </div>
  613.  </body>
  614. {% endblock %}
  615. ""Product/list.twig""/var/www/html/app/template/default/Product/list.twig");
  616.     }
  617. }