Calling Developers!
We are reenergizing our code contribution process! Learn More

What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Attribute-Cart-Based Catalog Personalization when I am trying to hit

Options
U01AZE27XGV
U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet

Attribute-Cart-Based Catalog Personalization when I am trying to hit http://yves.de.spryker.local/en/cameras-&-camcorders/digital-cameras getting fatal error, Yves exception

Comments

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    @UJN2JRU4F any inputs?

  • can you paste the the CatalogDependencyProvider as a snippet here?

  • looks like a missing import for the container class

  • your ide should tell you that it is unknown, does it not?

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    No it is not showing anything

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options
    <?php
    
    /**
     * This file is part of the Spryker Commerce OS.
     * For full license information, please view the LICENSE file that was distributed with this source code.
     */
    
    namespace Pyz\Client\Catalog;
    
    use Spryker\Client\Catalog\CatalogDependencyProvider as SprykerCatalogDependencyProvider;
    use Spryker\Client\Catalog\Plugin\ConfigTransferBuilder\AscendingNameSortConfigTransferBuilderPlugin;
    use Spryker\Client\Catalog\Plugin\ConfigTransferBuilder\CategoryFacetConfigTransferBuilderPlugin;
    use Spryker\Client\Catalog\Plugin\ConfigTransferBuilder\DescendingNameSortConfigTransferBuilderPlugin;
    use Spryker\Client\Catalog\Plugin\Elasticsearch\Query\ProductCatalogSearchQueryPlugin;
    use Spryker\Client\Catalog\Plugin\Elasticsearch\QueryExpander\PaginatedProductConcreteCatalogSearchQueryExpanderPlugin;
    use Spryker\Client\Catalog\Plugin\Elasticsearch\ResultFormatter\ProductConcreteCatalogSearchResultFormatterPlugin;
    use Spryker\Client\Catalog\Plugin\Elasticsearch\ResultFormatter\RawCatalogSearchResultFormatterPlugin;
    use Spryker\Client\CatalogPriceProductConnector\Plugin\ConfigTransferBuilder\AscendingPriceSortConfigTransferBuilderPlugin;
    use Spryker\Client\CatalogPriceProductConnector\Plugin\ConfigTransferBuilder\DescendingPriceSortConfigTransferBuilderPlugin;
    use Spryker\Client\CatalogPriceProductConnector\Plugin\ConfigTransferBuilder\PriceFacetConfigTransferBuilderPlugin;
    use Spryker\Client\CatalogPriceProductConnector\Plugin\CurrencyAwareCatalogSearchResultFormatterPlugin;
    use Spryker\Client\CatalogPriceProductConnector\Plugin\CurrencyAwareSuggestionByTypeResultFormatter;
    use Spryker\Client\CatalogPriceProductConnector\Plugin\ProductPriceQueryExpanderPlugin;
    use Spryker\Client\ProductLabelStorage\Plugin\ProductLabelFacetConfigTransferBuilderPlugin;
    use Spryker\Client\ProductListSearch\Plugin\Search\ProductListQueryExpanderPlugin;
    use Spryker\Client\ProductReview\Plugin\RatingFacetConfigTransferBuilderPlugin;
    use Spryker\Client\ProductReview\Plugin\RatingSortConfigTransferBuilderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\CompletionQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\FacetQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveInDateRangeQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\LocalizedQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\PaginatedQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SortedCategoryQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SortedQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SpellingSuggestionQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\StoreQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SuggestionByTypeQueryExpanderPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\CompletionResultFormatterPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\FacetResultFormatterPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\PaginatedResultFormatterPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SortedResultFormatterPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SpellingSuggestionResultFormatterPlugin;
    use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SuggestionByTypeResultFormatterPlugin;
    use Pyz\Client\Catalog\Plugin\Elasticsearch\QueryExpander\AttributeCartBasedBoostingQueryExpanderPlugin;
    
    class CatalogDependencyProvider extends SprykerCatalogDependencyProvider
    {
        const CLIENT_CART = 'CLIENT_CART';
        const CLIENT_PRODUCT_STORAGE = 'CLIENT_PRODUCT_STORAGE';
    
        /**
         * @param \Spryker\Client\Kernel\Container $container
         *
         * @return \Spryker\Client\Kernel\Container
         */
        public function provideServiceLayerDependencies(Container $container)
        {
            $container = parent::provideServiceLayerDependencies($container);
    
            $container = $this->addCartClient($container);
            $container = $this->addProductStorageClient($container);
    
            return $container;
        }
    
        /**
         * @param \Spryker\Client\Kernel\Container $container
         *
         * @return \Spryker\Client\Kernel\Container
         */
        protected function addProductStorageClient(Container $container)
        {
            $container[static::CLIENT_PRODUCT_STORAGE] = function (Container $container) {
                return $container->getLocator()->productStorage()->client();
            };
    
            return $container;
        }
    
    
    
        /**
         * @param \Spryker\Client\Kernel\Container $container
         *
         * @return \Spryker\Client\Kernel\Container
         */
        protected function addCartClient(Container $container)
        {
            $container[static::CLIENT_CART] = function (Container $container) {
                return $container->getLocator()->cart()->client();
            };
    
            return $container;
        }
        /**
         * @return \Spryker\Client\Catalog\Dependency\Plugin\FacetConfigTransferBuilderPluginInterface[]
         */
        protected function getFacetConfigTransferBuilderPlugins()
        {
            return [
                new CategoryFacetConfigTransferBuilderPlugin(),
                new PriceFacetConfigTransferBuilderPlugin(),
                new RatingFacetConfigTransferBuilderPlugin(),
                new ProductLabelFacetConfigTransferBuilderPlugin(),
            ];
        }
    
        /**
         * @return \Spryker\Client\Catalog\Dependency\Plugin\SortConfigTransferBuilderPluginInterface[]
         */
        protected function getSortConfigTransferBuilderPlugins()
        {
            return [
                new RatingSortConfigTransferBuilderPlugin(),
                new AscendingNameSortConfigTransferBuilderPlugin(),
                new DescendingNameSortConfigTransferBuilderPlugin(),
                new AscendingPriceSortConfigTransferBuilderPlugin(),
                new DescendingPriceSortConfigTransferBuilderPlugin(),
            ];
        }
    
        /**
         * @return \Spryker\Client\SearchExtension\Dependency\Plugin\QueryInterface
         */
        protected function createCatalogSearchQueryPlugin()
        {
            return new ProductCatalogSearchQueryPlugin();
        }
    
        /**
         * @return \Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface[]
         */
        protected function createCatalogSearchQueryExpanderPlugins()
        {
            return [
                new StoreQueryExpanderPlugin(),
                new LocalizedQueryExpanderPlugin(),
                new ProductPriceQueryExpanderPlugin(),
                new SortedQueryExpanderPlugin(),
    //            new SortedCategoryQueryExpanderPlugin(CategoryFacetConfigTransferBuilderPlugin::PARAMETER_NAME),
                new AttributeCartBasedBoostingQueryExpanderPlugin(),
                new PaginatedQueryExpanderPlugin(),
                new SpellingSuggestionQueryExpanderPlugin(),
                new IsActiveQueryExpanderPlugin(),
                new IsActiveInDateRangeQueryExpanderPlugin(),
    
                /**
                 * FacetQueryExpanderPlugin needs to be after other query expanders which filters down the results.
                 */
                new FacetQueryExpanderPlugin(),
            ];
        }
    
        /**
         * @return \Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface[]
         */
        protected function createCatalogSearchResultFormatterPlugins()
        {
            return [
                new FacetResultFormatterPlugin(),
                new SortedResultFormatterPlugin(),
                new PaginatedResultFormatterPlugin(),
                new CurrencyAwareCatalogSearchResultFormatterPlugin(
                    new RawCatalogSearchResultFormatterPlugin()
                ),
                new SpellingSuggestionResultFormatterPlugin(),
            ];
        }
    
        /**
         * @return \Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface[]
         */
        protected function createSuggestionQueryExpanderPlugins()
        {
            return [
                new StoreQueryExpanderPlugin(),
                new LocalizedQueryExpanderPlugin(),
                new CompletionQueryExpanderPlugin(),
                new SuggestionByTypeQueryExpanderPlugin(),
                new IsActiveQueryExpanderPlugin(),
                new IsActiveInDateRangeQueryExpanderPlugin(),
            ];
        }
    
        /**
         * @return \Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface[]
         */
        protected function createSuggestionResultFormatterPlugins()
        {
            return [
                new CompletionResultFormatterPlugin(),
                new CurrencyAwareSuggestionByTypeResultFormatter(
                    new SuggestionByTypeResultFormatterPlugin()
                ),
            ];
        }
    
        /**
         * @return \Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface[]
         */
        protected function createCatalogSearchCountQueryExpanderPlugins(): array
        {
            return [
                new StoreQueryExpanderPlugin(),
                new LocalizedQueryExpanderPlugin(),
                new IsActiveQueryExpanderPlugin(),
                new IsActiveInDateRangeQueryExpanderPlugin(),
            ];
        }
    
        /**
         * @return \Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface[]
         */
        protected function getProductConcreteCatalogSearchResultFormatterPlugins(): array
        {
            return [
                new ProductConcreteCatalogSearchResultFormatterPlugin(),
            ];
        }
    
        /**
         * @return \Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface[]
         */
        protected function getProductConcreteCatalogSearchQueryExpanderPlugins(): array
        {
            return [
                new LocalizedQueryExpanderPlugin(),
                new PaginatedProductConcreteCatalogSearchQueryExpanderPlugin(),
                new ProductListQueryExpanderPlugin(),
            ];
        }
    }
    
  • so there is no use statement for the container

  • my ide complains as expected:

  • please add the following to the top: use Spryker\Client\Kernel\Container;

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    It worked 🙂 Thank you

  • 👍