Reputation: 106
I built a cronjob to automaticly import products over night into my Magento 1.7.0.2 shop.
My Import worked pretty well, just the connection between a configurable article and its options did not update correctly, if the configurable article already existed.
So I added some code to the script, which would delete the articles to be imported right before the import.
All of a sudden, the following error occured:
exception 'Mage_Core_Exception' with message 'Error in data structure: entity codes are mixed' in /var/www/vhosts/my-domain.de/httpdocs/app/Mage.php:594
Stack trace:
#0 /var/www/vhosts/my-domain.de/httpdocs/app/code/core/Mage/ImportExport/Model/Resource/Import/Data.php(119): Mage::throwException('Error in data s...')
#1 /var/www/vhosts/my-domain.de/httpdocs/app/code/core/Mage/ImportExport/Model/Import.php(326): Mage_ImportExport_Model_Resource_Import_Data->getEntityTypeCode()
#2 /var/www/vhosts/my-domain.de/httpdocs/app/code/local/Webda/Import/Model/Observer.php(88): Mage_ImportExport_Model_Import->importSource()
#3 [internal function]: Webda_Import_Model_Observer->doImport(Object(Aoe_Scheduler_Model_Schedule))
#4 /var/www/vhosts/my-domain.de/httpdocs/app/code/community/Aoe/Scheduler/Model/Observer.php(79): call_user_func_array(Array, Array)
#5 /var/www/vhosts/my-domain.de/httpdocs/app/code/core/Mage/Core/Model/App.php(1338): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#6 /var/www/vhosts/my-domain.de/httpdocs/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#7 /var/www/vhosts/my-domain.de/httpdocs/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('default', Array)
#8 /var/www/vhosts/my-domain.de/httpdocs/cron.php(46): Mage::dispatchEvent('default')
#9 {main}
So, of course, I did undo all of my latest changes, but the error still remains.
Funfact: If I start the cronjob in the AOE Scheduler, it will work just fine, with or without my latest changes.
So I can definitly say, that the implementation is not the problem.
I did check the table "importexport_importdata", it is empty.
I did delete the cache several times.
Upvotes: 3
Views: 5815
Reputation: 119
Updating for M2
This occurs when \Magento\ImportExport\Model\ResourceModel\Import\Data::getUniqueColumnData is called. This function expects to return a single value. If there is more than one value then it errors out.
This is mostly caused by leftover data in the importexport_importdata when a job is interrupted. That table just temporarily holds data as the job is processing. So if you aren't running an import you can just assume that data is leftover. This is mostly caused by third party import modules and not default magento.
/**
* Return request data from import data table
*
* @param string $code parameter name
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getUniqueColumnData($code)
{
$connection = $this->getConnection();
$values = array_unique($connection->fetchCol($connection->select()->from($this->getMainTable(), [$code])));
if (count($values) != 1) {
throw new \Magento\Framework\Exception\LocalizedException(
__('Error in data structure: %1 values are mixed', $code)
);
}
return $values[0];
}
Upvotes: 2
Reputation: 184
I have seen this error come up in environments where you have a READ / WRITE split connections to different databases. I have also seen it on AWS Aurora. The error goes away if you move back to a default_setup
It has also been reported here: https://github.com/avstudnitz/AvS_FastSimpleImport/issues/29
Upvotes: 0
Reputation: 141
This seems a bit old issue but just in case someone else face this I share my experience.
The message Error in data structure: behaviors are mixed
comes from class
Mage_ImportExport_Model_Resource_Import_Data
It is related to the data in table importexport_importdata
.
Magento stores data in this table during the importation process.
Sometimes when an importation process fails or is stopped by user, the data in this table becomes corrupted.
The solution:
It is as simple as delete all records in importexport_importdata
table and then, try to execute the importation process again.
Upvotes: 2