ProductReadService
in package
implements
ProductReadServiceInterface
Class ProductReadService
Tags
Interfaces, Classes and Traits
- ProductReadServiceInterface
- Interface ProductReadServiceInterface
Table of Contents
- $listProviderFactory : ProductListProviderFactoryInterface
- $productLinker : ProductCategoryLinkerInterface
- The product category linker.
- $productRepo : ProductRepositoryInterface
- $urlRewriteStorage : UrlRewriteStorage
- The url rewrite storage.
- __construct() : mixed
- ProductReadService constructor.
- findRewriteUrl() : null|UrlRewrite
- Returns a single UrlRewrite instance for the provided content ID and language ID or NULL if no entry was found.
- findUrlRewritesByRewriteUrl() : UrlRewriteCollection
- Returns an UrlRewriteCollection with UrlRewrite instances for the provided rewrite url.
- getActiveProductList() : ProductListItemCollection
- Get Active Product List
- getPagedList() : ProductListItemCollection
- Returns a paged product list.
- getProductById() : StoredProductInterface
- Get Product by ID
- getProductLinks() : IdCollection
- Returns the category Ids which are linked with given product id.
- getProductList() : ProductListItemCollection
- Get Product List
- getProductsCount() : int
- Returns the count of all product entries.
- getRewriteUrls() : UrlRewriteCollection
- Returns an UrlRewriteCollection with UrlRewrite instances for the provided content ID.
- searchProducts() : ProductListItemCollection
- Filters products records by a given ProductSearchCondition object and returns an array with results.
- searchProductsCount() : IntType
- Count the total of filtered products.
Properties
$listProviderFactory
protected
ProductListProviderFactoryInterface
$listProviderFactory
$productLinker
The product category linker.
protected
ProductCategoryLinkerInterface
$productLinker
$productRepo
protected
ProductRepositoryInterface
$productRepo
$urlRewriteStorage
The url rewrite storage.
protected
UrlRewriteStorage
$urlRewriteStorage
Methods
__construct()
ProductReadService constructor.
public
__construct(ProductRepositoryInterface $productRepo, ProductListProviderFactoryInterface $listProviderFactory, ProductCategoryLinkerInterface $productLinker, UrlRewriteStorage $urlRewriteStorage) : mixed
Parameters
- $productRepo : ProductRepositoryInterface
- $listProviderFactory : ProductListProviderFactoryInterface
- $productLinker : ProductCategoryLinkerInterface
- $urlRewriteStorage : UrlRewriteStorage
Return values
mixed —findRewriteUrl()
Returns a single UrlRewrite instance for the provided content ID and language ID or NULL if no entry was found.
public
findRewriteUrl(IdType $productId, IdType $languageId) : null|UrlRewrite
Parameters
Return values
null|UrlRewrite —findUrlRewritesByRewriteUrl()
Returns an UrlRewriteCollection with UrlRewrite instances for the provided rewrite url.
public
findUrlRewritesByRewriteUrl(NonEmptyStringType $rewriteUrl) : UrlRewriteCollection
Parameters
- $rewriteUrl : NonEmptyStringType
Return values
UrlRewriteCollection —getActiveProductList()
Get Active Product List
public
getActiveProductList(LanguageCode $languageCode[, IdType|null $categoryId = null ][, IdType|null $customerStatusLimit = null ]) : ProductListItemCollection
Returns an active products list.
Parameters
- $languageCode : LanguageCode
-
The language code.
- $categoryId : IdType|null = null
-
The category ID of the product list.
- $customerStatusLimit : IdType|null = null
-
The customers status limit.
Return values
ProductListItemCollection —getPagedList()
Returns a paged product list.
public
getPagedList(LanguageCode $languageCode[, Pager|null $pager = null ][, array<string|int, mixed> $sorters = [] ]) : ProductListItemCollection
Parameters
- $languageCode : LanguageCode
-
Language of location specific data.
- $pager : Pager|null = null
-
(Optional) Pager object with pagination information
- $sorters : array<string|int, mixed> = []
-
(Optional) array of Sorter objects with data sorting information
Return values
ProductListItemCollection —getProductById()
Get Product by ID
public
getProductById(IdType $productId) : StoredProductInterface
Returns a specific product, depending on the provided ID.
Parameters
- $productId : IdType
-
The ID of the product to return.
Return values
StoredProductInterface —The stored product.
getProductLinks()
Returns the category Ids which are linked with given product id.
public
getProductLinks(IdType $productId) : IdCollection
Parameters
- $productId : IdType
Return values
IdCollection —getProductList()
Get Product List
public
getProductList(LanguageCode $languageCode[, IdType|null $categoryId = null ][, IdType|null $customerStatusLimit = null ]) : ProductListItemCollection
Returns a specific product list.
Parameters
- $languageCode : LanguageCode
-
The language code.
- $categoryId : IdType|null = null
-
The category ID of the product list.
- $customerStatusLimit : IdType|null = null
-
The customers status limit.
Return values
ProductListItemCollection —getProductsCount()
Returns the count of all product entries.
public
getProductsCount() : int
Return values
int —getRewriteUrls()
Returns an UrlRewriteCollection with UrlRewrite instances for the provided content ID.
public
getRewriteUrls(IdType $productId) : UrlRewriteCollection
Parameters
- $productId : IdType
Return values
UrlRewriteCollection —searchProducts()
Filters products records by a given ProductSearchCondition object and returns an array with results.
public
searchProducts(LanguageCode $languageCode, ProductSearchCondition $condition[, Pager|null $pager = null ][, array<string|int, mixed> $sorters = [] ]) : ProductListItemCollection
Parameters
- $languageCode : LanguageCode
-
Language code which should be used for products descriptions etc.
- $condition : ProductSearchCondition
-
Conditions object for search.
- $pager : Pager|null = null
-
(Optional) Pager object with pagination information
- $sorters : array<string|int, mixed> = []
-
(Optional) array of Sorter objects with data sorting information
Return values
ProductListItemCollection —searchProductsCount()
Count the total of filtered products.
public
searchProductsCount(LanguageCode $languageCode, ProductSearchCondition $condition) : IntType
Parameters
- $languageCode : LanguageCode
-
Language code which should be used for products descriptions etc.
- $condition : ProductSearchCondition
-
Conditions object for search.