When using Smart Importer when the tables in the database having a prefix (hosting service required it), it can not find the commerce_store_field_data table.

Clicking either on Configure or "I have CVS File for import" creates the following page error: The website encountered an unexpected error. Please try again later.

The log error indicates the following:
1603 20/Jul 18:53 php Error Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table
'db787516814.commerce_store_field_data' doesn't exist: SELECT store_id, name FROM c

Created the same table without the prefix, works like a charm. How will it effect the import if the one table doesn't have a prefix but the others do.

Comments

TBone242 created an issue. See original summary.

paultgreen’s picture

I think this is the same error I'm having. Is there any way to work around it without having to change table names?

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ssr_.commerce_store_field_data' doesn't exist: SELECT store_id, name FROM commerce_store_field_data; Array ( ) in Drupal\commerce_smart_importer\Form\SmartImporterConfigurationForm->buildForm() (line 92 of /var/www/vhosts/mysite/httpdocs/modules/commerce_smart_importer/src/Form/SmartImporterConfigurationForm.php).

Massimo25’s picture

Version: 8.x-1.x-dev » 8.x-1.0-alpha1
Assigned: Unassigned » Massimo25
Priority: Normal » Major
Issue tags: +error configuración import csv

Good morning,

I have the same error reported above when I go to configuration or in the entry I have a CSV I get the error page, actually the site where it is installed has a prefix to the tables in the database because on the database status there are three tables Drupal sites therefore I can not remove the prefix to the tables, kindly how can I solve the problem, otherwise the module is unusable.

In practice the error occurs every time the module is installed on a site where the tables in the database have a prefix, now to avoid changing or removing the prefix to the commerce_store_field_data table in the database, I corrected the fields in the files in question in the commerce_smart_importer \ src \ Form folder by removing the prefix where the database table was called except where it was a field and not the database table, at least from the graphical aspect it seems to work perfectly, another solution would have been to remove the prefix to the commerce_store_field_data table however this surely would have created problems as the tables of that site all have a prefix while correcting the call from the module files does not affect anything else, obviously the import of the products is still to be tested but I doubt that there can be problems.

Massimo25’s picture

Massimo25’s picture

Massimo25’s picture

  • DavorHorvacki committed bc819ea on 8.x-1.x
    Issue #3069163 by Massimo25, TBone242, paultgreen: Using Smart Importer...
DavorHorvacki’s picture

Status: Active » Needs review

Thanks for reporting, I would be very thankful in case you can test it for me

allisonc’s picture

/src/Form/SmartImporterConfigurationForm.php:92
Code should be changed to:

$sql = $this->database->select('commerce_store_field_data', 'cs')->fields('cs', ['store_id', 'name'])->execute()->fetchAll();

or

 $sql = $this->database->query("SELECT store_id, name FROM {commerce_store_field_data}")->fetchAll();