public
Last active

  • Download Gist
gistfile1.aspx
ASP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
var i = 0;
foreach (var dimType in ViewData.Model.SelectedProduct.DimensionTypes)
{
i++;
string ddlName = String.Format("ddlDimension_{0}", dimType.Key);
 
var dimensions = variations.Select(sv => sv.Dimensions.FirstOrDefault(d => d.TypeKey == dimType.Key));
var valueList = dimensions
.Select(d => new { Key = d.Key, ShortValue = d.ShortValue, IsInStock = variations.Any(sv => sv.Available && sv.Dimensions.Any(sd => sd.Key == d.Key)) })
.Distinct()
.OrderBy(d => DimensionSorter.GetSortOrder(d.Key))
.ToList();
if (valueList.Count > 0)
{
string selectedID = selectedDimensions.ContainsKey(dimType.Key) ? selectedDimensions[dimType.Key].ToString() : "";
string style = "";
if (dimType.Key == "SW" && !Model.SiteFeatureManager.IsFeatureEnabled(CatFootwear.Web.SiteFeature.ShowShoeWidth)) {
style = "display: none";
}
%>
<div class="RequiredDimension dimension <%= string.IsNullOrEmpty(style) ? "" : "heightadjustment" %> "
 
********** I WANT TO INSERT CLASS HERE ************
<&= i == 2 ? 'newclass' : '' %>
>
<span class="pdp-title DimName" id="<%= ddlName + "_ShortName" %>" style="<%= style %>"><%= Html.Encode(dimType.ShortName)%>:</span>
<input type="text" class="dimTextDisplay" id="<%= ddlName + "_Display" %>" readonly="readonly" value="" style="<%= style %>" />
<input type="hidden" class="dimType" value="<%= dimType.ShortName%>" />
<script type="text/javascript">
$('.dimType:last').after('<input type="hidden" class="dimID" name="<%= ddlName %>" id="<%= ddlName %>" />');
</script>
<ul style="<%= style %>">
<%
foreach (var item in valueList){%>
<li> <label title="<%=item.ShortValue%>" value="<%=item.Key %>" class="pdp-options <%=item.IsInStock?"valid":"outOfStock" %>" id="dimension_<%=item.Key%>">
<input name="<%= ddlName %>" type="radio" value="<%= item.Key %>" />
<%= item.ShortValue %>
</label></li>
<% } %>
<%
var firstVal = valueList != null && valueList.Count() > 0 ? valueList.First() : null;
if (potentiallyShowEuroSizingGrid) {
int LowestAcceptableEuroSize = 30;
// now check to see if the lowest value is 30 for euro dimensions. yes, using db sorting by string here to avoid casting all to int
int lowestDim;
if (firstVal != null && ((int.TryParse(firstVal.ShortValue, out lowestDim) && lowestDim > LowestAcceptableEuroSize) || "IY".Contains(Model.SelectedProduct.GenericSizeType.Key))) {
%>
<li><a href="<%= ResolveUrl(string.Format("~/Content/images/euro_sizes_{0}.gif", Model.SelectedProduct.GenericSizeType.Key)) %>" class="alt thickbox"><%= Html.ResolveTokenExpression("ProductDetail.Dimensions.SizeChart") %></a></li>
<% } } %>
</ul>
</div>
<% }
}%>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.