Error executing template "Designs/Swift/Paragraph/Swift_Slider.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_2bd660e7238c46f1b537dcb4522f6ab0.GetLink(ItemViewModel item) in D:\dynamicweb.net\Solutions\Dynamicweb\scrouples.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\Swift_Slider.cshtml:line 51 at CompiledRazorTemplates.Dynamic.RazorEngine_2bd660e7238c46f1b537dcb4522f6ab0.<>c__DisplayClass6_0.<RenderButton>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\scrouples.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\Swift_Slider.cshtml:line 389 at CompiledRazorTemplates.Dynamic.RazorEngine_2bd660e7238c46f1b537dcb4522f6ab0.<>c__DisplayClass1_0.<RenderSlideItem>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\scrouples.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\Swift_Slider.cshtml:line 255 at CompiledRazorTemplates.Dynamic.RazorEngine_2bd660e7238c46f1b537dcb4522f6ab0.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\scrouples.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\Swift_Slider.cshtml:line 147 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 Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Frontend 4 5 @functions { 6 7 private Dynamicweb.Frontend.LinkViewModel GetLink(ItemViewModel item) 8 { 9 string linkType = item.GetRawValueString("LinkType", "page"); 10 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 11 12 if (linkType == "page" && item.GetLink("ButtonLink") != null) 13 { 14 link = item.GetLink("ButtonLink"); 15 } 16 17 if (linkType == "product-group") 18 { 19 IList<ProductGroupViewModel> selectedGroups = item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 20 IList<string> groupIds = new List<string> { }; 21 22 if (selectedGroups != null) 23 { 24 foreach (var fromGroup in selectedGroups) 25 { 26 groupIds.Add(fromGroup.Id); 27 } 28 } 29 30 link = new Dynamicweb.Frontend.LinkViewModel() 31 { 32 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 33 IsExternal = false 34 }; 35 } 36 37 if (linkType == "product") 38 { 39 ProductListViewModel products = item.GetValue<ProductListViewModel>("ProductLink"); 40 IList<string> productIds = new List<string> { }; 41 42 if (products != null) 43 { 44 foreach (var product in products.Products) 45 { 46 productIds.Add(product.Id); 47 } 48 } 49 50 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 51 string productLink = products.Products.FirstOrDefault().GetProductLink(GetPageIdByNavigationTag("Shop"), false); 52 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 53 54 link = new Dynamicweb.Frontend.LinkViewModel() 55 { 56 Url = productLink, 57 IsExternal = false 58 }; 59 } 60 61 return link; 62 } 63 } 64 65 @{ 66 bool movePageBehind = false; 67 bool isFirstPoster = false; 68 string movePageBehindClass = ""; 69 if (Pageview.Page.PropertyItem != null) 70 { 71 string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 72 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; 73 if (movePageBehind) 74 { 75 movePageBehindClass = " poster-behind"; 76 if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) 77 { 78 isFirstPoster = true; 79 Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); 80 } 81 } 82 } 83 84 string title = Model.Item.GetString("Title"); 85 var sliderItems = Model.Item?.GetItems("Slider_Items") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); 86 87 // Style 88 string buttonSize = Model.Item.GetRawValueString("buttonSize", "regular"); 89 buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; 90 buttonSize = buttonSize == "regular" ? "" : buttonSize; 91 buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; 92 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 93 switch (contentPadding){ 94 case "small": 95 contentPadding = " p-3"; 96 break; 97 case "large": 98 contentPadding = " p-4"; 99 break; 100 } 101 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); 102 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 103 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 104 105 // Navgation 106 string slidesPerPage = $"slider-item-show{Model.Item.GetRawValueString("SlidesPerPage", "1")}"; 107 string sliderRatio = Model.Item.GetRawValueString("SliderRatio", "original") != "original" ? $"slider-item-ratio {Model.Item.GetRawValueString("SliderRatio", string.Empty)}" : string.Empty; 108 string navigationStyle = $"{Model.Item.GetRawValueString("NavigationStyle", "slider-nav-round")}"; 109 string navigationPlacement = $"{Model.Item.GetRawValueString("NavigationPlacement", "slider-nav-on-slides")}"; 110 string indicatorStyle = $"{Model.Item.GetRawValueString("IndicatorStyle", string.Empty)}"; 111 string revealSlides = Model.Item.GetRawValueString("RevealSlides", "no-reveal") == "reveal" ? "slider-item-reveal" : string.Empty; 112 string sliderItemsGap = Model.Item.GetRawValueString("SliderItemsGap", "slider-item-gap") == "slider-item-nogap" ? "slider-item-nogap" : string.Empty; 113 string navigationAlwaysVisible = (Model.Item.GetBoolean("NavigationAlwaysVisible")) ? "slider-nav-visible" : string.Empty; 114 string navigationVisibleOnTouch = (Model.Item.GetBoolean("NavigationVisibleOnTouch")) ? "slider-nav-touch" : string.Empty; 115 string navigationShowScrollbar = (Model.Item.GetBoolean("NavigationShowScrollbar")) ? "slider-nav-scrollbar" : string.Empty; 116 string scrollBarForceMobile = (Model.Item.GetBoolean("NavigationShowScrollbar")) ? "--swiffy-slider-track-height:0.5rem !important;" : string.Empty; 117 string navigationSmall = (Model.Item.GetBoolean("NavigationSmall")) ? "slider-nav-sm" : string.Empty; 118 string navigationInvertColors = (Model.Item.GetBoolean("NavigationInvertColors")) ? "slider-nav-dark" : string.Empty; 119 string navigationSlideEntirePage = (Model.Item.GetBoolean("NavigationSlideEntirePage")) ? "slider-nav-page" : string.Empty; 120 string navigationNoLoop = (Model.Item.GetBoolean("NavigationNoLoop")) ? "slider-nav-noloop" : string.Empty; 121 string indicatorsOutsideSlider = (Model.Item.GetBoolean("IndicatorsOutsideSlider") && indicatorStyle != string.Empty) ? "slider-indicators-outside" : string.Empty; 122 string indicatorsHighlightActive = (Model.Item.GetBoolean("IndicatorsHighlightActive")) ? "slider-indicators-highlight" : string.Empty; 123 string indicatorsInvertColors = (Model.Item.GetBoolean("IndicatorsInvertedColors")) ? "slider-indicators-dark" : string.Empty; 124 string indicatorsVisibleOnSmallDevices = (Model.Item.GetBoolean("IndicatorsVisibleOnSmallDevices")) ? "slider-indicators-sm" : string.Empty; 125 string animation = Model.Item.GetRawValueString("Animation", string.Empty) != string.Empty ? $"slider-nav-animation {Model.Item.GetRawValueString("Animation")}" : string.Empty; 126 string autoplay = (Model.Item.GetBoolean("Autoplay")) ? "slider-nav-autoplay" : string.Empty; 127 string autoplayInterval = Model.Item.GetRawValueString("AutoplayInterval", string.Empty); 128 bool hideSliderNavigation = false; 129 130 if(navigationStyle == "slider-nav-none") 131 { 132 hideSliderNavigation = true; 133 } 134 } 135 <div class="h-100 grid gap-0"> 136 <div class="g-col-12 item_@(Model.Item.SystemName.ToLower())"> 137 <div id="Slider_@Model.ID" class="swiffy-slider @(sliderRatio) @(slidesPerPage) @(navigationStyle) @(revealSlides) @(navigationPlacement) @(navigationAlwaysVisible) @(navigationVisibleOnTouch) @(sliderItemsGap) @(indicatorStyle) @(navigationShowScrollbar) @(navigationSmall) @(navigationInvertColors) @(indicatorsOutsideSlider) @(navigationNoLoop) @(indicatorsHighlightActive) @(indicatorsInvertColors) @(indicatorsVisibleOnSmallDevices) @(navigationSlideEntirePage) @(animation) @(autoplay) @(theme)@(contentPadding)" style="--swiffy-slider-nav-light:var(--swift-foreground-color);--swiffy-slider-nav-dark:var(--swift-background-color);visibility:hidden;opacity:0;@(scrollBarForceMobile)" data-slider-nav-autoplay-interval="@(autoplayInterval)"> 138 <ul class="slider-container"> 139 @{ 140 bool isFirst = true; 141 } 142 143 @foreach (var item in sliderItems) 144 { 145 isFirst = false; 146 147 {@RenderSlideItem(item, isFirst, buttonSize, titleFontSize, subtitleFontSize, movePageBehindClass)} 148 } 149 </ul> 150 151 @if(!hideSliderNavigation) 152 { 153 <button type="button" title="@Translate("Previous slide")" class="slider-nav" style="z-index:1;"> 154 <span class="visually-hidden">@Translate("Previous slide")</span> 155 </button> 156 <button type="button" title="@Translate("Next slide")" class="slider-nav slider-nav-next" style="z-index:1;"> 157 <span class="visually-hidden">@Translate("Next slide")</span> 158 </button> 159 } 160 161 @if (indicatorStyle != "slider-indicators-hidden") 162 { 163 <div class="slider-indicators" style="z-index:1;"> 164 @{ 165 string isActive = "active"; 166 int slideCount = 1; 167 } 168 169 170 @foreach (var item in sliderItems) 171 { 172 <button class="@isActive" type="button" title='@Translate("Go to slide") @slideCount'> 173 <span class="visually-hidden">@Translate("Go to slide") @slideCount</span> 174 </button> 175 176 slideCount++; 177 isActive = null; 178 } 179 </div> 180 } 181 </div> 182 183 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/swiffy-slider.js"></script> 184 <script type="module"> 185 swift.AssetLoader.Load('/Files/Templates/Designs/Swift/Assets/css/swiffy-slider.min.css', 'css'); 186 document.addEventListener('load.swift.assetloader', () => { 187 swiffyslider.initSlider(document.querySelector('#Slider_@Model.ID')); 188 document.querySelector('#Slider_@Model.ID').style.opacity = 1; 189 document.querySelector('#Slider_@Model.ID').style.visibility = "visible"; 190 }); 191 </script> 192 </div> 193 </div> 194 195 @helper RenderSlideItem(ItemViewModel item, bool isFirst, string buttonSize, string titleFontSize, string subtitleFontSize, string movePageBehindClass) 196 { 197 string itemLayout = item.GetRawValueString("ItemLayout", "poster"); 198 string layout = item.GetRawValueString("Layout", "align-middle-center-text-center"); 199 string containerWidth = "container-xl"; 200 int xPos = item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; 201 int yPos = item?.GetFile("Image")?.FocalPositionFromTop ?? 50; 202 string theme = !string.IsNullOrWhiteSpace(item.GetRawValueString("Theme")) ? " theme " + item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 203 string active = isFirst ? "active" : ""; 204 string alignment = string.Empty; 205 string maxWidth = item.GetRawValueString("TextReadability", "max-width-on"); 206 maxWidth = maxWidth == "max-width-on" ? "style=\"grid-template-columns: minmax(auto,75ch);\"" : maxWidth; 207 maxWidth = maxWidth == "max-width-off" ? string.Empty : maxWidth; 208 209 switch (layout) 210 { 211 case "align-top-left-text-left": 212 alignment = "text-start justify-content-start align-items-start"; 213 break; 214 case "align-top-center-text-center": 215 alignment = "text-center justify-content-center align-items-start"; 216 break; 217 case "align-top-right-text-right": 218 alignment = "text-end justify-content-end align-items-start"; 219 break; 220 case "align-middle-left-text-left": 221 alignment = "text-start justify-content-start align-items-center"; 222 break; 223 case "align-middle-center-text-center": 224 alignment = "text-center justify-content-center align-items-center"; 225 break; 226 case "align-middle-right-text-right": 227 alignment = "text-end justify-content-end align-items-center"; 228 break; 229 case "align-bottom-left-text-left": 230 alignment = "text-start justify-content-start align-items-end"; 231 break; 232 case "align-bottom-center-text-center": 233 alignment = "text-center justify-content-center align-items-end"; 234 break; 235 case "align-bottom-right-text-right": 236 alignment = "text-end justify-content-end align-items-end"; 237 break; 238 } 239 240 switch (itemLayout) 241 { 242 case "poster": 243 244 <li class="@(theme)"> 245 @{@RenderImage(item)} 246 247 @{string position = item.GetFile("Image") is object ? "position-absolute top-0 bottom-0 start-0 end-0 " : string.Empty;} 248 249 <div class="@(position)h-100 grid grid-1 p-3 px-xl-3 py-xl-4 @(containerWidth) @(alignment)" @(maxWidth)> 250 <div class="grid grid-1 gap-3"> 251 @{ 252 @RenderTitle(item, titleFontSize) 253 @RenderSubtitle(item, subtitleFontSize) 254 @RenderText(item) 255 @RenderButton(item, buttonSize) 256 } 257 </div> 258 </div> 259 </li> 260 261 break; 262 263 case "story-image-left": 264 265 <li class="@(theme)"> 266 <div class="row g-0 h-100"> 267 <div class="col-12 col-lg-6 col-xl-7 mh-100"> 268 <div class="overflow-hidden h-100 w-100"> 269 @{@RenderImage(item)} 270 </div> 271 </div> 272 <div class="col-12 col-lg-6 col-xl-5 mh-100 grid grid-1 p-3 px-xl-3 py-xl-4 @(containerWidth) @(alignment)" @(maxWidth)> 273 <div class="grid grid-1 gap-3"> 274 @{ 275 @RenderSubtitle(item, subtitleFontSize) 276 @RenderTitle(item, titleFontSize) 277 @RenderText(item) 278 @RenderButton(item, buttonSize) 279 } 280 </div> 281 </div> 282 </div> 283 </li> 284 285 break; 286 287 case "story-image-right": 288 289 <li class="@(theme)"> 290 <div class="row g-0 h-100"> 291 <div class="col-12 col-lg-6 col-xl-5 mh-100 grid grid-1 p-3 px-xl-3 py-xl-4 @(containerWidth) @(alignment)" @(maxWidth)> 292 <div class="grid grid-1 gap-3"> 293 @{ 294 @RenderSubtitle(item, subtitleFontSize) 295 @RenderTitle(item, titleFontSize) 296 @RenderText(item) 297 @RenderButton(item, buttonSize) 298 } 299 </div> 300 </div> 301 <div class="col-12 col-lg-6 col-xl-7 mh-100"> 302 @{@RenderImage(item)} 303 </div> 304 </div> 305 </li> 306 307 break; 308 309 case "logo": 310 311 <li class="@(theme)"> 312 @if (!string.IsNullOrEmpty(item.GetString("Image"))) 313 { 314 var altText = !string.IsNullOrEmpty(item.GetString("ImageAlt")) ? item.GetString("ImageAlt") : item.GetString("Title", string.Empty); 315 var image = item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(); 316 var link = GetLink(item); 317 318 if (link is object && !string.IsNullOrEmpty(link.Url)) 319 { 320 string target = link.IsExternal ? "target=\"_blank\"" : string.Empty; 321 <a href="@link.Url" class="d-flex h-100 text-center" @(target)> 322 <img src="@image.Path" class="mw-100 mh-100 m-auto" alt="@altText" loading="lazy" style="object-fit: contain;"> 323 </a> 324 } 325 else 326 { 327 <div class="d-flex h-100 text-center"> 328 <img src="@image.Path" class="mw-100 mh-100 m-auto" alt="@altText" loading="lazy" style="object-fit: contain;"> 329 </div> 330 } 331 } 332 </li> 333 334 break; 335 } 336 } 337 338 @helper RenderImage(ItemViewModel item) 339 { 340 if (!string.IsNullOrEmpty(item.GetString("Image"))) 341 { 342 var altText = !string.IsNullOrEmpty(item.GetString("ImageAlt")) ? item.GetString("ImageAlt") : item.GetString("Title", string.Empty); 343 var parms = new Dictionary<string, object>(); 344 parms.Add("cssClass", "h-100 w-100"); 345 parms.Add("columns", Model.GridRowColumnCount); 346 parms.Add("alt", altText); 347 348 @RenderPartial("Components/Image.cshtml", item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 349 } 350 } 351 352 @helper RenderTitle(ItemViewModel item, string titleFontSize) 353 { 354 if (!string.IsNullOrEmpty(item.GetString("Title")) && !item.GetBoolean("HideTitle")) 355 { 356 string titleColor = item.GetString("TitleColor", "text-inherit"); 357 string titleOpacity = item.GetString("TitleOpacity", "opacity-100"); 358 359 <h2 class="@titleFontSize @titleColor @titleOpacity m-0">@item.GetString("Title")</h2> 360 } 361 } 362 363 @helper RenderSubtitle(ItemViewModel item, string subtitleFontSize) 364 { 365 if (!string.IsNullOrEmpty(item.GetString("Subtitle"))) 366 { 367 string subtitleColor = item.GetString("SubtitleColor", "text-inherit"); 368 string subtitleOpacity = item.GetString("SubtitleOpacity", "opacity-100"); 369 370 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead m-0">@item.GetString("Subtitle")</p> 371 } 372 } 373 374 @helper RenderText(ItemViewModel item) 375 { 376 if (!string.IsNullOrEmpty(item.GetString("Text"))) 377 { 378 string textColor = item.GetString("TextColor", "text-inherit"); 379 string textOpacity = item.GetString("TextOpacity", "opacity-100"); 380 381 <div class="mb-0-last-child @textColor @textOpacity"> 382 @item.GetString("Text") 383 </div> 384 } 385 } 386 387 @helper RenderButton(ItemViewModel item, string buttonSize) 388 { 389 var link = GetLink(item); 390 string stretchedLink = item.GetRawValueString("StretchedLink", string.Empty); 391 stretchedLink = stretchedLink == "not-clickable" ? string.Empty : stretchedLink; 392 stretchedLink = stretchedLink == "clickable" ? "stretched-link" : stretchedLink; 393 394 if (link != null && !string.IsNullOrEmpty(item.GetString("ButtonLabel"))) 395 { 396 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; 397 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; 398 399 string buttonStyle = item.GetRawValueString("ButtonStyle", "primary"); 400 buttonStyle = buttonStyle == "primary" ? "btn-primary" : buttonStyle; 401 buttonStyle = buttonStyle == "secondary" ? "btn-secondary" : buttonStyle; 402 buttonStyle = buttonStyle == "link" ? "btn-link" : buttonStyle; 403 404 <div class="m-0"> 405 <a href="@link.Url" class="btn @buttonStyle@(buttonSize) @(stretchedLink)" @target @rel>@item.GetString("ButtonLabel")</a> 406 </div> 407 } 408 else if (link != null && !string.IsNullOrEmpty(link.Url)) 409 { 410 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; 411 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; 412 413 <a href="@link.Url" class="@(stretchedLink)" @target @rel> 414 <span class="visually-hidden">@item.GetString("Title")</span> 415 </a> 416 } 417 } 418 419 @if (movePageBehind && isFirstPoster) 420 { 421 <script> 422 ['resize', 'load'].forEach(function (e) { 423 window.addEventListener(e, () => swift.Scroll.setContentPosition()); 424 }); 425 </script> 426 } 427
JEWELLERY WITH LOVE
SILVER, GOLD & GEMSTONES
At Scrouples Jewellery you will find jewellery for every taste in different price ranges, which are sold in more than 300 jewellery stores. We design jewellery for women, men and children, so you have the opportunity to find the perfect gift for every occasion. Read more about our collections, materials and find your nearest retailer here on the page. Click below to view all our news and classic diamond series.
MAKE YOUR DIAMONDS GROW
VIEW EXCHANGE SERIES
Our exchange concept means that when you buy a diamond piece from one of our exchange series, you can eventually upgrade the brilliant to a larger size. You simply pay the price difference between the old and the new piece.
Valid within 2 years from the date of purchase. Minimum exchange increment is 0.05 ct.
FOLLOW ON INSTAGRAM
JEWELLERY STYLING, COMPETITIONS & NEWS
On our Instagram profile you can see news, participate in competitions and get inspiration for jewellery styling.
Follow our collaboration with the influencer Julie-Elsebeth, who presents our jewellery to her more than 150,000 followers. In collaboration with Julie-Elsebeth, we have designed a new jewellery series with earrings, necklace and bracelet in 9 carat gold with pearls and pink stones. Read more about the collaboration here.
Also follow us on Facebook, LinkedIn, TikTok and YouTube.