Forums / Addon Sideboxes / template switch addon

template switch addon

Views: 45,477

Results 21 to 40 of 62
12 Jul 2009, 11:31 PM
#21
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

template switch addon

navido:

In which path is this templates.txt file uploaded to?

Just as the read me states

  1. edit images/templates.txt; put in your templates for switching

Zen-Venom Get Bitten

19 Jul 2009, 9:26 PM
#22
navido avatar

navido

Zen Follower

Join Date:
Sep 2008
Posts:
221
Plugin Contributions:
0

Re: template switch addon

  1. edit images/templates.txt; put in your templates for switching

Thanks for answering, but i still dont get it, in your templates for switching it says..but where in your template? in what folder? :wacko:

20 Jul 2009, 8:36 AM
#23
hugo13 avatar

hugo13

Zen Follower

Join Date:
Apr 2004
Location:
vienna
Posts:
176
Plugin Contributions:
4

Re: template switch addon

navido:

Thanks for answering, but i still dont get it, in your templates for switching it says..but where in your template? in what folder? :wacko:

edit SHOP_ROOT/images/templates.txt file
or goto admin > tools > templateSwitcher & the file will be generated ( if you have write permissions fot the images-folder )

20 Jul 2009, 10:52 PM
#24
navido avatar

navido

Zen Follower

Join Date:
Sep 2008
Posts:
221
Plugin Contributions:
0

Re: template switch addon

Anyone else having problem with this? As one of the users wrote in the beginning of this thread i also get the classic view, and i cannot switch to other templates in my admin

I have 1.3.8a off course, and i have enabled the templateswitch sidebox to "Yes" for all of my templates.

The templates.txt file is put into www/images/

but still no work.

Anyone please??

20 Jul 2009, 11:03 PM
#25
navido avatar

navido

Zen Follower

Join Date:
Sep 2008
Posts:
221
Plugin Contributions:
0

Re: template switch addon

I deleted the "init_templates.php" from included/init_includes/overrides and now my template is ok and i can switch between the templates in my admin.

But off course the file init_tempaltes.php should not be deleted..is it maybe supposed to be in the " included/init_includes" folder?

22 Jul 2009, 3:56 PM
#26
navido avatar

navido

Zen Follower

Join Date:
Sep 2008
Posts:
221
Plugin Contributions:
0

Re: template switch addon

