mc12345678 / EasyPopulate-4.0

Data import and export module for Zencart 1.3.x and 1.5.x
GNU General Public License v2.0
10 stars 8 forks source link

v4.0.37 - Basic attrib import primary key field references unknown table #53

Closed mc12345678 closed 4 years ago

mc12345678 commented 4 years ago

In the latest revision to the basic import, the ability to choose a different primary key was incorporated. The reference to the field includes a table alias (instead of the table name). Without referencing the table alias, mysql doesn't necessarily understand the relationship. So in this case p.products_id or p.products_model was not recognized in a query such as:

SELECT * FROM products WHERE p.products_id = 1

as the p. of p.products_id was not recognized.

To correct this and potentially similar issues where variables are used to fill in the blank of the primary key, select queries should include the table reference as part of the sql statement regardless of how simple the select query is.