- Export / Import module
- Customer Testimonials Package
Each of these Opencart addons modifies the Opencart core files
admin/controller/common/header.php
admin/language/english/common/header.php
admin/view/template/common/header.tpl
and it works just fine!
Great tool!
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
When I turn it on, e.g. via a
Code: Select all
$vqmod->logging = TRUE;
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Code: Select all
.....
<file name="catalog/controller/product/category.php">
<operation>
<search position="before"><![CDATA[}
?>]]></search>
<add><![CDATA[
private function startsWith( $haystack, $needle ) {
if (strlen( $haystack ) < strlen( $needle )) {
return FALSE;
}
return (substr( $haystack, 0, strlen($needle) ) == $needle);
}
]]></add>
</operation>
</file>
......
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
You appear to be using a multiline search. I assume you are trying to match:JNeuhoff wrote:Another bug:
I am trying to add another function to catalog/controller/product/category.php, like this:
It won't do it, nor does it log an error message.Code: Select all
<search position="before"><![CDATA[} ?>]]></search>
Code: Select all
}
?>
You will need to use the offset feature. You can do it a few different ways, but since it looks like its the end of the file, try:
<search position="bottom" offset="1"></search>
you can leave the contents blank as bottom assumes the last line of the file, and offset means go up 1 line and add the code before that line.
I will see about improving the logging for that.
Code: Select all
....
<file name="catalog/controller/product/category.php">
<operation>
<search position="bottom" offset="2"></search>
<add><![CDATA[
private function startsWith( $haystack, $needle ) {
if (strlen( $haystack ) < strlen( $needle )) {
return FALSE;
}
return (substr( $haystack, 0, strlen($needle) ) == $needle);
}
]]></add>
</operation>
</file>
.....
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
May be something like in the following example:
Code: Select all
<operation>
<search position="replace" offset="1" range="5"><![CDATA[public function xyz() {]]></search>
<add><![CDATA[
..... replacement lines ...
]]></add>
</operation>
- Replace the following 5 lines with some new code.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
This is already part of the replace offset ability.JNeuhoff wrote:Is there an ability to replace multiple lines by some added code?
May be something like in the following example:
- Search for the line containing 'public function xyz() {'.Code: Select all
<operation> <search position="replace" offset="1" range="5"><![CDATA[public function xyz() {]]></search> <add><![CDATA[ ..... replacement lines ... ]]></add> </operation>
- Replace the following 5 lines with some new code.
I do this here:
http://forum.opencart.com/viewtopic.php ... 48#p123509
Take a look at this example:
I want to replace:
Code: Select all
public function query($sql) {
return $this->driver->query($sql);
}
Code: Select all
public function query($sql) {
$result = $this->driver->query($sql);
$exec_time = (time() + microtime());
$exec_time = round($exec_time - $query_time, 4);
$_SESSION['query_total_time'] += $exec_time;
}
Code: Select all
<search position="replace" offset="2"><![CDATA[
public function query($sql) {
]]></search>
Then inserts the new code at the originally replaced line. The replace is handled differently in the code where the offset works as a range delete, and then new code is added in place of it
Thanks, good to know it can be done.This finds the first line of that function.... then removes that line plus the next 2 lines from the offset.
Then inserts the new code at the originally replaced line. The replace is handled differently in the code where the offset works as a range delete, and then new code is added in place of it
I am in the process of switching my own website to the Opencart framework, and the VQMod comes in quite handy. I installed several modules which were modifying some of the same Opencart core files, and with a few tweaks in the category.php / category.tpl specified in the VQMod XML file I can also use the system as a simple CMS. Upgrading the system to future releases of Opencart will now be a lot easier!
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Ive got the xml generator almost done. Just adding the jquery for adding multiple files and operations. That should make it even easier to make then.
BTW, you've got me beat. I only have 15 mods.
Marc
OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English
VQMod is limited to what passes through the php engine. Stylesheets are simply passed through and rendered directly from the browser so you can't change those. But you can change the tpl file that calls the stylesheet. So if you make your own stylesheet, you modify themarc_cole wrote:Will we be able to modify CSS stylesheets anytime soon with VQMod?
<link rel="stylesheet" src="xxxxxxx">
line in the tpl
I have an XML file where it ignores an <operation> , probably due to some unknown error, yet it doesn't log anything, making it hard to track down the error cause.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Users browsing this forum: No registered users and 153 guests