Zen Cart Logo
Forums / All Other Contributions/Addons / Javascripts loading twice on the page

Javascripts loading twice on the page

Views: 1,926

Results 1 to 17 of 17
16 Dec 2015, 8:10 PM
#1
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Javascripts loading twice on the page

https://ad-discountperformance.com/

If you go to our website and view the source code you will see that the GTS javascript is loading twice and i can't seem to figure out why and how to go about fixing this issue.

If anyone can help me with this it would be great here is what i have tried so far.

  1. unstalled all files and ran the unistalled SQL
  2. checked all files for duplicate javascript there is none
  3. Reinstalled all files and loaded all info again and it is still showing 2 java script lines. ( line 142 & Line 322) in the view source section.
17 Dec 2015, 3:19 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Javascripts loading twice on the page

If you use Admin->Tools->Developers Toolkit, and use the "last" search box to "search all .php files" ... and choose "all Catalog files", and search for: trustedstores

... then it should show you a list of all files where "trustedstores" is found.
That may offer some clues for something you hadn't considered.

Which plugin are you using to add this trustedstores functionality to your store?

17 Dec 2015, 2:41 PM
#3
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

DrByte:

If you use Admin->Tools->Developers Toolkit, and use the "last" search box to "search all .php files" ... and choose "all Catalog files", and search for: trustedstores

... then it should show you a list of all files where "trustedstores" is found.
That may offer some clues for something you hadn't considered.

Which plugin are you using to add this trustedstores functionality to your store?

the plugin is from numinix called google trusted stores version 1.2.8

i have tried to search for duplicates using the developers tool kit ill check it again and see if anything shows on this installed one v

17 Dec 2015, 3:14 PM
#4
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

DrByte:

If you use Admin->Tools->Developers Toolkit, and use the "last" search box to "search all .php files" ... and choose "all Catalog files", and search for: trustedstores

... then it should show you a list of all files where "trustedstores" is found.
That may offer some clues for something you hadn't considered.

Which plugin are you using to add this trustedstores functionality to your store?

ok only found one thing

public_html/includes/templates/***********/jscript/jscript_google_trusted_stores.php

Line #34 : gts.src = "https://www.googlecommerce.com/trustedstores/api/js";

17 Dec 2015, 4:08 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Javascripts loading twice on the page

Okay, good. That means there's only one file that's actually outputting the snippet.

But now do a search for jscript_google_trusted_stores .... just in case you've got some code that's calling it multiple times. (Keep in mind that since it's named jscript_* it's gonna get loaded once automatically anyway, so if it's also mentioned in any other file that'll be what's making it run again.)

17 Dec 2015, 4:38 PM
#6
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

DrByte:

Okay, good. That means there's only one file that's actually outputting the snippet.

But now do a search for jscript_google_trusted_stores .... just in case you've got some code that's calling it multiple times. (Keep in mind that since it's named jscript_* it's gonna get loaded once automatically anyway, so if it's also mentioned in any other file that'll be what's making it run again.)

Searching 1560 files ... for: jscript_google_trusted_stores

Match Lines found: 0
Warning Error: No matching Configuration Keys were found ... jscript_google_trusted_stores

17 Dec 2015, 5:01 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Javascripts loading twice on the page

Hmmm ...

Numinix Support has probably encountered this before, and probably will come up with an answer faster than me downloading and studying the plugin in more detail.

17 Dec 2015, 5:02 PM
#8
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

DrByte:

Hmmm ...

Numinix Support has probably encountered this before, and probably will come up with an answer faster than me downloading and studying the plugin in more detail.

i haven't had any luck with that route. I opened a ticket with them and haven't heard anything in a week

17 Dec 2015, 5:20 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Javascripts loading twice on the page

Wait. This has nothing to do with Trusted Stores.

Your site is loading ALL your CSS and JS stuff twice.

And I think that's because you're using the CSS/JS-Loader plugin (which I've always hated because, well, it's a mess).
You'll need to sort out why the plugin is firing and the default loading of css and js is also firing.

Getting rid of all that duplication will make your site faster :)

17 Dec 2015, 5:42 PM
#10
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

DrByte:

Wait. This has nothing to do with Trusted Stores.

Your site is loading ALL your CSS and JS stuff twice.

And I think that's because you're using the CSS/JS-Loader plugin (which I've always hated because, well, it's a mess).
You'll need to sort out why the plugin is firing and the default loading of css and js is also firing.

Getting rid of all that duplication will make your site faster :)

