Browse - Product Detail Page

Build a product detail page which will delight customers using the server-side APIs. Learn how to display language specific content via dynamic properties. As a bonus, we will dive into the client-side APIs as well.

 


Relevant APIs

 

 

UCommerce.Runtime
SiteContext.Current.CatalogContext
CurrentProduct
CurrentCatalog
UCommerce.Api
CatalogLibrary.CalculatePrice(Product, Catalog)
CatalogLibrary.GetRelatedProducts(productId, relationType)

UCommerce.Extensions
DynamicEntityExtensions.DynamicProperty() ProductExtensions.DisplayName()
ProductExtensions.Description()

Hands-on

Find the file “Product.aspx.cs”. The method “Page_Load” loads data that will be binded to the page Product.aspx. Populate the ProductModel with data from Ucommerce. Map “CurrentProduct” from the CatalogLibrary to the ProductModel with:

  • Name
  • Description
  • Sku
  • VariantSku
  • LongDescription
  • Variants
  • PriceCalculation

Bonus

Display product images using Kentico APIs (as earlier, remember to use ImageService). Explore related products on CatalogLibrary using the following line of
code:

CatalogLibrary.GetRelatedProducts(productId).SelectMany(x =>x.Value)
{{lineitem.ProductName}}

{{lineitem.VariantName}} - {{lineitem.Quantity}} x {{lineitem.FormattedPrice}} {{lineitem.FormattedPrice}}

Your cart is empty ;(
Total {{basket.FormattedProductsTotal}}
Checkout