ProductWriteServiceInterface
in
Interface ProductWriteServiceInterface
Tags
Table of Contents
- changeProductLink() : ProductWriteServiceInterface
- Changes the category link of a product.
- createProduct() : int
- Create Product
- deleteProductById() : ProductWriteServiceInterface
- Delete Product
- deleteProductImage() : ProductWriteServiceInterface
- Delete Product Image
- deleteProductLink() : ProductWriteServiceInterface
- Removes a category link from a product by the given product id.
- deleteProductLinks() : ProductWriteServiceInterface
- Removes all category links from a product by given product ID.
- duplicateProduct() : int
- Duplicate Product
- importProductImageFile() : string
- Import Product Image File
- linkProduct() : ProductWriteServiceInterface
- Link Product
- processProductImage() : ProductWriteService
- Processes an image for the front end.
- renameProductImage() : ProductWriteServiceInterface
- Rename Product Image File
- unlinkProduct() : ProductWriteServiceInterface|$this
- Unlink a product.
- updateProduct() : ProductWriteServiceInterface
- Update Product
Methods
changeProductLink()
Changes the category link of a product.
public
changeProductLink(IdType $productId, IdType $currentCategoryId, IdType $newCategoryId) : ProductWriteServiceInterface
Parameters
- $productId : IdType
-
The product ID of the product to move.
- $currentCategoryId : IdType
-
Old category ID of the product.
- $newCategoryId : IdType
-
New category ID of the product.
Return values
ProductWriteServiceInterface —Same instance for chained method calls.
createProduct()
Create Product
public
createProduct(ProductInterface $product) : int
Creates a new product and returns the ID of it.
Parameters
- $product : ProductInterface
-
The product to create.
Return values
int —The ID of the created product.
deleteProductById()
Delete Product
public
deleteProductById(IdType $productId) : ProductWriteServiceInterface
Deletes a specific product, depending on the provided product ID.
Parameters
- $productId : IdType
-
The product ID of the product to delete.
Return values
ProductWriteServiceInterface —Same instance for chained method calls.
deleteProductImage()
Delete Product Image
public
deleteProductImage(FilenameStringType $filename) : ProductWriteServiceInterface
Deletes a product image.
Parameters
- $filename : FilenameStringType
-
The filename of the product image to delete.
Return values
ProductWriteServiceInterface —Same instance for chained method calls.
deleteProductLink()
Removes a category link from a product by the given product id.
public
deleteProductLink(IdType $productId, IdType $categoryId) : ProductWriteServiceInterface
Parameters
- $productId : IdType
-
Id of the product.
- $categoryId : IdType
-
Id of category from where the product is link is to delete.
Return values
ProductWriteServiceInterface —Same instance for chained method calls.
deleteProductLinks()
Removes all category links from a product by given product ID.
public
deleteProductLinks(IdType $productId) : ProductWriteServiceInterface
Parameters
- $productId : IdType
-
ID of product.
Return values
ProductWriteServiceInterface —Same instance for chained method calls.
duplicateProduct()
Duplicate Product
public
duplicateProduct(IdType $productId, IdType $targetCategoryId, BoolType $duplicateAttributes, BoolType $duplicateSpecials, BoolType $duplicateCrossSelling) : int
Duplicates a product to a category.
Parameters
- $productId : IdType
-
The product ID of the product to duplicate.
- $targetCategoryId : IdType
-
The target category ID of the product to be duplicated to.s
- $duplicateAttributes : BoolType
-
Should the attributes be duplicated also?
- $duplicateSpecials : BoolType
-
Should the specials be duplicated also?
- $duplicateCrossSelling : BoolType
-
Should cross selling be duplicated also?
Return values
int —Returns the ID of the new product.
importProductImageFile()
Import Product Image File
public
importProductImageFile(ExistingFile $sourceFile, FilenameStringType $preferredFilename) : string
Imports an image for the product.
Parameters
- $sourceFile : ExistingFile
-
The existing file to import.
- $preferredFilename : FilenameStringType
-
The preferred filename.
Return values
string —The new filename.
linkProduct()
Link Product
public
linkProduct(IdType $productId, IdType $targetCategoryId) : ProductWriteServiceInterface
Links a product to a category.
Parameters
- $productId : IdType
-
The product ID of the product to link.
- $targetCategoryId : IdType
-
The target category ID, of the category to be linked to.
Return values
ProductWriteServiceInterface —Same instance for chained method calls.
processProductImage()
Processes an image for the front end.
public
processProductImage(FilenameStringType $productImage) : ProductWriteService
Parameters
- $productImage : FilenameStringType
Return values
ProductWriteService —Same instance for chained method calls.
renameProductImage()
Rename Product Image File
public
renameProductImage(FilenameStringType $oldName, FilenameStringType $newName) : ProductWriteServiceInterface
Renames a product image file.
Parameters
- $oldName : FilenameStringType
-
The old name of the product image file.
- $newName : FilenameStringType
-
The new name of the product image file.
Return values
ProductWriteServiceInterface —Same instance for chained method calls.
unlinkProduct()
Unlink a product.
public
unlinkProduct(IdType $productId, IdCollection $categoryIds) : ProductWriteServiceInterface|$this
Deletes the product if all category links are removed.
Parameters
- $productId : IdType
-
Id of product to be unlinked.
- $categoryIds : IdCollection
-
Ids of categories to be unlinked.
Return values
ProductWriteServiceInterface|$this —Same instance for chained method calls.
updateProduct()
Update Product
public
updateProduct(StoredProductInterface $product, stdClass $rawProduct) : ProductWriteServiceInterface
Updates a stored product.
Parameters
- $product : StoredProductInterface
-
The product to update.
- $rawProduct : stdClass
Return values
ProductWriteServiceInterface —Same instance for chained method calls.