Jump to content

Afficher le prix des options dans les déclinaisons


Recommended Posts

Bonjour à tous,

 

Est-ce possible d'afficher le prix des options dans les déclinaisons ?

 

Exemple

 

Prenons un "produit A" avec 3 options. Nous avons dans la fiche produit un menu déroulant avec les 3 options :

 

- Option 1

- Option 2

- Option 3

 

J'aimerais avoir :

 

- Option 1

- Option 2 (+10,00€)

- Option 3 (+15,00€)

 

C'est possible de faire ça ? <_<

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

  • 5 months later...

Bon j'ai avancé un peu dans le problème.

 

Dans product.tpl, juste apres :

{foreach from=$group.attributes key=id_attribute item=group_attribute}

je mets :

{assign var='impact_price' value=Product::getAttributesImpacts($product->id)}

Puis à la fin de cette ligne, juste avant </option> :

<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option>

J'ajoute :

{if $impact_price[$id_attribute]['price'] > 0} ({convertPrice price=$impact_price[$id_attribute]['price']}){/if}

Résultat :

- Option 1

- Option 2 (10,00€)

- Option 3 (15,00€)

 

J'ai donc bien le prix de l'option qui s'affiche mais pas moyen d'avoir le "+" ou le "-" devant :wacko:

 

Quelqu'un aurait une idée ? :ph34r:

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

Bon j'ai avancé un peu dans le problème.

 

Dans product.tpl, juste apres :

{foreach from=$group.attributes key=id_attribute item=group_attribute}

je mets :

{assign var='impact_price' value=Product::getAttributesImpacts($product->id)}

Puis à la fin de cette ligne :

<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}

J'ajoute :

{if $impact_price[$id_attribute]['price'] > 0} ({convertPrice price=$impact_price[$id_attribute]['price']}){/if}

Résultat :

- Option 1

- Option 2 (10,00€)

- Option 3 (15,00€)

 

J'ai donc bien le prix de l'option qui s'affiche mais pas moyen d'avoir le "+" ou le "-" devant :wacko:

 

Quelqu'un aurait une idée ? :ph34r:

Bonjour, </option> qui est devant 'html':'UTF-8'} tu le supprime ?

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