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.

Minor fix - delete compare product from sidebar

supportc1ff5c69f69d
diff --git a/src/Web/Grand.Web/Views/Shared/Partials/SidebarCompareProducts.cshtml b/src/Web/Grand.Web/Views/Shared/Partials/SidebarCompareProducts.cshtml
index 98caad362..d2ee36e0f 100644
--- a/src/Web/Grand.Web/Views/Shared/Partials/SidebarCompareProducts.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/Partials/SidebarCompareProducts.cshtml
@@ -20,7 +20,7 @@
</template>
<template v-if="compareProductsQty > 0">
<template v-if="compareproducts !== null">
- <template v-for="product in compareproducts.Products">
+ <template v-for="(product, key) 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">
<b-img :alt="product.DefaultPictureModel.AlternateText" :src="product.DefaultPictureModel.ImageUrl" :title="product.DefaultPictureModel.Title" fluid></b-img>
@@ -30,7 +30,7 @@
<div class="price"><span>@Loc["Wishlist.Mini.UnitPrice"]:</span> <strong>{{product.ProductPrice.Price}}</strong></div>
</div>
<div>
- <a class="deleteitem" @@click="removeFromCompareList(product.Id); getCompareList('@Url.RouteUrl("SidebarCompareProducts")'); ">
+ <a class="deleteitem" @@click="removeFromCompareList(product.Id, key); getCompareList('@Url.RouteUrl("SidebarCompareProducts")'); ">
<b-icon icon="trash" variant="danger"></b-icon>
</a>
</div>
diff --git a/src/Web/Grand.Web/wwwroot/theme/script/app.js b/src/Web/Grand.Web/wwwroot/theme/script/app.js
index b92a77da7..e67dcc8a8 100644
--- a/src/Web/Grand.Web/wwwroot/theme/script/app.js
+++ b/src/Web/Grand.Web/wwwroot/theme/script/app.js
@@ -319,7 +319,7 @@ var vm = new Vue({
removeFromCompareList: function (product, index) {
if (product !== undefined) {
const compareList = AxiosCart.getCookie('Grand.CompareProduct');
- const newCompareList = compareList.replace(product.Id, '');
+ const newCompareList = compareList.replace(product, '');
AxiosCart.setCookie('Grand.CompareProduct', newCompareList);
vm.compareproducts.Products.splice(index, 1);
} else {