B2B shop
Backtee
Backtee
Error executing template "Designs/b2b/eCom7/CartV2/Step/b2b_cart.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f227c0e3d73f463babf8f3204996825c.Execute() in E:\Dynamicweb.Net\Solutions\Campfire\backtee2017copy.net.dynamicweb-cms.com\files\Templates\Designs\b2b\eCom7\CartV2\Step\b2b_cart.cshtml:line 8
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 2 3 @{ 4 5 var userID = GetString("UserManagement:User.ID"); 6 var userUserName = GetString("UserManagement:User.UserName"); 7 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 8 var group = user.Groups[0]; //Expection exactly one group - not 0 not 2 or more 9 10 var shopEmail = @user.Email; 11 var shopName = @user.Name; 12 var shopAddress = @user.Address + " " + @user.Address2; 13 var shopZip = @user.Zip; 14 var shopCity = @user.City; 15 var shopCountry = @user.CountryCode; 16 var shopPhone = @user.Phone; 17 18 var shopPayEmail = GetString("UserManagement:User.AccessUser_Faktura_email"); 19 var shopPayName = GetString("UserManagement:User.AccessUser_Faktura_navn"); 20 var shopPayAddress = GetString("UserManagement:User.AccessUser_Faktura_adresse"); 21 var shopPayZip = GetString("UserManagement:User.AccessUser_Faktura_postnr"); 22 var shopPayCity = GetString("UserManagement:User.AccessUser_Faktura_by"); 23 var shopPayCountry = GetString("UserManagement:User.AccessUser_Faktura_land"); 24 var shopPayPhone = GetString("UserManagement:User.AccessUser_Faktura_tlf"); 25 26 var chainEmail = ""; 27 var chainName = ""; 28 var chainAddress = ""; 29 var chainZip = ""; 30 var chainCity = ""; 31 var chainCountry = ""; 32 var chainPhone = ""; 33 34 var totalPrice = GetString("Ecom:Order.OrderLines.Total.Price"); 35 var totalPrice2 = GetString("Ecom:Order.TotalPriceWithoutOrderDiscountsAndFees.PriceFormatted"); 36 Double totalPriceInt = GetDouble("Ecom:Order.Price.PriceWithVAT.Value"); 37 Double totalPriceInt2 = GetDouble("Ecom:Order.TotalPriceWithoutOrderDiscountsAndFees.Price.Value"); 38 var currency = GetString("Ecom:Order.Currency.Code"); 39 var shippingFee = @GetString("Ecom:Order.ShippingFee.Price.Value"); 40 41 Boolean cartEmpty = GetBoolean("Ecom:Order.IsEmpty"); 42 } 43 44 45 @if (group != null){ 46 chainEmail = @group.Telefax; 47 chainName = @group.CompanyName; 48 chainAddress = @group.Address + " " + @group.Address2; 49 chainZip = @group.ZipCode; 50 chainCity = @group.City; 51 chainCountry = @group.Country; 52 chainPhone = @group.Telephone; 53 } 54 55 @if(chainZip == "") { 56 chainEmail = shopPayEmail; 57 chainName = shopPayName; 58 chainAddress = shopPayAddress; 59 chainZip = shopPayZip; 60 chainCity = shopPayCity; 61 chainCountry = shopPayCountry; 62 chainPhone = shopPayPhone; 63 } 64 65 66 67 68 <p style="display:none;"> 69 <b>Dine oplysninger:</b> 70 <br/>@shopName 71 <br/>@shopAddress 72 <br/>@shopZip @shopCity 73 <br/>@shopCountry 74 <br/>Email: @shopEmail 75 <br/>Tlf: @shopPhone 76 <br/><br/><b>Dine fakturaoplysninger:</b> 77 <br/>@shopPayName 78 <br/>@shopPayAddress 79 <br/>@shopPayZip @shopPayCity 80 <br/>@shopPayCountry 81 <br/>Email: @shopPayEmail 82 <br/>Tlf: @shopPayPhone 83 <br/><br/><b>Kædens oplysninger (@group.Name):</b> 84 <br/>@chainName 85 <br/>@chainAddress 86 <br/>@chainZip @chainCity 87 <br/>@chainCountry 88 <br/>Email: @chainEmail 89 <br/>Tlf: @chainPhone 90 </p> 91 92 93 94 95 96 <form name="ordersubmit" id="ordersubmit" class="testcart" method="post"> 97 <div class="cart-page"> 98 <div class="container"> 99 <div class="row"> 100 @if(cartEmpty){ 101 <div class="col-12 text-center"> 102 <h2 class="text-center">@Translate("emptycartpage","Cart is empty")</h2> 103 <p>@Translate("cartmessage","Your cart is saved for 1 day.")</p> 104 <a href="/" class="link button">@Translate("ShopNow","Shop now")</a> 105 </div> 106 } 107 else{ 108 109 <div class="col-12"> 110 <h2>Your info</h2> 111 </div> 112 <div class="col-lg-5 offset-lg-1 col-md-12 order-lg-2"> 113 <div class="orderlines"> 114 <div class="d-flex align-items-center"> 115 <h3 class="flex-grow-1">Overview</h3> 116 <a href="/Default.aspx?ID=5818&CartCmd=EmptyCart" class="empty-cart justify-self-end">Empty basket</a> 117 </div> 118 @foreach(var line in GetLoop("OrderLines")){ 119 var productNumber = line.GetString("Ecom:Product.Number"); 120 var productID = line.GetString("Ecom:Product.ID"); 121 var image = "/Files/Images/ProductImages/"+productNumber+"_600.jpg"; 122 var variant = line.GetString("Ecom:Order:OrderLine.ProductVariantText"); 123 var deleteLink = line.GetString("Ecom:Order:OrderLine.DeleteLink"); 124 var lineprice = line.GetString("Ecom:Order:OrderLine.Price"); 125 var lineName = line.GetString("Ecom:Order:OrderLine.ProductName.Short"); 126 var priceDiscount = line.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts"); 127 Boolean isDiscount = line.GetBoolean("Ecom:Order:OrderLine.IsDiscount"); 128 var lineQuantity = line.GetInteger("Ecom:Order:OrderLine.Quantity"); 129 if(isDiscount){ 130 <div class="discount d-flex align-items-center"> 131 <div class="infos flex-grow-1"> 132 <h3>@lineName</h3> 133 </div> 134 <div class="price-wrap"> 135 <div class="price">@lineprice</div> 136 </div> 137 </div> 138 } 139 else{ 140 <div class="orderline d-flex align-items-start"> 141 <div class="image-box"> 142 <img src="@image" alt="@lineName" width="50"/> 143 </div> 144 <div class="infos flex-grow-1"> 145 <h3>@lineName</h3> 146 <span class="info">Size: @variant</span> 147 <span class="info">Quantity: @lineQuantity</span> 148 </div> 149 <div class="price-wrap"> 150 <div class="price">@lineprice</div> 151 </div> 152 </div> 153 } 154 } 155 156 <div> 157 158 159 160 </div> 161 162 163 <totalprices :deliveryprice="@shippingFee" :subtotal="'@totalPrice2'" :totalint="'@totalPriceInt2'" :currency="'@currency'"></totalprices> 164 165 166 </div> 167 168 </div> 169 <div class="col-lg-6"> 170 171 172 <div class="delivery"> 173 <h3>Delivery Information</h3> 174 <div class="row"> 175 <div class="field col-sm-12"> 176 <label for="EcomOrderDeliveryEmail">Email*</label> 177 <input type="text" name="EcomOrderDeliveryEmail" class="required email" id="EcomOrderDeliveryEmail" value="@shopEmail" placeholder='Email' required="required" /> 178 </div> 179 <div class="field col-sm-12"> 180 <label for="EcomOrderDeliveryName">Name*</label> 181 <input type="text" name="EcomOrderDeliveryName" class="required" id="EcomOrderDeliveryName" value="@shopName" placeholder='Name' required="required" /> 182 </div> 183 <div class="field col-sm-12"> 184 <label for="EcomOrderDeliveryName">Address*</label> 185 <input type="text" name="EcomOrderDeliveryAddress" class="required" id="EcomOrderDeliveryAddress" value="@shopAddress" placeholder='Address' required="required" /> 186 </div> 187 <div class="field col-sm-6"> 188 <label for="EcomOrderDeliveryZip">Zipcode*</label> 189 <input type="text" name="EcomOrderDeliveryZip" class="required" id="EcomOrderDeliveryZip" value="@shopZip" placeholder='Zipcode' required="required" /> 190 </div> 191 <div class="field col-sm-6"> 192 <label for="EcomOrderDeliveryZip">City*</label> 193 <input type="text" name="EcomOrderDeliveryCity" class="required" id="EcomOrderDeliveryCity" value="@shopCity" placeholder='City' required="required" /> 194 </div> 195 <div class="field col-6"> 196 <label for="EcomOrderDeliveryCountry">Country</label> 197 <input type="text" name="EcomOrderDeliveryCountry" id="EcomOrderDeliveryCountry" value="@shopCountry" > 198 </div> 199 <div class="field col-6"> 200 <label for="EcomOrderDeliveryPhone">Phone number*</label> 201 <input type="text" name="EcomOrderDeliveryPhone" class="required" id="EcomOrderDeliveryPhone" value="@shopPhone" placeholder='Phone number' required="required" /> 202 </div> 203 </div> 204 </div> 205 206 207 <div class="billing"> 208 <br/><h3>Invoice Information</h3> 209 <div class="row"> 210 <div class="field col-12"> 211 <label for="EcomOrderCustomerEmail">Email</label> 212 <input type="text" name="EcomOrderCustomerEmail" class="email" id="EcomOrderCustomerEmail" value="@chainEmail" placeholder="Email" readonly /> 213 </div> 214 <div class="field col-12"> 215 <label for="EcomOrderCustomerName">Name</label> 216 <input type="text" name="EcomOrderCustomerName" id="EcomOrderCustomerName" value="@chainName" placeholder='Name' readonly /> 217 </div> 218 <div class="field col-12"> 219 <label for="EcomOrderCustomerAddress">Address</label> 220 <input type="text" name="EcomOrderCustomerAddress" id="EcomOrderCustomerAddress" value="@chainAddress" placeholder='Address' readonly /> 221 </div> 222 <div class="field col-6"> 223 <label for="EcomOrderCustomerZip">Zipcode</label> 224 <input type="text" name="EcomOrderCustomerZip" id="EcomOrderCustomerZip" value="@chainZip" placeholder='Zipcode' readonly /> 225 </div> 226 <div class="field col-6"> 227 <label for="EcomOrderCustomerCity">City</label> 228 <input type="text" name="EcomOrderCustomerCity" id="EcomOrderCustomerCity" value="@chainCity" placeholder='City' readonly /> 229 </div> 230 <div class="field col-6"> 231 <label for="EcomOrderCustomerCountry">Country</label> 232 <input type="text" value="@chainCountry" name="EcomOrderCustomerCountry" id="EcomOrderCustomerCountry" placeholder="Country" readonly /> 233 </div> 234 <div class="field col-6"> 235 <label for="EcomOrderCustomerPhone">Phone number</label> 236 <input type="text" name="EcomOrderCustomerPhone" id="EcomOrderCustomerPhone" value="@chainPhone" placeholder='Telefon' readonly /> 237 </div> 238 </div> 239 </div> 240 241 242 <input type="hidden" name="boughtInShop" id="boughtInShop" value="B2B Shop"> 243 244 245 <div style="display:none;"> 246 @foreach(var shippingMethod in GetLoop("Shippingmethods")){ 247 var shipPrice = shippingMethod.GetString("Ecom:Cart.ShippingMethod.Price.Price"); 248 var shipName = shippingMethod.GetString("Ecom:Cart.Shippingmethod.Name"); 249 var shipStatus = ""; 250 String shipMethodID = shippingMethod.GetString("Ecom:Cart.Shippingmethod.ID"); 251 if(shipMethodID=="SHIP24"){ 252 shipStatus = "checked"; 253 } 254 <input type="radio" class="deliveryType" name="EcomCartShippingmethodID" id='@shipMethodID' v-on:change="updateShipping(@shipPrice)" value="@shipMethodID" @shipStatus /> <label for="@shipMethodID">@shipName</label><br> 255 } 256 <input type="hidden" v-model="shippingFee" value="0" /> 257 258 259 @foreach(var method in GetLoop("Paymethods")){ 260 var methodName = method.GetString("Ecom:Cart.Paymethod.Name"); 261 var methodStatus = "";; 262 var methodID = method.GetString("Ecom:Cart.Paymethod.ID"); 263 if(methodID=="PAY51"){ 264 methodStatus = "checked"; 265 } 266 <input type="radio" name="EcomCartPaymethodID" id="EcomCartPaymethodID_@methodID" value="@methodID" @methodStatus /> @methodName <br/> 267 } 268 269 270 </div> 271 272 273 274 <div class="submit"> 275 <div class="terms"> 276 <input type="checkbox" id="EcomOrderCustomerAccepted" name="EcomOrderCustomerAccepted" required > 277 <label for="EcomOrderCustomerAccepted"> I've read the <u><a href="/Default.aspx?ID=5848" target="_blank">terms and conditions</a></u></label> 278 </div> 279 <input type="submit" class="buy-button" value="Confirm order" name="CartV2.GotoStep1" /> 280 </div> 281 282 283 </div> 284 285 } 286 </div> 287 </div> 288 </div> 289 </form> 290 291