Post by JNeuhoff » Sun Feb 16, 2014 3:17 am

OpenCart 2.0 uses its own XML-based modification system which is basically just a series of inline search/add operations for the 'before', 'after', and 'replace' positions for a whole target file. It uses a different XML syntax, and has none of the many additional features provided by VQmod 2.4.1, such as the regex-attribute, the offset-attribute, the error-attribute, the trim-attribute, etc.

I have therefore added a full VQmod 2.4.1 support to the OpenCart 2.0 system/engine/modification.php file. I have asked Daniel whether he's interested in adding it to this core OpenCart 2.0 Modification class. If he doesn't, and if there is enough interest, I can also release it as a free extension. Please let me know.

BTW.:
Handling an OpenCart 2.0 modification is quite different from previous 1.5.x versions. There is no vqmod folder. Instead, any xml-file needs to be to uploaded via the OpenCart 2.0 extension installer at
  • admin > Extensions > Extension Installer > Upload
The XML file will then be stored into the database. The modification has to be activated once via
  • admin > Extensions > Modifications > refresh
All the modified target files will then show up in the system/modification folder, this is the new equivalent of the old vqmod/vqcache folder (the latter is not used anymore).

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by ocx » Mon Feb 17, 2014 6:23 am

I have therefore added a full VQmod 2.4.1 support to the OpenCart 2.0 system/engine/modification.php file. I have asked Daniel whether he's interested in adding it to this core OpenCart 2.0 Modification class. If he doesn't, and if there is enough interest, I can also release it as a free extension. Please let me know
You have our vote for making it available for 2.0. Many of us have come to rely on all the features vQmod offers. Anything less than that would seem futile.

User avatar
ocx
New member

Posts

Joined
Sun Apr 07, 2013 5:22 am

Post by Cue4cheap » Mon Feb 17, 2014 6:36 am

I have found VQmod very easy and indispensable. Unless the new way in 2.0 is like VQmod I think we really need VQmod still.
Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by rph » Mon Feb 17, 2014 7:41 am

I wish OpenCart was getting its own hooking system. To the credit of vQmod, you can do a heck of a lot with it. But so many times it feels like pushing it way past what vQmod was ever meant for. Templating is troublesome to the point it's often easier to insert jQuery into a page and have that code make the DOM changes. If you're making database changes such as adding tables you'll have to shoehorn code to check for them over and over again in the model somewhere. And I don't know if 2.0 changes this, but there's no real central area to put mod settings.

I do agree that if you're going to add vQmod as OpenCart's baked-in modification method it's best to stick with the default as much as possible. vQmod has years of active development and experience behind it. There isn't a pressing need to re-invent the wheel.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by JNeuhoff » Mon Feb 17, 2014 6:58 pm

OK, for those who want to test it out:
Now you are ready to upload your own VQmod XML files via the
  • admin > Extensions > Extension Installer
After each upload don't forget to go to
  • admin > Extensions > Modifications
and then to click on the Refresh button.

That's it!

Remember OpenCart 2.0 is still work in progress before the final release by Daniel!

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by JNeuhoff » Mon Feb 17, 2014 7:07 pm

rph wrote:I wish OpenCart was getting its own hooking system.
That's why we wrote the Override Engine which allows you to extend most controller and model classes and then override their methods with your own ones. More flexible than a hooking system.

However, modifying templates is still the most cumbersome bit, I am still looking for a better solution for this.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Qphoria » Wed Feb 19, 2014 4:46 am

JNeuhoff wrote:
rph wrote:I wish OpenCart was getting its own hooking system.
That's why we wrote the Override Engine which allows you to extend most controller and model classes and then override their methods with your own ones. More flexible than a hooking system.

However, modifying templates is still the most cumbersome bit, I am still looking for a better solution for this.
Agreed.. I wish that either the Override Engine was being merged into the core and vQmod left external as it has always been. The Override Engine or a proper hook system is something that a core should offer where as vQmod was just created in lieu of a proper system. vQmod still absolutely has its place but I really don't see the point of adding a de-featured wannabe version of it when a properly defined system with design regulations and usage could be added.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JNeuhoff » Wed Feb 19, 2014 5:08 am

Qphoria wrote: Agreed.. I wish that either the Override Engine was being merged into the core
We already have an OpenCart 2.0 fork which has both a vQmod 2.4.1 compatible modification system AND the Override Engine fully integrated. Will try to merge future changes from the original OpenCart master branch to this fork (might have to reload it a few times because git is a nightmare to use)

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by rph » Sat Feb 22, 2014 1:13 am

JNeuhoff wrote:
This is a bit off-topic, but I don't understand why the decision was made to use the modification system to make these changes rather than just coding them into the core. It makes sense that vQmod does it that way but there's no reason for OpenCart to.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by JNeuhoff » Sat Feb 22, 2014 1:26 am

rph wrote:
JNeuhoff wrote:
This is a bit off-topic, but I don't understand why the decision was made to use the modification system to make these changes rather than just coding them into the core. It makes sense that vQmod does it that way but there's no reason for OpenCart to.
It actually makes sense, because you may not want to use the modification system, in which case you'd just do a
  • admin > Extensions > Modifications > clear
