Jump to content

Associer le formulaire de déclinaison à celui des personnalisations.


Recommended Posts

Bonjour, comme vous pouvez le voir dans la capture ci-jointe, j'ai essayer d'associer les formulaires de déclinaisons ainsiq eu ceux des personnalisations

Pour info, je suis encore dans la version prestashop 1.2.5.

Mon soucis et que évidement un formulaire dans un formulaire ça ne fonctionne pas, j'aimerais donc associer les deux. De tel sorte qu'il n'y ai qu'un seul bouton pour prendre la commande ainsi que enregistrer les données de la personnalisation.

J'ai donc déjà placer le code, je vous l'envoie dans le message suivant pour pas charger.

Pourriez vous m'aider svp ?

42642_xd1g8DF6UjIr7XMJn6xK_t

Link to comment
Share on other sites

Et donc le code en question dans mon fichier product.tpl :

    <!-- add to cart form-->
       <form id="buy_block" action="{$base_dir}cart.php" method="post">

           <!-- hidden datas -->


               <input type="hidden" name="token" value="{$static_token}" />
               <input type="hidden" name="id_product" value="{$product->id|intval}" id="product_page_product_id" />
               <input type="hidden" name="add" value="1" />
               <input type="hidden" name="id_product_attribute" id="idCombination" value="" />


           <!-- prices -->


               {if $product->on_sale}

{l s='On sale!'}
               {elseif ($product->reduction_price != 0 || $product->reduction_percent != 0) && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product->reduction_from))}
{l s='Price lowered!'}
               {/if}



               {if !$priceDisplay || $priceDisplay == 2}
{convertPrice price=$product->getPrice(true, $smarty.const.NULL, 2)}
                       {l s='tax incl.'}
               {/if}
               {if $priceDisplay == 1}
{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)}
                       {l s='tax excl.'}
               {/if}

               {if $priceDisplay == 2}


{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)} {l s='tax excl.'}
               {/if}



           {if ($product->reduction_price != 0 || $product->reduction_percent != 0) && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product->reduction_from))}


               {if !$priceDisplay || $priceDisplay == 2}
{convertPrice price=$product->getPriceWithoutReduct()}
                       {l s='tax incl.'}
               {/if}
               {if $priceDisplay == 1}
{convertPrice price=$product->getPriceWithoutReduct(true)}
                       {l s='tax excl.'}
               {/if}


           {/if}
           {if $product->reduction_percent != 0 && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product->reduction_from))}

{l s='(price reduced by'} {$product->reduction_percent|floatval} %{l s=')'}
           {/if}
           {if $packItems|@count}

{l s='instead of'} {convertPrice price=$product->getNoPackPrice()}


           {/if}
           {if $product->ecotax != 0}

{l s='include'} {convertPrice price=$product->ecotax} {l s='for green tax'}
           {/if}

           {if isset($groups)}

           <!-- attributes -->

           {foreach from=$groups key=id_attribute_group item=group}


{$group.name|escape:'htmlall':'UTF-8'} :
               {assign var='groupName' value='group_'|cat:$id_attribute_group}

                   {foreach from=$group.attributes key=id_attribute item=group_attribute}
{$group_attribute|escape:'htmlall':'UTF-8'}
                   {/foreach}


           {/foreach}

           {/if}

           {if $product->reference}
{l s='Reference :'} {$product->reference|escape}{/if}

Link to comment
Share on other sites

Et la suite .... :

  <!-- Customizable products -->
{if $product->customizable}

       <form method="post" action="{$customizationFormTarget}" enctype="multipart/form-data" id="customizationForm">
           {if $product->uploadable_files|intval}
{l s='Pictures'}

               {counter start=0 assign='customizationField'}
               {foreach from=$customizationFields item='field' name='customizationFields'}
                   {if $field.type == 0}
{assign var='key' value='pictures_'|cat:$product->id|cat:'_'|cat:$field.id_customization_field}
                           {if isset($pictures.$key)}getUrlWith('deletePicture', $field.id_customization_field)}">{/if}
<input type="file" name="file{$field.id_customization_field}" id="img{$customizationField}" class="customization_block_input {if isset($pictures.$key)}filled{/if}" />{if $field.required}*{/if}
{if !empty($field.name)}{$field.name}{else}{l s='Please select an image file from your hard drive'}{/if}

                       {counter}
                   {/if}
               {/foreach}

           {/if}

           {if $product->text_fields|intval}

               {counter start=0 assign='customizationField'}
               {foreach from=$customizationFields item='field' name='customizationFields'}
                   {if $field.type == 1}
{assign var='key' value='textFields_'|cat:$product->id|cat:'_'|cat:$field.id_customization_field}
                           {if !empty($field.name)}{$field.name}{/if}<input type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" value="{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}" class="customization_block_input" />{if $field.required}*{/if}

                       {counter}
                   {/if}
               {/foreach}

           {/if}


               <input type="hidden" name="quantityBackup" id="quantityBackup" value="" />
               <input type="hidden" name="submitCustomizedDatas" value="1" />
               <input type="button" class="button" value="{l s='Save'}">

       </form>

           <!-- availability -->

quantity == 0 && !$product->available_later) || (!$product->available_now && $display_qties != 1) } style="display:none;"{/if}>
{l s='Availability:'}
quantity == 0} class="warning-inline"{/if}>
                   {if $product->quantity == 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}



           <!-- number of item in stock -->

quantity == 0)} style="display:none;"{/if}>
{$product->quantity|intval}
quantity > 1} style="display:none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}
quantity < 2} style="display:none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}


           <!-- Out of stock hook -->

quantity > 0} style="display:none;"{/if}>
               {$HOOK_PRODUCT_OOS}



quantity > $last_qties || $product->quantity == 0) || $allow_oosp} style="display:none;"{/if} >{l s='Warning: Last items in stock!'}


quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p>
           {if $HOOK_PRODUCT_ACTIONS}
               {$HOOK_PRODUCT_ACTIONS}
           {/if}
       </form>
       {if $HOOK_EXTRA_RIGHT}{$HOOK_EXTRA_RIGHT}{/if}





{if $quantity_discounts}

Link to comment
Share on other sites

  • 1 month later...

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