duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/addons/duncanmcclean/simple-commerce
Other
146 stars 40 forks source link

Add on version check results in an error #1040

Closed de-raaf-media closed 6 months ago

de-raaf-media commented 6 months ago

Description

In SimpleCommerce.php line 32 a version is checked:

return Addon::get('duncanmcclean/simple-commerce')->version();

In /checkout/payment this results in an error:

Call to a member function version() on null

Steps to reproduce

Click on "continue to payment" and the error occurs.

Environment

Environment Application Name: Statamic Laravel Version: 10.48.4 PHP Version: 8.2.16 Composer Version: 2.7.1 Environment: local Debug Mode: ENABLED URL: [domain].test Maintenance Mode: OFF

Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED

Drivers Broadcasting: log Cache: statamic Database: mysql Logs: stack / single Mail: smtp Queue: sync Session: file

Simple Commerce Currencies: EUR Gateways: Mollie Repository: Customer: DuncanMcClean\SimpleCommerce\Customers\UserCustomerRepository Repository: Order: DuncanMcClean\SimpleCommerce\Orders\EloquentOrderRepository Repository: Product: DuncanMcClean\SimpleCommerce\Products\EntryProductRepository Shipping Methods: Free Shipping Tax Engine: DuncanMcClean\SimpleCommerce\Tax\BasicTaxEngine

Statamic Addons: 3 Antlers: runtime Sites: 1 Stache Watcher: Enabled Static Caching: Disabled Version: 4.55.0 PRO

Statamic Addons doublethreedigital/simple-commerce: 6.0.11 statamic-rad-pack/runway: 6.6.2 statamic/eloquent-driver: 3.3.2

Statamic Eloquent Driver Asset Containers: file Assets: file Blueprints: file Collection Trees: file Collections: file Entries: eloquent Forms: file Global Sets: file Global Variables: file Navigation Trees: file Navigations: file Revisions: file Taxonomies: file Terms: file

duncanmcclean commented 6 months ago

If you run php artisan tinker and paste in \Statamic\Facades\Addon::all(), what comes back?

de-raaf-media commented 6 months ago

Ok, I see the issue. What is the best approach?

 Illuminate\Support\Collection {#552
    all: [
      "doublethreedigital/simple-commerce" => Statamic\Extend\Addon {#553},
      "statamic-rad-pack/runway" => Statamic\Extend\Addon {#554},
      "statamic/eloquent-driver" => Statamic\Extend\Addon {#555},
    ],
  }
duncanmcclean commented 6 months ago

Does composer dump-autoload or php artisan statamic:addon:discover fix the issue?

de-raaf-media commented 6 months ago

After composer dump-autoload I did php artisan statamic:addon:discover

Result:

Discovered Addon: doublethreedigital/simple-commerce Discovered Addon: statamic-rad-pack/runway Discovered Addon: statamic/eloquent-driver Addon manifest generated successfully.

duncanmcclean commented 6 months ago

Okay! Are you still hitting the error when checking out?

de-raaf-media commented 6 months ago

Yes I do.

duncanmcclean commented 6 months ago

What does your composer.json file look like?

de-raaf-media commented 6 months ago

I am sorry. I totally missed the first step where the composer location was changed. I did change all the namespaces. Anyway. This fixes it!

duncanmcclean commented 6 months ago

Awesome! I thought that might have been it.