Post by marc_cole » Wed Jan 26, 2011 1:19 am

Qphoria wrote: anyway it's just a log ;)
True, but try reading a log with half of it underlined in green squiggles! ;)

I fixed it on my copy, so all's well that ends well.

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 Xsecrets » Wed Jan 26, 2011 1:54 am

marc_cole wrote:
Qphoria wrote: anyway it's just a log ;)
True, but try reading a log with half of it underlined in green squiggles! ;)

I fixed it on my copy, so all's well that ends well.
you know komodo has an option in the edit menu fix line endings that will remove all the green squiggles at once.

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 daymobrew » Wed Jan 26, 2011 2:02 am

I created a modification by copying the sample code at the top of vqmod.php and setting the attributes/parameters per the docs.
I left in regex="false" in <search> and my mod wasn't working. The target file was listed in the log as a file to be modified.

Then I removed regex="false" and it worked.
Maybe line 364 of vqmod.php need to check that $regex is true.

Code: Select all

if ($regex && !$this->testRegEx($search, "test string")) {
change to:

Code: Select all

if ($regex == true && !$this->testRegEx($search, "test string")) {

New member

Posts

Joined
Wed Dec 22, 2010 7:36 am

Post by Qphoria » Wed Jan 26, 2011 2:22 am

Ya this is the second time this week ive made that rookie mistake of assuming "false" = false. Im a dummy

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by marc_cole » Wed Jan 26, 2011 2:33 am

Xsecrets wrote:you know komodo has an option in the edit menu fix line endings that will remove all the green squiggles at once.
I know, but I'd have to do that pretty much every single time I viewed the log, which would get old fast. Anyway, I just wanted Q to know in case it was more widespread than just me. After changing my copy of the php file, I no longer have the problem. I just have to remember to make the change on all the updates. :-\

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 marc_cole » Wed Jan 26, 2011 2:43 am

One more suggestion and then I'll stop — for now. ;)

UTC time is hard-coded in vqmod.php

Code: Select all

date_default_timezone_set('UTC');
Could you code it to automatically retrieve the local time so that the timestamp in the log reflects that? I've manually changed that line to read:

Code: Select all

date_default_timezone_set('America/Los_Angeles');
but again, that's something I have to do with each revision.

Thanks.

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 » Wed Jan 26, 2011 2:48 am

marc_cole wrote:One more suggestion and then I'll stop — for now. ;)

UTC time is hard-coded in vqmod.php

Code: Select all

date_default_timezone_set('UTC');
Could you code it to automatically retrieve the local time so that the timestamp in the log reflects that? I've manually changed that line to read:

Code: Select all

date_default_timezone_set('America/Los_Angeles');
but again, that's something I have to do with each revision.

Thanks.
technically it should be pulled based on your php.ini setting for timezone.. but i was getting errors if that wasn't set so I just forced it to UTC for now. I was just going to remove the time stamp as I really only cared about the microseconds.
Perhaps I can check if the ini_get has the timezone set already and use that.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by marc_cole » Wed Jan 26, 2011 2:55 am

Qphoria wrote:I was just going to remove the time stamp as I really only cared about the microseconds.
I hope it doesn't get removed. It may be a moot point, but I like to see when it was last run.

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 Xsecrets » Wed Jan 26, 2011 3:28 am

yeah automatic timezone is quite the PITA in php it's virtually impossible to code it in a way that will work on every server setup.

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 daymobrew » Wed Jan 26, 2011 10:58 pm

I have downloaded a few extensions for my site and a number of them want to modify core files. With vqmod I am able to create xml files to do this.
I plan to submit my xml files to the module authors.

This is a fantastic module. Thank you for it.

New member

Posts

Joined
Wed Dec 22, 2010 7:36 am

Post by daymobrew » Thu Jan 27, 2011 6:21 am

Can I use vqmod to delete a block of code?

My theme's header.tpl has inline css. I would like to move it to a css file.
Obviously I can add a link to the external css file, but how do I delete the inline css code?

New member

Posts

Joined
Wed Dec 22, 2010 7:36 am

Post by Qphoria » Thu Jan 27, 2011 6:29 am

yep.. just search for the first line..
set the position="replace"
set the offset equal to the number of lines in the block minus the first line
set the <add> to just be empty. use trim="true" to ensure there are no spaces

Example. If i have this block of code that i want to remove:

Code: Select all

foreach ($download_query->rows as $download) {
    $download_data[] = array(
        'download_id' => $download['download_id'],
    );
}
I would search the first line, and use offset="4" to cover the remaining 4 lines:

Code: Select all

<operation>
    <search position="replace" offset="4"><![CDATA[
   foreach ($download_query->rows as $download) {
    ]]></search>
    <add trim="true"><![CDATA[
    ]]></add>
</operation>

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by daymobrew » Thu Jan 27, 2011 7:11 pm

Qphoria wrote:yep.. just search for the first line..
set the position="replace"
set the offset equal to the number of lines in the block minus the first line
set the <add> to just be empty. use trim="true" to ensure there are no spaces
Thanks.
BTW, it leaves blank lines instead of deleting them - just looks strange when I view source and see 41 blank lines.

Could the lines be removed with array_splice() ?
In applyMod():

Code: Select all

                    } elseif ($position == 'replace') { //replace
                        $existing_line = "";
                        if ($offset) {
							for ($i=0; $i<=$offset; $i++) {
								$filedata[$linenum + $i] = '';
							}
Replace the loop code with:

Code: Select all

if ($offset) {
array_splice($filedata, $linenum, $offset); // $filedata will be modified.
}

New member

Posts

Joined
Wed Dec 22, 2010 7:36 am

Post by Qphoria » Thu Jan 27, 2011 8:46 pm

I guess if it works.. a few empty lines never killed anyone (except that one time...)

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by tommyla » Fri Jan 28, 2011 9:48 pm

just my stupid future request, add it in opencart 1.5 by default, tweak the modules system to use it, so we can install xml file (upload), disable option and remove mods/modules all by using admin interface

atm its a mess to install mods etc that modify the core files, with vQmod this would fix alot of the problems, like re-add modified code when upgrading

anyway, vQmod makes life alot esier for people that want to run a store without needing to re-code it half of the time

Active Member

Posts

Joined
Wed Jul 22, 2009 9:49 pm
Location - Norway

Post by philbydevil » Sat Jan 29, 2011 6:58 am

I'm considering using vQmod, as I can see the enormous benefit of not editing core files. A couple of (hopefully) quick questions before I spend any time uploading and testing:

1. I've already edited some core files, is this a problem? Can I still use vQmod? (I'm thinking I can).
2. Once vQmod is installed, should I then go back and find all of the core files I've modified and create an xml for each mod? (I'm thinking yes).

Thanks.

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by Qphoria » Sat Jan 29, 2011 7:06 am

Yes and yes.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xsecrets » Sat Jan 29, 2011 7:20 am

for number two you don't have to, but it will make things easier in the future with upgrades and such.

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 philbydevil » Sat Jan 29, 2011 7:28 am

Cool, thanks. Will get started...

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by jty » Sat Jan 29, 2011 1:14 pm

I finally got around to looking at this vqmod thingy and ........ Holy Magic !!!! 'tis goooood
A big thank-you to Q
Last edited by jty on Sat Jan 29, 2011 9:30 pm, edited 2 times in total.

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am
Who is online

Users browsing this forum: No registered users and 141 guests