avstudnitz/AvS_FastSimpleImport

PHP Fatal error in prepareAttributesForSave

Opened this issue · 6 comments

Using AvS_FastSimpleImport_Model_Import->processProductImport([..]) I receiving this error:

PHP Fatal error: Uncaught Error: Call to a member function prepareAttributesForSave() on null in /var/www/html/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php:1417
Stack trace:
#0 /var/www/html/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php(481): AvS_FastSimpleImport_Model_Import_Entity_Product->_saveProducts()
#1 /var/www/html/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php(522): Mage_ImportExport_Model_Import_Entity_Product->_importData()
#2 /var/www/html/app/code/core/Mage/ImportExport/Model/Import.php(325): Mage_ImportExport_Model_Import_Entity_Abstract->importData()
#3 /var/www/html/app/code/community/AvS/FastSimpleImport/Model/Import.php(123): Mage_ImportExport_Model_Import->importSource()

I think the input data in not correctly validated, it would be better to handle this kind of error instead of let it throwing a Fatal error.

i am receiving the same error...did you find any solution to this issue?

Hi @testBanana

sorry but it's been too long, I do not remember well.. I think it was connected to a wrong data set, try to check if you are importing using an existing product type or something like that.

ok....thanks ... i will check this..

Hi there,

When we delete any product and try to import data that time we gets below error and unable to import data.

Fatal error: Call to a member function prepareAttributesForSave() on null in /app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php on line 1434

If we use fresh Magento setup that time it is working fine but if we delete at-least 1 or more products and try to import that time it is not working and found above error.

I hope someone have solution of this issue.

i found the issue and it was just a encoding problem...
this means that in the product attributes were some malformed UTF-8 characters...

and so the import didn't work.

i've fixed it with iconv, like this...

.....
foreach ($matches[1] as $key => $featureId) { $featuresAndValues["term_merkmal_$featureId"] = iconv('UTF-8', 'UTF-8//IGNORE', substr($matches[2][$key], 0, 255)); }
....

now the import is working just fine...

@pixlogix: check if you have malformed characters..., or try to import just some products...

Hi @testBanana

Thank you for your quick reply.

Sometime it is working fine and sometime it's not working. We are already using iconv() function. Also we have tried to change $productType with static (http://prntscr.com/ktfgwu) and it is working fine but looks like frontend testing array value empty (http://prntscr.com/ktfim7) even products imports fine.

We think, it might be many factors to fix issue.