Question

When we are working on Magento2.2.4 on the same, i got the proper response order_id was created.

But, coming to Magento2.2.6, i am getting the response like thisenter image description here

We have checked the log files from var/log/exception.log

I got the following :

[2018-10-24 09:34:49] main.CRITICAL: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist, query was: INSERT INTO `mg_sequence_order_1` () VALUES () {"exception":"[object] (Zend_Db_Statement_Exception(code: 42): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist, query was: INSERT INTO `mg_sequence_order_1` () VALUES () at /home/depoto/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist at /home/depoto/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []
[2018-10-24 09:35:05] main.CRITICAL: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist, query was: INSERT INTO `mg_sequence_order_1` () VALUES () {"exception":"[object] (Zend_Db_Statement_Exception(code: 42): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist, query was: INSERT INTO `mg_sequence_order_1` () VALUES () at /home/depoto/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist at /home/depoto/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []
[2018-10-24 09:37:09] main.CRITICAL: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist, query was: INSERT INTO `mg_sequence_order_1` () VALUES () {"exception":"[object] (Zend_Db_Statement_Exception(code: 42): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist, query was: INSERT INTO `mg_sequence_order_1` () VALUES () at /home/depoto/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'depoto.mg_sequence_order_1' doesn't exist at /home/depoto/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []

We have the table sequence_order_1.

But the log file is showing the error with depoto_mg_sequence_order_1

Why this is happening like this?

Was it helpful?

Solution

As per the question, the existing table has name sequence_order_1, while the exception.log says, it is trying to find a table with name mg_sequence_order_1 in the depoto database.

The problem seems to be that while installing Magento 2, table prefix was set as mg_.

While creating the table sequence_order_1, the prefix was not used, but the code written for getting the order information is using the table name by getTable() function.

So, Magento is adding the default prefix, i.e. mg_ in the table name. That is why Magento is not able to get the table name and throwing the error that base table does not exist.

To fix the error, either drop the custom table (sequence_order_1), and recreate it with the prefix (mg_).

Or, if it is possible to change the code for getting the order info, you can pass the table name hardcoded (without using getTable() function).

I hope I was clear enough to solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top