Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Moving Sidebox to Center Column

Moving Sidebox to Center Column

Views: 4,177

Results 1 to 12 of 12
22 May 2009, 2:42 PM
#1
wellcool avatar

wellcool

New Zenner

Join Date:
Apr 2009
Posts:
23
Plugin Contributions:
0

Moving Sidebox to Center Column

Hi all,

I've installed the "What's New Scroller" sidebox, which works fine.

I now want to move it into the center of the index page.

I've tried using the "Sidebox Anywhere" mod (I realise it's designed to reproduce a sidebox on an external site) to get the whats_new box to appear where I want it, by adding the following:

<?php
// BOF Sidebox Anywhere MOD

$zcSBmodule = 'tpl_whats_new.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/template_default/sideboxes/single_sidebox.php");

// EOF Sidebox Anywhere MOD
?>

into tpl_index_default.php. I either just get the above code displaying on the page, or only half of the page displays, depending on where within that file I put the above code.

Am I going about this in the correct way? Or is there another way to move a sidebox to somewhere specific?

wwwdotavantebagsdotcom

Many thanks.

23 May 2009, 3:22 AM
#2
website_rob avatar

website_rob

Inactive

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

Re: Moving Sidebox to Center Column

All you would be moving is the javascript code.

To place on the site Home page use:
Admin > Tools > Define Pages Editor and select: main_page.php to edit

Put the javascript in its own DIV and style as necessary.

26 May 2009, 12:28 PM
#3
wellcool avatar

wellcool

New Zenner

Join Date:
Apr 2009
Posts:
23
Plugin Contributions:
0

Re: Moving Sidebox to Center Column

Thanks for your reply Rob.

Is it just this that I would need to put in the div:

//  ----------------------------------------------------------------------------------
//   START CONFIGURABLES VALUES:
//   Change the values here to modify how the marquee looks and works
//  ----------------------------------------------------------------------------------

	$scroll_amount =    "1"; 		// scroll amount
	$scroll_delay =     "5";  		// scroll delay
	$scroll_direction = "up"; 		// scroll direction (can be up, down, left or right)
	$scroll_behaviour = "scroll"; 	// scroll behaviour (can be scroll, alternate or slide) ** Seems to make no diff **
	$box_height =       "130"; 		// height of whats new box

//  ----------------------------------------------------------------------------------
//   END CONFIGURABLES VALUES.
//  ----------------------------------------------------------------------------------






//  ----------------------------------------------------------------------------------
//   DO NOT EDIT THE FOLLOWING CODE.
//   NB: added lines to the original template are highlighted with comments.
//  ----------------------------------------------------------------------------------

  $content = "";
  $whats_new_box_counter = 0;
  //-------------------------------------------------------------------------------------------------------------------------------
  $content .= '<marquee behavior= "' . $scroll_behaviour . '" align= "center" direction= "' . $scroll_direction . '" height="' . $box_height . '" scrollamount= "' . $scroll_amount . '" scrolldelay= "' . $scroll_delay . '" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'><center>';
  //-------------------------------------------------------------------------------------------------------------------------------  
  while (!$random_whats_new_sidebox_product->EOF) {
    $whats_new_box_counter++;
    $whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']);
    $content .= '<div class="sideBoxContent centeredContent">';
    $content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($random_whats_new_sidebox_product->fields['master_categories_id']) . '&products_id=' . $random_whats_new_sidebox_product->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $random_whats_new_sidebox_product->fields['products_image'], $random_whats_new_sidebox_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
    $content .= '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a>';
    $content .= '<div>' . $whats_new_price . '</div>';
    $content .= '</div>';
  //-------------------------------------------------------------------------------------------------------------------------------
    $content .= '<br />';
  //-------------------------------------------------------------------------------------------------------------------------------
    $random_whats_new_sidebox_product->MoveNextRandom();
  }
  //-------------------------------------------------------------------------------------------------------------------------------
  $content .= '</center></marquee>';
  //-------------------------------------------------------------------------------------------------------------------------------
?>

Thankyou.

26 May 2009, 12:43 PM
#4
website_rob avatar

website_rob

Inactive

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

Re: Moving Sidebox to Center Column

The code you show has been customized to work within a Sidebox. Not sure exactly what you want to do but using the code and putting in the "main_page.php" is a start. Some tweaking may be required.

Or you could go to a script site like http://www.dynamicdrive.com/ and get one of their Scrolling scripts.

26 May 2009, 1:09 PM
#5
wellcool avatar

wellcool

New Zenner

Join Date:
Apr 2009
Posts:
23
Plugin Contributions:
0

Re: Moving Sidebox to Center Column

I'm keen to use something like this so that it updates as the Featured/Specials etc are updated.

wwwdotavantebagsdotcom shows what happens when I put the above code in. Not good! I'll have a fiddle...

Thanks for your help.

26 May 2009, 1:54 PM
#6
wellcool avatar

wellcool

New Zenner

Join Date:
Apr 2009
Posts:
23
Plugin Contributions:
0

Re: Moving Sidebox to Center Column

