Jump to content
xt:Commerce Community Forum

new_products.php & whats_new.php bugs


x-ray

Recommended Posts

Hi there,

i have found some logic bugs in new_products.php module and whats new box :

they are showing any products orderderd by date added, not only true new products :

in new_products.php

we have statment that will set range of product selection to only new products :


if (MAX_DISPLAY_NEW_PRODUCTS_DAYS != '0') {


  $date_new_products = date("Y.m.d", mktime(1, 1, 1, date(m), date(d) - MAX_DISPLAY_NEW_PRODUCTS_DAYS, date(Y)));

  $days = " and p.products_date_added > '".$date_new_products."' ";


}

but its newer used in any query, so we must add this for both queries : for an example : . . . ".$fsk_lock." ".$days." . . . same thing with box whats_new, but we must add this statment :

if (MAX_DISPLAY_NEW_PRODUCTS_DAYS != '0') {


  $date_new_products = date("Y.m.d", mktime(1, 1, 1, date(m), date(d) - MAX_DISPLAY_NEW_PRODUCTS_DAYS, date(Y)));

  $days = " and p.products_date_added > '".$date_new_products."' ";


}

now this module will show correct new producs, also this select query isn't optimized :

$new_products_query = "SELECT * FROM

its sellects all data from 4 biggest tables (in most cases) , but uses only few fields You can replace it byt this one :

$new_products_query = "SELECT p.products_id,

pd.products_name,

pd.products_short_description,

p.products_price,

p.products_tax_class_id,

p.products_image,

FROM

This should speed up much more selection of new products.

Link to comment
Share on other sites

  • 6 months later...

Archived

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

×
  • Create New...