Hi,
A bit of a problem if somebody can help please?
I have the editable sidebox installed, and I have entered some coding into the module template to use it as an advice centre to populate and show information that is entered into extra fields in admin when a product is created.
All was going well, and it was working fine, until I decided to move the sidebox into the left column instead of the right.
Now, I am not really very good with coding/php, and I am surprised that it even worked up until now! But there seems to be a problem with my coding which means that if the editable sidebox shares a column with another sidebox, the layout completely messes up. If it is in a column by itself, then it is ok.
I have a couple of images, but for some reason it won't let me upload them. Here is the code that I have though:
From includes/templates/mytemplate/sideboxes:
PHP Code:
<?php
/**
* editable sidebox - allows a sidebox editable with the define pages editor to be added to your site
*
* @package templateSystem
* @copyright 2007 Kuroi Web Design
* @copyright Portions Copyright 2003-2007 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: blank_sidebox.php 2007-08-10 kuroi $
*/
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
$content = file_get_contents($define_sidebox);
$content .= '<div class="adbox">'.$extra_field .'</div>';
$content .= '<div class="adbox">' .$current_categories_description_sub .'</div>' ;
$content .= '<div class="adbox">'.$products_file_1_link . '</div>' ;
$content .= '<div class="adbox">'.$products_file_2_link . '</div>' ;
$content .= '<div class="adbox">'.$products_file_3_link . '</div>' ;
$content .= '<div class="adbox">'.$products_file_4_link . '</div>' ;
// this is where the content that you have via the Admin is pulled in.
$content .= '</div>';
?>
And from includes/modules/sideboxes:
PHP Code:
<?php
/**
* editable sidebox - allows an admin-editable sidebox to be added to your site
*
* @package templateSystem
* @copyright 2007 Kuroi Web Design
* @copyright Portions Copyright 2003-2007 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: blank_sidebox.php 2007-08-10 kuroi $
*/
// test if box should display
$show_editable_sidebox = true;
if (in_array($current_page_base,explode(",",'faqs_all')) ) {
$show_editable_sidebox = false;
}
if (in_array($current_page_base,explode(",",'faq_info')) ) {
$show_editable_sidebox = false;
}
$define_sidebox = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', DEFINE_EDITABLE_SIDEBOX_NAME, 'false');
if ($show_editable_sidebox == true) {
require($template->get_template_dir('tpl_editable_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_editable_sidebox.php');
$title = BOX_HEADING_EDITABLE_SIDEBOX;
$title_link = false;
$sql = "select * from " . TABLE_PRODUCT_EXTRA_FIELDS . "
where products_id = '" . (int)$_GET['products_id'] . "'";
$files = $db->Execute($sql);
/*
* extract info from queries for use as template-variables:
*/
$extra_field = $files->fields['extra_field'];
$products_file_1_title = $files->fields['file_1_title'];
$products_file_2_title = $files->fields['file_2_title'];
$products_file_3_title = $files->fields['file_3_title'];
$products_file_4_title = $files->fields['file_4_title'];
$products_file_1 = $files->fields['file_1'];
$products_file_2 = $files->fields['file_2'];
$products_file_3 = $files->fields['file_3'];
$products_file_4 = $files->fields['file_4'];
$products_video = $files->fields['video'];
$products_video_title = $files->fields['video_title'];
if (!empty($products_video)) $products_video_link = '<a href="javascript:popupWindow(\''.zen_href_link(FILENAME_FLASH).'&id='.$_GET[products_id]. '\') ">'. $products_video_title . '</a>';
if (!empty($products_file_1_title)) $products_file_1_link = '<a href="' . "download/" . $products_file_1 . ' >'. $products_file_1_title . '</a>';
if (!empty($products_file_2_title)) $products_file_2_link = '<a href="' . "product_extra_files/" . $products_file_2 . '">'. $products_file_2_title . '</a>';
if (!empty($products_file_3_title)) $products_file_3_link = '<a href="' . "product_extra_files/" . $products_file_3 . '">'. $products_file_3_title . '</a>';
if (!empty($products_file_4_title)) $products_file_4_link = '<a href="' . "product_extra_files/" . $products_file_4 . '">'. $products_file_4_title . '</a>';
$sql = "select * from " . TABLE_CATEGORIES_DESCRIPTION . "
where categories_id = '" . (int)$_GET['categories_id'] . "'";
$files = $db->Execute($sql);
$current_categories_description_sub = $files->fields['categories_description_sub'];
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
Can anybody tell me where I am going wrong please? Like I said, it works fine when it is in a column of its own, but when it shares a column the whole page gets messed up.
Thanks
Bookmarks