[MOD] - VirtualQMod "vQmod" Virtual File Modification System
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
uksitebuilder wrote:I only downloaded it liek 5 hours ago - has it been updated since then ?
hmm no. Does the vqmod.log show any errors? If it hits an error and it isn't set to "skip" then it will revert the entire file to the normal version

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
there were a couple of skip errors but only on vqmod default scripts
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
And what were the errors . . .

Better Product SEO URL's - Perfectly structured product links
Better Category SEO URL's - Give subcategories the same SEO keyword
SEO URL's Route Editor - Fix all of your index.php links

-

JAY6390 - Posts: 4634
- Joined: Wed May 26, 2010 3:47 pm
- Location: United Kingdom
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
- Code: Select all
2011-06-13 20:56:53.9483870 - SOURCEFILE: htdocs/opencart/system/engine/controller.php
2011-06-13 20:56:53.9483940 - MODFILE: htdocs/opencart/vqmod/xml/vqmod_opencart.xml
2011-06-13 20:56:53.9484000 - TEMPFILE: htdocs/opencart/vqmod/vqcache/vq-system_engine_controller.php
2011-06-13 20:56:53.9487860 - OPERATION...
2011-06-13 20:56:53.9487950 - ERROR:
2011-06-13 20:56:53.9488010 - SEARCH: if (file_exists($file)) {
2011-06-13 20:56:53.9488070 - POSITION: before
2011-06-13 20:56:53.9488130 - OFFSET:
2011-06-13 20:56:53.9488180 - INDEX:
2011-06-13 20:56:53.9488240 - REGEX:
2011-06-13 20:56:53.9488300 - ADD: global $vqmod; $file = $vqmod->modCheck($file);
2011-06-13 20:56:53.9490100 - OPERATION COMPLETED SUCCESSFULLY!
2011-06-13 20:56:53.9490680 - OPERATION...
2011-06-13 20:56:53.9490750 - ERROR: skip
2011-06-13 20:56:53.9490810 - SEARCH: if (file_exists(DIR_TEMPLATE . $this->template)) {
2011-06-13 20:56:53.9490870 - POSITION: replace
2011-06-13 20:56:53.9490920 - OFFSET:
2011-06-13 20:56:53.9490980 - INDEX:
2011-06-13 20:56:53.9491040 - REGEX:
2011-06-13 20:56:53.9491090 - ADD:
global $vqmod;
$file = $vqmod->modCheck(DIR_TEMPLATE . $this->template);
if (file_exists($file)) {
2011-06-13 20:56:53.9492600 - OPERATION COMPLETED SUCCESSFULLY!
2011-06-13 20:56:53.9493170 - OPERATION...
2011-06-13 20:56:53.9493240 - ERROR: skip
2011-06-13 20:56:53.9493300 - SEARCH: exit('Error: Could not load template ' . DIR_TEMPLATE . $this->template . '!');
2011-06-13 20:56:53.9493360 - POSITION: replace
2011-06-13 20:56:53.9493410 - OFFSET:
2011-06-13 20:56:53.9493470 - INDEX:
2011-06-13 20:56:53.9493530 - REGEX:
2011-06-13 20:56:53.9493580 - ADD: exit('Error: Could not load template ' . $file . '!');
2011-06-13 20:56:53.9495040 - OPERATION COMPLETED SUCCESSFULLY!
2011-06-13 20:56:53.9495590 - OPERATION...
2011-06-13 20:56:53.9495660 - ERROR: skip
2011-06-13 20:56:53.9495720 - SEARCH: require(DIR_TEMPLATE . $this->template);
2011-06-13 20:56:53.9495780 - POSITION: replace
2011-06-13 20:56:53.9495830 - OFFSET:
2011-06-13 20:56:53.9495890 - INDEX:
2011-06-13 20:56:53.9495950 - REGEX:
2011-06-13 20:56:53.9496000 - ADD: require($file);
2011-06-13 20:56:53.9497500 - OPERATION COMPLETED SUCCESSFULLY!
2011-06-13 20:56:53.9498690 - TEMPFILE UPDATED WITH MODIFIED CODE
2011-06-13 20:56:53.9499090 - SUBSTITUTION COMPLETE!
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
not errors now I look at it, more commands to skip any errors.
I just rtied a really simple xml file and even removed the two that were working in case for some reason there was a limit on the number of xml files
but the following simply created a duplicate of the original too.
I just rtied a really simple xml file and even removed the two that were working in case for some reason there was a limit on the number of xml files
but the following simply created a duplicate of the original too.
- Code: Select all
<modification>
<id>Header Change</id>
<version>1.0</version>
<vqmver>1.1.0</vqmver>
<author>uksb</author>
<file name="catalog\view\theme\default\template\common\header.tpl">
<operation>
<search position="replace"><![CDATA[
<link href="<?php echo $icon; ?>" rel="icon" />
]]></search>
<add trim="true"><![CDATA[
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $icon; ?>" />
]]></add>
</operation>
</file>
</modification>
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
I think I have figured it out - haven't tested yet, but seems I was copying the file path's from BeyondCompare and instead of forward slashes BC uses backslashes in the file path.
Coincidence, I think not. Will test and advise if it is now working.
Strange though that duplicates of the original files were being created in the cache.
Coincidence, I think not. Will test and advise if it is now working.
Strange though that duplicates of the original files were being created in the cache.
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
Just tested and it is working now. seems it was the backslashes after all!
Apologies.
Apologies.
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
There is a little bug in VQmod 1.1.0. The replace function adds an additional trailing space character to the replacement, as in the following example:
While it doesn't hurt in above given example, there could be cases where it becomes relevant to have a precice replacement string, as specified in the replacement operation.
- Code: Select all
<file name="admin/model/catalog/information.php">
<operation>
<search position="replace"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET ]]></search>
<add><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET meta_description = '".$data['meta_description']."', meta_keywords = '".$data['meta_keywords']."', ]]></add>
</operation>
</file>
While it doesn't hurt in above given example, there could be cases where it becomes relevant to have a precice replacement string, as specified in the replacement operation.
J.Neuhoff - MHC Web Design
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
-

