Post by karapuz » Mon Oct 13, 2014 2:39 am

Hi,

I tested the alpha version, reported this problem and it is still actual in the 2.0.0.0 release! Guys, if you offer the modification functionality then make it right. At the present time it is completely unsuitable for serious changes. It does not support indexes, it does not work with lines (like vqmod does). Actually, it is just a simple substring replace call :( People recommend to forget about modifications and install vqmod instead! Are you sure that this was your original plan? Why did someone spend time on this functionality if it is worth almost nothing right now?... If you have any license issues with vqmod integration then perhaps you should purchase this source code.

Please let us know your plans about the modifications and if there will be any improvements soon.

User avatar
New member

Posts

Joined
Tue Jul 17, 2012 4:59 am


Post by rph » Mon Oct 13, 2014 4:46 am

vQmod was released under GPL so there shouldn't be any licensing issues. I think it's just part of OpenCart's general "not invented here" approach to code. Personally I would have let vQmod be vQmod and pushed hard on a more complete event/hooking system in the cart itself. Expecting developers to build extensions without the benefit of an IDE, version control, and unit testing is crazy this day and age.

But OCMod is what we have. I'm not sure what other devs think about it. I'm definitely feeling between a rock and a hard place. It's either wait for OCMod to get whipped into shape who knows when or upgrade existing vQmods and deal with the problems of having several different modding systems later.

-Ryan


rph
Expert Member

Posts

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

Post by Daniel » Tue Oct 14, 2014 1:43 am

then help me build one closer to vqmod. we just need the functionality that is used the most. not the full featured version.

this is one that some one posted to fix white space issues.

example:

https://github.com/opencart/opencart/co ... d97dae5184

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by karapuz » Tue Oct 14, 2014 2:20 am

I found out that there is an index functionality in ocmod but it does not work because of a bug. Here is a ticket mentioning this issue:

https://github.com/opencart/opencart/issues/1967

As soon as they fix it, it should work better although I would still miss inserting the code below/above lines.

User avatar
New member

Posts

Joined
Tue Jul 17, 2012 4:59 am


Post by Daniel » Tue Oct 14, 2014 1:16 pm

karapuz wrote:I found out that there is an index functionality in ocmod but it does not work because of a bug. Here is a ticket mentioning this issue:

https://github.com/opencart/opencart/issues/1967

As soon as they fix it, it should work better although I would still miss inserting the code below/above lines.
there is no index functionality its called offset because its where the occurrences of the matched elements shoudl start to replace.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Daniel » Wed Oct 15, 2014 2:03 am

try testing the latest master version please.

index and trim attributes on the search element.

position and offset are set on the add element.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Multiple Search Match Test</name>
    <version>1.0</version>
    <author>OpenCart Ltd</author>
    <link>http://www.opencart.com</link>
    <file path="catalog/controller/common/home.php">
        <operation>
            <search><![CDATA[$data['column_left'] = $this->load->controller('common/column_left');]]></search>
            <add position="before"><![CDATA[
            /* test123 */
            ]]></add>
        </operation>
    </file>  
</modification>

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by karapuz » Wed Oct 15, 2014 3:47 am

Daniel wrote:try testing the latest master version please.
Thank you for the update! It almost works as needed, but I have two notices after testing:

1) in admin/controller/extension/modification.php the following line
if (trim($search) == $line) {

should be replaced with something like this:
if (stripos($line, $search) !== false) {

Because no one specifies the whole line for matching. The line should be identified by the substring in the 'search'.

2) Ocmod indexes start with 0, the default vqmod starts indexes with 1. It not a big deal of course, but if you could make it identical then perhaps it would be better.

Thank you again.

User avatar
New member

Posts

Joined
Tue Jul 17, 2012 4:59 am


Post by Daniel » Wed Oct 15, 2014 12:10 pm

offset can stay at 0, they normally start at this.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Daniel » Wed Oct 15, 2014 12:12 pm

ok just added

if (stripos($line, $search) !== false) {

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by karapuz » Wed Oct 15, 2014 1:34 pm

Thank you! It is a really big improvement for extension writers. I will continue developing a module for opencart 2.0 with the latest modification update. If any new issues occur I will let you know.

User avatar
New member

Posts

Joined
Tue Jul 17, 2012 4:59 am


Post by Daniel » Wed Oct 15, 2014 4:46 pm

did you use the xml code from above?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by JNeuhoff » Wed Oct 15, 2014 6:30 pm

Daniel wrote:then help me build one closer to vqmod. we just need the functionality that is used the most. not the full featured version.

this is one that some one posted to fix white space issues.

example:

https://github.com/opencart/opencart/co ... d97dae5184
We have had a complete VQmod-XML support available for the admin/controller/extension/modification.php for quite a while now, please feel free to use it. It can co-exist with the OCmod-XML.

BTW.: I have yet to see some more documentation for e.g. the OCmod's offset, limit and index(is the latter still there?) attritbutes, how are they supposed to work with a single whole string buffer, as opposed to VQmod's array of lines?

Attachments

VQmod-XML support for the OpenCart 2.0.0.1b modification system


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 Daniel » Wed Oct 15, 2014 7:06 pm

except last time i looked at this it did not work.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by JNeuhoff » Wed Oct 15, 2014 7:59 pm

I have been using it for a while for my VQmod extensions, and so have many other users, without any issues. If anyone comes across a bug, let me know.

The bottom line is: We need line-based features as is the case with the VQmod-XML and its attributes.
Last edited by JNeuhoff on Thu Oct 16, 2014 2:40 am, edited 1 time 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 karapuz » Thu Oct 16, 2014 12:24 am

2JNeuhoff: After the latest update OC2 introduces the line-based additions like vqmod does. Check the latest modification.php file from the github.

User avatar
New member

Posts

Joined
Tue Jul 17, 2012 4:59 am


Post by Daniel » Thu Oct 16, 2014 2:17 am

adding ignoreif as well

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by JNeuhoff » Thu Oct 16, 2014 2:56 am

karapuz wrote:2JNeuhoff: After the latest update OC2 introduces the line-based additions like vqmod does. Check the latest modification.php file from the github.
That looks much better already. Looking at the code, it now seems to be fully lines-based, and supports the trim and index attributes for the add-node, as well as the position and offset attributes for the add-node. So it's becoming more VQmod-alike finally.

Of course, our VQmod-XML addon for the Opencart modification already has it all ;)

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 Daniel » Fri Oct 17, 2014 7:02 pm

sack it going to make it the same spec as vqmod

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by JNeuhoff » Sun Oct 19, 2014 1:17 am

Daniel wrote:sack it going to make it the same spec as vqmod
Well, I assume same specs, but not the same VQmod-XML syntax?

Anyway, your OCmod looks much better now, because it is finally using an array of lines instead of a whole stringbuffer to operate on. There is still a bug which I posted on github.

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 Oct 20, 2014 1:30 am

Daniel, you said on github about the automatic removal of leading whitespaces on a matched line:
this is not how vqmod works! this is a feature you want!

you should indent yourself.

The search should match the search expression on the line, and then just replace the match with the subsituted data. It should not do anything else, like removing leading whitespaces on the matched line. Only the matched search expression, or the subsituted data from the add-node text should be allowed to be trimmed, depending on the 'trim' attributes. See https://github.com/vqmod/vqmod/wiki/Scripting on how vqmod does it! I just tested it with QPhoria's latest VQmod 2.5.1 and my own VQmod 2.4.1 on OpenCart 2.0.0.1b.

If we want VQmod features, with just using a different OCmod XML syntax, then your current code is wrong. If you like, I can easily implement your planned OCmod XML syntax, I already have VQmod-XML anyway, the main change would only be the relocation of the 'position' and 'offset' attributes from the 'search' node to the 'add' node, and some other minor changes ('name' instead of 'id', or introducing the 'code' and 'link' nodes that didn't exist in VQmod, or removing the vqmver node etc).

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

Who is online

Users browsing this forum: No registered users and 30 guests