Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

alternative new_products layout for those who want


asim0s

Recommended Posts

well i really didnt like the way new_products showed up so i changed the entire file

 

changed the whole looks of it

 

here is the sample

 

 

sample here

 

if anyone wants it i can paste the code i dont mind

 

 

i have a couple of questions though

 

how can i add a buy it now image link

and a More image link again (that will leed to the product description)

 

thank you

 

Enjoy

Link to comment
Share on other sites

why should i use the original css???

there wasnt anything thata feeeded my needs and didnt want to change the looks and feels of something also

 

also my code aint perfect need some fixes

dunno very good php or i can say at all php but my problem is that when the new products are like 7 the 8th cell is created also but its empty im trying to figure out a way if anyone could help me its really appreciated

 

here is the code

 

insert this into stylesheets

 

.ourtexthere{
 font-family: Verdana;
 font-size: 11px;
}

.greetinguser {

/*background: #f8f8f9;*/
 border: Black 1px;
 border-style: solid;
 background:#EFEFEF;
 font-family: Verdana;
 font-size: 11px;
}
.greetinguserwhite {

/*background: #f8f8f9;*/
 border: Black 1px;
 border-style: solid;
 background:#ffffff;
 font-family: Verdana;
 font-size: 11px;
}

 

then backup your catalog/includes/modules/new_products.php

 

then replace the whole code with this

 

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

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?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);
 }

echo '

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="greetinguser">
<tr>
<td>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
 <tr>
   <td>
     <table width="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
       <tr>
         <td>'.sprintf(TABLE_HEADING_NEW_PRODUCTS,'').'<b>'. strftime('%B').'</b></td>
       </tr>
     </table>
   </td>
 </tr>
</table>
</td>
</tr>
 <tr>
  <td>';
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);


echo  ' <table width="100%" border="0" cellspacing="3" cellpadding="3">
     <tr>
       <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
         <tr>
   <td colspan="2">
   
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
           <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td>
	 <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td>
	 </tr>
	 </table>
	 
	 </td>
         </tr>
   
    <tr>
           <td colspan="2"></td>
         </tr>
         <tr>
           <td class="ourtexthere"><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). '</a></td>
           <td class="ourtexthere"><b>FrozenSystems for the month of <font color="0000FF">'.strftime('%B').'</font> presents to you the</b> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></td>
         </tr>
     <tr>
           <td colspan="2" align="right"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">'. tep_image(DIR_WS_IMAGES .'more_button.gif',''). '</a></td>
         </tr>
   <tr>
	 <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
	 </tr>
       </table></td>'
 ?>
<?php
 $new_products = tep_db_fetch_array($new_products_query);
 $new_products['products_name'] = tep_get_products_name($new_products['products_id']);
 // if(empty($new_products['products_name']))
 // {
  //	exit;
 // }else{
 if ($new_products != tep_db_fetch_array($new_products_query)){
?>
<?php
    echo '  <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
         <tr>
   <td colspan="2">
   
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
           <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td>
	 <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td>
	 </tr>
	 </table>
	 
	 </td>
         </tr>
 
 
 
         <tr>
           <td colspan="2"></td>
         </tr>
         <tr>
           <td class="ourtexthere"><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). '</a></td>
           <td class="ourtexthere"><b>FrozenSystems for the month of <font color="0000FF">'.strftime('%B').'</font> presents to you the</b> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></td>
         </tr>
       <tr>
           <td colspan="2" align="right"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">'. tep_image(DIR_WS_IMAGES .'more_button.gif','') .'</a></td>
	 </tr>
	 <tr>
	 <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
	 </tr>
       </table></td>
     </tr>
   </table>';
 }
}
echo '</td>
 </tr>
</table>';

?>
<!-- new_products_eof //-->

Link to comment
Share on other sites

ok previous problem fixed here is the new code

everything works like a charm now

 

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

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?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);
 }

