Page 1 of 1

Information Page with Form and Javascript?

Posted: Thu Feb 09, 2017 2:23 pm
by McYoda
Dear all
I'm completely lost. Have been searching forums, google, well more or less all the web for two hours now, but didn't find a solution.

What I want to do:
I want to create an Information Page, which is easy in fact. But: my HTML code includes a form and javascript. And that does not work. When I put the code in the editor (in code view mode!) and I click save, I get just a strange value ("0.35") shown on a blank page apart from that and the "save" never get back to the OpenCart backend.
After reloading the content I tried to save is completely lost.

Just for information: the form I like to put in that information page is a price calculator for scuba diving gases.

I've attached the zipped *.html file, since it is quite a long code to put it in code tags. If you open that html in a browser it works perfectly (apart from having a bad look without css ;-))

I hope somebody can guide me how to accomplish my goal to have this html file as an information page in OpenCart. I really need this stuff. So any help is highly appreciated.

I'm on OpenCart 2.3.0.2 using Journal Theme 2.

Thanks for any hints
Martin

Re: Information Page with Form and Javascript?

Posted: Thu Feb 09, 2017 7:11 pm
by paulfeakins
Hi Martin,

You probably don't want to try and paste all that in to the WYSIWYG editor.

You'd be better off creating a new template .tpl file, adding the code in there, then selecting your template for the page.

Cheers,
Paul

Re: Information Page with Form and Javascript?

Posted: Fri Feb 10, 2017 12:52 am
by IP_CAM
well, wondering, I just downloaded a socalled 'clean category Page' extension, and inserted your html file
content, as it came, into it's catclean.tpl file. Then, I created a new category, called TEST, by use
of the Admin, using the Layout Override Clean Cat, and this is the 'very quick step' result of all this, it
does not even show an error somewhere, it even works in full, to my big surprise. :D
Extension used (in my OC v.1.5.6.5!)
https://www.opencart.com/index.php?rout ... n_id=18429
The Category is called TEST, visible in my Cat Sections.
Just to give you a hint. ;)
Ernie

http://www.evelo.li/shop/index.php?rout ... ry&path=62

Re: Information Page with Form and Javascript?

Posted: Sun Feb 12, 2017 2:54 pm
by McYoda
Hi Paul
Thanks for this hint. Trying since 3 hours now reading google links like hell.
I got a template ready but I don't get the my content to work...
You don't happen to have some more hints?

Re: Information Page with Form and Javascript?

Posted: Sun Feb 12, 2017 2:55 pm
by McYoda
Hi IP_CAM
Nice idea. Wrote to the developer about v2.3.0.2 compatibility. We'll see....
Thanks for this.

Re: Information Page with Form and Javascript?

Posted: Sun Feb 12, 2017 6:22 pm
by pprmkr
Install attached file using Extensions - Installer
Refresh Modifications

Edit the Information page you want to display the calculation form .
Enter {GasRechner} there where you want to place the form.

Before and/or after {GasRechner} type your text ...

What does this modification do ?
- It searches for {GasRechner} in information - description
- It replaces the text {GasRechner} with $this->load->view('information/gasrechner');
- Content before and after {GasRechner} are placed before and after $this->load->view('information/gasrechner')

Re: Information Page with Form and Javascript?

Posted: Fri Feb 17, 2017 1:16 am
by McYoda
Thanks for all your support.
I managed it by installing CKEditor and just creating an information page.
CKEditor is way more powerful than this cheap Summernote thing.

Re: Information Page with Form and Javascript?

Posted: Sat Jan 11, 2020 3:57 pm
by hobbykit
Dear all,

I have a similar problem. I've been browsing the google for two days, but I can't find any information.
In my old site I had a calculator (for connecting resistors and capacitors, and some basic electrical laws) and everyone used it.
My HTML code includes a form.
I am now using OpenCart 2.0.1.1, and cannot use it.

Any help will be helpful to me.
Thank you for your time.

Georgi

Re: Information Page with Form and Javascript?

Posted: Wed Jan 15, 2020 4:34 am
by pprmkr
Download and install with Extension - Installer
Then Refresh modification

On any information page you can enter:

Code: Select all

{ECalculator}

This code will be replaced by the calculator.

See demo

Please report back ...

When helpfull : show apriciation

Re: Information Page with Form and Javascript?

Posted: Wed Jan 15, 2020 9:47 pm
by hobbykit
Thanks for the quick response and assistance.
I downloaded it, installed it. No problem about that.
But it stopped loading information pages (Information - About Us, Catalog, Partners and Distributors).
Maybe I confused something. I don't understand much. Sorry about that.
Can I place it in Categories?

Re: Information Page with Form and Javascript?

Posted: Wed Jan 15, 2020 10:27 pm
by pprmkr
Sorry. Modifications always added calculator.
Fixed : check presents of {ECalculator}

- Delete Exensions - Modifications - PprMkr Including Electronics calculator
- Download and reinstall attached archive.
- Refresh Modifications

Re: Information Page with Form and Javascript?

Posted: Wed Jan 15, 2020 10:45 pm
by hobbykit
I post it, but I get the error:

/public_html/vqmod/vqcache/vq2-system_modification_system_engine_loader.php on line 45

Can I place it in Categories, not on the information page?

Re: Information Page with Form and Javascript?

Posted: Thu Jan 16, 2020 4:37 pm
by pprmkr
Attached : Now possible to add to information page and category

See category demo ( language English only )
See information demo

Extensions - Modification: Delete 'PprMkr Including Electronics calculator'
Extensions - Extensie Installer: Install 'electronics_calculater.ocmod.zip'
Extensions - Modification: Refresh

Re: Information Page with Form and Javascript?

Posted: Thu Jan 16, 2020 5:48 pm
by hobbykit
Thank you. Works perfectly.
I installed electronics_calculater_oc201.ocmod.zip
At the risk of me becoming insolent, to ask. Can there be two languages? English and Bulgarian?

Re: Information Page with Form and Javascript?

Posted: Thu Jan 16, 2020 6:01 pm
by pprmkr
Multilanguage. Just type {ECalculator} in each description field.

Note: Text on calculator will not be translated !
However: this can be done, but requires language files for each language and extra controller code.

Re: Information Page with Form and Javascript?

Posted: Thu Jan 16, 2020 11:20 pm
by pprmkr
Uninstall previous.
Install latest.

You have to translate language files and copy to catalog/language/Your_Language/information folder yourself.

Re: Information Page with Form and Javascript?

Posted: Fri Jan 17, 2020 4:14 pm
by hobbykit
Thank you so much !
I translated it. Works perfectly.
You're a great person !