Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

13.2 KB
Raw Blame
@model ProductDetailsModel
@inject SeoSettings seoSettings
@inject IPageHeadBuilder pagebuilder

@{
    Layout = "_SingleColumn";

    //title, meta
    pagebuilder.AddTitleParts(!string.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);
    pagebuilder.AddMetaDescriptionParts(Model.MetaDescription);
    pagebuilder.AddMetaKeywordParts(Model.MetaKeywords);

    //canonical URL
    if (seoSettings.CanonicalUrlsEnabled)
    {
        var productUrl = Url.RouteUrl("Product", new { Model.SeName }, Url.ActionContext.HttpContext.Request.Scheme);
        pagebuilder.AddCanonicalUrlParts(productUrl);
    }
}

@section meta {
    @if (seoSettings.OpenGraphMetaTags)
    {
        <meta property=og:type content=product/>
        <meta property="og:title" content="@Html.Encode(Model.Name)"/>
        <meta property="og:description" content="@Html.Encode(Model.MetaDescription)"/>
        <meta property="og:image" content="@Model.DefaultPictureModel.ImageUrl"/>
        <meta property="og:image:url" content="@Model.DefaultPictureModel.ImageUrl"/>
        <meta property="og:url" content="@Url.ActionContext.HttpContext.Request.GetEncodedUrl()"/>
        <meta property="og:site_name" content="@Html.Encode(Model.CurrentStoreName)"/>
    }

    @if (seoSettings.TwitterMetaTags)
    {
        <meta property="twitter:card" content="summary"/>
        <meta property="twitter:site" content="@Html.Encode(Model.CurrentStoreName)"/>
        <meta property="twitter:title" content="@Html.Encode(Model.Name)"/>
        <meta property="twitter:description" content="@Html.Encode(Model.MetaDescription)"/>
        <meta property="twitter:image" content="@Model.DefaultPictureModel.ImageUrl"/>
        <meta property="twitter:url" content="@Url.ActionContext.HttpContext.Request.GetEncodedUrl()"/>
    }

    @*Product JSON-LD - not gated on the Open Graph settings, which are about social
        previews; this is what search engines read for rich results*@
    <partial name="Partials/ProductStructuredData" model="Model"/>
}

<!--product breadcrumb-->

@section Breadcrumb
{
    <partial name="Partials/Breadcrumbs" model="Model.Breadcrumb"/>
}