The system/modification.xml is the equivalent of vqmod/xml/vqmod_opencart.xml, and is only activated by a
  • admin > Extensions > Modifications > refresh

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by rph » Sat Feb 22, 2014 2:55 am

I admittedly haven't looked into OpenCart's system too deeply but from what I see it's impossible to disable the modification system on the application layer. Disabling modification.xml would just give you a system where the library application files were being modified but the framework and its extended classes weren't.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by JNeuhoff » Sat Feb 22, 2014 3:07 am

After you do a

admin > Extensions > Modifications > refresh

you get the following modified classes in system/modication, to be used instead of the normal counterparts:
  • system_engine_controller.php
  • system_engine_front.php
  • system_engine_loader.php
  • system_library_config.php
  • system_library_language.php
  • system_startup.php
I think the only hard-coded $modification->getFile(...) calls are in index.php and admin/index.php.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by rph » Sat Feb 22, 2014 4:24 am

Yes, the application files will always be modded since it's hardcoded in the index.php files but the framework files would not. A half-running modding system could definitely lead to issues.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by JNeuhoff » Mon May 05, 2014 10:54 pm

I have modified the admin/controller/extension/modification.php (OpenCart master branch) to support VQmod 2.4.1 compatible XML for modifications and tested it with some XML files. In case anybody is interested, get the file from here.
Last edited by JNeuhoff on Tue Aug 26, 2014 2:18 am, edited 6 times in total.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by JAY6390 » Thu May 15, 2014 6:30 am

+1 - starred the repo for future ref. I still need to look into this fully as I've barely touched 2.0 since it was getting its admin makeover. It's good to see so many people are still behind vQmod and completely agree that it's a little pointless adding in this new mod system. I had been toying a while back with something to let you add hooks to the whole mvc essentially - but on the whole the override system does it better so I scrapped it. It would have been nice to have some discussions and changes made to the core for 2.0, not just reusing the old code and dressing it up a bit. Seems a bit of a fruitless effort. Hopefully the full release will be worth the wait. Only time will tell. Out of interest, could you tell me JNeuhoff why v2.0 and just a standard install of vQmod wouldn't work?

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by rph » Thu May 15, 2014 1:15 pm

JAY6390 wrote:It would have been nice to have some discussions and changes made to the core for 2.0, not just reusing the old code and dressing it up a bit. Seems a bit of a fruitless effort.
I couldn't agree more. An RFC process like the PHP development group uses would have been nice. Stuff like tightly integrating Bootstrap into the theme instead of using mixins is really going to cause problems for designers and developers down the road and it doesn't seem like there's much we can do about it.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by JNeuhoff » Thu May 15, 2014 5:35 pm

Out of interest, could you tell me JNeuhoff why v2.0 and just a standard install of vQmod wouldn't work?
I thought about it. However, since OpenCart 2.0 already has a nice extension installer, as well as the equivalent of a VQmod manager (admin/controller/extension/modificiation.php), I just focused on adding the VQmod XML syntax to the modification.php.

As regards Daniel's modification XML: I had discussions on this with Daniel on github, and I still think Daniel's modification features aren't sufficient for real world complex modifications. For one thing, his OCMOD treats the target file to be modified like a single string buffer, whereas VQMOD treats it as an array of lines. Because of this, in Daniel's modification system, the position attribute (with values after/before) are processed more like VQmod's iafter/ibefore, but for the whole string buffer. And Daniel's modification system does not have any equivalent of the important VQmod offset attribute (there is an attributes in his latest version called offset and limit, but they work more like VQmod's index attribute, Daniel just renamed index to offset!)
I had been toying a while back with something to let you add hooks to the whole mvc essentially - but on the whole the override system does it better so I scrapped it.
I already have the Override Engine ported to OpenCart 2.0. Extending classes and overriding methods is more flexible than using hooks. I am thinking of creating a fork with a VQmod-modification and Override Engine already included in the framework once OpenCart 2.0 is released.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by JAY6390 » Thu May 15, 2014 6:36 pm

I see - thanks for the clarification. The plan (when I first found out about the new mod system) was to get the new mod system to be vqmoded to run its files through vqmod instead - however the fact it stores xmls in the database and not in files hinders this signifcantly. It's good to know that a standard installation of vQmod will work with 2.0 (I assume), albeit not in sync with the new one. I suspect that the new system will be simply left alone and vqmods used still unless the features you've said aren't there get added to it. no regex or even before/after is going to make it pretty useless though since you're going to be limited to some very basic changes

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by DSGI » Thu May 22, 2014 9:14 pm

Hey Jay -

I've tired to use VQmod locally on my 2.0 install with PDO but everything breaks when installing VQmod on V2.0, do you have plans to make VQmod compatible with 2.0? Any timeframe on that?

Thanks!

DSGI

New member

Posts

Joined
Wed Feb 08, 2012 5:28 pm

Post by JAY6390 » Thu May 22, 2014 9:18 pm

until 2.0 is released there's no point bothering to work on it really since anything can change. At that point, we'll have to see whats been done and what needs doing. It's also highly recommended that you don't upgrade to 2.0 immediately, as there are likely going to be a few issues and you would be better waiting for a 2.1 release

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 102 guests