Jump to content

Edit History

gouna

gouna

L'url de la page est réinitialisée en même temps que les filtres sont remis à leur état d'origine. Avec la version "originale" du module, il n'y a pas la possibilité de réinitialiser les filtres par listing directement dans le listing "---" ; or ici cela serait lié à ce passage :

{block name='facet_item_dropdown'}
                  <div id="facet_{$_expand_id}" class="collpase--facet collapse{if !$_collapse} show{/if}">
                      <select class="custom-select">
                          <option value="">---</option>
                          {foreach from=$facet.filters item="filter"}
                              <option value="{$filter.nextEncodedFacetsURL}" {if $filter.active} selected="selected"{/if}>
                                  {$filter.label}
                                  {if $filter.magnitude and $show_quantities}
                                      ({$filter.magnitude})
                                  {/if}
                              </option>
                          {/foreach}
                      </select>

                  </div>
          {/block}


Voici le contenu du fichier "facets.tpl" dans "thème BLCK"/modules/ps_facetedsearch/views/templates/front/catalog

{if $displayedFacets|count}
  <div id="search_filters" class="search_filters">
    {block name='facets_title'}
      <p class="text-uppercase h6 visible--desktop">{l s='Filtrer :' d='Shop.Theme.Actions'}</p>
    {/block}

    {block name='facets_clearall_button'}
      {if $activeFilters|count}
        <div class="clear-all-wrapper">
          <button data-search-url="{$clear_all_link}" class="btn--clearfilter btn btn-sm btn-block btn-outline-secondary js-search-filters-clear-all">
            <i class="material-icons">&#xE14C;</i>
            {l s='Clear all' d='Shop.Theme.Actions'}
          </button>
        </div>
      {/if}
    {/block}

    {foreach from=$displayedFacets item="facet"}

        {assign var=_expand_id value=10|mt_rand:100000}
        {assign var=_collapse value=true}
        {foreach from=$facet.filters item="filter"}
            {if $filter.active}{assign var=_collapse value=false}{/if}
        {/foreach}
      <section class="facet__block">
          <div class="facet__header">
              <p class="facet__title">{$facet.label}</p>
              <a href="#facet_{$_expand_id}" class="icon-collapse visible--mobile stretched-link" data-toggle="collapse"{if !$_collapse} aria-expanded="true"{/if}>
                  <i class="material-icons">&#xE313;</i>
              </a>
          </div>


        {if in_array($facet.widgetType, ['radio', 'checkbox'])}
          {block name='facet_item_other'}
            <div id="facet_{$_expand_id}" class="collpase--facet collapse{if !$_collapse} show{/if}">
              {foreach from=$facet.filters key=filter_key item="filter"}
                {if !$filter.displayed}
                  {continue}
                {/if}
                  <div class="custom-control custom-{if $facet.multipleSelectionAllowed}checkbox{else}radio{/if}{if isset($filter.properties.color) || isset($filter.properties.texture)} custom-color{/if}{if $filter.active} custom-control--active{/if}">
                      <input
                              id="facet_input_{$_expand_id}_{$filter_key}"
                              data-search-url="{$filter.nextEncodedFacetsURL}"
                              type="{if $facet.multipleSelectionAllowed}checkbox{else}radio{/if}"
                              class="custom-control-input"
                              {if $filter.active } checked{/if}
                      >
                      <label class="custom-control-label" for="facet_input_{$_expand_id}_{$filter_key}">
                          {if isset($filter.properties.color)}
                              <span class="color" style="background-color:{$filter.properties.color}"></span>
                          {elseif isset($filter.properties.texture)}
                              <span class="color texture" style="background-image:url({$filter.properties.texture})"></span>
                          {/if}
                          <span class="color__label">{$filter.label}
                          {*{if $filter.magnitude and $show_quantities}*}
                              {*<span class="magnitude">({$filter.magnitude})</span>*}
                          {*{/if}*}
                          </span>
                      </label>
                  </div>
              {/foreach}
            </div>
          {/block}

        {elseif $facet.widgetType == 'dropdown'}
          {block name='facet_item_dropdown'}
                  <div id="facet_{$_expand_id}" class="collpase--facet collapse{if !$_collapse} show{/if}">
                      <select class="custom-select">
                          <option value="">---</option>
                          {foreach from=$facet.filters item="filter"}
                              <option value="{$filter.nextEncodedFacetsURL}" {if $filter.active} selected="selected"{/if}>
                                  {$filter.label}
                                  {if $filter.magnitude and $show_quantities}
                                      ({$filter.magnitude})
                                  {/if}
                              </option>
                          {/foreach}
                      </select>

                  </div>
          {/block}

        {elseif $facet.widgetType == 'slider'}
          {block name='facet_item_slider'}
            {foreach from=$facet.filters item="filter"}
              <ul id="facet_{$_expand_id}"
                class="faceted-slider"
                data-slider-min="{$facet.properties.min}"
                data-slider-max="{$facet.properties.max}"
                data-slider-id="{$_expand_id}"
                data-slider-values="{$filter.value|@json_encode}"
                data-slider-unit="{$facet.properties.unit}"
                data-slider-label="{$facet.label}"
                data-slider-specifications="{$facet.properties.specifications|@json_encode}"
                data-slider-encoded-url="{$filter.nextEncodedFacetsURL}"
              >
                <li>
                  <p id="facet_label_{$_expand_id}">
                    {$filter.label}
                  </p>

                  <div id="slider-range_{$_expand_id}"></div>
                </li>
              </ul>
            {/foreach}
          {/block}
        {/if}
      </section>
    {/foreach}
  </div>
{/if}

 

