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.

sidebar cart - delete product

DanielŻuławskid67ff628a935
diff --git a/src/Web/Grand.Web/Views/Shared/SidebarShoppingCart.cshtml b/src/Web/Grand.Web/Views/Shared/SidebarShoppingCart.cshtml
index f08b78115..8087feb13 100644
--- a/src/Web/Grand.Web/Views/Shared/SidebarShoppingCart.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/SidebarShoppingCart.cshtml
@@ -44,7 +44,7 @@
<div class="quantity"><span>@Loc["ShoppingCart.Mini.Quantity"]:</span> <strong>{{item.Quantity}}</strong></div>
</div>
<div>
- <a class="deleteitem" :data-href="item.Id" data-store-url="@Url.RouteUrl("DeleteCartItem")" onclick="deletecartitem(this.getAttribute('data-store-url') +'/'+ this.getAttribute('data-href'))">
+ <a class="deleteitem" @@click="deletecartitem('@Url.RouteUrl("DeleteCartItem")/'+ item.Id)">
<b-icon icon="trash" class="deleteitem" 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 b7b25290b..ee1ad0597 100644
--- a/src/Web/Grand.Web/wwwroot/theme/script/app.js
+++ b/src/Web/Grand.Web/wwwroot/theme/script/app.js
@@ -45,6 +45,20 @@
}
},
methods: {
+ deletecartitem: function (href) {
+ axios({
+ method: "post",
+ baseURL: href
+ }).then(function (response) {
+ const newfly = response.data.sidebarshoppingcartmodel;
+ vm.flycart = newfly;
+ vm.flycartitems = newfly.Items;
+ vm.flycartindicator = newfly.TotalProducts;
+ }).catch(function (error) {
+ alert(error);
+ });
+ return false;
+ },
updateCompareProductsQty: function () {
const cookie = AxiosCart.getCookie('Grand.CompareProduct');
if (cookie !== '') {
diff --git a/src/Web/Grand.Web/wwwroot/theme/script/public.common.js b/src/Web/Grand.Web/wwwroot/theme/script/public.common.js
index c95394af6..17af308c5 100644
--- a/src/Web/Grand.Web/wwwroot/theme/script/public.common.js
+++ b/src/Web/Grand.Web/wwwroot/theme/script/public.common.js
@@ -1,22 +1,4 @@
-function deletecartitem(href) {
- axios({
- method: "post",
- baseURL: href
- }).then(function (response) {
- var newfly = response.data.sidebarshoppingcartmodel;
- this.flycart = newfly;
- this.flycartitems = newfly.Items;
- this.flycartindicator = newfly.TotalProducts;
- vm.flycart = newfly;
- vm.flycartitems = newfly.Items;
- vm.flycartindicator = newfly.TotalProducts;
- }).catch(function (error) {
- alert(error);
- });
- return false;
-}
-
-function displayPopupPrivacyPreference(html) {
+function displayPopupPrivacyPreference(html) {
new Vue({
el: '#ModalPrivacyPreference',
data: {