public function aroundGetData(CategoryDataProvider $dataProvider, \Closure $proceed)
    {
        $data = $proceed();

        $currentCategory = $dataProvider->getCurrentCategory();

        if ($currentCategory->getId() === null || $currentCategory->getLevel() < 2) {
            $data[$currentCategory->getId()]['use_default']['is_virtual_category'] = true;
        }

        if ($currentCategory->getLevel() >= 2 && !isset($data[$currentCategory->getId()]['virtual_category_root'])) {
            $data[$currentCategory->getId()]['virtual_category_root'] = $currentCategory->getPathIds()[1];
        }

        $data[$currentCategory->getId()]['use_default']['show_use_store_positions'] = true;
        if (!$currentCategory->getStoreId() || $currentCategory->getId() === null) {
            $data[$currentCategory->getId()]['use_default']['show_use_store_positions'] = false;
        }

        // To restore global/"All store views" positions/blacklist.
        $data[$currentCategory->getId()]['default']['sorted_products'] = [];
        $data[$currentCategory->getId()]['default']['blacklisted_products'] = [];
        if ($currentCategory->getStoreId()) {
            $globalCategory = clone $currentCategory;
            $globalCategory->setUseStorePositions(false);
            $data[$currentCategory->getId()]['default']['sorted_products'] = $this->getProductSavedPositions($globalCategory);
            $data[$currentCategory->getId()]['default']['blacklisted_products'] = $this->getBlacklistedProducts($globalCategory);
        }

        $data[$currentCategory->getId()]['sorted_products']         = $this->getProductSavedPositions($currentCategory);
        $data[$currentCategory->getId()]['blacklisted_products']    = $this->getBlacklistedProducts($currentCategory);
        $data[$currentCategory->getId()]['product_sorter_load_url'] = $this->getProductSorterLoadUrl($currentCategory);
        $data[$currentCategory->getId()]['price_format']            = $this->localeFormat->getPriceFormat();

        return $data;
    }
public function aroundGetData(CategoryDataProvider $dataProvider, \Closure $proceed)
    {
        $data = $proceed();

        $currentCategory = $dataProvider->getCurrentCategory();

        if ($currentCategory->getId() === null || $currentCategory->getLevel() < 2) {
            $data[$currentCategory->getId()]['use_default']['is_virtual_category'] = true;
        }

        if ($currentCategory->getLevel() >= 2 && !isset($data[$currentCategory->getId()]['virtual_category_root'])) {
            $data[$currentCategory->getId()]['virtual_category_root'] = $currentCategory->getPathIds()[1];
        }

        $data[$currentCategory->getId()]['use_default']['show_use_store_positions'] = true;
        if (!$currentCategory->getStoreId() || $currentCategory->getId() === null) {
            $data[$currentCategory->getId()]['use_default']['show_use_store_positions'] = false;
        }

        // To restore global/"All store views" positions/blacklist.
        $data[$currentCategory->getId()]['default']['sorted_products'] = [];
        $data[$currentCategory->getId()]['default']['blacklisted_products'] = [];
        if ($currentCategory->getStoreId()) {
            $globalCategory = clone $currentCategory;
            $globalCategory->setUseStorePositions(false);
            $data[$currentCategory->getId()]['default']['sorted_products'] = $this->getProductSavedPositions($globalCategory);
            $data[$currentCategory->getId()]['default']['blacklisted_products'] = $this->getBlacklistedProducts($globalCategory);
        }

        $data[$currentCategory->getId()]['sorted_products']         = $this->getProductSavedPositions($currentCategory);
        $data[$currentCategory->getId()]['blacklisted_products']    = $this->getBlacklistedProducts($currentCategory);
        $data[$currentCategory->getId()]['product_sorter_load_url'] = $this->getProductSorterLoadUrl($currentCategory);
        $data[$currentCategory->getId()]['price_format']            = $this->localeFormat->getPriceFormat();

        return $data;
    }
public function aroundGetData ( CategoryDataProvider $ dataProvider , \ Closure $ proceed ) { $ data = $ proceed ( ) ; $ currentCategory = $ dataProvider -> getCurrentCategory ( ) ; if ( $ currentCategory -> getId ( ) === null || $ currentCategory -> getLevel ( ) < 2 ) { $ data [ $ currentCategory -> getId ( ) ] [ 'use_default' ] [ 'is_virtual_category' ] = true ; } if ( $ currentCategory -> getLevel ( ) >= 2 && ! isset ( $ data [ $ currentCategory -> getId ( ) ] [ 'virtual_category_root' ] ) ) { $ data [ $ currentCategory -> getId ( ) ] [ 'virtual_category_root' ] = $ currentCategory -> getPathIds ( ) [ 1 ] ; } $ data [ $ currentCategory -> getId ( ) ] [ 'use_default' ] [ 'show_use_store_positions' ] = true ; if ( ! $ currentCategory -> getStoreId ( ) || $ currentCategory -> getId ( ) === null ) { $ data [ $ currentCategory -> getId ( ) ] [ 'use_default' ] [ 'show_use_store_positions' ] = false ; } // To restore global/"All store views" positions/blacklist. $ data [ $ currentCategory -> getId ( ) ] [ 'default' ] [ 'sorted_products' ] = [ ] ; $ data [ $ currentCategory -> getId ( ) ] [ 'default' ] [ 'blacklisted_products' ] = [ ] ; if ( $ currentCategory -> getStoreId ( ) ) { $ globalCategory = clone $ currentCategory ; $ globalCategory -> setUseStorePositions ( false ) ; $ data [ $ currentCategory -> getId ( ) ] [ 'default' ] [ 'sorted_products' ] = $ this -> getProductSavedPositions ( $ globalCategory ) ; $ data [ $ currentCategory -> getId ( ) ] [ 'default' ] [ 'blacklisted_products' ] = $ this -> getBlacklistedProducts ( $ globalCategory ) ; } $ data [ $ currentCategory -> getId ( ) ] [ 'sorted_products' ] = $ this -> getProductSavedPositions ( $ currentCategory ) ; $ data [ $ currentCategory -> getId ( ) ] [ 'blacklisted_products' ] = $ this -> getBlacklistedProducts ( $ currentCategory ) ; $ data [ $ currentCategory -> getId ( ) ] [ 'product_sorter_load_url' ] = $ this -> getProductSorterLoadUrl ( $ currentCategory ) ; $ data [ $ currentCategory -> getId ( ) ] [ 'price_format' ] = $ this -> localeFormat -> getPriceFormat ( ) ; return $ data ; }
Append virtual rule and sorting product data.

@param CategoryDataProvider $dataProvider Data provider.
@param \Closure             $proceed      Original method.

@return array
Append virtual rule and sorting product data .