Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new products cell width and height


Guest

Recommended Posts

in the new products.php when shown on my main page, it lists the new products in rows and columns. th width of these cells for which each product resides is great. the height however fluctuates from product to product so the details and add to cart buttons do not line uphorizontally with the next product in line.

 

Anyone know where i can change this?

 

Thanks

 

Matt

Link to comment
Share on other sites

in the new products.php when shown on my main page, it lists the new products in rows and columns. th width of these cells for which each product resides is great. the height however fluctuates from product to product so the details and add to cart buttons do not line uphorizontally with the next product in line.

 

Anyone know where i can change this?

 

Thanks

 

Matt

in catalog/products_new.php try this. At about line 89 find

<td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>"  

add right after that
height="size"

where size is height of your tallest image +10px. 
You can also set width to be a specific size so columns line up correctly (if needed) by replacing the above php code with specific size.

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

in catalog/products_new.php try this. At about line 89 find

<td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>"  

add right after that
height="size"

where size is height of your tallest image +10px. 
You can also set width to be a specific size so columns line up correctly (if needed) by replacing the above php code with specific size.

 

 

yes i see this, but i need this to happen with new_products.php not products_new.php here is my coding

 

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

E-Commerce Solutions

 Copyright (c) 2005 www.flash-template-design.com

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<tr>
<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<div class="header">'.TABLE_HEADING_NEW_PRODUCTS.'</div>');

 new contentBoxHeading($info_box_contents);
?>
<div style="background-color:#FFF;">
<?php 
 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$new_products['products_id'].' && language_id='.(int)$languages_id;
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 65);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';

if  ( ($col == 0 && $row == 1) || ($col == 2 && $row == 1) ){
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'width="1" height="100%" valign="middle" ',
									   'text' => '<table height="" width="100%" border="0" cellspacing="0" cellpadding="0" >
 <tr>
<td><div style="width:1px;"></div></td>
 </tr>
</table>');
}
elseif (($col == 0 && $row == 1) || ($col == 2 && $row == 1)) {
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'height="1"',
									   'text' => '<table width="95%" border="0" cellspacing="0" cellpadding="0" >
 <tr>
<td style="font-size:1px;background:url(images/points.gif) repeat-x;"> </td>
 </tr>
</table>');
}
elseif ($col == 1 && $row == 1) {
$info_box_contents[$row][$col] = array('align' => '',
									   'params' => '',
									   'text' => ' ');
}
else {	
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="main" width="50%"  valign="top" align="left"',
									   'text' => '<table width="96%" cellpadding=0 cellspacing=0 border=0 style="margin-bottom:7px;">
									   				<tr>
															<td rowspan="2"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="absmiddle"') . '</a></td>
															<td height="35" style="padding-right:10px;"><div class="productName">'.$new_products['products_name'].'</div></td>
													</tr>
													<tr>
														<td height="32" ><span style="color:#C20000; font-size:20px; "> ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</span></td>
													</tr>
													<tr>
														<td colspan="2" height="1" align="left" style="padding:0px 10px;"><div style="background:url(images/dotted.gif);"><img src="images/dotted.gif" width="3" height="1" alt="" /></div></td>
													</tr>
													<tr>

														<td height="60" colspan="2" style="padding-left:15px; align="left" valign="top">'.$description['products_description'].'</td>
													</tr>

													<tr>		
															<td colspan="2" class="main" valign=top align="right" style="padding-right:10px; >'. tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')).'
																<table width="100%"  border="0" cellspacing="0" cellpadding="0">
																  <tr>	
																	<td style="padding-top:1px; padding-right:1px;" ><a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']).'">'.tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS).'</a></td><td style="padding-top:1px;"><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a></td>
																  </tr>
																</table></form>
															</td>
														</tr>
													</table>'); }


$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}

 }
 new contentBox($info_box_contents, 0);

?>
</div>
</td>
</tr>
<!-- new_products_eof //-->

 

 

Any idea's?

 

Matt

Link to comment
Share on other sites

yes i see this, but i need this to happen with new_products.php not products_new.php here is my coding

 

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

E-Commerce Solutions

 Copyright (c) 2005 www.flash-template-design.com

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<tr>
<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<div class="header">'.TABLE_HEADING_NEW_PRODUCTS.'</div>');

 new contentBoxHeading($info_box_contents);
?>
<div style="background-color:#FFF;">
<?php 
 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$new_products['products_id'].' && language_id='.(int)$languages_id;
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 65);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';