oh boy. So any suggestions on where to start?

17 Dec 2015, 5:59 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Javascripts loading twice on the page

Probably your html_header.php and/or tpl_main_page.php .... but it's been so long since I used that CSS/JS-Loader plugin that I don't remember all the ways it mangles things.

17 Dec 2015, 7:29 PM
#12
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

DrByte:

Probably your html_header.php and/or tpl_main_page.php .... but it's been so long since I used that CSS/JS-Loader plugin that I don't remember all the ways it mangles things.

my current html.header.php file looks like this

<?php /** * Common Template * * outputs the html header. i,e, everything that comes before the \</head\> tag <br /> * * @package templateSystem * @copyright Copyright 2003-2014 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version GIT: $Id: Author: DrByte Jul 5 2014 Modified in v1.5.4 $ * Altered by rbarbour (ZCAdditions.com), Responsive DIY Template Default for 1.5.x (65) * Modified by Anne (Picaflor-Azul.com) Westminster New v1.3 */ /** * load the module for generating page meta-tags */ require(DIR_WS_MODULES . zen_get_module_directory('meta_tags.php')); /** * output main page HEAD tag and related headers/meta-tags, etc */ ?> <?php // (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65) if (!class_exists('Mobile_Detect')) { include_once(DIR_WS_CLASSES . 'Mobile_Detect.php'); $detect = new Mobile_Detect; } // (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>> <head> <title><?php echo META_TAG_TITLE; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" /> <meta name="keywords" content="<?php echo META_TAG_KEYWORDS; ?>" /> <meta name="description" content="<?php echo META_TAG_DESCRIPTION; ?>" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="author" content="The Zen Cart® Team. Responsive zen cart design by Picaflor Azul. " /> <meta name="generator" content="shopping cart program by Zen Cart®, <http://www.zen-cart.com> eCommerce" /> <?php // (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" /> <?php // (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?> <?php if (defined('ROBOTS_PAGES_TO_SKIP') && in_array($current_page_base,explode(",",constant('ROBOTS_PAGES_TO_SKIP'))) || $current_page_base=='down_for_maintenance' || $robotsNoIndex === true) { ?> <meta name="robots" content="noindex, nofollow" /> <?php } ?> <?php if (defined('FAVICON')) { ?> <link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" /> <link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" /> <?php } //endif FAVICON ?> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" /> <?php if (isset($canonicalLink) && $canonicalLink != '') { ?> <link rel="canonical" href="<?php echo $canonicalLink; ?>" /> <?php } ?> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <?php /** * load the loader files */

if($RI_CJLoader->get('status') && (!isset($Ajax) || !$Ajax->status())){
$RI_CJLoader->autoloadLoaders();
$RI_CJLoader->loadCssJsFiles();
$files = $RI_CJLoader->header();

foreach($files['css'] as $file)
if($file['include']) {
include($file['src']);
} else if (!$RI_CJLoader->get('minify_css') || $file['external']) {
echo '<link rel="stylesheet" type="text/css" href="'.$file['src'].'" />'."\n";
} else {
echo '<link rel="stylesheet" type="text/css" href="min/?f='.$file['src'].'&'.$RI_CJLoader->get('minify_time').'" />'."\n";
}

foreach($files['jscript'] as $file)
if($file['include']) {
include($file['src']);
} else if(!$RI_CJLoader->get('minify_js') || $file['external']) {
echo '<script type="text/javascript" src="'.$file['src'].'"></script>'."\n";
} else {
echo '<script type="text/javascript" src="min/?f='.$file['src'].'&'.$RI_CJLoader->get('minify_time').'"></script>'."\n";
}
}

