Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Good popup script


monte22

Recommended Posts

I am looking for a popup script that contains a cookie so that it only appears once. I want to show my customers one thing, but not have it bother them everytime they navigate back to the homepage.

 

Is anyone using something like this?

Link to comment
Share on other sites

I think this is probably what you are looking for.

 

<script language="javascript">
// BOF:  Session PopUp---------------------------------------------------------
var onoff="on"
function openpopup(){
var popurl="pagetopopuphere.html"
winpops=window.open(popurl,"","width=250,height=355,screenX=150,screenY=150,top=150,left=150")
}

function get_cookie(Name) {
//this function is used only if you had selected popup to load ONCE per session
//You may remove this function if variable "onoff" above is set to "off"
 var search = Name + "="
 var returnvalue = "";
 if (document.cookie.length > 0) {
   offset = document.cookie.indexOf(search)
   if (offset != -1) { // if cookie exists
     offset += search.length
     // set index of beginning of value
     end = document.cookie.indexOf(";", offset);
     // set index of end of cookie value
     if (end == -1)
        end = document.cookie.length;
     returnvalue=unescape(document.cookie.substring(offset, end))
     }
  }
 return returnvalue;
}

function loadpopup(){
if (onoff=="on"){
if (get_cookie('alreadypopped')==''){
openpopup()
document.cookie="alreadypopped=yes"
}
}
else
openpopup()
}

loadpopup()
// EOF:  Session PopUp---------------------------------------------------------
</script>

 

This will load your popup once per browser session. That way as people navigate through your site they don't get a popup on every page, only when they initially enter your site. You can see it in action on my site by clicking my WWW link down below.

 

Make sure to edit:

var popurl="pagetopopuphere.html"

to the page you want to load in the popup.

 

And then edit your popup window parameters in this code:

(popurl,"","width=250,height=355,screenX=150,screenY=150,top=150,left=150")

Hope this helps.

Link to comment
Share on other sites

  • 2 weeks later...

Hello, Here is my index.php::

 

<?php
/*
 $Id: index.php,v 1.1 2003/06/11 17:38:00 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [URL=http://www.oscommerce.com]http://www.oscommerce.com[/URL]

 Copyright ? 2003 osCommerce

 Released under the GNU General Public License
*/
<head>
<script language="javascript">
// BOF:  Session PopUp---------------------------------------------------------
var onoff="on"
function openpopup(){
var popurl="pagetopopuphere.html"
winpops=window.open(popurl,"","width=250,height=360,screenX=150,screenY=150,top=150,left=150")
}

function get_cookie(Name) {
//this function is used only if you had selected popup to load ONCE per session
//You may remove this function if variable "onoff" above is set to "off"
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
  offset = document.cookie.indexOf(search)
  if (offset != -1) { // if cookie exists
    offset += search.length
    // set index of beginning of value
    end = document.cookie.indexOf(";", offset);
    // set index of end of cookie value
    if (end == -1)
       end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
 }
return returnvalue;
}

function loadpopup(){
if (onoff=="on"){
if (get_cookie('alreadypopped')==''){
openpopup()
document.cookie="alreadypopped=yes"
}
}
else
openpopup()
}

loadpopup()
// EOF:  Session PopUp---------------------------------------------------------
</script>
</head>
define('TEXT_MAIN', 'Welcome to C & D Computer Consulting We are currently working on adding new product to our store inventory, <b>If you are looking for a product and cant find it feel free to contact us and we will do our best to locate it for you.</b> Please feel free to check back with us as our inventory grows we will be better able to serve you!!<br><br><table border="0" width="100%" cellspacing="5" cellpadding="2"><tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/1.gif') . '</td><td class="main" valign="top"><b>Error Messages</b><br><br>If there are any error or warning messages shown above, please correct them first before proceeding.<br><br>Error messages are displayed at the very top of the page with a complete <span class="messageStackError">background</span> color.<br><br>Several checks are performed to ensure a healthy setup of your online store - these checks can be disabled by editing the appropriate parameters at the bottom of the includes/application_top.php file.</td></tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/2.gif') . '</td><td class="main" valign="top"><b>Editing Page Texts</b><br><br>The text shown here can be modified in the following file, on each language basis:<br><br><nobr class="messageStackSuccess">[path to catalog]/includes/languages/' . $language . '/' . FILENAME_DEFAULT . '</nobr><br><br>That file can be edited manually, or via the Administration Tool with the <nobr class="messageStackSuccess">Languages->' . ucfirst($language) . '->Define</nobr> or <nobr class="messageStackSuccess">Tools->File Manager</nobr> modules.<br><br>The text is set in the following manner:<br><br><nobr>define(\'TEXT_MAIN\', \'<span class="messageStackSuccess">This is a default setup of the osCommerce project...</span>\');</nobr><br><br>The text highlighted in green may be modified - it is important to keep the define() of the TEXT_MAIN keyword. To remove the text for TEXT_MAIN completely, the following example is used where only two single quote characters exist:<br><br><nobr>define(\'TEXT_MAIN\', \'\');</nobr><br><br>More information concerning the PHP define() function can be read <a href="http://www.php.net/define" target="_blank"><u>here</u></a>.</td></tr><tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/3.gif') . '</td><td class="main" valign="top"><b>Securing The Administration Tool</b><br><br>It is important to secure the Administration Tool as there is currently no security implementation available.</td></tr><tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/4.gif') . '</td><td class="main" valign="top"><b>Online Documentation</b><br><br>Online documentation can be read at the <a href="http://wiki.oscommerce.com" target="_blank"><u>osCommerce Wiki Documentation Effort</u></a> site.<br><br>Community support is available at the <a href="http://www.oscommerce.com/forums" target="_blank"><u>osCommerce Community Support Forums</u></a> site.</td></tr></table><br>If you wish to download the solution powering this shop, or if you wish to contribute to the osCommerce project, please visit the <a href="http://www.oscommerce.com" target="_blank"><u>support site of osCommerce</u></a>. This shop is running on osCommerce version <font color="#f0000"><b>' . PROJECT_VERSION . '</b></font>.');
define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');
define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');
define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');

if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) {
 define('HEADING_TITLE', 'Let\'s See What We Have Here');
 define('TABLE_HEADING_IMAGE', '');
 define('TABLE_HEADING_MODEL', 'Model');
 define('TABLE_HEADING_PRODUCTS', 'Product Name');
 define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');
 define('TABLE_HEADING_QUANTITY', 'Quantity');

 

Thanks

David

Link to comment
Share on other sites

David, you should restore your original /homepages/28/d88783310/htdocs/store/includes/languages/english/index.php file. That is not where you should be making changes. Make the changes in /homepages/28/d88783310/htdocs/store/index.php instead.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...