echo '

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="greetinguser">
<tr>
<td>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
 <tr>
   <td>
     <table width="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
       <tr>
         <td><font size="2"><font color="#8A8A8A"><b>'.sprintf(TABLE_HEADING_NEW_PRODUCTS,'').'</b></font><b>'. strftime('%B').'</font></b></td>
       </tr>
     </table>
   </td>
 </tr>
</table>
</td>
</tr>
 <tr>
  <td>';
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);


echo  ' <table width="100%" border="0" cellspacing="3" cellpadding="3">
     <tr>
       <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
         <tr>
   <td colspan="2">
   
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
           <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td>
	 <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td>
	 </tr>
	 </table>
	 
	 </td>
         </tr>
   
    <tr>
           <td colspan="2"></td>
         </tr>
         <tr>
           <td class="ourtexthere"><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). '</a></td>
           <td class="ourtexthere"><b>FrozenSystems for the month of <font color="0000FF">'.strftime('%B').'</font> presents to you the</b> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></td>
         </tr>
     <tr>
           <td colspan="2" align="right"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">'. tep_image(DIR_WS_IMAGES .'more_button.gif',''). '</a></td>
         </tr>
   <tr>
	 <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
	 </tr>
       </table></td>'
 ?>
<?php
 $new_products = tep_db_fetch_array($new_products_query);
 $new_products['products_name'] = tep_get_products_name($new_products['products_id']);
 // if(empty($new_products['products_name']))
 // {
  //	exit;
 // }else{
 if (empty($new_products['products_name'])){
 echo '  <td width="50%" valign="top">
 <table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1">
         <tr>
   <td colspan="2">
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
           <td class="ourtexthere" width="90%"></td>
	 <td class="ourtexthere" align="right" width="10%"></td>
	 </tr>
	 </table>
	 </td>
         </tr>
         <tr>
           <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
         </tr>
         <tr>
           <td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
           <td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
         </tr>
       <tr>
           <td colspan="2" align="right">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
	 </tr>
	 <tr>
	 <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
	 </tr>
       </table></td>
     </tr>
   </table>';
 }
 else{
?>
<?php
    echo '  <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
         <tr>
   <td colspan="2">
   
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
           <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td>
	 <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td>
	 </tr>
	 </table>
	 
	 </td>
         </tr>
 
 
 
         <tr>
           <td colspan="2"></td>
         </tr>
         <tr>
           <td class="ourtexthere"><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). '</a></td>
           <td class="ourtexthere"><b>FrozenSystems for the month of <font color="0000FF">'.strftime('%B').'</font> presents to you the</b> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></td>
         </tr>
       <tr>
           <td colspan="2" align="right"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">'. tep_image(DIR_WS_IMAGES .'more_button.gif','') .'</a></td>
	 </tr>
	 <tr>
	 <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
	 </tr>
       </table></td>
     </tr>
   </table>';
 }
}
echo '</td>
 </tr>
</table>';

?>
<!-- new_products_eof //-->

Link to comment
Share on other sites

I liked the look of this alternative new_products but didn't like the same text - "...for the month of October presents to you the...." on each product - I wanted to use a shortened version of the product description with a ...read more link at the end, so here goes.

 

change the $limit = 170; at the start of the file to display more/less of the description.

 

 

<?php

 

$limit = 170;

 

