Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tableless design of osCommerce


petino

Recommended Posts

There are some tables, but that is not a bad thing. Tables are OK in xHTML for tabular data.

 

I'm not really liking the layout/theme, but I like the cleaner code.

Have you done this using the existing classes and functions, or is it mostly hand-coded in all the files?

Link to comment
Share on other sites

There are some tables, but that is not a bad thing. Tables are OK in xHTML for tabular data.

 

I'm not really liking the layout/theme, but I like the cleaner code.

Have you done this using the existing classes and functions, or is it mostly hand-coded in all the files?

 

 

hi burt,

 

yes, tables are ok for tabular data (shopping cart, tables in product description)

 

i have modified the classes and functions + changes in all files (like index.php, product_info.php, etc.)

Link to comment
Share on other sites

hi burt,

 

yes, tables are ok for tabular data (shopping cart, tables in product description)

 

i have modified the classes and functions + changes in all files (like index.php, product_info.php, etc.)

 

 

Hi,

 

would you mind sharing how you changed the boxes to divs?

I'm no php programmer but am ok with xhtml/css.

I've managed to create the header, footer and the top menu and breadcrumbs ok with css but i can't find where to make the boxes into divs.

 

Your help would be greatly appreciated.

 

Cheers

Link to comment
Share on other sites

Hi,

 

would you mind sharing how you changed the boxes to divs?

I'm no php programmer but am ok with xhtml/css.

I've managed to create the header, footer and the top menu and breadcrumbs ok with css but i can't find where to make the boxes into divs.

 

Your help would be greatly appreciated.

 

Cheers

 

sure,

i have changed files in "/includes/boxes/" folder

 

for example best_sellers.php:

 

<?php
/*
 $Id: best_sellers.php,v 1.21 2003/06/09 22:07:52 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if (isset($current_category_id) && ($current_category_id > 0)) {
$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
 } else {
$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
 }

 if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {
?>
<!-- best_sellers //-->
	  <div class="blok1-nadpis"><?php echo '<span class="headerNavigation1">' . BOX_HEADING_BESTSELLERS . '</span>'; ?></div>
<?php


$rows = 0;
$bestsellers_list = '<ol id="bestsellers">';
while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
  $rows++;
  $bestsellers_list .=  '<li><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></li>';
}
$bestsellers_list .= '</ol>';

$info_box_contents = array();
$info_box_contents[] = array('text' => $bestsellers_list);

new infoBox2($info_box_contents);
?>

<!-- best_sellers_eof //-->
<?php
 }
?>

 

and a file "includes/classes/boxes.php" (below is just a bit of code)

 

...

//box 2  
  class tableBox2 {
var $div_class = 'pollColumn';
var $table_parameters = '';
var $table_row_parameters = '';
var $table_data_parameters = '';

// class constructor
function tableBox2($contents, $direct_output = false) {
  $tableBox_string = ' ';
  if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
  $tableBox_string .= '' . "\n";

  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
	$tableBox_string .= '  ';
	if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
	if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
	$tableBox_string .= '' . "\n";

	if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
	  for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
		if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
		  $tableBox_string .= '	';
		  if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
		  if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
			$tableBox_string .= ' ' . $contents[$i][$x]['params'];
		  } elseif (tep_not_null($this->table_data_parameters)) {
			$tableBox_string .= ' ' . $this->table_data_parameters;
		  }
		  $tableBox_string .= '';
		  if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
		  $tableBox_string .= $contents[$i][$x]['text'];
		  if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
		  $tableBox_string .= '' . "\n";
		}
	  }
	} else {
	  $tableBox_string .= '	';
	  if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
	  if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
		$tableBox_string .= ' ' . $contents[$i]['params'];
	  } elseif (tep_not_null($this->table_data_parameters)) {
		$tableBox_string .= ' ' . $this->table_data_parameters;
	  }
	  $tableBox_string .= '' . $contents[$i]['text'] . '' . "\n";
	}

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

  $tableBox_string .= '' . "\n";

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

  return $tableBox_string;
}
 }

class infoBox2 extends tableBox2 {
function infoBox2($contents) {
  $info_box_contents2 = array();
  $info_box_contents2[] = array('text' => $this->infoBoxContents2($contents));

  $this->tableBox2($info_box_contents2, true);
}

function infoBoxContents2($contents) {

  $info_box_contents2 = array();
 // $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	$info_box_contents2[] = array(array(
									   'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),

									   'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : '')));
  }
  //$info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  return $this->tableBox2($info_box_contents2);
}


}

...

 

if you have problems with implementation, i can send you those files via e-mail, just PM me

Link to comment
Share on other sites

  • 2 months later...

it wouldn't be possible to get one more example would it please, for say /boxes/categories.php ?

 

 

and with "includes/classes/boxes.php" do i just place that code at the end of my current boxes.php file?

and then my files with tables will use tableBox and with divs will use tableBox2 as my understanding?

 

thanks in advance :)

kev.

Link to comment
Share on other sites

  • 2 weeks later...

This is great. I've been working on tableless commerce for 2 weeks. Could you Please post all your catalog, except configure.php? You could zip them. If you do, I'll work on making it onto something that could be shared more easily. With you getting all the credit.

Peace, Matt

Link to comment
Share on other sites

  • 4 months later...

hi,

could you please explain how you make this perfectly validate template?I search and try something but tables are very frustrated me..I don't want to install an user contributed like STS or BTS..

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...