adobe / commerce-cif-connector

AEM Commerce connector for Magento and GraphQL
Apache License 2.0
43 stars 27 forks source link

Unable to create multiple cloud services #117

Open geertsmichael opened 4 years ago

geertsmichael commented 4 years ago

Expected Behaviour

My Magento & AEM set-up consists out of multiple locales and multiple store views. I am under the impression that I need multiple cloud services to connect per locale to the correct store view.

Actual Behaviour

I can only create 1 single CIF cloud service per /conf/brand folder. All my locales share the same /conf/brand folder. I need to configure the store view on the cloud service and this cloud service is applied to all my locales. So I cannot use different store views anymore.

Steps to Reproduce

  1. Create a cloud service for the gb-en site, pointing to store view gb.
  2. Create a cloud service for the us-en site, pointing to the store view us.

Platform and Version

CIF connector 0.10.0 AEM 6.4.5

cjelger commented 4 years ago

@dplaton Can you please check if this is documented? If not, we should add an example to explain how to setup multiple stores. Thank you.

dkuntze commented 4 years ago

to me this looks like the libs/commerce/gui/components/configuration/page/_cq_dialog/.content.xml file changes the name of cq:magentoStore to 'magentoStore' (minus the cq:) which makes it impossible to have multiple stores since the java constant looks for cq:magentoStore - and if it cannot find it, it returns 'default'.

okassa commented 4 years ago

We've found the same issue today that @dkuntze explained. Hopefully, we have also found a temporary workaround by using the GraphQL client. We have added to the default OSGI config (com.adobe.cq.commerce.graphql.client.impl.GraphqlClientImpl ) for a the GraphQL client a default HTTP header like Store:name_of_the_store,and it works fine. It make sense only for a single store, it's less flexible we will wait for the fix.

The master branch contains the fix as per [0] and [1], but for the tag cif-connector-reactor-0.10.0 there is a bug as per [2].

[0] https://github.com/adobe/commerce-cif-connector/blob/master/bundles/cif-connector-graphql/src/main/java/com/adobe/cq/commerce/graphql/resource/Constants.java [1] https://github.com/adobe/commerce-cif-connector/blob/master/bundles/cif-virtual-catalog/src/main/java/com/adobe/cq/commerce/virtual/catalog/data/Constants.java [2] https://github.com/adobe/commerce-cif-connector/blob/cif-connector-reactor-0.10.0/bundles/cif-connector-graphql/src/main/java/com/adobe/cq/commerce/graphql/resource/Constants.java

dkuntze commented 4 years ago

@okassa the easiest fix, without changing code, is just to have both properties on the node. Open up CRXDE and add cq:magentoStore with the same value as the other.

okassa commented 4 years ago

@dkuntze you're right, it's far much easier ;-) this fix is OK for local development i think. I'm not sure if going through CRXDE for each and very update in the cloud configuration is flexible enough. I don't like people to do manual updated on non local servers like qa,pre-prod,prod this a bad habit. I'll rather go for a temporary SlingPostProcessor which will update magentoStore property whenever the cq:magentoStore property is changed on a configuration.

cjelger commented 4 years ago

IIUC, the problem you have should be fixed by https://github.com/adobe/commerce-cif-connector/pull/118