XML import - zero values converted to empty string
Posted: 20 Jan 2024, 09:25
Hi,
I am trying to import products using the XML format. I have exported current products to get a template file, added my products and than tried to import the file back. However the import fails - the UI does not show anything but I get 500 HTTP error with this message
This is how the elements for each product look like. I have not touch those so they are the same as they were generated during export.
I think the problem is in the import procedure
This code converts 0 and '0' to empty string ('') which results in setting column stockstatus_a_id to invalid value.
This code is the same in versions 4.0.9, 4.0.10 and 5.0.0b20.
I am trying to import products using the XML format. I have exported current products to get a template file, added my products and than tried to import the file back. However the import fails - the UI does not show anything but I get 500 HTTP error with this message
Code: Select all
{
"error": true,
"code": 0,
"message": "Incorrect integer value: '' for column 'stockstatus_a_id' at row 1"
}
Code: Select all
...
<stockstatus_a_id>0</stockstatus_a_id>
<stockstatus_n_id>0</stockstatus_n_id>
....
Code: Select all
admin/layouts/product_import.php@527
Code: Select all
// correct simple xml
foreach($data as $k => $v) {
if (empty($v)) {
$data[$k] = '';
}
}
This code is the same in versions 4.0.9, 4.0.10 and 5.0.0b20.