Forums / All Other Contributions/Addons / More than One Sidebox Anywhere Mod

More than One Sidebox Anywhere Mod

Locked

Started by hduane on 1 Dec 2009, 3:45 AM · Views: 2,053

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
1 Dec 2009, 3:45 AM
#1
hduane avatar

hduane

New Zenner

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

More than One Sidebox Anywhere Mod

When I attempt to place more than one ZC sidebox in a non-ZC page using Sidebox Anywhere, only the first one shows up. Is it possible to use the same single_sidebox.php file for more than one sidebox? Could I possibly be looking at a PHP issue instead?

Thanks for any help,

Duane

1 Dec 2009, 4:26 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: More than One Sidebox Anywhere Mod

I expect you would have to clone all the single_sidebox.php files into single_sidebox2.php and related filenames etc., along with defines and possibly sql queries... There are other threads about cloning sideboxes, and the steps are probably applicable to your case.

1 Dec 2009, 8:31 PM
#3
hduane avatar

hduane

New Zenner

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

Re: More than One Sidebox Anywhere Mod

gjh42:

I expect you would have to clone all the single_sidebox.php files into single_sidebox2.php and related filenames etc., along with defines and possibly sql queries... There are other threads about cloning sideboxes, and the steps are probably applicable to your case.

This was my plan "b." Thanks for your direction.

Duane

4 Dec 2009, 2:27 PM
#4
hduane avatar

hduane

New Zenner

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

Re: More than One Sidebox Anywhere Mod

gjh42:

I expect you would have to clone all the single_sidebox.php files into single_sidebox2.php and related filenames etc., along with defines and possibly sql queries... There are other threads about cloning sideboxes, and the steps are probably applicable to your case.

Well, Glenn.

I've cloned single_sidebox.php file into single_sidebox2.php. But it appears that I cannot execute both on the same page. In fact the second one eliminates my footer. I would like the page to include both categories and featured products. Right now it is only executing the categories:

http://rapicom.net/test.html

My goal is to have it look like http://rapicom.net.

My code snippets appear in the left column and underneath the content of the center column. Here they are respectively:

<?php $zcSBmodule = 'ch_categories.php'; $zcSBlayout = 'left'; require ("/[REMOVED BY DUANE]/single_sidebox.php"); ?> <?php $zcSBmodule = 'featured.php'; $zcSBlayout = 'left'; require ("/[REMOVED BY DUANE]/single_sidebox2.php"); ?>

I really don't have a firm grasp on executing PHP within a page; so it could be my oversight more than anything else.

All help is much appreciated,

Duane

4 Dec 2009, 3:25 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: More than One Sidebox Anywhere Mod

You may need to alter these variable names as well to avoid conflicts, both in your page file and in the single_sidebox2 file(s).

<?php $zcSBmodule2 = 'featured.php'; $zcSBlayout2 = 'left'; require ("/[REMOVED BY DUANE]/single_sidebox2.php"); ?>
4 Dec 2009, 6:29 PM
#6
hduane avatar

hduane

New Zenner

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

Re: More than One Sidebox Anywhere Mod

gjh42:

You may need to alter these variable names as well to avoid conflicts, both in your page file and in the single_sidebox2 file(s).

Still not working...I've tested my changes with the sidebox2 alone and it worked. Here's the changed code on test.html:

<?php $zcSBmodule2 = 'featured.php'; $zcSBlayout2 = 'left'; require ("/[REMOVED BY DUANE]/single_sidebox2.php"); ?>

Here's the single_sidebox2.php file:

/******************** SINGLE_SIDEBOX.PHP SCRIPT CODE *******************/
/

  • Determine working directory
    /
    $startingDir2 = getcwd();
    $zcDir2 = realpath(dirname(FILE));
    chdir($zcDir2);
    define('STRICT_ERROR_REPORTING', false);
    /
  • Set default image dir, which overrides the usual Zen Cart settings in case the working dir is not the same
    /
    // define('DIR_WS_IMAGES', $zcDir . '/images/');
    /
    *
  • Load common library stuff
    */
    require('includes/application_top.php');

/**

  • module and layout determination
    */
    if (!isset($zcSBmodule2)) $zcSBmodule2 = (isset($_GET['module'])) ? zen_db_input($_GET['module']) : 'whats_new.php';
    if (!isset($zcSBcolumn2)) $zcSBcolumn2 = (isset($_GET['layout'])) ? zen_db_input($_GET['layout']) : 'left';
    if (!isset($zcSBwidth2)) $zcSBwidth2 = (isset($_GET['width'])) ? zen_db_input($_GET['width']) : 0;
    if (substr($zcSBmodule2, -4) != '.php') $zcSBmodule2 .= '.php';
    $column_width = (int)$zcSBwidth2;
    if ($column_width == 0) $column_width = ($zcSBcolumn2 == 'right') ? COLUMN_WIDTH_RIGHT : COLUMN_WIDTH_LEFT;
    $column_box_default = ($zcSBcolumn2 == 'right') ? 'tpl_box_default_right.php' : 'tpl_box_default_left.php';