/**

  • load all template-specific stylesheets, named like "style*.css", alphabetically
    /
    $directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^style/', '.css');
    while(list ($key, $value) = each($directory_array)) {
    echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
    }
    /
    *
  • load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
    */
    $manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
    $tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
    $tmp_pagename = ($this_is_home_page) ? 'index_home' : $current_page_base;
    if ($current_page_base == 'page' && isset($ezpage_id)) $tmp_pagename = $current_page_base . (int)$ezpage_id;
    $sheets_array = array('/' . $_SESSION['language'] . 'stylesheet',
    '/' . $tmp_pagename,
    '/' . $SESSION['language'] . '' . $tmp_pagename,
    '/c
    ' . $cPath,
    '/' . $SESSION['language'] . 'c' . $cPath,
    '/m
    ' . $manufacturers_id,
    '/' . $SESSION['language'] . 'm' . (int)$manufacturers_id,
    '/p
    ' . $tmp_products_id,
    '/' . $_SESSION['language'] . 'p' . $tmp_products_id
    );
    while(list ($key, $value) = each($sheets_array)) {
    //echo "<!--looking for: $value-->\n";
    $perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . $value . '.css';
    if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
    }

/**

  • custom category handling for a parent and all its children ... works for any c_XX_XX_children.css where XX_XX is any parent category
    */
    $tmp_cats = explode('', $cPath);
    $value = '';
    foreach($tmp_cats as $val) {
    $value .= $val;
    $perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/c
    ' . $value . '_children.css';
    if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
    $perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . $_SESSION['language'] . 'c' . $value . 'children.css';
    if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
    $value .= '
    ';
    }

/**

  • load printer-friendly stylesheets -- named like "print*.css", alphabetically
    */
    $directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^print/', '.css');
    sort($directory_array);
    while(list ($key, $value) = each($directory_array)) {
    echo '<link rel="stylesheet" type="text/css" media="print" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
    }

