Class ProductWriteService

Class ProductWriteService

ProductWriteService implements ProductWriteServiceInterface
Package: Product
Category: System
Located at Services/Core/Product/ProductWriteService.inc.php

Methods summary

public __construct( ProductRepositoryInterface $productRepo, AbstractFileStorage $productImageStorage, ProductCategoryLinkerInterface $productLinker, ProductImagePathsSettingsInterface $envProductImagePathsSettings, LanguageProviderInterface $languageProvider, UrlKeywordsRepairerInterface $urlKeywordsRepairer )

ProductWriteService constructor.

public createProduct( ProductInterface $product ) : integer

Create Product

public updateProduct( StoredProductInterface $product ) : ProductWriteServiceInterface

Update Product

public deleteProductById( IdType $productId ) : ProductWriteServiceInterface

Delete Product

public duplicateProduct( IdType $productId, IdType $targetCategoryId, BoolType $duplicateAttributes = null, BoolType $duplicateSpecials = null, BoolType $duplicateCrossSelling = null ) : integer

Duplicate Product

public linkProduct( IdType $productId, IdType $targetCategoryId ) : ProductWriteService

Link Product

public unlinkProduct( IdType $productId, IdCollection $categoryIds ) : ProductWriteServiceInterface|ProductWriteService

Unlink a product. Deletes the product if all category links are removed.

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

Import Product Image File

public renameProductImage( FilenameStringType $oldName, FilenameStringType $newName ) : ProductWriteService

Rename Product Image File

public deleteProductImage( FilenameStringType $filename ) : ProductWriteService

Delete Product Image

public processProductImage( FilenameStringType $productImage ) : ProductWriteService

Processes an image for the front end.

protected duplicateProductImage( ProductImageInterface $sourceProductImage ) : ProductImageInterface

Duplicates a given Product Image and set the properties accordingly to the provided Source Product Image

Properties summary

protected $productRepo : ProductRepositoryInterface

The product repository.


		
protected $productImageStorage : AbstractFileStorage

The product image storage.


		
protected $productLinker : ProductCategoryLinkerInterface

The product category linker.


		
protected $envProductImagePathsSettings : ProductImagePathsSettingsInterface

EnvProductImagePathsSettings.


		
protected $languageProvider : LanguageProviderInterface

Used for fetching the language data.


		
protected $urlKeywordsRepairer : UrlKeywordsRepairerInterface

Used for writing and repairing product's url keywords