Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

_CheckoutAttributes.cshtml

@model ShoppingCartModel
@using System.Text
@using Nop.Core
@using Nop.Core.Domain.Catalog
@using Nop.Core.Domain.Media
@using Nop.Services.Media
@inject IDownloadService downloadService
@inject CatalogSettings catalogSettings

@if (Model.CheckoutAttributes.Count > 0)
{
    var attributeChangeScriptsBuilder = new StringBuilder();
    
@foreach (var attribute in Model.CheckoutAttributes) { var controlId = $"checkout_attribute_{attribute.Id}"; var textPrompt = !string.IsNullOrEmpty(attribute.TextPrompt) ? attribute.TextPrompt : attribute.Name;
@if (attribute.IsRequired) { * }
@switch (attribute.AttributeControlType) { case AttributeControlType.DropdownList: { attributeChangeScriptsBuilder.AppendFormat("$('#{0}').on('change', function(){{checkoutAttributeChange();}});\n", controlId); } break; case AttributeControlType.RadioList: {
    @foreach (var attributeValue in attribute.Values) { var attributeName = string.IsNullOrEmpty(attributeValue.PriceAdjustment) ? attributeValue.Name : T("ShoppingCart.CheckoutAttributes.PriceAdjustment", attributeValue.Name, attributeValue.PriceAdjustment).Text;
  • attributeChangeScriptsBuilder.AppendFormat("$('#{0}_{1}').on('click', function(){{checkoutAttributeChange();}});\n", controlId, attributeValue.Id); }
} break; case AttributeControlType.Checkboxes: case AttributeControlType.ReadonlyCheckboxes: {
    @foreach (var attributeValue in attribute.Values) { var attributeName = string.IsNullOrEmpty(attributeValue.PriceAdjustment) ? attributeValue.Name : T("ShoppingCart.CheckoutAttributes.PriceAdjustment", attributeValue.Name, attributeValue.PriceAdjustment).Text;
  • attributeChangeScriptsBuilder.AppendFormat("$('#{0}_{1}').on('click', function(){{checkoutAttributeChange();}});\n", controlId, attributeValue.Id); }
} break; case AttributeControlType.TextBox: { } break; case AttributeControlType.MultilineTextbox: { } break; case AttributeControlType.Datepicker: { } break; case AttributeControlType.FileUpload: { Download download = null; if (!string.IsNullOrEmpty(attribute.DefaultValue)) { download = await downloadService.GetDownloadByGuidAsync(new Guid(attribute.DefaultValue)); } @* register CSS and JS *@ //ex. ['jpg', 'jpeg', 'png', 'gif'] or [] var allowedFileExtensions = string.Join(", ", attribute.AllowedFileExtensions.Select(x => "'" + x.Trim() + "'").ToList()); if (download != null) { } else { } @*fine uploader container*@
@*fine uploader template (keep it synchronized to \Content\fineuploader\templates\default.html)*@ } break; case AttributeControlType.ColorSquares: {
    @foreach (var attributeValue in attribute.Values) { var attributeName = string.IsNullOrEmpty(attributeValue.PriceAdjustment) ? attributeValue.Name : T("ShoppingCart.CheckoutAttributes.PriceAdjustment", attributeValue.Name, attributeValue.PriceAdjustment).Text;
  • attributeChangeScriptsBuilder.AppendFormat("$('#{0}_{1}').on('click', function(){{checkoutAttributeChange();}});\n", controlId, attributeValue.Id); }
} break; case AttributeControlType.ImageSquares: { //not support attribute type } break; }
}
}