Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Catalog Library

The catalog Library is a friendly way of allowing you to grab the information you need in order to display catalog items in your webshop. You can either ask for something explicitly or you can have it resolve the data on it's own by leaving the optional parameters alone.

The Catalog library can be accessed under the following namespace:

    using Ucommerce.Api;

To resolve it use the following method or constructor inject the interface directly in your controller or web API route (requires you manually bridge the IOC with the MVC framework):

    
    var catalogLibrary = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<Ucommerce.Api.ICatalogLibrary>();
    
    

Ucommerce.Api.ICatalogLibrary

Description

This interface is designed to provide catalog information. This includes categories, products and search indexes. It is meant for visitors only, and should only be used within an HttpContext.

Methods


GetCatalog

  • Description
    Gets the catalog in the current CatalogContext.
  • Arguments
    • Guid? catalogId = null: If catalogId is provided, it will look in the ProductCatalogIndex for the catalog with that specific Id
  • Return type Ucommerce.Search.Models.ProductCatalog

GetRootCategories

  • Description
    Gets the categories without a parent from the current CatalogContext.
  • Arguments
    • Guid? catalogId = null: If the catalog Id is passed in, it will return the root categories in the provided catalog
    • uint skip = 0: Skips over the first x values in the query result. Default: 0
    • uint take = 64: Takes x values from the query result. Default: 64
  • Return type Ucommerce.Search.ResultSet<Ucommerce.Search.Models.Category>

GetCategory

  • Description
    Gets the current category in the current CatalogContext.
  • Arguments
    • Guid? categoryId = null: If provided, will search for a specific category in the search index
  • Return type Ucommerce.Search.Models.Category

GetCategories

  • Description
    Gets categories based on the list of category guids passed.
  • Arguments
    • IList<Guid> categoryIds: Provide a list of guids to get categories from the search index
    • uint skip = 0: Skips over the first x values in the query result. Default: 0
    • uint take = 64: Takes x values from the query result. Default: 64
  • Return type Ucommerce.Search.ResultSet<Ucommerce.Search.Models.Category>

GetProducts

  • Description
    Gets products in the current category.
  • Arguments
    • Guid? categoryId = null: If provided, will search for products in the specific category in the search index
    • uint skip = 0: Skips over the first x values in the query result. Default: 0
    • uint take = 64: Takes x values from the query result. Default: 64
  • Return type Ucommerce.Search.ResultSet<Ucommerce.Search.Models.Product>

GetProduct

  • Description
    Gets either a product with no variants or a product family. Does not get variants.
  • Arguments
    • string sku: Product identifier
  • Return type Ucommerce.Search.Models.Product

CalculatePrices

  • Description
    Gives a list of prices for the products based on product and price group parameters.
  • Arguments
    • IList<Guid> productGuids: Provide a list of product ids to get their prices
    • IList<Guid> priceGroupGuids = null: If not provided, will default to the CurrentPriceGroup of CatalogContext
  • Return type Ucommerce.Catalog.Models.ProductPriceCalculationResult

ChangePriceGroup

  • Description
    Changes the current price group for the visitor. Price group is stored as a cookie.
  • Arguments
    • Guid priceGroupGuid: Provide the price group you want to change to
    • Boolean changeBasketBillingCurrency = True: Will change the currency on the basket by default. If the products do not have corresponding prices, they will be removed from basket
  • Return type Void

GetVariants

  • Description
    Gets variants of the product.
  • Arguments
    • Ucommerce.Search.Models.Product product: Product that provides the variants
  • Return type Ucommerce.Search.ResultSet<Ucommerce.Search.Models.Product>

GetProducts

  • Description
    Queries the product index based on categories and facets.
  • Arguments
    • IList<Guid> categoryIds: Categories that contain the products
    • Ucommerce.Search.Facets.FacetDictionary facets: Dictionary list of facets
    • uint skip = 0: Skips over the first x values in the query result. Default: 0
    • uint take = 64: Takes x values from the query result. Default: 64
  • Return type Ucommerce.Search.Facets.FacetResultSet<Ucommerce.Search.Models.Product>

GetProducts

  • Description
    Queries products based on a category and facets.
  • Arguments
    • Guid categoryId: Category that contains the products
    • Ucommerce.Search.Facets.FacetDictionary facets: Dictionary list of facets
    • uint skip = 0: Skips over the first x values in the query result. Default: 0
    • uint take = 64: Takes x values from the query result. Default: 64
  • Return type Ucommerce.Search.Facets.FacetResultSet<Ucommerce.Search.Models.Product>

GetFacets

  • Description
    Gets facets for products. For multi-category product lists, use the method overload that takes in a list of category ids.
  • Arguments
    • Guid categoryId: Category that contains the products
    • Ucommerce.Search.Facets.FacetDictionary facets: Dictionary list of facets
    • uint skip = 0: Skips over the first x values in the query result. Default: 0
    • uint take = 64: Takes x values from the query result. Default: 64
  • Return type IList<Ucommerce.Search.Facets.Facet>

GetFacets

  • Description
    Gets facets for products.
  • Arguments
    • IList<Guid> categoryIds: Categories that provides the products
    • Ucommerce.Search.Facets.FacetDictionary facets: Dictionary list of facets
    • uint skip = 0: Skips over the first x values in the query result. Default: 0
    • uint take = 64: Takes x values from the query result. Default: 64
  • Return type IList<Ucommerce.Search.Facets.Facet>