将产品属性添加到自定义模态Prestashop 1.7

时间:2019-05-10 06:43:33

标签: prestashop smarty prestashop-1.7

我正在产品页面中创建自定义模式弹出窗口,我需要在其中放置产品属性。<​​/ p>

我已将“ product-variants.tpl”包含到自定义tpl中,并且属性在模式中正确显示。

但是,当通过模态更改属性时,它们会跳回到产品页面中选择的值。我需要模态才能将属性更改为


更新:

我注意到,在产品页面中选择属性时,它会更改地址栏中的URL,但是当通过模式更改属性时,URL不会更新。我尝试启用友好URL的强制更新,但没有帮助。


更新2:

{block name="content"}
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" style="position: absolute;
top: 385px;
left: 345px;">
    Inquiry
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">

                {if isset($product)}
                    <h5 class="modal-title" name="mysubject">Inquire about {$product.name} </h5>
                    {/if}


                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <form action="" method="post">
                        <label for="recipient-name" class="col-form-label">Name:</label>
                        <input type="text" name="customer_name" value="" class="form-control" required>
                        <label for="recipient-mail" class="col-form-label">E-mail:</label>
                        <input type="email" name="customer_mail" value="" class="form-control" required>
                        <label for="recipient-name" class="col-form-label">Phone:</label>
                        <input type="tel" name="customer_phone" value="" class="form-control" required>
                        <label for="recipient-name" class="col-form-label">Free text:</label>
                        <div class="form-group row">
                            <div class="col-md-9"  style="float:none;">
                                <textarea class="form-control" name="customer_message" placeholder="How can we help?" rows="3"></textarea>
                            </div>
                        </div>

                            {include file='catalog/_partials/product-variants.tpl'}
                        {block name='product_prices'}
                            {include file='catalog/_partials/product-prices.tpl'}
                        {/block}

                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Отказ</button>
                            <button class="btn btn-primary" name="button_pressed">Send</button>
                        </div>
                    </form>

                </div>


            </div>

        </div>
    </div>

</div>

{/ block}

这是我使用的.tpl-在我的字面上包括product属性tpl文件

1 个答案:

答案 0 :(得分:0)

我发现,我需要复制产品属性代码并删除主div的类名

<div class="product-variants">

收件人:

<div class="">

,然后属性将所选内容保留在模态中。