Error compiling template "Designs/Swift/eCom/ProductCatalog/ProductViewList.cshtml" Line 120: 'TemplatesHelper.IsLazyLoadingForProductInfoEnabled' is obsolete: 'Use Context.Current.Items["IsLazyLoadingForProductInfoEnabled"] instead' Line 123: A local variable or function named 'isLazyLoadingForProductInfoEnabled' is already defined in this scope Line 123: The variable 'isLazyLoadingForProductInfoEnabled' is assigned but its value is never used
1 //------------------------------------------------------------------------------ 2 // <auto-generated> 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319.42000 5 // 6 // Changes to this file may cause incorrect behavior and will be lost if 7 // the code is regenerated. 8 // </auto-generated> 9 //------------------------------------------------------------------------------ 10 11 namespace CompiledRazorTemplates.Dynamic { 12 using System; 13 using System.Collections.Generic; 14 using System.Linq; 15 16 #line 2 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 17 using Dynamicweb.Rendering; 18 19 #line default 20 #line hidden 21 22 #line 3 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 23 using Dynamicweb.Ecommerce.ProductCatalog; 24 25 #line default 26 #line hidden 27 28 #line 4 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 29 using Dynamicweb.Core; 30 31 #line default 32 #line hidden 33 34 35 public class RazorEngine_d607e96f59be4cdc8bcbb365f48dac0b : ViewModelTemplate<ProductListViewModel> { 36 37 #line hidden 38 39 #line 6 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 40 41 public string GetRepositoryName() 42 { 43 return GetIndexValue(); 44 } 45 46 public string GetQueryName() 47 { 48 return GetIndexValue(true); 49 } 50 51 public string GetIndexValue(bool isQuery = false, string defaultValue = "Products") 52 { 53 int pageId = GetPageIdByNavigationTag("Shop"); 54 if (pageId == 0) return defaultValue; 55 56 var productCatalogParagraph = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(pageId).OrderBy(p => p.Sort).FirstOrDefault(p => p.ModuleSystemName == "eCom_ProductCatalog" && Dynamicweb.Content.Services.Grids.GetGridRowById(p.GridRowId).Active); 57 if (productCatalogParagraph == null) return defaultValue; 58 59 var indexQuery = productCatalogParagraph.ModuleProperties["IndexQuery"].Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); 60 if (indexQuery.Length <= 1) return defaultValue; 61 62 var result = isQuery ? indexQuery[indexQuery.Length - 1].Replace(".query", "") : indexQuery[indexQuery.Length - 2]; 63 64 return string.IsNullOrEmpty(result) ? defaultValue : result; 65 } 66 67 #line default 68 #line hidden 69 70 71 public RazorEngine_d607e96f59be4cdc8bcbb365f48dac0b() { 72 } 73 74 public override void Execute() { 75 WriteLiteral("\r\n"); 76 77 WriteLiteral("\r\n"); 78 79 80 #line 34 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 81 82 bool isFeed = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("feed")) ? Convert.ToBoolean(Dynamicweb.Context.Current.Request.QueryString.Get("feed")) : false; 83 84 //Put the ProductListViewModel up in context items 85 if (Dynamicweb.Context.Current.Items.Contains("ProductList")) 86 { 87 Dynamicweb.Context.Current.Items["ProductList"] = Model; 88 } 89 else 90 { 91 Dynamicweb.Context.Current.Items.Add("ProductList", Model); 92 } 93 94 95 #line default 96 #line hidden 97 WriteLiteral("\r\n\r\n"); 98 99 100 #line 48 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 101 if (isFeed) 102 { 103 104 105 #line default 106 #line hidden 107 108 #line 50 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 109 Write(Model.ToJson()); 110 111 112 #line default 113 #line hidden 114 115 #line 50 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 116 117 } 118 else 119 { 120 bool isLazyLoadingForProductInfoEnabled = Dna.Ecommerce.LiveIntegration.TemplatesHelper.IsLazyLoadingForProductInfoEnabled; 121 122 // START CUSTOM CODE - Avoid PLP requests to WebApi 123 bool isLazyLoadingForProductInfoEnabled = false; 124 // END CUSTOM CODE 125 126 if (isLazyLoadingForProductInfoEnabled) 127 { 128 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 129 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 130 string productIds = string.Join("&ProductIds=", Model.Products.Select(p => p.Number)); 131 132 133 134 #line default 135 #line hidden 136 WriteLiteral("\t\t<script"); 137 138 WriteLiteral(" type=\"module\""); 139 140 WriteLiteral(" src=\"/Files/Templates/Designs/Swift/Assets/js/rizzo/sr-live-info-feed.js\""); 141 142 WriteLiteral("></script>\r\n"); 143 144 145 #line 67 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 146 147 148 149 #line default 150 #line hidden 151 WriteLiteral("\t\t<script"); 152 153 WriteLiteral(" type=\"module\""); 154 155 WriteLiteral(">\t\t \r\n\t\t\tlet feedConfig = {\r\n GetVariantInfo: false, //swift.LiveProd" + 156 "uctInfo.GetVariantInfoForProductList(),\r\n\t\t\t\tUserId: \""); 157 158 159 #line 71 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 160 Write(Dynamicweb.Core.Converter.ToString(Pageview.User?.ID)); 161 162 163 #line default 164 #line hidden 165 WriteLiteral("\",\r\n\t\t\t\tEcomLanguageId: \""); 166 167 168 #line 72 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 169 Write(Dynamicweb.Ecommerce.Common.Context.LanguageID); 170 171 172 #line default 173 #line hidden 174 WriteLiteral("\",\r\n\t\t\t\tEcomCurrencyId: \""); 175 176 177 #line 73 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 178 Write(Dynamicweb.Ecommerce.Common.Context.Currency.Code); 179 180 181 #line default 182 #line hidden 183 WriteLiteral("\",\r\n\t\t\t\tEcomCountryCode: \""); 184 185 186 #line 74 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 187 Write(Dynamicweb.Ecommerce.Common.Context.Country.Code2); 188 189 190 #line default 191 #line hidden 192 WriteLiteral("\",\r\n\t\t\t\tEcomShopId: \""); 193 194 195 #line 75 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 196 Write(Pageview.Area.EcomShopId); 197 198 199 #line default 200 #line hidden 201 WriteLiteral("\",\r\n\t\t\t\tEcomPricesWithVat: \""); 202 203 204 #line 76 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 205 Write(Pageview.Area.EcomPricesWithVat); 206 207 208 #line default 209 #line hidden 210 WriteLiteral("\",\r\n\t\t\t\tShowPricesWithVat: \""); 211 212 213 #line 77 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 214 Write(showPricesWithVat == "false" && !neverShowVat); 215 216 217 #line default 218 #line hidden 219 WriteLiteral("\",\r\n\t\t\t\tProductIds: \""); 220 221 222 #line 78 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 223 Write(productIds); 224 225 226 #line default 227 #line hidden 228 WriteLiteral("\",\r\n\t\t\t\tPageSize: "); 229 230 231 #line 79 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 232 Write(Model.PageSize); 233 234 235 #line default 236 #line hidden 237 WriteLiteral("\r\n\t\t\t}\r\n\t\t\tswift.LiveProductInfo.init(feedConfig);\r\n\t\t</script>\r\n"); 238 239 240 #line 83 "F:\Domains\Sites\uat-hager.mydwsite.com\Files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewList.cshtml" 241 } 242 } 243 244 245 #line default 246 #line hidden 247 } 248 } 249 } 250
1 @inherits ViewModelTemplate<ProductListViewModel> 2 @using Dynamicweb.Rendering 3 @using Dynamicweb.Ecommerce.ProductCatalog 4 @using Dynamicweb.Core 5 6 @functions { 7 public string GetRepositoryName() 8 { 9 return GetIndexValue(); 10 } 11 12 public string GetQueryName() 13 { 14 return GetIndexValue(true); 15 } 16 17 public string GetIndexValue(bool isQuery = false, string defaultValue = "Products") 18 { 19 int pageId = GetPageIdByNavigationTag("Shop"); 20 if (pageId == 0) return defaultValue; 21 22 var productCatalogParagraph = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(pageId).OrderBy(p => p.Sort).FirstOrDefault(p => p.ModuleSystemName == "eCom_ProductCatalog" && Dynamicweb.Content.Services.Grids.GetGridRowById(p.GridRowId).Active); 23 if (productCatalogParagraph == null) return defaultValue; 24 25 var indexQuery = productCatalogParagraph.ModuleProperties["IndexQuery"].Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); 26 if (indexQuery.Length <= 1) return defaultValue; 27 28 var result = isQuery ? indexQuery[indexQuery.Length - 1].Replace(".query", "") : indexQuery[indexQuery.Length - 2]; 29 30 return string.IsNullOrEmpty(result) ? defaultValue : result; 31 } 32 } 33 34 @{ 35 bool isFeed = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("feed")) ? Convert.ToBoolean(Dynamicweb.Context.Current.Request.QueryString.Get("feed")) : false; 36 37 //Put the ProductListViewModel up in context items 38 if (Dynamicweb.Context.Current.Items.Contains("ProductList")) 39 { 40 Dynamicweb.Context.Current.Items["ProductList"] = Model; 41 } 42 else 43 { 44 Dynamicweb.Context.Current.Items.Add("ProductList", Model); 45 } 46 } 47 48 @if (isFeed) 49 { 50 @Model.ToJson() 51 } 52 else 53 { 54 bool isLazyLoadingForProductInfoEnabled = Dna.Ecommerce.LiveIntegration.TemplatesHelper.IsLazyLoadingForProductInfoEnabled; 55 56 // START CUSTOM CODE - Avoid PLP requests to WebApi 57 bool isLazyLoadingForProductInfoEnabled = false; 58 // END CUSTOM CODE 59 60 if (isLazyLoadingForProductInfoEnabled) 61 { 62 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 63 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 64 string productIds = string.Join("&ProductIds=", Model.Products.Select(p => p.Number)); 65 66 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/rizzo/sr-live-info-feed.js"></script> 67 68 <script type="module"> 69 let feedConfig = { 70 GetVariantInfo: false, //swift.LiveProductInfo.GetVariantInfoForProductList(), 71 UserId: "@(Dynamicweb.Core.Converter.ToString(Pageview.User?.ID))", 72 EcomLanguageId: "@Dynamicweb.Ecommerce.Common.Context.LanguageID", 73 EcomCurrencyId: "@Dynamicweb.Ecommerce.Common.Context.Currency.Code", 74 EcomCountryCode: "@Dynamicweb.Ecommerce.Common.Context.Country.Code2", 75 EcomShopId: "@Pageview.Area.EcomShopId", 76 EcomPricesWithVat: "@Pageview.Area.EcomPricesWithVat", 77 ShowPricesWithVat: "@(showPricesWithVat == "false" && !neverShowVat)", 78 ProductIds: "@productIds", 79 PageSize: @Model.PageSize 80 } 81 swift.LiveProductInfo.init(feedConfig); 82 </script> 83 } 84 } 85