Bladeren bron

[Boutique] Commander : correctif catégorie affichée sans produits

feature/souke
Guillaume Bourgeois 11 maanden geleden
bovenliggende
commit
1c3bbaf5f9
2 gewijzigde bestanden met toevoegingen van 12 en 9 verwijderingen
  1. +2
    -3
      producer/views/order/order.php
  2. +10
    -6
      producer/web/js/vuejs/order-order.js

+ 2
- 3
producer/views/order/order.php Bestand weergeven

@@ -323,10 +323,9 @@ $this->setTitle('Commander');
v-if="countSelectedProductsByCategory(category) > 1">s</template></span>
</td>
</tr>
<template
v-if="(categoryCurrent && categoryCurrent.id == category.id) || category.id == null">
<template v-if="(categoryCurrent && categoryCurrent.id == category.id) || category.id == null">
<tr v-for="product in products"
v-if="product.id_product_category == category.id && product.productDistribution && product.productDistribution[0] && product.productDistribution[0].active == 1">
v-if="product.id_product_category == category.id && isProductAvailable(product)">
<td class="photo">
<a class="product-photo" :href="product.photo_big" :title="product.name">
<img v-if="product.photo.length" class="photo-product" :src="product.photo"/>

+ 10
- 6
producer/web/js/vuejs/order-order.js Bestand weergeven

@@ -249,11 +249,12 @@ var app = new Vue({

if(response.data.categories) {
app.categories = response.data.categories ;
if(app.countProductsByCategory(response.data.categories[0])) {
app.setCategoryCurrent(response.data.categories[0], true) ;
}
else {
app.setCategoryCurrent(response.data.categories[1], true) ;
for(keyCategory in response.data.categories) {
var category = response.data.categories[keyCategory];
if(category.id && app.countProductsByCategory(category)) {
app.setCategoryCurrent(category, true) ;
break;
}
}
}

@@ -599,10 +600,13 @@ var app = new Vue({
}
return this.producer.credit_limit == null || (this.producer.credit_limit != null && (this.user.credit - total >= this.producer.credit_limit)) ;
},
isProductAvailable: function(product) {
return product.productDistribution && product.productDistribution[0] && product.productDistribution[0].active == 1;
},
countProductsByCategory: function(category) {
var count = 0 ;
for(var i = 0 ; i < this.products.length ; i++) {
if(this.products[i].id_product_category == category.id) {
if(this.products[i].id_product_category == category.id && this.isProductAvailable(this.products[i])) {
count ++ ;
}
}

Laden…
Annuleren
Opslaan