Page 1 of 1

vqmod xml does not work as it should

Posted: Sat Aug 25, 2018 11:18 pm
by nicexe
Hello,
I'm having some trouble with my custom vqmod xml and I'm not even sure why it doesn't work.
I'm basically trying to replace a line in a tpl file with a different line.
This is my mod:

Code: Select all

<modification>
	<id><![CDATA[header mod]]></id>
	<version><![CDATA[1.0]]></version>
	<vqmver><![CDATA[2.3.0]]></vqmver>
	<author><![CDATA[nicexe]]></author>
	<file name="catalog/view/theme/basel/template/common/headers/header2.tpl">
		<operation>
			<search position="replace" error="log"><![CDATA[        <div class="dropdown-wrapper-click from-top hidden-sx hidden-sm hidden-xs">]]></search>
			<add><![CDATA[        <div class="dropdown-wrapper-click from-top hidden-sx hidden-xs">]]></add>
		</operation>
	</file>
</modification>
I cleared vqmod cache and enabled the mod but when I visit the page I can definitely see that the code isn't replaced.
I checked the logs and I see no error related to my mod or the file it messes with.
I also checked the vqmod cache and the modified file is missing so that tells me that my mod never took place.

What am I doing wrong?

Re: vqmod xml does not work as it should

Posted: Sun Aug 26, 2018 12:08 am
by straightlight
<file name="catalog/view/theme/basel/template/common/headers/header2.tpl">
for:
<file path="catalog/view/theme/basel/template/common/headers/header2.tpl">
I would suggest the use of the VQMod Manager from the Marketplace to debug your XML files with VQMod.

Re: vqmod xml does not work as it should

Posted: Sun Aug 26, 2018 12:10 am
by thekrotek
straightlight wrote:
Sun Aug 26, 2018 12:08 am
<file name="catalog/view/theme/basel/template/common/headers/header2.tpl">
for:
<file path="catalog/view/theme/basel/template/common/headers/header2.tpl">
I would suggest the use of the VQMod Manager from the Marketplace to debug your XML files with VQMod.
No, this is not the issue, because "name" is valid for VQMod, "path" is required by OCMod only, since it doesn't support "name" attribute.

Re: vqmod xml does not work as it should

Posted: Sun Aug 26, 2018 12:11 am
by straightlight
Right. I may have mixed both on this one. However, I did suggested the use of VQMod Manager to confirm the results.

Re: vqmod xml does not work as it should

Posted: Sun Aug 26, 2018 3:32 am
by kestas
nicexe wrote:
Sat Aug 25, 2018 11:18 pm

<operation>
<search position="replace" error="log">
error="log"
must be in
<operation error="log">
so first you should read how to use vqmod. Next... maybe you have copied wrong line to replace.


Cheers

Re: vqmod xml does not work as it should

Posted: Sun Aug 26, 2018 4:39 am
by IP_CAM
AVOID any empty SPACE(s) or TAG(s) in SEARCH Command Content, like shown here,
BEFORE and/or AFTER an ANCHOR/TAG LINE, like, in this case, this one:
<div class="dropdown-wrapper-click from-top hidden-sx hidden-sm hidden-xs">
as shown here:

Code: Select all

<search position="replace"><![CDATA[        <div class="dropdown-wrapper-click from-top hidden-sx hidden-sm hidden-xs">]]></search>
by better doing it like this:

Code: Select all

<search position="replace"><![CDATA[<div class="dropdown-wrapper-click from-top hidden-sx hidden-sm hidden-xs">]]></search>
Ernie

Re: vqmod xml does not work as it should

Posted: Wed Aug 29, 2018 10:58 pm
by nicexe
Thanks people.
I took into account what you replied.
The script now looks a bit like this:

Code: Select all

<modification>
	<id><![CDATA[header mod]]></id>
	<version><![CDATA[1.0]]></version>
	<vqmver><![CDATA[2.6.0]]></vqmver>
	<author><![CDATA[nicexe]]></author>
	<file name="catalog/view/theme/basel/template/common/headers/header2.tpl,catalog/view/theme/basel/template/common/headers/header2.twig">
		<operation>
			<search position="replace" error="log"><![CDATA[<div class="dropdown-wrapper-click from-top hidden-sx hidden-sm hidden-xs">]]></search>
			<add><![CDATA[<div class="dropdown-wrapper-click from-top hidden-sx hidden-xs">]]></add>
		</operation>
	</file>
</modification>
For one reason or another I am still having problems.
I do not see any related entry in the logs so I assume that the file I'm modding is not really the one responsible for what I'm trying to change.
Is there any way to make sure what piece of code is responsible for a piece of html in order to target with a VQMod?

Re: vqmod xml does not work as it should

Posted: Thu Aug 30, 2018 4:05 am
by kestas
did you tried
error="log"
move to
<operation error="log">

in your code are:

Code: Select all

<search position="replace" error="log"> 
should be:

Code: Select all

<operation error="log">
<search position="replace">

Re: vqmod xml does not work as it should

Posted: Mon Oct 15, 2018 11:29 pm
by nicexe
kestas wrote:
Thu Aug 30, 2018 4:05 am
did you tried
error="log"
move to
<operation error="log">
Thanks. This was what caused the problem.