JNeuhoff - Posts: 2113
- Joined: Tue Dec 04, 2007 7:38 pm
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
JNeuhoff wrote:There is a little bug in VQmod 1.1.0. The replace function adds an additional trailing space character to the replacement, as in the following example:
- Code: Select all
<file name="admin/model/catalog/information.php">
<operation>
<search position="replace"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET ]]></search>
<add><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET meta_description = '".$data['meta_description']."', meta_keywords = '".$data['meta_keywords']."', ]]></add>
</operation>
</file>
While it doesn't hurt in above given example, there could be cases where it becomes relevant to have a precice replacement string, as specified in the replacement operation.
That is why there is the trim="true" attribute for <add>
RTFM

No bug

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
Works with <add trim="true"> though it kind of defeats the purpose of using <
JNeuhoff - Posts: 2113
- Joined: Tue Dec 04, 2007 7:38 pm
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
JNeuhoff wrote:Works with <add trim="true"> though it kind of defeats the purpouse of using <![CDATA[ which is supposed to leave the string unchanged.
touche, tho in your example above there IS a space after the comma and before the ]]. If you remove that space does it still add the space?
Thinking about it now, the replace command simply uses "str_replace" so there is no way it could add additional spaces on its own. the trim attribute is usually only needed for before or after positioning as it creates a new line which may include an extra carriage return if another line before it was already a blank line.

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
Qphoria wrote:touche, tho in your example above there IS a space after the comma and before the ]]. If you remove that space does it still add the space?
yes, the space after the comma is there on purpose. If I remove that space, it still adds one after the replacement which it shouldn't. If I keep the space, it ends up with 2 spaces after the replacement instead of the original single one.
J.Neuhoff - MHC Web Design
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
-

JNeuhoff - Posts: 2113
- Joined: Tue Dec 04, 2007 7:38 pm
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
Is it possible that there is an extra space in the original file itself? I know there are a lot of places that have extra tabs and spaces at the end of the in the core. As I said above, the replace command uses the php function "str_replace" so I dont see any way for an extra space to occur.

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
Qphoria wrote:Is it possible that there is an extra space in the original file itself? I know there are a lot of places that have extra tabs and spaces at the end of the in the core. As I said above, the replace command uses the php function "str_replace" so I dont see any way for an extra space to occur.
No, there is only one space after the comma, see attached file which I am working on for one of my opencart-based projects.
- Attachments
-
information.xml.zip- (962 Bytes) Downloaded 43 times
J.Neuhoff - MHC Web Design
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
-

