barrelstrength / sprout-fields

International, Craft-friendly field types.
https://sprout.barrelstrengthdesign.com/craft-plugins/fields
Other
11 stars 7 forks source link

Address Field Table Not Getting Created #40

Closed mikestecker closed 6 years ago

mikestecker commented 6 years ago

Upon creating a new field using the Sprout Address field type, adding it to a section then proceeding to edit the section entry, I was presented with The table does not exist: {{%sproutfields_addresses}}

I'm not sure if there should be a new table for this sort of content, but it's looking for one...

PHP 7.1.14 Craft 3 RC-15 Sprout Fields 3.0.3 Sprout Encode Email 2.0.0

Also, not sure if related: this is a Craft 2 -> 3 migration in progress where older Sprout plugins that haven't been ported to Craft 3 yet were installed and configured.

BenParizek commented 6 years ago

Thanks @mikestecker

We'll look into this. It could be a migration issue. If you have a moment, could you confirm which version of Sprout Base you have installed? The version would be listed in:

vender/barrelstrength/sprout-base/composer.json
mikestecker commented 6 years ago

Sure, it's 1.0.9

pdaleramirez commented 6 years ago

@BenParizek
I tested this and there was no migration on creating the sproutfields_addresses. I created the migration file in the plugin. I also did a test running craft2 to craft3 db updates. Committed here on both v3 and develop branch https://github.com/barrelstrength/craft-sprout-fields/commit/1d0e7c2cbf3c25417dd09a01f0d36d46c4831723

BenParizek commented 6 years ago

@mikestecker This should be resolved in the latest release of Sprout Fields.

mikestecker commented 6 years ago

@BenParizek @pdaleramirez is there a way to try and re-run the migration? I'm running the latest version but it doesn't seem to be fixed still. I'm on Sprout Fields 3.0.6 and Sprout Base 1.1.0 but I'm still getting this error

mikestecker commented 6 years ago

I tried to manually create the table with this query in MySQL:

CREATE TABLE `sproutfields_addresses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `elementId` int(11) DEFAULT NULL,
  `siteId` int(11) DEFAULT NULL,
  `fieldId` int(11) DEFAULT NULL,
  `countryCode` varchar(255) DEFAULT NULL,
  `administrativeArea` varchar(255) DEFAULT NULL,
  `locality` varchar(255) DEFAULT NULL,
  `dependentLocality` varchar(255) DEFAULT NULL,
  `postalCode` varchar(255) DEFAULT NULL,
  `sortingCode` varchar(255) DEFAULT NULL,
  `address1` varchar(255) DEFAULT NULL,
  `address2` varchar(255) DEFAULT NULL,
  `dateCreated` datetime NOT NULL,
  `dateUpdated` datetime NOT NULL,
  `uid` char(36) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Which removed my error, but when I add the field to an entry and click "Add Address", the modal is empty. Screenshot from Chrome: screenshot 2018-04-17 10 25 25

mikestecker commented 6 years ago

After inspecting the issue with the missing modal earlier, I noticed this error in the console:

POST https://staging.acdcorp.com/index.php/admin/actions/sprout-base/address/get-address-form-fields 500 ()

Which led me to looking in Craft's logs: Error: Call to undefined method CommerceGuys\Addressing\Model\Address::setCountryCode()

Let me know if you need anything to try and track this down.