Page 2 of 2

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Sat Jul 25, 2020 12:55 pm
by aleopencart
IP_CAM wrote:
Sat Jul 25, 2020 2:52 am
JNeuhoff's Integrated VQmod add's the modified Code to the Database, exactly like OcMods are 'handled',
instead of placing such Files in a Vqmod/Vqcache/ Subdirectory. It's probably the best and most efficient way of all,
since it avoids additional tasks, in order to create a Page. Not to speak about ERRORS, due to two Systems, unable
to communicate with each other, as VqMod and OcMod 'combined' should do, or better, cannot do. ;)
So, if you still use VqMods, for whatever unknown reason ever, use Integrated VQmod, you're better off ... ;)
Ernie
---
Integrated VQmod for OpenCart
https://www.opencart.com/index.php?rout ... n_id=19501
I don't doubt about the solution. But with vqmod it is faster to test the code to be rewritten without write code on database every time...

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Sat Jul 25, 2020 5:44 pm
by JNeuhoff
aleopencart wrote:
Sat Jul 25, 2020 2:08 am
JNeuhoff wrote:
Fri Jul 24, 2020 9:55 pm
Once you fix the 'modification.xml', our Integrated VQmod should work just fine for OpenCart 3.0.3.5 and 3.0.3.6! I just tested it for OpenCart 3.0.3.6.
Please what's the fix for the modification.xml file that you have tested?
Use this modification.xml:

Code: Select all


