Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New products in two columns


gregy

Recommended Posts

Hi

 

I would like this code to dispaly new products (last 24 hours) in two columns. Curently it is in 1. Can you help me work this out?

 

Thank you

 

<?php
/*
 $Id: products_new.php,v 1.27 2003/06/09 22:35:33 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW));
?>
<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<?php

//begin fixed code to only actually show "new" products as new products

$days_of_new_products = 1;

// the numbers of days that new products will be shown on this page is selected by $days_of_new_products
$time_lag = mktime(date("H"), date("i"), date("s"), date("m"), date("d")-$days_of_new_products, date("Y"));

// creates the MySQL date time stamp from the UNIX date , example: 2004-12-06 10:02:44
$date_time_lag = date("Y-m-d H:i:s", $time_lag);

$products_new_array = array();

$products_new_query_raw = "select p.products_quantity, p.products_id, pd.products_name, 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 > '".$date_time_lag."' order by p.products_date_added DESC, pd.products_name";

// end fix for new products

$products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>

<tr>
 <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
   <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
   <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
  </tr>
 </table></td>
</tr>
<tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
 }
?>
<tr>
 <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?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']));
     }
?>
  <tr>
   <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id'],'NONSSL',false) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
   <td valign="top" class="main"><font face="verdana" size="1"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id'],'NONSSL',false) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br><br><b>' . TEXT_PRICE . '</b> ' . $products_price; ?></font></td>
           <?php if ($products_new['products_quantity'] > 0)
           {?>
                     <?php } ?>
  </tr>
  <tr>
   <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
   }
 } else {
?>
  <tr>
   <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>
  </tr>
  <tr>
   <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>
 </table></td>
</tr>
</table></div>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...