Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with whats new box code


edski

Recommended Posts

Posted

Hiya i'm designing my oscommerce to suit i theme i got and im enjoying learning how to modify bits and bobs of the code.

 

Ive ran into a bit of a problem i wish to display 2 whats new items next to each other, while i managed to sort out the code to generate 2 different images i now have the problem of getting them to display side by side.

 

Normally in my dreamweaver i would use the following code :-

<table width="234" border="0" cellpadding="0" cellspacing="0">
 <tr> 
<td width="117" height="120" valign="top"><!--LayoutEmptyCell--> </td>
<td width="117" valign="top"><!--LayoutEmptyCell--> </td>
 </tr>
</table>

 

then i would put the image into the empty cells, but looking at the whats new code i'm wondering where to start :-

 

<?php
/*
 $Id: whats_new.php,v 1.31 2003/02/10 22:31:09 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
?>
<!-- whats_new //-->
	  <tr>
		<td>
<?php
$random_product['products_name'] = tep_get_products_name($random_product['products_id']);
$random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

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



if (tep_not_null($random_product['specials_new_products_price'])) {
  $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
  $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
  $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
}

 if ($random_product2 = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
$random_product2['products_name'] = tep_get_products_name($random_product2['products_id']);
$random_product2['specials_new_products_price'] = tep_get_products_special_price($random_product2['products_id']);


if (tep_not_null($random_product2['specials_new_products_price'])) {
  $whats_new_price = '<s>' . $currencies->display_price($random_product2['products_price'], tep_get_tax_rate($random_product2['products_tax_class_id'])) . '</s><br>';
  $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product2['specials_new_products_price'], tep_get_tax_rate($random_product2['products_tax_class_id'])) . '</span>';
} else {
  $whats_new_price = $currencies->display_price($random_product2['products_price'], tep_get_tax_rate($random_product2['products_tax_class_id']));
}

$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
							 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br>       <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'index32.gif') . '</a>');



new whatsnewBox($info_box_contents);
}
?>
		</td>
	  </tr>

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

 

you will see the code i used to generate 2nd image but if anyone could give me an idea of how i can achieve my goal i would be grateful.

 

:thumbsup:

Archived

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

×
×
  • Create New...