Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Latest products


chinakris

Recommended Posts

Posted

Hi

I give up. I know it's here somewhere but I can't find it.

How do I stop "latest products" from showing all of the products in the store, instead of the most recently added ones?

Thanks in advance.

Posted

If I understand your question correctly.

 

Try Admin | Configurations | Maximum Values | New Products Module. B)

Posted
If I understand your question correctly.

 

Try Admin | Configurations | Maximum Values | New Products Module. B)

 

Thank you. But changing that figure only changes the amount of products which are displayed on the page at once. What I want is for only the most recent products to be on there, not the whole catalogue. Any other suggestions would be appreciated.

Posted
Can anyone else help me out?

 

 

do something like this in the top of new_products module:

 

$days_to look_back = "120";

 

list($usec, $sec) = explode(' ', microtime());

srand( (float) $sec + ((float) $usec * 100000) );

$mtm= rand();

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

$new_products_query =

tep_db_query("select p.products_id,

p.products_image,

p.products_model,

p.products_tax_class_id,

pd.products_name,

IF(s.status, s.specials_new_products_price, p.products_price) as products_price

from " . TABLE_PRODUCTS . " p left join

" . TABLE_SPECIALS . " s on p.products_id = s.products_id left join

" . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id

where pd.language_id = '" . (int)$languages_id . "' and

products_status = '1' and

products_date_added > SUBDATE( now( ) , INTERVAL " . $days_to_look_back . " DAY )

order by rand($mtm) DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

$check_products_query =

tep_db_query("select count(products_id) as count

from " . TABLE_PRODUCTS . "

where products_status = '1' and

products_date_added > SUBDATE( now( ) , INTERVAL " . $days_to_look_back . " DAY )");

} else {

 

$new_products_query =

tep_db_query("select distinct p.products_id,

p.products_image,

p.products_model,

p.products_tax_class_id,

pd.products_name,

IF(s.status, s.specials_new_products_price, p.products_price) as products_price

from " . TABLE_PRODUCTS . " p left join

" . TABLE_SPECIALS . " s on p.products_id = s.products_id,

" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c,

" . TABLE_CATEGORIES . " c left join

" . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id

where pd.language_id = '" . (int)$languages_id . "' and

p.products_id = p2c.products_id and

p2c.categories_id = c.categories_id and

c.parent_id = '" . $new_products_category_id . "' and

p.products_status = '1' and

p.products_date_added > SUBDATE( now( ) , INTERVAL " . $days_to_look_back . " DAY )

order by rand($mtm) DESC

limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

$check_products_query =

tep_db_query("select count(p.products_id) as count

from " . TABLE_PRODUCTS . " p left join

" . TABLE_SPECIALS . " s on p.products_id = s.products_id,

" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c,

" . TABLE_CATEGORIES . " c

where p.products_id = p2c.products_id and

p2c.categories_id = c.categories_id and

c.parent_id = '" . $new_products_category_id . "' and

p.products_status = '1' and

products_date_added > SUBDATE( now( ) , INTERVAL " . $days_to_look_back . " DAY )

limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

 

$check = tep_db_fetch_array($check_products_query);

Treasurer MFC

Archived

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

×
×
  • Create New...