/**

  • Load required functions and processing to generate the output:
    /
    $language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/';
    $box_id = zen_get_box_id($zcSBmodule2);
    /
    *
  • Cycle through possible override options, first for sideboxes, and then for modules if no matching sidebox found
    /
    $paths_to_try = array();
    $paths_to_try[] = DIR_WS_MODULES . 'sideboxes/' . $template_dir . '/' . $zcSBmodule2;
    $paths_to_try[] = DIR_WS_MODULES . 'sideboxes/' . $zcSBmodule2;
    $paths_to_try[] = DIR_WS_MODULES . $template_dir . '/' . $zcSBmodule2;
    $paths_to_try[] = DIR_WS_MODULES . $zcSBmodule2;
    $found_object = false;
    for ($i=0, $n=sizeof($paths_to_try); $i < $n; $i++) {
    if ( file_exists($zcDir2 . '/' . $paths_to_try[$i]) ) {
    $found_object = true;
    require($paths_to_try[$i]);
    break;
    }
    }
    /
    *
  • If nothing found yet, assume regular template
    /
    if (!$found_object && file_exists($template->get_template_dir($zcSBmodule2, DIR_WS_TEMPLATE, 'index', 'templates') . '/' . $zcSBmodule2)) {
    require($template->get_template_dir($zcSBmodule2, DIR_WS_TEMPLATE, 'index', 'templates') . '/' . $zcSBmodule2);
    } else if (isset($list_box_contents) && is_array($list_box_contents)) {
    require($template->get_template_dir('tpl_columnar_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_columnar_display.php');
    }
    /
    *
  • Load general code which runs before page closes
    */
    require(DIR_WS_INCLUDES . 'application_bottom.php');
    chdir($startingDir);
    ?>

Thank for the help so far.

Duane

7 Dec 2009, 2:08 PM
#7
hduane avatar

hduane

New Zenner

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

Re: More than One Sidebox Anywhere Mod

Would this thread be better off in a different ZC forum? Should I move it?

Thanks,

Duane

8 Dec 2009, 8:56 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: More than One Sidebox Anywhere Mod

HDuane:

When I attempt to place more than one ZC sidebox in a non-ZC page using Sidebox Anywhere, only the first one shows up. Is it possible to use the same single_sidebox.php file for more than one sidebox?
It wasn't designed with that in mind.
Having it run a 2nd time will trigger numerous internal duplication problems and thus likely many PHP errors, which probably cause the page to stop drawing at the point where the 2nd box is expected to appear.

It will have to be fully rewritten to make it show twice on the same page.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

8 Dec 2009, 10:41 PM
#9
hduane avatar

hduane

New Zenner

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

Re: More than One Sidebox Anywhere Mod

DrByte:

It will have to be fully rewritten to make it show twice on the same page.

Is there any chance of that happening? Or is there another direction I could try?

Thanks for the insight,

Duane

11 Dec 2009, 5:11 PM
#10
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Re: More than One Sidebox Anywhere Mod

Hi,

Don't you think it is so stupid to delete my post?
:no:

11 Dec 2009, 5:25 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: More than One Sidebox Anywhere Mod

Jerry5763837:

Hi,

Don't you think it is so stupid to delete my post?
:no:

Your post wasn't deleted. It was moved to its own discussion so it could be handled appropriately, since the topic was somewhat different:
http://www.zen-cart.com/forum/showthread.php?t=143696

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

9 Jan 2010, 7:54 PM
#12
joeguy44 avatar

joeguy44

New Zenner

Join Date:
Mar 2009
Posts:
15
Plugin Contributions:
0

Re: More than One Sidebox Anywhere Mod

I have the same need to get more than one side box into an external page... has anyone figured out a way to do this? was the sidebox anywhere mod rewritten, would someone do it for $ ?

Solve for x?
No, x needs to solve it for himself, or else he'll never learn.

9 Jan 2010, 11:41 PM
#13
joeguy44 avatar

joeguy44

New Zenner

Join Date:
Mar 2009
Posts:
15
Plugin Contributions:
0

Re: More than One Sidebox Anywhere Mod

so I was just messing around with an idea to see if I could get more that one sidebox to show on my external non-zen php page, and this worked.

<div> <?php include("../zencart/ezpage_sidebox_include.php"); ?> </div> <div> <?php include("../zencart/includes/modules/sideboxes/categories.php"); ?> </div> <div> <?php include("../zencart/includes/modules/sideboxes/search.php"); ?> </div>

These are all php includes, where as, the first one pulls a php page ( ezpage_sidebox_include.php) that uses the sidebox anywhere mod, the last two just pull sideboxes straight from the respective folders without the mod's code.

Could someone with coding experience please tell me if this is "good form." Are there problems a newbie like me is not aware of that are created by doing this? Is this a fluke that it works?

thanks!

Solve for x?
No, x needs to solve it for himself, or else he'll never learn.