Error executing template "Designs/Swift/Paragraph/NAS_Text_AnteriorSiguiente.cshtml" System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.Generic.List`1.get_Item(Int32 index) at CompiledRazorTemplates.Dynamic.RazorEngine_d072a307217742079b603c6e6e99defe.<>c__DisplayClass0_0.<RenderBody>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Tecnoav\aromcolor.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\NAS_Text_AnteriorSiguiente.cshtml:line 194 at CompiledRazorTemplates.Dynamic.RazorEngine_d072a307217742079b603c6e6e99defe.Execute() in D:\dynamicweb.net\Solutions\Tecnoav\aromcolor.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\NAS_Text_AnteriorSiguiente.cshtml:line 33 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.Ecommerce.Products 4 5 @{ 6 string layout = Model.Item.GetRawValueString("Layout", "text-start"); 7 layout = layout == "alignLeft" ? "align-items-start text-start" : layout; 8 layout = layout == "alignCenter" ? "align-items-center text-center" : layout; 9 layout = layout == "alignRight" ? "align-items-end text-end" : layout; 10 layout = layout == "alignLeftMiddle" ? "align-items-start text-start justify-content-center" : layout; 11 12 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 13 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 14 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 15 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 16 17 //Backward compatibility (Vertical align) 18 string verticalAlign = ""; 19 if (!string.IsNullOrEmpty(Model.Item.GetString("verticalAlign"))) { 20 verticalAlign = verticalAlign == "vertical-align-top" ? "justify-content-start" : verticalAlign; 21 verticalAlign = verticalAlign == "vertical-align-center" ? "justify-content-center" : verticalAlign; 22 verticalAlign = verticalAlign == "vertical-align-bottom" ? "justify-content-end" : verticalAlign; 23 } 24 25 string maxWidth = Model.Item.GetRawValueString("TextReadability", "max-width-on"); 26 maxWidth = maxWidth == "max-width-on" ? " mw-75ch" : maxWidth; 27 maxWidth = maxWidth == "max-width-off" ? "" : maxWidth; 28 29 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 30 } 31 32 <div class="h-100 position-relative d-flex flex-column mb-0-last-child @contentPadding @verticalAlign @(layout)@(theme) item_@Model.Item.SystemName.ToLower()"> 33 @RenderBody(maxWidth) 34 </div> 35 36 @helper RenderBody(string maxWidth) 37 { 38 Dynamicweb.Frontend.LinkViewModel link1 = new Dynamicweb.Frontend.LinkViewModel(); 39 Dynamicweb.Frontend.LinkViewModel link2 = new Dynamicweb.Frontend.LinkViewModel(); 40 41 string linkType1 = Model.Item.GetRawValueString("LinkType", "page"); 42 string linkType2 = Model.Item.GetRawValueString("LinkType2", "page2"); 43 44 if (linkType1 == "page" && Model.Item.GetLink("ButtonLink") != null) 45 { 46 link1 = Model.Item.GetLink("ButtonLink"); 47 } 48 49 if (linkType2 == "page2" && Model.Item.GetLink("ButtonLink2") != null) 50 { 51 link2 = Model.Item.GetLink("ButtonLink2"); 52 } 53 54 if (linkType1 == "product-group") 55 { 56 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 57 IList<string> groupIds = new List<string> { }; 58 59 if (selectedGroups != null) 60 { 61 foreach (var fromGroup in selectedGroups) 62 { 63 groupIds.Add(fromGroup.Id); 64 } 65 } 66 67 link1 = new Dynamicweb.Frontend.LinkViewModel() 68 { 69 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds) 70 }; 71 } 72 73 if (linkType2 == "product-group2") 74 { 75 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink2"); 76 IList<string> groupIds = new List<string> { }; 77 78 if (selectedGroups != null) 79 { 80 foreach (var fromGroup in selectedGroups) 81 { 82 groupIds.Add(fromGroup.Id); 83 } 84 } 85 86 link2 = new Dynamicweb.Frontend.LinkViewModel() 87 { 88 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 89 IsExternal = false 90 }; 91 } 92 93 if (linkType1 == "product") 94 { 95 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink"); 96 IList<string> productIds = new List<string> { }; 97 98 if (products != null) 99 { 100 foreach (var product in products.Products) 101 { 102 productIds.Add(product.Id); 103 } 104 } 105 106 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 107 string pageTag = productIds.Count == 1 ? "ProductDetailPage" : "Shop"; 108 link1 = new Dynamicweb.Frontend.LinkViewModel() 109 { 110 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag(pageTag) + "&" + productParameter + "=" + string.Join(",", productIds) 111 }; 112 } 113 114 if (linkType2 == "product2") 115 { 116 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink2"); 117 IList<string> productIds = new List<string> { }; 118 119 if (products != null) 120 { 121 foreach (var product in products.Products) 122 { 123 productIds.Add(product.Id); 124 } 125 } 126 127 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 128 string pageTag = productIds.Count == 1 ? "ProductDetailPage" : "Shop"; 129 link2 = new Dynamicweb.Frontend.LinkViewModel() 130 { 131 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag(pageTag) + "&" + productParameter + "=" + string.Join(",", productIds).Trim(), 132 IsExternal = false 133 }; 134 } 135 136 if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 137 { 138 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 139 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 140 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h3"); 141 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 142 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity}{maxWidth} mb-3\">"; 143 string headingLevelStop = $"</{headingLevel}>"; 144 145 @headingLevelStart 146 @Model.Item.GetString("Title") 147 @headingLevelStop 148 } 149 150 if (!string.IsNullOrEmpty(Model.Item.GetString("Lead"))) 151 { 152 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 153 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 154 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 155 156 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead mb-3@(maxWidth)"> 157 @Model.Item.GetString("Lead") 158 </p> 159 } 160 161 if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 162 { 163 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 164 string textOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 165 166 <div class="mb-0-last-child @textColor @(textOpacity)@(maxWidth)"> 167 @Model.Item.GetString("Text") 168 </div> 169 } 170 171 172 173 @* NAS START TOM Añadir los botones anterior/listado/siguiente de este producto *@ 174 175 ProductViewModel auxProduct = null; 176 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 177 { 178 auxProduct = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 179 if (auxProduct!=null) { 180 GroupInfoViewModel auxGroupPrimary = auxProduct.PrimaryOrDefaultGroup; 181 if (auxGroupPrimary!=null) { 182 // Link a la pagina de productos y link al listado del grupo 183 string auxLinkDefault = "Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + auxGroupPrimary.Id; 184 string auxLinkAll = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + GetPageIdByNavigationTag("Shop")); 185 string auxLinkGroup = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(auxLinkDefault); 186 // Productos que contiene este grupo 187 Dynamicweb.Ecommerce.Products.ProductCollection auxProds = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(auxGroupPrimary.Id).Products; 188 int auxIndex = auxProds.IndexOf(auxProduct.Id); 189 int auxIndexAnterior = auxIndex==0? auxProds.Count-1 : auxIndex-1; 190 int auxIndexSiguiente = auxIndex==auxProds.Count-1? 0 : auxIndex+1; 191 string auxLinkAnterior = null; 192 string auxLinkSiguiente = null; 193 if (auxIndexAnterior!=auxIndexSiguiente) { 194 auxLinkAnterior = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(auxLinkDefault + "&ProductID=" + auxProds[auxIndexAnterior ].Id); 195 auxLinkSiguiente = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(auxLinkDefault + "&ProductID=" + auxProds[auxIndexSiguiente].Id); 196 } 197 // Mostramos enlaces 198 <div> 199 @{ 200 if (auxLinkAnterior!=null) { 201 <a href="@auxLinkAnterior"><img src="/Files/Icons/chevron-left.svg" alt="Producto anterior" width="20" height="20" /></a> 202 } 203 <a href="@auxLinkAll"><img src="/Files/Icons/NAS_listado.png" alt="Productos" width="15" height="15" /></a> 204 if (auxLinkSiguiente!=null) { 205 <a href="@auxLinkSiguiente"><img src="/Files/Icons/chevron-right.svg" alt="Producto anterior" width="20" height="20" /></a> 206 } 207 } 208 </div> 209 } 210 } 211 } 212 @* NAS END TOM *@ 213 214 215 216 if (link1 != null && !string.IsNullOrEmpty(link1.Url) || link2 != null && !string.IsNullOrEmpty(link2.Url)) 217 { 218 string target1 = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link1.IsExternal ? "target=\"_blank\"" : ""; 219 string target2 = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link2.IsExternal ? "target=\"_blank\"" : ""; 220 string rel1 = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link1.IsExternal ? "rel=\"noopener\"" : ""; 221 string rel2 = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link2.IsExternal ? "rel=\"noopener\"" : ""; 222 string buttonLabel1 = Model.Item.GetString("ButtonLabel", string.Empty); 223 string buttonLabel2 = Model.Item.GetString("ButtonLabel2", string.Empty); 224 string buttonStyle1 = Model.Item.GetRawValueString("ButtonStyle", ""); 225 buttonStyle1 = buttonStyle1 == "primary" ? "btn-primary " : buttonStyle1; 226 buttonStyle1 = buttonStyle1 == "secondary" ? "btn-secondary " : buttonStyle1; 227 buttonStyle1 = buttonStyle1 == "link" ? "btn-link" : buttonStyle1; 228 string buttonStyle2 = Model.Item.GetRawValueString("ButtonStyle2", ""); 229 buttonStyle2 = buttonStyle2 == "primary" ? "btn-primary " : buttonStyle2; 230 buttonStyle2 = buttonStyle2 == "secondary" ? "btn-secondary " : buttonStyle2; 231 buttonStyle2 = buttonStyle2 == "link" ? "btn-link" : buttonStyle2; 232 string stretchedLink1 = Model.Item.GetRawValueString("StretchedLink", "column-not-clickable"); 233 string stretchedLink2 = Model.Item.GetRawValueString("StretchedLink2", "column-not-clickable"); 234 string stretchedLinkClass = stretchedLink1 == "column-clickable" && string.IsNullOrEmpty(link2.Url) && string.IsNullOrEmpty(buttonLabel2) ? "stretched-link" : string.Empty; 235 string stretchedLinkClass2 = stretchedLink2 == "column-clickable" && string.IsNullOrEmpty(link1.Url) && string.IsNullOrEmpty(buttonLabel1) ? "stretched-link" : string.Empty; 236 string alignmentClass = string.Empty; 237 238 if (Model.Item.GetString("Layout") == "alignCenter") 239 { 240 alignmentClass = " justify-content-center"; 241 } 242 <div class="d-flex flex-wrap gap-3 mt-3@(alignmentClass)"> 243 244 @if (link1 != null && !string.IsNullOrEmpty(link1.Url)) 245 { 246 if (!string.IsNullOrEmpty(buttonLabel1)) 247 { 248 <a href="@link1.Url" @target1 @rel1 class="text-nowrap btn @(buttonStyle1)@(stretchedLinkClass)">@buttonLabel1</a> 249 } 250 else 251 { 252 <a href="@link1.Url" @target1 @rel1 class="@(stretchedLinkClass)"> 253 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 254 </a> 255 } 256 } 257 258 @if (link2 != null && !string.IsNullOrEmpty(link2.Url)) 259 { 260 if (!string.IsNullOrEmpty(buttonLabel2)) 261 { 262 <a href="@link2.Url" @target2 @rel2 class="text-nowrap btn @(buttonStyle2)@(stretchedLinkClass2)">@buttonLabel2</a> 263 } 264 else 265 { 266 <a href="@link2.Url" @target2 @rel2 class="@(stretchedLinkClass2)"> 267 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 268 </a> 269 } 270 } 271 </div> 272 } 273 } 274
Sabor Coco
$29,00 - $116,00
InStock
Sabor líquido grado alimenticio. Nuestros envases son aptos para alimentos.
- Tipo Industria: Alimenticia y Farmacéutica
- Categoria usos: Bebidas, lácteos, panadería, confites, cárnicos, snacks, cuidado oral y farmacéutico, otros
Peso | 1 kilo / 4 kilos | |
---|---|---|
Presentacion | Botella / Galón | |
Descriptor del Sabor | Coco, fermentado | |
Disponible ✅ |