if  ( ($col == 0 && $row == 1) || ($col == 2 && $row == 1) ){
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'width="1" height="100%" valign="middle" ',
									   'text' => '<table height="" width="100%" border="0" cellspacing="0" cellpadding="0" >
 <tr>
<td><div style="width:1px;"></div></td>
 </tr>
</table>');
}
elseif (($col == 0 && $row == 1) || ($col == 2 && $row == 1)) {
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'height="1"',
									   'text' => '<table width="95%" border="0" cellspacing="0" cellpadding="0" >
 <tr>
<td style="font-size:1px;background:url(images/points.gif) repeat-x;"> </td>
 </tr>
</table>');
}
elseif ($col == 1 && $row == 1) {
$info_box_contents[$row][$col] = array('align' => '',
									   'params' => '',
									   'text' => ' ');
}
else {	
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="main" width="50%"  valign="top" align="left"',
									   'text' => '<table width="96%" cellpadding=0 cellspacing=0 border=0 style="margin-bottom:7px;">
									   				<tr>
															<td rowspan="2"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="absmiddle"') . '</a></td>
															<td height="35" style="padding-right:10px;"><div class="productName">'.$new_products['products_name'].'</div></td>
													</tr>
													<tr>
														<td height="32" ><span style="color:#C20000; font-size:20px; "> ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</span></td>
													</tr>
													<tr>
														<td colspan="2" height="1" align="left" style="padding:0px 10px;"><div style="background:url(images/dotted.gif);"><img src="images/dotted.gif" width="3" height="1" alt="" /></div></td>
													</tr>
													<tr>

														<td height="60" colspan="2" style="padding-left:15px; align="left" valign="top">'.$description['products_description'].'</td>
													</tr>

													<tr>		
															<td colspan="2" class="main" valign=top align="right" style="padding-right:10px; >'. tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')).'
																<table width="100%"  border="0" cellspacing="0" cellpadding="0">
																  <tr>	
																	<td style="padding-top:1px; padding-right:1px;" ><a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']).'">'.tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS).'</a></td><td style="padding-top:1px;"><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a></td>
																  </tr>
																</table></form>
															</td>
														</tr>
													</table>'); }


$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}

 }
 new contentBox($info_box_contents, 0);

?>
</div>
</td>
</tr>
<!-- new_products_eof //-->

Any idea's?

 

Matt

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

yes i see this, but i need this to happen with new_products.php not products_new.php here is my coding

 

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

E-Commerce Solutions

 Copyright (c) 2005 www.flash-template-design.com

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<tr>
<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<div class="header">'.TABLE_HEADING_NEW_PRODUCTS.'</div>');

 new contentBoxHeading($info_box_contents);
?>
<div style="background-color:#FFF;">
<?php 
 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$new_products['products_id'].' && language_id='.(int)$languages_id;
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 65);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';

if  ( ($col == 0 && $row == 1) || ($col == 2 && $row == 1) ){
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'width="1" height="100%" valign="middle" ',
									   'text' => '<table height="" width="100%" border="0" cellspacing="0" cellpadding="0" >
 <tr>
<td><div style="width:1px;"></div></td>
 </tr>
</table>');
}
elseif (($col == 0 && $row == 1) || ($col == 2 && $row == 1)) {
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'height="1"',
									   'text' => '<table width="95%" border="0" cellspacing="0" cellpadding="0" >
 <tr>
<td style="font-size:1px;background:url(images/points.gif) repeat-x;"> </td>
 </tr>
</table>');
}
elseif ($col == 1 && $row == 1) {
$info_box_contents[$row][$col] = array('align' => '',
									   'params' => '',
									   'text' => ' ');
}
else {	
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="main" width="50%"  valign="top" align="left"',
									   'text' => '<table width="96%" cellpadding=0 cellspacing=0 border=0 style="margin-bottom:7px;">
									   				<tr>
															<td rowspan="2"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="absmiddle"') . '</a></td>
															<td height="35" style="padding-right:10px;"><div class="productName">'.$new_products['products_name'].'</div></td>
													</tr>
													<tr>
														<td height="32" ><span style="color:#C20000; font-size:20px; "> ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</span></td>
													</tr>
													<tr>
														<td colspan="2" height="1" align="left" style="padding:0px 10px;"><div style="background:url(images/dotted.gif);"><img src="images/dotted.gif" width="3" height="1" alt="" /></div></td>
													</tr>
													<tr>

														<td height="60" colspan="2" style="padding-left:15px; align="left" valign="top">'.$description['products_description'].'</td>
													</tr>

													<tr>		
															<td colspan="2" class="main" valign=top align="right" style="padding-right:10px; >'. tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')).'
																<table width="100%"  border="0" cellspacing="0" cellpadding="0">
																  <tr>	
																	<td style="padding-top:1px; padding-right:1px;" ><a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']).'">'.tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS).'</a></td><td style="padding-top:1px;"><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a></td>
																  </tr>
																</table></form>
															</td>
														</tr>
													</table>'); }


$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}

 }
 new contentBox($info_box_contents, 0);

?>
</div>
</td>
</tr>
<!-- new_products_eof //-->

Any idea's?

 

Matt

I'm not where I can test this but there is only 1 place where it addresses small_image_height and small_image_width. Have you tried replacing these with absolute values?

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...