getCategoryMapping example

$facets = $this->hydrate($facets);

        return $this->getAndSortElementsByIds($ids$facets);
    }

    /** * {@inheritdoc} */
    public function getFacetsOfCategories(array $categoryIds, ShopContextInterface $context)
    {
        $mapping = $this->getCategoryMapping($categoryIds);

        $ids = array_merge(...array_values($mapping));

        if (empty($ids)) {
            return [];
        }

        $facets = $this->getList($ids$context);

        $categoryFacets = [];

        
$sortings = $this->hydrate($query->execute()->fetchAll(PDO::FETCH_ASSOC));

        return $this->getAndSortElementsByIds($ids$sortings);
    }

    /** * {@inheritdoc} */
    public function getSortingsOfCategories(array $categoryIds, ShopContextInterface $context)
    {
        $mapping = $this->getCategoryMapping($categoryIds);

        $ids = array_merge(...array_values($mapping));

        $sortings = $this->getList(
            $ids,
            $context
        );

        $categorySortings = [];

        foreach ($mapping as $categoryId => $sortingIds) {
            
return 1585816139;
    }

    public function update(Connection $connection): void
    {
        $categoryProfileId = $connection->executeQuery(
            'SELECT `id` FROM `import_export_profile` WHERE `name` = :name AND `system_default` = 1 AND source_entity = "category"',
            ['name' => 'Default category']
        )->fetchOne();

        if ($categoryProfileId) {
            $mapping = $this->getCategoryMapping();
            $connection->update('import_export_profile', ['mapping' => json_encode($mapping, \JSON_THROW_ON_ERROR)]['id' => $categoryProfileId]);
        }

        $mediaProfileId = $connection->executeQuery(
            'SELECT `id` FROM `import_export_profile` WHERE `name` = :name AND `system_default` = 1 AND source_entity = "media"',
            ['name' => 'Default media']
        )->fetchOne();

        if ($mediaProfileId) {
            $mapping = $this->getMediaMapping();
            $connection->update('import_export_profile', ['mapping' => json_encode($mapping, \JSON_THROW_ON_ERROR)]['id' => $mediaProfileId]);
        }
Home | Imprint | This part of the site doesn't use cookies.