Andrey
Andrey
Offline
OC 2.3.1 with a database imported from OC 1.5.6 with latest Pekka's migration tool.

Clean Arastta 1.0.6 with freshly installed extension.

If I try to import a database I get an error:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Notice</b>: 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 '' at line 1Error No: 1064INSERT INTO `oc_address` (`address_id`, `customer_id`, `firstname`, `lastname`, `company`, `address_1`, `address_2`, `city`, `postcode`, `country_id`, `zone_id`, `custom_field`) VALUES ('9', '8', '***', '***', '', '***', '', '***', '***', '***'; in <b>/mnt/wwwhost/****/system/library/db/mysqli.php</b> on line <b>49</b>
Thursday, June 18 2015, 02:56 PM
Share this post:
Responses (30)
  • Accepted Answer

    Thursday, June 18 2015, 05:39 PM - #Permalink
    Looks like the sql-statement is wrong.
    Could you post the whole (mask sensible data).
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Thursday, June 18 2015, 08:57 PM - #Permalink
    Here it is

    SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

    OK

    <b>Notice</b>: 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 '' at line 1Error No: 1064INSERT INTO `oc_address` (`address_id`, `customer_id`, `firstname`, `lastname`, `company`, `address_1`, `address_2`, `city`, `postcode`, `country_id`, `zone_id`, `custom_field`) VALUES ('9', '8', '*', '*', '', '*', '', '*', '*', '176'; in <b>/mnt/wwwhost/test-ar/system/library/db/mysqli.php</b> on line <b>49</b><b>Notice</b>: 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 '' at line 1Error No: 1064INSERT INTO `oc_address` (`address_id`, `customer_id`, `firstname`, `lastname`, `company`, `address_1`, `address_2`, `city`, `postcode`, `country_id`, `zone_id`, `custom_field`) VALUES ('13', '12', '*', '*', '', '*', '', '*', '*', '176', '0'; in <b>/mnt/wwwhost/test-ar/system/library/db/mysqli.php</b> on line <b>49</b><b>Notice</b>: 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 '' at line 1Error No: 1064INSERT INTO `oc_address` (`address_id`, `customer_id`, `firstname`, `lastname`, `company`, `address_1`, `address_2`, `city`, `postcode`, `country_id`, `zone_id`, `custom_field`) VALUES ('15', '14', '*', '*', '', '*', '', '*', '*'; in <b>/mnt/wwwhost/test-ar/system/library/db/mysqli.php</b> on line <b>49</b><b>Notice</b>: 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 '' at line 1Error No: 1064INSERT INTO `oc_address` (`address_id`, `customer_id`, `firstname`, `lastname`, `company`, `address_1`, `address_2`, `city`, `postcode`, `country_id`, `zone_id`, `custom_field`) VALUES ('18', '17', '*', '*', '', '*', '', '*', '*', '176', '0'; in <b>/mnt/wwwhost/test-ar/system/library/db/mysqli.php</b> on line <b>49</b><b>Notice</b>: 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 '' at line 1Error No: 1064INSERT INTO `oc_address` (`address_id`, `customer_id`, `firstname`, `lastname`, `company`, `address_1`, `address_2`, `city`, `postcode`, `country_id`, `zone_id`, `custom_field`) VALUES ('30', '29', '*', '*', '', '*', '', '*', '*', '176', '0'; in <b>/mnt/wwwhost/test-ar/system/library/db/mysqli.php</b> on line <b>49</b><b>Notice</b>: Undefined offset: 27 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 28 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 29 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 30 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 31 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 32 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 33 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 34 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 35 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 36 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 37 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 38 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 39 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 40 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 41 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 42 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 43 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 44 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 45 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 46 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 47 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 48 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 49 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 50 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 51 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 52 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 53 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 54 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 55 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 56 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 57 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 58 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 59 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 60 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: 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 ''PayPal' at line 1Error No: 1064INSERT INTO `oc_order` (`order_id`, `invoice_no`, `invoice_prefix`, `store_id`, `store_name`, `store_url`, `customer_id`, `customer_group_id`, `firstname`, `lastname`, `email`, `telephone`, `fax`, `payment_firstname`, `payment_lastname`, `payment_company`, `payment_address_1`, `payment_address_2`, `payment_city`, `payment_postcode`, `payment_country`, `payment_country_id`, `payment_zone`, `payment_zone_id`, `payment_address_format`, `payment_method`, `payment_code`, `shipping_firstname`, `shipping_lastname`, `shipping_company`, `shipping_address_1`, `shipping_address_2`, `shipping_city`, `shipping_postcode`, `shipping_country`, `shipping_country_id`, `shipping_zone`, `shipping_zone_id`, `shipping_address_format`, `shipping_method`, `shipping_code`, `comment`, `total`, `order_status_id`, `affiliate_id`, `commission`, `language_id`, `currency_id`, `currency_code`, `currency_value`, `ip`, `forwarded_ip`, `user_agent`, `accept_language`, `date_added`, `date_modified`, `custom_field`, `payment_custom_field`, `shipping_custom_field`, `marketing_id`, `tracking`) VALUES ('45792', '0', '*', '0', '*', '*', '5', '1', '*', '*', '*', '*', '', '*', '*', '', '*', '', '*', '*', '*', '176', '', '0', '', 'PayPal ; in <b>/mnt/wwwhost/test-ar/system/library/db/mysqli.php</b> on line <b>49</b><b>Notice</b>: Undefined offset: 26 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 27 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 28 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 29 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 30 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 31 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 32 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 33 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 34 in <b>/mnt/wwwhost/test-ar/admin/model/tool/opencart.php</b> on line <b>158</b><b>Notice</b>: Undefined offset: 35 in <b>/mnt/wwwhost/test
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Thursday, June 18 2015, 08:59 PM - #Permalink
    the same in a file
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 18 2015, 09:20 PM - #Permalink
    Seems that all queries are missing the final closing )
    in the admin/model/tool/opencart.php on line 158

    e.g.:
    VALUES ('30', '29', '*', '*', '', '*', '', '*', '*', '176', '0';


    Where can I find this tool?
    Checked pekkas GH, but there is "only" his converter.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 18 2015, 09:54 PM - #Permalink
    That is located in the addons repository Michael https://github.com/arastta/addons
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 18 2015, 10:07 PM - #Permalink
    Thx, found it.
    Very short in time right now, but after a first look, the content (length) of $data_value is different than $data_key (line 106 and 117).
    That is why this error occures:
    Undefined offset: 27 in /mnt/wwwhost/test-ar/admin/model/tool/opencart.php on line 158


    Guess this will be reason why the closing ) is missing.
    Sorry, can not check right now, I am on the way.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 18 2015, 10:18 PM - #Permalink
    Thx Michael, will let Cüneyt check it by tomorrow ;)
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Thursday, July 09 2015, 04:29 PM - #Permalink
    I think, I've found the problem. You are using
    explode('(', $value);

    and if there are braces anywhere in text, the script will fail.

    BTW, why in the line 109 is $check = strpos($data_key[1], ")"); instead of $check = strpos($data_key[$i], ")");?
    for ($i = 0; $i < count($data_key); $i++) {
    $check = strpos($data_key[1], ")");
    if ($check !== false) {
    $var = explode(')', $data_key[$i]);
    $data_key[$i] = $var[0];
    }
    }
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, July 09 2015, 05:34 PM - #Permalink
    I've change lines 109, 119 and 183.

    Modified package attached please update package then test again.
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Thursday, July 09 2015, 09:54 PM - #Permalink
    This update don't solve the problem with braces and other such symbols in database (there are many in oc_orders, oc_settings). I've changed the script and it seems to be working for my data. I have only the problem with importing google analytics script, but it's easier to add this manually.

    Here is my model/opencart.php.

    I would say that is better way to make the changes directly in database, how it's done in Pekka's opencart 1.x -> 2.x converter.
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Saturday, July 11 2015, 12:51 PM - #Permalink
    I couldn't attach the file and forum banned me for a day :(
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, July 11 2015, 07:32 PM - #Permalink
    Have you tried to ZIP the file?
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Saturday, July 11 2015, 10:44 PM - #Permalink
    The same. Click on Reply and nothing happens.
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, July 11 2015, 11:12 PM - #Permalink
    What is the file size?
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Saturday, July 11 2015, 11:14 PM - #Permalink
    25 Kb or 4Kb in zip
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, July 12 2015, 04:14 AM - #Permalink
    Strange.. Can you please upload to file sharing sites and past the download link here so we could see it's content?
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Sunday, July 12 2015, 04:12 PM - #Permalink
    The reply is currently minimized Show
  • Accepted Answer

    Monday, July 13 2015, 07:55 AM - #Permalink
    That seems to be filtered by our firewall because of being a PHP file.

    Andrey, can you please send a Pull Request via GitHub so that we could evaluate it?

    https://github.com/arastta/addons/tree/master/tools/ext_opencart2_arastta

    Regards
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Tuesday, July 14 2015, 07:14 PM - #Permalink
    I've tried to do it. I'm not sure, because I'm not familiar with Git.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, July 15 2015, 06:52 PM - #Permalink
    If you allow me to upload your code, I can do that from my account.
    The reply is currently minimized Show
  • Accepted Answer

    Andrey
    Andrey
    Offline
    Wednesday, July 15 2015, 08:34 PM - #Permalink
    No problem, please do it.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, March 04 2016, 09:50 PM - #Permalink
    Tested the latest version of the migrator, and it failed with quite many errors.
    Found this topic and tested the file from Andrey, and it worked after removing Google Analytics code and
    TRUNCATE TABLE `__modification`;
    from the backup file.
    Hm ...
    The reply is currently minimized Show
  • Accepted Answer

    Monday, March 14 2016, 12:13 PM - #Permalink
    A few things I have noticed with the latest version:

    In _address and _order table, it doesn't handle commas and parenthesis (brackets) in the address fields.
    In _order table it doesn’t handle all browser and language info (user_agent and accepted_language).
    Also in _order table it fails on shipping_method data like 'Norway (Weight: 0.30kg)', probably the parenthesis again.
    Plus it fails if Google Analytics code is set in settings.

    For databases migrated from OC 1.5.6.4 to 2.1.0.1 it seems like it fails because of different field ordering in _order table.

    If modifications has added extra fields, it will probably fail also then, had to delete one in products table, added by a well known options extension ...
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 01 2016, 03:45 PM - #Permalink
    @Dennis Dulici, could you send me your code? I can PM you my email, but since you're admin I suppose you can already see it? ;)
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 01 2016, 03:51 PM - #Permalink
    @Jørn, the code is available at the Marketplace (install directly from admin) and GitHub.

    Here: https://extensions.arastta.pro/tools/opencart-2-migration
    And here: https://github.com/arastta/addons/tree/master/tools/ext_opencart2_arastta

    But you could also save you some possible trouble, and go for: https://arastta.org/migrate
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 01 2016, 04:02 PM - #Permalink
    I've installed the one from the markedplace, but it fails like in the OP... The changes on the extention in the GitHub repo seems to only have fixed some semantics?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 01 2016, 04:08 PM - #Permalink
    Then you have the code available, and if needed you can try to fix it and make a PR on GitHub.
    But I would rater used the migration service, especially if your OC is newer than 2.0.x

    Edit! Last time I used the script it had to be adjusted because extensions had added fields to tables etc, so they didn't match. Really not worth the hassle when there is a more automated service handling most of those issues.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 01 2016, 04:37 PM - #Permalink
    Actually my OC is 1.5.6. I assumed the extention would onlu work with v2 since it had 2 in it's name, but can it also be used on v1.5?

    If not, I might try the paid option
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 01 2016, 04:43 PM - #Permalink
    No, it's not for OC 1.5. Then you must upgrade to OC 2 first, before migrating to Arastta from there.
    Go for the migration service, going directly from OC 1.5 to Arastta, and save us all a lot of trouble. ;)
    The reply is currently minimized Show
  • Accepted Answer

    Friday, September 02 2016, 12:05 AM - #Permalink
    The reply is currently minimized Show
Your Reply