In Prestashop 1.7 I have the following code in product.tpl:
<div class="target">
</div>
<div class="product-actions">
{block name='product_buy'}
<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
<input type="hidden" name="token" value="{$static_token}">
<input type="hidden" name="id_product" value="{$product.id}"
id="product_page_product_id">
<input type="hidden" name="id_customization" value="{$product.id_customization}"
id="product_customization_id">
{block name='product_variants'}
{hook h='displayProductVariants' product=$product}
{include file='catalog/_partials/product-variants.tpl'}
{/block}
{block name='product_pack'}
{if $packItems}
<section class="product-pack">
<p class="h4">{l s='This pack contains' d='Shop.Theme.Catalog'}</p>
{foreach from=$packItems item="product_pack"}
{block name='product_miniature'}
{include file='catalog/_partials/miniatures/pack-product.tpl' product=$product_pack}
{/block}
{/foreach}
</section>
{/if}
{/block}
{block name='product_add_to_cart'}
{include file='catalog/_partials/product-add-to-cart.tpl'}
{/block}
{block name='product_discounts'}
{include file='catalog/_partials/product-discounts.tpl'}
{/block}
{block name='product_additional_info'}
{include file='catalog/_partials/product-additional-info.tpl'}
{/block}
{block name='product_refresh'}{/block}
</form>
{/block}
{block name='hook_display_reassurance'}
{hook h='displayReassurance'}
{/block}
</div>
I need to move product_variants block to other div (into div class="target"). The problem is when I move product_variants block the cart doesn't work properly. I guess it happens due form... I don't know how to solve this problem. It is possible to do through css?
Thanks in advance!
I try this and doesn't works:
<div class="target">
{block name='product_variants'}
{hook h='displayProductVariants' product=$product}
{include file='catalog/_partials/product-variants.tpl'}
{/block}
</div>
<div class="product-actions">
{block name='product_buy'}
<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
<input type="hidden" name="token" value="{$static_token}">
<input type="hidden" name="id_product" value="{$product.id}"
id="product_page_product_id">
<input type="hidden" name="id_customization" value="{$product.id_customization}"
id="product_customization_id">
{block name='product_pack'}
{if $packItems}
<section class="product-pack">
<p class="h4">{l s='This pack contains' d='Shop.Theme.Catalog'}</p>
{foreach from=$packItems item="product_pack"}
{block name='product_miniature'}
{include file='catalog/_partials/miniatures/pack-product.tpl' product=$product_pack}
{/block}
{/foreach}
</section>
{/if}
{/block}
{block name='product_add_to_cart'}
{include file='catalog/_partials/product-add-to-cart.tpl'}
{/block}
{block name='product_discounts'}
{include file='catalog/_partials/product-discounts.tpl'}
{/block}
{block name='product_additional_info'}
{include file='catalog/_partials/product-additional-info.tpl'}
{/block}
{block name='product_refresh'}{/block}
</form>
{/block}
{block name='hook_display_reassurance'}
{hook h='displayReassurance'}
{/block}
</div>
Also I tryed this and doesn't work:
<div class="target">
<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
<input type="hidden" name="token" value="{$static_token}">
<input type="hidden" name="id_product" value="{$product.id}"
id="product_page_product_id">
<input type="hidden" name="id_customization" value="{$product.id_customization}"
id="product_customization_id">
{block name='product_variants'}
{hook h='displayProductVariants' product=$product}
{include file='catalog/_partials/product-variants.tpl'}
{/block}
</form>
</div>
<div class="product-actions">
{block name='product_buy'}
<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
<input type="hidden" name="token" value="{$static_token}">
<input type="hidden" name="id_product" value="{$product.id}"
id="product_page_product_id">
<input type="hidden" name="id_customization" value="{$product.id_customization}"
id="product_customization_id">
{block name='product_pack'}
{if $packItems}
<section class="product-pack">
<p class="h4">{l s='This pack contains' d='Shop.Theme.Catalog'}</p>
{foreach from=$packItems item="product_pack"}
{block name='product_miniature'}
{include file='catalog/_partials/miniatures/pack-product.tpl' product=$product_pack}
{/block}
{/foreach}
</section>
{/if}
{/block}
{block name='product_add_to_cart'}
{include file='catalog/_partials/product-add-to-cart.tpl'}
{/block}
{block name='product_discounts'}
{include file='catalog/_partials/product-discounts.tpl'}
{/block}
{block name='product_additional_info'}
{include file='catalog/_partials/product-additional-info.tpl'}
{/block}
{block name='product_refresh'}{/block}
</form>
{/block}
{block name='hook_display_reassurance'}
{hook h='displayReassurance'}
{/block}
</div>