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.

5.0 KB
Raw Blame
@using System.Globalization
@model ProductDetailsModel.ProductPriceModel
@inject IContextAccessor contextAccessor

<div class="prices d-flex justify-content-center align-items-start row px-3 flex-column" itemprop="offers" itemscope itemtype="https://schema.org/Offer" data-offer-for="@Model.ProductId">
    @*availability belongs to the Offer, not the Product; product-attributes.js keeps it
      in step when the selected attributes change the stock*@
    @if (Model.Availability.HasValue)
    {
        <link itemprop="availability" href="@Model.Availability.ToSchemaOrgUrl()" id="[email protected]"/>
    }
    @if (Model.EnteredPrice)
    {
        @*Display empty space*@
    }
    else if (Model.CallForPrice)
    {
        <div class="product-price call-for-price col-12 px-0">
            <button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#modal-1">@Loc["Products.CallForPrice"]</button>
            <div class="modal fade" id="modal-1" tabindex="-1" aria-labelledby="modal-1-label" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="modal-1-label">@Loc["Products.CallForPrice"]</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <p class="my-4">
                    <span>@Loc["Products.CallForPrice"]:</span><a href="tel:@contextAccessor.StoreContext.CurrentStore.CompanyPhoneNumber"> @contextAccessor.StoreContext.CurrentStore.CompanyPhoneNumber</a>
                </p>
            </div>
        </div>
    </div>
</div>
        </div>
    }
    else
    {
        if (Model.IsReservation)
        {
            <div class="rental-price mb-2">
                <label class="mb-0">@Loc["Products.Price.ReservationPrice"]:</label>
                <span>@Model.ReservationPrice</span>
            </div>
        }

        if (Model.IsAuction)
        {
            <div class="actual-price">
                @if (Model.HighestBidValue > 0)
                {
                    <label class="mb-0">@Loc["Products.Price.CurrentPrice"]:</label>
                    <span>@Model.HighestBid</span>
                }
                else
                {
                    <label class="mb-0">@Loc["Products.Price.StartPrice"]:</label>
                    <span>@Model.StartPrice</span>
                }
            </div>
        }

        if (!string.IsNullOrWhiteSpace(Model.CatalogPrice))
        {
            <div class="catalog-product-price col-12 px-0 mb-2">
                <label class="col-form-label mb-0">@Loc["Products.Price.CatalogPrice"]:</label>
                <span class="h6 mb-0">@Model.CatalogPrice</span>
            </div>
        }

        if (!(Model.IsAuction && Model.DisableBuyButton))
        {
            <div class="@if (string.IsNullOrWhiteSpace(Model.PriceWithDiscount)) { <text>product-price col-12 px-0 d-inline-flex align-items-center</text> }else { <text>non-discounted-price col-12 px-0 d-flex align-items-center</text> }">
                <span class="price-value-@(Model.ProductId) @if (string.IsNullOrEmpty(Model.PriceWithDiscount)) { <text>actual-price</text> }">
                    <strong>@Html.Raw(Model.Price)</strong>
                    @if (!string.IsNullOrWhiteSpace(Model.PriceWithDiscount))
                    {
                        <div class="d-inline-flex align-items-center product-price discounted-price col-12 px-0">
                            <label class="mb-0 mx-2">@Loc["Products.Price.WithDiscount"]:</label>
                            <strong class="actual-price">@Html.Raw(Model.PriceWithDiscount)</strong>
                        </div>
                    }
                    <meta itemprop="price" content="@Model.PriceValue.ToString("0.00", CultureInfo.InvariantCulture)" class="your-price price-value-@(Model.ProductId)"/>
                </span>
                @if (!string.IsNullOrWhiteSpace(Model.OldPrice))
                {
                    <div class="old-product-price">
                        <span class="old-price mx-2">@Model.OldPrice</span>
                    </div>
                }

            </div>
        }
        else
        {
            @if (!string.IsNullOrWhiteSpace(Model.OldPrice))
            {
                <div class="old-product-price">
                    <span class="old-price mx-2">@Model.OldPrice</span>
                </div>
            }
        }

        if (!string.IsNullOrEmpty(Model.BasePricePAngV))
        {
            <div class="base-price-pangv ms-2">
                @Model.BasePricePAngV
            </div>
        }

        if (!string.IsNullOrEmpty(Model.CurrencyCode))
        {
            <meta itemprop="priceCurrency" content="@Model.CurrencyCode"/>
        }

        @if (string.IsNullOrWhiteSpace(Model.PriceWithDiscount))
        {
            <meta itemprop="price" content="@Model.PriceValue.ToString("0.00", CultureInfo.InvariantCulture)"/>
        }
    }
</div>