Question

I'm trying to add a product to my cart, like this:

cartFacade.addToCart("M300044", 2);

And it fails with: Product with code 'M300044' not found!

When I debug the code, I find that this query is executed by FlexibleSearchService.search(query):

SELECT {c:pk} FROM {Product AS c} WHERE {c:code}='M300044' 

If I execute this query on my hybris Admin console, I do get a Product as a result.

Why can't FlexibleSearchService find it though? Is it something to do with setting a catalog version somewhere?

Was it helpful?

Solution

In this case it was because I was doing this from a Test class, so hybris couldn´t find the product because there was no data whatsoever in the junit tenant.

So I had to create the data in the setup method of my Test class, which is executed before the actual test method is called.

OTHER TIPS

You need to make sure one more thing that you have set the session user = admin , because if there is a restriction applied on u r product then your test case won't work

I believe this is a SYNCHRONIZATION issue. STAGED Product Version is not aligned with Online. You have two options. HMC > System > Facet Search > indexer wizard. Product Cockpit.

Check available stock for product in hmc. May this help you

initialize Junit tenant so by checking import sample data yes so that data which you have in production will be available for testing.

you need to make full SOLR indexing for the products from hmc before they can appear in front end store or using hypris APIs hope that help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top