I’m having trouble importing Tailor records on one site while it’s perfectly OK on another.
Maybe someone can help me out.
- Site one - (clean) OC 3.7 install, demo theme, multisite with 3 sites.
Exported data from demo Blog blueprint.
Imported/updated the same data with no problem (checked “Update existing records”).
- Site two, OC3.7 install, custom theme, multisite with 3 sites.
Duplicate of Blog blueprint from site 1 (the same that comes with Demo theme).
Exported data from demo Blog blueprint.
Importing the same data throw a notice Record ID already exists even with “Update existing records” checkbox checked
I went through code to find why and found this:
In file modules/backend/behaviors/importexportcontroller/ActionImport.php there is a method to bind ImportOptions from request to model on line 42:
if ($optionData = post('ImportOptions')) {
$model->fill($optionData);
}
This works perfectly on site 1 and Tailor\Models\RecordImport has an attribute update_existing set and so it updates imported records.
But on site 2 this doesn’t work and attribute update_existing is not added to the RecordImport model and this ends with notice Record ID already exists.
The only way I was able to fix this on site 2 was to change method $model->fill($optionData) to $model->forceFill($optionData) in ActionImport.php or to add fillable['update_existing'] attribute to RecordImport.php model.
Tailor’s RecordImport doesn’t have attribute fillable (not even parent ImportModel) so this make sense, but how is this working on site 1 but not on site 2?
Both sites has identical environment (Valet with PHP8.2, OC3.7.11) and identical Blog Posts blueprints from Demo theme.
Does anyone have any experience with this?