Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new class not working


gscreations

Recommended Posts

Ive added a new class to boxes.php

 

Which will hopefully display my products in a single row table, can someone have a look at this because for some reason it doesnt work, im sure ive missed something somewhere, it is being called from the bottom of product_listing.php which i have alterted to:

 

new ScrollingBox($list_box_contents);

} else {

$list_box_contents = array();

 

$list_box_contents[0] = array('params' => 'class="productListing-odd"');

$list_box_contents[0][] = array('params' => 'class="productListing-data"',

'text' => TEXT_NO_PRODUCTS);

 

new ScrollingBox($list_box_contents);

}

 

Code in boxes.php:

 

class ScrollingBox {

var $table_border = '1';

var $table_width = '600';

var $table_cellspacing = '0';

var $table_cellpadding = '0';

var $table_parameters = '';

var $table_row_parameters = '';

var $table_data_parameters = '';

 

function ScrollingBox($contents) {

$this->table_parameters = 'class="productListing"';

$ScrollingBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';

if (tep_not_null($this->table_parameters)) $ScrollingBox_string .= ' ' . $this->table_parameters;

$ScrollingBox_string .= '><tr>' . "\n";

 

for ($i=0, $n=sizeof($contents); $i<$n; $i++) {

if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $ScrollingBox_string .= $contents[$i]['form'] . "\n";

$ScrollingBox_string .= ' <tr';

if (tep_not_null($this->table_row_parameters)) $ScrollingBox_string .= ' ' . $this->table_row_parameters;

if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $ScrollingBox_string .= ' ' . $contents[$i]['params'];

$ScrollingBox_string .= '>' . "\n";

if (isset($contents[$i][0]) && is_array($contents[$i][0])) {

if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {

$ScrollingBox_string .= ' <td';

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

if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {

$ScrollingBox_string .= ' ' . $contents[$i][$x]['params'];

} elseif (tep_not_null($this->table_data_parameters)) {

$ScrollingBox_string .= ' ' . $this->table_data_parameters;

}

$ScrollingBox_string .= '>';

if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $ScrollingBox_string .= $contents[$i][$x]['form'];

$ScrollingBox_string .= $contents[$i][$x]['text'];

if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $ScrollingBox_string .= '</form>';

$ScrollingBox_string .= '</td>' . "\n";

}

}else {

$ScrollingBox_string .= ' <td';

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

if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {

$ScrollingBox_string .= ' ' . $contents[$i]['params'];

} elseif (tep_not_null($this->table_data_parameters)) {

$ScrollingBox_string .= ' ' . $this->table_data_parameters;

}

$ScrollingBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";

}

$ScrollingBox_string .= ' </tr>' . "\n";

if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $ScrollingBox_string .= '</form>' . "\n";

}

$ScrollingBox_string .= '</table>' . "\n";

 

if ($direct_output == true) echo $ScrollingBox_string;

 

return $ScrollingBox_string;

 

}

}

Link to comment
Share on other sites

ok worked on it a bit more no reduced down to:

This returns correct table tags including looping through <td>'s, but it is just not displaying the images so must be something simple ive missed, any ideas???

 

 

class ScrollingBox {

var $table_border = '1';

var $table_width = '600';

var $table_cellspacing = '0';

var $table_cellpadding = '0';

var $table_parameters = '';

var $table_row_parameters = '';

var $table_data_parameters = '';

 

function ScrollingBox($contents, $direct_output = true) {

$this->table_parameters = 'class="productListing"';

$ScrollingBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';

if (tep_not_null($this->table_parameters)) $ScrollingBox_string .= ' ' . $this->table_parameters;

$ScrollingBox_string .= '><tr>' . "\n";

 

for ($i=0, $n=sizeof($contents); $i<$n; $i++) {

$ScrollingBox_string .= '<td align="center">';

$ScrollingBox_string .= $contents[$i]['text'] . '</td>' . "\n";

}

 

$ScrollingBox_string .= '</tr>' . "\n";

 

 

$ScrollingBox_string .= '</table>' . "\n";

 

if ($direct_output == true) echo $ScrollingBox_string;

 

return $ScrollingBox_string;

 

}

}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...