Post by TheJD » Tue Dec 04, 2018 8:21 am

I think this is the right place. I will explain the task I was doing and the results. I am sure this would be a bug issue...if not please move to the proper category.
Using OC 3.0.2.0
Pretty much a fresh copy

Goal: I wanted to add a page to the store that would keep a customer on the store, but load a custom widget on a page that would allow customers to sign up for a credit line program.

Here are the steps I did...first I kept trying to to do the HTML Content Module process, but that would not work. It would never show me the title of the content i made when i tried to select it from the drop down under the styles. So what I did was create a new information page and added the HTML code under the code button. At first i would go to the info page and create a new page, title it and then in the body area i would click the CODE button and add the code in there. After, i would save the new info page and i noticed it would show a empty body when i loaded it on the store. After a test of clicking around, I realized I had to actually click the code button again after entering the data the first time into CODE to load the data in the field box with what I had entered, then save the info page for it to actually save the info page.

When i finally saw it working and loading the custom widget with the customer style settings and script code i am entering, i went back to change a few things in the info page, and when i saved the page the widget seemed to load 2 times, then when i checked and saved again it was there a third time, and then 4th. every time i would enter and save/adjust to the info page, it was adding another instance of the widget code i had input into the code area.
The code it was adding to the 3rd line of the data is a <iframe code. This iframe was being generated on the preview before i clicked on CODE, so the load of that was causing the CODE to write another iframe each time i loaded that info page to edit it out....this is the bug.

Hopefully I explained this correctly, and there is a fix for it.

Thank you

Newbie

Posts

Joined
Thu Nov 29, 2018 4:27 pm

Post by IP_CAM » Tue Dec 04, 2018 10:50 am

Well, it's not easy to find out, what you did in detail, but did you always
use the correct Editor Setting, and NOT add Source Code into the
wysiwyg Section of the Editor. And/or in reverse ? 8)
Still, such is NEVER an OC BUG, or it would be widespread known,
but likely someone else's :D
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.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by TheJD » Tue Dec 04, 2018 12:04 pm

IP_CAM wrote:
Tue Dec 04, 2018 10:50 am
Well, it's not easy to find out, what you did in detail, but did you always
use the correct Editor Setting, and NOT add Source Code into the
wysiwyg Section of the Editor. And/or in reverse ? 8)
Still, such is NEVER an OC BUG, or it would be widespread known,
but likely someone else's :D
Ernie
ok i will bring some more details as to what i am doing right now...
Last edited by TheJD on Tue Dec 04, 2018 12:13 pm, edited 1 time in total.

Newbie

Posts

Joined
Thu Nov 29, 2018 4:27 pm

Post by TheJD » Tue Dec 04, 2018 12:11 pm

Ok so i am adding a Behalf.com payment widget. The info for the widget is found here: http://resources.behalf.com/wp-content/ ... Widget.pdf

On the cart admin, i go to Catalog then Information. I add a Financing page, and in the body area I am clicking on the CODE button and inputting this:

Code: Select all

<center>
<div id="behalf-payment-element"> </div>

<style>
  #behalf-payment-element {
    min-width: 320px;
  }
</style>

<script>
  window.behalfPaymentReady = function() {
    var config = {
      "clientToken" : "TOKENID",
      "showPromo" : true,
      "callToAction" : {
        "workflow" : "redirect"
      }
    }
    BehalfPayment.init(config);
    BehalfPayment.load("#behalf-payment-element");
  };
</script>
<script src="https://sdk.behalf.com/sdk/v4/behalf_payment_sdk.js" async></script>
</center>
Now the first issue i noticed is if I just enter this code and click the save icon, it actually is NOT saving the code i entered into that created page. it is keeping it blank or empty. I have to press CODE again AFTER i enter the code in there to load the body back up and then it shows the data i entered under CODE, only then can we click save to save what is in there.

The issue I am seeing after saving and loading the page and seeing it is all working is that if i go back to the Info page to edit it around a little and save, it is automatically creating a template line within the code:

Code: Select all

<center>
<div id="behalf-payment-element"> <iframe src="//app.behalf.com/service?connection=CONNECTIONNUMBERSIAMTAKINGOUT" id="behalf-embedded-widget" scrolling="no" style="min-width: 320px; max-width: 566px;" width="100%" height="852" frameborder="0"></iframe></div>

<style>
  #behalf-payment-element {
    min-width: 320px;
  }
</style>

<script>
  window.behalfPaymentReady = function() {
    var config = {
      "clientToken" : "TOKENID",
      "showPromo" : true,
      "callToAction" : {
        "workflow" : "redirect"
      }
    }
    BehalfPayment.init(config);
    BehalfPayment.load("#behalf-payment-element");
  };
</script>
<script src="https://sdk.behalf.com/sdk/v4/behalf_payment_sdk.js" async=""></script>
</center>
This iframe code is being added to my code and saved each time i reload and save the page i am creating"

Code: Select all

<iframe src="//app.behalf.com/service?connection=CONNECTIONNUMBERSIAMTAKINGOUT" id="behalf-embedded-widget" scrolling="no" style="min-width: 320px; max-width: 566px;" width="100%" height="852" frameborder="0"></iframe>
Without knowing this, i edited and saved and edited and saved, and it kept making a new line each time until i finally realized that the line is being created automatically and saved without me knowing. This is the bug (i think)

Newbie

Posts

Joined
Thu Nov 29, 2018 4:27 pm

Post by ADD Creative » Wed Dec 05, 2018 1:18 am

There are two issues, both to do with the Summernote editor. Probably why it's been dropped and replaced by CKEditor for the next version.

The first is the Summernote will not save in code view. This is the standard behaviour apparently. https://github.com/summernote/summernote/issues/1996
I use the following workaround. It may work for you.
viewtopic.php?f=202&t=207621#p737212

The second is that Summernote will execute scripts when switching out of code view. https://github.com/summernote/summernote/issues/1462
I'm not sure there is a workaround for this.

Your best option may be to try checking the extension store for an extension that will replace Summernote with CKEditor or another editor.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by TheJD » Wed Dec 05, 2018 3:19 am

ADD Creative wrote:
Wed Dec 05, 2018 1:18 am
There are two issues, both to do with the Summernote editor. Probably why it's been dropped and replaced by CKEditor for the next version.

The first is the Summernote will not save in code view. This is the standard behaviour apparently. https://github.com/summernote/summernote/issues/1996
I use the following workaround. It may work for you.
viewtopic.php?f=202&t=207621#p737212

The second is that Summernote will execute scripts when switching out of code view. https://github.com/summernote/summernote/issues/1462
I'm not sure there is a workaround for this.

Your best option may be to try checking the extension store for an extension that will replace Summernote with CKEditor or another editor.
So adding a CKEditor extension I would use the "source" button and enter the data that way right? I am looking at some of the demos now

Newbie

Posts

Joined
Thu Nov 29, 2018 4:27 pm

Post by ADD Creative » Wed Dec 05, 2018 10:52 pm

Yes. However you need to check how that version of handles script tags. In OpenCart 1.5.x script tags work as you would expect. Executed on the catalogue side but not in admin. OpenCart 3.1 beta, however, seems to remove script tags when switching out of source view.

It will be down to the version of CKEditor and how the extension has configured it. You may be able to test the demo sites that they don't remove the script tags on switching from source view.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 103 guests