Zen Cart Logo
Forums / Addon Sideboxes / Sidebox Anywhere mod - Please Help

Sidebox Anywhere mod - Please Help

Views: 13,781

Results 1 to 20 of 64
7 Jan 2008, 10:01 AM
#1
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Sidebox Anywhere mod - Please Help

I downloaded the Searchbox Anywhere mod and installed it yesterday.

The instructions seem to be a little vague to me. Can anuone help me get this onto a page and in working order too please.

USAGE INSTRUCTIONS:
 *   1. Upload this single_sidebox.php file to the same folder as your Zen Cart files.
 *   2. On a PHP page where you desire to show Zen Cart sidebox content, insert the following code:
 *        $zcSBmodule = 'name.php';  // name of sidebox or centerbox to be displayed (see filenames in the /includes/modules/sideboxes folder) (if not set, uses "whats_new.php")
 *        $zcSBlayout = 'left';      // 'left' or 'right' sidebox template style (if not specified, uses 'left')
 *        require ("path/to/zencart/single_sidebox.php");

Now can someone tell me what format the require ("path/to/etc should be?

Also when I put it into a page all that is displayed is the text quoted above.

Could someone help with the correct coding to have this displaying correctly?
The pages I am looking to insert this too are all similar. The code ends and thats where i want this box displayed then, at the end of the page.

Also would it be possible to have this displayed using HTML or BBC for use in forum boards and as part of an affiliate programme?

Thanks
Rob

7 Jan 2008, 11:40 AM
#2
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

Haven't installed this Mod myself, but your 'path/to/etc' would probably be something like:

includes/templates/tjrwatches/sideboxes/single_sidebox.php

If you haven't one already, you will need to create the 'sideboxes' dir.

You cannot use BBC code but should be no problems with HTML.

7 Jan 2008, 1:01 PM
#3
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

Thanks for the reply.

But how do I then insert it into a page so that it displays correctly?

EDITED TO ADD: I have added the whole file so you can see what i have missed (no doubt i have missed alot :$)

<?php
/**
 * single_sidebox.php used to display a Zen Cart sidebox on some external resource
 *
 * @package general
 * @copyright Copyright 2003-2008 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: single_sidebox.php 2008-01-03 01:01:18Z drbyte $
 */
/*
 *   USAGE INSTRUCTIONS:
 *   1. Upload this single_sidebox.php file to the same folder as your Zen Cart files.
 *   2. On a PHP page where you desire to show Zen Cart sidebox content, insert the following code:
 *        $zcSBmodule = 'name.php';  // name of sidebox or centerbox to be displayed (see filenames in the /includes/modules/sideboxes folder) (if not set, uses "whats_new.php")
 *        $zcSBlayout = 'left';      // 'left' or 'right' sidebox template style (if not specified, uses 'left')
 *        require ("includes/templates/tjrwatches/sideboxes/single_sidebox.php");
 *
 *
 *   DEFAULTS:
 *   $zcSBmodule = (if not set, uses "whats_new.php")
 *   $zcSBlayout = (optional) (if not specified, uses 'left')
 *   $zcSBwidth  = (optional) If not specified, uses Zen Cart store defaults
 *
*/
/******************** SINGLE_SIDEBOX.PHP SCRIPT CODE ********************/
/*
 * Determine working directory
 */
  $startingDir = getcwd();
  $zcDir = realpath(dirname(__FILE__));
  chdir($zcDir);
	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($zcSBmodule)) $zcSBmodule = (isset($_GET['module'])) ? zen_db_input($_GET['module']) : 'whats_new.php';
  if (!isset($zcSBcolumn)) $zcSBcolumn = (isset($_GET['layout'])) ? zen_db_input($_GET['layout']) : 'left';
  if (!isset($zcSBwidth)) $zcSBwidth  = (isset($_GET['width'])) ? zen_db_input($_GET['width']) : 0;
  if (substr($zcSBmodule, -4) != '.php') $zcSBmodule .= '.php';
  $column_width = (int)$zcSBwidth;
  if ($column_width == 0) $column_width = ($zcSBcolumn == 'right') ? COLUMN_WIDTH_RIGHT : COLUMN_WIDTH_LEFT;
  $column_box_default = ($zcSBcolumn == '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($zcSBmodule);
/**
 * 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 . '/' . $zcSBmodule;
  $paths_to_try[] = DIR_WS_MODULES . 'sideboxes/' . $zcSBmodule;
  $paths_to_try[] = DIR_WS_MODULES . $template_dir . '/' . $zcSBmodule;
  $paths_to_try[] = DIR_WS_MODULES . $zcSBmodule;
  $found_object = false;
  for ($i=0, $n=sizeof($paths_to_try); $i < $n; $i++) {
    if ( file_exists($zcDir . '/' . $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($zcSBmodule, DIR_WS_TEMPLATE, 'index', 'templates') . '/' . $zcSBmodule)) {
    require($template->get_template_dir($zcSBmodule, DIR_WS_TEMPLATE, 'index', 'templates') . '/' . $zcSBmodule);
  } 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);
?>
7 Jan 2008, 5:21 PM
#4
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

For output of desired Text, create a file (example: zcSidebox.php) and upload it here:
/includes/modules/sideboxes/zcSidebox.php

To output the Sidebox on your desired page(s) you insert this code wherever you want, in the other PHP script:

$zcSBmodule = 'zcSidebox.php';

7 Jan 2008, 5:23 PM
#5
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

Thank you for the reply.

What do I put in this new file i created?
Do I need to put anything in it?

7 Jan 2008, 5:33 PM
#6
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

What you put in the other PHP file should include both lines.

$zcSBmodule = 'zcSidebox.php';
require("/home/yourID/public_html/includes/templates/tjrwatches/sideboxes/single_sidebox.php");

In the above example, you would put normal HTML code in the 'zcSidebox.php' file. Do not put in full page code.

i.e
Do not put:

<html <head <body </body </html

Only put in HTML code for what you actually want displayed. Be it a Table, Div, etc.

7 Jan 2008, 9:05 PM
#7
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

Hi. I am sorry but i am just not understanding anything that you are saying to me.

You are saying to use

$zcSBmodule = 'zcSidebox.php';
require("/home/yourID/public_html/includes/templates/tjrwatches/sideboxes/single_sidebox.php");

and yet in the file it says...

On a PHP page where you desire to show Zen Cart sidebox content, insert the following code:

  •    $zcSBmodule = 'name.php';  // name of sidebox or centerbox to be displayed (see filenames in the /includes/modules/sideboxes folder) **(if not set, uses "whats_new.php")**
    
  •    $zcSBlayout = 'left';      // 'left' or 'right' sidebox template style (if not specified, uses 'left')
    
  •    require ("includes/templates/tjrwatches/sideboxes/single_sidebox.php");
    

Bolding mine.

Thats what is confusing me. Also the extra page I had to create.

The code to use in the other outside file.

Everything I have tried so far has resulted in just the code being displayed and not the side box as it should do.

If someone could explain it simply or even crete this mod so it is not so confusing please.

Thanks
Rob

7 Jan 2008, 9:21 PM
#8
drbyte avatar

drbyte

Sensei

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

Re: Sidebox Anywhere mod - Please Help

I'm sure Rob means well. I'm not sure he's taking you entirely in the right direction though. (This mod itself is not a sidebox, which is how he was treating it. It's used to "display" a sidebox's normal content, but not on a usual Zen Cart page.)

But, more information from you is needed. Where are you wanting to use this? On what kind of page?
This tool is written to be implemented as PHP code, not as an SSI or HTML addon.

7 Jan 2008, 9:27 PM
#9
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

Yes I am sure Rob did mean well and I thank him for trying to help me with this.

The page would vary as I would like to use this as part of my affiliates so the code would need to be in HTML.

PLUS...

I would like to add it into a PHP page. Again the pages will vary.

It would be better if there was a way to just have a sidebox displayed anywhere I want it too with less hassle. (For those like me that are not good at php)

If you could tell me exactly what is needed from me for you to help me I can get right onto getting that information.

Thanks
Rob

7 Jan 2008, 9:54 PM
#10
drbyte avatar

drbyte

Sensei

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

Re: Sidebox Anywhere mod - Please Help

Do you have a PHP page where you want to use this?
If so, where is it?
Is it a single php file, or is a part of a larger CMS system somewhere on your site?

7 Jan 2008, 9:57 PM
#11
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

I have a place in mind to test it out.

It is one file that helps create the end result that you would see on the web

8 Jan 2008, 7:54 AM
#12
drbyte avatar

drbyte

Sensei

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

Re: Sidebox Anywhere mod - Please Help

TJR Stores:

I have a place in mind to test it out.I'm so happy for you.
:clap:

I was thinking you might be a little more forthcoming with details. We gave up mind-reading a long time ago.

I'll leave it with you:

  • incorporate the PHP code as documented ... into your existing PHP page.
8 Jan 2008, 9:03 AM
#13
drbyte avatar

drbyte

Sensei

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

Re: Sidebox Anywhere mod - Please Help

You haven't said "where" you intend to use it.
I have no idea what exactly you're trying to do at this point.

It's already been stated that the Sidebox Anywhere mod is written to be used on PHP pages, not HTML pages. It is a PHP script. It is called from within existing PHP scripts. A simple PHP "require" command is all that's needed.

TJR Stores:

The instructions seem to be a little vague to me.

USAGE INSTRUCTIONS:

    1. Upload this single_sidebox.php file to the same folder as your Zen Cart files.
    1. On a PHP page where you desire to show Zen Cart sidebox content, insert the following code:
  •    $zcSBmodule = 'name.php';  // name of sidebox or centerbox to be displayed (see filenames in the /includes/modules/sideboxes folder) (if not set, uses "whats_new.php")
    
  •    $zcSBlayout = 'left';      // 'left' or 'right' sidebox template style (if not specified, uses 'left')
    
  •    require ("path/to/zencart/single_sidebox.php");
    
> 
> Now can someone tell me what format the require ("path/to/etc should be?

Translation:
1. Upload the single_sidebox.php file, as instructed, to the same folder as your Zen Cart files. Make no changes to it.

2. On a PHP page ... ie: one that has a .php extension, (not a .html extension), insert the 3 lines of code shown.  Usually this would be an existing PHP page on your site.

3. the "path/to/zencart/" would be the server's filesystem path to your Zen Cart store, such as /home/yourname/public_html/store/

> **TJR Stores:**
>
> Can anuone help me get this onto a page and in working order too please.
Sure.
1. Upload single_sidebox.php as instructed.
2. Create a call_my_sidebox.php file in your /public_html/ folder.
3. Put this in it, making appropriate edits to suit your server: ```
<?php
  $zcSBmodule = 'whats_new.php';
  $zcSBlayout = 'left';
  require ("/home/tjrstores_user_name/public_html/zencart/single_sidebox.php");
?>
  1. Run the file in your browser: https://www.tjrstores.com/call_my_sidebox.php
    Your Zen Cart whats-new sidebox content will show up in the browser.
8 Jan 2008, 9:06 AM
#14
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

Thank you fr the clear instruction.

Maybe a slight update to the file in the downloads section to avoind this in future could be a good idea..?

8 Jan 2008, 10:24 AM
#15
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

OK I got it working on its own separate page, thank you DrByte for that.

My question is what code do I need to insert it in this section of the page...

  <div align="center"><a href="rss_feed.php"><img src="themes/<?=$setts['default_theme'];?>/img/system/rss.gif" border="0" alt="" align="absmiddle"></a></div>
[b]HERE IS WHERE I WANT TO INSERT THE SIDEBOX[/b]
      <div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="180" height="1"></div></td>
   <td width="100%">

This piece of code is related to this website https://www.iwacstores.com/testsite/index.php

and will place it under the RSS Auctions image on the left hand side.

BUT I also would need to know if the code used would be suitable to use on any page, as most are similar to this one.

Thanks
Rob

8 Jan 2008, 10:27 AM
#16
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

Wouldn't let me edit the post for some reason..

would like to add in http://www.tjrstores.com/new_stock.php which is the link to how the side box is displayed.

8 Jan 2008, 10:28 AM
#17
drbyte avatar

drbyte

Sensei

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

Re: Sidebox Anywhere mod - Please Help

I'd do it like this:

  <div align="center"><a href="rss_feed.php"><img src="themes/<?=$setts['default_theme'];?>/img/system/rss.gif" border="0" alt="" align="absmiddle"></a></div>
<?php
  $zcSBmodule = 'whats_new.php';
  $zcSBlayout = 'left';
  require ("/home/iwac_user_name/public_html/testsite/single_sidebox.php");
?>
      <div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="180" height="1"></div></td>
   <td width="100%">
8 Jan 2008, 10:33 AM
#18
drbyte avatar

drbyte

Sensei

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

Re: Sidebox Anywhere mod - Please Help

Hmmm ... your tjrstores site is different from your iwacstores site.
They need to be on the same server ... and ideally on the same hosting account.

8 Jan 2008, 10:37 AM
#19
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

OK.. with the page being on a separate website and server I changed the path/to/
to this

http://www.tjrstores.com/single_sidebox.php

and it worked, but the images of the products are not loading.

So would I therefore need to create the single_sidebox.php file on the IWAC Stores server for this to work properly?

or

Have i missed something in the code?

8 Jan 2008, 10:43 AM
#20
tjr_stores avatar

tjr_stores

New Zenner

Join Date:
Aug 2007
Location:
UK
Posts:
66
Plugin Contributions:
0

Re: Sidebox Anywhere mod - Please Help

OK

I tried to add the pages etc onto iwac stores' server and got an error 500 internal server error.

The sidebox is trying to call for the images in http://iwacstores.com images dir

of course these images are not there.

How do I change this?