Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Product
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2018 at 11:26 UTC
Updated:
13 Mar 2018 at 11:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
luksakThis patch translates the selected variation before the comparison.
Comment #3
luksakActually we should write a test that checks if the right attributes are selected when providing the GET parameter.
Comment #5
bojanz commentedThe current fix seems to break current tests.
Comment #6
mglamanComment #7
mglamanSo we need a test which has
?v=contextSo the case here is not that we lost translation... it's just falling back to the default variation.
Comment #8
mglamanThe break is somewhere else.
\Drupal\commerce_product\Plugin\Field\FieldWidget\ProductVariationWidgetBase::loadEnabledVariations actually runs
$this->variationStorage->loadEnabled()and then retrieves the translation.Comment #9
mglamanThis is a blind test enhancement. PhantomJS is screwing up locally. But this adds more context testing for `?v=`. I just noticed we have no Functional testing for it, only Kernel.
Comment #11
mglamanWE HAVE CONFIRMED FAILURE OF ISSUE REPORTED IN TEST! WOO!
Typo - should be "Mon super produit"
Comment #12
mglamanI think the problem is
And that is because \Drupal\commerce_product\ProductVariationStorage::loadFromContext does not return a translated variation, which we decided the storage should not do (that's really a repository's job.
So I moved this to a shared helper which gets the translation from context via the entity repository.
Blind patch and test run.
Comment #13
bojanz commentedFix looks good!
"with context" sounds very confusing here, I didn't connect it to the url at all.
"Load variation2 directly via the url." makes more sense.
Same with the *fromContext test methods, I'd call that *fromUrl
We should be able to use $this->rebuildContainer() instead of drupal_flush_all_caches().
Comment #15
bojanz commentedAddressed my feedback, committed. Thanks!