Post by elcopdoo » Sun Oct 19, 2014 8:28 pm

Can anyone help me with simple ocmod file:
- I need to add a line of code into stylesheet.css.

My current ocmod looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name><![CDATA[Elcop_mod]]></name>
<version><![CDATA[1.0.0]]></version>
<author><![CDATA[elcopdoo]]></author>
<link><![CDATA[http://www.xxx.com]]></link>
<file path="catalog\view\theme\default\stylesheet\stylesheet.css">
<operation>
<search offset="6"><![CDATA[
line-height: 20px;
]]></search>

<add position="after"><![CDATA[
background: linear-gradient(rgba(255,255,0,0.05), rgba(255,255,0,0.5), rgba(255,255,0,0));
]]></add>

</operation>
</file>
</modification>

I saved this file as install.xml but when try to upload error shows that file is not valid.

New member

Posts

Joined
Sun Oct 12, 2014 9:13 pm

Post by elcopdoo » Sun Oct 19, 2014 8:42 pm

Ok, I successfully uploaded file by renaming it to elcop.ocmod.xml ,
but mod is not working:
Warning: DOMDocument::loadXML(): StartTag: invalid element name in Entity, line: 3 in admin/controller/extension/modification.php on line 123Warning: DOMDocument::loadXML(): Premature end of data in tag name line 3 in Entity, line: 3 in admin/controller/extension/modification.php on line 123Warning: DOMDocument::loadXML(): Premature end of data in tag modification line 2 in Entity, line: 3 in admin/controller/extension/modification.php on line 123Notice: Trying to get property of non-object in admin/controller/extension/modification.php on line 126

New member

Posts

Joined
Sun Oct 12, 2014 9:13 pm

Post by JNeuhoff » Sun Oct 19, 2014 8:53 pm

This one works fine for OpenCart 2.0.0.1b:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<name><![CDATA[Elcop_mod]]></name>
	<code><![CDATA[Elcop_mod]]></code>
	<version><![CDATA[1.0.0]]></version>
	<author><![CDATA[elcopdoo]]></author>
	<link><![CDATA[http://www.xxx.com]]></link>
	<file path="catalog/view/theme/default/stylesheet/stylesheet.css">
		<operation>
			<search offset="6"><![CDATA[
line-height: 20px;
]]></search>

			<add position="after"><![CDATA[
background: linear-gradient(rgba(255,255,0,0.05), rgba(255,255,0,0.5), rgba(255,255,0,0));
]]></add>

		</operation>
	</file>
</modification>

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 elcopdoo » Sun Oct 19, 2014 9:02 pm

Warning: DOMDocument::loadXML(): Couldn't find end of Start Tag name line 3 in Entity, line: 3 in admin/controller/extension/modification.php on line 123Warning: DOMDocument::loadXML(): Premature end of data in tag modification line 2 in Entity, line: 3 in admin/controller/extension/modification.php on line 123Notice: Trying to get property of non-object in admin/controller/extension/modification.php on line 126

I have latest OC2 from github installed.

New member

Posts

Joined
Sun Oct 12, 2014 9:13 pm

Post by JNeuhoff » Sun Oct 19, 2014 9:30 pm

Your relevent error message is:
Couldn't find end of Start Tag name line 3 in Entity, line: 3 in admin/controller/extension/modification.php on line 123
Your PHP DOM library therefore complaints about this line:

Code: Select all

	<name><![CDATA[Elcop_mod]]></name>
As you can see, the end of Start tag, namely </name>, is clearly there.

And it works absolutely fine on my system, which makes me think there is more likely to be a bug in PHP's DOM library you have installed.

Suggested remedies:

- try it on a Linux server with Apache, not Windows, to see whether you get the same error
- try it without the 1st line

Code: Select all

 <?xml version="1.0" encoding="UTF-8"?>

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 elcopdoo » Mon Oct 20, 2014 5:12 am

Ok, installed php-xml is 5.4.16-23 on COS7
I tried everything, even installing atomic PHP Panda with multiple php versions(5.4/5.5/5.6),

but now the the error is:
Warning: DOMDocument::loadXML(): StartTag: invalid element name in Entity, line: 3

I'm beginning to think this has to do with installed latest OC2.0.0.1b ...

Do You have any other suggestions?

Update:
with latest admin/controller/extension/modification.php
(https://github.com/opencart/opencart/co ... bc1fb9b2ad)
error is:
Warning: DOMDocument::loadXML(): Empty string supplied as input in admin/controller/extension/modification.php on line 123Notice: Trying to get property of non-object in admin/controller/extension/modification.php on line 134

in line 123 is:
$dom->loadXml($xml);

so, $xml is not properly initialized or what?

New member

Posts

Joined
Sun Oct 12, 2014 9:13 pm

Post by JNeuhoff » Mon Oct 20, 2014 5:44 am

You are the only one out of thousands of OpenCart 2.0.0.0 or 2.0.0.1b users or testers, and I am certainly not able to reproduce your error.

Have you tried the XML-file without the

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
?

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 elcopdoo » Mon Oct 20, 2014 2:14 pm

Yes, thats the first thing I tried,

I'll try to reinstall latest OC2 from scratch...

New member

Posts

Joined
Sun Oct 12, 2014 9:13 pm

Post by tifosi » Mon Oct 20, 2014 5:54 pm

Noticed you're using "offset" in the mod.

In ocmod for v2.0.0.0 this is working the same way as index for vqmod i.e as an array indices NOT as a line offset.

This is a current bone of contention between the vqmod devs & oc core devs and likely to be changed for the next OC version.

You're looking for the 6th instance of the search.

AND search attributes should be on the add tag not search. So it will fail anyway.

https://github.com/opencart/opencart/wi ... ion-System

New member

Posts

Joined
Tue Feb 17, 2009 8:14 am

Post by JNeuhoff » Mon Oct 20, 2014 6:47 pm

Yes, you are right. There will be changes done to the way OCmod works in the next OpenCart version, see the discussions on github or this forum thread.

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 tifosi » Mon Oct 20, 2014 7:17 pm

Hi Jeff

Seen your input into these over the last couple of weeks. Yes, hopefully "offset" & "index" will revert back to what they should be. Offset is particularly useful in mod placement.

Would like to see better logging in the next version, the log tab output is a bit unintuitive atm, finding why something hasn't parsed is a laborious trial and error.

Hopefully error="log|skip" will be re-added to the operation or add tag.

Currently converting mods from 1.5.x to 2.0.x. Most things can be worked around atm, but some are a pain. Seems Daniel has got on board now with how crucial this is to the success of oc2 and not just an extra bit. Every opencart install I've been involved with has had multiple modifications, sometime 20+ and vqmod has been essential.

S

New member

Posts

Joined
Tue Feb 17, 2009 8:14 am

Post by uksitebuilder » Mon Oct 20, 2014 7:32 pm

You cannot modify .css or .js files with OCMod ( I believe )

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by elcopdoo » Mon Oct 20, 2014 8:35 pm

After reinstalling latest OC2 from scratch,
error disappeared, so it was OC after all....
Unfortunately mod for CSS didn't work.

Also created pull request GitHub #2064 in the way...

I think We are very close to V2.0.0.1 to be released :)

New member

Posts

Joined
Sun Oct 12, 2014 9:13 pm

Post by cyclops12 » Sun Dec 06, 2015 6:22 am

uksitebuilder is correct

Limitations - Files not modified by OCMOD
a) index.php
b) Standalone
c) Javascript
d) CSS stylesheets

see site for reference: http://ocextensions.co.uk/ocmod/ocmod

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by adnan00733 » Sun Jun 05, 2016 6:36 am

Hi.
You can use this extension
http://www.opencart.com/index.php?route ... n_id=26860

After installing above extension you will be to to change in .css, .js, .json etc files via OCMOD.

Newbie

Posts

Joined
Sun Jun 05, 2016 6:29 am
Who is online

Users browsing this forum: No registered users and 131 guests