Post by th3d3sign3r » Thu Dec 21, 2017 12:53 am

Hi, i am trying to build my first extension for opencart 3.0.2.0 using ocmod.
My problem is that i want to search for this code inside my install.xml file :

Code: Select all

<file path="catalog/view/theme/*/template/common/header.twig">
	<operation>
	<search><![CDATA[
      {% if logged %}
        <a href="{{ account }}">
        <div class="col-sm-2 pull-right txt-left user-account-btn" id="user-account-btn-id">
        <i class="fa fa-user-o"></i><span class="hidden-xs hidden-sm hidden-md">{{ text_account }}</span>
        </div>
        </a>
        {% endif %}
    ]]></search>
	<add position="replace"><![CDATA[
        // MY NEW CODE GOES HERE 
    ]]></add>
	</operation>
    </file>


The problem is that ocmod cant search and find multi lines of code inside the file header.twig
I searched so many hours to find a solution but no luck!!! :( Can someone show me with an example how can i search for mutli lines of code in ocmod xml ??

Thanks in advance

Newbie

Posts

Joined
Mon Dec 18, 2017 6:08 pm

Post by straightlight » Thu Dec 21, 2017 2:01 am

Ensure to use the most recent version of VQMod. If the issue still persists, contact qphoria regarding VQMod library issues.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by th3d3sign3r » Thu Dec 21, 2017 4:58 pm

Thanks for replying, but i m not using vQmod. I m using the Opencart core ocmod.

Newbie

Posts

Joined
Mon Dec 18, 2017 6:08 pm

Post by straightlight » Thu Dec 21, 2017 9:34 pm

Sorry, that is correct - you are posting about OCMod. Although, OCMod does not have multi-line research as VQMod already has.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by th3d3sign3r » Fri Dec 22, 2017 3:48 am

I m building an xml mod that fix the multi-line search for ocmod but works only for add="after" and add="before" operations. I m trying also to fix the add="replace" operation as well but still no luck with it. However i 'll post my work here the next days.
If someone else knows a solution for this issue please post it here.

Newbie

Posts

Joined
Mon Dec 18, 2017 6:08 pm

Post by straightlight » Fri Dec 22, 2017 3:59 am

No problem. Although, more information would be needed since this portion:
// MY NEW CODE GOES HERE
in your file doesn't really provide more information at this time.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by th3d3sign3r » Fri Dec 22, 2017 5:20 pm

Code: Select all

<file path="catalog/view/theme/*/template/common/header.twig">
	<operation>
	<search><![CDATA[
      {% if logged %}
        <a href="{{ account }}">
        <div class="col-sm-2 pull-right txt-left user-account-btn" id="user-account-btn-id">
        <i class="fa fa-user-o"></i><span class="hidden-xs hidden-sm hidden-md">{{ text_account }}</span>
        </div>
        </a>
        {% endif %}
    ]]></search>
	<add position="replace"><![CDATA[
        <div class="col-sm-2 pull-right txt-left user-account-btn" id="user-account-btn-id">
        <i class="fa fa-user-o"></i><span class="hidden-xs hidden-sm hidden-md">{{ text_account }}</span>
        </div>
    ]]></add>
	</operation>
    </file>
This is the complete code i want to use. As you can see i want to use replace operation so i can remove the <a href> tag from the header.twig code

Newbie

Posts

Joined
Mon Dec 18, 2017 6:08 pm

Post by JNeuhoff » Fri Dec 22, 2017 6:05 pm

You should consider alternatives. Using a multi-line search is a bad idea to start with in the first place. Both OCmod and VQmod should only be used as a last resort for core file modifications.

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Google Tag Manager * Google Rich Snippets * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 10 guests