ProductWriteServiceInterface

Extends

Interface ProductWriteServiceInterface

category

System

package

Product

subpackage

Interfaces

Methods

Create Product

createProduct(\ProductInterface $product) : integer

Creates a new product and returns the ID of it.

Arguments

$product

\ProductInterface

The product to create.

Response

integer

The ID of the created product.

Delete Product

deleteProductById(\IdType $productId) : \ProductWriteServiceInterface

Deletes a specific product, depending on the provided product ID.

Arguments

$productId

\IdType

The product ID of the product to delete.

Response

\ProductWriteServiceInterface

Same instance for chained method calls.

Delete Product Image

deleteProductImage(\FilenameStringType $filename) : \ProductWriteServiceInterface

Deletes a product image.

Arguments

$filename

\FilenameStringType

The filename of the product image to delete.

Response

\ProductWriteServiceInterface

Same instance for chained method calls.

Duplicate Product

duplicateProduct(\IdType $productId, \IdType $targetCategoryId, \BoolType $duplicateAttributes, \BoolType $duplicateSpecials, \BoolType $duplicateCrossSelling) : integer

Duplicates a product to a category.

Arguments

$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?

Response

integer

Returns the ID of the new product.

Import Product Image File

importProductImageFile(\ExistingFile $sourceFile, \FilenameStringType $preferredFilename) : string

Imports an image for the product.

Arguments

$sourceFile

\ExistingFile

The existing file to import.

$preferredFilename

\FilenameStringType

The preferred filename.

Response

string

The new filename.

Link Product

linkProduct(\IdType $productId, \IdType $targetCategoryId) : \ProductWriteServiceInterface

Links a product to a category.

Arguments

$productId

\IdType

The product ID of the product to link.

$targetCategoryId

\IdType

The target category ID, of the category to be linked to.

Response

\ProductWriteServiceInterface

Same instance for chained method calls.

Processes an image for the front end.

processProductImage(\FilenameStringType $productImage) : \ProductWriteService

Arguments

$productImage

\FilenameStringType

Response

\ProductWriteService

Same instance for chained method calls.

Rename Product Image File

renameProductImage(\FilenameStringType $oldName, \FilenameStringType $newName) : \ProductWriteServiceInterface

Renames a product image file.

Arguments

$oldName

\FilenameStringType

The old name of the product image file.

$newName

\FilenameStringType

The new name of the product image file.

Response

\ProductWriteServiceInterface

Same instance for chained method calls.

Unlink a product.

unlinkProduct(\IdType $productId, \IdCollection $categoryIds) : \ProductWriteServiceInterface|$this

Deletes the product if all category links are removed.

Arguments

$productId

\IdType

Id of product to be unlinked.

$categoryIds

\IdCollection

Ids of categories to be unlinked.

Response

\ProductWriteServiceInterface|$this

Same instance for chained method calls.

Update Product

updateProduct(\StoredProductInterface $product, \stdClass $rawProduct) : \ProductWriteServiceInterface

Updates a stored product.

Arguments

$product

\StoredProductInterface

The product to update.

$rawProduct

\stdClass

Response

\ProductWriteServiceInterface

Same instance for chained method calls.