<?xml version="1.0" encoding="utf-8"?>
<modification>
  <name>Modification Default</name>
  <code>default</code>
  <version>1.1</version>
  <author>OpenCart Ltd</author>
  <link>http://www.opencart.com</link>
  <file path="system/{engine,library}/{action,loader,config,language}*.php|system/library/template/template.php">
    <operation>
      <search regex="true">
        <![CDATA[~(require|include)(_once)?\(([^)]+)~]]>
      </search>
      <add position="replace">
        <![CDATA[$1$2(modification($3)]]>
      </add>
    </operation>
  </file>
  <file path="system/library/template/twig.php">
    <operation>
      <search>
        <![CDATA[if (is_file($file)) {]]>
      </search>
      <add position="replace">
        <![CDATA[if (defined('DIR_CATALOG') && is_file(DIR_MODIFICATION . 'admin/view/template/' . $filename . '.twig')) {	
                $code = file_get_contents(DIR_MODIFICATION . 'admin/view/template/' . $filename . '.twig');
            } elseif (is_file(DIR_MODIFICATION . 'catalog/view/theme/' . $filename . '.twig')) {
                $code = file_get_contents(DIR_MODIFICATION . 'catalog/view/theme/' . $filename . '.twig');
            } elseif (is_file($file)) {]]>
      </add>
    </operation>
  </file> 
</modification>

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Sat Jul 25, 2020 11:19 pm
by aleopencart
JNeuhoff wrote:
Sat Jul 25, 2020 5:44 pm
aleopencart wrote:
Sat Jul 25, 2020 2:08 am
JNeuhoff wrote:
Fri Jul 24, 2020 9:55 pm
Once you fix the 'modification.xml', our Integrated VQmod should work just fine for OpenCart 3.0.3.5 and 3.0.3.6! I just tested it for OpenCart 3.0.3.6.
Please what's the fix for the modification.xml file that you have tested?
Use this modification.xml:

<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Modification Default</name>
<code>default</code>
<version>1.1</version>
<author>OpenCart Ltd</author>
<link>http://www.opencart.com</link>
<file path="system/{engine,library}/{action,loader,config,language}*.php|system/library/template/template.php">
<operation>
<search regex="true">
<![CDATA[~(require|include)(_once)?\(([^)]+)~]]>
</search>
<add position="replace">
<![CDATA[$1$2(modification($3)]]>
</add>
</operation>
</file>
<file path="system/library/template/twig.php">
<operation>
<search>
<![CDATA[if (is_file($file)) {]]>
</search>
<add position="replace">
<![CDATA[if (defined('DIR_CATALOG') && is_file(DIR_MODIFICATION . 'admin/view/template/' . $filename . '.twig')) {
$code = file_get_contents(DIR_MODIFICATION . 'admin/view/template/' . $filename . '.twig');
} elseif (is_file(DIR_MODIFICATION . 'catalog/view/theme/' . $filename . '.twig')) {
$code = file_get_contents(DIR_MODIFICATION . 'catalog/view/theme/' . $filename . '.twig');
} elseif (is_file($file)) {]]>
</add>
</operation>
</file>
</modification>
Thanks a lot JNeuhoff!!! But I replaced "system/modification.xml" of the 3.0.3.6 release with this and VQMOD still doesn't work with twig files. Php files work well. I don't know. I'm not doing something right.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Sat Jul 25, 2020 11:28 pm
by JNeuhoff
It will work with the Integrated VQMod.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Sun Jul 26, 2020 12:28 am
by aleopencart
JNeuhoff wrote:
Sat Jul 25, 2020 11:28 pm
It will work with the Integrated VQMod.
Ahh ok, I thought it also worked with traditional vqmod.
Thank you very much!

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Wed Jul 29, 2020 1:09 pm
by trueliar
The problem seems to be for both ocmod and vqmod.

I've done a simple Workaround/fix as a ocmod or vqmod.
https://www.opencart.com/index.php?rout ... n_id=39911

If you want to publish your own VQmod (or ocmod) for opencart 3.x (3.0.3.5 3.0.3.6), instead of downloading the previous package, I suggest you to add this code in your own xml file.

Code: Select all

	<file path="system/library/template/twig.php" error="skip" info="fix Core Opencart twig files modification">
		<operation>
			<search><![CDATA[$file = DIR_TEMPLATE . $filename . '.twig';]]></search>
			<add position="replace"><![CDATA[$file = modification( DIR_TEMPLATE . $filename . '.twig' );
			if( class_exists('VQMod') ) {
				$file = \VQMod::modCheck($file);
			}
			]]></add>
		</operation>
	</file>
It will not interfere with other versions of of OC 3.x or the extension if already installed.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Wed Jul 29, 2020 9:50 pm
by aleopencart
trueliar wrote:
Wed Jul 29, 2020 1:09 pm
The problem seems to be for both ocmod and vqmod.

I've done a simple Workaround/fix as a ocmod or vqmod.
https://www.opencart.com/index.php?rout ... n_id=39911

If you want to publish your own VQmod (or ocmod) for opencart 3.x (3.0.3.5 3.0.3.6), instead of downloading the previous package, I suggest you to add this code in your own xml file.

Code: Select all

	<file path="system/library/template/twig.php" error="skip" info="fix Core Opencart twig files modification">
		<operation>
			<search><![CDATA[$file = DIR_TEMPLATE . $filename . '.twig';]]></search>
			<add position="replace"><![CDATA[$file = modification( DIR_TEMPLATE . $filename . '.twig' );
			if( class_exists('VQMod') ) {
				$file = \VQMod::modCheck($file);
			}
			]]></add>
		</operation>
	</file>
It will not interfere with other versions of of OC 3.x or the extension if already installed.
Thanks you very much!! Now 3.0.3.5 & 3.0.3.6 versions works fine with VQMOD. I have tested the fix also OCMOD extensions but it doesn't work.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Wed Jul 29, 2020 11:52 pm
by trueliar
aleopencart wrote:
Wed Jul 29, 2020 9:50 pm
...
Thanks you very much!! Now 3.0.3.5 & 3.0.3.6 versions works fine with VQMOD. I have tested the fix also OCMOD extensions but it doesn't work.
For the ocmod Make sure to click on update in the Extensions->modification

Check the ocmod logs for errors. The fix is for the twig files, so if the extension is not meant for oc 3.0.3.6 there could probably be a different problem related to the third party extension.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Fri Jul 31, 2020 2:28 pm
by aleopencart
trueliar wrote:
Wed Jul 29, 2020 11:52 pm
aleopencart wrote:
Wed Jul 29, 2020 9:50 pm
...
Thanks you very much!! Now 3.0.3.5 & 3.0.3.6 versions works fine with VQMOD. I have tested the fix also OCMOD extensions but it doesn't work.
For the ocmod Make sure to click on update in the Extensions->modification

Check the ocmod logs for errors. The fix is for the twig files, so if the extension is not meant for oc 3.0.3.6 there could probably be a different problem related to the third party extension.

You're right, it works very well in both OCMOD & VQMOD !!
Many Thanks

I ask myself a question was this modification exclusion wanted by the developers? :-\

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Fri Jul 31, 2020 7:14 pm
by trueliar
aleopencart wrote:
Fri Jul 31, 2020 2:28 pm
You're right, it works very well in both OCMOD & VQMOD !!
Many Thanks

I ask myself a question was this modification exclusion wanted by the developers? :-\
You are welcome!

I suppose that it's not a wanted thing since the ocmod modification system still creates the twig files in the cache but they are not retrieved and showed in the frontend.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Sat Aug 01, 2020 12:51 am
by aleopencart
trueliar wrote:
Fri Jul 31, 2020 7:14 pm
aleopencart wrote:
Fri Jul 31, 2020 2:28 pm
You're right, it works very well in both OCMOD & VQMOD !!
Many Thanks

I ask myself a question was this modification exclusion wanted by the developers? :-\
You are welcome!

I suppose that it's not a wanted thing since the ocmod modification system still creates the twig files in the cache but they are not retrieved and showed in the frontend.
Will it be the end of extensions as we see them today ?? ??? :o

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Sat Aug 01, 2020 1:06 am
by JNeuhoff
aleopencart wrote:
Sat Aug 01, 2020 12:51 am
Will it be the end of extensions as we see them today ?? ??? :o
As I said on this forum thread, modifications of templates still work fine when using our fixed 'system/modification.xml'. And it works for the Integrated VQMod, too.

However, please be aware that the upcoming OpenCart 3.1.x. release has no built-in XML-based modification system at all at the moment.
OpenCart extensions shouldn't have to use OCmod or VQmod. XML is a structured markup language useful for documents and protocols, it's not really meant to be a programming language.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Sat Aug 01, 2020 3:33 pm
by aleopencart
JNeuhoff wrote:
Sat Aug 01, 2020 1:06 am
aleopencart wrote:
Sat Aug 01, 2020 12:51 am
Will it be the end of extensions as we see them today ?? ??? :o
As I said on this forum thread, modifications of templates still work fine when using our fixed 'system/modification.xml'. And it works for the Integrated VQMod, too.

However, please be aware that the upcoming OpenCart 3.1.x. release has no built-in XML-based modification system at all at the moment.
OpenCart extensions shouldn't have to use OCmod or VQmod. XML is a structured markup language useful for documents and protocols, it's not really meant to be a programming language.
Ok, many thanks!

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Thu Aug 06, 2020 8:32 pm
by fiveyencoin
First of all, I wanted to say THANK YOU to everyone who has commented on this. I am new to OpenCart, and even newer to the world of vq/ocmod. It was quite frustrating when I bought a mod, discovered it needed "vqmod," and was frustrated when I couldn't get it working.

In any case, I was having the same issue: model/controller PHP was being affected by vqmod, but the twig templates were not. Here's a summary of what I did to fix it:
0. Got rid of the "old school" vqmod that I had installed per the extension's instructions, installed Integrated vQMod
1. Made the changes to twig.php as described in this pull: https://github.com/opencart/opencart/pull/8106/files
2. Replaced modification.xml from the maintenance branch here: https://github.com/opencart/opencart/tr ... aintenance
3. Re-enabled Integrated vQMod and things seem to be working great now.

It's been a real headache for the last 4 hours, so again, I appreciate everyone who helped me piece this together finally.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Thu Aug 06, 2020 11:21 pm
by JNeuhoff
Glad to hear you got it to work.

As regards:
1. Made the changes to twig.php as described in this pull: https://github.com/opencart/opencart/pull/8106/files
I suggested that solution on github ages ago, it's good to see that it's finally included in the master branch.
The last 2 releases of OpenCart (3.0.3.6 and 3.0.3.5) should not be used in a production environment!

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Fri Aug 07, 2020 2:28 am
by xxvirusxx
JNeuhoff wrote:
Thu Aug 06, 2020 11:21 pm
I suggested that solution on github ages ago, it's good to see that it's finally included in the master branch.
I don't think will be added..

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Fri Aug 07, 2020 7:06 am
by IP_CAM
Who knows, OC was always good for Surprises :laugh:
Whereby, Twig did not lead to, what possibly has been expected, and nobody
ever asked for OcMod, they both only added to formerly unknown problems.
And as long as PHP is used in other parts, it's just a waste of Resources, to make
a (so-called BASIC) Software work, by adding more to it than it really requires.
Especially, as long as it does NOT add to overall performance, which is also not
the case.
From a NON-Coder Point of View at least, something, most OC Users are .... :-\
Ernie

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Fri Aug 07, 2020 4:20 pm
by JNeuhoff
xxvirusxx wrote:
Fri Aug 07, 2020 2:28 am
JNeuhoff wrote:
Thu Aug 06, 2020 11:21 pm
I suggested that solution on github ages ago, it's good to see that it's finally included in the master branch.
I don't think will be added..
You are right. I think I'll do another pull request on github for this.

Re: Opencart 3.0.3.5 vqmod not work with twig files

Posted: Fri Aug 07, 2020 6:44 pm
by xxvirusxx
JNeuhoff wrote:
Fri Aug 07, 2020 4:20 pm
I think I'll do another pull request on github for this.
I think will be ignored because of "restriction". Is like you use PHP but you can't use php include.. :laugh:

Re: Opencart 3.0.3.5 vqmod not work with PHP files

Posted: Fri Sep 11, 2020 7:39 pm
by khnaz35
Hi guys is any one else having issue with OCMOD or VQMOD not working with PHP files on OC 3.0.3.5?

This is my XML file for VQMOD

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>Advance Settings Editor</id>
    <version>1.0</version>
    <vqmver required="true">2.6.0</vqmver>
    <author>khnaz35</author>
    
    <!-- ADMIN -->
    <!-- Controller -->
    <file name="admin/controller/common/column_left.php">
        <operation error="log">
            <search position="before"><![CDATA[$user = array();]]></search>
            <add><![CDATA[
			if ($this->user->hasPermission('access', 'setting/advance')) {
				$system[] = array(
					'name'	   => $this->language->get('text_setting_advance'),
					'href'     => $this->url->link('setting/advance', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()		
				);	
			}
]]></add>
        </operation>
	</file>
    
    <!-- Language -->
    <file name="admin/language/*/common/column_left.php">
        <operation error="log">
            <search position="before"><![CDATA[$_['text_other_status']         = 'Other Statuses';]]></search>
            <add><![CDATA[$_['text_setting_advance']         = 'Advance Settings';
]]></add>
        </operation>
	</file>

</modification>
Tried same converted to OCMOD and uploading via Extension=> Installer upload is fine but upon refreshing the modifications theme caches sass etc not sign of change in dashboard.