Page 1 of 1

[SOLVED] Website Popup Box

Posted: Sat Feb 22, 2025 11:16 pm
by porter943
Hello Everyone,
I'm trying to place a Welcome popup box on my website on page load but can seem to find the place (or file) to insert the popup box code, I have tried placing it on the header.twig but it did not work. I'm using OC version 3.0.2.0
Would anyone know where to place the popup box code?
Thank you

Re: Website Popup Box

Posted: Sun Feb 23, 2025 12:28 am
by JNeuhoff
Probably the common/footer.twig would be the place to add your JQuery/javascript code for the popup, using an OpenCart event handler.

Re: Website Popup Box

Posted: Sun Feb 23, 2025 12:56 am
by porter943
Tried that but did not work!
Here is the code I want to insert.
<?php
echo '<script type="text/javascript">
window.onload = function () { alert("Welcome!."); }</script>';
?>

Re: Website Popup Box

Posted: Sun Feb 23, 2025 6:23 am
by grgr
You don't need the <?php ... ?> tags.

Re: Website Popup Box

Posted: Sun Feb 23, 2025 6:46 am
by porter943
Okay now where do I insert the code?

Re: Website Popup Box

Posted: Sun Feb 23, 2025 6:33 pm
by johnp
porter943 wrote:
Sun Feb 23, 2025 6:46 am
Okay now where do I insert the code?
An easy way is to install an extension that lets you add custom JS to the the site header. You just need to add this:

Code: Select all

<script type="text/javascript">
window.onload = function () { alert("Welcome!."); }</script>
If in doubt post in the commercial support forum for some assistance.

Re: Website Popup Box

Posted: Sun Feb 23, 2025 7:56 pm
by nonnedelectari
A welcome alert on every page load, that's going to be annoying.

Re: Website Popup Box

Posted: Sun Feb 23, 2025 11:46 pm
by OSWorX
nonnedelectari wrote:
Sun Feb 23, 2025 7:56 pm
A welcome alert on every page load, that's going to be annoying.
No .. really .. ?
Remembers me back in the end of the '90s O0

And javascript?
No, flash would be much better .. :hammer: