Forums / Addon Admin Tools / Clone a Template [Support Thread]

Clone a Template [Support Thread]

Results 1 to 20 of 108
15 Jun 2016, 23:06
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Clone a Template [Support Thread]

I'll be submitting this plugin to the Plugins area for review later today or in the morning (needed the support thread for the readme).

It's an admin tool that allows you to copy all template-override files (and Layout Boxes Controller configuration) for an existing template on your store to another template name. I think it will be especially useful to create "clones" of the Responsive Classic template that's built into Zen Cart 1.5.5.

The plugin is multi-language-aware, so if your store is multi-lingual and the "source" template includes multi-lingual files, they'll all be copied to the newly-minted "target" template.

I will post back here once I've got a download link from the Plugins.
17 Jun 2016, 15:05
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Clone a Template [Support Thread]

The plugin is now available for download from the Plugins.
21 Jun 2016, 03:04
#4
jsteggy avatar

jsteggy

New Zenner

Join Date:
Jan 2012
Posts:
28
Plugin Contributions:
0

Re: Clone a Template [Support Thread]

Hi. Quick question I hope. I installed this and used it to clone a template in v1.5.5a and now have two templates with the same name in the template selection menu. Where can I change the name of one of those duplicates. The cloner tool did create the second template with the name I picked.

Thanks
21 Jun 2016, 07:43
#5
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: Clone a Template [Support Thread]

Haven't tested the pugin, but normally ,that would be on you template_info.php file.
But probably this plugin will do that.
21 Jun 2016, 11:50
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Clone a Template [Support Thread]

@jsteggy and @mesnitu, that's one of the things on my list of to-do's for the plugin (clone its name, too). As mesnitu indicated, you can physically edit the cloned template's template_info.php file so that it is displayed differently from its parent.
21 Jun 2016, 12:21
#7
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: Clone a Template [Support Thread]

or create a new template_info with a user defined name...

once I've play around with a clone template, but it was with a bash script. So I needed the template name ...and description , and the admin folder name.

But this will clone the responsive zc155 template, so with the bootstrap, etc.. right ?
21 Jun 2016, 12:26
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Clone a Template [Support Thread]

Yes, this plugin came about when I was cloning the responsive_classic template that is built into Zen Cart 1.5.5 and later.
01 Jul 2016, 12:17
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Clone a Template [Support Thread]

I've just submitted v1.1.0 to the plugins' area for review:

CHANGE: Update the cloned template's template_info file to include user-specified description.

The plugin's admin page now requires a template description; that text is used as the cloned template's "description" within its template_info.php file, allowing the template to be distinguished from its base in the Tools->Template Selection tool.
01 Jul 2016, 13:22
#10
bottyz avatar

bottyz

New Zenner

Join Date:
Mar 2010
Posts:
90
Plugin Contributions:
0

Re: Clone a Template [Support Thread]

lat9:

I've just submitted v1.1.0 to the plugins' area for review:

CHANGE: Update the cloned template's template_info file to include user-specified description.

The plugin's admin page now requires a template description; that text is used as the cloned template's "description" within its template_info.php file, allowing the template to be distinguished from its base in the Tools->Template Selection tool.


Thanks Lat9,

So far so good, works as intended. I'll update if I find any bugs :)
04 Jul 2016, 02:22
#11
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Posts:
3,427
Plugin Contributions:
2

Re: Clone a Template [Support Thread]

Just had a first play with this (very useful) plugin with one of Anne's templates (Westminster New).

Whilst all store side files are being cloned just fine, none of the template specific admin files of this template are being dealt with (4 files in my example such as files in admin/includes/auto_loaders, admin/includes/init_includes and another couple of files).

So, these files still need to be cloned manually. Are there any plans to get this implemented in future versions of this plugin?

Thanks / Frank
04 Jul 2016, 06:15
#12
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Posts:
10,620
Plugin Contributions:
212

Re: Clone a Template [Support Thread]

@lat9: Thank you for automating this tedious task.
04 Jul 2016, 07:04
#13
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Posts:
2,862
Plugin Contributions:
5

Re: Clone a Template [Support Thread]

Great tool cindy! I found 1 small error, but maybe it is already fixed in the latest version
In "YOUR_ADMIN\clone_template.php" on line 203 there is an extra "</td>"
[PHP] <td class="spacing"><?php echo zen_draw_form ('choose_template', FILENAME_CLONE_TEMPLATE, '', 'post'); ?>
<?php echo '<b>' . TEXT_TEMPLATE_SOURCE . '</b>' . zen_draw_pull_down_menu ('template_source', $template_list_dropdown, $current_template_dir) . '  <b>' . TEXT_NEW_TEMPLATE_NAME . '</b>' . zen_draw_input_field ('cloned_name') . zen_draw_hidden_field ('copy_template', 'yes') . '  ' . zen_image_submit ('button_go.gif', CLONE_TEMPLATE_GO_ALT, 'onclick="return issueWarnings ();"'); ?></td>
</form></td>[/PHP]
this should be:
[PHP] <td class="spacing"><?php echo zen_draw_form ('choose_template', FILENAME_CLONE_TEMPLATE, '', 'post'); ?>
<?php echo '<b>' . TEXT_TEMPLATE_SOURCE . '</b>' . zen_draw_pull_down_menu ('template_source', $template_list_dropdown, $current_template_dir) . '  <b>' . TEXT_NEW_TEMPLATE_NAME . '</b>' . zen_draw_input_field ('cloned_name') . zen_draw_hidden_field ('copy_template', 'yes') . '  ' . zen_image_submit ('button_go.gif', CLONE_TEMPLATE_GO_ALT, 'onclick="return issueWarnings ();"'); ?>
</form></td>[/PHP]
04 Jul 2016, 09:01
#14
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Posts:
3,427
Plugin Contributions:
2

