Jump to content

Résolu - Pb confition d'affichage marque


Recommended Posts

Bonjour,

j'ai installé un module qui affiche les marques sur la home page.

Je voudrais afficher uniquement les ID que j'ai besoin (3 pour commencer), et non les 30 marques.

Voici le code que j'ai dans le module :

{foreach from=$manufacturers item=manufacturer name=manufacturer_list}
		
           {if $manufacturer.image}
        	   <li class="{if $smarty.foreach.manufacturer_list.last}last_item{elseif $smarty.foreach.manufacturer_list.first}first_item{else}item{/if}">
				<div class="pb-3"><span>{$manufacturer.id_manufacturer}</span>
				<div>
                   <a href="{Context::getContext()->link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)|escape:'html'}">
                      <img class="radius-50" src="{$urls.base_url}img/m/{$manufacturer.image_url}" alt="{$manufacturer.name|escape:'html':'UTF-8'} "/>
                   </a>
				 </div>  
						<div class="description mt-3 pt-3">
							<p class="mb-0">{$manufacturer.short_description|strip_tags:'UTF-8'|truncate:180:'...' nofilter}</p>
							
						</div>
				  </div>
               </li>
           {/if}
    	{/foreach}

j'ai essayé d'ajouter ma condition, mais ca ne fonctionne pas.

			{if isset($manufacturers) && ($manufacturer.id_manufacturer == 11 || && $category.id == 32 || && $category.id == 15)}

Ai-je une erreur dans ma condition ?

Merci pour votre aide.

Ps 1.7

Edited by Manu-41
reesolu (see edit history)
Link to comment
Share on other sites

{foreach from=$manufacturers item=manufacturer name=manufacturer_list}
		
  {if $manufacturer.image && ($manufacturer.id_manufacturer == 11 || $manufacturer.id_manufacturer == 32 || $manufacturer.id_manufacturer == 15)}
  <li class="{if $smarty.foreach.manufacturer_list.last}last_item{elseif $smarty.foreach.manufacturer_list.first}first_item{else}item{/if}">
    <div class="pb-3"><span>{$manufacturer.id_manufacturer}</span>
      <div>
        <a href="{Context::getContext()->link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)|escape:'html'}">
          <img class="radius-50" src="{$urls.base_url}img/m/{$manufacturer.image_url}" alt="{$manufacturer.name|escape:'html':'UTF-8'} "/>
        </a>
      </div>  
      <div class="description mt-3 pt-3">
        <p class="mb-0">{$manufacturer.short_description|strip_tags:'UTF-8'|truncate:180:'...' nofilter}</p>

      </div>
    </div>
  </li>
  {/if}
{/foreach}

 

  • Like 1
Link to comment
Share on other sites

8 hours ago, Mediacom87 said:
{foreach from=$manufacturers item=manufacturer name=manufacturer_list}
		
  {if $manufacturer.image && ($manufacturer.id_manufacturer == 11 || $manufacturer.id_manufacturer == 32 || $manufacturer.id_manufacturer == 15)}
  <li class="{if $smarty.foreach.manufacturer_list.last}last_item{elseif $smarty.foreach.manufacturer_list.first}first_item{else}item{/if}">
    <div class="pb-3"><span>{$manufacturer.id_manufacturer}</span>
      <div>
        <a href="{Context::getContext()->link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)|escape:'html'}">
          <img class="radius-50" src="{$urls.base_url}img/m/{$manufacturer.image_url}" alt="{$manufacturer.name|escape:'html':'UTF-8'} "/>
        </a>
      </div>  
      <div class="description mt-3 pt-3">
        <p class="mb-0">{$manufacturer.short_description|strip_tags:'UTF-8'|truncate:180:'...' nofilter}</p>

      </div>
    </div>
  </li>
  {/if}
{/foreach}

 

Mille Merci Mediacom!!!!! ça fonctionne bien.

Ça m'a bien aidé !

Link to comment
Share on other sites

  • Manu-41 changed the title to Résolu - Pb confition d'affichage marque

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...