Hello, Guest |
| Register
Remember me Forgot password ?
Site Map Site Map Contact us Contact us
PrestaShop e-commerce software
  780 users online
Forum  >  Forum francophone  >  Intégration  >  Thread

 
Post Reply
New Topic
[Tips] Remplacer liste déroulante pour attribut unique

online
Posted: 15 February 2010 10:55 AM   [ Ignore ]
Partner
RankRankRankRankRank
Avatar

Messages :

  • total: 4351
  • last 7 days: 95
Joined: 2008-01-08

Bonjour,

J’ai enfin trouvé comment ne faire apparaitre qu’un texte à la place d’une liste déroulante lorsque qu’un groupe d’attribut ne comporte qu’un seul attribut, ceci pour permettre de donner une information capitale sur un produit sans passer par les caractéristiques

Donc dans product.tpl vous devez remplacer :

<!-- attributes -->
            <
div id="attributes">
            
{foreach from=$groups key=id_attribute_group item=group}
            
<p>
                <
label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8':</label>
                
{assign var='groupName' value='group_'|cat:$id_attribute_group}
                
<select name="{$groupName}" id="group_{$id_attribute_group|intval}">
                    
{foreach from=$group.attributes key=id_attribute item=group_attribute}
                        
<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if}>{$group_attribute|escape:'htmlall':'UTF-8'}</option>
                    
{/foreach}
                
</select>
            </
p>
            
{/foreach}

par :

<!-- attributes -->
            <
div id="attributes">
            
{foreach from=$groups key=id_attribute_group item=group}
            
<p>
                <
label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8':</label>
                
{assign var='groupName' value='group_'|cat:$id_attribute_group}
                {if count
($group.attributes) > 1}
                
<select name="{$groupName}" id="group_{$id_attribute_group|intval}">
                    
{foreach from=$group.attributes key=id_attribute item=group_attribute}
                        
<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if}>{$group_attribute|escape:'htmlall':'UTF-8'}</option>
                    
{/foreach}
                
</select>
                
{else}
                    {foreach from
=$group.attributes key=id_attribute item=group_attribute}
                        
<span class="editable">{$group_attribute|escape:'htmlall':'UTF-8'}</span>
                    
{/foreach}
                {
/if}
            
</p>
            
{/foreach}

 Signature 

Prestations : Modules - Services - Templates - Hébergement
Guide Référencement SEO - Rapport de positionnement hebdomadaire par mail

 
online
Posted: 15 February 2010 12:46 PM   [ Ignore ]   [ # 1 ]
V.I.P.
RankRankRankRank
Avatar

Messages :

  • total: 858
  • last 7 days: 6
Joined: 2009-12-17

Impecable wink

 Signature 

vince_userbar.png
Home CategoriesMegaDrown EvolutionAnimation 3D
Retrouvez tous mes modules Prestashop ici

 
 
 
Fast Reply
New Topic