Post by mahmood56 » Sun Nov 08, 2015 2:55 pm

Hi,
Recently I've created an extension to remove "addthis" script from product page, but always I get an error when I want to refresh the extension modification page.

my extension

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Remove Addthis</name>
    <version>1.0</version>
    <link>http://www.moghimi.net</link>
    <author>Mahmood Moghimi</author>
    <code>remove-addthis</code>
	<file path="catalog/view/theme/*/template/product/product.tpl">
		<operation>
		   <search><![CDATA[<!-- AddThis Button BEGIN -->
            <div class="addthis_toolbox addthis_default_style"><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a> <a class="addthis_button_tweet"></a> <a class="addthis_button_pinterest_pinit"></a> <a class="addthis_counter addthis_pill_style"></a></div>
            <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-515eeaf54693130e"></script>
            <!-- AddThis Button END -->]]></search>
		   <add position="replace"><![CDATA[<!--Removed-->]]></add>
		</operation>
	</file>
</modification>
error :

Fatal error: Call to a member function getElementsByTagName() on a non-object in ..\opencart\admin\controller\extension\modification.php on line 152
can anyone suggest me a solution??

Newbie

Posts

Joined
Sun Nov 08, 2015 2:41 pm

Post by clorne » Sun Nov 08, 2015 9:41 pm

<search> cannot handle multiple lines

Active Member

Posts

Joined
Fri Dec 23, 2011 6:03 pm

Post by viethemes » Sun Nov 08, 2015 11:33 pm

It seems that the extension is not compatible with your OpenCart version. You can try replacing with below code

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Remove Addthis</name>
    <id>remove_addthis</id>
    <version>1.0</version>
    <link>http://www.moghimi.net</link>
    <author>Mahmood Moghimi</author>
    <code>remove-addthis</code>
   <file path="catalog/view/theme/*/template/product/product.tpl">
      <operation>
         <search><![CDATA[<!-- AddThis Button BEGIN -->
            <div class="addthis_toolbox addthis_default_style"><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a> <a class="addthis_button_tweet"></a> <a class="addthis_button_pinterest_pinit"></a> <a class="addthis_counter addthis_pill_style"></a></div>
            <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-515eeaf54693130e"></script>
            <!-- AddThis Button END -->]]></search>
         <add position="replace"><![CDATA[<!--Removed-->]]></add>
      </operation>
   </file>
</modification>

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by mahmood56 » Mon Nov 09, 2015 7:43 pm

clorne wrote:<search> cannot handle multiple lines
thank you clorne,
your tip was another problem in my extension, but the xml file encoding was my main problem!
my xml file was saved as "Unicode" encoding, I solved it by saving the file as "UTF-8" encoding.

Newbie

Posts

Joined
Sun Nov 08, 2015 2:41 pm
Who is online

Users browsing this forum: Baidu [Spider] and 49 guests