HeadlessEC (GraphQL) not yet compatible with Bagisto 2.1.2?
-
Hello @tmss
If you want to make Bagisto2.0 (GraphQL) compatible to the latest version Bagisto 2.1.2((GraphQL)) go to
vendor >> bagisto >> graphql-api >> src >> Models >> CatalogRule >> CatalogRule.php
this file and make a slight change in these two functions i.e. catalog_rule_products() and catalog_rule_product_prices() and apply return type HasMany as shown in the below image.
Thanks & Regards..!!
-
Thanks for the confirmation.
This was already in place, but it did not work.I was getting this error at the time and it looked like some CLASS was missing.
ERROR: Failed to find class Webkul\CMS\Models\CmsPageTranslation in namespaces [App, Webkul\GraphQLAPI\Models] for directive @paginate.{" exception":""[object] (Nuwave\Lighthouse\\Exceptions\\DefinitionException(code: 0): Failed to find class
-
Hello @tmss
May I know in which Bagisto version you are making these changes ?
Also, read the complete readme file of headless e-commerce regarding the installation
https://github.com/bagisto/headless-ecommerce
Thanks & Regards..!!
-
Thank you very much.
I was reading the same material.
https://github.com/bagisto/headless-ecommerceThe version of Bagisto is 2.1.2.
What I want to do is.
- to run headless-ecommerce.
2.I am trying to develop a package in "bagisto/packages" without touching the source of Bagisto itself.
- to run headless-ecommerce.
-
Hello @tmss
We have also provided a video tutorial to install this
https://youtu.be/kdHTm30GvwI?si=OThfOZYDBm5IGg7W
kindly check the link to learn in detail video from 5:14 minutes inside this video.
Thanks & Regards..!!
-
Thanks for the video!
I have GraphQL as a package though,
https://github.com/bagisto/headless-ecommerce
Is this the same as what you are doing on this page?If I install it with a command that references GitHub
It will be downloaded in bagisto/vendor/bagisto/graphql-api.
No packages were added to bagisto/packages/Webkul.Also, should I use an older version?
From the video, it looks like the following versions- Bagisto:v1.4.3
- Headless EC (GraphQL):v1.4.3
- nextjs-commerce:v1 branch
I am currently using 2.1.2 of Bagisto.
By the way, the following versions worked as shown in the image
- Bagisto:2.0.0
- Headless EC:dev-master
What is the safest and most stable way to use HeadlessEC?
Is it preferable to use 1.4.3 as shown in the video?I would like to use something that is stable in its documentation and specifications and that I can safely update in the future.
I am experimenting with various versions and am confused.
Sorry for the inconvenience. -
Hello @tmss
Greetings of the day..!
This is an example of bagisto1.4.3 you can install it with the latest version with the instruction present in READ ME file.
https://github.com/bagisto/headless-ecommerce
Thanks & Regards..!
-
-
Hello @tmss
You're Welcome. If, you like our support kindly give 5-star reviews here from the link below
It will be grateful for us.https://www.trustpilot.com/review/bagisto.com
Thanks & Regards..!!
-
Thank you for the video!
I was very careful and it did not work.Sorry for the many sentences!
I tried to install HeadlessEC(GraphQL) by referring to the video (v1.4.3), v1.4.3 and v2.0.1 README.md and comparing them.
Compared to v2.0.1, the following seemed to be necessary in summary, so I performed the following
- put Headless EC(GraphQL) under Packages
(I ultimately found this unnecessary) - setup Headless EC v2.0.1 according to README.md *1
https://github.com/bagisto/headless-ecommerce/blob/v2.0.1/README.md
*1 There are no steps to configure config/lighthouse.php
I ran it and it didn't work.
I have a question about README.md of v1.4.3 and differences between v1.4.3 Video and v2.0.1 README.md, etc. I would appreciate it if you could check.■Questions.
1.
I tried to install Headless EC on Bagisto 2.1.2 with the followingResult: Failure error
composer require bagisto/graphql-api:2.0.1
composer require bagisto/graphql-api:2.0.0Result: Success
composer require bagisto/graphql-api dev-mainI can only install dev-main, is this normal?
Can I continue to use this in production?1. Symfony\Component\ErrorHandler\Error\FatalError Declaration of Webkul\GraphQLAPI\Models\CatalogRule\CatalogRule::catalog_rule_products() must be compatible with Webkul\CatalogRule\Models\CatalogRule::catalog_rule_products(): Illuminate\Database\Eloquent\Relations\HasMany at vendor/bagisto/graphql-api/src/Models/CatalogRule/CatalogRule.php:14 10▕ { 11▕ /** 12▕ * Get the Catalog rule Product that owns the catalog rule. 13▕ */ ➜ 14▕ public function catalog_rule_products() 15▕ { 16▕ return $this->hasMany(CatalogRuleProductProxy::modelClass()); 17▕ } 18 2. Whoops\Exception\ErrorException Declaration of Webkul\GraphQLAPI\Models\CatalogRule\CatalogRule::catalog_rule_products() must be compatible with Webkul\CatalogRule\Models\CatalogRule::catalog_rule_products(): Illuminate\Database\Eloquent\Relations\HasMany at vendor/bagisto/graphql-api/src/Models/CatalogRule/CatalogRule.php:14 10▕ { 11▕ /** 12▕ * Get the Catalog rule Product that owns the catalog rule. 13▕ */ ➜ 14▕ public function catalog_rule_products() 15▕ { 16▕ return $this->hasMany(CatalogRuleProductProxy::modelClass()); 17▕ } 18▕ 3. Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Please let me know which combination of Bagisto and HeadlessEC (GraphQL) can be used as a stable version.
Currently, it's not clear what version is compatible with what,
I am trying various versions.I am very confused.
My goal is to use HeadlessEC(GraphQL) with Bagisto v2.1.2.- I saw on Github that Headless EC(GraphQL) v2.0.1 only works with Bagisto v2.0.0.
- This time I was told that Bagisto v2.1.2 could be used, so I tried again, but it still did not work.
Is it correct that there is no way to use Headless EC(GraphQL) v2.0.1 with Bagisto v2.1.2?
(The HasMany fixes have already been applied but did not work).The error in Laravel is always the same as below.
I also looked here and it seems that some CLASS files do not exist.local.ERROR: Failed to find class Webkul\CMS\Models\CmsPage in namespaces [App, Webkul\GraphQLAPI\Models] for directive @paginate. {"exception":"[object] (Nuwave\\Lighthouse\\Exceptions\\DefinitionException(code: 0): Failed to find class Webkul\\CMS\\Models\\CmsPage in namespaces [App, Webkul\\GraphQLAPI\\Models] for directive @paginate. at /var/www/html/bagisto/vendor/nuwave/lighthouse/src/Schema/Directives/BaseDirective.php:190)
I don't think I need to manually put graphql-api in pakages/Webkul in v.2.0.1, is that correct?
The result of the installation with the command,
I thought that I don't need to put it in pakages/Webkul again because it is in bagisto/vendor/bagisto/graphql-api.bagisto/vendor/bagisto/graphql-api/composer.json
This is also why there is also the following statement in"autoload": { "psr-4": { "Webkul\\GraphQLAPI\\": "src/" } },
bagisto/config/lighthouse.php
I believe it can also be referenced in namespaces in(It should also automatically integrate with bagisto/composer.json)
I only found in the video about adding to bagisto/config/app.php providers.
*Not mentioned in README.md.Webkul\GraphQLAPI\Providers\GraphQLAPIServiceProvider::class,
Is this one still required in v2.0.1?
I found this, so I don't believe it is currently needed.
(It is loaded by extra (discovery function))bagisto/vendor/bagisto/graphql-api/composer.json
"extra": { "laravel": { "providers": [ "Webkul\\GraphQLAPI\\Providers\\GraphQLAPIServiceProvider" ], "aliases": {} } },
In the video, I had first placed the package I had DL'd from GitHub myself under bagisto/packages/Webkul,
In addition, I did the following command,composer require bagisto/graphql-api php artisan bagisto_graphql:install
I don't think it's necessary, since it's a double configuration under the vendor, but is it necessary?
I'm sorry if I'm wrong.- vendor
- bagisto/packages/Webkul
I feel it will be difficult to manage version upgrades in the future if I put them in two separate files.
As of v2.0.1, I don't put packages that I downloaded from GitHub under bagisto/packages/Webkul.
Is this correct? - put Headless EC(GraphQL) under Packages