/
ProductTemplate.Simple.cshtml
157 lines (150 loc) · 9.48 KB
/
ProductTemplate.Simple.cshtml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
@model ProductDetailsModel
@using Nop.Core.Domain.Seo;
@inject Nop.Core.IWebHelper webHelper
@inject SeoSettings seoSettings
@{
Layout = "_ColumnsOne";
//title
Html.AddTitleParts(!string.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);
//meta
Html.AddMetaDescriptionParts(Model.MetaDescription);
Html.AddMetaKeywordParts(Model.MetaKeywords);
//page class
Html.AppendPageCssClassParts("html-product-details-page");
//canonical URL
if (seoSettings.CanonicalUrlsEnabled)
{
var productUrl = Url.RouteUrl("Product", new { SeName = Model.SeName }, webHelper.CurrentRequestProtocol).ToLowerInvariant();
Html.AddCanonicalUrlParts(productUrl, seoSettings.QueryStringInCanonicalUrlsEnabled);
}
//open graph META tags
if (seoSettings.OpenGraphMetaTags)
{
Html.AddHeadCustomParts("<meta property=\"og:type\" content=\"product\" />");
Html.AddHeadCustomParts("<meta property=\"og:title\" content=\"" + Html.Encode(Model.Name) + "\" />");
Html.AddHeadCustomParts("<meta property=\"og:description\" content=\"" + Html.Encode(Nop.Core.Html.HtmlHelper.StripTags(Model.MetaDescription)) + "\" />");
Html.AddHeadCustomParts("<meta property=\"og:image\" content=\"" + Model.DefaultPictureModel.ImageUrl + "\" />");
Html.AddHeadCustomParts("<meta property=\"og:image:url\" content=\"" + Model.DefaultPictureModel.ImageUrl + "\" />");
Html.AddHeadCustomParts("<meta property=\"og:url\" content=\"" + webHelper.GetThisPageUrl(false) + "\" />");
Html.AddHeadCustomParts("<meta property=\"og:site_name\" content=\"" + Html.Encode(Model.CurrentStoreName) + "\" />");
}
//Twitter META tags
if (seoSettings.TwitterMetaTags)
{
Html.AddHeadCustomParts("<meta property=\"twitter:card\" content=\"summary\" />");
Html.AddHeadCustomParts("<meta property=\"twitter:site\" content=\"" + Html.Encode(Model.CurrentStoreName) + "\" />");
Html.AddHeadCustomParts("<meta property=\"twitter:title\" content=\"" + Html.Encode(Model.Name) + "\" />");
Html.AddHeadCustomParts("<meta property=\"twitter:description\" content=\"" + Html.Encode(Nop.Core.Html.HtmlHelper.StripTags(Model.MetaDescription)) + "\" />");
Html.AddHeadCustomParts("<meta property=\"twitter:image\" content=\"" + Model.DefaultPictureModel.ImageUrl + "\" />");
Html.AddHeadCustomParts("<meta property=\"twitter:url\" content=\"" + webHelper.GetThisPageUrl(false) + "\" />");
}
}
<!--product breadcrumb-->
@section Breadcrumb
{
@await Html.PartialAsync("_ProductBreadcrumb", Model.Breadcrumb)
}
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsAfterBreadcrumb, additionalData = Model })
<div class="page product-details-page">
<div class="page-body">
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsTop, additionalData = Model })
<form asp-route="Product" asp-route-sename="@Model.SeName" method="post" id="product-details-form">
@if (seoSettings.MicrodataEnabled)
{
@await Html.PartialAsync("_Microdata", Model)
}
<div data-productid="@Model.Id">
<div class="product-essential">
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsEssentialTop, additionalData = Model })
<!--product pictures-->
@await Html.PartialAsync("_ProductDetailsPictures", Model)
<div class="overview">
@await Html.PartialAsync("_Discontinued", Model)
<div class="product-name">
<h1>
@Model.Name
</h1>
</div>
@if (!string.IsNullOrEmpty(Model.ShortDescription))
{
<div class="short-description">
@Html.Raw(Model.ShortDescription)
</div>
}
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsOverviewTop, additionalData = Model })
<!--product reviews-->
@await Html.PartialAsync("_ProductReviewOverview", Model.ProductReviewOverview)
<!--manufacturers-->
@await Html.PartialAsync("_ProductManufacturers", Model.ProductManufacturers)
<!--availability-->
@await Html.PartialAsync("_Availability", Model)
<!--SKU, MAN, GTIN, vendor-->
@await Html.PartialAsync("_SKU_Man_GTIN_Ven", Model)
<!--delivery-->
@await Html.PartialAsync("_DeliveryInfo", Model)
<!--sample download-->
@await Html.PartialAsync("_DownloadSample", Model)
<!--attributes-->
@{
var dataDictAttributes = new ViewDataDictionary(ViewData);
dataDictAttributes.TemplateInfo.HtmlFieldPrefix = $"attributes_{Model.Id}";
@await Html.PartialAsync("_ProductAttributes", Model.ProductAttributes, dataDictAttributes)
}
<!--gift card-->
@{
var dataDictGiftCard = new ViewDataDictionary(ViewData);
dataDictGiftCard.TemplateInfo.HtmlFieldPrefix = $"giftcard_{Model.Id}";
@await Html.PartialAsync("_GiftCardInfo", Model.GiftCard, dataDictGiftCard)
}
<!--rental info-->
@{
var dataDictRental = new ViewDataDictionary(ViewData);
dataDictRental.TemplateInfo.HtmlFieldPrefix = $"rental_{Model.Id}";
@await Html.PartialAsync("_RentalInfo", Model, dataDictRental)
}
<!--price & add to cart & estimate shipping-->
@{
var dataDictPrice = new ViewDataDictionary(ViewData);
dataDictPrice.TemplateInfo.HtmlFieldPrefix = $"price_{Model.Id}";
@await Html.PartialAsync("_ProductPrice", Model.ProductPrice, dataDictPrice)
@await Html.PartialAsync("_ProductTierPrices", Model.TierPrices)
var dataDictAddToCart = new ViewDataDictionary(ViewData);
dataDictAddToCart.TemplateInfo.HtmlFieldPrefix = $"addtocart_{Model.Id}";
@await Html.PartialAsync("_AddToCart", Model.AddToCart, dataDictAddToCart)
@await Html.PartialAsync("_ProductEstimateShipping", Model.ProductEstimateShipping)
}
<!--wishlist, compare, email a friend-->
<div class="overview-buttons">
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsInsideOverviewButtonsBefore, additionalData = Model })
@{
var dataDictAddToWishlist = new ViewDataDictionary(ViewData);
dataDictAddToWishlist.TemplateInfo.HtmlFieldPrefix = $"addtocart_{Model.Id}";
@await Html.PartialAsync("_AddToWishlist", Model.AddToCart, dataDictAddToWishlist)
}
@await Html.PartialAsync("_CompareProductsButton", Model)
@await Html.PartialAsync("_ProductEmailAFriendButton", Model)
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsInsideOverviewButtonsAfter, additionalData = Model })
</div>
@await Html.PartialAsync("_ShareButton", Model)
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsOverviewBottom, additionalData = Model })
</div>
@if (!string.IsNullOrEmpty(Model.FullDescription))
{
<div class="full-description">
@Html.Raw(Model.FullDescription)
</div>
}
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsEssentialBottom, additionalData = Model })
</div>
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsBeforeCollateral, additionalData = Model })
<div class="product-collateral">
@await Html.PartialAsync("_ProductSpecifications", Model.ProductSpecifications)
@await Html.PartialAsync("_ProductTags", Model.ProductTags)
</div>
@await Component.InvokeAsync("ProductsAlsoPurchased", new { productId = Model.Id })
@await Component.InvokeAsync("RelatedProducts", new { productId = Model.Id })
</div>
</form>
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.ProductDetailsBottom, additionalData = Model })
</div>
</div>