/**

  • load all site-wide jscript_*.js files from includes/templates/YOURTEMPLATE/jscript, alphabetically
    */
    $directory_array = $template->get_template_part($template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.js');
    while(list ($key, $value) = each($directory_array)) {
    echo '<script type="text/javascript" src="' . $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value . '"></script>'."\n";
    }

/** CDN for jQuery core **/
?>

<?php /** * load all page-specific jscript_*.js files from includes/modules/pages/PAGENAME, alphabetically */ $directory_array = $template->get_template_part($page_directory, '/^jscript_/', '.js'); while(list ($key, $value) = each($directory_array)) { echo '<script type="text/javascript" src="' . $page_directory . '/' . $value . '"></script>' . "\n"; } /** * load all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically */ $directory_array = $template->get_template_part($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.php'); while(list ($key, $value) = each($directory_array)) { /** * include content from all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically. * These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page */ require($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value); echo "\n"; } /** * include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically. */ $directory_array = $template->get_template_part($page_directory, '/^jscript_/'); while(list ($key, $value) = each($directory_array)) { /** * include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically. * These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page */ require($page_directory . '/' . $value); echo "\n"; } // DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->'; // (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65) if (COLUMN_WIDTH == '0' || (in_array($current_page_base,explode(",",'popup_image,popup_image_additional')) )) { echo ''; } else { $responsive_mobile = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . 'responsive_mobile.css' . '" />'; require($template->get_template_dir('responsive_mobile.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/responsive_mobile.php'); $responsive_tablet = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . 'responsive_tablet.css' . '" />'; require($template->get_template_dir('responsive_tablet.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/responsive_tablet.php'); $responsive_default = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . 'responsive_default.css' . '" />'; echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . 'responsive.css' . '" />'; if ($detect->isMobile() && !$detect->isTablet() or $detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode']=='isMobile' or $detect->isTablet() && $_SESSION['display_mode']=='isMobile' or $_SESSION['display_mode']=='isMobile') { echo $responsive_mobile; } else if ($detect->isTablet() or $detect->isMobile() && $_SESSION['display_mode']=='isTablet' or $detect->isTablet() && $_SESSION['display_mode']=='isTablet' or $_SESSION['display_mode']=='isTablet'){ echo $responsive_tablet; } else if ($detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode']=='isDesktop' or $detect->isTablet() && $_SESSION['display_mode']=='isDesktop' or $_SESSION['display_mode']=='isNonResponsive'){ echo ''; } else { echo $responsive_default; } } if($detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode']=='isDesktop' or $detect->isTablet() && $_SESSION['display_mode']=='isDesktop' or $detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode']=='isNonResponsive' or $detect->isTablet() && $_SESSION['display_mode']=='isNonResponsive' or $_SESSION['display_mode']=='isNonResponsive'){ $fluidisFixed = 'fluidIsFixed'; } else { $fluidisFixed = ''; } // (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?> <script src="<?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/css_browser_selector.js' ?>" type="text/javascript"></script> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet" /> </head> <?php // NOTE: Blank line following is intended: ?>

I noticed that there are 2 lines that are the same

  • load all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically
    /
    $directory_array = $template->get_template_part($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.php');
    while(list ($key, $value) = each($directory_array)) {
    /
    *

But im not sure if im on the right track and how to fix that.

17 Dec 2015, 7:38 PM
#13
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Javascripts loading twice on the page

You didn't merge the file correct. try the code below

<?php
/**
 * Common Template
 *
 * outputs the html header. i,e, everything that comes before the \</head\> tag <br />
 *
 * @package templateSystem
 * @copyright Copyright 2003-2014 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte Jul 5 2014 Modified in v1.5.4 $
 * Altered by rbarbour (ZCAdditions.com), Responsive DIY Template Default for 1.5.x (65)
 * Modified by Anne (Picaflor-Azul.com) Westminster New v1.3
 */
/**
 * load the module for generating page meta-tags
 */
require(DIR_WS_MODULES . zen_get_module_directory('meta_tags.php'));
/**
 * output main page HEAD tag and related headers/meta-tags, etc
 */
?>


<?php
// (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65)

if (!class_exists('Mobile_Detect')) {
  include_once(DIR_WS_CLASSES . 'Mobile_Detect.php');
  $detect = new Mobile_Detect;
}

// (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65)
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
<head>
<title><?php echo META_TAG_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
<meta name="keywords" content="<?php echo META_TAG_KEYWORDS; ?>" />
<meta name="description" content="<?php echo META_TAG_DESCRIPTION; ?>" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="author" content="The Zen Cart® Team. Responsive zen cart design by Picaflor Azul. " />
<meta name="generator" content="shopping cart program by Zen Cart®, http://www.zen-cart.com eCommerce" />

<?php // (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />

<?php // (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?>

<?php if (defined('ROBOTS_PAGES_TO_SKIP') && in_array($current_page_base,explode(",",constant('ROBOTS_PAGES_TO_SKIP'))) || $current_page_base=='down_for_maintenance' || $robotsNoIndex === true) { ?>
<meta name="robots" content="noindex, nofollow" />
<?php } ?>
<?php if (defined('FAVICON')) { ?>
<link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<?php } //endif FAVICON ?>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
<?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
<link rel="canonical" href="<?php echo $canonicalLink; ?>" />
<?php } ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <?php
    /**
     * load the loader files
     */
    if ($RI_CJLoader->get('status') && (!isset($Ajax) || !$Ajax->status())) {
      $RI_CJLoader->autoloadLoaders();
      $RI_CJLoader->loadCssJsFiles();
      $files = $RI_CJLoader->header();

      foreach ($files['css'] as $file) {
        if ($file['include']) {
          include($file['src']);
        } else if (!$RI_CJLoader->get('minify_css') || $file['external']) {
          echo '<link rel="stylesheet" type="text/css" href="' . $file['src'] . '" />' . "\n";
        } else {
          echo '<link rel="stylesheet" type="text/css" href="min/?f=' . $file['src'] . '&' . $RI_CJLoader->get('minify_time') . '" />' . "\n";
        }
      }

      foreach ($files['jscript'] as $file) {
        if ($file['include']) {
          include($file['src']);
        } else if (!$RI_CJLoader->get('minify_js') || $file['external']) {
          echo '<script type="text/javascript" src="' . $file['src'] . '"></script>' . "\n";
        } else {
          echo '<script type="text/javascript" src="min/?f=' . $file['src'] . '&' . $RI_CJLoader->get('minify_time') . '"></script>' . "\n";
        }
      }
    }
// DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
// (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65)

    if (COLUMN_WIDTH == '0' || (in_array($current_page_base, explode(",", 'popup_image,popup_image_additional')) )) {

      echo '';
    } else {
      $responsive_mobile = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . 'responsive_mobile.css' . '" />';
      require($template->get_template_dir('responsive_mobile.php', DIR_WS_TEMPLATE, $current_page_base, 'common') . '/responsive_mobile.php');
      $responsive_tablet = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . 'responsive_tablet.css' . '" />';
      require($template->get_template_dir('responsive_tablet.php', DIR_WS_TEMPLATE, $current_page_base, 'common') . '/responsive_tablet.php');
      $responsive_default = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . 'responsive_default.css' . '" />';
      echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . 'responsive.css' . '" />';
      if ($detect->isMobile() && !$detect->isTablet() or $detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode'] == 'isMobile' or $detect->isTablet() && $_SESSION['display_mode'] == 'isMobile' or $_SESSION['display_mode'] == 'isMobile') {
        echo $responsive_mobile;
      } else if ($detect->isTablet() or $detect->isMobile() && $_SESSION['display_mode'] == 'isTablet' or $detect->isTablet() && $_SESSION['display_mode'] == 'isTablet' or $_SESSION['display_mode'] == 'isTablet') {
        echo $responsive_tablet;
      } else if ($detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode'] == 'isDesktop' or $detect->isTablet() && $_SESSION['display_mode'] == 'isDesktop' or $_SESSION['display_mode'] == 'isNonResponsive') {
        echo '';
      } else {
        echo $responsive_default;
      }
    }

    if ($detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode'] == 'isDesktop' or $detect->isTablet() && $_SESSION['display_mode'] == 'isDesktop' or $detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode'] == 'isNonResponsive' or $detect->isTablet() && $_SESSION['display_mode'] == 'isNonResponsive' or $_SESSION['display_mode'] == 'isNonResponsive') {
      $fluidisFixed = 'fluidIsFixed';
    } else {
      $fluidisFixed = '';
    }
// (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65)
    ?>

<script src="<?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/css_browser_selector.js' ?>" type="text/javascript"></script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet" />


</head>
<?php // NOTE: Blank line following is intended: ?>
17 Dec 2015, 7:47 PM
#14
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

Design75:

You didn't merge the file correct. try the code below

<?php /** * Common Template * * outputs the html header. i,e, everything that comes before the \</head\> tag <br /> * * @package templateSystem * @copyright Copyright 2003-2014 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version GIT: $Id: Author: DrByte Jul 5 2014 Modified in v1.5.4 $ * Altered by rbarbour (ZCAdditions.com), Responsive DIY Template Default for 1.5.x (65) * Modified by Anne (Picaflor-Azul.com) Westminster New v1.3 */ /** * load the module for generating page meta-tags */ require(DIR_WS_MODULES . zen_get_module_directory('meta_tags.php')); /** * output main page HEAD tag and related headers/meta-tags, etc */ ?> <?php // (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65) if (!class_exists('Mobile_Detect')) { include_once(DIR_WS_CLASSES . 'Mobile_Detect.php'); $detect = new Mobile_Detect; } // (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>> <head> <title><?php echo META_TAG_TITLE; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" /> <meta name="keywords" content="<?php echo META_TAG_KEYWORDS; ?>" /> <meta name="description" content="<?php echo META_TAG_DESCRIPTION; ?>" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="author" content="The Zen Cart® Team. Responsive zen cart design by Picaflor Azul. " /> <meta name="generator" content="shopping cart program by Zen Cart®, http://www.zen-cart.com eCommerce" /> <?php // (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" /> <?php // (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?> <?php if (defined('ROBOTS_PAGES_TO_SKIP') && in_array($current_page_base,explode(",",constant('ROBOTS_PAGES_TO_SKIP'))) || $current_page_base=='down_for_maintenance' || $robotsNoIndex === true) { ?> <meta name="robots" content="noindex, nofollow" /> <?php } ?> <?php if (defined('FAVICON')) { ?> <link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" /> <link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" /> <?php } //endif FAVICON ?> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" /> <?php if (isset($canonicalLink) && $canonicalLink != '') { ?> <link rel="canonical" href="<?php echo $canonicalLink; ?>" /> <?php } ?> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <?php /** * load the loader files */ if ($RI_CJLoader->get('status') && (!isset($Ajax) || !$Ajax->status())) { $RI_CJLoader->autoloadLoaders(); $RI_CJLoader->loadCssJsFiles(); $files = $RI_CJLoader->header();
  foreach ($files['css'] as $file) {
    if ($file['include']) {
      include($file['src']);
    } else if (!$RI_CJLoader->get('minify_css') || $file['external']) {
      echo '<link rel="stylesheet" type="text/css" href="' . $file['src'] . '" />' . "\n";
    } else {
      echo '<link rel="stylesheet" type="text/css" href="min/?f=' . $file['src'] . '&' . $RI_CJLoader->get('minify_time') . '" />' . "\n";
    }
  }

  foreach ($files['jscript'] as $file) {
    if ($file['include']) {
      include($file['src']);
    } else if (!$RI_CJLoader->get('minify_js') || $file['external']) {
      echo '<script type="text/javascript" src="' . $file['src'] . '"></script>' . "\n";
    } else {
      echo '<script type="text/javascript" src="min/?f=' . $file['src'] . '&' . $RI_CJLoader->get('minify_time') . '"></script>' . "\n";
    }
  }
}

// DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
// (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65)

if (COLUMN_WIDTH == '0' || (in_array($current_page_base, explode(",", 'popup_image,popup_image_additional')) )) {

  echo '';
} else {
  $responsive_mobile = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . 'responsive_mobile.css' . '" />';
  require($template->get_template_dir('responsive_mobile.php', DIR_WS_TEMPLATE, $current_page_base, 'common') . '/responsive_mobile.php');
  $responsive_tablet = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . 'responsive_tablet.css' . '" />';
  require($template->get_template_dir('responsive_tablet.php', DIR_WS_TEMPLATE, $current_page_base, 'common') . '/responsive_tablet.php');
  $responsive_default = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . 'responsive_default.css' . '" />';
  echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . 'responsive.css' . '" />';
  if ($detect->isMobile() && !$detect->isTablet() or $detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode'] == 'isMobile' or $detect->isTablet() && $_SESSION['display_mode'] == 'isMobile' or $_SESSION['display_mode'] == 'isMobile') {
    echo $responsive_mobile;
  } else if ($detect->isTablet() or $detect->isMobile() && $_SESSION['display_mode'] == 'isTablet' or $detect->isTablet() && $_SESSION['display_mode'] == 'isTablet' or $_SESSION['display_mode'] == 'isTablet') {
    echo $responsive_tablet;
  } else if ($detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode'] == 'isDesktop' or $detect->isTablet() && $_SESSION['display_mode'] == 'isDesktop' or $_SESSION['display_mode'] == 'isNonResponsive') {
    echo '';
  } else {
    echo $responsive_default;
  }
}

if ($detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode'] == 'isDesktop' or $detect->isTablet() && $_SESSION['display_mode'] == 'isDesktop' or $detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode'] == 'isNonResponsive' or $detect->isTablet() && $_SESSION['display_mode'] == 'isNonResponsive' or $_SESSION['display_mode'] == 'isNonResponsive') {
  $fluidisFixed = 'fluidIsFixed';
} else {
  $fluidisFixed = '';
}

// (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65)
?>

<script src="<?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/css_browser_selector.js' ?>" type="text/javascript"></script> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet" /> </head> <?php // NOTE: Blank line following is intended: ?> ```

THANKS !! that fixed the problem

17 Dec 2015, 8:39 PM
#15
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

Ok i just found another problem

Our checkout doesn't seem to be working in Firefox any suggestions on that?

17 Dec 2015, 8:47 PM
#16
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Javascripts loading twice on the page

Dashizna:

Ok i just found another problem

Our checkout doesn't seem to be working in Firefox any suggestions on that?

I went all the way to the confirmation page, and all seems to work. Except for some lay-out problems

17 Dec 2015, 8:50 PM
#17
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Javascripts loading twice on the page

Design75:

I went all the way to the confirmation page, and all seems to work. Except for some lay-out problems

yes but there is no way to select a payment option so you can't confirm the order. its cutting off a bunch of things

I have a test item on the site and you can choose a pay by phone option to test at this time. The test item is part number Test item 1000