Error compiling template "Designs/Rapido/_parsed/MiniCartCustom(JSON).parsed.cshtml"
Line 141: The name 'GetString' does not exist in the current context
Line 142: The name 'GetString' does not exist in the current context

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 15 #line 5 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 16 using System.Linq; 17 18 #line default 19 #line hidden 20 21 #line 3 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 22 using Dynamicweb.Ecommerce; 23 24 #line default 25 #line hidden 26 27 #line 4 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 28 using System.Web; 29 30 #line default 31 #line hidden 32 33 #line 6 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 34 using System.Text.RegularExpressions; 35 36 #line default 37 #line hidden 38 39 40 public class RazorEngine_3eab2b9c76c042aa83924f7f0b6bdcda : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> { 41 42 #line hidden 43 44 #line 14 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 45 46 public class MiniCartOrderLineCustomField 47 { 48 public string name { get; set; } 49 public string label { get; set; } 50 public string value{ get; set; } 51 } 52 53 public class MiniCartOrderLine 54 { 55 public string template { get; set; } 56 public string id { get; set; } 57 public string name { get; set; } 58 public string variantname { get; set; } 59 public string unitname { get; set; } 60 public string unitprice { get; set; } 61 public string quantity { get; set; } 62 public double pointPrice { get; set; } 63 public double pointsTotal { get; set; } 64 public string totalprice { get; set; } 65 public string link { get; set; } 66 public string image { get; set; } 67 public bool isEmpty { get; set; } 68 public List<MiniCartOrderLineCustomField> customFields{get;set;} 69 } 70 71 public class Root 72 { 73 public int numberofproducts { get; set; } 74 public string paymentmethod { get; set; } 75 public string paymentfee { get; set; } 76 public string shippingmethod { get; set; } 77 public string shippingfee { get; set; } 78 public string totalprice { get; set; } 79 public double earnings { get; set; } 80 public string totalvat { get; set; } 81 public bool isEmpty { get; set; } 82 83 public List<MiniCartOrderLine> OrderLines { get; set; } 84 public string poNumber { get; set; } 85 public string notificationOnParcel { get; set; } 86 } 87 88 #line default 89 #line hidden 90 91 92 public RazorEngine_3eab2b9c76c042aa83924f7f0b6bdcda() { 93 } 94 95 public override void Execute() { 96 97 #line 2 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 98 Dynamicweb.Context.Current.Response.ContentType = "application/json"; 99 100 #line default 101 #line hidden 102 WriteLiteral("\r\n"); 103 104 WriteLiteral("\r\n"); 105 106 107 #line 8 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 108 109 string feedType = HttpContext.Current.Request.QueryString.Get("feedtype"); 110 int productCatalog = GetPageIdByNavigationTag("ProductsPage"); 111 var cartObject = Dynamicweb.Ecommerce.Common.Context.Cart; 112 113 114 #line default 115 #line hidden 116 WriteLiteral("\r\n\r\n"); 117 118 WriteLiteral("\r\n"); 119 120 121 #line 58 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 122 123 string jsonFeed = ""; 124 125 List<Root> feedObject = new List<Root>(); 126 Root feedRoot = new Root(); 127 128 if (feedType != "Counter") 129 { 130 feedRoot.numberofproducts = Dynamicweb.Core.Converter.ToInt32(Model.Cart.TotalProductsCount); 131 feedRoot.paymentmethod = Model.Cart.PaymentMethod ?? ""; 132 feedRoot.paymentfee = Model.Cart.PaymentFee.Price.Formatted; 133 feedRoot.shippingmethod = Model.Cart.ShippingMethod ?? ""; 134 feedRoot.shippingfee = Model.Cart.ShippingFee.Price.Formatted; 135 //feedRoot.earnings = GetDouble("Ecom:Order.RewardTotalPoints"); 136 feedRoot.totalprice = Model.Cart.TotalPrice.Price.Formatted; 137 feedRoot.totalvat = Model.Cart.TotalPrice.Vat.Formatted; 138 feedRoot.isEmpty = Model.Cart.IsEmpty; 139 140 feedRoot.OrderLines = new List<MiniCartOrderLine>(); 141 feedRoot.poNumber = GetString("PoNumber"); 142 feedRoot.notificationOnParcel = GetString("NotificatioOnParcel"); 143 144 foreach (var orderline in Model.Cart.CartOrderlines) 145 { 146 147 string productLink = orderline.ProductLink; 148 string variantId = !string.IsNullOrEmpty(orderline.ProductVariantID) ? "&VariantID=" + orderline.ProductVariantID : ""; 149 string groupId = orderline.ProductID != null ? Dynamicweb.Ecommerce.Services.Products.GetProductById(orderline.ProductID, variantId, true).DefaultGroup.Id : ""; 150 productLink = string.Format("/Default.aspx?ID={0}&GroupID={1}&ProductID={2}{3}", productCatalog, groupId, orderline.ProductID, variantId); 151 152 MiniCartOrderLine miniCartOrderLine = new MiniCartOrderLine(); 153 miniCartOrderLine.template = orderline.IsProduct ? "CartOrderline" : "CartOrderlineDiscount"; 154 miniCartOrderLine.id = orderline.ProductID; 155 miniCartOrderLine.name = orderline.ProductName != null ? orderline.ProductName + orderline.ProductVariantText : ""; 156 miniCartOrderLine.variantname = orderline.ProductVariantText ?? ""; 157 miniCartOrderLine.unitname = orderline.UnitName ?? ""; 158 miniCartOrderLine.quantity = orderline.Quantity.ToString(); 159 miniCartOrderLine.totalprice = orderline.TotalPrice.Price.Formatted; 160 //miniCartOrderLine.pointsTotal = orderline.GetDouble("Ecom:Order:OrderLine.Points"); 161 //miniCartOrderLine.pointPrice = orderline.GetDouble("Ecom:Product.PointPrice"); 162 miniCartOrderLine.link = productLink; 163 miniCartOrderLine.unitprice = orderline.UnitPrice.Price.Formatted; 164 miniCartOrderLine.image = orderline.ProductImage; 165 miniCartOrderLine.isEmpty = Model.Cart.IsEmpty; 166 miniCartOrderLine.customFields = new List<MiniCartOrderLineCustomField>(); 167 168 if(cartObject != null){ 169 var cartLineObject = cartObject.OrderLines.Where(x=>x.Id == orderline.ID).FirstOrDefault(); 170 if(cartLineObject != null){ 171 foreach(var olfv in cartLineObject.OrderLineFieldValues ) 172 { 173 var newField = new MiniCartOrderLineCustomField() 174 { 175 name = olfv.OrderLineFieldSystemName, 176 label = olfv.OrderLineFieldName, 177 value = olfv.Value 178 }; 179 miniCartOrderLine.customFields.Add(newField); 180 } 181 } 182 } 183 184 feedRoot.OrderLines.Add(miniCartOrderLine); 185 } 186 } 187 else 188 { 189 feedRoot.numberofproducts = (int)Model.Cart.TotalProductsCount; 190 } 191 192 feedObject.Add(feedRoot); 193 jsonFeed = Newtonsoft.Json.JsonConvert.SerializeObject(feedObject); 194 195 196 197 #line default 198 #line hidden 199 WriteLiteral("\r\n\r\n"); 200 201 202 #line 133 "D:\Dynamicweb.net\Solutions\Degree\eplast.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\MiniCartCustom(JSON).parsed.cshtml" 203 Write(jsonFeed); 204 205 206 #line default 207 #line hidden 208 } 209 } 210 } 211

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 @{Dynamicweb.Context.Current.Response.ContentType = "application/json";} 3 @using Dynamicweb.Ecommerce; 4 @using System.Web 5 @using System.Linq; 6 @using System.Text.RegularExpressions 7 8 @{ 9 string feedType = HttpContext.Current.Request.QueryString.Get("feedtype"); 10 int productCatalog = GetPageIdByNavigationTag("ProductsPage"); 11 var cartObject = Dynamicweb.Ecommerce.Common.Context.Cart; 12 } 13 14 @functions { 15 public class MiniCartOrderLineCustomField 16 { 17 public string name { get; set; } 18 public string label { get; set; } 19 public string value{ get; set; } 20 } 21 22 public class MiniCartOrderLine 23 { 24 public string template { get; set; } 25 public string id { get; set; } 26 public string name { get; set; } 27 public string variantname { get; set; } 28 public string unitname { get; set; } 29 public string unitprice { get; set; } 30 public string quantity { get; set; } 31 public double pointPrice { get; set; } 32 public double pointsTotal { get; set; } 33 public string totalprice { get; set; } 34 public string link { get; set; } 35 public string image { get; set; } 36 public bool isEmpty { get; set; } 37 public List<MiniCartOrderLineCustomField> customFields{get;set;} 38 } 39 40 public class Root 41 { 42 public int numberofproducts { get; set; } 43 public string paymentmethod { get; set; } 44 public string paymentfee { get; set; } 45 public string shippingmethod { get; set; } 46 public string shippingfee { get; set; } 47 public string totalprice { get; set; } 48 public double earnings { get; set; } 49 public string totalvat { get; set; } 50 public bool isEmpty { get; set; } 51 52 public List<MiniCartOrderLine> OrderLines { get; set; } 53 public string poNumber { get; set; } 54 public string notificationOnParcel { get; set; } 55 } 56 } 57 58 @{ 59 string jsonFeed = ""; 60 61 List<Root> feedObject = new List<Root>(); 62 Root feedRoot = new Root(); 63 64 if (feedType != "Counter") 65 { 66 feedRoot.numberofproducts = Dynamicweb.Core.Converter.ToInt32(Model.Cart.TotalProductsCount); 67 feedRoot.paymentmethod = Model.Cart.PaymentMethod ?? ""; 68 feedRoot.paymentfee = Model.Cart.PaymentFee.Price.Formatted; 69 feedRoot.shippingmethod = Model.Cart.ShippingMethod ?? ""; 70 feedRoot.shippingfee = Model.Cart.ShippingFee.Price.Formatted; 71 //feedRoot.earnings = GetDouble("Ecom:Order.RewardTotalPoints"); 72 feedRoot.totalprice = Model.Cart.TotalPrice.Price.Formatted; 73 feedRoot.totalvat = Model.Cart.TotalPrice.Vat.Formatted; 74 feedRoot.isEmpty = Model.Cart.IsEmpty; 75 76 feedRoot.OrderLines = new List<MiniCartOrderLine>(); 77 feedRoot.poNumber = GetString("PoNumber"); 78 feedRoot.notificationOnParcel = GetString("NotificatioOnParcel"); 79 80 foreach (var orderline in Model.Cart.CartOrderlines) 81 { 82 83 string productLink = orderline.ProductLink; 84 string variantId = !string.IsNullOrEmpty(orderline.ProductVariantID) ? "&VariantID=" + orderline.ProductVariantID : ""; 85 string groupId = orderline.ProductID != null ? Dynamicweb.Ecommerce.Services.Products.GetProductById(orderline.ProductID, variantId, true).DefaultGroup.Id : ""; 86 productLink = string.Format("/Default.aspx?ID={0}&GroupID={1}&ProductID={2}{3}", productCatalog, groupId, orderline.ProductID, variantId); 87 88 MiniCartOrderLine miniCartOrderLine = new MiniCartOrderLine(); 89 miniCartOrderLine.template = orderline.IsProduct ? "CartOrderline" : "CartOrderlineDiscount"; 90 miniCartOrderLine.id = orderline.ProductID; 91 miniCartOrderLine.name = orderline.ProductName != null ? orderline.ProductName + orderline.ProductVariantText : ""; 92 miniCartOrderLine.variantname = orderline.ProductVariantText ?? ""; 93 miniCartOrderLine.unitname = orderline.UnitName ?? ""; 94 miniCartOrderLine.quantity = orderline.Quantity.ToString(); 95 miniCartOrderLine.totalprice = orderline.TotalPrice.Price.Formatted; 96 //miniCartOrderLine.pointsTotal = orderline.GetDouble("Ecom:Order:OrderLine.Points"); 97 //miniCartOrderLine.pointPrice = orderline.GetDouble("Ecom:Product.PointPrice"); 98 miniCartOrderLine.link = productLink; 99 miniCartOrderLine.unitprice = orderline.UnitPrice.Price.Formatted; 100 miniCartOrderLine.image = orderline.ProductImage; 101 miniCartOrderLine.isEmpty = Model.Cart.IsEmpty; 102 miniCartOrderLine.customFields = new List<MiniCartOrderLineCustomField>(); 103 104 if(cartObject != null){ 105 var cartLineObject = cartObject.OrderLines.Where(x=>x.Id == orderline.ID).FirstOrDefault(); 106 if(cartLineObject != null){ 107 foreach(var olfv in cartLineObject.OrderLineFieldValues ) 108 { 109 var newField = new MiniCartOrderLineCustomField() 110 { 111 name = olfv.OrderLineFieldSystemName, 112 label = olfv.OrderLineFieldName, 113 value = olfv.Value 114 }; 115 miniCartOrderLine.customFields.Add(newField); 116 } 117 } 118 } 119 120 feedRoot.OrderLines.Add(miniCartOrderLine); 121 } 122 } 123 else 124 { 125 feedRoot.numberofproducts = (int)Model.Cart.TotalProductsCount; 126 } 127 128 feedObject.Add(feedRoot); 129 jsonFeed = Newtonsoft.Json.JsonConvert.SerializeObject(feedObject); 130 131 } 132 133 @jsonFeed