how to create MagentoGraphqlClient conection ?
in order to execute graphql queries to fetch products from magento
表示
返信
いいね!の合計
This article from Adobe gives you pretty much everything to start to CIF integration with AEM
Make sure you have all the details of the Magento client like URL, username, password and root category to pick the catalog data
This will be a cloud configuration that needs to be added which is explained in detail in the article.
I hope this magneto graphql documention helps -
https://devdocs.magento.com/guides/v2.4/graphql/authorization-tokens.html
And writing MagnetoGraphQLClient interface:
https://github.com/adobe/aem-core-cif-components/blob/master/bundles/core/src/main/java/com/adobe/cq...
Add store/ url required details in OSGI config - com.adobe.cq.commerce.graphql.client.impl.GraphqlClientImpl~<identifier>.cfg.json
then create cloudconfig of the store view
In AEM go to Tools -> Cloud Services -> CIF Configuration
Select the commerce configuration you want to change
Open the configuration properties via the action bar
and configure to site hierarchy
Refer detailed adobe doc https://experienceleague.adobe.com/docs/experience-manager-65/commerce/storefront/getting-started.ht...
backend side to get MagentoGraphqlClient object:
MagentoGraphqlClient magentoGraphQLclientObject = resource.adaptTo(MagentoGraphqlClientImpl.class): request.adaptTo(MagentoGraphqlClientImpl.class);
Hi Heena Madan,
Getting build error while using
MagentoGraphqlClient magentoGraphQLclientObject = resource.adaptTo(MagentoGraphqlClientImpl.class);
[ERROR] The analyser found the following errors for author and publish : [ERROR] [api-regions-exportsimports] com.aem.magento:aem-magento.core:1.0.0-SNAPSHOT: Bundle aem-magento.core:1.0.0-SNAPSHOT is importing package(s) com.adobe.cq.commerce.core.components.internal.client in start level 20 but no bundle is exporting these for that start level. (com.aem.magento:aem-magento.all:1.0.0-SNAPSHOT)
I have used,
<dependency> <artifactId>core-cif-components-core</artifactId> <version>2.12.0</version> <groupId>com.adobe.commerce.cif</groupId> <scope>provided</scope> </dependency>
If bundle is not found at start level 20- you need to export these jars. embed required cif and magento jar in "all" module
<!-- Adobe CIF Dependencies --> <embedded> <groupId>com.adobe.commerce.cif</groupId> <artifactId>core-cif-components-apps</artifactId> <type>zip</type> <target>/apps/project-packages/application/install</target> </embedded> <embedded> <groupId>com.adobe.commerce.cif</groupId> <artifactId>core-cif-components-config</artifactId> <type>zip</type> <target>/apps/project-packages/application/install</target> </embedded> <embedded> <groupId>com.adobe.commerce.cif</groupId> <artifactId>core-cif-components-core</artifactId> <target>/apps/project-packages/application/install</target> </embedded> <embedded> <groupId>com.adobe.commerce.cif</groupId> <artifactId>magento-graphql</artifactId> <target>/apps/<project-packages/application/install</target> </embedded> <embedded> <groupId>com.adobe.commerce.cif</groupId> <artifactId>graphql-client</artifactId> <target>/apps/project-packages/application/install</target> </embedded>
these dependencies are already there in all module pom.
Still not working
I am also facing this issue. Any solution you found for this ?
表示
返信
いいね!の合計
Any luck with this issue? I am having the same problem with my custom product component.
MagentoGraphqlClient is not getting injected in my CustomProductImpl even though I have all required OSGI configurations done. Due to this, I am getting magentoGraphqlClient object as null. I kept debug pointer in OOTB ProductImpl as well, and over there I can see the object is getting initialised.
Strange thing, the injection in my local works fine some times and some times it doesn’t. In AEM cloud Dev ,magentoGraphqlClient is always null.
表示
返信
いいね!の合計
Have you configured commerce endpoint in AEM cloud instance? If not, it will give you null magentoGraphql client
表示
返信
いいね!の合計
yep, that's configured in cloud manager. All OSGI configs are also fine.
all dependencies and embeds are done in pom files.
表示
返信
いいね!の合計
Can you check bundles are active with perfect OSGI config? You can verify in developer console
表示
返信
いいね!の合計
Yep, all bundles are active.
One observation was OSGI component for GraphqlClientImpl was appearing as Satisfied instead of active. Checked it via developer console.
Any idea why would the status go into satisfied state?
表示
返信
いいね!の合計
seems version mismatch..Can you check version of bundles that is available in aem cloud and what you are passing?
表示
返信
いいね!の合計