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..

Hi, I have a question about the Bootcamp, section "Content & Search - Attribute Car Based Catalo

U01ALHKK517
U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi,
I have a question about the Bootcamp, section "Content & Search - Attribute Car Based Catalog Personalization - Challenge".
I created the CatalogFactory in Pyz\Client\Catalog with the getCartClient function. In the class "AttributeCartBasedBoostingQueryExpanderPlugin" I cannot access the getCartClient function.
The Spryker NS CatalogFactory is used here. did I forgot something?

Β«1

Comments

  • πŸ€”

  • let me have a quick look

  • did you try to run it?

  • on first look the problem appears to be a missing @method annotation on the class

  • but that is only a hint for the ide for auto completion. it should still work as intended

  • if you add

    /**
     * @method \Pyz\Client\Catalog\CatalogFactory getFactory()
     */
    
  • above the query expander class, the ide should give you the autocompletion

  • U01ALHKK517
    U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

    thanks for your investigation. the "IDE hint" was already added. With this i get no errors in my ide but if I call the url where the AttributeCartBasedBoostingQueryExpanderPlugin is executed i get this exception:

    Call to undefined method Spryker\Client\Catalog\CatalogFactory::getCartClient()
    
  • U01ALHKK517
    U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

    maybe the stacktrace is helpful

    #0 /data/shop/development/current/vendor/spryker/search/src/Spryker/Client/Search/SearchClient.php(50): Pyz\Client\Catalog\Plugin\Elasticsearch\QueryExpander\AttributeCartBasedBoostingQueryExpanderPlugin->expandQuery(Object(Spryker\Client\Catalog\Plugin\Elasticsearch\Query\ProductCatalogSearchQueryPlugin), Array)
    #1 /data/shop/development/current/vendor/spryker/catalog/src/Spryker/Client/Catalog/CatalogClient.php(39): Spryker\Client\Search\SearchClient->expandQuery(Object(Spryker\Client\Catalog\Plugin\Elasticsearch\Query\ProductCatalogSearchQueryPlugin), Array, Array)
    #2 /data/shop/development/current/vendor/spryker-shop/catalog-page/src/SprykerShop/Yves/CatalogPage/Dependency/Client/CatalogPageToCatalogClientBridge.php(36): Spryker\Client\Catalog\CatalogClient->catalogSearch('', Array)
    #3 /data/shop/development/current/vendor/spryker-shop/catalog-page/src/SprykerShop/Yves/CatalogPage/Controller/CatalogController.php(76): SprykerShop\Yves\CatalogPage\Dependency\Client\CatalogPageToCatalogClientBridge->catalogSearch('', Array)
    #4 /data/shop/development/current/vendor/spryker-shop/catalog-page/src/SprykerShop/Yves/CatalogPage/Controller/CatalogController.php(46): SprykerShop\Yves\CatalogPage\Controller\CatalogController->executeIndexAction(Array, 13, Object(Symfony\Component\HttpFoundation\Request))
    #5 /data/shop/development/current/vendor/symfony/http-kernel/HttpKernel.php(158): SprykerShop\Yves\CatalogPage\Controller\CatalogController->indexAction(Array, Object(Symfony\Component\HttpFoundation\Request))
    #6 /data/shop/development/current/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #7 /data/shop/development/current/vendor/spryker/application/src/Spryker/Shared/Application/Application.php(132): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #8 /data/shop/development/current/vendor/spryker/application/src/Spryker/Shared/Application/Application.php(110): Spryker\Shared\Application\Application->handle(Object(Symfony\Component\HttpFoundation\Request))
    #9 /data/shop/development/current/public/Yves/index.php(22): Spryker\Shared\Application\Application->run()
    #10 {main}
    
  • well, as you can see it tries to get it from the core factory

  • so you extended factory might have a wrong name/namespace

  • can you please check here?

  • U01ALHKK517
    U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

    i created the factory with the namespace "Pyz\Client\Catalog" that should match or i am wrong?

  • that is correct

  • can you send a screenshot of the top of the class

  • U01ALHKK517
    U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

    and extend the class "Spryker\Client\Catalog\CatalogFactory"

  • and maybe of the relevant project file tree

  • looks correct at first glance. let me try to reconstruct. might take a moment

  • U01ALHKK517
    U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

    no problem, thank you. its not a blocker... for now i have added the 2 methods to the spryker/client/catalog factory. . i know this is not the correct way πŸ™‚

  • ok, in my b2c it works like a charm. (apart from the sorting having no effect πŸ€”)

  • (side note: running the funciton score query in isolation works as intended)

  • i will try to set this up with b2b now

  • Unknown
    edited October 2020

    you are working with b2b, right @U01ALHKK517?

  • U01ALHKK517
    U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

    yes, i have the current b2b (202009)

  • U01ALHKK517
    U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

    oh yes I noticed that too (no sorting). I think in some cases the attribute in the elastic search is not color but "farbe". At least that's what I discovered when I debugged the ES response.

  • thanks for the hint. i will ahve to check that later

  • still can’t reproduce

  • can you show me the above dependency provider, @U01ALHKK517 ?

  • U01ALHKK517
    U01ALHKK517 Posts: 12 πŸ§‘πŸ»β€πŸš€ - Cadet

    sure, i attached it here