When I go to my checkout, and I submit my billing info, and click next, I get the following error:

OException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'commerce_customer_address_xnl' in 'field list': INSERT INTO {field_data_commerce_customer_address} (entity_type, entity_id, revision_id, bundle, delta, language, commerce_customer_address_country, commerce_customer_address_xnl, commerce_customer_address_name_line, commerce_customer_address_first_name, commerce_customer_address_last_name, commerce_customer_address_organisation_name, commerce_customer_address_xal, commerce_customer_address_administrative_area, commerce_customer_address_sub_administrative_area, commerce_customer_address_locality, commerce_customer_address_dependent_locality, commerce_customer_address_postal_code, commerce_customer_address_thoroughfare, commerce_customer_address_premise, commerce_customer_address_sub_premise, commerce_customer_address_data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17, :db_insert_placeholder_18, :db_insert_placeholder_19, :db_insert_placeholder_20, :db_insert_placeholder_21); Array ( [:db_insert_placeholder_0] => commerce_customer_profile [:db_insert_placeholder_1] => 24 [:db_insert_placeholder_2] => 24 [:db_insert_placeholder_3] => billing [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => CA [:db_insert_placeholder_7] => <NameDetails PartyType="Person"><NameLine>Evan Soikie</NameLine></NameDetails> [:db_insert_placeholder_8] => Evan Soikie [:db_insert_placeholder_9] => [:db_insert_placeholder_10] => [:db_insert_placeholder_11] => [:db_insert_placeholder_12] => [:db_insert_placeholder_13] => [:db_insert_placeholder_14] => [:db_insert_placeholder_15] => Crofton [:db_insert_placeholder_16] => [:db_insert_placeholder_17] => V0R1R0 [:db_insert_placeholder_18] => 114-1753 Cecil St. [:db_insert_placeholder_19] => [:db_insert_placeholder_20] => [:db_insert_placeholder_21] => ) in field_sql_storage_field_storage_write() (line 425 of /home/umicha03/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

Comments

rszrama’s picture

Status: Active » Needs review

Did you use the latest dev version of Address Field? There should be no schema problems with it.

Ceb’s picture

yes, latest dev version.

Ceb’s picture

I tried to disable and re-enable all modules. As I did, I started getting errors about database fields that already existed, but weren't being used. (?)

I would like to try and uninstall and re-install the commerce module. Is there a way to properly do this that would also remove database fields? Or would I have to remove the database fields manually... in which case. Is there a simple way to recognize which ones need to go and which ones don't?

Ceb’s picture

nevermind, found the uninstall tab.

Ceb’s picture

However, trying to uninstall, I seem to keep getting errors like this on a number of modules: (all the UI modules)
"
Fatal error: Call to undefined function commerce_product_types() in /home/umicha03/public_html/sites/all/modules/commerce/modules/product/commerce_product_ui.module on line 24"

rszrama’s picture

Status: Needs review » Closed (cannot reproduce)

There's a warning about the uninstall process on the project page; it's still a work in progress thanks to a core issue with the removal of fields on uninstall. Additionally, if your site is an update from an older version to the beta, that also wasn't supported.

Here's the pertinent issue; for now I'm going to mark this one closed unless you can come up with steps to reproduce the Address Field problem on a clean install:

#858722: Cannot reinstall Commerce modules after uninstall due to field deletion failure

WilliamV’s picture

Status: Closed (cannot reproduce) » Active

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'commerce_customer_address_xnl' in 'field list': INSERT INTO {field_data_commerce_customer_address} (entity_type, entity_id, revision_id, bundle, delta, language, ...

I have same errorcode when changing addressfield-module from alpha to dev-version.

I need to do this to apply fields for Belgian addresses conform xnal-standards.

Please advise.

rszrama’s picture

Status: Active » Closed (cannot reproduce)

As w/ Commerce, database updates weren't supported during Address Field alpha releases; Address Field really just needs to be turned into beta. Can you rebuild this site? If not, you should be able to completely uninstall addressfield and reinstall it, manually adding back an Address Field onto your customer profile types.

WilliamV’s picture

I was able to rebuild by simply deleting the addressfield-module-folder on the server and replace it with a recently made backup.
Thank you for the follow-up.
Kind regards,
W.

rszrama’s picture

Great, glad to hear it.

jakonore’s picture

Hi,

I had the same problem and solved it by running this SQL queries. It will simply add the missing columns.

ALTER TABLE `field_data_commerce_customer_address` ADD `commerce_customer_address_xnl` longtext;
ALTER TABLE `field_data_commerce_customer_address` ADD `commerce_customer_address_name_line` varchar(255);
ALTER TABLE `field_data_commerce_customer_address` ADD `commerce_customer_address_first_name` varchar(255);
ALTER TABLE `field_data_commerce_customer_address` ADD `commerce_customer_address_last_name` varchar(255);
ALTER TABLE `field_data_commerce_customer_address` ADD `commerce_customer_address_organisation_name` varchar(255);
ALTER TABLE `field_data_commerce_customer_address` ADD `commerce_customer_address_xal` longtext;
ALTER TABLE `field_revision_commerce_customer_address` ADD `commerce_customer_address_xnl` longtext;
ALTER TABLE `field_revision_commerce_customer_address` ADD `commerce_customer_address_name_line` varchar(255);
ALTER TABLE `field_revision_commerce_customer_address` ADD `commerce_customer_address_first_name` varchar(255);
ALTER TABLE `field_revision_commerce_customer_address` ADD `commerce_customer_address_last_name` varchar(255);
ALTER TABLE `field_revision_commerce_customer_address` ADD `commerce_customer_address_organisation_name` varchar(255);
ALTER TABLE `field_revision_commerce_customer_address` ADD `commerce_customer_address_xal` longtext;
davidwhthomas’s picture

Status: Closed (cannot reproduce) » Needs review

Same error here, checkout gives WSOD as fields don't exist in database.

Here's the code for an update hook to add the fields to an existing install:

Steps:

* Change EXAMPLE_ to your module name, e.g mymodule_update_7001
* Add to your module's .install file
* Run update.php to apply database updates.

<?php
/**
 * Add new fields for Address Field module
 */
function EXAMPLE_update_7001(){
  $ret = array();

  $fields = array(
    'commerce_customer_address_xnl' => array(
      'description' => "XML contents of the xNL element.",
      'type' => 'text',
      'size' => 'big',
      'not null' => FALSE,
    ),
    'commerce_customer_address_name_line' => array(
      'description' => 'Contents of a primary NameLine element in the xNL XML.',
      'type' => 'varchar',
      'length' => 255,
      'not null' => FALSE,
      'default' => '',
    ),
    'commerce_customer_address_first_name' => array(
      'description' => 'Contents of the FirstName element of a primary PersonName element in the xNL XML.',
      'type' => 'varchar',
      'length' => 255,
      'not null' => FALSE,
      'default' => '',
    ),
    'commerce_customer_address_last_name' => array(
      'description' => 'Contents of the LastName element of a primary PersonName element in the xNL XML.',
      'type' => 'varchar',
      'length' => 255,
      'not null' => FALSE,
      'default' => '',
    ),
    'commerce_customer_address_organisation_name' => array(
      'description' => 'Contents of a primary OrganisationName element in the xNL XML.',
      'type' => 'varchar',
      'length' => 255,
      'not null' => FALSE,
      'default' => '',
    ),
    'commerce_customer_address_xal' => array(
      'description' => "XML contents of the address xAL element.",
      'type' => 'text',
      'size' => 'big',
      'not null' => FALSE,
    ),
  );
  foreach($fields as $field => $definition){
    if( ! db_field_exists('field_data_commerce_customer_address', $field)){
      db_add_field('field_data_commerce_customer_address', $field, $definition);
    }
    if( ! db_field_exists('field_revision_commerce_customer_address', $field)){
      db_add_field('field_revision_commerce_customer_address', $field, $definition);
    }
  }

  return $ret;
}
?>

Thanks for the interesting module,

DT

rszrama’s picture

Status: Needs review » Closed (cannot reproduce)

Let's actually solve the issue via #1174262: Column not found: 1054 Unknown column 'field_address_xnl', as that's the proper queue to put an update function in. We'll need to support this since we moved to beta in DC before going beta in Address field.

puidu’s picture

Great solution davidwhthomas, it worked for me! Thanks!