0

Multiline Search in OCMOD

Multiline Search in OCMOD

Sometimes for making OpenCart mods is necessary to search multiline markers for a higher accuracy.

The fix adds a support of qoute attribute. The function preg_quote() uses it.

So, go to admin/controller/extension/modification.php. 

And 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);

Replace it to:

$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;

After:

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

Add this:

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

Don't forget to save the file and clear the cache.

The solution is found on opencartjazz.com