osCommerce Knowledge Base

Add Width to Product Listing Columns

Last Update: 17th August, 2005
Article ID: 210



Introduction

The product listing columns can have set widths for each column. There are only 2 files to alter. Make a backup before any modifications.

Solution

In /includes/modules/product_listing.php:

After:

$lc_align = '';


in each column section lines 34 to 68:

Add the following line, with the desired width in place of the 100:

$lc_width = '100';



So that each column value will look like this:

case 'PRODUCT_LIST_MODEL':
$lc_text = TABLE_HEADING_MODEL;
$lc_align = '';
$lc_width = '100';
break;



Then replace following about line 74:

    $list_box_contents[0][] = array('align' => $lc_align,
                                    'params' => 'class="productListing-heading"',
                                    'text' => ' ' . $lc_text . ' ');


With:

    $list_box_contents[0][] = array('align' => $lc_align,
                                    'width' => $lc_width,
                                    'params' => 'class="productListing-heading"',
                                    'text' => ' ' . $lc_text . ' ');



It is also suggested to remove any $lc_align = ''; values in the product listings from lines 34 to 68 and also from lines 99 to 140, or set them all to the left, center or right.

The next file to alter is /includes/classes/boxes.php:

Find this code around line 39:

if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';



Add this code after the above line:

if (isset($contents[$i][$x]['width']) && tep_not_null($contents[$i][$x]['width'])) $tableBox_string .= ' width="' . tep_output_string($contents[$i][$x]['width']) . '"';

 

How helpful is this article?