villagedefrance / OpenCart-Overclocked

OpenCart Overclocked Edition. Advanced Shopping Cart CMS based on OC v1.5.6.X source code.
https://villagedefrance.net
Other
31 stars 22 forks source link

Export / Import Issues #152

Closed Tangol closed 6 years ago

Tangol commented 6 years ago

Please note that any user group, regardless of the Modify Permission, can Export XLSX.

Import XLSX and Export / Import (CSV) work fine and you get the: Warning: You do not have permission to modify Export / Import XLSX - (CSV)! message when you try to take an action.

Tested on https://github.com/villagedefrance/OpenCart-Overclocked/commit/33b66b969e3f5e2670d044682dde840e637f3b34

Tangol commented 6 years ago

Warning: You do not have permission to modify Export / Import (XLSX) !

2018-03-12 13:11:28 - PHP Fatal Error: Uncaught Error: Call to undefined method ModelToolExportImport::validateWorksheetNames() in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php:5326
Stack trace:
#0 C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php(5762): ModelToolExportImport->validateUpload(Object(PHPExcel))
#1 C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\controller\tool\export_import.php(30): ModelToolExportImport->upload('C:\\Bitnami\\wamp...', true)
#2 C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\system\engine\front.php(41): ControllerToolExportImport->upload()
#3 C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\system\engine\front.php(28): Front->execute(Object(Action))
#4 C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\index.php(159): Front->dispatch(Object(Action), Object(Action))
#5 {main}
  thrown in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php on line 5326

err

Tested on https://github.com/villagedefrance/OpenCart-Overclocked/commit/5c087969e2d400083c1d99ce2c576fab86910508

Tangol commented 6 years ago

The issues above are fixed, but I have another question.

How is the Export / Import (CSV) system supposed to work? For example, I did a test by taking the following steps:

Result: the products didn't appear back in the Catalog, but are present in the database...

villagedefrance commented 6 years ago

I think the reason they don't show back is because the original product_ids have been deleted and the product table auto-increment is now offset. This is why I placed a warning message about not changing any of the ids. The CSV method is most useful for small updates, like price changes, or as an optional backup, but it is not recommended for large scale Add/Delete operations.

Tangol commented 6 years ago

The CSV method is most useful for small updates, like price changes, or as an optional backup, but it is not recommended for large scale Add/Delete operations.

If you can't import the data and have it show up in the store, then this feature is kind of useless. That would be the main purpose of the Import/Export system. To export data, modify it, then import it back into the store.

Also, found another issue (XLSX).

Result:

  1. Yes (Update and/or add data)

    2018-03-13 14:06:41 - PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php on line 1229
    2018-03-13 14:06:41 - PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php on line 1255
    2018-03-13 14:06:41 - PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php on line 1257
    2018-03-13 14:06:41 - PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php on line 1285
    2018-03-13 14:06:41 - PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php on line 1286
    2018-03-13 14:06:41 - PHP Exception: Error: Duplicate entry '11-0' for key 'PRIMARY'<br />Error No: 1062<br />INSERT INTO `oc_manufacturer_to_store` SET manufacturer_id = '11', store_id = '0' in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\system\database\mysqli.php on line 39
  2. No (Delete all old data before Import) 2018-03-13 14:08:51 - PHP Exception: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''12'' at line 1<br />Error No: 1064<br />ALTER TABLEoc_url_aliasAUTO_INCREMENT = '12' in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\system\database\mysqli.php on line 39

err

I've noticed that currently, both Export/Import systems (XLSX and CSV) are unstable. I'll do my best to test and report everything, as the ability to import and export stuff, is the most important feature of OpenCart.

Tangol commented 6 years ago

Another error for the XLSX Incremental Import (Update and/or add data), when all products are deleted and trying to import a previously exported products-2018-03-14.xlsx file.

2018-03-14 10:10:19 - PHP Notice: Undefined variable: description in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\admin\model\tool\export_import.php on line 278
2018-03-14 10:10:19 - PHP Exception: Error: Duplicate entry '11-0' for key 'PRIMARY'<br />Error No: 1062<br />INSERT INTO `oc_manufacturer_to_store` SET manufacturer_id = '11', store_id = '0' in C:\Bitnami\wampstack-7.0.22-1\apache2\htdocs\oce\system\database\mysqli.php on line 39

Tested on https://github.com/villagedefrance/OpenCart-Overclocked/commit/55be94840f5855ab3cc804a31e18978c70ef110f

villagedefrance commented 6 years ago

I have re-instated the previous PHPExcel library and Model. It is now working again but will need more fine tuning to make it perfect. I think this issue should now be closed. ... and possibly a fresh one open later if new problems are found.