Add variations, slider, fix cart ...

This commit is contained in:
Ludovic CANDELLIER
2022-03-21 21:52:12 +01:00
parent 0eaa11b2a9
commit ddc5f2664c
27 changed files with 438 additions and 81 deletions

View File

@@ -0,0 +1,57 @@
@if ($article['offers']['semences'] ?? false)
@include('Shop.Articles.partials.addBasket', [
'data' => $article['offers']['semences'],
'title' => 'Semence',
'model' => 'semences',
])
@endif
@if ($article['offers']['plants'] ?? false)
@include('Shop.Articles.partials.addBasket', [
'data' => $article['offers']['plants'],
'title' => 'Plant',
'model' => 'plants',
])
@endif
@if ($article['offers']['legumes'] ?? false)
@include('Shop.Articles.partials.addBasket', [
'data' => $article['offers']['legumes'],
'title' => 'Légume',
'model' => 'legumes',
])
@endif
@push('js')
<script>
$('.basket').click(function() {
var type = $(this).data('type');
var offer_id = $('#' + type + '-offer_id').find('option:selected').val();
var quantity = $('#' + type + '-quantity').val();
var data = {
'offer_id': offer_id,
'quantity': quantity,
};
$.post('{{ route("Shop.Basket.addBasket") }}', data, function() {
console.log('ici');
});
console.log(type);
console.log(offer_id);
console.log(quantity);
console.log(data);
});
function setPrice(model) {
var offer_id = $('#' + model + '-offer_id').find('option:selected').val();
var quantity = $('#' + model + '-quantity').val();
var data = {
'offer_id': offer_id,
'quantity': quantity,
};
$.post('{{ route("Shop.Basket.getPrice") }}', data, function(data) {
$('#' + model + '-price').html(data);
});
}
</script>
@endpush