Re: Clone a Template [Support Thread]

swguy:

@lat9: Thank you for automating this tedious task.


Absolutely! Thumbs up all around :clap::thumbsup::cheers:
04 Jul 2016, 11:10
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Clone a Template [Support Thread]

frank18:

Just had a first play with this (very useful) plugin with one of Anne's templates (Westminster New).

Whilst all store side files are being cloned just fine, none of the template specific admin files of this template are being dealt with (4 files in my example such as files in admin/includes/auto_loaders, admin/includes/init_includes and another couple of files).

So, these files still need to be cloned manually. Are there any plans to get this implemented in future versions of this plugin?

Thanks / Frank

Frank, this plugin has no way of knowing that a particular template has admin-level files that could also be "cloned". Now, if there was a standard naming convention for those admin-level files ... that would be a different answer!

Out of curiosity, to which template do you refer?
04 Jul 2016, 11:12
#16
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Clone a Template [Support Thread]

Design75:

Great tool cindy! I found 1 small error, but maybe it is already fixed in the latest version
In "YOUR_ADMIN\clone_template.php" on line 203 there is an extra "</td>"
[PHP] <td class="spacing"><?php echo zen_draw_form ('choose_template', FILENAME_CLONE_TEMPLATE, '', 'post'); ?>
<?php echo '<b>' . TEXT_TEMPLATE_SOURCE . '</b>' . zen_draw_pull_down_menu ('template_source', $template_list_dropdown, $current_template_dir) . '####<b>' . TEXT_NEW_TEMPLATE_NAME . '</b>' . zen_draw_input_field ('cloned_name') . zen_draw_hidden_field ('copy_template', 'yes') . '####' . zen_image_submit ('button_go.gif', CLONE_TEMPLATE_GO_ALT, 'onclick="return issueWarnings ();"'); ?></td>
</form></td>[/PHP]
this should be:
[PHP] <td class="spacing"><?php echo zen_draw_form ('choose_template', FILENAME_CLONE_TEMPLATE, '', 'post'); ?>
<?php echo '<b>' . TEXT_TEMPLATE_SOURCE . '</b>' . zen_draw_pull_down_menu ('template_source', $template_list_dropdown, $current_template_dir) . '####<b>' . TEXT_NEW_TEMPLATE_NAME . '</b>' . zen_draw_input_field ('cloned_name') . zen_draw_hidden_field ('copy_template', 'yes') . '####' . zen_image_submit ('button_go.gif', CLONE_TEMPLATE_GO_ALT, 'onclick="return issueWarnings ();"'); ?>
</form></td>[/PHP]

Eek! Thanks, Design75, I'll get that bug noted and corrected in GitHub.
04 Jul 2016, 12:15
#17
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Posts:
3,427
Plugin Contributions:
2

Re: Clone a Template [Support Thread]

lat9:

Frank, this plugin has no way of knowing that a particular template has admin-level files that could also be "cloned". Now, if there was a standard naming convention for those admin-level files ... that would be a different answer!

Out of curiosity, to which template do you refer?


Thanks Cindy,

It is Westminster New

But, as I said, it's only 4 files to clone, no big issue. As long as one is aware of this....
05 Jul 2016, 11:19
#18
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Clone a Template [Support Thread]

lat9:

I've just submitted v1.1.0 to the plugins' area for review:

CHANGE: Update the cloned template's template_info file to include user-specified description.

The plugin's admin page now requires a template description; that text is used as the cloned template's "description" within its template_info.php file, allowing the template to be distinguished from its base in the Tools->Template Selection tool.

v1.1.0 is now available for download.
14 Jul 2016, 13:04
#19
allmart avatar

allmart

Zen Follower

Join Date:
Feb 2016
Posts:
190
Plugin Contributions:
0

Re: Clone a Template [Support Thread]

Sorry but I am a little unclear on the procedure of cloning the template. After I clone my template, through admin, do I then select the cloned template as the master where I do my mods and re-clone that template after changes have been made or do I after cloning the original template, select the original template as the master and clone that one after after changes.

Thanks
14 Jul 2016, 13:41
#20
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Clone a Template [Support Thread]

allmart:

Sorry but I am a little unclear on the procedure of cloning the template. After I clone my template, through admin, do I then select the cloned template as the master where I do my mods and re-clone that template after changes have been made or do I after cloning the original template, select the original template as the master and clone that one after after changes.

Thanks

When you Clone a Template, you're making a copy of the current contents of the files associated with that template as well as the template's layout-boxes settings. For example, if you've been making modifications to the responsive_classic template's file-set then cloning responsive_classic will pick up all the changes you've made to date into your newly-cloned template folders.

Once you've made a clone (i.e. copy) of that template, you'll go to Tools->Template Selection and select that newly-cloned template as your active template and then go to Tools->Layout Boxes Controller and click that big RESET button at the bottom of the screen to make sure that the layout-boxes are properly set.

For example, if you are cloning the responsive_classic template and entered allmart_rc as your Target Template then the cloning process copies all files from the /responsive_classic folders to their respective /allmart_rc ones. You'll make all further edits to the files in the /allmart_rc folders ... and you'll have "protected" your changes from inadvertent template-file overwrites on the next Zen Cart upgrade!