PrestaShop Developer Conference
PrestaShop Developer Conference
Paris, France - November 6, 2024
Let's talk code, commerce and open source.

Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page

Category domain

Category Commands

AddCategoryCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\AddCategoryCommand Class AddCategoryCommand adds new category.

Command details
Constructor parameters
  • $array $localizedNames
  • $array $localizedLinkRewrites
  • $bool $isActive
  • $int $parentCategoryId
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\AddCategoryHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\AddCategoryHandlerInterface
Return type void

AddRootCategoryCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\AddRootCategoryCommand Class AddRootCategoryCommand adds new root category.

Command details
Constructor parameters
  • $array $name
  • $array $linkRewrite
  • $bool $isActive
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\AddRootCategoryHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\AddRootCategoryHandlerInterface
Return type void

BulkDeleteCategoriesCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\BulkDeleteCategoriesCommand Class BulkDeleteCategoriesCommand.

Command details
Constructor parameters
  • $array $categoryIds
  • $string $deleteMode
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\BulkDeleteCategoriesHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\BulkDeleteCategoriesHandlerInterface
Return type void

BulkDisableCategoriesCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\BulkDisableCategoriesCommand Class DisableCategoriesCommand disables provided categories.

Command details
Constructor parameters
  • $array $categoryIds
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\BulkUpdateCategoriesStatusHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\BulkUpdateCategoriesStatusHandlerInterface
Return type void

DeleteCategoryCoverImageCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\DeleteCategoryCoverImageCommand Deletes cover image for given category.

Command details
Constructor parameters
  • $int $categoryId
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\DeleteCategoryCoverImageHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\DeleteCategoryCoverImageHandlerInterface
Return type void

DeleteCategoryCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\DeleteCategoryCommand Class DeleteCategoryCommand deletes provided category.

Command details
Constructor parameters
  • $int $categoryId
  • $string $mode
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\DeleteCategoryHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\DeleteCategoryHandlerInterface
Return type void

DeleteCategoryMenuThumbnailImageCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\DeleteCategoryMenuThumbnailImageCommand Deletes given menu thumbnail for category.

Command details
Constructor parameters
  • $int $categoryId
  • $int $menuThumbnailId
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\DeleteCategoryMenuThumbnailImageHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\DeleteCategoryMenuThumbnailImageHandlerInterface
Return type void

EditCategoryCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\EditCategoryCommand Class EditCategoryCommand edits given category.

Command details
Constructor parameters
  • $int $categoryId
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\EditCategoryHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\EditCategoryHandlerInterface
Return type void

EditRootCategoryCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\EditRootCategoryCommand Class EditRootCategoryCommand edits given root category. This command is actually handling the Home category edition, as the actual "root" category doesn't exist from UX perspective

Command details
Constructor parameters
  • $int $categoryId
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\EditRootCategoryHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\EditRootCategoryHandlerInterface
Return type void

SetCategoryIsEnabledCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\SetCategoryIsEnabledCommand Class ToggleCategoryStatusCommand toggles given category status.

Command details
Constructor parameters
  • $int $categoryId
  • $bool $isEnabled
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\SetCategoryIsEnabledHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\SetCategoryIsEnabledHandlerInterface
Return type void

UpdateCategoryPositionCommand

PrestaShop\PrestaShop\Core\Domain\Category\Command\UpdateCategoryPositionCommand Updates category position

Command details
Constructor parameters
  • $int $categoryId
  • $int $parentCategoryId
  • $int $way
  • $array $positions
  • $bool $foundFirst
Handler class PrestaShop\PrestaShop\Adapter\Category\CommandHandler\UpdateCategoryPositionHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\CommandHandler\UpdateCategoryPositionHandlerInterface
Return type void

Category Queries

GetCategoriesTree

PrestaShop\PrestaShop\Core\Domain\Category\Query\GetCategoriesTree Provides Category tree list where each category holds its child categories

Query details
Constructor parameters
  • $int $languageId
  • $int $shopId
Handler class PrestaShop\PrestaShop\Adapter\Category\QueryHandler\GetCategoriesTreeHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\QueryHandler\GetCategoriesTreeHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Category\QueryResult\CategoryForTree[]

GetCategoryForEditing

PrestaShop\PrestaShop\Core\Domain\Category\Query\GetCategoryForEditing Class GetCategoryForEditing retrieves category data for editing.

Query details
Constructor parameters
  • $int $categoryId
Handler class PrestaShop\PrestaShop\Adapter\Category\QueryHandler\GetCategoryForEditingHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\QueryHandler\GetCategoryForEditingHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Category\QueryResult\EditableCategory

GetCategoryIsEnabled

PrestaShop\PrestaShop\Core\Domain\Category\Query\GetCategoryIsEnabled Get current status (enabled/disabled) for given category.

Query details
Constructor parameters
  • $int $categoryId
Handler class PrestaShop\PrestaShop\Adapter\Category\QueryHandler\GetCategoryIsEnabledHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Category\QueryHandler\GetCategoryIsEnabledHandlerInterface
Return type bool