如何将product_variants块移动到Prestashop 1.7中的另一个div

时间:2019-05-29 08:26:35

标签: php smarty prestashop-1.7

在Prestashop 1.7中,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>

我需要将product_variants块移至其他div(进入div class =“ target”)。 问题是当我移动product_variants块时,购物车无法正常工作。我想这是应有的形式... 我不知道如何解决这个问题。 可以通过CSS做吗?

谢谢!

我尝试了一下,但不起作用:

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

我也尝试过这种方法,但是不起作用:

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

0 个答案:

没有答案