-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SearchBundle][ProductBundle] Add multilingual in elasticsearch engine and check on product availability #4525
Conversation
Overall its 👍 but IMO the title is a bit misleading since there is more than just multilingual support. |
$engine = null; | ||
foreach ($syliusSearchConfigs as $syliusSearchConfig) { | ||
if (isset($syliusSearchConfig['engine'])) { | ||
$engine = $syliusSearchConfig['engine']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you add break;
in this if
? Cause now last one wins, with break
first one wins.
@okwinza You're right, changed title according to that |
$elasticaProductListenerDefinition->addArgument(new Reference('fos_elastica.object_persister.' . $index . '.product')); | ||
$elasticaProductListenerDefinition->setTags($tags); | ||
|
||
$container->setDefinition('sylius_product.listener.product_update', $elasticaProductListenerDefinition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks wrong, cause every index will overwrite the definition "over & over", so if you have two, it will write for both, but second one will overwrite definition of the first one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, i can add a check on that to add only one time.
[Edit] i refactor that definition to avoid extra loops, and wrong service definition (overwrite)
Product bundle should not depend on SyliusSearchBundle. Can we somehow decouple it in this PR? |
} | ||
|
||
/** | ||
* Add available products filter for variants (or master variant) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant comment
@@ -166,4 +173,47 @@ private function prependVariation(ContainerBuilder $container, array $config) | |||
], | |||
]); | |||
} | |||
|
|||
/** | |||
* Add elastica product listener |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all this redundant comments
@pjedrzejewski I can move prependElasticaProductListener to the core ? ElasticaProductListener too. |
ping @pjedrzejewski :) |
Looks good to me, we are going to change SearchBundle a lot, to simplify how it works. Could you move this from Core to SearchBundle? That's appropriate place I think. |
Thanks for your work! |
yes of course |
Done @pjedrzejewski ;) |
Great work Nicolas, you can't even imagine how helpful this PR is, opening and RFC in few minutes with explanation. :D Thanks! |
My pleasure :) |
See #4659, I rambled a bit, but I hope you get the idea. :D |
@Niiko After upgrading, this PR caused the following error to appear when deleting a product:
Any idea? I am using the same mapping as you are using for a product. Using Elastic Search I've found that in the |
My bad, sorry |
[SearchBundle][ProductBundle] Add multilingual in elasticsearch engine and check on product availability
Here is my work on multilingual search with elasticsearch engine.
Here is my fos_elastica configuration
In order to work, the product type in fos_elastica config has to have properties : masterVariant, variants and enabled. So, if accepted, i can PR a minimum configuration for Sylius-docs.
I had also a check on availability of products with three checks :
I have a question on last one, can we consider if onHand > 0 means product is available, or onHand - onHold > 0 ?