Browse Source

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

feature/souke
Guillaume Bourgeois 11 months ago
parent
commit
1c3bbaf5f9
2 changed files with 12 additions and 9 deletions
  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 View File

v-if="countSelectedProductsByCategory(category) > 1">s</template></span> v-if="countSelectedProductsByCategory(category) > 1">s</template></span>
</td> </td>
</tr> </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" <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"> <td class="photo">
<a class="product-photo" :href="product.photo_big" :title="product.name"> <a class="product-photo" :href="product.photo_big" :title="product.name">
<img v-if="product.photo.length" class="photo-product" :src="product.photo"/> <img v-if="product.photo.length" class="photo-product" :src="product.photo"/>

+ 10
- 6
producer/web/js/vuejs/order-order.js View File



if(response.data.categories) { if(response.data.categories) {
app.categories = 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;
}
} }
} }


} }
return this.producer.credit_limit == null || (this.producer.credit_limit != null && (this.user.credit - total >= this.producer.credit_limit)) ; 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) { countProductsByCategory: function(category) {
var count = 0 ; var count = 0 ;
for(var i = 0 ; i < this.products.length ; i++) { 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 ++ ; count ++ ;
} }
} }

Loading…
Cancel
Save