Debutant46 Posted May 18, 2010 Share Posted May 18, 2010 Bonjour, Je souhaite créer un nouveau module contenant la liste des attributs pour un produit donné dans un tableau.Pour chaque ligne du tableau, j'ai le nom de l'attribut, une saisie de quantité, le prix du produit et enfin un bouton ajouter au panier qui doit ajouter le produit avec l'attribut de la ligne et la quantité rentrée par l'utilisateur.Mon problème est que je n'arrive pas à récupérer l'attribut souhaité.Je vous donne mon code pour savoir si vous auriez une idée. <form id="buy_block" ACTION="http://localhost/stage/cart.php" method="post"> {l s='Product Options'} {l s='Description' }{l s='Quantité' }{l s='Prix' } {$group.name|escape:'htmlall':'UTF-8'} <input type="hidden" name="token" value="d93760ca85770dc7181859f5f44386a4" /> <input type="hidden" name="id_product" value="{$idProduct}" id="product_page_product_id" /> <input type="hidden" name="add" value="5" /> <input type="hidden" name="id_product_attribute" id="idCombination" value="" /> {* Affiche les cases à cocher *} group_{$id_attribute_group|intval} {$group_attribute.id_attribute} {$id_attribute|intval} <input type="checkbox" name="group_{$id_attribute_group}"> {* Affiche les valeurs de l'attribut *} {if $displayDesc} {$group_attribute|escape:'htmlall':'UTF-8'} {/if} {if $displayQuantity} <input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}"> {/if} 1er bout de code(sujet deplacé- atch) Link to comment Share on other sites More sharing options...
Debutant46 Posted May 18, 2010 Author Share Posted May 18, 2010 2eme partie {if $displayPrice} {if $attributeImpacts} {foreach from=$attributeImpacts key=id_attribute_impact item=attributeImpact} {*test d'affichage*} {$attributeImpact.price} || {$attributeImpact.id_attribute} || {$group_attribute.id_attribute} || {if $attributeImpact.id_attribute == $group_attribute.id_attribute} {if $attributeImpact.price > 0} {if $reductionPrice != 0 OR $reductionPercent !=0 AND ($reductionFrom == $reductionTo OR ($smarty.now|date_format:'%Y-%m-%d' <= $reductionTo AND $smarty.now|date_format:'%Y-%m-%d' >= $reductionFrom))} {math equation = "((p+a)-((p+a)*(r/100))-t)*g" a=$attributeImpact.price p=$prix r=$reductionPercent t=$reductionPrice g=$groupReduction format="%.2f"} {else} {math equation = "(p+a)*g" a=$attributeImpact.price p=$prix g=$groupReduction format="%.2f"} {/if} {else} {if $reductionPrice != 0 OR $reductionPercent !=0 AND ($reductionFrom == $reductionTo OR ($smarty.now|date_format:'%Y-%m-%d' <= $reductionTo AND $smarty.now|date_format:'%Y-%m-%d' >= $reductionFrom))} {math equation = "((p+a)-((p+a)*(r/100))-t)*g" p=$prix a=$attributeImpact.price r=$reductionPercent g=$groupReduction t=$reductionPrice format="%.2f"} {else} {math equation = "p*g" p=$prix g=$groupReduction format="%.2f"} {/if} {/if} {else} Try again !! {/if} {/foreach} {else} {if $reductionPrice != 0 OR $reductionPercent !=0 AND ($reductionFrom == $reductionTo OR ($smarty.now|date_format:'%Y-%m-%d' <= $reductionTo AND $smarty.now|date_format:'%Y-%m-%d' >= $reductionFrom))} {math equation = "(p-(p*(r/100))-t)*g" p=$prix r=$reductionPercent g=$groupReduction t=$reductionPrice format="%.2f"} {else} {math equation = "p*g" p=$prix g=$groupReduction format="%.2f"} {/if} {/if} {/if} <input type="submit" name="Submit" value="Ajouter au panier" class="exclusive" /></p> {/foreach} {/foreach} {/if} </form> Merci d'avance Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now