Jump to content

Archived

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

christiansees

Center Specials Box

Recommended Posts

Hello All,

I have been working on a new box in the center column That pull from the items added to specials and displays them just like most recently added. I have most of it coded. There is just one problem and any help would be most appreciated.

I call it new_releases.php

<?php
/*
 $Id: new_releases.php,v 0.1 2008/13/03 14:10:58 John Hoerr Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_release //-->
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => TABLE_HEADING_NEW_RELEASES);

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

$new_release_query = tep_db_query("select distinct p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_release = tep_db_fetch_array($new_release_query)) {
$new_release['products_name'] = tep_get_products_name($new_release['products_id']);
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" width="33%" valign="top"',
									   'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_release['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_release['products_image'], $new_release['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_release['products_id']) . '">' . $new_release['products_name'] . '</a><br>' . $currencies->display_price($new_release['products_price'], tep_get_tax_rate($new_release['products_tax_class_id'])));

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

 new contentBox($info_box_contents);
?>
<!-- new_release_eof //-->

 

In order for this to work you have to add the code

		  <tr>
		<td><?php include(DIR_WS_MODULES . FILENAME_NEW_RELEASES); ?></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>

To index.php around line 110 and line 320.

Also you have to add to filenames.php

  define('FILENAME_NEW_RELEASES', 'new_releases.php');

And to catalog/includes/languages/english/index.php you have to add

define('TABLE_HEADING_NEW_RELEASES', 'New Releases');

Here is where you would put in what ever you would want your box to say choose the language directory for which ever language you use.

My problem is that rather than displaying what is added to specials in order it displays one of the items added to specials over and over. You can see it here

Once again any help is much appreciated.


On your last day only you will have to approve or disaprove of how your life has been.

Share this post


Link to post
Share on other sites

Try removing the distinct an putting in a group by.

$new_release_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' group by p.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);


Lloyd

Share this post


Link to post
Share on other sites

Lloyd,

YOU ROCK!

Thanks allot for your suggestion. It worked like a charm.

Do you think I should add this as a contribution?


On your last day only you will have to approve or disaprove of how your life has been.

Share this post


Link to post
Share on other sites

10% of 0 = 0

So I'll tell you what 60/40 that's my best offer take it or leave it!


On your last day only you will have to approve or disaprove of how your life has been.

Share this post


Link to post
Share on other sites

×