Also, am I correct in thinking that Define Pages Editor won't accept php code?

If not, how can I mange to get the scroller in there?

Thanks.

26 May 2009, 2:30 PM
#7
wellcool avatar

wellcool

New Zenner

Join Date:
Apr 2009
Posts:
23
Plugin Contributions:
0

Re: Moving Sidebox to Center Column

So, if I was to use this scroller script, how can I insert the new products?

I've tried inserting the contents of tpl_whats_new.php, but it's not working at all.

I'm assuming that the completed code needs to be inserted into tpl_index_default.php?

The code I concocted was:

<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">

<!--YOUR SCROLL CONTENT HERE-->

<?php
/**
 * Side Box Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2007 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: tpl_whats_new.php 6128 2007-04-08 04:53:32Z birdbrain $
 */
  $content = "";
  $whats_new_box_counter = 0;
  while (!$random_whats_new_sidebox_product->EOF) {
    $whats_new_box_counter++;
    $whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']);
    $content .= '<div class="sideBoxContent centeredContent">';
    $content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($random_whats_new_sidebox_product->fields['master_categories_id']) . '&products_id=' . $random_whats_new_sidebox_product->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $random_whats_new_sidebox_product->fields['products_image'], $random_whats_new_sidebox_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
    $content .= '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a>';
    $content .= '<div>' . $whats_new_price . '</div>';
    $content .= '</div>';
    $random_whats_new_sidebox_product->MoveNextRandom();
  }
?>


<!--YOUR SCROLL CONTENT HERE-->

</div>
</div>
10 Aug 2010, 2:41 PM
#8
breda avatar

breda

New Zenner

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

Re: Moving Sidebox to Center Column

Hi,
Did you get this issue resoved and working in the centre column?
Regards,
Breda

15 Dec 2010, 12:39 AM
#9
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Moving Sidebox to Center Column

I want to do something similar to this also. i.e. I have this Magic SlideShow product that only outputs to the side boxes. Thus I want to move one of the side boxes ( Featured Products ) to the centre, just under the header image. I want the slide show to be more visible, so moving it to the centre and toward the top of the main page is my goal.

Any ideas how to do this ?

14 Jul 2011, 11:53 PM
#10
jkspin avatar

jkspin

New Zenner

Join Date:
Apr 2007
Location:
in the woods
Posts:
9
Plugin Contributions:
0

Re: Moving Sidebox to Center Column

Am trying to do a similar thing here, though I am trying to put it in its own div just below the center column.
Using 1.3.9g and the Scrolling Featured Sidebox code I have modified the tpl_main_page.php to include

$featuredHorizontal_template = 'tpl_featuredHorizontal.php';

at @ line 50, and added this @ around line 135 after "<?php
/**

  • prepares and displays center column

*/
require($body_code);
?>":

**<div class="centerColumn" id="scrollBox">

<?php /* prepares and displays scrolling output */ require($template->get_template_dir('tpl_featuredHorizontal.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_featuredHorizontal.php'); ?> </div>**

Then I modified the scrolling tpl_featured.php to scroll left and named it tpl_featuredHorizontal.php, putting it in my_template/common folder and made necessary additions to the css file.

So.... it is not working, any advice about what I'm doing wrong?

22 Jan 2012, 8:34 PM
#11
cpegfa avatar

cpegfa

New Zenner

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

Re: Moving Sidebox to Center Column

I am doing the same thing recently. Not sure if you have resolved the issue already. Anyway, let's share my solution:

(I am moving the currencies sidebox from right column to center. So, I using this as the example)

Right column sideboxes are handled by the module column_right.php, which then called the currencies.php.

currencies.php makes use of 2 template files:

  1. common/tpl_box_default_right.php - Format of each right column sidebox
  2. sideboxes/tpl_currencies.php - Format of the currencies box content

To move the currencies sidebox to center, you can override the currencies.php MODULE to make use of your own template (the last few line of the file).

Remarks:
Some variables are used in the above 2 template files and was set in the above 2 modules:
a) $column_box_default in the file is the original box formatter, i.e. 'tpl_box_default_right.php'. You can ignore this if you have your own box design.
b) $column_width in the file is the box width, which equals to the right column width (BOX_WIDTH_RIGHT). Again, You can ignore this if you have your own box design.
c) $box_id = zen_get_box_id('currencies.php');. Suggest you to keep that for formality.

Then, in the page belongs to center column that you want to add your box, add the following lines:

$column_box_default = 'tpl_box_default_right.php';
$column_width = BOX_WIDTH_RIGHT;
$box_id = zen_get_box_id('currencies.php');
require(DIR_WS_MODULES . 'sideboxes/' . $template_dir . '/currencies.php');

Oliver

19 Apr 2012, 11:52 PM
#12
pinksparklegirl avatar

pinksparklegirl

New Zenner

Join Date:
Aug 2011
Location:
UK
Posts:
41
Plugin Contributions:
0

Re: Moving Sidebox to Center Column

Did anyone get this to work? I'd love to move the scrolling what's new box to the top of my home page, but don't know how to do it.