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



我在产品页面中创建一个自定义模态弹出窗口,其中我需要放置产品属性。

我已将" 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-从字面上看,包括产品属性tpl文件

我已经弄清楚了,我需要复制产品属性代码并删除Main Div的类名

<div class="product-variants">

to:

<div class="">

,然后将所选的属性留在模式中。

最新更新