gouna

gouna

L'url de la page est réinitialisée en même temps que les filtres sont remis à leur état d'origine. Avec la version "originale" du module, il n'y a pas la possibilité de réinitialiser les filtres par listing directement dans le listing "---" ; or ici cela serait lié à ce passage :

{block name='facet_item_dropdown'}
                  <div id="facet_{$_expand_id}" class="collpase--facet collapse{if !$_collapse} show{/if}">
                      <select class="custom-select">
                          <option value="">---</option>
                          {foreach from=$facet.filters item="filter"}
                              <option value="{$filter.nextEncodedFacetsURL}" {if $filter.active} selected="selected"{/if}>
                                  {$filter.label}
                                  {if $filter.magnitude and $show_quantities}
                                      ({$filter.magnitude})
                                  {/if}
                              </option>
                          {/foreach}
                      </select>

                  </div>
          {/block}



Voici le contenu du fichier "facets.tpl" dans "thème BLCK"/modules/ps_facetedsearch/views/templates/front/catalog

{if $displayedFacets|count}
  <div id="search_filters" class="search_filters">
    {block name='facets_title'}
      <p class="text-uppercase h6 visible--desktop">{l s='Filtrer :' d='Shop.Theme.Actions'}</p>
    {/block}

    {block name='facets_clearall_button'}
      {if $activeFilters|count}
        <div class="clear-all-wrapper">
          <button data-search-url="{$clear_all_link}" class="btn--clearfilter btn btn-sm btn-block btn-outline-secondary js-search-filters-clear-all">
            <i class="material-icons">&#xE14C;</i>
            {l s='Clear all' d='Shop.Theme.Actions'}
          </button>
        </div>
      {/if}
    {/block}

    {foreach from=$displayedFacets item="facet"}

        {assign var=_expand_id value=10|mt_rand:100000}
        {assign var=_collapse value=true}
        {foreach from=$facet.filters item="filter"}
            {if $filter.active}{assign var=_collapse value=false}{/if}
        {/foreach}
      <section class="facet__block">
          <div class="facet__header">
              <p class="facet__title">{$facet.label}</p>
              <a href="#facet_{$_expand_id}" class="icon-collapse visible--mobile stretched-link" data-toggle="collapse"{if !$_collapse} aria-expanded="true"{/if}>
                  <i class="material-icons">&#xE313;</i>
              </a>
          </div>


        {if in_array($facet.widgetType, ['radio', 'checkbox'])}
          {block name='facet_item_other'}
            <div id="facet_{$_expand_id}" class="collpase--facet collapse{if !$_collapse} show{/if}">
              {foreach from=$facet.filters key=filter_key item="filter"}
                {if !$filter.displayed}
                  {continue}
                {/if}
                  <div class="custom-control custom-{if $facet.multipleSelectionAllowed}checkbox{else}radio{/if}{if isset($filter.properties.color) || isset($filter.properties.texture)} custom-color{/if}{if $filter.active} custom-control--active{/if}">
                      <input
                              id="facet_input_{$_expand_id}_{$filter_key}"
                              data-search-url="{$filter.nextEncodedFacetsURL}"
                              type="{if $facet.multipleSelectionAllowed}checkbox{else}radio{/if}"
                              class="custom-control-input"
                              {if $filter.active } checked{/if}
                      >
                      <label class="custom-control-label" for="facet_input_{$_expand_id}_{$filter_key}">
                          {if isset($filter.properties.color)}
                              <span class="color" style="background-color:{$filter.properties.color}"></span>
                          {elseif isset($filter.properties.texture)}
                              <span class="color texture" style="background-image:url({$filter.properties.texture})"></span>
                          {/if}
                          <span class="color__label">{$filter.label}
                          {*{if $filter.magnitude and $show_quantities}*}
                              {*<span class="magnitude">({$filter.magnitude})</span>*}
                          {*{/if}*}
                          </span>
                      </label>
                  </div>
              {/foreach}
            </div>
          {/block}

        {elseif $facet.widgetType == 'dropdown'}
          {block name='facet_item_dropdown'}
                  <div id="facet_{$_expand_id}" class="collpase--facet collapse{if !$_collapse} show{/if}">
                      <select class="custom-select">
                          <option value="">---</option>
                          {foreach from=$facet.filters item="filter"}
                              <option value="{$filter.nextEncodedFacetsURL}" {if $filter.active} selected="selected"{/if}>
                                  {$filter.label}
                                  {if $filter.magnitude and $show_quantities}
                                      ({$filter.magnitude})
                                  {/if}
                              </option>
                          {/foreach}
                      </select>

                  </div>
          {/block}

        {elseif $facet.widgetType == 'slider'}
          {block name='facet_item_slider'}
            {foreach from=$facet.filters item="filter"}
              <ul id="facet_{$_expand_id}"
                class="faceted-slider"
                data-slider-min="{$facet.properties.min}"
                data-slider-max="{$facet.properties.max}"
                data-slider-id="{$_expand_id}"
                data-slider-values="{$filter.value|@json_encode}"
                data-slider-unit="{$facet.properties.unit}"
                data-slider-label="{$facet.label}"
                data-slider-specifications="{$facet.properties.specifications|@json_encode}"
                data-slider-encoded-url="{$filter.nextEncodedFacetsURL}"
              >
                <li>
                  <p id="facet_label_{$_expand_id}">
                    {$filter.label}
                  </p>

                  <div id="slider-range_{$_expand_id}"></div>
                </li>
              </ul>
            {/foreach}
          {/block}
        {/if}
      </section>
    {/foreach}
  </div>
{/if}

 

×
×
  • Create New...