Answer the question
In order to leave comments, you need to log in
How to pass an additional field - the price of the product?
There is a quick form for purchasing goods, a small script is connected to the standard "buy \ add to cart" form of the prestashop engine. It is necessary to transfer an additional 1 more field - the price of the goods.
Here is the actual code:
<form action="/themes/default-bootstrap/modules/blockcart/ju_fast.php" method="post" onsubmit="return (ValidPhone())">
<div class="layer_cart_product_info">
<span id="layer_cart_product_title" class="product-name"></span>
<span id="layer_cart_product_attributes"></span>
<input name="name_g" id="name_g" type="hidden" value="">
<div>
<input name="name_b1" id="name_b1" required placeholder="Имя" type="text">
</div>
<div>
<input name="phone_b1" id="phone_b1" required placeholder="Телефон" type="text" >
{literal}
<script>
function ValidPhone()
{
var re = /^\d[\d\(\)\ -]{4,17}\d$/;
var myPhone = document.getElementById('phone_b1').value;
var valid = re.test(myPhone);
return valid;
}
</script>
{/literal}
</div>
<div>
<input type="submit" value="Быстрый заказ" id="fsell_done">
</div>
</div>
$("#fsell_done").hover(
function () {
var str_gname = $("span#layer_cart_product_title").text();
$("#name_g").val(str_gname);
}
);
Answer the question
In order to leave comments, you need to log in
To transfer static data, which in our case is the price, you can use a hidden input in the form, for example:
<form>
...
<intput type="hidden" name="price" value="100" />
</form>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question