Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/08/2008, 12:14
jorgels
 
Fecha de Ingreso: marzo-2003
Ubicación: México, D. F.
Mensajes: 12
Antigüedad: 21 años, 1 mes
Puntos: 0
Filtrar por Fecha

Quiero filtrar los resultados basado en la fecha: date_purchased siempre y cuando esa fecha no sea mayor a un año, es decir si es la fecha es 12/08/2007, hoy ya no me deberia aparecer:


Aqui esta mi codigo completo:


<?php
if (tep_session_is_registered('customer_id')) {
$orders_query = tep_db_query("select distinct op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = '1' group by products_id order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX);
if (tep_db_num_rows($orders_query)) {
?>
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_CUSTOMER_ORDERS);
new infoBoxHeading($info_box_contents, false, false);
$product_ids = '';
while ($orders = tep_db_fetch_array($orders_query)) {
$product_ids .= (int)$orders['products_id'] . ',';
}
$product_ids = substr($product_ids, 0, -1);
$customer_orders_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
$products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . (int)$languages_id . "' order by products_name");
while ($products = tep_db_fetch_array($products_query)) {
$customer_orders_string .= ' <tr>' .
' <td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a></td>' .
' </tr>';
}
$customer_orders_string .= '</table>';
$info_box_contents = array();
$info_box_contents[] = array('text' => $customer_orders_string);
new infoBox($info_box_contents);
?>
</td>
</tr>
<?php
}
}
?>


Gracias de antemano.