RE: Control New Products

meltus <[email protected]>
Newsgroups gmane.comp.web.oscommerce.features
Message-ID <10cea1257ec41c7b7752cd469e640e73@osCommerce-Forums>
This message was sent from: Features
http://forums.oscommerce.com/viewtopic.php?p=199815#199815
----------------------------------------------------------------

by default the new products shows the first x of the new products sorted by date added.  THis works fine of you have a lot of new products.  If you infrequently add new products - the infobox soons becomes rather silly as the products were added a long time ago.

You need to add a clasue to the SQL,

i.e.

[code]products_date_added > SUBDATE( now(  ) ,  INTERVAL 30  DAY  ) [/code]


[code]$products_new_query_raw = "select p.products_id, pd.products_name, pd.products_description_short, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_date_added > SUBDATE( now(  ) ,  INTERVAL 30  DAY  ) order by p.products_date_added DESC, pd.products_name";[/code]



this shows an example of adding a clause to check that it was within the last 30 days.


the SQL you need to amend will be in products_new.php and includes/modules/new_products.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.