Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Set column width in product listing


mugitty

Recommended Posts

I have searched through the code and through the forums and can't seem to find a solution for this.

 

Is it possible to set a specific width for a given column in product listings? Specifically, I am trying to set the column width for the article name column in Newsdesk v1.4, so that the length of the summary doesn't cause the article name to wrap.

 

I have used non-breaking spaces in the article name to accomplish this but would prefer to be able to set a specific width for the column.

 

TIA for any pointers!

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

You can do it the following way:

 

/includes/modules/product_listing.php:

 

Add the following line:

 

$lc_width = '100';

 

(define width of the column in single quotes in place of 100)

 

after each:

 

$lc_align = '';

 

so that a column values will look like this:

 

case 'PRODUCT_LIST_MODEL':

        $lc_text = TABLE_HEADING_MODEL;

        $lc_align = '';

        $lc_width = '100';

        break;

 

Replace following line :

 

$list_box_contents[0][] = array('align' => $lc_align,

                                    'width' => $lc_width,

                                    'params' => 'class="productListing-heading"',

                                    'text' => ' ' . $lc_text . ' ');

 

With:

 

$list_box_contents[0][] = array('align' => $lc_align,

                                    'params' => 'class="productListing-heading"',

                                    'text' => ' ' . $lc_text . ' ');

 

Add the following line in /includes/classes/boxes.php:

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

 

after:

 

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

 

Make a backup before modifications.

 

Hope it helps!

Link to comment
Share on other sites

Kavita;

 

Thank you very much for your response.

 

It is now working the way I was looking for. My Dec. 2002 snapshot is a bit different in the boxes class, but I was able to sort it out (that was the area that I was missing in order to make it work).

 

Thanks again :D

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...