Closed danlupo closed 4 years ago
Hi @danlupo. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.
Please, add a comment to assign the issue: @magento I am working on this
@danlupo - thank you for the report. We have not yet implemented store switching into the app, so I would expect GraphQL to return whatever language the default
storeview is. I believe your suspicion is correct, if you're not seeing that response from GraphQL, we'll need to create a bug for Magento core over in magento/magento2.
If you have implemented your own store switching, and you had previously fetched filters in French, you should be mindful of the Apollo cache. If you switched back to English, but didn't purge the Apollo cache, your cache would still have French filters and return those, instead of hitting the network. You can confirm this by deleting the apollo-cache-persist
entry in LocalStorage and refreshing; if filters then return to english, the cache was your problem.
Closing this out as not a bug in Venia since we're just consumers of the GraphQL, but please re-open if there's something specific to Venia that's blocking you.
@danlupo I have the same issue! I have 5 store view and I played around with the labels with store view when I leave all of them empty it will pick the Admin Value. But What I notice if I started adding them back one at the time and loading the PWA I noticed that it seem to be picking it up some sort of alphabetically order.
I've added for IE store view and here is the setup:
Here is the result on PWA :
Next I've added for German de store view see the results:
Now DE store view shows in the filter hmmm interesting de
as d comes f4 the letter i fro ie
store view it seems picking it up alphabetically.
Next NL reload the page and guess. it still showing DE label. see result:
NOTES: Clear Cache, and reload PWA in incognito every time testing it!
Results from graphiql playground:
I think this should be re-open to look at it again is seem and issue with query Order By or something else.
UPDATED: I've done a bit More investigation and the querry results is bellow:
SELECT
a.
attribute_id,
a.
attribute_code,
a.
frontend_labelAS
attribute_label,
option_value.
valueAS
option_label,
option_value.
option_idFROM
eav_attributeAS
aLEFT JOIN
eav_attribute_optionAS
optionsON a.attribute_id = options.attribute_id LEFT JOIN
eav_attribute_option_valueAS
option_valueON options.option_id = option_value.option_id WHERE (option_value.option_id IN (5431, 5432)) OR (a.attribute_code in ('color') AND a.frontend_input = 'boolean');
It looks like to me is displaying the last result !
@lano-vargas we actually moved this issue to magento support as it was not a PWA studio issue. Moreover we found the source and provided a patch there. Please check it out below. I hope this helps solve your issue.
--- a/vendor/magento/module-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php 2020-06-22 14:52:49.421201000 +0000
+++ b/vendor/magento/module-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php 2020-06-22 14:52:41.762499000 +0000
@@ -71,7 +71,7 @@
*/
public function build(AggregationInterface $aggregation, ?int $storeId): array
{
- $attributeOptions = $this->getAttributeOptions($aggregation);
+ $attributeOptions = $this->getAttributeOptions($aggregation, $storeId);
// build layer per attribute
$result = [];
@@ -133,10 +133,11 @@
* Get list of attributes with options
*
* @param AggregationInterface $aggregation
+ * @param int $storeId
* @return array
* @throws \Zend_Db_Statement_Exception
*/
- private function getAttributeOptions(AggregationInterface $aggregation): array
+ private function getAttributeOptions(AggregationInterface $aggregation, int $storeId): array
{
$attributeOptionIds = [];
$attributes = [];
@@ -154,6 +155,6 @@
return [];
}
- return $this->attributeOptionProvider->getOptions(\array_merge(...$attributeOptionIds), $attributes);
+ return $this->attributeOptionProvider->getOptions(\array_merge(...$attributeOptionIds), $storeId, $attributes);
}
}
--- a/vendor/magento/module-catalog-graph-ql/DataProvider/Product/LayeredNavigation/AttributeOptionProvider.php 2020-06-22 14:56:58.633549000 +0000
+++ b/vendor/magento/module-catalog-graph-ql/DataProvider/Product/LayeredNavigation/AttributeOptionProvider.php 2020-06-22 14:53:00.977201000 +0000
@@ -41,11 +41,12 @@
* Get option data. Return list of attributes with option data
*
* @param array $optionIds
+ * @param int $storeId
* @param array $attributeCodes
* @return array
* @throws \Zend_Db_Statement_Exception
*/
- public function getOptions(array $optionIds, array $attributeCodes = []): array
+ public function getOptions(array $optionIds, int $storeId, array $attributeCodes = []): array
{
if (!$optionIds) {
return [];
@@ -76,6 +77,7 @@
);
$select->where('option_value.option_id IN (?)', $optionIds);
+ $select->where('option_value.store_id = ?', $storeId);
if (!empty($attributeCodes)) {
$select->orWhere(
Thanks! That fix is working for me!
Describe the bug Have multiple storefronts in different languages (default english + french). Create a custom searchable/filterable product attribute and configure it's different labels.
In PWA Studio will access the default/english store, however the labels are french
To reproduce Steps to reproduce the behavior:
Expected behavior Labels should be in the same language as the store
Screenshots
Additional context We've applied the elasticsearch patch described here also, but it seems unrelated. We suspect that it might be a graphql bug.
Please complete the following device information:
npm -v
: 6.13.4node -v
: v10.19.0Please let us know what packages this bug is in regards to:
venia-ui
peregrine