I have a page that I made so many changes to it doesn't make sense doing the individual edits. How do I replace the whole page without overwriting the core page? Does upload replace an existing file, or move the uploaded file to the modifications folder if it already exists? Or is there a way to search and replace an entire files contents?
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
Hi!
Use you can use ocmod "offset" attribute to replace all file content.
Use you can use ocmod "offset" attribute to replace all file content.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Modification Default</name>
<version>1.0</version>
<author>OpenCart Ltd</author>
<link>http://www.opencart.com</link>
<file path="catalog/controller/common/home.php">
<operation>
<search><![CDATA[<?php]]></search>
<add position="replace" offset="100"><![CDATA[
test123
]]></add>
</operation>
</file>
</modification>
My extensions in marketplace. [ security | flexibility | speedup ]
You mean by FTP? How would any OpenCart code possibly interfere with you uploading over the top of a file by FTP?
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
@halfhope, thanks. I was hoping to avoid basically putting an entire file of code inside the install file. I would think since ocmod was...I'm assuming...designed to avoid replacing core files it would work off the logic of seeing an existing file during the upload and copy that to the modification folder instead. Oh well, you work with what you have right.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
Hi
If it is a view file, You can do it like this:
If it is not a view file, This is how I did it in one of my extensions using the event system:
This changes the default page to the custom page.
If it is a view file, You can do it like this:
Code: Select all
<file path="catalog/controller/common/home.php">
<operation>
<search><![CDATA[$this->load->view('common/home', $data)]]></search>
<add position="replace"><![CDATA[$this->load->view('common/home2', $data)]]></add>
</operation>
</file>
Code: Select all
$this->load->model('setting/event');
$this->model_setting_event->addEvent('checkout_success', 'catalog/controller/checkout/success/before', 'extension/module/checkout_success/changeRoute');
Code: Select all
public function changeRoute(&$route = '', $data = array(), $output = '') {
$route = 'extension/module/checkout_success';
}
Who is online
Users browsing this forum: DigitCart and 104 guests