Page 1 of 1

error when try to upload extenion using extension installer in admin backend

Posted: Fri Jan 05, 2018 6:50 pm
by unhing3d
EDIT: Token removed...

When I try to install import/export tool ( https://www.opencart.com/index.php?rout ... _license=0)
I get the following message:

Code: Select all

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

OK

<b>Warning</b>: Invalid argument supplied for foreach() in <b>/var/www/vhosts/domain.com/httpdocs/admin/controller/marketplace/installer.php</b> on line <b>80</b><b>Warning</b>: Invalid argument supplied for foreach() in <b>/var/www/vhosts/domain.com/httpdocs/admin/controller/marketplace/installer.php</b> on line <b>95</b>{"text":"Installing","next":"https:\/\/www.domain.com\/admin\/index.php?route=marketplace\/install\/install&user_token=&extension_install_id=7"}

Re: error when try to upload extenion using extension installer in admin backend

Posted: Sat Jan 06, 2018 10:22 am
by IP_CAM
Export/Import Tool
https://www.opencart.com/index.php?rout ... sion_id=17
Well, the XML File contains an error, as I look at it, since it is not possible,
to add anything AFTER only the first part of a language Variable OcMod Anchor line, like this:
$_['text_backup']
This Language Definition OcMod Anchor line would have to look like this,
for the DEFAULT OC english Language Section at least, in the install.xml file:
$_['text_backup'] = 'Backup / Restore';
to place the OcMod Content correctly, to make it work.
---
So, better, MAKE the additional Language Variable to be inserted by OcMod
BEFORE

Code: Select all

$_['text_backup']
in the install.xml file, like this:

Code: Select all

<search><![CDATA[$_['text_backup']]]></search>
<add position="before"><![CDATA[
$_['text_export_import']             = 'Export / Import';
]]></add> 
and try to install it again, after FIRST clearing out your Modification
Section, to make sure, nothing from the old install attempt still exists.
---
But if you plan to keep this Extensions anyway, I would try to upload the OcMod ADMIN and
SYSTEM Directory with it's Content to the Shop Sub, by use of an FTP Client, and take the
OcMod Code out of the install.xml file, and place it directly into the Source Files, like in the File:
admin/controller/common/column_left.php
BEFORE THIS LINE:

Code: Select all

if ($this->user->hasPermission('access', 'tool/upload')) {
ADD THIS:

Code: Select all

if ($this->user->hasPermission('access', 'extension/export_import')) {
	$maintenance[] = array(
	'name'	   => $this->language->get('text_export_import'),
	'href'     => $this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], true),
	'children' => array()		
	);
} 
----------------------------------------------
and in the File:
admin/language/en-gb/common/column_left.php (english Language!)
BEFORE or AFTER THIS LINE :

Code: Select all

$_['text_backup'] = 'Backup / Restore';
ADD THIS:

Code: Select all

$_['text_export_import']             = 'Export / Import';
---
Just an idea, good Luck! ;)
Ernie

PS: And since the next Version OC will use different Code again, it really does not matter,
if existing OC Source Code is changed, it will be replaced by new Version Files anyway, just to have it said...

Re: error when try to upload extenion using extension installer in admin backend

Posted: Sat Jan 06, 2018 7:01 pm
by JNeuhoff
The install.xml file is fine, the OCMOD after attribute means to insert something after the line which has a match of the search expression. The search expression does not have to specify a whole line.

Re: error when try to upload extenion using extension installer in admin backend

Posted: Sun Jan 07, 2018 5:21 am
by IP_CAM
Well, this may be correct for OcMods, but my VqModded v.1.5.6.5 turns wild, if
I try such in a language File. It even produces some missing Variable Errors.
And I am working with VqMod 2.6.1...
Ernie

Re: error when try to upload extenion using extension installer in admin backend

Posted: Sun Jan 07, 2018 7:36 pm
by JNeuhoff
The same is true for VQmod: the after attribute means to insert after the line which has a match of the search expression. the search expression doesn't have to match the whole line.

Re: error when try to upload extenion using extension installer in admin backend

Posted: Wed Aug 07, 2019 5:02 am
by biga85
OpenCart 3.0.3.2 and php5.4.
First time trying to install ocmod extension there is error on line 80 (can't find file "somename.tmp" under /storage/upload/). Second time there is already a tmp file and then error is on line 95 (can't find directory "tmp-anytext" under /storage/upload/). I created this directory and problem solved. When checking if there is a directory it checks that directory is created 5 minutes before installation!
I bet that with php7 there is no such problems as foreach statement in php will see that array is empty and will skip foreach (maybe) but seems not in php5.4 at least.

Re: error when try to upload extenion using extension installer in admin backend

Posted: Wed Aug 07, 2019 5:34 am
by OSWorX
php 5.4 > throw it away as fast as you can!
And use 7.2.x at least.