duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/simple-commerce
Other
143 stars 34 forks source link

Can't access customers/orders since 6.x update #1015

Closed sdussaut closed 5 months ago

sdussaut commented 5 months ago

Description

Hi!

I am using SC with database users and customers and something might be wrong with the update as I can't access any customers/orders in the control panel.

I get this error:

StatamicRadPack\Runway\Http\Controllers\CP\ResourceController::getPrimaryColumn(): Return value must be of type string, null returned

The full stack trace can be found here: https://flareapp.io/share/87n9DdeP

I had already existing customers and orders in my DB before the update to 6.x.

Thanks for your help!

Steps to reproduce

Follow the SC upgrade guide from 5.x to 6.x ;-)

Environment

Environment Application Name: Test site Laravel Version: 10.40.0 PHP Version: 8.3.1 Composer Version: 2.6.6 Environment: local Debug Mode: ENABLED URL: test-site.test Maintenance Mode: OFF

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

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

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

Statamic Addons: 2 Antlers: runtime Sites: 1 Stache Watcher: Disabled Static Caching: half Version: 4.48.0 PRO

Statamic Addons duncanmcclean/simple-commerce: 6.0.7 statamic-rad-pack/runway: 6.1.0

duncanmcclean commented 5 months ago

This should be fixed by updating to the latest version of Runway.

Related: statamic-rad-pack/runway#422

sdussaut commented 5 months ago

If you look at the environment info I provided, I do have Runway 6.1.0 installed :-)

duncanmcclean commented 5 months ago

Oops sorry, I misread as 6.1.0.

What does your resources/blueprints/vendor/runway/order.yaml file look like? (does one even exist?)

sdussaut commented 5 months ago

In that folder there are customers.yaml and orders.yaml but the ones for the entries (order.yaml and customer.yaml) are still directly under blueprints.

duncanmcclean commented 5 months ago

Okay, try deleting the customers.yaml and orders.yaml inside the vendor/runway directory, then run php please runway:migrate-blueprints.

That command should move your blueprints over to the right place.

sdussaut commented 5 months ago

Thanks, I ran the command and what it did is:

The folder structure is unchanged on my side:

Capture d’écran 2024-02-16 à 11 27 39

I might be missing something here but I don't know what.

duncanmcclean commented 5 months ago

You don't need the collection blueprints for orders/customers anymore, Runway v5 wasn't using them and Runway v6 won't be using them.

I believe in Simple Commerce v5, the Runway blueprints for orders & customers used to live directly in the root resources/blueprints directory. If they're no longer there, which I think might be the case for you, then it won't be able to migrate from your previous order/customer blueprints.

In which case, you can just copy the default order/customer blueprints into your resources/blueprints/vendor/runway directory, then everything should work:

sdussaut commented 5 months ago

Ok I did that and now everything seems in order.

Thank you very much for your help!