Error executing template "Designs/ColoursAndCoating_generated/eCom/ProductCatalog/pdp_config.cshtml"
System.OutOfMemoryException: Array dimensions exceeded supported range.
at System.Data.SqlClient.TdsParser.TryReadPlpUnicodeChars(Char[]& buff, Int32 offst, Int32 len, TdsParserStateObject stateObj, Int32& totalCharsRead)
at System.Data.SqlClient.TdsParser.TryReadSqlStringValue(SqlBuffer value, Byte type, Int32 length, Encoding encoding, Boolean isPlp, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TryReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, Int32 length, TdsParserStateObject stateObj, SqlCommandColumnEncryptionSetting columnEncryptionOverride, String columnName)
at System.Data.SqlClient.SqlDataReader.TryReadColumnInternal(Int32 i, Boolean readHeaderOnly)
at System.Data.SqlClient.SqlDataReader.TryReadColumn(Int32 i, Boolean setTimeout, Boolean allowPartiallyReadColumn)
at System.Data.SqlClient.SqlDataReader.GetValues(Object[] values)
at System.Data.ProviderBase.SchemaMapping.LoadDataRow()
at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at Bluedesk.Tools.DynamicWeb.DataAccess.DynamicwebData.Query(String sqlQuery, SqlParameter[] parameters)
at Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend.EcomFrontendServices.GetDataTable(String ProductId, String VariantId, String GroupId, String LangId, PageView PageView) in C:\vso\ColoursCoatings\BluedeskBaseSolution\ClientBase\ItemTypes\Bluedesk.DynamicWeb.ItemTypes.BaseSolution\Frontend\ProductAndVariants.cs:line 159
at Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend.EcomFrontendServices.RenderProductAndVariants(String ProductId, String VariantId, String GroupId, String LangId, PageView PageView) in C:\vso\ColoursCoatings\BluedeskBaseSolution\ClientBase\ItemTypes\Bluedesk.DynamicWeb.ItemTypes.BaseSolution\Frontend\ProductAndVariants.cs:line 169
at CompiledRazorTemplates.Dynamic.RazorEngine_04dda7279f734f5688bd4716c47bd83e.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\Colours and Coating\colours.dw9.dynamicweb-cms.com\files\Templates\Designs\ColoursAndCoating_generated\eCom\ProductCatalog\pdp_config.cshtml:line 16
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits ViewModelTemplate<ProductViewModel>
2
3 @using Dynamicweb;
4 @using Dynamicweb.Rendering;
5 @using Dynamicweb.Caching;
6 @using Dynamicweb.Content;
7 @using Dynamicweb.Content.Items;
8 @using Dynamicweb.Ecommerce.ProductCatalog
9 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution;
10 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend;
11
12
13 @{
14 EcomFrontendServices EcomFrontendServices = new EcomFrontendServices();
15
16 ProductAndVariantsObj ProductAndVariantsObj = EcomFrontendServices.RenderProductAndVariants(Model.Id, Model.VariantId, Model.PrimaryOrDefaultGroup.Id, Pageview.Area.EcomLanguageId, Pageview);
17 Dynamicweb.Context.Current.Session["ProductAndVariants"] = ProductAndVariantsObj;
18
19 int ProductDetailConfigurationPageID = ProductAndVariantsObj.Template.ProductDetailConfigurationPagePageId;
20 int FooProductDetailLayoutID = 0;
21
22 string minWidth = "";
23 string maxWidth = "";
24
25 string groupid = Model.PrimaryOrDefaultGroup.Id;
26
27 string canonical = $"Default.aspx?ID={Pageview.Page.ID}";
28 if (!string.IsNullOrWhiteSpace(groupid))
29 {
30 canonical = $"{canonical}&GroupID={groupid}";
31 }
32 if (!string.IsNullOrWhiteSpace(Model.Id))
33 {
34 canonical = $"{canonical}&ProductID={Model.Id}";
35 }
36 if (!string.IsNullOrWhiteSpace(Model.VariantId))
37 {
38 canonical = $"{canonical}&VariantID={Model.VariantId}";
39 }
40
41 string basedomain = Dynamicweb.Context.Current.Request.Url.DnsSafeHost;
42 if (!string.IsNullOrEmpty(Pageview.Area.DomainLock))
43 {
44 basedomain = Pageview.Area.DomainLock;
45 }
46
47 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(canonical);
48 string href = $"{Dynamicweb.Context.Current.Request.Url.Scheme}://{basedomain}{friendlyUrl}";
49
50 Pageview.Meta.AddTag("customCan", string.Format("<link rel=\"canonical\" href=\"{0}\">", href));
51
52 if (ProductAndVariantsObj != null)
53 {
54 foreach (GridRow g in Dynamicweb.Services.Grids.GetGridRowsByPageId(ProductDetailConfigurationPageID))
55 {
56 ProductDetailPageBreakpointRow _data = ItemManager.Storage.GetById<ProductDetailPageBreakpointRow>(g.ItemId.ToString());
57
58 // minWidth = _data.Device.minWidth != 0 ? " and (min-width: " + _data.Device.minWidth + "px)" : "";
59 // maxWidth = _data.Device.maxWidth != 0 ? " and (max-width: " + _data.Device.maxWidth + "px)" : "";
60
61 FooProductDetailLayoutID = Dynamicweb.Services.Pages.GetPageForItem("ProductDetailPage", _data.ProductDetailConfiguration.Id).ID;
62
63 <section class="productDetail productDetail--@Model.Id.ToString()">
64 @RenderGrid(FooProductDetailLayoutID)
65 </section>
66
67 List<AdvancedGrid> AdvancedGrids = FrontendServices.RenderAdvancedGrid(Pageview, FooProductDetailLayoutID.ToString());
68
69 <style>
70 @if (AdvancedGrids != null && AdvancedGrids.Count > 0)
71 {
72 foreach (AdvancedGrid AdvancedGrid in AdvancedGrids)
73 {
74 @AdvancedGrid.InlineStyles
75 }
76 }
77 </style>
78 }
79 }
80
81 if(Dynamicweb.Context.Current.Session["YouHaveSeenTheseProductsList"] == null) {
82 var emptyArray = new List<string>();
83 Dynamicweb.Context.Current.Session["YouHaveSeenTheseProductsList"] = emptyArray.ToArray();
84 }
85
86 var productIds = ((string[])Dynamicweb.Context.Current.Session["YouHaveSeenTheseProductsList"]).ToList();
87 string prodId = Model.Id;
88 if(!string.IsNullOrWhiteSpace(Model.VariantId))
89 {
90 prodId = $"{prodId};{Model.VariantId}";
91 }
92 if (productIds.Contains(prodId))
93 {
94 productIds.Remove(prodId);
95 }
96 productIds.Insert(0, prodId);
97 Dynamicweb.Context.Current.Session["YouHaveSeenTheseProductsList"] = productIds.ToArray();
98 }
99
Naar boven