Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New Products list


ollee

Recommended Posts

Does anybody know of a contribution that allows this? I'm looking for something that generates a simple list of the last 20 or so products added to the store and can't seem to find anything like it! cheers.

Link to comment
Share on other sites

yeah, but it displays them as images, right? I'm looking for a simple text list.

Not that I know of.

 

Depending on where you want it to display, you may have to hack something to get what you want.

Link to comment
Share on other sites

managed to hack something together, if anyone's interested, for future reference:

 

<?php

/*

Control New Products modul Version 2,0 ***

 

$Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

------------------------------------------------

 

Control New Products modul Version 2,0 ***

File edited 2003/07/24 by Henrik Algmark AKA. Zipper from Sweden ***

PLZ email me feedback on this script as it is my first contri to the OsC Community ***

[email protected] ***

-------------------------------------------------

*/

?>

 

<?php /*

---------INPORTANT INFORMATION!!!!------------

In $box_show_option, shoose between value 1 or 2. Do not choose any other number as the script will be corrupt.

Value 1 makes the new products box disappear completely if there are no new products added within the shoosen amount of days. (Default)

Value 2 shows the new products box withe the text in $no_new_rext if there are no new products added within the shoosen amount of days. */

$box_show_option = "1"; // SHOOSE BETWEEN VALUE 1 OR 2 HERE

$days = "30"; // SET THE NUMBER OF DAYS A PRODUCT SHOULD APPEAR IN THE BOX AFTER IT HAS BEEN ADDED. DEFAULT= 30 DAYS

$no_new_text = "No new products this month"; // TRANSLATE INTO YOUR LANGUAGE (Default English)

//-------END OF EDITING-----------------------

 

// DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING!!!!

// *** Start of edited part of original file new_products.php provided by OsCommerce ***

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_tax_class_id, 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 where products_status = '1' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) 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 . " DAY )");

} else {

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, 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 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 . " DAY )");

$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 . " DAY ) limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

$check = tep_db_fetch_array($check_products_query);

if ($check['count'] <= 0 && $box_show_option == 1) {

echo "

<!-- new_products //-->

<!-- new_products_disabled //-->

<!-- new_products_eof //-->";

} elseif ($check['count'] <= 0 && $box_show_option == 2) {

?>

<!-- new_products //-->

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 

new contentBoxHeading($info_box_contents);

$row = 0;

$col = 0;

$info_box_contents = array();

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$info_box_contents[$row][$col] = array('align' => 'left',

'params' => 'class="smallText" width="33%" valign="top"',

'text' => $no_new_text);

new contentBox($info_box_contents);

?>

<!-- new_products_eof //-->

<?php } else { ?>

<!-- new_products //-->

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 

new contentBoxHeading($info_box_contents);

$info_box_contents = array();

while ($new_products = tep_db_fetch_array($new_products_query)) {

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$info_box_contents[$row][$col] = array('align' => 'left',

'params' => 'class="smallText" valign="top"',

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>');

 

$col ++;

if ($col > 0) {

$col = 0;

$row ++;

}

}

 

new contentBox($info_box_contents);

?>

<!-- new_products_eof //-->

<?php } ?>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...