Privately testing a new template

Allowing an admin test a new template on a live site

In recent versions of Zen Cart, it is possible for an admin user to privately test a new template while other users see the regular template. Use these steps:

  • Determine your IP Address
  • Go to the screen Admin > Configuration > Website Maintenance, and enter your IP Address in the Down For Maintenance (exclude this IP-Address) field.

NOTE: If you are using a local webserver (such as MAMP or WAMP), you must use whatever value is contained in $_SERVER['REMOTE_ADDR'] for your IP Address. This will not be your public facing IP address - it might be ::1 or some other private value.

  • Visit the storefront and append the argument t=YOURNEWTEMPLATE to the URL. You will now be locally switched to the new template.

For example, if the URL was

https://MYSTORE.com/index.php

you would use

https://MYSTORE.com/index.php?t=MYTEMPLATE

If the URL was

https://MYSTORE.com/index.php?main_page=index&cPath=6

you would use

https://MYSTORE.com/index.php?main_page=index&cPath=6&t=MYTEMPLATE 
  • This only needs to be done once; it will be carried forward for subsequent page visits in the current session.

  • When you’re finished testing, append t=off to the URL to stop private testing.

If you want to make other templates available to all users (i.e. not limit it to IP addresses from the Down For Maintenance list), make the following changes:

  • copy includes/init_includes/init_templates.php to includes/init_includes/overrides/init_templates.php
  • At the bottom of includes/init_includes/overrides/init_templates.php

change

if (zen_is_whitelisted_admin_ip()) {

to

if (1) {



Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified January 21, 2022 by Scott C Wilson (f35b308).