Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Control New Products module for 2.2-MS2


d4funky1

Recommended Posts

Hi,

 

I have just installed the above contrib.

 

The readme file states:

 

Change the options available in your new new_products.php

 

This all looks like code to me and there isn't any commented out sections with instructions???

 

I have included the file below and would like to know how to do the following:

 

1, select which category to show

2, select the length of time in which to show that category

 

At the moment there are no products showing at all when this is uploaded.

 

Here's the file:

 

<?php
/*
 edited - 2005/07/01 13:50

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

 $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 (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<!-- New Product Expire //-->
<?php
$days = EXPIRE_NEW_PRODUCTS;

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$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 {
$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_new_products = tep_db_fetch_array($check_products_query);
if ($check_new_products['count'] < "1") { 
echo "<br><!-- new_products_disabled //--><br>";
} else {
?>
<!-- New Product Expire_eof //-->
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

new contentBoxHeading($info_box_contents);  
 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
?>
<!-- New Product Expire //-->
<?php
$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 p.products_date_added > SUBDATE( now(  ) ,  INTERVAL " . $days . "  DAY  ) and p.products_status = '1' and products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } 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_date_added > SUBDATE( now(  ) ,  INTERVAL " . $days . "  DAY  ) and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }
?>
<!-- New Product Expire_eof //-->
<?php

 $row = 0;
 $col = 0;
 $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' => 'center',
									   'params' => 'width="33%" valign="top"',
									   'text' => '

				 <table cellspacing=0 cellpadding=0>
				  <tr><td background=images/m24.gif width=169 height=61>
					   <table cellspacing=0 cellpadding=0 align=center>
						<tr><td height=28></td></tr>
						<tr><td class=fe2 align=center style="padding-left:7px;padding-right:7px;"><a class=fe2 href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></td></tr>
						<tr><td height=6></td></tr>
					   </table>
				  </td></tr>
				  <tr><td class=bg>
					   <table cellspacing=0 cellpadding=0 align=center width=115>
						<tr><td height=5></td></tr>
						<tr><td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td></tr>
						<tr><td height=4></td></tr>
						<tr><td class=fe1 align=right>'.$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</td></tr>
					   </table>
				  </td></tr>
				  <tr><td><img src=images/m26.gif width=169 height=9></td></tr>
				  <tr><td height=5></td></tr>
				  <tr><td align=center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image_button('small_view.gif', IMAGE_BUTTON_BUY_NOW) . '</a> <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW) . '</a></td></tr>
				 </table>

									   ');

$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}
 }

 echo '<div class="pageHeading">'.HEADING_TITLE.'</div>';
 new contentBox($info_box_contents);
 }
?>
<!-- new_products_eof //-->

 

many thanks

D4

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...