/*

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

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- new_products //-->

<?php

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

$new_products_query = tep_db_query("select pd.products_id, pd.products_description, 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_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' and p.products_id = pd.products_id 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, pd.products_id, pd.products_description, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 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' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

echo '

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="greetinguser">

<tr>

<td>

<table width="100%" border="0" cellspacing="3" cellpadding="3">

<tr>

<td>

<table width="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">

<tr>

<td><font size="2"><font color="#000000"><center><b>'.sprintf(TABLE_HEADING_NEW_PRODUCTS,'').'</center></font></b></td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

<tr>

<td>';

while ($new_products = tep_db_fetch_array($new_products_query)) {

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$products_description = $new_products['products_description'];

$description_length = strlen($products_description);

if ($description_length > $limit) {

$products_description = substr($products_description,0,$limit) . "";

}

echo ' <table width="100%" border="0" cellspacing="3" cellpadding="3">

<tr>

<td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">

<tr>

<td colspan="2">

 

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td>

<td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td>

</tr>

</table>

 

</td>

</tr>

 

<tr>

<td colspan="2"></td>

</tr>

<tr>

<td class="ourtexthere"><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). '</a></td>

<td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a></td>

</tr>

<tr>

<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>

</tr>

</table></td>'

?>

<?php

$new_products = tep_db_fetch_array($new_products_query);

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

 

$products_description = $new_products['products_description'];

 

$description_length = strlen($products_description);

 

if ($description_length > $limit) {

$products_description = substr($products_description,0,$limit) . "";

 

}

 

// if(empty($new_products['products_name']))

// {

// exit;

// }else{

if (empty($new_products['products_name'])){

echo ' <td width="50%" valign="top">

<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td colspan="2">

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="ourtexthere" width="90%"></td>

<td class="ourtexthere" align="right" width="10%"></td>

</tr>

</table>

</td>

</tr>

<tr>

<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>

</tr>

<tr>

<td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>

<td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>

</tr>

<tr>

<td colspan="2" align="right">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>

</tr>

<tr>

<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>

</tr>

</table></td>

</tr>

</table>';

}

else{

?>

<?php

echo ' <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">

<tr>

<td colspan="2">

 

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td>

<td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td>

</tr>

</table>

</td>

</tr>

<tr>

<td colspan="2"></td>

</tr>

<tr>

<td class="ourtexthere"><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). '</a></td>

<td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a></td>

</tr>

 

<tr>

<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>

</tr>

</table></td>

</tr>

</table>';

}

}

echo '</td>

</tr>

</table>';

?>

<!-- new_products_eof //-->

Link to comment
Share on other sites

well i would love also to use product description

 

but unfortunately my product description is html so it will need more code to display..

 

 

hmmm... now that you are suggesting it i will try it

Link to comment
Share on other sites

Great tip.

 

One question. How do you make it so that it will display random new products?

Also I have the boxes on the left side of the big info box. Is there a way to add another coulum of new products meaning that there will be two rowns of boxes contaning new products.

 

Thanks

Link to comment
Share on other sites

One question. How do you make it so that it will display random new products?

 

Change order by p.products_date_added desc in both sql querys to order by rand()

 

Also I have the boxes on the left side of the big info box. Is there a way to add another coulum of new products meaning that there will be two rowns of boxes contaning new products.

 

 

not sure what you mean by this..

daithi

Link to comment
Share on other sites

No I did not. I do however have the specials infobox underneath it. Would that create that problem?

 

Is there a way inorder to make the second colum display the specials at random. If there is a way, then I can remove the infobox underneath and that might fix the problem.

 

 

Thanks for your help.

Link to comment
Share on other sites

  • 1 month later...

Hi @ all

 

 

I wanna have this Design for the product_listing (under Categories -- includes/modules/product_listing.php)

 

I use MS2. Can anybody help me please ?

 

<?php

$limit = 170;

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

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

Copyright ? 2003 osCommerce

Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select pd.products_id, pd.products_description, 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_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' and p.products_id = pd.products_id 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, pd.products_id, pd.products_description, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 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' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
}
echo '
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="greetinguser">
<tr>
<td>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
<tr>
<td><font size="2"><font color="#000000"><center><b>'.sprintf(TABLE_HEADING_NEW_PRODUCTS,'').'</center></font></b></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>';
while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);
$products_description = $new_products['products_description'];
$description_length = strlen($products_description);
if ($description_length > $limit) { 
$products_description = substr($products_description,0,$limit) . "";
}
echo ' <table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
<tr>
<td colspan="2">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td>
<td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td>
</tr>
</table>

</td>
</tr>

<tr>
<td colspan="2"></td>
</tr>
<tr>
<td class="ourtexthere"><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). '</a></td>
<td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a></td>
</tr>
<tr>
<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
</tr>
</table></td>'
?>
<?php
$new_products = tep_db_fetch_array($new_products_query);
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$products_description = $new_products['products_description'];

$description_length = strlen($products_description);

if ($description_length > $limit) { 
$products_description = substr($products_description,0,$limit) . "";

}

// if(empty($new_products['products_name']))
// {
// exit;
// }else{
if (empty($new_products['products_name'])){
echo ' <td width="50%" valign="top">
<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="ourtexthere" width="90%"></td>
<td class="ourtexthere" align="right" width="10%"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
</tr>
<tr>
<td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
<td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
</tr>
<tr>
<td colspan="2" align="right">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
</tr>
<tr>
<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
</tr>
</table></td>
</tr>
</table>';
}
else{
?>
<?php
echo ' <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite">
<tr>
<td colspan="2">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td>
<td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td class="ourtexthere"><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). '</a></td>
<td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a></td>
</tr>

<tr>
<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td>
</tr>
</table></td>
</tr>
</table>';
}
}
echo '</td>
</tr>
</table>';
?>
<!-- new_products_eof //-->

Link to comment
Share on other sites

This is great! What a difference this makes, i have only just begun to play around with this, but already it looks great!

 

Many thanks for the code..

 

:D

Link to comment
Share on other sites

Hi there,

 

Thought someone on this thread could maybe help me,

 

This is my current new products design at the moment :-

 

http://www.mexicofotografico.com/catalog/index.php

 

How do I align the text/title to the right of the image ? (so it sits mid-height of the image), instead of having the text/title underneath ?

 

If anyone at all could give me any kind of guidance I would be more than most grateful !!!

 

J

Link to comment
Share on other sites

  • 3 weeks later...

For those of you using this modified new_products.php layout...

 

If you'd like to add borders around the images in the new products box,

copy and paste this into your stylesheet, just below where you've already added the stylesheet additions from this modification:

 

table.greetinguser td.ourtexthere img {
border: 1px darkblue solid;
}

table.greetinguser td.ourtexthere a:hover img {
border: 1px orange solid;
}

 

Just change the pixel, color and border style to your liking.

 

Big thanks to "papas" for this freebie...Is open source cool or what? :D

Link to comment
Share on other sites

msheno01,

 

I believe that, unless you ESTENSIVELY modify the osc code (and your site doesn;t show that you have), you are required to display the "Powered by OsCommerce and accompanying hyperlink.

Link to comment
Share on other sites

I believe that, unless you ESTENSIVELY modify the osc code (and your site doesn;t show that you have), you are required to display the "Powered by OsCommerce and accompanying hyperlink.
No, you are required to display the Copyright osCommerce and link. Note: to remove the copyright, one must *at minimum* replace all the images on the site, including the buttons. The layout also needs to be substantially altered. See www.oscommerce.com/community/faq,26/q,50 for more info.

 

You are only required (although it is always preferred) to display the Powered by text when you are posting in the My Store forum. That is a forum rule. The copyright is a legal requirement.

 

Hth,

Matt

Link to comment
Share on other sites

  • 1 month later...

Ok back on topic.

 

I have one for you, and it is probably very easy to do, however I flat out just don't totaly understand PHP yet ... I am learning though.

 

Ok in this new_products.php "contrib?" I would like to make 2 changes and need some help.

 

1. I need to change the layout so that there is only 1 column instead of 2 per row.

I would also like to widen the column a bit so that it takes up almost the entire row, but leaves enough space to "breath".

 

2. With this new given space, I would also like to add a BUY NOW button.

(To target the customers that just can't hold back any longer.) haha!

 

Any help is much appreciated!

If someone can do this, or has done it, please paste your code here.

I would like to learn how to make the changes, as I have already spent several hours trying to accomplish this. (Yes, I am that bad - Progress not perfection!)

 

Also Is this a contrib yet ? I can see a possible admin section to it also, to make these changes and to allow the BUY NOW button ect .. would be nice as OC doesnt offer any flex in the new products box. Much Needed contrib. - Thank You!

Scooterboy

Link to comment
Share on other sites

  • 3 months later...

Archived

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

×
×
  • Create New...