craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
219 stars 170 forks source link

[5.x]: Key "site" for array with keys "0, 1" does not exist on saving Commerce sites settings #3426

Closed vnali closed 6 months ago

vnali commented 6 months ago

What happened?

Description

When saving commerce sites settings on admin/commerce/settings/sites page, if there is two sites and we select same store for both sites, on saving the form, we get 'Key "site" for array with keys "0, 1" does not exist' on line of 20 of src/templates/settings/stores/_siteStore.twig.

Craft CMS version

5.0.0-beta.6

Craft Commerce version

5.0.0-beta.1

PHP version

8.2

Operating system and version

No response

Database type and version

MariaDB 10.6.7

Image driver and version

No response

Installed plugins and versions

-

linear[bot] commented 6 months ago

PT-1300 [5.x]: Key "site" for array with keys "0, 1" does not exist on saving Commerce sites settings

lukeholder commented 6 months ago

Hi @vnali I can't reproduce the issue. Can you make sure you don't have any pending project config changes and try saving it again?

vnali commented 6 months ago

Hi @lukeholder I tried to 'Reapply Everything' and after commenting some lines in the SpokeAndChain module, I got an error related to line of 350 of emails services complaining about senderAddress key is not available.
This was a migrated SpokeAndChain demo from Craft 4 to Craft 5. maybe I should wait for an official SpokeAndChain demo. Thanks!

vnali commented 6 months ago

Hello @lukeholder I just tried this on another Craft 5.0.0-beta.7 without any plugins or modules

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`craft5`.`commerce_shippingcategories`, CONSTRAINT `fk_jrwgtxfdxqfbdsxhdmnnbbmvwiogvvynezkz` FOREIGN KEY (`storeId`) REFERENCES `commerce_stores` (`id`))The SQL being executed was: DELETE FROM `commerce_stores` WHERE `id`=2'
nfourtythree commented 6 months ago

Hi @vnali

Thank you for bringing this to our attention.

We have pushed a fix that will be included in the next release of Commerce 5 beta.

To get this early, change your craftcms/commerce requirement in your project's composer.json to:

"require": {
  "craftcms/commerce": "5.0.x-dev#93f7931e14c7052d662352f95606c1e18ea4fc61 as 5.0.0-beta.1",
  "...": "..."
}

Then run composer update.

Thanks!