Zen Cart Logo
Forums / General Questions / Single sideboxes in override folders

Single sideboxes in override folders

Views: 1,219

Results 1 to 18 of 18
31 Jul 2014, 1:56 AM
#1
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Single sideboxes in override folders

I've created a new sidebox that will be in the site header. I tried putting the module file in modules/sideboxes/custom_template but quickly discovered that doesn't work. A single sidebox like the search_header has to be placed in the modules/sideboxes directory.

Is it possible to do this with a single file? The regular sideboxes work fine with one only in an override folder. I really prefer to see it in an override directory so that I can find the non-default items easily.

31 Jul 2014, 4:05 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

What is the code you're using in the header to "call" the sidebox so that it gets displayed? Maybe that's what needs some adjusting to allow it to work with override folders?

31 Jul 2014, 11:06 AM
#3
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Single sideboxes in override folders

It's just checking to see if certain fields are empty or not. Without any check at all (like removing the check statement from search_header), it just displays whether turned on or off. Totally different from the normal sideboxes.

$check_query = "select count(*) as count
                      from " . TABLE_CONFIGURATION ."
                      where configuration_group_id = ". (int)$smgroupid ." 
					  and ((configuration_key = 'BOX_LINKEDIN_URL' and `configuration_value` != '') .....)";

      $check = $db->Execute($check_query);

      if ($check->fields['count'] > 0) {
        $show_sm_box_header= true;
      }

 if ($show_sm_box_header == true) {
      require($template->get_template_dir('tpl_sm_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes').      '/tpl_sm_box_header.php');
	  $title = '<label>' . BOX_HEADING_SOCIALMEDIA . '</label>';
      $title_link = false;
      require($template->get_template_dir('tpl_box_header.php', DIR_WS_TEMPLATE, $current_page_base,'common') . '/tpl_box_header.php' .      $column_box_default);
 }
31 Jul 2014, 3:24 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

That extra " . $column_box_default" at the end of that last line shouldn't be there.

31 Jul 2014, 3:28 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

Then try changing the line in tpl_header.php from this:

<div id="navMainSearch"><?php require(DIR_WS_MODULES .[B] 'sideboxes/[/B]search_header.php'); ?></div>

to this:

<div id="navMainSearch"><?php require(DIR_WS_MODULES . [B]zen_get_module_directory('[/B]search_header.php'[B])[/B]); ?></div>

(of course replacing 'search_header.php' with the name of your sidebox module)

31 Jul 2014, 3:41 PM
#6
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Single sideboxes in override folders

uh, it's a sidebox? That only looks in the module directory, not the subdirectories like sideboxes

31 Jul 2014, 3:46 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

delia:

uh, it's a sidebox? That only looks in the module directory, not the subdirectories like sideboxes
And the processing-logic to generate a sidebox is driven by a module in the modules directory. That's why I used the search_header sidebox as an example.

Although I suppose if you've totally skipped using a module file and dropped the module's code directly into your template, then you're bypassing all of that. In which case the change I suggested is irrelevant.

31 Jul 2014, 4:00 PM
#8
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Single sideboxes in override folders

okay, let's go back a bit.

All I want to do is put a sidebox into the sideboxes override directory without loading one also in the sideboxes directory. That doesn't seem possible. I changed the file as you said but it only looks in the modules directory - not the overrides. So it just looks like you have to have one in both places for the overrides directory to work for sideboxes.

If I change the search header to the same code

<?php require(DIR_WS_MODULES .zen_get_module_directory('search_header.php')); ?>

I get: PHP Warning: require(includes/modules/search_header.php) So that logic doesn't work for the search_header sidebox

31 Jul 2014, 4:07 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

Hmmm, will have to do some more digging ...

31 Jul 2014, 5:06 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

If you have a "copy" of the tpl_sm_whatever.php in the main sideboxes dir (as if it were one of the originals in core), does the override work then?

31 Jul 2014, 5:14 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

In your first post in this thread you did talk about putting stuff into the modules directory, but then in post 6 you said you're not using a module.

So now I'm not clear whether this is an override issue with the "template" or with the "module".

31 Jul 2014, 6:36 PM
#12
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Single sideboxes in override folders

actually that's where it is - I'm not using template overrides for this sample site. Everything is in the default_template.

31 Jul 2014, 11:58 PM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

Okay, I'm confused about what exactly you're doing then.

I cloned the search_header "sidebox" and made changes to the output so I knew it was firing, and it works perfectly fine when using overrides.

1 Aug 2014, 12:21 PM
#14
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Single sideboxes in override folders

You deleted the one in the modules/sideboxes directory and only have it in the modules/sideboxes/custom_template directory?

1 Aug 2014, 3:16 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Single sideboxes in override folders

delia:

You deleted the one in the modules/sideboxes directory and only have it in the modules/sideboxes/custom_template directory?

Yes, but that also requires making the change I showed earlier: http://www.zen-cart.com/showthread.php?214130-Single-sideboxes-in-override-folders&p=1254424#post1254424 else the override won't be found.

1 Aug 2014, 3:26 PM
#16
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Single sideboxes in override folders

Okay, I'll try again. I got so tired yesterday that I may just not have done it right.

9 Aug 2014, 1:44 PM
#17
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Single sideboxes in override folders

So went to a fresh install of default 1.5. 3

Changed the header line to ```php

<div id="navMainSearch"><?php require(DIR_WS_MODULES . zen_get_module_directory('search_header.php')); ?></div> ```

Deleted the search_header.php from modules/sideboxes and placed it in modules/sideboxes/classic instead.

Does not find the sidebox for search header.

9 Aug 2014, 2:00 PM
#18
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Single sideboxes in override folders

The zen_get_module_directory does not look into the modules/sideboxes directory, only the module directory.