Quote Originally Posted by swguy View Post
You can take the 1.5.8 copy of init_templates.php and add the override check (line 38-54 from my mod) to line 32 and it will work. For PHP 8+, you have to do an empty() check on $_SESSION['skin'] too before checking it against $new_template_dir.

But are you sure you still need this plugin? Have you looked at this:
https://docs.zen-cart.com/user/templ...ivate_testing/
I tried this and many other ways and they all failed.
PHP Code:
/**
 * Allow admins to switch templates using &t= URL parameter
 */
if (zen_is_whitelisted_admin_ip()) {
    
// check if a template override was requested and that the template exists on the filesystem
    
if (isset($_GET['t']) && file_exists(DIR_WS_TEMPLATES $_GET['t'])) {
        
$_SESSION['tpl_override'] = $_GET['t'];
    }
    if (isset(
$_GET['t']) && $_GET['t'] === 'off') {
        unset(
$_SESSION['tpl_override']);
    }
    if (isset(
$_SESSION['tpl_override'])) $template_dir $_SESSION['tpl_override'];

  
/* See if there is an override */
    
if (isset($_GET['skin'])) { 
    if (
$_GET['skin'] != '') { 
       
$new_template_dir zen_db_prepare_input($_GET['skin']);
    if (isset(
$_SESSION['skin'])) {
           if (
$_SESSION['skin'] != $new_template_dir) { 
                  
$_SESSION['skin'] = $new_template_dir
           }
       }
       
$template_dir $new_template_dir
    } else { 
       if (isset(
$_SESSION['skin'])) { 
          unset(
$_SESSION['skin']);
       }
    }
  } else if (isset(
$_SESSION['skin'])) {
    
$template_dir $_SESSION['skin'];
  } 
Would you tell me what I'm doing wrong?

Thanks!