4

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?

  • Please check log files, there must be logs. – Ramkishan Suthar Oct 24 '18 at 7:19
  • how can i check the logs could you please ?? – Lavaraju Oct 24 '18 at 7:37
  • See logs in var/log/exception.log. – Thao Pham Oct 24 '18 at 8:05
  • You should run reindex and check again. – Thao Pham Nov 1 '18 at 7:00
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.