Anyone please?:(

13 Aug 2009, 5:47 AM
#27
ultimate_zc avatar

ultimate_zc

Zen Follower

Join Date:
Jun 2008
Location:
Osprey, Florida
Posts:
147
Plugin Contributions:
7

Re: template switch addon

I have a temporary solution that worked for me. Find your file includes\init_includes\overrides*init_templates.php*. On that file find the following code on line 41:

 $template_dir = 'classic'; 
   if(isset($_GET['template_switch_id'])){
    zen_setcookie("zctemplate", $_GET['template_switch_id'], time()+(60*60*24*365));
    $template_dir = $_GET['template_switch_id'];
  } else {
      if(isset($_COOKIE["zctemplate"])){
        $template_dir = $_COOKIE["zctemplate"];
        zen_setcookie("zctemplate", $_COOKIE["zctemplate"], time()+(60*60*24*365)); 
      }
  }

and change it to:

 $template_dir = 'classic'; 
   if(isset($_GET['template_switch_id'])){
    zen_setcookie("zctemplate", $_GET['template_switch_id'], time()+(60*60*24*365));
    $template_dir = $_GET['template_switch_id'];
  }

the only problem with this solution is that the chosen template will not be stored in a cookie for future visits.

I have this addon installed in one of my websites and works fine. I installed the same files on a different website and ran into the same problem you did.:blink:

If I find a better solution I'll post it here.

1 Sep 2009, 1:18 AM
#28
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,444
Plugin Contributions:
3

Re: template switch addon

Would this work with different size of header, columns, and boxes if they are fixed?

IDEASLady
IDEAS Creative Studio

Your image... our business!

9 Dec 2009, 3:14 PM
#29
mydigitalfixation avatar

mydigitalfixation

New Zenner

Join Date:
Nov 2009
Posts:
6
Plugin Contributions:
0

Re: template switch addon

I installed this mod and now find that the buttons are a little issue. If I set a template to use css buttons then when switching between templates the other templates will also have to use the css buttons. For some templates I would like to have css buttons turned off.

If I have css buttons turned on in admin settings, is there a file I can override on a per template basis to hardcode turning off css buttons?

10 Dec 2009, 10:59 AM
#30
hugo13 avatar

hugo13

Zen Follower

Join Date:
Apr 2004
Location:
vienna
Posts:
176
Plugin Contributions:
4

Re: template switch addon

MyDigitalFixation:

If I have css buttons turned on in admin settings, is there a file I can override on a per template basis to hardcode turning off css buttons?

one way could be to change the database-entry IMAGE_USE_CSS_BUTTONS ```
UPDATE configuration SET configuration_key = 'IMAGE_USE_CSS_BUTTONS_' WHERE configuration_key = 'IMAGE_USE_CSS_BUTTONS' LIMIT 1;


this files make use from the constant IMAGE_USE_CSS_BUTTONS```
includes\functions\html_output.php (267:20)
includes\functions\html_output.php (293:20)
includes\templates\template_default\sideboxes\tpl_search.php (17:18)
includes\templates\template_default\sideboxes\tpl_search_header.php (16:18)

you have now to create or modify the file includes\templates\YOUR_TEMPLATE\common\main_template_vars.php

add a line with ```
define('IMAGE_USE_CSS_BUTTONS', 'no')


you can see it
- <http://demo.zen-cart.at/index.php?main_page=product_info&cPath=25&products_id=100&language=de&template_switch_id=css> == CSS buttons
<http://demo.zen-cart.at/index.php?main_page=product_info&cPath=25&products_id=100&language=de&template_switch_id=XAJAX> == image buttons
10 Dec 2009, 1:17 PM
#31
mydigitalfixation avatar

mydigitalfixation

New Zenner

Join Date:
Nov 2009
Posts:
6
Plugin Contributions:
0

Re: template switch addon

Thank you very much!

I've revised code to alter the look of zencart but have never revised the functional code (except for installing mods) so I better run this by you first to be sure I get it correct.

From includes\functions\html_output.php

line 267

if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes' && strlen($alt)<30) return zenCssButton($image, $alt, 'submit', $sec_class /, $parameters = ''/ );

line 293

if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') return zenCssButton($image, $alt, 'button', $sec_class, $parameters = '');

From includes/templates/template_default/sideboxes - the code referencing IMAGE_USE_CSS_BUTTONS

your line 17, in my file is at line 33

if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {

From includes/templates/template_default/sideboxes - the code referencing IMAGE_USE_CSS_BUTTONS

your line 16, in my file is at line 31

if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {

for the above strings, after they have been revised, is this how they should look?

From includes\functions\html_output.php

line 267

if (strtolower(UPDATE configuration SET configuration_key = 'IMAGE_USE_CSS_BUTTONS_' WHERE configuration_key = 'IMAGE_USE_CSS_BUTTONS' LIMIT 1;) == 'yes' && strlen($alt)<30) return zenCssButton($image, $alt, 'submit', $sec_class /, $parameters = ''/ );

line 293

if (strtolower(UPDATE configuration SET configuration_key = 'IMAGE_USE_CSS_BUTTONS_' WHERE configuration_key = 'IMAGE_USE_CSS_BUTTONS' LIMIT 1;) == 'yes') return zenCssButton($image, $alt, 'button', $sec_class, $parameters = '');

From includes/templates/template_default/sideboxes - the code referencing IMAGE_USE_CSS_BUTTONS

your line 17, in my file is at line 33

if (strtolower(UPDATE configuration SET configuration_key = 'IMAGE_USE_CSS_BUTTONS_' WHERE configuration_key = 'IMAGE_USE_CSS_BUTTONS' LIMIT 1;) == 'yes') {

From includes/templates/template_default/sideboxes - the code referencing IMAGE_USE_CSS_BUTTONS

your line 16, in my file is at line 31

if (strtolower(UPDATE configuration SET configuration_key = 'IMAGE_USE_CSS_BUTTONS_' WHERE configuration_key = 'IMAGE_USE_CSS_BUTTONS' LIMIT 1;) == 'yes') {

10 Dec 2009, 1:28 PM
#32
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,444
Plugin Contributions:
3

Re: template switch addon

Can someone PLEASE, answer my question? :cry:

IDEASLady
IDEAS Creative Studio

Your image... our business!

10 Dec 2009, 1:48 PM
#33
hugo13 avatar

hugo13

Zen Follower

Join Date:
Apr 2004
Location:
vienna
Posts:
176
Plugin Contributions:
4

Re: template switch addon

sorry for confusion

you have only to manipulate 1 template file :: includes\templates\YOUR_TEMPLATE\common\main_template_vars.php
if the file does not exist, copy the one from template_default
now add a line with

  if (file_exists(DIR_WS_MODULES . 'pages/' . $current_page_base . '/main_template_vars.php')) {
    $body_code = DIR_WS_MODULES . 'pages/' . $current_page_base . '/main_template_vars.php';
  } else {
    $body_code = $template->get_template_dir('tpl_' . preg_replace('/.php/', '',$_GET['main_page']) . '_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_' . $_GET['main_page'] . '_default.php';
  }

// template-switch
define('IMAGE_USE_CSS_BUTTONS', 'no');
  1. use zen-cart admin
    tools > install sql patches and run ```
    UPDATE configuration SET configuration_key = 'IMAGE_USE_CSS_BUTTONS_', configuration_title = 'CSS Buttons (functionless)' WHERE configuration_key = 'IMAGE_USE_CSS_BUTTONS' LIMIT 1;
10 Dec 2009, 1:55 PM
#34
hugo13 avatar

hugo13

Zen Follower

Join Date:
Apr 2004
Location:
vienna
Posts:
176
Plugin Contributions:
4

Re: template switch addon

@ideasgirl
look at :: http://demo.zen-cart.at/index.php?main_page=index&template_switch_id=viennablood

viennablood == the standard german-template; 800px
XAJAX == 1024px & ajax for products
css == zen-cart international = screen wide
hugo13_orange == smarty based template (never finished)

10 Dec 2009, 2:02 PM
#35
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,444
Plugin Contributions:
3

Re: template switch addon

hugo13:

@ideasgirl
look at :: http://demo.zen-cart.at/index.php?main_page=index&template_switch_id=viennablood

viennablood == the standard german-template; 800px
XAJAX == 1024px & ajax for products
css == zen-cart international = screen wide
hugo13_orange == smarty based template (never finished)

Yes Hugo, but my question goes to "if it fixed" and not fluid. See, your templates (and other I've seen) are with fluid backgrounds (colors and bars) but I haven't seen it with different columns and boxes with different fixed width (which usually you have to change in admin panel).

IDEASLady
IDEAS Creative Studio

Your image... our business!

10 Dec 2009, 2:37 PM
#36
mydigitalfixation avatar

mydigitalfixation

New Zenner

Join Date:
Nov 2009
Posts:
6
Plugin Contributions:
0

Re: template switch addon

That works perfectly. Thank you very much for the mod and the extra help!

10 Dec 2009, 3:02 PM
#37
hugo13 avatar

hugo13

Zen Follower

Join Date:
Apr 2004
Location:
vienna
Posts:
176
Plugin Contributions:
4

Re: template switch addon

I think you can do all what you can do with css
look at: http://demo.zen-cart.at/index.php?main_page=index&template_switch_id=css

#navColumnTwo {
  width: 111px !IMPORTANT;
}

#templateswitch {
	position:absolute;
	width:400px !IMPORTANT;
	height:15px;
	z-index:1;
	left: 333px;
	top: 77px;
}
#categories{
	position:absolute;
	width:200px !IMPORTANT;
	height:15px;
	z-index:1;
	left: 3px;
	top: 77px;
}
10 Dec 2009, 3:32 PM
#38
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,444
Plugin Contributions:
3

Re: template switch addon

Ok, great! I'll give it a try...

IDEASLady
IDEAS Creative Studio

Your image... our business!

1 Aug 2010, 4:53 AM
#39
luisitolozano avatar

luisitolozano

New Zenner

Join Date:
Aug 2009
Posts:
11
Plugin Contributions:
0

Re: template switch addon

Hi there is any way to make this template switcher to do the job automatic every time it detects an iphone browser, it will be great :smartalec:

16 Sep 2010, 6:01 PM
#40
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: template switch addon

I have a dumb question. Do i need to upload each template that I plan on using to switch templates, or how does this work. I mean if I going to let my customers pick from 10 different templates do I upload all these? If not this does not work. I can not change from the default template and it is all screwed up. Thank you in advance.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation