Author Topic: Need to create a POPUP  (Read 13584 times)

Offline Billy0298

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Need to create a POPUP
« on: November 11, 2013, 03:57:10 PM »
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

Offline Billy0298

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Need to create a POPUP
« Reply #1 on: November 11, 2013, 07:52:16 PM »
any one please help

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Need to create a POPUP
« Reply #2 on: November 12, 2013, 09:33:36 AM »
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

Offline Billy0298

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Need to create a POPUP
« Reply #3 on: November 12, 2013, 12:38:32 PM »
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>

Offline Billy0298

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Need to create a POPUP
« Reply #4 on: November 12, 2013, 12:50:22 PM »
:( 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

Offline Billy0298

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Need to create a POPUP
« Reply #5 on: November 13, 2013, 01:49:28 PM »
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

Offline JHammond53

  • Newbie
  • *
  • Posts: 39
  • Karma: +11/-0
    • View Profile
Re: Need to create a POPUP
« Reply #6 on: November 13, 2013, 02:46:09 PM »
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>
« Last Edit: November 13, 2013, 02:57:40 PM by JHammond53 »

Offline Billy0298

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Need to create a POPUP
« Reply #7 on: November 13, 2013, 04:05:45 PM »
THANK YOU SOOOOO MUCH THAT WORKED  :) :) :) :)

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Need to create a POPUP
« Reply #8 on: November 14, 2013, 08:24:45 AM »
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

Offline JHammond53

  • Newbie
  • *
  • Posts: 39
  • Karma: +11/-0
    • View Profile
Re: Need to create a POPUP
« Reply #9 on: November 14, 2013, 09:17:21 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

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2046
  • Karma: +318/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Need to create a POPUP
« Reply #10 on: November 14, 2013, 07:03:25 PM »
also do not forget attribute type for script tag for html-validation pass.
i mean
Code: [Select]
<script type="text/javascript">
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

 

Powered by SMFPacks Social Login Mod