Recettes : plus qu'à faire l'appel au addtocart, pour le frontOffice

This commit is contained in:
2021-05-04 19:51:26 +02:00
parent 2402e699fa
commit 59e926d86d
2 changed files with 22 additions and 4 deletions

View File

@@ -42,6 +42,7 @@ div.entete span b {
font-weight: 900;
font-size: 22px;
color: #95c11e;
text-align: center;
}
.recette-soustitre {
font-weight: 400;

View File

@@ -45,7 +45,7 @@
<span class="difficulte"><b>{intl l='Difficulty' d='recettes'}</b><img src="{image file='assets/img/cellular.svg' source='Recettes'}" alt="Difficulty">{$label_difficulty}</span>
</div>
<br>
<form action="/admin/module/Recettes/addtocart" method="post">
<form id="form-recette" action="/admin/module/Recettes/addtocart" method="post">
<div class="row">
<div class="photo-principale col-md-4">
{loop type="image" name="image-loop" content=$content_id visible=true}
@@ -68,12 +68,16 @@
<td class="cellule-large">{$PRODUCT_LABEL}</td>
<td class="cellule-etroite">{$QUANTITY_NEEDED}</td>
<td class="cellule-etroite">{$QUANTITY_PROPOSED}</td>
<td class="cellule-etroite"><input type="checkbox" id="product-{$PSE_ID}" class="cellule-checkbox"></td>
<td class="cellule-etroite"><input type="checkbox" id="product-{$PSE_ID}" name="selected-product" class="cellule-checkbox"></td>
</tr>
{/loop}
<tr>
<td colspan="3"></td>
<td><input type="submit" class="button recette-bouton" value="{intl l='Add to cart' d='recettes'}"></td>
<td>
<div class="form-group">
<button type="submit" class="btn btn-primary">{intl l='Add to cart' d='recettes'}</button>
</div>
</td>
</tr>
</tbody>
</table>
@@ -85,7 +89,6 @@
</form>
<br>
<br>
<div class="row">
<table class="table table-striped table-steps">
{loop type="recipe_steps" name="steps-loop" recipe_id=$ID}
<tr>
@@ -105,3 +108,17 @@
{block name="stylesheet"}
{hook name="content.stylesheet"}
{/block}
{block name="after-javascript-include"}
<script>
$("#form-recette").off('submit').submit(function(ev) {
if ($('input[name=selected-product]:checked').length === 0) {
alert("Vous n'avez choisi aucun produit à rajouter dans votre panier.");
ev.preventDefault();
}
});
</script>
{/block}