Overview
  • Package
  • Class
  • Tree
  • Todo

Packages

  • AddonValue
    • Interfaces
  • ApiV2Controllers
  • Category
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • Customer
    • Address
    • Country
    • CountryZone
    • Interfaces
    • Validation
    • ValueObjects
  • Email
    • Collections
    • Entities
    • Exceptions
    • Interfaces
    • Repository
    • ValueObjects
  • Http
    • Collections
    • Exceptions
    • Factories
    • Interfaces
    • ValueObjects
  • Loaders
    • CrossCuttingLoader
    • GXCoreLoader
    • Interfaces
  • None
  • Order
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
    • Storages
    • ValueObjects
  • Product
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • ProductModule
    • Collections
    • Deleter
    • Entities
    • Factories
    • Interface
    • Interfaces
    • Reader
    • Repositories
    • Writer
  • Shared
    • Exceptions
    • FileSystem
    • Interfaces
    • Storage
    • Types
  • Statistics
    • Interfaces
  • UserConfiguration
    • Interfaces
    • Repository

Classes

  • ProductObjectService
  • ProductReadService
  • ProductWriteService

Class ProductWriteService

Class ProductWriteService

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

Methods summary

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

ProductWriteService constructor.

ProductWriteService constructor.

Parameters

$productRepo
$productImageStorage
$productLinker
$envProductImagePathsSettings
$languageProvider
public integer
# createProduct( ProductInterface $product )

Create Product

Create Product

Creates a new product and returns the ID of it.

Parameters

$product
The product to create.

Returns

integer
The ID of the created product.

Throws

InvalidArgumentException
Through "linkProduct" method.

Implementation of

ProductWriteServiceInterface::createProduct()
public ProductWriteServiceInterface
# updateProduct( StoredProductInterface $product )

Update Product

Update Product

Updates a stored product.

Parameters

$product
The product to update.

Returns

ProductWriteServiceInterface
Same instance for chained method calls.

Implementation of

ProductWriteServiceInterface::updateProduct()
public ProductWriteServiceInterface
# deleteProductById( IdType $productId )

Delete Product

Delete Product

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

Parameters

$productId
The product ID of the product to delete.

Returns

ProductWriteServiceInterface
Same instance for chained method calls.

Implementation of

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

Duplicate Product

Duplicate Product

Duplicates a product to a category.

Parameters

$productId
The product ID of the product to duplicate.
$targetCategoryId
The target category ID of the product to be duplicated to.s
$duplicateAttributes
Should the attributes be duplicated also?
$duplicateSpecials
Should the specials be duplicated also?
$duplicateCrossSelling
Should cross selling be duplicated also?

Returns

integer
Returns the ID of the new product.

Throws

InvalidArgumentException
If "$newProductId" is not an integer.

Todo

Implement the last three arguments when finished in UML.

Implementation of

ProductWriteServiceInterface::duplicateProduct()
public ProductWriteService
# linkProduct( IdType $productId, IdType $targetCategoryId )

Link Product

Link Product

Links a product to a category.

Parameters

$productId
The product ID of the product to link.
$targetCategoryId
The target category ID, of the category to be linked to.

Returns

ProductWriteService
Same instance for chained method calls.

Implementation of

ProductWriteServiceInterface::linkProduct()
public ProductWriteService
# changeProductLink( IdType $productId, IdType $currentCategoryId, IdType $newCategoryId )

Changes the category link of a product.

Changes the category link of a product.

Parameters

$productId
The product ID of the product to move.
$currentCategoryId
Old category ID of the product.
$newCategoryId
New category ID of the product.

Returns

ProductWriteService
Same instance for chained method calls.

Implementation of

ProductWriteServiceInterface::changeProductLink()
public ProductWriteService
# deleteProductLink( IdType $productId, IdType $categoryId )

Removes a category link from a product by the given product id.

Removes a category link from a product by the given product id.

Parameters

$productId
Id of the product.
$categoryId
Id of category from where the product is link is to delete.

Returns

ProductWriteService
Same instance for chained method calls.

Implementation of

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

Import Product Image File

Import Product Image File

Imports an image for the product.

Parameters

$sourceFile
The existing file to import.
$preferredFilename
The preferred filename.

Returns

string
The new filename.

Throws

InvalidArgumentException
If the provided source file or the preferred filename is not valid.

Implementation of

ProductWriteServiceInterface::importProductImageFile()
public ProductWriteService
# renameProductImage( FilenameStringType $oldName, FilenameStringType $newName )

Rename Product Image File

Rename Product Image File

Renames a product image file.

Parameters

$oldName
The old name of the product image file.
$newName
The new name of the product image file.

Returns

ProductWriteService
Same instance for chained method calls.

Throws

InvalidArgumentException
If the provided old name or new name is not valid.

Implementation of

ProductWriteServiceInterface::renameProductImage()
public ProductWriteService
# deleteProductImage( FilenameStringType $filename )

Delete Product Image

Delete Product Image

Deletes a product image.

Parameters

$filename
The filename of the product image to delete.

Returns

ProductWriteService
Same instance for chained method calls.

Implementation of

ProductWriteServiceInterface::deleteProductImage()
public ProductWriteService
# deleteProductLinks( IdType $productId )

Removes all category links from a product by given product ID.

Removes all category links from a product by given product ID.

Parameters

$productId
ID of product.

Returns

ProductWriteService
Same instance for chained method calls.

Implementation of

ProductWriteServiceInterface::deleteProductLinks()
protected ProductImageInterface
# duplicateProductImage( ProductImageInterface $sourceProductImage )

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

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

Parameters

$sourceProductImage
The Product Image to duplicate.

Returns

ProductImageInterface
The duplicated Product Image.

Properties summary

protected ProductRepositoryInterface $productRepo

The product repository.

The product repository.

#
protected AbstractFileStorage $productImageStorage

The product image storage.

The product image storage.

#
protected ProductCategoryLinkerInterface $productLinker

The product category linker.

The product category linker.

#
protected ProductImagePathsSettingsInterface $envProductImagePathsSettings

EnvProductImagePathsSettings.

EnvProductImagePathsSettings.

#
protected LanguageProviderInterface $languageProvider

Used for fetching the language data.

Used for fetching the language data.

#
API documentation generated by ApiGen