Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Nov 2011
    Posts
    38
    Plugin Contributions
    0

    Default Side Box Column Layout

    Hi

    I am currently designing an online shop. Currently on my own pc and not online therefore i cannot post a link. Sorry.

    I am trying to customise a sidebox add-on - manufacturer image sidebox.

    I have this displayed fine, however i would like the images displayed side by side in a table or in 2 columns rather than the satndard vertical list. Ive tried doing this by setting up some css to work within the side box and the php to run through twice (once for left column and once for the right column) however this does not work and im now rather stuck.

    Below is the code for the sidebox:

    PHP Code:
    <?php

    /**
     * Side Box Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2006 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: modification of tpl_manufacturers_select.php 4771 2006-10-17 05:32:42Z ajeh $
     * @modify by Alejandro Hurtado <ahurt2000######################>
     */
     
    if (!defined(BOX_HEADING_MANUFACTURERS_IMG)) define(BOX_HEADING_MANUFACTURERS_IMG,'Manufacturers'); // define sidebox header
      
    if (!defined(BOX_MANUFACTURER_HOMEPAGE_IMG)) define(BOX_MANUFACTURER_HOMEPAGE_IMG,'web');             // define link to manufacturers URL
      
      
    $title '<label>' BOX_HEADING_MANUFACTURERS_IMG '</label>';
      
    $title_link false;
      
    $content "";
      
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent centeredContent">';
      while (!
    $manufacturer_sidebox_img -> EOF){
        
    $content.='<div >';
        
    $content.='<a href="' zen_href_link(FILENAME_DEFAULT'manufacturers_id=' $manufacturer_sidebox_img->fields['manufacturers_id']) . '">';        
        
    $content.=zen_image(DIR_WS_IMAGES $manufacturer_sidebox_img->fields['manufacturers_image'], $manufacturer_sidebox_img->fields['manufacturers_name'], IMAGE_MANUFACTURER_WIDTHIMAGE_MANUFACTURER_HEIGHT);
        
    $content.= '</a></div>';
        if (
    zen_not_null($manufacturer_sidebox_img->fields['manufacturers_url']))
            
    $content.='<a href="' zen_href_link(FILENAME_REDIRECT'action=manufacturer&manufacturers_id=' $manufacturer_sidebox_img->fields['manufacturers_id']) . '" target="_blank">' sprintf(BOX_MANUFACTURER_HOMEPAGE_IMG) . '</a>';
        
        
    $manufacturer_sidebox_img->MoveNext();
      }
      
    $content .= '</div>';

    ?>

  2. #2
    Join Date
    Nov 2011
    Posts
    38
    Plugin Contributions
    0

    Default Re: Side Box Column Layout

    Sorry forgot to also mention that i also get the following error message with this sidebox when i click on a product and view the product:

    Code:
    1327 Undeclared variable: BOX_MANUFACTURER_MAX_LOGOS
    in:
    [select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from stavertonelectricalmanufacturers m left join stavertonelectricalmanufacturers_info mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '1') ORDER BY RAND() LIMIT 0,BOX_MANUFACTURER_MAX_LOGOS

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Side Box Column Layout

    MySQL doesn't recognize PHP constants, so it thinks that is a variable. You need to drop out of the SQL query string building momentarily and evaluate the constant, then let its value be inserted into the query. Without seeing the context, something like

    ... on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '1') ORDER BY RAND() LIMIT ' . BOX_MANUFACTURER_MAX_LOGOS

    This is incomplete as I don't know what the full original code looked like.


    If you are ordering the logos randomly, there is no reason to need to build the output one column at a time. You can insert a line break after every second item and get the results you want. There are many ways you could do this.
    Last edited by gjh42; 15 Nov 2011 at 03:08 PM.

  4. #4
    Join Date
    Nov 2011
    Posts
    38
    Plugin Contributions
    0

    Default Re: Side Box Column Layout

    Hi

    thanks for your help but im still stuck with both problems.

    the code which runs the manufacturers sidebox is as follows:

    PHP Code:
    <?php
    /**
     * manufacturers_img sidebox - displays a list of manufacturers logos so customer can choose to filter on their products only
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 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:modification of manufacturers.php 2834 2006-01-11 22:16:37Z birdbrain $
     * @ modify by: Alejandro Hurtado <ahurt2000######################>
     */

    // test if manufacturers sidebox should show
      
    $show_manufacturerstrue;


    // for large lists of manufacturers uncomment this section
    /*
      if (($_GET['main_page']==FILENAME_DEFAULT and ($_GET['cPath'] == '' or $_GET['cPath'] == 0)) or  ($request_type == 'SSL')) {
        $show_manufacturers= false;
      } else {
        $show_manufacturers= true;
      }
    */


    if ($show_manufacturers) {
      
    // uncomment this section for fast response if you not use the URL manufacturers link
      /*
      $manufacturer_sidebox_img_query = "select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image
                                from " . TABLE_MANUFACTURERS . " m
                                order by manufacturers_name";
      */                          
      
    $manufacturer_sidebox_img_query "select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url
                                from " 
    TABLE_MANUFACTURERS " m
                               left join " 
    TABLE_MANUFACTURERS_INFO " mi
                               on (m.manufacturers_id = mi.manufacturers_id
                               and mi.languages_id = '" 
    . (int)$_SESSION['languages_id'] . "')
                                ORDER BY RAND() LIMIT 0,"
    BOX_MANUFACTURER_MAX_LOGOS ;
                                

      
    $manufacturer_sidebox_img $db->Execute($manufacturer_sidebox_img_query);

      if (
    $manufacturer_sidebox_img->RecordCount()>0) {

          require(
    $template->get_template_dir('tpl_manufacturers_img_select.php',DIR_WS_TEMPLATE$current_page_base,'sideboxes'). '/tpl_manufacturers_img_select.php');


        require(
    $template->get_template_dir($column_box_defaultDIR_WS_TEMPLATE$current_page_base,'common') . '/' $column_box_default);
      }
    // $show_manufacturers
    ?>

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Side Box Column Layout

    ORDER BY RAND() LIMIT 0,". BOX_MANUFACTURER_MAX_LOGOS ;
    This indicates that BOX_MANUFACTURER_MAX_LOGOS is not being defined, so its name is used instead of the integer value it should have.

    Is this your addition, or is it part of the (presumably tested) original mod?

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Side Box Column Layout

    PHP Code:
      $content "";
      
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent centeredContent">';
      
    $count 1//initialize counter
      
    while (!$manufacturer_sidebox_img -> EOF){
        
    $newline = ($count 2)? ' class="newline"'''//if count is odd, add newline class tag
        
    $count ++; //increment count
        
    $content.='<div' $newline '>'
        
    $content.='<a href="' zen_href_link(FILENAME_DEFAULT'manufacturers_id=' $manufacturer_sidebox_img->fields['manufacturers_id']) . '">';        
        
    $content.=zen_image(DIR_WS_IMAGES $manufacturer_sidebox_img->fields['manufacturers_image'], $manufacturer_sidebox_img->fields['manufacturers_name'], IMAGE_MANUFACTURER_WIDTHIMAGE_MANUFACTURER_HEIGHT);
        
    $content.= '</a></div>';
        if (
    zen_not_null($manufacturer_sidebox_img->fields['manufacturers_url']))
            
    $content.='<a href="' zen_href_link(FILENAME_REDIRECT'action=manufacturer&manufacturers_id=' $manufacturer_sidebox_img->fields['manufacturers_id']) . '" target="_blank">' sprintf(BOX_MANUFACTURER_HOMEPAGE_IMG) . '</a>';
        
        
    $manufacturer_sidebox_img->MoveNext();
      }
      
    $content .= '</div>'
    In your stylesheet, add rules

    #manufacturers-imgContent div {float: left; width: 48%;}
    .newline {clear: left;}

    #manufacturers-img is a guess at the box id; change it as required to match the actual id.

  7. #7
    Join Date
    Nov 2011
    Posts
    38
    Plugin Contributions
    0

    Default Re: Side Box Column Layout

    This i beleive is a tested mod, from the add on section and i am trying to modify it to get the box into 2 columns as stated previously.

    I have defined the BOX_MANUFACTURER_MAX_LOGOS within the english/index.php which was stated to do so in the set up.

    I just cant understand why it works on the main page, categories page however not on the item display page. It seems as if it is conflicting with something within the items page.

    Thanks for your help so far btw.

    I inserted that code into my css, and all it did was float the list to the left, the .newline seemed to do nothing. Still no side by side logos (2 Column sidebox)

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Side Box Column Layout

    Then decrease the width so both logos can fit on one line. The .newline can have no effect until the items fit side by side. How wide are your logo image files, and what is your setting for IMAGE_MANUFACTURER_WIDTH?

    Apparently there is an error in the BOX_MANUFACTURER_MAX_LOGOS define. What do you have?

    You didn't say before that it worked on some pages and not on others. Exactly how does it behave (or not) in different places?

  9. #9
    Join Date
    Nov 2011
    Posts
    38
    Plugin Contributions
    0

    Default Re: Side Box Column Layout

    I have tried ajusting the image sizes. I ahve this set up so i can do this within the admin panel. No matter how small the images are they still only display in a column to the left of that sidebox. The sidebox column is 150px wide, i have tried image sizes at 75px width and just tried 25px width but still has the same effect.

    The sidebox displays fine on the main page, categories page (obviously not with the column layout i require) however as soon as i click on a specific item and it takes me to that item page, i get the error outlined in the previous post. This is the same in all browsers.

    I have in my english/mytemplate/index.php page - define('BOX_MANUFACTURER_MAX_LOGOS', '10'); This is set as follows, would i have it in the correct place within the index page??

    PHP Code:
    <?php
    /**
     * @package languageDefines
     * @copyright Copyright 2003-2006 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: index.php 6550 2007-07-05 03:54:54Z drbyte $
     */

    define('TEXT_MAIN','This is the main define statement for the page for english when no template defined file exists. It is located in: <strong>/includes/languages/english/index.php</strong>');

    // Showcase vs Store
    if (STORE_STATUS == '0') {
      
    define('TEXT_GREETING_GUEST''');
    } else {
      
    define('TEXT_GREETING_GUEST''Welcome, please enjoy our online showcase.');
    }

    define('TEXT_GREETING_PERSONAL''Hello <span class="greetUser">%s</span>! Would you like to see our <a href="%s">newest additions</a>?');

    define('TEXT_INFORMATION''Define your main Index page copy here.');

    //moved to english
    //define('TABLE_HEADING_FEATURED_PRODUCTS','Featured Products');

    //define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');
    //define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');
    //define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');

    if ( ($category_depth == 'products') || (zen_check_url_get_terms()) ) {
      
    // This section deals with product-listing page contents
      
    define('HEADING_TITLE''Available Products');
      
    define('TABLE_HEADING_IMAGE''Product Image');
      
    define('TABLE_HEADING_MODEL''Model');
      
    define('TABLE_HEADING_PRODUCTS''Product Name');
      
    define('TABLE_HEADING_MANUFACTURER''Manufacturer');
      
    define('TABLE_HEADING_QUANTITY''Quantity');
      
    define('TABLE_HEADING_PRICE''Price');
      
    define('TABLE_HEADING_WEIGHT''Weight');
      
    define('TABLE_HEADING_BUY_NOW''Buy Now');
      
    define('TEXT_NO_PRODUCTS''There are no products to list in this category.');
      
    define('TEXT_NO_PRODUCTS2''There is no product available from this manufacturer.');
      
    define('TEXT_NUMBER_OF_PRODUCTS''Number of Products: ');
      
    define('TEXT_SHOW''Filter Results by:');
      
    define('TEXT_BUY''Buy 1 \'');
      
    define('TEXT_NOW''\' now');
      
    define('TEXT_ALL_CATEGORIES''All Categories');
      
    define('TEXT_ALL_MANUFACTURERS''All Manufacturers');
      
    } elseif (
    $category_depth == 'top') {
      
    // This section deals with the "home" page at the top level with no options/products selected
      /*Replace this text with the headline you would like for your shop. For example: 'Welcome to My SHOP!'*/
      
    define('HEADING_TITLE''');
    } elseif (
    $category_depth == 'nested') {
      
    // This section deals with displaying a subcategory
      /*Replace this line with the headline you would like for your shop. For example: 'Welcome to My SHOP!'*/
      
    define('HEADING_TITLE''Congratulations! You have successfully installed your Zen Cart&trade; E-Commerce Solution.'); 
    }

    define('BOX_HEADING_MANUFACTURERS_IMG''Manufacturers');
    define('BOX_MANUFACTURER_HOMEPAGE_IMG''Web of %s');
    define('BOX_MANUFACTURER_MAX_LOGOS''10');
    ?>

  10. #10
    Join Date
    Nov 2011
    Posts
    38
    Plugin Contributions
    0

    Default Re: Side Box Column Layout

    Just thought it play around with the coding of the side box and removed, BOX_MANUFACTURER_MAX_LOGOS and replaced it with the value of 10. This now works on the product page. But not quite correctly, instead of just images it is also has a hypelink under the images saying 'web'.

    Old code:

    PHP Code:
    $manufacturer_sidebox_img_query "select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url
                                from " 
    TABLE_MANUFACTURERS " m
                               left join " 
    TABLE_MANUFACTURERS_INFO " mi
                               on (m.manufacturers_id = mi.manufacturers_id
                               and mi.languages_id = '" 
    . (int)$_SESSION['languages_id'] . "')
                                ORDER BY RAND() LIMIT 1,"
    BOX_MANUFACTURER_MAX_LOGOS  

    New code:

    PHP Code:
    $manufacturer_sidebox_img_query "select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url
                                from " 
    TABLE_MANUFACTURERS " m
                               left join " 
    TABLE_MANUFACTURERS_INFO " mi
                               on (m.manufacturers_id = mi.manufacturers_id
                               and mi.languages_id = '" 
    . (int)$_SESSION['languages_id'] . "')
                                ORDER BY RAND() LIMIT 1,"
    10 

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. adjust the width of side box of side column
    By b90702098 in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 12 Apr 2012, 04:28 AM
  2. Right side layout box problem
    By corvettesalvage in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 8 Jun 2009, 05:48 PM
  3. Changing Categories Layout in Side Box
    By QuickInks in forum Templates, Stylesheets, Page Layout
    Replies: 30
    Last Post: 6 Feb 2009, 02:18 PM
  4. side box freak out, bad layout?? my sideboxes bleed off to the side
    By ChristopherDoiron in forum General Questions
    Replies: 6
    Last Post: 4 Feb 2008, 01:12 AM
  5. disable side box column for ez-pages
    By subb in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Dec 2006, 09:07 PM

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