CoolCMS API

CatalogExportDownloadTrait

Catalog export in the import format, shared by three entry points: the group action of the `ProductSet` and `Product` grids ({@see \App\UI\Admin\Eshop\Presenters\ProductSetPresenter}, {@see \App\UI\Admin\Eshop\Presenters\ProductPresenter}) and the form on {@see \App\UI\Admin\Eshop\Presenters\ProductImportPresenter} `show`. A trait because none of the three presenters owns the export; the dependency comes via `#[Inject]` (a trait cannot reach the presenter constructor).

The export is stateless (no job, no table; see ProductImportManager::export()): the file lies in privateDir and is streamed at once with CallbackResponse and readfile(), not with FileResponse, which the project does not use.

IMPORTANT: also called from GroupAction::setCallback(), where processGroupAction() calls $this->redirect('this') after the callback. sendResponse() throws AbortException before that line runs, so the download works without another signal. The error branch (flashMessage() and return) lets processGroupAction() finish its own redirect normally.

Table of Contents

Properties

$catalogExportManager  : ProductImportManager

Methods

sendCatalogExport()  : void
resolveCatalogExportPath()  : string|null
Builds the path the same way as the import (`ProductImportEditTrait::resolveImportPrivatePath()`), in a different subdirectory.

Properties

Methods

sendCatalogExport()

protected sendCatalogExport(array<int, int> $productIds, array<int, int> $productSetIds, array<int, string> $languages, bool $includeIds, array<int, string> $sections) : void
Parameters
$productIds : array<int, int>
$productSetIds : array<int, int>
$languages : array<int, string>
$includeIds : bool
$sections : array<int, string>

resolveCatalogExportPath()

Builds the path the same way as the import (`ProductImportEditTrait::resolveImportPrivatePath()`), in a different subdirectory.

private resolveCatalogExportPath(string $relative) : string|null
Parameters
$relative : string
Return values
string|null
On this page

Search results