On a basic OC 3.0.3.6 installation I'm trying to use the language editor to modify the "Powered By" text in the footer. I have the correct route and key, but any html I put in the Value gets displayed in the front end. This happens even if I just copy/paste the existing string that's in the default. Is there some code I have to insert to designate the html?
Thanks.
Is the new text not showing up in the footer? Did you disable OpenCart's cache?CJC wrote: ↑Thu Oct 15, 2020 12:04 amHi All,
On a basic OC 3.0.3.6 installation I'm trying to use the language editor to modify the "Powered By" text in the footer. I have the correct route and key, but any html I put in the Value gets displayed in the front end. This happens even if I just copy/paste the existing string that's in the default. Is there some code I have to insert to designate the html?
Thanks.
A2 Hosting features: Shared Turbo Boost, Managed Warp 1, Unmanaged Hyper 1, and Warp 2 Turbo
Can you do a pastebin of the code, and post a screenshot of the footer?CJC wrote: ↑Thu Oct 15, 2020 12:58 amThe new text shows up, but the html code is displayed instead of being interpreted.
rjcalifornia wrote: ↑Thu Oct 15, 2020 12:16 am
Is the new text not showing up in the footer? Did you disable OpenCart's cache?
A2 Hosting features: Shared Turbo Boost, Managed Warp 1, Unmanaged Hyper 1, and Warp 2 Turbo
And a screenshot of the language editor screen:
And this is the code for the value field:
Code: Select all
Website Design: <a href="http://www.c2-it.com">C2 It Multimedia</a><br /> %s © %s
rjcalifornia wrote: ↑Thu Oct 15, 2020 6:12 am
Can you do a pastebin of the code, and post a screenshot of the footer?
admin/model/design/translation.php
line 4 change
Code: Select all
$this->db->query("INSERT INTO `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape($data['value']) . "', `date_added` = NOW()");
Code: Select all
$this->db->query("INSERT INTO `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape(html_entity_decode($data['value'], ENT_QUOTES, 'UTF-8')) . "', `date_added` = NOW()");
Code: Select all
$this->db->query("UPDATE `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape($data['value']) . "' WHERE `translation_id` = '" . (int)$translation_id . "'");
Code: Select all
$this->db->query("UPDATE `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape(html_entity_decode($data['value'], ENT_QUOTES, 'UTF-8')) . "' WHERE `translation_id` = '" . (int)$translation_id . "'");
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature
It is indeed and I am sure that Straightlight has seen itCJC wrote: ↑Thu Oct 15, 2020 8:45 pmSo I'm assuming based on the need to edit core files to make this work that this should be reported as a bug. Also, another issue is that once you have an edit created, you can never modify it. If you try to open it and make a change when you click the Save button you'll get an error and the screen will have reverted to a blank entry.
I am also aware of that issue with the modify.
It is a new feature for OC3 and has never actually worked properly .. and to be honest it is reasonable to say that since no-one really asks for the fix, no-one really uses it
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
admin/view/design/translation_form.twig
remove from line 98 - 149
Code: Select all
{% if key %}
$('select[name="store_id"]').prop('disabled', true);
$('select[name="language_id"]').prop('disabled', true);
$('select[name="route"]').prop('disabled', true);
$('select[name="key"]').prop('disabled', true);
$('input[name="key"]').prop('disabled', true);
{% else %}
$('select[name="language_id"]').on('change', function() {
$.ajax({
url: 'index.php?route=design/translation/path&user_token={{ user_token }}&language_id=' + $('select[name="language_id"]').val(),
dataType: 'json',
beforeSend: function() {
$('select[name="route"]').html('');
$('select[name="key"]').html('');
$('input[name="key"]').val('');
$('textarea[name="default"]').val('');
$('select[name="store_id"]').prop('disabled', true);
$('select[name="language_id"]').prop('disabled', true);
$('select[name="route"]').prop('disabled', true);
$('select[name="key"]').prop('disabled', true);
$('input[name="key"]').prop('disabled', true);
$('textarea[name="value"]').prop('disabled', true);
},
complete: function() {
$('select[name="store_id"]').prop('disabled', false);
$('select[name="language_id"]').prop('disabled', false);
$('select[name="route"]').prop('disabled', false);
},
success: function(json) {
html = '<option value=""></option>';
if (json) {
for (i = 0; i < json.length; i++) {
if (i == 0) {
html += '<option value="' + json[i] + '" selected="selected">' + json[i] + '</option>';
} else {
html += '<option value="' + json[i] + '">' + json[i] + '</option>';
}
}
}
$('select[name="route"]').html(html);
$('select[name="route"]').trigger('change');
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
var translation = [];
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Thank You!
by mona wrote: ↑Thu Oct 15, 2020 11:25 amYou can try this
admin/model/design/translation.php
line 4 changetoCode: Select all
$this->db->query("INSERT INTO `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape($data['value']) . "', `date_added` = NOW()");
and line 8 changeCode: Select all
$this->db->query("INSERT INTO `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape(html_entity_decode($data['value'], ENT_QUOTES, 'UTF-8')) . "', `date_added` = NOW()");
toCode: Select all
$this->db->query("UPDATE `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape($data['value']) . "' WHERE `translation_id` = '" . (int)$translation_id . "'");
Works better on 3.0.3.1 for some reason.Code: Select all
$this->db->query("UPDATE `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape(html_entity_decode($data['value'], ENT_QUOTES, 'UTF-8')) . "' WHERE `translation_id` = '" . (int)$translation_id . "'");
Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!
YES EXACTLY .. that is why OCMOD and VQMOD are the only protective / logical / sensible / safest ways forward ..
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Anyway, we are mere mortals .. This example would be this. Then you just add to this single file for all your language files.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Language Files::by_mona</name>
<code>Language Files::by_mona</code>
<version>Language Files V1</version>
<author>by-mona</author>
<link>http://support.by-mona.com/ticket/</link>
<file path="catalog/language/en-gb/common/footer.php">
<operation>
<search><![CDATA[Powered By <a href="http://www.opencart.com">OpenCart</a><br /> %s © %s]]></search>
<add position="replace"><![CDATA[Powered By <a href="http://www.c2-it.com.com">C2 It Multimedia</a><br /> %s © %s]]></add>
</operation>
</file>
</modification>
You zip up and call it language files.ocmod.zip (the OCMOD.ZIP is the important bit) upload in install. Modifications (clear &) refresh.
OC3.0.3.6 has a bug in the modification refresh for twig files (this is not a twig its a php, but just FYI). There are a few fixes around, but .. I always tell people to go into the log and press clear first anyway - then top right refresh (the bug is the refresh clear function doesn’t clear twig files) .. clean tidy and gets rid of all the previous refresh data, which you don’t need if you have a quick check through there are no NOT FOUND or ABORTS in the list (which is how you check there are no conflicts / errors ).
I attached a copy so you can just try it.
Here you can read https://github.com/opencart/opencart/wi ... ion-System
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Well, there is a Website, called Google, and they have all infos on such you'll ever need.are you aware of any guides for using it? I'm willing to learn.
https://www.google.com/search?q=VqMod+% ... 8&oe=utf-8
But better don't expect anybody to know, what will be next, when it comes to future
OC Versions, most likely 'events', but VqMod will possibly survive even that.
And strictly basically, there is no difference between VqMod and OcMod, they both
do the same, namely, 'replacing'/'adding to'/'removing' Code from the OC Source Files.
VqMod 'constructs' a 'cached' Output File out of the 'Result', to then be used, instead of
the original. VqMod places it's 'cached' output FILES into the 'vqmod/vqcache/' Section,
whereby OcMod places it's 'cached' output File CONTENT into the Database.
---
Real Professionals would NOT use both Technologies, it just makes no sense, to do the
same, just in different ways. Why use several 'Engines', if it can be done with one ? ...
It's contrary to ANY Programmer Logic, anywhere ...
So, one should decide on, what to use, and if one decides on VqMod, one should better
completly 'disable' OcMod (in the system/startup.php file, and remove the modification.xml file too),
in order to avoid 'surplus' Server Jobs and timeconsuming Database Access Requirements.
Those Sections would need to be rewritten in the system/startup.php file:
Most likely removed in most parts:
Code: Select all
// Modification Override
function modification($filename) {
if (defined('DIR_CATALOG')) {
$file = DIR_MODIFICATION . 'admin/' . substr($filename, strlen(DIR_APPLICATION));
} elseif (defined('DIR_OPENCART')) {
$file = DIR_MODIFICATION . 'install/' . substr($filename, strlen(DIR_APPLICATION));
} else {
$file = DIR_MODIFICATION . 'catalog/' . substr($filename, strlen(DIR_APPLICATION));
}
if (substr($filename, 0, strlen(DIR_SYSTEM)) == DIR_SYSTEM) {
$file = DIR_MODIFICATION . 'system/' . substr($filename, strlen(DIR_SYSTEM));
}
if (is_file($file)) {
return $file;
}
return $filename;
}
Code: Select all
if (is_file($file)) {
include_once(modification($file));
return true;
} else {
return false;
}
}
Code: Select all
// Engine
require_once(modification(DIR_SYSTEM . 'engine/action.php'));
require_once(modification(DIR_SYSTEM . 'engine/controller.php'));
require_once(modification(DIR_SYSTEM . 'engine/event.php'));
require_once(modification(DIR_SYSTEM . 'engine/router.php'));
require_once(modification(DIR_SYSTEM . 'engine/loader.php'));
require_once(modification(DIR_SYSTEM . 'engine/model.php'));
require_once(modification(DIR_SYSTEM . 'engine/registry.php'));
require_once(modification(DIR_SYSTEM . 'engine/proxy.php'));
Code: Select all
// Engine
require_once(DIR_SYSTEM . 'engine/action.php');
require_once(DIR_SYSTEM . 'engine/controller.php');
require_once(DIR_SYSTEM . 'engine/event.php');
require_once(DIR_SYSTEM . 'engine/router.php');
require_once(DIR_SYSTEM . 'engine/loader.php');
require_once(DIR_SYSTEM . 'engine/model.php');
require_once(DIR_SYSTEM . 'engine/registry.php');
require_once(DIR_SYSTEM . 'engine/proxy.php');
---
OR THEN, use this genious VqMod Engine, it also places and 'handles' it's 'cached'
modified File Content in/from the DB, in/from the same DB (Modification) Section
as used for OcMods. A 'flatfile-type' VqMod Cache Section is so no longer required.
It's one more way, to speed up overall Site Performance, if one likes to use VqMod+OcMod
In addition to avoiding different Cache-Cleaner Tools, to clean up both Cache Sections.
Integrated VQmod for OpenCart
https://www.opencart.com/index.php?rout ... n_id=19501
---
VQMODs to OCMODS or OCMODS to VQMODS
https://www.opencart.com/index.php?rout ... n_id=24897
conversion VQMOD to OCMOD Tool
https://www.opencart.com/index.php?rout ... n_id=28183
---
Just to give you some Idea on this. VqMod has further been used, because OcMod seems not capable, to
do 'everything' what VqMod is capable to, when it comes to some 'specific' Routines, whatever that means.
But I don't know more on this, someone else will possibly be able to ...
Personally, I believe in flat-file VqMod, due to the fact, that my up to ~150 VqMods would use a lot of
additional Space on the Database, and beeing called all the time. And as larger a DB get's, as slower it will be
able, to 'react'. Better use DB's for DATA, (Page-) Code has nothing to do in a Database, it, at best, makes it
more vulnerable. But that's my very personal UnPro Opinion only, so, don't take it for granted.
Good Luck!
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.