Jump to content

[Résolu] Affichage Prix Déclinaisons (Product.tpl)


Recommended Posts

Bonjour,

Je veux afficher toutes les déclinaisons sur ma page produits

Tout les attributs ont été bien mis mais je n'arrive pas récuperer le prix de la déclinaison

CF image 1

Le code est le suivant :


<table>

<caption>Liste des déclinaisons</caption>



<thead> <!-- En-tête du tableau -->

<tr>

<th>Réference</th>

{foreach from=$groups item='attributearray' key='groupindex'}

<th>{$attributearray.name}</th>

{/foreach}

<th>Prix</th>

</tr>

<tbody> <!-- Corps du tableau -->

{foreach from=$combinations item='combination' key='combinationId'}

<tr>



<td>{$combination.reference}</td>

{foreach from=$combination.attributes_values item='a' key='groupindex'}

<td>{$a}</td>

{/foreach}

{if !empty($product->unity) && $priceDisplay >= 0 && $priceDisplay <= 2 }



{assign var='basePrice' value=$product->getPrice(true, $smarty.const.NULL, 2)}

<td>{convertPrice price=$basePrice}</td>

{/if}

</tr>

{/foreach}

</tbody>

</thead>





</table>

une aide de votre part me sauverais :D

 

post-444646-0-92193000-1361893602_thumb.png

Edited by michaeldesch (see edit history)
Link to comment
Share on other sites

Problème résolu !

 

Explication :

 

On a un produit avec un prix de 90 € avec 3 déclinaisons.

 

Selon les déclinaisons il y a un impact 10 € 30€ 40€.

 

si l'impact est de 0 il faut afficher le prix d'origine (90€) sinon on calcule le prix plus l'impact

 

Voici le code :

 

 <thead> <!-- En-tête du tableau -->
   <tr>
  <th>Réference</th>
  {foreach from=$groups item='attributearray' key='groupindex'}
  <th>{$attributearray.name}</th>
  {/foreach}
  <th>Prix</th>
   </tr>
<tbody> <!-- Corps du tableau -->
 {foreach from=$combinations item='combination' key='combinationId'}
 <tr>

  <td>{$combination.reference}</td>
  {foreach from=$combination.attributes_values item='a' key='groupindex'}
  <td>{$a}</td>
  {/foreach}
  {if $priceDisplay >= 0 && $priceDisplay <= 2}
{if $combination.price != 0}
 <td>{convertPrice price=$combination.price + $product->price}</td>
{else}
 <td>{convertPrice price=$productPrice}</td>
{/if}
  {/if}
 </tr>
 {/foreach}
</tbody>
  </thead>

Link to comment
Share on other sites

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...