_tommadden
09/24/2024, 8:40 AMskttl
09/24/2024, 10:47 AM_tommadden
09/24/2024, 12:55 PMMike Chambers
09/24/2024, 2:09 PMMike Chambers
09/24/2024, 2:10 PM_tommadden
09/24/2024, 2:50 PMMike Chambers
09/24/2024, 2:55 PMMike Chambers
09/24/2024, 2:58 PM@removeTagHelper Microsoft.AspNetCore.Mvc.Razor.TagHelpers.OptionTagHelper, Microsoft.AspNetCore.Mvc.Razor
in your _ViewImports (I think you can have multiple _ViewImports so if you put in the umbracoCheckoutCommerce folder it will only apply to those views, incase something is using the option taghelpers elsewhere, you might then also have to include the imports from https://github.com/umbraco/Umbraco.Commerce.Checkout/blob/support/13.x/src/Umbraco.Commerce.Checkout/Views/UmbracoCommerceCheckout/_ViewImports.cshtml_tommadden
09/24/2024, 3:02 PMMike Chambers
09/24/2024, 3:05 PMselected=""
if you are passing null )
csharp
@foreach (var country in countries)
{
var selected = currentOrder.ShippingInfo.CountryId == country.Id ? "selected" : null;
<option value="@(country.Id)" selected="@selected" data-regions="@(JsonConvert.SerializeObject(UmbracoCommerceApi.Instance.GetRegions(country.StoreId, country.Id).Select(x => new {
id = x.Id,
name = x.Name
})))">
@(country.Name)
</option>
}
Mike Chambers
09/24/2024, 3:08 PMAspNetCoreGeneratedDocument
csharp
foreach (CountryReadOnly item in countries)
{
WriteLiteral(" <option");
BeginWriteAttribute("value", " value=\"", 5645, "\"", 5666, 1);
WriteAttributeValue("", 5653, item.Id, 5653, 13, isLiteral: false);
EndWriteAttribute();
WriteLiteral(" ");
Write(Html.Raw((currentOrder.PaymentInfo.CountryId == item.Id) ? "selected=\"selected\"" : ""));
WriteLiteral("\n data-regions=\"");
Write(JsonConvert.SerializeObject(from x in UmbracoCommerceApi.Instance.GetRegions(item.StoreId, item.Id)
select new
{
id = x.Id,
name = x.Name
}));
WriteLiteral("\">\n ");
Write(item.Name);
WriteLiteral("\n </option>\n");
}
_tommadden
09/24/2024, 3:15 PMNik
09/24/2024, 3:33 PM<option>
tag instead of the tag helver version you can do <!option>
instead just as an FYI (I really dislike that <option
is a tag helper!)_tommadden
09/24/2024, 6:44 PMMike Chambers
09/24/2024, 7:04 PM<!option />
is in the eyes of the frontend coder it doesn't look like a real tag, so tend to correct it without thinking š š„Mike Chambers
09/24/2024, 7:05 PM<body/>
is also another one that seems to create taghelper issues.Mike Chambers
09/24/2024, 7:20 PMselected
... š¤
if you were using the the selectTagHelper
..
<select asp-for="Person" asp-items="Model.People">
<option value="">Pick one</option>
</select>
but not sure how you'd add the data attributes required here. (or indeed if tag helpers translate into RCL libraries)