Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

SidebarCompareProducts - minor changes

DanielŻuławski3027e88cb702
diff --git a/src/Web/Grand.Web/Views/Shared/SidebarCompareProducts.cshtml b/src/Web/Grand.Web/Views/Shared/SidebarCompareProducts.cshtml
index 1e418a24a..f3836d593 100644
--- a/src/Web/Grand.Web/Views/Shared/SidebarCompareProducts.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/SidebarCompareProducts.cshtml
@@ -18,8 +18,8 @@
<template v-slot:title>
@Loc["Products.Compare.Title"]
</template>
- <template v-if="compareproducts !== null">
- <template v-if="compareproducts.Products !== undefined">
+ <template v-if="compareProductsQty > 0">
+ <template v-if="compareproducts !== null">
<template v-for="product in compareproducts.Products">
<div class="item comapre-product d-inline-flex no-wrap">
<a :href="product.Url" :title="product.DefaultPictureModel.Title" v-if="product.DefaultPictureModel.ImageUrl">
@@ -36,22 +36,22 @@
</div>
</div>
</template>
- <template v-if="compareproducts.Products == 0">
- <div class="d-flex flex-column justify-content-center align-items-center">
- <b-icon icon="shuffle" font-scale="7.5" variant="secondary"></b-icon>
- <div class="text-center text-muted mt-3">@Loc["Products.Compare.NoItems"]</div>
- </div>
- </template>
</template>
- <template v-else>
+ <template v-if="loader">
<div class="d-flex justify-content-center align-items-center h-100" v-if="wishlistitems == undefined">
<div class="spinner-border text-info" role="status">
</div>
</div>
</template>
</template>
+ <template v-else>
+ <div class="d-flex flex-column justify-content-center align-items-center">
+ <b-icon icon="shuffle" font-scale="7.5" variant="secondary"></b-icon>
+ <div class="text-center text-muted mt-3">@Loc["Products.Compare.NoItems"]</div>
+ </div>
+ </template>
<template v-slot:footer>
- <template v-if="compareproducts !== null && compareproducts.Products !== undefined && compareproducts.Products.length > 0">
+ <template v-if="compareProductsQty > 0">
<b-col class="p-3 bg-dark">
<div class="form-row">
<div class="col-lg-6 col-12">
diff --git a/src/Web/Grand.Web/wwwroot/theme/script/app.js b/src/Web/Grand.Web/wwwroot/theme/script/app.js
index 5d203ff5a..64d5ef5b6 100644
--- a/src/Web/Grand.Web/wwwroot/theme/script/app.js
+++ b/src/Web/Grand.Web/wwwroot/theme/script/app.js
@@ -15,6 +15,7 @@
RelatedProducts: null,
compareproducts: null,
compareProductsQty: 0,
+ loader: false,
}
},
props: {
@@ -257,21 +258,25 @@
))
},
getCompareList: function () {
- axios({
- baseURL: '/compareproducts',
- method: 'get',
- params: {
- t: new Date().getTime()
- },
- data: null,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'X-Response-View': 'Json'
- }
- }).then(response => {
- this.compareproducts = response.data
- })
+ if (this.compareProductsQty > 0) {
+ this.loader = true;
+ axios({
+ baseURL: '/compareproducts',
+ method: 'get',
+ params: {
+ t: new Date().getTime()
+ },
+ data: null,
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-Response-View': 'Json'
+ }
+ }).then(response => {
+ this.loader = false;
+ this.compareproducts = response.data
+ })
+ }
},
removeFromCompareList: function (id) {
if (id !== undefined) {