Results 1 to 7 of 7
  1. #1

    Default Sidebox coding problems...... please help

    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_defaultDIR_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

  2. #2

    Default Re: Sidebox coding problems...... please help

    Not sure if the images have attached correctly, but they should be below:

    Click image for larger version. 

Name:	imagesamp.jpg 
Views:	40 
Size:	34.3 KB 
ID:	14977
    Click image for larger version. 

Name:	imagesamp2.jpg 
Views:	34 
Size:	15.6 KB 
ID:	14978

  3. #3
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Sidebox coding problems...... please help

    The left sidebox column probably has styling rules that are different from those for the right column, for some reason. A link to the site would help.

  4. #4

    Default Re: Sidebox coding problems...... please help

    Hi,
    Thank for the response. The images I have uploaded are from a test site on my computer. Here is a link to the current site: http://www.drgreens.co.uk/Environmen...ed-Controllers
    The same thing happens if I switch the columns over so everything is in the right column

  5. #5
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Sidebox coding problems...... please help

    No way to test without seeing the site, but take a look at these rules in stylesheet.css:

    #navColumnOneWrapper {
    margin-left:1.5em;
    margin-right:1em;
    margin-bottom:8px;
    margin-top:2em
    }

    #navColumnTwoWrapper {
    margin-left: 2.5em;
    margin-right: 1.5em;
    margin-bottom: 8px;
    margin-top:-1em;
    }

  6. #6

    Default Re: Sidebox coding problems...... please help

    I had a play about with the stylesheet, but still can't fix it. I'm leaning towards it being a small problem somewhere with the code, as when the problem occurs a part of the code doesn't trigger:

    PHP Code:
    $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>' 
    Do you have any idea how to call a separate template file from a sidebox file? I'm thinking I am doing something wrong with the coding in the sidebox template file, and that if I call the separate template file with the original coding in that it might work?
    Like I said, I am terrible with coding, I just use code that is already part of zen cart and change it to suit, not sure what most of it really means though.

    Thanks

  7. #7

    Default Re: Sidebox coding problems...... please help

    This is the coding for the product_info template:

    PHP Code:
    <div class="files">
    <?php if(isset($products_file_1_link) || isset($products_file_2_link) || isset($products_file_3_link) || isset($products_file_4_link) || isset($video_file_link) || isset($extra_field)) {
            echo  
    '<div class="filesHead">'.TEXT_PRODUCT_MORE_INFO.'</div><ul>';
              }
    ?>
    <?php 
    if($extra_field!='') { 
        echo 
    '<li>'.$extra_field '</li>';
    ?>
     
    <?php if(isset($products_video_link)) { 
        echo 
    '<li>'.$products_video_link '</li>';
    ?> 
    <?php if(isset($products_file_1_link)) { 
        echo 
    '<li>'.$products_file_1_link '</li>';
    ?>    
    <?php if(isset($products_file_2_link)) {
        echo 
    '<li>'.$products_file_2_link '</li>';
    ?>    
    <?php if(isset($products_file_3_link)) {
        echo 
    '<li>'.$products_file_3_link'</li>';
    }  
    ?>
    <?php 
    if(isset($products_file_4_link)) {
        echo 
    '<li>'.$products_file_4_link;

    if(isset(
    $products_file_1_link) || isset($products_file_2_link) || isset($products_file_3_link) || isset($products_file_4_link) || isset($video_file_link) || isset($extra_field)) {
    echo 
    '</ul>';
    }
    ?>
    </div>
    This coding works on the product info page, so I suppose I need to know how to translate it into the sidebox template. Can anybody help please, I am going round in circles and it's driving me crazy

    Thanks

 

 

Similar Threads

  1. v150 Need help with module php coding please. Short and Sweet
    By VBE-1 in forum General Questions
    Replies: 2
    Last Post: 2 Oct 2012, 01:29 AM
  2. Some coding help please
    By malc in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 8 Jun 2011, 08:17 AM
  3. php coding help please..
    By philip937 in forum General Questions
    Replies: 2
    Last Post: 20 Nov 2009, 11:25 PM
  4. Coding help please
    By Nixak in forum General Questions
    Replies: 0
    Last Post: 24 Jul 2009, 03:21 PM
  5. please help! sidebox problems
    By earthlyinfo in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 30 Sep 2008, 08:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR