Clone a Template for Zen Cart v1.5.0 (and later)

Version 1.2.1 by lat9

Copyright (C) 2016-2019, Vinos de Frutas Tropicales

Current Support Thread at Zen Cart Forums: https://www.zen-cart.com/showthread.php?220458-Clone-a-Template-Support-Thread

What it does

With the release of Zen Cart 1.5.5a and its built-in responsive template, I found that creating "clones" of that template by hand were getting to be a pain! Rather than continue with that pain, this plugin came into being! Once you're copied the plugin's files to your store's file-system, you'll find a new admin-menu entry: Tools->Clone a Template

Clone a Template enables you to create a copy of any of your store's templates with a single button-click. The processing copies all template-override files from a source template to a target, copies that source-template's Layout Boxes Controller database settings to the new template and finally updates the target-template's /includes/templates/target_template/template_info.php to identify the source-template's folder-name and the date/time of the cloning operation.

v1.2.0 of Clone a Template introduces the capability to also remove a template's template-override files … for any add-on or cloned templates in your store. This action deletes all files and associated directories and removes all Layout Boxes Controller settings from your database.

This section identifies the procedure you'll use to install/update or remove the plugin for your Zen Cart.

There are no core-file overwrites required by Clone a Template. Just rename the YOUR_ADMIN folder to match your Zen Cart admin's folder name and then copy the plugin's files to your store's file-system:

  1. /YOUR_ADMIN/clone_template.php
  2. /YOUR_ADMIN/includes/auto_loaders/config.clone_template.php
  3. /YOUR_ADMIN/includes/classes/class.admin.cloneTemplate.php
  4. /YOUR_ADMIN/includes/extra_datafiles/clone_template_filenames.php
  5. /YOUR_ADMIN/includes/init_includes/init_clone_template.php
  6. /YOUR_ADMIN/includes/languages/english/clone_template.php
  7. /YOUR_ADMIN/includes/languages/english/extra_definitions/clone_template_name.php

First, delete the files that were copied to your Zen Cart installation's admin directories. Then use your admin's Tools->Run SQL Patches to run the file /docs/clone_template/uninstall/clone_template_uninstall.sql.

This section identifies the files added or modified for this plugin as well as the plugin's change history.

The plugin provides the following files in its distribution zip-file.

  1. /YOUR_ADMIN/clone_template.php
  2. /YOUR_ADMIN/includes/auto_loaders/config.clone_template.php
  3. /YOUR_ADMIN/includes/classes/class.admin.cloneTemplate.php
  4. /YOUR_ADMIN/includes/extra_datafiles/clone_template_filenames.php
  5. /YOUR_ADMIN/includes/init_includes/init_clone_template.php
  6. /YOUR_ADMIN/includes/languages/english/clone_template.php
  7. /YOUR_ADMIN/includes/languages/english/extra_definitions/clone_template_name.php
  • v1.2.1, 2019-08-15:
    • BUGFIX: Correct overzealous replacement of target template name.
    • The following files were changed:
      1. /YOUR_ADMIN/includes/classes/class.admin.cloneTemplate.php
      2. /YOUR_ADMIN/includes/languages/english/clone_template.php
  • v1.2.0, 2017-05-31:
    • BUGFIX: Remove extraneous </td>.
    • CHANGE: Enable a cloned or add-on template's template-override files to be removed.
  • v1.1.0, 2016-07-01:
    • CHANGE: Update the target-template's "template_info.php" file to enable identification of the newly-cloned template.
  • v1.0.0, 2016-06-16:
    • Initial release.