Post by JNeuhoff » Tue Jan 04, 2011 8:48 am

I have created and tested some vqmod XML files for:

- 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! 8)

MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Qphoria » Tue Jan 04, 2011 9:43 am

Excellent to hear :)

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by kedgetech » Tue Jan 04, 2011 12:21 pm

Excellent work Q. Would save us a ton of time.

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by Qphoria » Tue Jan 04, 2011 1:25 pm

Should have the xml generator form done this week to make it even easier to make vqmod .xml files

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JNeuhoff » Wed Jan 05, 2011 5:33 am

The logging still seems to have problems:

When I turn it on, e.g. via a

Code: Select all

$vqmod->logging = TRUE;
It will only create log entries when processing the vqmod/vqmod_opencart.xml , not for any of the other XML files.

MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Qphoria » Wed Jan 05, 2011 6:21 am

Actually I'm seeing in some cases when logging is FALSE that this happens. It happens on my linux box but not on my windows box. It is weird.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JNeuhoff » Wed Jan 05, 2011 6:27 am

I am trying to add another function to catalog/controller/product/category.php, like this:

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>
......
It won't do it, nor does it log an error message.

MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Qphoria » Wed Jan 05, 2011 6:36 am

JNeuhoff wrote:Another bug:

I am trying to add another function to catalog/controller/product/category.php, like this:

Code: Select all

<search position="before"><![CDATA[}
?>]]></search>
It won't do it, nor does it log an error message.
You appear to be using a multiline search. I assume you are trying to match:

Code: Select all

    }
?>
You can't do multiline searches.

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.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JNeuhoff » Wed Jan 05, 2011 6:45 am

Using the offset attribute solved the problem. it is now working:

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>
.....
Thanks a lot.

MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Xsecrets » Wed Jan 05, 2011 10:55 am

I just found it easiest to search for the class line and add it after since it really doesn't matter what order the functions are in.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Qphoria » Wed Jan 05, 2011 11:01 am

Yea. Its nice that there are so many different ways to mod it.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JNeuhoff » Thu Jan 06, 2011 7:40 pm

Is there an ability to replace multiple lines by some added code?

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>
- Search for the line containing 'public function xyz() {'.
- Replace the following 5 lines with some new code.

MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Qphoria » Thu Jan 06, 2011 8:45 pm

JNeuhoff wrote:Is there an ability to replace multiple lines by some added code?

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>
- Search for the line containing 'public function xyz() {'.
- Replace the following 5 lines with some new code.
This is already part of the replace offset ability.
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);
} 
with:

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;
}
So I would use

Code: Select all

<search position="replace" offset="2"><![CDATA[
public function query($sql) {
]]></search>
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

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by lrombes » Sat Jan 08, 2011 3:41 am

Q,

I was looking at the VirualQMod_Readme file and in the second paragraph it says to drop files in the /vmod/ folder. Is this correct or should it be /vqmod/? version 1.0.5.

Newbie

Posts

Joined
Sat Sep 18, 2010 12:10 am

Post by Qphoria » Sat Jan 08, 2011 3:54 am

vqmod.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JNeuhoff » Sat Jan 08, 2011 6:09 am

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
Thanks, good to know it can be done.

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!

MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Qphoria » Sat Jan 08, 2011 6:49 am

Hurrah! I now have 32 mods on my live site using vqmod. Ive been including vqmod options with all my latest mod updates that require core modifications. I only use vqmod now for modifications.

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.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by marc_cole » Sat Jan 08, 2011 9:32 am

Looking forward to it! Will we be able to modify CSS stylesheets anytime soon with VQMod?

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


Active Member

Posts

Joined
Tue Dec 14, 2010 11:26 am
Location - Seattle, WA

Post by Qphoria » Sat Jan 08, 2011 9:35 am

marc_cole wrote:Will we be able to modify CSS stylesheets anytime soon with VQMod?
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 the
<link rel="stylesheet" src="xxxxxxx">
line in the tpl

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JNeuhoff » Sat Jan 08, 2011 10:30 pm

There is still the some issue of not doing the logging correctly.

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.

MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 5 guests