JNeuhoff - Posts: 2113
- Joined: Tue Dec 04, 2007 7:38 pm
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
JNeuhoff wrote:Qphoria wrote:Is it possible that there is an extra space in the original file itself? I know there are a lot of places that have extra tabs and spaces at the end of the in the core. As I said above, the replace command uses the php function "str_replace" so I dont see any way for an extra space to occur.
No, there is only one space after the comma, see attached file which I am working on for one of my opencart-based projects.
FYI, your closing tag is wrong in the .xml file

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
Sorry, yes, it should have been </modification>.
Howver, the problem is still there with the additional blank.
I looked at your vqmod.php file. By the time it reaches the line at
the blank character is already chopped off. $search contains
"$this->db->query("INSERT INTO " . DB_PREFIX . "information SET"
instead of
"$this->db->query("INSERT INTO " . DB_PREFIX . "information SET "
while the variable $add is correct. I think the $search is wrong because it is set like this in vqmod.php:
Howver, the problem is still there with the additional blank.
I looked at your vqmod.php file. By the time it reaches the line at
- Code: Select all
$filedata[$linenum] = str_replace($search, $add, $filedata[$linenum]);
the blank character is already chopped off. $search contains
"$this->db->query("INSERT INTO " . DB_PREFIX . "information SET"
instead of
"$this->db->query("INSERT INTO " . DB_PREFIX . "information SET "
while the variable $add is correct. I think the $search is wrong because it is set like this in vqmod.php:
- Code: Select all
$search = trim($operation->getElementsByTagName('search')->item(0)->nodeValue);
J.Neuhoff - MHC Web Design
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
-

JNeuhoff - Posts: 2113
- Joined: Tue Dec 04, 2007 7:38 pm
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
yea i saw this too.. because I ALWAYS trim $search.. the reason I always trim search is to offset the way people format their tags... for readability sake I always use:
Keeping the code separate from the tags. If i didn't trim then it would be searching for
Technically tho you are right that cdata should be the exact string.. but i made it lax.
That said, it would be detrimental for existing mods to have to go back and fix their xml files to follow the strict rules of cdata. Instead it will just have to be lax and keep in mind that you shouldn't try to match trailing spaces. Perhaps I can add an attribute for the search trim="false"
- Code: Select all
<search position="after"><![CDATA[
'ups_status',
]]></search>
Keeping the code separate from the tags. If i didn't trim then it would be searching for
- Code: Select all
\n'ups_status',\n
Technically tho you are right that cdata should be the exact string.. but i made it lax.
That said, it would be detrimental for existing mods to have to go back and fix their xml files to follow the strict rules of cdata. Instead it will just have to be lax and keep in mind that you shouldn't try to match trailing spaces. Perhaps I can add an attribute for the search trim="false"

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
You could instead remove leading and trailing whitespaces like \n and \r only, e.g.
- Code: Select all
$search = trim($operation->getElementsByTagName('search')->item(0)->nodeValue,"\n\r");
J.Neuhoff - MHC Web Design
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
-

JNeuhoff - Posts: 2113
- Joined: Tue Dec 04, 2007 7:38 pm
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
Qphoria wrote:Perhaps I can add an attribute for the search trim="false"
That to me sounds like the ideal solution

Better Product SEO URL's - Perfectly structured product links
Better Category SEO URL's - Give subcategories the same SEO keyword
SEO URL's Route Editor - Fix all of your index.php links

-

JAY6390 - Posts: 4634
- Joined: Wed May 26, 2010 3:47 pm
- Location: United Kingdom
Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy
Let's make it a vqmod version 1.1.1 then:
- Code: Select all
final class VQMod {
private $vqversion = '1.1.1'; // Current version for logging
......
.....
if ($version < $this->vqversion) {
$search = trim($operation->getElementsByTagName('search')->item(0)->nodeValue);
} else {
$search = trim($operation->getElementsByTagName('search')->item(0)->nodeValue,"\n\r");
}
.....
J.Neuhoff - MHC Web Design
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
OpenCart Override Engine (Version 5.3)
allowing addons to override and modify core methods, language files and templates (see also FAQ)
-

JNeuhoff - Posts: 2113
- Joined: Tue Dec 04, 2007 7:38 pm
Who is online
Users browsing this forum: shimele and 10 guests













