Originally Posted by
gohealth
Hi,
I'm using the Attrib-Basic-EP file to try and get my attributes loaded. I have used the tool to load a number of products and am now using the Attrib-Basics-EP file I exported as a template to populate (it does have some good entries as my store does have some products with attributes already). Before editing and adding more, I thought I would test the update. The upload of the exported file, unchanged, returned the message:
MySQLi error 1054: Unknown column 'p.products_model' in 'where clause'
When executing:
SELECT * FROM products WHERE (
p.products_model = '1392')
I see the syntax error in that products was not referenced as 'p', but the upload has created the SQL as p.products_model. Is this a bug?
Note, I originally tried this with products_id still the primary key. However, I have changed products_model to be the primary key and still get the same error.
Running ZC 1.5.6c on PHP 7.3
It is a bug resulting from streamlining the code a little where the query operating against a single table did not use a table name alias and reference to the desired field did include the table alias.
In the file admin/easypopulate_4_attrib.php
At line 29, if you change:
Code:
$query ="SELECT * FROM ".TABLE_PRODUCTS." WHERE (" . $chosen_key_sql . ")";
To:
Code:
$query ="SELECT * FROM ".TABLE_PRODUCTS." p WHERE (" . $chosen_key_sql . ")";
That issue will be addressed for either/both primary key choices.
BTW, thank you for the identification and research performed. Apologies for the discrepancy. I'll be updating github when I get a chance and also search for other queries that might have been generated the same way of using a single table and not using a table alias.
Bookmarks