<vc:widget widget-zone="productdetails_after_breadcrumb" additional-data="@Model.Id"></vc:widget>
<div class="page product-details-page product-standard" vue-island="productreviews productreviewsoverview">
    <vc:widget widget-zone="productdetails_top" additional-data="@Model.Id"></vc:widget>
    <validation-observer ref="ProductFormObserver">
        <form asp-route="Product" asp-route-sename="@Model.SeName" method="post" id=@($"product-details-form-{Model.Id}") ref="form" v-on:submit.prevent="formSubmitParam($event, vm.$refs.ProductFormObserver)">
            <div itemscope itemtype="https://schema.org/Product" data-productid="@Model.Id">
                <div class="container position-relative">
                    <div class="row">
                        <vc:widget widget-zone="productdetails_before_pictures" additional-data="@Model.Id"></vc:widget>
                        <!--product pictures-->
                        <partial name="Partials/Pictures" model="Model"/>
                        <vc:widget widget-zone="productdetails_after_pictures" additional-data="@Model.Id"></vc:widget>
                        <div class="col-xl-6 col-lg-6 col-md-7 col-12 overview ps-md-3 ps-0 pe-0">
                            @if (!string.IsNullOrEmpty(Model.Flag))
                            {
                                <div class="product-label">
                                    <div class="badge text-bg-info">@Model.Flag</div>
                                </div>
                            }
                            <partial name="Partials/Unavailable" model="Model"/>
                            <h1 class="generalTitle" itemprop="name">
                                @Model.Name
                            </h1>
                            <!--product reviews-->
                            @if (Model.ProductReviewOverview.AllowCustomerReviews)
                            {
                                <partial name="Partials/ProductReviewOverview" model="Model.ProductReviewOverview"/>
                            }
                            <vc:widget widget-zone="productdetails_overview_top" additional-data="@Model.Id"></vc:widget>
                            @if (!string.IsNullOrEmpty(Model.ShortDescription))
                            {
                                <div class="short-description generalMarginSupporter" v-pre>
                                    @Html.Raw(Model.ShortDescription)
                                </div>
                            }
                            <!--collections-->
                            @if (Model.ProductCollections.Any())
                            {
                                <partial name="Partials/Collections" model="Model.ProductCollections"/>
                            }
                            <!--availability-->
                            @if (!string.IsNullOrWhiteSpace(Model.StockAvailability) || Model.DisplayOutOfStockSubscription)
                            {
                                <partial name="Partials/Availability" model="Model"/>
                            }
                            <!--Code products - SKU, MAN, GTIN, Vendor info -->
                            <partial name="Partials/Codes" model="Model"/>
                            <!--delivery-->
                            @if ((Model.FreeShippingNotificationEnabled && Model.IsFreeShipping) || !string.IsNullOrWhiteSpace(Model.DeliveryDate)
                                                                                                 || Model.NotReturnable || Model.AdditionalShippingCharge > 0)
                            {
                                <partial name="Partials/DeliveryInfo" model="Model"/>
                            }
                            <!--sample download-->
                            @if (Model.HasSampleDownload)
                            {
                                <partial name="Partials/DownloadSample" model="Model"/>
                            }
                            <!--product bundles-->
                            @if (Model.ProductBundleModels.Any())
                            {
                                <partial name="Partials/ProductBundles" model="Model"/>
                            }
                            <!--attributes-->
                            @if (Model.ProductAttributes.Any())
                            {
                                <partial name="Partials/ProductAttributes" model="Model"/>
                            }
                            <!--warehouses-->
                            @if (Model.AllowToSelectWarehouse)
                            {
                                <partial name="Partials/Warehouses" model="Model"/>
                            }
                            <!--gift voucher-->
                            @if (Model.GiftVoucher.IsGiftVoucher)
                            {
                                <partial name="Partials/GiftVoucherInfo" model="Model"/>
                            }
                            <!--reservation info-->
                            @if (Model.ProductType == ProductType.Reservation)
                            {
                                <partial name="Partials/ReservationInfo" model="Model"/>
                            }
                            <!--price & add to cart-->
                            <div class="overview-buttons generalMarginSupporter">
                                @if (Model.TierPrices.Any())
                                {
                                    <div class="col-lg-12 px-0">
                                        <partial name="Partials/TierPrices" model="Model.TierPrices"/>
                                    </div>
                                }
                                <div class="col-lg-12 px-0">
                                    @{
                                        <partial name="Partials/Prices" model="Model.ProductPrice"/>
                                    }
                                </div>
                                <div class="generalMarginSupporter">
                                    <!--auction-->
                                    @if (Model.ProductType == ProductType.Auction)
                                    {
                                        <partial name="Partials/AuctionInfo" model="Model"/>
                                    }
                                    <partial name="Partials/AddToCart" model="Model.AddToCart"/>
                                    <div class="btn-group mt-2 mb-3 w-100">
                                        @if (Model.ProductType is ProductType.SimpleProduct or ProductType.BundledProduct)
                                        {
                                            <partial name="Partials/AddToWishlist" model="Model.AddToCart"/>
                                            <partial name="Partials/ProductsComparison" model="Model"/>
                                        }
                                        @if (Model.EmailAFriendEnabled)
                                        {
                                            <partial name="Partials/SendFriend" model="Model"/>
                                        }
                                    </div>
                                </div>
                            </div>
                            @if (!string.IsNullOrWhiteSpace(Model.PageShareCode))
                            {
                                <div class="col-12 product-share px-0">
                                    <partial name="Partials/ShareButton" model="Model"/>
                                </div>
                            }
                            <vc:widget widget-zone="productdetails_overview_bottom" additional-data="@Model.Id"></vc:widget>
                        </div>
                    </div>
                </div>

                <div class="col-12 px-0 my-3">
                    <div>
                        <gn-tabs content-class="mt-3" align="center">
                            <gn-tab title="@Loc["Products.Description"]" active="true">
                                @* v-pre: this content comes from the database and lands inside the #app template,
                                   so Vue would compile any {{ }} it contains - a stray brace in an editor's text
                                   threw at compile time and took the whole page down with it *@
                                <div v-pre>
                                    @Html.Raw(Model.FullDescription)
                                </div>
                            </gn-tab>
                            @if (Model.ProductTags.Any())
                            {
                                <gn-tab title="@Loc["Products.Tags"]">
                                    <partial name="Partials/ProductTags" model="Model.ProductTags"/>
                                </gn-tab>
                            }
                            @if (Model.ProductSpecifications.Any())
                            {
                                <gn-tab title="@Loc["Products.Specs"]">
                                    <partial name="Partials/ProductSpecifications" model="Model.ProductSpecifications"/>
                                </gn-tab>
                            }
                            @if (Model.ProductReviewOverview.AllowCustomerReviews)
                            {
                                <gn-tab id="review-tab" title="@Loc["Products.Reviews"]">
                                    @await Component.InvokeAsync("ProductReviews", new { productId = Model.Id })
                                </gn-tab>
                            }
                            @if (Model.AskQuestionOnProduct)
                            {
                                <gn-tab title="@Loc["Products.ContactUs"]"
                                        on-click="@(Model.ProductAskQuestion.DisplayCaptcha ? "askquestion.getCaptcha()" : null)">
                                    <partial name="Partials/AskQuestionOnProduct" model="Model.ProductAskQuestion"/>
                                </gn-tab>
                            }
                        </gn-tabs>
                    </div>
                </div>
                <vc:products-also-purchased product-id="@Model.Id" product-thumb-picture-size="null"></vc:products-also-purchased>
                <vc:related-products product-id="@Model.Id" product-thumb-picture-size="null"></vc:related-products>
                <vc:similar-products product-id="@Model.Id" product-thumb-picture-size="null"></vc:similar-products>
                <vc:recommended-products product-id="@Model.Id" product-thumb-picture-size="null"></vc:recommended-products>
                @if (Model.RenderCaptcha)
                {
                    <partial name="Partials/Captcha"/>
                }
            </div>
        </form>
    </validation-observer>
    @if (Model.EmailAFriendEnabled)
    {
        @await Component.InvokeAsync("ProductEmailAFriend", new { productId = Model.Id })
    }
    <vc:widget widget-zone="productdetails_bottom" additional-data="@Model.Id"></vc:widget>
</div>