Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New_products into a table


K-P

Recommended Posts

Posted

Has anyone managed to change the new_products.php into more of a table format so it can be more easily edited like the cieto featured products mod?

 

<?php
/* 
 $Id: featured_products.php,v 2.51 2003/10/31 21:00:00 cieto Exp $

 cieto Featured Products 2.51 MS2 listing module
 [email protected]

Made for:
 osCommerce, Open Source E-Commerce Solutions 
 http://www.oscommerce.com 
 Copyright (c) 2002 osCommerce 
 Released under the GNU General Public License 

*/
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2"> 
<tr> 
<?php 
 if (sizeof($featured_products_array) <> '0') { 
  $col = 0; 
for($i=0; $i<sizeof($featured_products_array); $i++) { 
  if ($featured_products_array[$i]['specials_price']) { 
	$products_price = '<s>' .  $currencies->display_price($featured_products_array[$i]['price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id'])) . '</s>??<span class="productSpecialPrice">' . $currencies->display_price($featured_products_array[$i]['specials_price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id'])) . '</span>'; 
  } else { 
	$products_price = $currencies->display_price($featured_products_array[$i]['price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id'])); 
  } 
  $col++; 
?> 
<td width="50%" valign="top" align="center"> 
<table border="0" width="100%" cellspacing="0" cellpadding="2"> 
<tr> 
<td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" rowspan="4" align="right" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $featured_products_array[$i]['image'], $featured_products_array[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td> 
<td width="80%" valign="top" class="main"><div align="left"><?php echo '<b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '"><u>' . $featured_products_array[$i]['name'] . '</u></a></b>'; ?> 
</div></td> 
</tr> 
<tr> 
<td valign="top" class="main"> 
  <?php 
 if ($featured_products_array[$i]['shortdescription'] != '') { 
  echo $featured_products_array[$i]['shortdescription']; 
 } else { 
  $bah = explode(" ", $featured_products_array[$i]['description']); 
  for($desc=0; $desc<MAX_FEATURED_WORD_DESCRIPTION; $desc++) 
  { 
  echo "$bah[$desc] "; 
  } 
  echo '...'; 
 } 
  ?>  
	  </td> 
</tr> 
<tr> 
<td valign="top" class="main"></td> 
</tr> 
<tr> 
	<td align="left" valign="top" class="main">
	 <?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '5') . '<br><br>' . TABLE_HEADING_PRICE . ': ' . $products_price .'<br>';?>
		  <br>
	  <?php echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>??'; ?></a>
	  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'discount-perfume-fragrance-oil=' . str_replace(" ", "-", $featured_products_array[$i]['name']) . '&products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">';?>

  <!-- If you dont need the More Info text besides the Buy now text/image, just comment out the line below -->
	<?php echo TEXT_MORE_INFO;?></a>?

	</td> 
</tr> 
</table> 
</td> 
<?php 
  if ((($col / FEATURED_PRODUCTS_COLUMNS) == floor($col / FEATURED_PRODUCTS_COLUMNS))) { 
?> 
</tr> 
<tr> 
<td colspan="<?php echo FEATURED_PRODUCTS_COLUMNS; ?>" align="right" valign="top" class="main"><hr width="100%" size="1" noshade></td> 
</tr> 
<tr> 
 <?php 
 } 
if (($i+1) != sizeof($featured_products_array)) { 
?> 
 <?php 
  } 
} 
 } 
?> 
</table>

 

i'd like to change the layout of it if possible, to something like this, can anyone advise?

Posted

That is a good start - simply change the file to call new products rather than featured - you can look at the default module for the correct database query :)

 

Matti

Archived

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

×
×
  • Create New...