Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Getting products_new to match product listing table


jhande

Recommended Posts

I have been playing with the product_new.php file and have been able to change a few things no problem.

 

But I can't figure out how to get the table to display as the product listing table with the odd & even row colors as declared in the stylesheet.

 

I thought it was a simple addition of this:

	  if (($rows/2) == floor($rows/2)) {
	$list_box_contents[] = array('params' => 'class="productListing-even"');
  } else {
	$list_box_contents[] = array('params' => 'class="productListing-odd"');
  }

 

To this:

  $products_new_query_raw = "select p.products_id, pd.products_name, pd.short_desc, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_date_added >= '" . tep_date_raw($mdy) . "'" . " order by p.products_date_added DESC, pd.products_name";
 $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 

Or this:

<?php
 if ($products_new_split->number_of_rows > 0) {
$products_new_query = tep_db_query($products_new_split->sql_query);
while ($products_new = tep_db_fetch_array($products_new_query)) {
  if ($new_price = tep_get_products_special_price($products_new['products_id'])) {
	$products_price = '<s>' . $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';
  } else {
	$products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));
  }
?>

 

But as usual I was wrong. :blush:

 

Can anyone help me on this one?

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Link to comment
Share on other sites

Try this. In products_new.php find

	while ($products_new = tep_db_fetch_array($products_new_query)) {

Change to

	$rows = 0;
while ($products_new = tep_db_fetch_array($products_new_query)) {
  $rows++;

Just below this part

	  if ($new_price = tep_get_products_special_price($products_new['products_id'])) {
	$products_price = '<s>' . $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';
  } else {
	$products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));
  }

Add

	  if (($rows/2) == floor($rows/2)) {
	echo '		  <tr class="productListing-even">';
  } else {
	echo '		  <tr class="productListing-odd">';
  }

Remove the " <tr> " after that.

 

One thing to keep in mind. This part (right after the data output) puts a space between the rows. If you dont want that space just remove it.

		  <tr>
		<td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...