Biberons e Chupetas


Aroma Home Protetor Ouvidos Panda

Ouvidos
Exception in template (Designs\farmacia\eCom/Product/Product.cshtml): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: oldValue
   at System.String.Replace(String oldValue, String newValue)
   at Dynamicweb.Modules.Searching.Rules.Parser.UnescapeStrings(String s)
   at Dynamicweb.Modules.Searching.Rules.Parser.GetValue(String value)
   at Dynamicweb.Modules.Searching.Rules.Parser.ParseSimpleExpression(String expression)
   at Dynamicweb.Modules.Searching.Rules.Parser.Parse(String input)
   at Dynamicweb.Modules.ItemPublisher.FilterHelper.ToXml(String filter)
   at Dynamicweb.Modules.ItemPublisher.Frontend.GetContentBySettings(String settings)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Dynamicweb.Extensibility.AddInManager.InvokeFunction(Object instance, String FunctionName, Object[] Params)
   at Dynamicweb.Rendering.RazorTemplateBase`1.RenderItemList(Object settings)
   at CompiledRazorTemplates.Dynamic.abdfeadec.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@inherits RazorTemplateBase<RazorTemplateModel<Template>> @using Dynamicweb.Rendering; @using System; @using System.IO; @using System.Web; @using System.Text; @using System.Collections.Generic; @using System.Linq @using System.Text.RegularExpressions; @using System.IO; @using System.Web; @{ string designName = GetString("Template:DesignBaseUrl").Replace("/Files/Templates/Designs/", "").Replace("/", ""); }@functions{ public static string GetImage(string sourceString, int imageWidth, int imageHeight, int imageWidthTablet = 0, int imageHeightTablet = 0, int imageWidthMobile = 0, int imageHeightMobile = 0, string imageFormat = "jpg", int imageCompression = 0, int imageCrop = 5, string background = "", string designName = "RizzoDesignFolder") { Dynamicweb.Frontend.PageView currentPageview = Dynamicweb.Frontend.PageView.Current(); string currDevice = currentPageview.Device.ToString(), alternativeImage = currentPageview.Area.Item["NoImage"] != null ? currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/"+ designName + "/images/alternativeImage.jpg", widthString = "", heightString = "", getImageFormat = imageFormat != "jpg" ? "&amp;Format=" + imageFormat : "", getImageCompression = imageCompression != 0 ? "&amp;Compression=" + imageCompression : "", bgColor = !string.IsNullOrEmpty(background) ? "&amp;backgroud="+background : ""; int getImageWidth = imageWidth != 0 ? imageWidth : 0, getImageHeight = imageHeight != 0 ? imageHeight : 0; if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Tablet.ToString()) { getImageWidth = imageWidthTablet != 0 ? imageWidthTablet : getImageWidth; getImageHeight = imageHeightTablet != 0 ? imageHeightTablet : getImageHeight; } else if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Mobile.ToString()) { getImageWidth = imageWidthMobile != 0 ? imageWidthMobile : getImageWidth; getImageHeight = imageHeightMobile != 0 ? imageHeightMobile : getImageHeight; } if (getImageWidth != 0) { widthString = "&amp;Width=" + getImageWidth; } if (getImageHeight != 0) { heightString = "&amp;Height=" + getImageHeight; } string output = "/Admin/Public/GetImage.ashx?Image=" + sourceString + widthString + heightString + "&amp;altFmImage_path=" + alternativeImage + getImageFormat + getImageCompression + "&amp;Crop=" + imageCrop + bgColor; return output; } public static string GetImageFile(string imagesFolder, string image, string productID, string size) { string folderPath = Path.GetDirectoryName(HttpContext.Current.Server.MapPath(imagesFolder)); if (Directory.Exists(folderPath)) { string temp = @"\", imagePatternSearch = String.Format("{0}-*", productID); var imageFiles = Directory.GetFiles(folderPath, imagePatternSearch).Where(f => f.Contains(size)); if (imageFiles.Any()) { string file = imageFiles.FirstOrDefault(); image = imagesFolder + file.Substring((file.LastIndexOf(@temp) + 1), (file.Length - file.LastIndexOf(@temp) - 1)); } } return GetImage(image, 220, 220, 220, 220, 220, 220, "jpg", 0, 1); } } @inherits RazorTemplateBase<RazorTemplateModel<Template>> @using Dynamicweb.Rendering; @functions{ private string GetImagePathUrl(string small, string medium, string large, string pattern) { string imagePath; if (!string.IsNullOrEmpty(small)) imagePath = small; else if (!string.IsNullOrEmpty(medium)) imagePath = medium; else if (!string.IsNullOrEmpty(large)) imagePath = large; else imagePath = pattern; return imagePath; } } @{ Dynamicweb.Content.Items.Item areaItem = Pageview.Area.Item; bool showQuantity = areaItem["ShowQuantityField"].ToString() == "True" ? true : false, // Added - Tiago S. - 02/03/2017 hasNoDiscount = GetBoolean("Ecom:Product.Discount.TotalAmount.IsZero"), // Added - Tiago S. - 10/05/2017 - optimization. isFirstImage = true; int productStock = GetInteger("Ecom:Product.AvailableAmount"); string currentPageId = Pageview.Page.ID.ToString(), detailID = areaItem["ProductDetail"] != null ? areaItem["ProductDetail"].ToString() : "", variantDefaultId = GetString("Ecom:Product.DefaultVariantComboID"), variantCurrentId = GetString("Ecom:Product.VariantID"), variantId = (!string.IsNullOrEmpty(variantCurrentId)) ? variantCurrentId : variantDefaultId, titleKey = "title", title = "", imageKey = "image", image = "", stockStatus = (GetInteger("Ecom:Product.Stock") > 0 && productStock > 0) ? "fa-check" : "fa-close", productId = GetString("Ecom:Product.ID"), productLanguage = GetString("Ecom:Product.LanguageID"), productName = GetString("Ecom:Product.Name"), productNumber = GetString("Ecom:Product.Number"), imagesFolder = "/Files/Files/" + designName + "/Products/", imagePattern = String.Format("{0}{1}{2}.jpg", imagesFolder, productId, !String.IsNullOrWhiteSpace(variantId) ? "-" + variantId.Replace(".", "_") : ""), imagePatternSearch = String.Format("{0}{1}-*", productId, !String.IsNullOrWhiteSpace(variantId) ? "-" : ""), imagePatternSearch_2 = String.Format("{0}{1}.*", productId, !String.IsNullOrWhiteSpace(variantId) ? "-" : ""), // TODO - Use image defined in back-office. imageLarge = GetString("Ecom:Product.ImageLarge.Default.Clean"), imageMedium = GetString("Ecom:Product.ImageMedium.Default.Clean"), imageSmall = GetString("Ecom:Product.ImageSmall.Default.Clean"), productImage = GetImagePathUrl(imageLarge, imageMedium, imageSmall, imagePattern), productGetImage = GetImage(productImage, 0, 600), productIntro = GetString("Ecom:Product.ShortDescription"), productMetaDescription = GetString("Ecom:Product.MetaDescription"), productDescription = GetString("Ecom:Product.LongDescription"), pointPrice = GetString("Ecom:Product.PointPrice"), productDetails = GetString("Ecom:Product:Field.Details.Value.Clean"), productWarranty = GetString("Ecom:Product:Field.Warranty.Value.Clean"), productPrice = GetString("Ecom:Product.Discount.Price.PriceWithVATFormatted").Replace(" €", "€"), orderContext = "", // Filter for downloads item downloadsFilter = "Products contains \"p_" + productId + ",\" or Products contains \"p_" + productId + ":\" or Products ends with \"p_" + productId + "\"", // Added - Tiago S. - 02/03/2017 stickerC = GetBoolean("Ecom:Product:Field.New.Value.Clean") ? "newProd" : ""; List<LoopItem> loopVariantCombinations = GetLoop("VariantCombinations"), loopVariantGroups = GetLoop("VariantGroups"), loopProdPrices = GetLoop("Product.Prices"), loopDetails = GetLoop("Details"), loopRelatedGroups = GetLoop("ProductRelatedGroups"); Dictionary<string, List<LoopItem>> allVariantsPrice = new Dictionary<string, List<LoopItem>>(); foreach (var vc in loopVariantCombinations) { var name = vc.GetString("Ecom:VariantCombination.VariantID"); var prices = vc.GetLoop("Product.Prices"); allVariantsPrice.Add(name, prices); } List<Dictionary<string, string>> imagesList = new List<Dictionary<string, string>>(); string folderPath = Path.GetDirectoryName(HttpContext.Current.Server.MapPath("/Files/Files/" + designName + "/Products/" + productNumber + ".jpg")); IEnumerable<string> imageFiles = Directory.GetFiles(folderPath, imagePatternSearch_2) .Concat(Directory.GetFiles(folderPath, imagePatternSearch).Where(f => !f.Contains("home") && !f.Contains("small") && !f.Contains("large") && !f.Contains("medium") && !f.Contains("thickbox"))); // Added - Tiago S. - 10/05/201 // Check to see if images where defined on the product, and if so add them. if (!String.IsNullOrEmpty(imageLarge) || !String.IsNullOrEmpty(imageMedium) || !String.IsNullOrEmpty(imageSmall)) { if (!String.IsNullOrEmpty(imageLarge)) { imagesList.Add(new Dictionary<string, string> { { titleKey, title }, { imageKey, imageLarge } }); } if (!String.IsNullOrEmpty(imageMedium)) { imagesList.Add(new Dictionary<string, string> { { titleKey, title }, { imageKey, imageMedium } }); } if (!String.IsNullOrEmpty(imageSmall)) { imagesList.Add(new Dictionary<string, string> { { titleKey, title }, { imageKey, imageSmall } }); } } // Default behaviour for images -> /Files/Files/farmacia/Products else if (Directory.Exists(folderPath)) { string temp = @"\"; // Removed to simplify the code. // TODO - REMOVE FROM PRODUCTION. @*foreach (string file in Directory.GetFiles(folderPath, imagePatternSearch_2)) { Dictionary<string, string> dct_image = new Dictionary<string, string>(); image = imagesFolder + file.Substring((file.LastIndexOf(@temp) + 1), (file.Length - file.LastIndexOf(@temp) - 1)); string metafield = "title"; var metadata = Dynamicweb.Content.Files.Metadata.EditorFactory.GetMetadataForFile(image); title = metadata != null ? metadata.GetValue(metafield).ToString() : productName; dct_image.Add(titleKey, title); dct_image.Add(imageKey, image); imagesList.Add(dct_image); } foreach (string file in Directory.GetFiles(folderPath, imagePatternSearch).Where(f => !f.Contains("home") && !f.Contains("small") && !f.Contains("large") && !f.Contains("medium") && !f.Contains("thickbox"))) { Dictionary<string, string> dct_image = new Dictionary<string, string>(); image = imagesFolder + file.Substring((file.LastIndexOf(@temp) + 1), (file.Length - file.LastIndexOf(@temp) - 1)); string metafield = "title"; var metadata = Dynamicweb.Content.Files.Metadata.EditorFactory.GetMetadataForFile(image); title = metadata != null ? metadata.GetValue(metafield).ToString() : productName; dct_image.Add(titleKey, title); dct_image.Add(imageKey, image); imagesList.Add(dct_image); }*@ foreach (string file in imageFiles) { Dictionary<string, string> dct_image = new Dictionary<string, string>(); image = imagesFolder + file.Substring((file.LastIndexOf(@temp) + 1), (file.Length - file.LastIndexOf(@temp) - 1)); string metafield = "title"; var metadata = Dynamicweb.Content.Files.Metadata.EditorFactory.GetMetadataForFile(image); title = metadata != null ? metadata.GetValue(metafield).ToString() : productName; dct_image.Add(titleKey, title); dct_image.Add(imageKey, image); imagesList.Add(dct_image); } } // Possible files and "fontawesom" icons Dictionary<string, string> iconFiles = new Dictionary<string, string>(); iconFiles.Add("pdf", "fa-file-pdf-o"); iconFiles.Add("jpg", "fa-file-image-o"); iconFiles.Add("png", "fa-file-image-o"); iconFiles.Add("zip", "fa-file-archive-o"); iconFiles.Add("rar", "fa-file-archive-o"); switch (areaItem["Theme"].ToString()) { case "theme1": orderContext = "ORDERCONTEXT1"; break; case "theme2": orderContext = "ORDERCONTEXT2"; break; case "theme3": orderContext = "ORDERCONTEXT3"; break; default: break; } var activeDiscountLoop = GetLoop("ProductDiscounts"); var activeDiscount = activeDiscountLoop.Any() ? activeDiscountLoop.First().GetString("Ecom:Product.Discount.ID") : ""; DateTime dateTimeFrom = DateTime.MinValue, dateTimeTo = DateTime.MinValue; if (!string.IsNullOrEmpty(activeDiscount)) { try { var selectDiscountQuery = string.Format("SELECT DiscountValidFrom, DiscountValidTo FROM EcomDiscount WHERE DiscountId = '{0}'", activeDiscount); using (var reader = Dynamicweb.Database.CreateDataReader(selectDiscountQuery)) { reader.Read(); string datimeToTicks = reader["DiscountValidTo"].ToString(); string datimeFromTicks = reader["DiscountValidFrom"].ToString(); if (!string.IsNullOrEmpty(datimeToTicks)) { datimeToTicks = datimeToTicks.Split(' ')[0]; dateTimeTo = DateTime.ParseExact(datimeToTicks, new[] { "dd/MM/yyyy" }, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None).Date; } if (!string.IsNullOrEmpty(datimeFromTicks)) { datimeFromTicks = datimeFromTicks.Split(' ')[0]; dateTimeFrom = DateTime.ParseExact(datimeFromTicks, new[] { "dd/MM/yyyy" }, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None).Date; } } } catch (Exception) { // ignored } } if (dateTimeTo == DateTime.MinValue.Date || dateTimeTo < dateTimeFrom) { dateTimeTo = new DateTime(DateTime.Now.Year, 12, 31).Date; } } @using System; @using System.Collections.Generic; @using System.Web.Script.Serialization; @{ Dictionary<string, Dictionary<string, Dictionary<string, string>>> product = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>(); Dictionary<string, Dictionary<string, string>> variants = new Dictionary<string, Dictionary<string, string>>(); string productJSON = ""; if (loopVariantCombinations.Any()) { foreach (LoopItem variant in loopVariantCombinations) { string variantHref = "/" + variant.GetString("Ecom:VariantCombination.Link.Clean") + "?PID=" + Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ID.ToString(), productNumberVariant = variant.GetString("Ecom:Product.Number"), oldPrice = variant.GetString("Ecom:Product.Price").Replace(" €", "€"), price = variant.GetString("Ecom:Product.Discount.Price.PriceWithVATFormatted").Replace(" €", "€"), stock = variant.GetString("Ecom:Product.AvailableAmount"), smallImage = variant.GetString("Ecom:Product.ImageSmall.Clean"), mediumImage = variant.GetString("Ecom:Product.ImageMedium.Clean"), largeImage = variant.GetString("Ecom:Product.ImageLarge.Clean"), id = variant.GetString("Ecom:VariantCombination.VariantID"), variantName = variant.GetString("Ecom:VariantCombination.VariantText"), variantShortDescription = variant.GetString("Ecom:VariantCombination.VariantText"); Dictionary<string, string> variantDict = new Dictionary<string, string>(); variantDict.Add("name", variantName); variantDict.Add("id", id); variantDict.Add("number", productNumberVariant); variantDict.Add("price", price); variantDict.Add("oldPrice", oldPrice); variantDict.Add("stock", stock); variantDict.Add("smallImage", smallImage); variantDict.Add("mediumImage", mediumImage); variantDict.Add("largeImage", largeImage); variantDict.Add("productIsFavorite", variant.GetString("Ecom:Product.IsProductInFavoriteList")); variantDict.Add("addToList", variant.GetString("Ecom:Product.AddToFavorites")); variantDict.Add("removeFromList", variant.GetString("Ecom:Product.RemoveFromFavorites")); variants.Add(id, variantDict); } product.Add("product", variants); } productJSON = new JavaScriptSerializer().Serialize(product); } <div id="product-container" data-pageId="@currentPageId" data-productId="@productId" data-variantId="@variantId" data-errorCombination1='@Translate("combinationNotAvailable","Combination not available")'> <article id="product-description" class="col-xs-12 noPadding"> <div id="product-images" class="col-sm-6 col-xs-12 noPadding"> @* Added - Tiago S. - 02/03/2017 *@ @if (!String.IsNullOrEmpty(stickerC)) { <b class="light sticker"> <span> @Translate("novelty", "Novidade") </span> </b> } else if (!hasNoDiscount) { <b class="dark sticker"> <span> @Translate("promotion", "Promoção") </span> </b> } <div id="product-lg-image" class="col-xs-12 noPaddingLeft"> <figure class="text-center"> <img class="img-responsive" src="@productGetImage" alt="@productName" title="@productName" /> <div class="hidden" id="videoContainer"> <a id="playPause" href="#"><i class="fa fa-play"></i></a> <video id="video" width="100%" src=""> Your browser does not support the video tag. </video> </div> </figure> </div> <div id="imgThumbs" class="col-xs-12 noPaddingLeft"> <ul> @foreach (System.Collections.Generic.Dictionary<String, String> imageStr in imagesList) { string imgStr = imageStr["image"].ToString(); // Modified - Tiago S. - 11/05/2017 - added a check for the png file type as this is a valid file type for images. bool isAnImage = imgStr.ToLower().Contains(".jpg") || imgStr.ToLower().Contains(".png"); string getimageImg = GetImage(imgStr, 0, 105), getimageDataImg = isAnImage ? GetImage(imgStr, 600, 600) : imgStr, // Optimization, no need to check the index of every object -> consumes alot of resources, // we can use a simple flag to know if the current item is first. //liClass = imagesList.IndexOf(imageStr) == 0 ? "active" : ""; liClass = isFirstImage ? "active" : ""; <li data-type='@imgStr.Substring(imgStr.LastIndexOf('/') + 1).Replace(productId, "").Replace(".jpg","").Replace(".mp4","")' class="@liClass"> @if (isAnImage) { <img data-image="@getimageDataImg" class="img-responsive" src="@getimageImg" title="@imageStr["title"]" alt="@imageStr["title"]" /> } else { <video data-image="@getimageDataImg" width="100%" src="@getimageDataImg">Your browser does not support the video tag.</video> } </li> isFirstImage = false; } </ul> </div> </div> <div id="product-info-wrapper" class="col-sm-6 col-xs-12"> <div class="product-title padding-bottom">@productName</div> <div class="col-xs-12 noPadding"> @if (!string.IsNullOrEmpty(productIntro)) { <div class="col-xs-12 noPadding productIntroduction">@productIntro</div> } else if (!string.IsNullOrEmpty(productDescription)) { <div class="col-xs-12 noPadding productIntroduction">@productDescription</div> } @Translate("reference", "Referência"): @productNumber </div> @if (!hasNoDiscount) { <div class="productOldPrice inlineBlock"> @GetString("Ecom:Product.ActualPriceWithVAT").Replace(" €", "€") </div> } <div class="product-price inlineBlock"> @productPrice </div> <div class="NETREVIEWS_PRODUCT_STARS" data-product-id="@productId"></div> @if (dateTimeFrom != DateTime.MinValue) { <div class="actualDiscountDeadline"> <span> @Translate("PromotionStart", "Promoção disponível de") <strong>@(dateTimeFrom.ToString("dd/MM/yyyy"))</strong> @Translate("PromotionTo", "até") <strong>@(dateTimeTo.ToString("dd/MM/yyyy"))</strong> </span> </div> } @* Added - Tiago S. - Show product prices. *@ <!-- Quantity prices --> @if (allVariantsPrice.Any() && showQuantity) { <div id="pricesContainer" class="col-xs-12 noPadding"> <h2> @Translate("quantityPrices", "Quantity prices") </h2> <div id="quantityContainer" class="col-xs-12 noPadding"> <ul> @foreach (var allv in allVariantsPrice) { var list = allv.Value; if (list.Any()) { foreach (var i in list) { int quantity = i.GetInteger("Ecom:Product.Prices.Quantity"); string priceProd = i.GetString("Ecom:Product.Prices.PriceFormatted"); <li product-variant="@allv.Key" class="hidden"> <span class="col-xs-6">@Translate("qty", "Qty") <span>&gt;=</span> @quantity</span> <b class="col-xs-6 text-right">(@priceProd)</b> </li> } } } </ul> </div> </div> } else if (loopProdPrices.Count > 0 && showQuantity) { <div id="pricesContainer" class="col-xs-12 noPadding"> <h2> @Translate("quantityPrices", "Quantity prices") </h2> <div id="quantityContainer" class="col-xs-12 noPadding"> <ul> @foreach (LoopItem price in loopProdPrices) { int quantity = price.GetInteger("Ecom:Product.Prices.Quantity"); string priceProd = price.GetString("Ecom:Product.Prices.PriceFormatted"); <li> <span class="col-xs-6">@Translate("qty", "Qty") <span>&gt;=</span> @quantity</span> <b class="col-xs-6 text-right">(@priceProd)</b> </li> } </ul> </div> </div> } <div class="order-now"> <form name="addToCart" class="add-to-cart form-fields" action="/Default.aspx?ID=@(currentPageId)" method="post" data-outofstock='@Translate("outOfStock", "Out of stock")'> <input type="hidden" name="cartcmd" value="add" /> <input type="hidden" name="productID" value="@productId" /> <input type="hidden" name="variantID" id="variantID" value="@variantId" @((string.IsNullOrEmpty(variantId)) ? "disabled='disabled'" : "") /> <input type="hidden" name="OrderContext" value="@orderContext" /> @if (loopVariantCombinations.Any()) { <div id="variantsContainer" class="col-xs-12 noPadding"> @if (loopVariantGroups.Any()) { foreach (LoopItem variantGroup in loopVariantGroups) { string variantGroupName = variantGroup.GetString("Ecom:VariantGroup.Name"), variantGroupId = variantGroup.GetString("Ecom:VariantGroup.ID"); List<LoopItem> loopAvailableOptions = variantGroup.GetLoop("VariantAvailableOptions"); if (loopAvailableOptions.Any()) { <fieldset class="col-sm-6 col-xs-12"> <label class="text-left" for="@variantGroupId">@variantGroupName</label> <select class="full-width-input" name="@(variantGroupId)_options" id="@variantGroupId"> @foreach (LoopItem option in loopAvailableOptions) { string optionId = option.GetString("Ecom:VariantOption.ID"), optionName = option.GetString("Ecom:VariantOption.Name"); bool optionSelected = option.GetBoolean("Ecom:VariantOption.Selected"); <option value="@optionId" @((optionSelected) ? "selected" : "")>@optionName</option> } </select> </fieldset> } } } </div> } <div id="stockStatus" class="col-xs-12 noPadding" data-unavailable='@Translate("unavailableStock", "Indisponível")' data-available='@Translate("availableStock", "Em Stock")'> <i class="fa @stockStatus"></i> @((stockStatus.Contains("close") || productStock <= 0) ? Translate("unavailableStock", "Indisponível") : Translate("availableStock", "Em Stock")) </div> @if (pointPrice != "0") { <div id="prodLoyaltyPoints" class="col-xs-12 noPadding"><i class="fa fa-gift"></i> @Translate("earn", "Earn") @pointPrice @Translate("loyaltyPoints", "loyalty points")</div> } <div class="col-xs-12 grayBox noPadding"> <div class="highlight-content text-right"> @if ((showQuantity && productStock > 0) || loopVariantCombinations.Any()) { if (loopVariantCombinations.Any() && productStock == 0) { productStock = 10; } <fieldset class="quantity-container pull-left col-xs-6 noPadding"> <label for="quantity">@Translate("quantity", "Quantity")</label> <input data-stocktranslate='@Translate("currentStock","The current stock is")' class="hidden quantityInput" data-stock='@GetString("Ecom:Product.Stock")' maxlength="5" id="quantity" class="quantity" name="quantity" type="number" value="1" /> <select data-width="25%" name="quantitySelect"> @for (int num = 1; (num < 10) && num <= productStock; num++) { <option value="@num">@num</option> } @if (productStock >= 10) { <option value="10+">10+</option> } </select> </fieldset> } <a class="col-xs-6 pull-right" id="addToCartSubmit"> <span data-finishcart='@Translate("finishCart", "Finalizar compra")' data-continuebuying='@Translate("continuebuying", "Continuar a comprar")' data-addtitle='@Translate("yourProductWasAdded", "O seu produto foi adicionado ao carrinho")' data-add='@Translate("addToCart", "Add to cart")' data-added='@Translate("added", "Added")'>@Translate("addToCart", "Add to Cart")</span> </a> @* if(GetBoolean("Ecom:Product.CanBuyForPoints")) { <a class="btn btn-bg" id="addToCartPointsSubmit"> <i class="fa fa-shopping-cart"></i> <span data-add='@Translate("addWithPoints", "Add with points")' data-added='@Translate("added", "Added")'>@Translate("addWithPoints", "Add with points")</span> </a> } *@ </div> </div> <div class="col-xs-12 noPadding"> <div class="shareIcons"> <!-- Go to www.addthis.com/dashboard to customize your tools --> <div class="addthis_sharing_toolbox"></div> @* <span>@Translate("share", "Share")</span> <ul> <li> <a class="fa-facebook fa" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=@(Pageview.GlobalTags.GetTagByName("Global:Request.Scheme").Value.ToString())://@(Pageview.GlobalTags.GetTagByName("Global:Request.Host").Value.ToString())@(Pageview.GlobalTags.GetTagByName("Global:Pageview.Url").Value.ToString())"><span>@Translate("shareFacebook", "Share facebook")</span></a> </li> <li> <a class="fa-twitter fa" target="_blank" href="https://twitter.com/home?status=@(Pageview.GlobalTags.GetTagByName("Global:Request.Scheme").Value.ToString())://@(Pageview.GlobalTags.GetTagByName("Global:Request.Host").Value.ToString())@(Pageview.GlobalTags.GetTagByName("Global:Pageview.Url").Value.ToString())"><span>@Translate("shareTwitter", "Share twitter")</span></a> </li> <li> <a class="fa-linkedin fa" target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=@(Pageview.GlobalTags.GetTagByName("Global:Request.Scheme").Value.ToString())://@(Pageview.GlobalTags.GetTagByName("Global:Request.Host").Value.ToString())@(Pageview.GlobalTags.GetTagByName("Global:Pageview.Url").Value.ToString())&title=@productName&summary=@productIntro&source="><span>@Translate("shareLinkedin", "Share linkedin")</span></a> </li> </ul> *@ </div> </div> <input class="hidden" type="submit" value='@Translate("addToCart", "Add to Cart")' /> </form> </div> </div> @* TABS / Long description / Product custom field(example) / Downloads (items) *@ @* Modified - Tiago S. - added this check so that the container is not placed unnecessarily. *@ @if (!string.IsNullOrEmpty(productDescription) || !string.IsNullOrEmpty(productWarranty) || loopDetails.Any()) { <div id="tabsContainer" class="col-xs-12 noPadding"> <ul class="col-xs-12 noPadding"> @if (!string.IsNullOrEmpty(productDescription)) { <li class="active"> <a href="#description_tab">@Translate("description", "Mais informações")</a> </li> } @if (!string.IsNullOrEmpty(productWarranty)) { <li> <a href="#warraty_tab">@Translate("warranty", "Warranty") (custom field)</a> </li> } @RenderSnippet("downloadItem") @if (loopDetails.Any()) { <li> <a href="#productDdownloads_tab">@Translate("downloads", "Downloads")</a> </li> } </ul> @if (!string.IsNullOrEmpty(productDescription)) { <div class="active col-xs-12" id="description_tab">@productDescription</div> } @if (!string.IsNullOrEmpty(productWarranty)) { <div class="col-xs-12" id="warraty_tab">@productWarranty</div> } <div>Test: @Pageview.Area.Item["ProductDownloads"] | @downloadsFilter</div> @RenderItemList(new { ItemType = "ProductDownloads", ListSourceType = "Page", ListSourcePage = Pageview.Area.Item["ProductDownloads"], ItemFieldsList = "*", ListTemplate = "ItemPublisher/List/ProductDownloads.cshtml", ListPageSize = 99, IncludeParagraphItems = true, Filter = downloadsFilter }) @if (loopDetails.Any()) { <div class="col-xs-12" id="productDdownloads_tab"> <ul> @foreach (LoopItem detail in loopDetails) { string file = detail.GetString("Ecom:Product:Detail.Image.Clean"); int lastIndexOfTemp = file.LastIndexOf("."); string metafield = "title", fileTitle = file.Substring(file.LastIndexOf('/') + 1).Replace("-", " ").Replace("_", " "), substringFile = file.Substring((lastIndexOfTemp + 1), (file.Length - lastIndexOfTemp - 1)), icon = iconFiles.ContainsKey(substringFile) ? iconFiles[substringFile] : "fa-file-pdf-o", extension = file.Substring((file.LastIndexOf(".") + 1)); if (fileTitle.Contains(".")) { fileTitle = fileTitle.Substring(0, fileTitle.LastIndexOf(".")); } <li> <a class="downloadFile" href="@file"> <i class='fa @icon'></i> @fileTitle <b> @Translate("download", "Download") </b> <span> @extension </span> </a> </li> } </ul> </div> } </div> } </article> <section id="commentOpinioesVerificadasProduto" class="container"> <div class="NETREVIEWS_PRODUCT_REVIEWS" data-product-id="@productId"></div> </section> @if (loopRelatedGroups.Any()) { foreach (LoopItem relGroup in loopRelatedGroups) { List<LoopItem> loopRelProds = relGroup.GetLoop("Products"); if (loopRelProds.Any()) { <div class="mainProducts col-xs-12 noPadding"> <div class="mainProdTitle"> <h2> @Translate("relatedProducts", "Produtos Relacionados") </h2> @if (loopRelProds.Any()) { <div class="pull-right"> <span class="prev-item"> &nbsp; </span> <span class="next-item"> &nbsp; </span> </div> } </div> <ul> @foreach (LoopItem prod in loopRelProds.Take(8)) { string stickerClass = prod.GetBoolean("Ecom:Product:Field.New.Value.Clean") ? "newProd" : "", name = prod.GetString("Ecom:Product.Name"), relProdID = prod.GetString("Ecom:Product.ID"), relVariantDefaultId = prod.GetString("Ecom:Product.DefaultVariantComboID"), relVariantCurrentId = prod.GetString("Ecom:Product.VariantID"), relVariantId = (!string.IsNullOrEmpty(relVariantCurrentId)) ? relVariantCurrentId : relVariantDefaultId, relImagePattern = String.Format("{0}{1}{2}.jpg", imagesFolder, relProdID, !String.IsNullOrWhiteSpace(relVariantId) ? "-" + relVariantId.Replace(".", "_") : ""), relImage = GetImagePathUrl( prod.GetString("Ecom:Product.ImageLarge.Default.Clean"), prod.GetString("Ecom:Product.ImageMedium.Default.Clean"), prod.GetString("Ecom:Product.ImageSmall.Default.Clean"), relImagePattern), relProductGetImage = GetImage(relImage, 220, 220, 220, 220, 220, 220, "jpg", 0, 5), relImagePatternSearch = String.Format("{0}{1}-*", relProdID, !String.IsNullOrWhiteSpace(relVariantId) ? "-" : ""), relImagePatternSearch_2 = String.Format("{0}{1}.*", relProdID, !String.IsNullOrWhiteSpace(relVariantId) ? "-" : ""), priceOld = prod.GetString("Ecom:Product.Discount.Price.PriceWithVATFormatted").Replace(" €", "€"), id = detailID + "&ProductID=" + relProdID, priceWithDiscount = prod.GetString("Ecom:Product.ActualPriceWithVAT").Replace(" €", "€"); /* Added - Tiago S. - Check the directory for an image, if none is defined with the previous manners. */ if (!System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath(relImage))) { IEnumerable<string> relImageFiles = Directory.GetFiles(folderPath, relImagePatternSearch).Where(f => !f.Contains("home") && !f.Contains("small") && !f.Contains("large") && !f.Contains("medium") && !f.Contains("thickbox")) .Concat(Directory.GetFiles(folderPath, relImagePatternSearch_2).Where(f => !f.Contains("home") && !f.Contains("small") && !f.Contains("large") && !f.Contains("medium") && !f.Contains("thickbox"))); if (relImageFiles.Any()) { string relImageFile = relImageFiles.First(); relProductGetImage = GetImage( imagesFolder + relImageFile.Substring((relImageFile.LastIndexOf(@"\") + 1), (relImageFile.Length - relImageFile.LastIndexOf(@"\") - 1)) , 220, 220, 220, 220, 220, 220, "jpg", 0, 5); } } bool discountExists = prod.GetBoolean("Ecom:Product.Discount.TotalAmount.IsZero"); /* Removed - Tiago S. - Not necessary. */ /*relImage = GetImageFile(imagesFolder, relImage, relProdID, "large");*/ <!--<li class="col-xs-2 col-sm-3 col-md-4 ">--> <li class="col-xs-6 col-sm-4"> <div> @if (!String.IsNullOrEmpty(stickerClass)) { <b class="light"> <span> @Translate("novelty", "Novidade") </span> </b> } else if (!discountExists) { <b class="dark"> <span> @Translate("promotion", "Promoção") </span> </b> } <figure> <a href="@id"> <img src="@relProductGetImage" alt="@name" title="@name" /> </a> </figure> <div> <h3> @name </h3> @if (!discountExists) { <span> @priceWithDiscount </span> } <strong> @priceOld </strong> </div> <a href="@id"> @Translate("seeMore", "Ver Mais") </a> </div> </li> } </ul> </div> } } } </div> @{ string scheme = Pageview.GlobalTags.GetTagByName("Global:Request.Scheme").Value.ToString(), host = Pageview.GlobalTags.GetTagByName("Global:Request.Host").Value.ToString(), url = Pageview.GlobalTags.GetTagByName("Global:Pageview.Url").Value.ToString(); string ogDescription = !string.IsNullOrEmpty(productMetaDescription) ? productMetaDescription : productIntro; } @SnippetStart("OGMeta") <meta property="og:title" content='@productName' /> <meta property="og:image" content='@(scheme)://@(host + (imagesList.Any() ? imagesList[0]["image"] : "" ))' /> <meta property="og:site_name" content='@areaItem["CompanyName"]' /> <meta property="og:url" content='@(scheme)://@(host + url)' /> <meta property="og:description" content='@StripHtml(ogDescription)' /> <meta property="og:type" content="article" /> <meta property="og:locale" content='@Pageview.GlobalTags.GetTagByName("Global:Area.LongLang").Value.ToString().Replace("-", "_")' /> @SnippetEnd("OGMeta") @SnippetStart("jsOnLoad") onLoadProductDetail({obj_product:@productJSON}); console.log(@productJSON) @SnippetEnd("jsOnLoad") @functions { public static string StripHtml(string source) { return Regex.Replace(source, "<.*?>", string.Empty); } }