From 16ab3364c91701511e376b79b1d0d900c33e228e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=C5=BBu=C5=82awski?= Date: Thu, 28 Oct 2021 08:58:42 +0200 Subject: [PATCH 01/10] compare products sidebar --- .../Controllers/ProductController.cs | 6 +- .../Catalog/_CatalogProductListView.cshtml | 2 +- .../Catalog/_CatalogProductListViewVue.cshtml | 2 +- .../Views/Product/CompareProducts.cshtml | 121 ++++++++---------- src/Web/Grand.Web/Views/Shared/Header.cshtml | 1 + .../Shared/SidebarCompareProducts.cshtml | 74 +++++++++++ .../Views/Shared/SidebarShoppingCart.cshtml | 4 +- .../Views/Shared/SidebarWishlist.cshtml | 26 ++-- .../Views/Shared/_CatalogProductView.cshtml | 2 +- .../Shared/_CatalogProductViewVue.cshtml | 2 +- .../wwwroot/theme/css/common/common.css | 2 +- .../wwwroot/theme/css/common/common.rtl.css | 2 +- .../wwwroot/theme/css/header/header.css | 20 +-- src/Web/Grand.Web/wwwroot/theme/script/app.js | 30 +++++ .../wwwroot/theme/script/public.axios.js | 70 +++++++--- 15 files changed, 246 insertions(+), 118 deletions(-) create mode 100644 src/Web/Grand.Web/Views/Shared/SidebarCompareProducts.cshtml diff --git a/src/Web/Grand.Web/Controllers/ProductController.cs b/src/Web/Grand.Web/Controllers/ProductController.cs index 935fa8e64..ed5cd085d 100644 --- a/src/Web/Grand.Web/Controllers/ProductController.cs +++ b/src/Web/Grand.Web/Controllers/ProductController.cs @@ -878,7 +878,7 @@ protected virtual List GetComparedProductIds() return new List(); //get array of string product identifiers from cookie - var productIds = productIdsCookie.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var productIds = productIdsCookie.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); //return list of int product identifiers return productIds.Select(productId => productId).Distinct().ToList(); @@ -890,7 +890,7 @@ protected virtual void AddCompareProductsCookie(IEnumerable comparedProd HttpContext.Response.Cookies.Delete(CacheKey.PRODUCTS_COMPARE_COOKIE_NAME); //create cookie value - var comparedProductIdsCookie = string.Join(",", comparedProductIds); + var comparedProductIdsCookie = string.Join("|", comparedProductIds); //create cookie options var cookieOptions = new CookieOptions { @@ -971,7 +971,7 @@ public virtual IActionResult RemoveProductFromCompareList(string productId) comparedProductIds.Remove(productId); //set cookie - AddCompareProductsCookie(comparedProductIds); ; + AddCompareProductsCookie(comparedProductIds); return RedirectToRoute("CompareProducts"); } diff --git a/src/Web/Grand.Web/Views/Catalog/_CatalogProductListView.cshtml b/src/Web/Grand.Web/Views/Catalog/_CatalogProductListView.cshtml index c863a7309..22af80f43 100644 --- a/src/Web/Grand.Web/Views/Catalog/_CatalogProductListView.cshtml +++ b/src/Web/Grand.Web/Views/Catalog/_CatalogProductListView.cshtml @@ -288,7 +288,7 @@ } @if (!Model.ProductPrice.DisableAddToCompareListButton && Model.ProductType == ProductType.SimpleProduct) { - diff --git a/src/Web/Grand.Web/Views/Catalog/_CatalogProductListViewVue.cshtml b/src/Web/Grand.Web/Views/Catalog/_CatalogProductListViewVue.cshtml index 251134eb0..8b52de5b1 100644 --- a/src/Web/Grand.Web/Views/Catalog/_CatalogProductListViewVue.cshtml +++ b/src/Web/Grand.Web/Views/Catalog/_CatalogProductListViewVue.cshtml @@ -226,7 +226,7 @@ + diff --git a/src/Web/Grand.Web/Views/Shared/SidebarCompareProducts.cshtml b/src/Web/Grand.Web/Views/Shared/SidebarCompareProducts.cshtml new file mode 100644 index 000000000..d08bac735 --- /dev/null +++ b/src/Web/Grand.Web/Views/Shared/SidebarCompareProducts.cshtml @@ -0,0 +1,74 @@ +@inject IWorkContext workContext +@{ + var supportRtl = workContext.WorkingLanguage.Rtl; +} + \ No newline at end of file diff --git a/src/Web/Grand.Web/Views/Shared/SidebarShoppingCart.cshtml b/src/Web/Grand.Web/Views/Shared/SidebarShoppingCart.cshtml index 8764c9589..f08b78115 100644 --- a/src/Web/Grand.Web/Views/Shared/SidebarShoppingCart.cshtml +++ b/src/Web/Grand.Web/Views/Shared/SidebarShoppingCart.cshtml @@ -44,8 +44,8 @@
@Loc["ShoppingCart.Mini.Quantity"]: {{item.Quantity}}
diff --git a/src/Web/Grand.Web/Views/Shared/SidebarWishlist.cshtml b/src/Web/Grand.Web/Views/Shared/SidebarWishlist.cshtml index 4a7417e43..eafe3286a 100644 --- a/src/Web/Grand.Web/Views/Shared/SidebarWishlist.cshtml +++ b/src/Web/Grand.Web/Views/Shared/SidebarWishlist.cshtml @@ -41,20 +41,24 @@