There is several hotfixes which might help if you encounter problems trying to use Opencart 2 Extension Installer feature. The "Multiline fix" adds feature that widely used in our XML modifications, so you should made changes described in "Multiline fix" section if you plan to use our extensions.

OCMOD Multiline fix

We extended OCMOD regex mode by adding "quote" (bool) parameter to regex search/replace mode. This hack enables searching replacement place in sources using multiple lines of source code. The hack is simple, only 2 places with minimum changes. When this switch set to true, the preg_quote function used:

preg_quote() takes str and puts a backslash in front of every character that is part of the regular expression syntax. This is useful if you have a run-time string that you need to match in some text and the string may contain special regex characters.

The special regular expression characters are:

. \ + * ? [ ^ ] $ ( ) { } = ! < > | : -

This makes possible to use preg for multiline replaces. It leaves standard mode as is, and just adds another mode (multiline).

To apply the hack to Opencart 2.0.1.1, open the file admin/controller/extension/modification.php and go to the line #307. You will see

} else {
    $search = $operation->getElementsByTagName('search')->item(0)->textContent;
    $limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
    $replace = $operation->getElementsByTagName('add')->item(0)->textContent;

where you must add one line (after "$limit = ..."):

} else {
    $search = $operation->getElementsByTagName('search')->item(0)->textContent;
    $limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
    $quote = $operation->getElementsByTagName('search')->item(0)->getAttribute('quote');
    $replace = $operation->getElementsByTagName('add')->item(0)->textContent;

And after

// Limit
if (!$limit) {
    $limit = -1;
}

Add:

// Quote
if ($quote == 'true') {
    $search = preg_quote($search);
}

Thats all.

Change length of Modifications XML database field

Opencart stores XML text of modifications in the database. The length of the field is limited: we had problem on module which changes lots of template files. So we propose to apply install.sql, this will fix issue and enable work of big modifications.

ALTER TABLE `oc_modification` CHANGE COLUMN `xml` `xml` MEDIUMTEXT NOT NULL;

OC2 extension installer bugfix

If you receive "JSON Error" messages trying to use Extension Installer -- try this hotfix. Do not apply it if your extension installer works correctly after specifying FTP account credentials in store settings.

  • fix "PHP Warning: Invalid argument supplied for foreach() ... on line 333";
  • prevent "PHP Warning: ftp_mkdir(): Create directory operation failed ... on line 338" (when existing directories created: catalog, admin, admin/controller, etc.);
  • prevent "PHP Warning: ftp_put(): Illegal PORT command ... on line 345"
Compatibility
Opencart 1.5.x No
Opencart 2.0 Opencart 2.0.1.1, 2.0.2.0, 2.0.3.1
Overwrite files Provided DIFF and/or set of changed files
2016-12-23

Подскажите пожалуйста как скачать это дополнение, то ли заработался и где то не дочитал но не пойму есть описание но ни ссылки на скачивание ни покупку ничего не нашел. простите возможно за глупый вопрос... Заранее благодарен за помощь и ответ.


----

В описании все изменения. Там всего 2 раза нажать Ctrl-C и дважды вставить Ctrl-V. Я не писал для этого модуль. И кнопка убрана, потому что файлов никаких нет.

2016-09-16

Опишите хоть в 2-х словах как пользоваться новыми атрибутами!

2016-04-01

совместим с ocStore 2.1.0.2

2015-09-28

If module you use require the Multiline fix or you want to use multiline search patterns in your OcMod extensions - you need this fix. If not - it not required.

In 2.0.3.1 you need to find

$search = trim($operation->getElementsByTagName('search')->item(0)->textContent);
$limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
$replace = trim($operation->getElementsByTagName('add')->item(0)->textContent);

and replace it with next code:

$search = trim($operation->getElementsByTagName('search')->item(0)->textContent);
$limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
$quote = $operation->getElementsByTagName('search')->item(0)->getAttribute('quote');
$replace = trim($operation->getElementsByTagName('add')->item(0)->textContent);

2015-09-25

Is it required to install OCMOD Multiline fix in Open Cart 2.0.3.1 ?
I downloaded the file modification.php from admin/controller/extension/modification.php but the file does not contain the text which you have suggested to change.
Here it shows $trim = $operation->getElementsByTagName('search')->item(0)->getAttribute('trim');
instead of
$limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
Please suggest how to proceed.

Write a review

Note: HTML is not translated!
    Bad           Good

Opencart 2.0.1.1 bugfix: OC2 Extension installer

  • Brand: OpencartJazz
  • Product Code: oc2011-bugfix-extension-installer
  • Availability: No files
  • Free

Related Products