News:

AbanteCart v1.4.2 is released.

Main Menu
support

Need to create a POPUP

Started by Billy0298, November 11, 2013, 03:57:10 PM

Previous topic - Next topic

Billy0298

Hello,

I Need to create a pop up window when customers access my store. I would like to put a warning message Like disclaimer before the enter the site. How can i make this possible do ineed to create block and then enter code in index. php t call for that pop up/block on enter to my site? if so can some one please help me with the code and instructions.

Your help is very much appreciated

Billy0298


abantecart

Simple approach:
Create HTML block with JavaScript to show warning and assign this block to main page layout

If you need separate page, this is a harder approach.
You will need to create new extension/controller and add predespatch controller before loading index page.

Similar approach implemented in 'login to view products' extension.   
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Billy0298

sounds difficult is there an easy way may be to put this code in index.php

<script type="text/javascript">

function popup(){
  cuteLittleWindow = window.open("page.html", "littleWindow", "location=no,width=320,height=200");
}

</script>

Billy0298

:( that didn't work can, you please walk me through as to what i need to do to  create a pop up html window on the start of my store. so for example customer enters my store and a pop up window shows up with a disclaimer customer click on the link in that window i have the disclaimer written and links in htm to either enter the store or not. I have to make sure that the store is opened in the background and a small html window as pop up at the same time

Billy0298

PLEASE CAN SOMEBODY HELP ME i CANT USE THE STORE WITH OUT THE DISCLAIMER MY CREDIT CARD PROCESSOR REQUIRES THIS POP UP WINDOW - DON'T WANT TO GO TO PRESTASHOP OR OSCOMMERCE THESE ARE THE ONLY SHOPPING CARTS THAT HAVE THIS OPTION AVAILABLE,

I LOVE THIS SHOPPING CART THERE IS GOT TO BE A SOLUTION HERE PLEASE SUPPORT ME

PAUL

JHammond53

#6
Paul,

Here are 2 different options to achieve what you want

Browse to the following file public_html  ->  storefront  ->  view  ->  default_html5  ->  template  ->  pages  ->  index  ->  home.tpl

Modify home.tpl with the following code.



OPTION 1 -> Popup alert (just a string of text) (won't be blocked by pop up blockers)

Blue is existing
red is new code
purple is where you put your message


<section class="container">
   <div class="welcome_msg">
      <?php echo $welcome; ?>
   </div>
</section>


<script>
  $(document).ready(function(){
    alert('MESSAGE HERE');
  });
</script>




OPTION 2 -> Popup window (opens url) (will be blocked by pop up blockers)

Blue is existing
red is new code
purple is where you put URL


<section class="container">
   <div class="welcome_msg">
      <?php echo $welcome; ?>
   </div>
</section>


<script>
  $(document).ready(function(){
    testwindow = window.open("URL HERE", "mywindow", "location=1,status=1,scrollbars=1,width=100,height=100");
    testwindow.moveTo(0, 0);
  });
</script>

Billy0298

THANK YOU SOOOOO MUCH THAT WORKED  :) :) :) :)

abantecart

That works, but careful on upgrades if this file is part of update script.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

JHammond53

Quote from: abantecart on November 14, 2013, 08:24:45 AM
That works, but careful on upgrades if this file is part of update script.

I have also achieved it by creating a block and applying to home layout page per your first comment and it works the same as the second option I posted. Its just a more permanent effect if an upgrade were to happen like you said. His response to your first post was that it seemed too difficult (IMO easier than the options I gave).

Paul, if you want to have a more permanent option do the following:
   1.   Log into the admin side of the cart, browse to Design -> Blocks
   2.   Click on the "Insert" icon to the right of the page
   3.   Give your popup a name and title
   4.   Add the following code to the custom block content (make sure you click "Source" to enter the code side of the editor)
         <script>
         $(document).ready(function(){
            testwindow = window.open("URL HERE", "mywindow", "location=1,status=1,scrollbars=1,width=500,height=500");
            testwindow.moveTo(0, 0);
         });
         </script>


   5.   Click Save, then browse to Design -> Layouts
   6.   On the left, click Home Page
   7.   At the top, find a slot that has "--- None ---" and click the drop down. Find "html_block:: YOUR POPUP NAME" 
   8.   Click Save.
   9.   Try it out

abolabo

also do not forget attribute type for script tag for html-validation pass.
i mean <script type="text/javascript">
"No one is useless in this world who lightens the burdens of another."
― Charles Dickens

Forum Rules Code of conduct
AbanteCart.com 2010 -