【发布时间】:2023-03-28 16:35:01
【问题描述】:
我正在产品页面中创建一个自定义模式弹出窗口,我需要在其中放置产品属性。
我已将“product-variants.tpl”包含到我的自定义 tpl 中,并且属性在模式中正确显示。
但是当通过模态改变属性时,它们会跳转回产品页面中选择的值。我需要模态能够将属性更改为
更新:
我注意到,当在产品页面中选择一个属性时,它会更改地址栏中的 URL,但是当通过 modal 更改属性时,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">×</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 文件
【问题讨论】:
-
您好,地址栏更新是通过 Javascript 动态执行的(与友好 URL 无关)。此外,您可能希望发布您的代码以及一些屏幕截图和/或简短的截屏视频,以便其他人更容易为您提供帮助。
-
@BrunoLeveque 已经发布了我使用的模态的 tpl 代码。
-
有人知道吗?
标签: prestashop smarty prestashop-1.7