Jump to content
Sign in to follow this  
spooks

Product Listing Enhancements, Thumbnails & Manufacturer Headings

Recommended Posts

that change is for list mode u havent said what mode u are using!

 

for the new_products.php module you would:

 

after:

 

$display = $border;

 

add:

 

 $button = '<form name="cart_add" method="post" action="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=update_product&products_id=' . $products['products_id'] , 'NONSSL'). '"><input type="hidden" name="products_id" value="' . $products['products_id'] . '"><input type="text" name="cart_quantity" value="1" maxlength="5" size="5"><br>' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</form>';

 

Sweet - works like a beauty. Thanks -

Share this post


Link to post
Share on other sites

i installed this, it works fine

but the categories images are simply resized from their full size.

 

i installed automatic thumbnail creator (http://www.oscommerce.com/community/contributions,841) just before i installed your contribution.

and the automatic thumbnail creator made the categories image display fixed size thumbnails.

 

However, since i installed this product listing enhancements contribution, it seems to have overriden the other contributions "thumbnail" code.

 

How do i edit the code for the categories page so it will display the proper resized thumbnail?

 

which code do i edit?

Share this post


Link to post
Share on other sites

most likely a bug the in the thumbnail code u have used, it modifies tep_image, which is the function used by this.

 

I've noted many thumbnail contribs fail due buggy code if the image data provided is'nt 'just so'

 

Use osc thumb, that works


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites
most likely a bug the in the thumbnail code u have used, it modifies tep_image, which is the function used by this.

 

I've noted many thumbnail contribs fail due buggy code if the image data provided is'nt 'just so'

 

Use osc thumb, that works

 

Hi

thanks for the info

ive looked for osc thumb, but there is no contribution for that?

ive removed that autothumbnail script now, so now the shop has just got your script on it now, resizing all the images etc.

 

So can you advise me which is the best auto thumbnail script to use in conjunction with yours, so that I can upload images in admin,

and then your script will automatically display the smaller thumbnails. Or is it not possible?

 

if you can let me know which is the best one,that would be great!

 

Thanks!

Edited by vampirehunter

Share this post


Link to post
Share on other sites

osC Thumb does exist, or i would not have mentioned it!! http://addons.oscommerce.com/info/5491

 

There are quite a few contribs that are based on it as well


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

Someone PM asking how to display manufacturers description

 

1. Please read my note regarding PM :angry:

 

2. Assuming u have done the manufacturers description part of the install

in admin select manufacturers in display style and set display manufacturers description to true.


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

Hello people

 

First of all I want to thank Sam for this great contribution. I wanted to have this great thing here combined with "featured products", so I started to search the forum, and I found this Sam's answer to somebody

 

I have no plans to incorporate the featured products module into this contrib, but there is nothing stopping you from doing so if your able.

So, I thought "why not", and here are the results. I'm posting the 2 modified files, please do not just copy over, thats not a contribution, it's just the solution I found for my self, so merge carefully, I'm not able to give answers to any problems. I have AI commented out and I use also products short description

 

Would be also great if Sam could have a look to say what he think about my cooking here :) The only thing I did was to watch was he was doing with the files catalog/products_new.php and catalog/includes/modules/new_products.php and transfer it to the following 2 files:

 

1) File catalog/featured_products.php

<?php
/*
 $Id: featured_products.php,v 1.5.8 2003/06/09 22:35:33 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
 $HTTP_GET_VARS['manufacturers_id'] = '';
unset($HTTP_GET_VARS['manufacturers_id']);
unset($_GET['manufacturers_id']);

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FEATURED_PRODUCTS);
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_FEATURED_PRODUCTS));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
///// To random featured products
//  list($usec, $sec) = explode(' ', microtime());
//  srand( (float) $sec + ((float) $usec * 100000) );
//  $mtm= rand();
//////  
  $featured_products_array = array();
  // BOF product listing
$date = strftime("%Y-%m-%d",$date); 
	$define_list = array('PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
					 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
					 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
					 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);
asort($define_list);
$column_list = array();
reset($define_list);
while (list($key, $value) = each($define_list)) {
  if ($value > 0) $column_list[] = $key;
} 
	 $sort_sql='';
   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

	  $_GET['sort'] = 0 . 'd';
	  $sort_sql = " order by p.products_date_added DESC, pd.products_name";

} else {
  $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  $sort_order = substr($HTTP_GET_VARS['sort'], 1);

  switch ($column_list[$sort_col-1]) {
	 case 'PRODUCT_LIST_NAME':
	  $sort_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
	  break;
	case 'PRODUCT_LIST_MANUFACTURER':
	  $sort_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_PRICE':
	  $sort_sql .= " order by p.products_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
  }
}
// EOF product listing
  $featured_products_query_raw = "select p.products_id, pd.products_name, pd.short_desc, 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
  left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
  where p.products_status = '1' and f.status = '1' order by p.products_date_added DESC, pd.products_name";

// to random//  $featured_products_query_raw = "select p.products_id, pd.products_name, 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 left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm)";

if (strstr(PRODUCT_THUMBNAIL_VIEW, 'thumbnails')) {
		$listing_sql = $featured_products_query_raw;
 ?>
		<tr>
	<td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
  </tr>
<?php } else {
  $featured_products_split = new splitPageResults($featured_products_query_raw, MAX_DISPLAY_FEATURED_PRODUCTS);

 if (($featured_products_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $featured_products_split->display_count(TEXT_DISPLAY_NUMBER_OF_FEATURED_PRODUCTS); ?> </td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $featured_products_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>
  <tr>
	<td> <!-- Featured Products Main Page Box -->
	 <table bgcolor="ffffff" border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 if ($featured_products_split->number_of_rows > 0) {
$featured_products_query = tep_db_query($featured_products_split->sql_query);
$featured_products_query = tep_db_query($featured_products_query_raw);
while ($featured_products = tep_db_fetch_array($featured_products_query)) {
	if (tep_not_null($featured_products['specials_new_products_price'])) {
	$products_price = '<s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br>';
   	$products_price .= '<span class="productSpecialPrice">' . $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>';
  } else {
	$products_price = $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id']));
  }
?>
	  <tr>
		<td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
		<td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '"><b><u>' . $featured_products['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($featured_products['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $featured_products['manufacturers_name'] . '<br><br>' .	$featured_products['short_desc'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
		<td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
	  </tr>
	  <tr>
		<td colspüan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
<?php
}
 } else {
?>
	  <tr>
		<td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
<?php
 }
?>
	</table>
	</td>
  </tr>
<?php
 if (($featured_products_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <tr>
	<td>
	  <table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $featured_products_split->display_count(TEXT_DISPLAY_NUMBER_OF_FEATURED_PRODUCTS); ?></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $featured_products_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table>
   </td>
  </tr>
<?php
 }
  }
?>
</table></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

2) File catalog/includes/modules/featured.php

<?php
/*
 $Id: featured.php,v 1.7 2008/08/22 22:30:20 aa0001 Exp $

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

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License

 Featured Products V1.1
 Displays a list of featured products, selected from admin
 For use as an Infobox instead of the "New Products" Infobox  
*/
?>
<!-- featured_products //-->
<?php
// BOF product listing
$cat_path = false;

function thumbnail_new($products,$column_list,$border,$borderend) {
	global $PHP_SELF,$cPath,$cat_path;
$currencies = new currencies();
$man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : '');	
	$link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : ''))) . '"' . ($man_id  || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>';
	$image = $products['products_image']; 
	//$addimages = (file_exists(DIR_WS_CLASSES . 'displayimages.php')); // Additional Images Present // commentd out because not [picking the main image
	if ($addimages) { 	
	$image_query = tep_db_query( "SELECT ai.medium_images, ai.images_description, ai.popup_images, p.products_image_med, p.products_image_description  FROM " .  TABLE_ADDITIONAL_IMAGES . " ai, " . TABLE_PRODUCTS . " p WHERE ai.products_id=p.products_id and ai.products_id = '".(int)$products['products_id']."'");
$selected_image = tep_db_fetch_array($image_query);
	$image = ($selected_image['medium_images'] ? $selected_image['medium_images'] : ($selected_image['products_image_med'] ? $selected_image['products_image_med'] : ($selected_image['popup_images'] ? $selected_image['popup_images'] : $products['products_image']))); 
										} 
$image = (!$grid && $column_list[0] == 'PRODUCT_LIST_IMAGE' ? '<br>' : '') . $link . tep_image(DIR_WS_IMAGES . $image, ($addimages ? (tep_not_null($selected_image['images_description']) ? $selected_image['images_description'] : (tep_not_null($selected_image['products_image_description']) ? $selected_image['products_image_description'] : $products['products_name'])) : $products['products_name']), PRODUCT_IMAGE_WIDTH, '') . '</a>' . '<br>';
	$buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif');
	$button = (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW ? (LISTING_BUTTON == 'buy now & details' ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"') . '</a> <span class="buy_now">|</span> ' . $link . tep_image_button('button_details_small.gif', IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a><br><br>' : (strstr(LISTING_BUTTON, 'buy now') ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW) . '</a><br><br>' : '<br>' . $link . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a><br><br>' )) : ' '); 

	$name =	$link . '<b>' . $products['products_name'] . '</b>' . '</a><br>'. ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br>' . $products['short_desc'] . '<br>' : '');	 
	$price = (function_exists(display_short_price)) ? $currencies->display_short_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) : $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])); 	
if (tep_not_null($products['specials_new_products_price'])) {
		 $price = '<s>' .  $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products['specials_new_products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</span>';
		} 
	if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($products['products_id']) > 0 ? '+' : ''); 
	$show_price = '<br><font size="'.PRODUCT_PRICE_SIZE.'">' . ($products['products_price'] > 0 ? $price : 'P.O.A') . '<br></font>';
	$quantity = ($products['products_quantity'] ? 'Stock = '.$products['products_quantity'] : 'Out of Stock').'<br />';
	$weight = 'Weight = '.$products['products_weight'].'Kg<br />';
$model = $products['products_model'] . '<br>';
	$manfact = '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $products['manufacturers_id']) . '">' . $products['manufacturers_name'] . '</a><br>';
	$display = $border;
	for ($disp=0, $n=sizeof($column_list); $disp<$n; $disp++) {
	switch ($column_list[$disp]) {
	  case 'PRODUCT_LIST_IMAGE':
				  $display .= '<table summary="" width="100%" ><tr><td style="text-align:center;" valign="top" height="'.PRODUCT_IMAGE_VSPACE.'" >'.$image.'</td></tr></table>';
		break;
				case 'PRODUCT_LIST_NAME':
		$display .= '<table summary=""><tr><td class="thumbcontent" height="'.PRODUCT_NAME_VSPACE.'" >'.$name.'</td></tr></table>';
		break;
		  case 'PRODUCT_LIST_MODEL':
		$display .= $model;
		break;
				case 'PRODUCT_LIST_MANUFACTURER':
		$display .= $manfact;
		break;
				case 'PRODUCT_LIST_PRICE':   
		$display .= $show_price;
		break;		
				case 'PRODUCT_LIST_QUANTITY':
		$display .= $quantity;
		break;	
				case 'PRODUCT_LIST_WEIGHT':
		$display .= $weight;
		break;	
				}
	}
	$display .= $borderend . $button;  
return($display);
}	// function end

$date = strtotime("-60 days"); // set max age of displayed product
$date = strftime("%Y-%m-%d",$date); 
$grid = strstr(PRODUCT_THUMBNAIL_VIEW, 'grid');
$style = (!$grid ? 'class="smallText"' : 'class="infoBoxGrid"');
$border = (!$grid ? '<table class="infoBoxProducts" cellpadding="4" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'"><tr><td>' : '<br>');
$borderend = (!$grid ? '</td></tr></table>' : '');
$column_list = array('PRODUCT_LIST_IMAGE', 'PRODUCT_LIST_NAME' , 'PRODUCT_LIST_PRICE' );
// EOF product listing

if( defined('FEATURED_PRODUCTS_DISPLAY') AND FEATURED_PRODUCTS_DISPLAY == 'true' ) {
 $featured_products_category_id = $new_products_category_id;
 $cat_name_query = tep_db_query('SELECT `categories_name` FROM ' . TABLE_CATEGORIES_DESCRIPTION . " WHERE `categories_id` = '" . $featured_products_category_id . "' limit 1");
 $cat_name_fetch = tep_db_fetch_array($cat_name_query);
 $cat_name = $cat_name_fetch['categories_name'];
 $info_box_contents = array();

 list($usec, $sec) = explode(' ', microtime());
 srand( (float) $sec + ((float) $usec * 100000) );
 $mtm= rand();

 if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
  $info_box_contents[] = array('align' => 'left', 'text' => '<a class="headerNavigation" href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . TABLE_HEADING_FEATURED_PRODUCTS . '</a>');

// Phocea Optimize featured query
// Ben: Option to only show featured products on sale
$query = 'SELECT p.products_id, p.products_image, p.products_tax_class_id, IF (s.status, s.specials_new_products_price, NULL) AS specials_new_products_price, p.products_price, pd.products_name, pd.short_desc ';

if ( defined('FEATURED_PRODUCTS_SPECIALS_ONLY') AND FEATURED_PRODUCTS_SPECIALS_ONLY == 'true' ) {
  $query .= 'FROM ' . TABLE_SPECIALS . ' s LEFT JOIN ' . TABLE_PRODUCTS . ' p ON s.products_id = p.products_id ';
} else {
  $query .= 'FROM ' . TABLE_PRODUCTS . ' p LEFT JOIN ' . TABLE_SPECIALS . ' s ON p.products_id = s.products_id ';
}

$query .= 'LEFT JOIN ' . TABLE_PRODUCTS_DESCRIPTION . " pd ON p.products_id = pd.products_id AND pd.language_id = '" . $languages_id . "'
LEFT JOIN " . TABLE_FEATURED . " f ON p.products_id = f.products_id
WHERE p.products_status = '1' AND f.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS;

$featured_products_query = tep_db_query( $query );	
 } else {
$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));
$subcategories_array = array();
tep_get_subcategories($subcategories_array, $featured_products_category_id);
$featured_products_category_id_list = tep_array_values_to_string($subcategories_array);
if ($featured_products_category_id_list == '') {
  $featured_products_category_id_list .= $featured_products_category_id;
} else {
  $featured_products_category_id_list .= ',' . $featured_products_category_id;
}

if ( defined('FEATURED_PRODUCTS_SUB_CATEGORIES') AND FEATURED_PRODUCTS_SUB_CATEGORIES == 'true' ) {
  // current catID as starting value
  $cats[] = $new_products_category_id; 
  // put cat-IDs of all cats nested in current branch into $cats array, 
  // go through all subbranches
  for($i=0; $i<count($cats); $i++) {
	$categorie_query = tep_db_query('SELECT `categories_id` FROM ' . TABLE_CATEGORIES . " WHERE parent_id = '" . (int)$cats[$i] . "'"); 
	while ($categorie = tep_db_fetch_array($categorie_query)) {
	  $cats[] = $categorie['categories_id'];
	}
	// sort out doubles
	$cats = array_unique($cats);
  }
  $catIdSql = implode(', ', $cats);
} else {
  $catIdSql = $featured_products_category_id_list;
}

// Phocea Optimize featured query
$query = 'SELECT distinct p.products_id, p.products_image, p.products_tax_class_id, IF (s.status, s.specials_new_products_price, NULL) AS specials_new_products_price, p.products_price, pd.products_name
FROM ' . TABLE_PRODUCTS . ' p LEFT JOIN ' . TABLE_PRODUCTS_TO_CATEGORIES . ' p2c using(products_id)
LEFT JOIN ' . TABLE_CATEGORIES . ' c USING (categories_id)
LEFT JOIN ' . TABLE_FEATURED . ' f ON p.products_id = f.products_id
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 AND pd.language_id = '" . $languages_id . "' 
where c.categories_id IN(" . $catIdSql . ") AND p.products_status = '1' AND f.status = '1' ";

if ( defined('FEATURED_PRODUCTS_SPECIALS_ONLY') AND FEATURED_PRODUCTS_SPECIALS_ONLY == 'true' ) {
	$query .= " AND s.status = '1' ";
}
$query .= 'ORDER BY rand(' . $mtm . ') DESC LIMIT ' . MAX_DISPLAY_FEATURED_PRODUCTS;

$featured_products_query = tep_db_query( $query );
}

 $row = 0;
 $col = 0; 
 $num = 0;
 while ($featured_products = tep_db_fetch_array($featured_products_query)) {
$num ++;
if ($num == 1) {
  new contentBoxHeading($info_box_contents); 
}
// If on special show regular and sale price
  if (tep_not_null($featured_products['specials_new_products_price'])) {
  $products_price = '<s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br>';
 	$products_price .= '<span class="productSpecialPrice">' . $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>';
} else {
  $products_price = $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id']));
}
$info_box_contents[$row][$col] = array('align' => 'center',
									  'params' => $style . ' width="'.(PRODUCTS_PER_ROW ? (100/PRODUCTS_PER_ROW) : '').'%" valign="top"',										
									  'text' => (strstr(PRODUCT_THUMBNAIL_VIEW, 'list') ? '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) : thumbnail_new($featured_products, $column_list,$border,$borderend)));
$col ++;
if ($col > PRODUCTS_PER_ROW-1) {
  $col = 0;
  $row ++;
}
 }
 if($num) {

  new contentBox($info_box_contents);
 }
} else {
  // If it's disabled, then include the original New Products box
  include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); // disable for dont show if desactive the feature module
}
?>
<!-- featured_products_eof //-->

 

It works for me, so I hope it works for you too :)

Share this post


Link to post
Share on other sites

I have edited Open includes/languages/english/index.php to remove define('TEXT_POA', ' P.O.A'); (I have no idea what P.O.A is

 

 

I have reloaded the page serveral times and has not cleared out. I also check from another computer that I have not used befoe. Where else is this data contained? Does that not defy the purpose of having a set variable if it is set in more than one place? Thank you

 

KM

Share this post


Link to post
Share on other sites

its yor store cache, reset that!!

 

P.O.A = Price On Application, common english term, displayed when price is zero


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

Admin >Cache Control - File Does Not Exist

Admin>Config>Cache - Use Cache - False

 

Still shows...

 

I noticed that you have define('TEXT_POA', in two places. Should a define only be defined once for quality control reasons?

 

Thanks

 

KM

 

its yor store cache, reset that!!

 

P.O.A = Price On Application, common english term, displayed when price is zero

Share this post


Link to post
Share on other sites

the product listing module can be called by more than one page, therefore the defines are required more than once


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

Sorry I am just treating it like the main config file for example... one location for database information.

 

So if all my cache options are off in the store, why is it still showing? Normally if I change the price is shows up right away thanks

 

KM

 

 

 

the product listing module can be called by more than one page, therefore the defines are required more than once

Share this post


Link to post
Share on other sites

smthg perculiar with your store, this contrib does nothing with cache, do u have a template?


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

if your changing the data in the dbase & you dont see it in listing, its iether the cache is on, or error causing no change, or corrupt dbase.

 

if your changing a define & not seeing result, your iether not uploading changed file or uploading in wrong place (admin?)

 

I would point out the listing does not gather the data, thats done by the calling page.

 

 

NB just reread your first, you said you removed define('TEXT_POA', ' P.O.A');

 

if you mean you deleted that line, you have undefined text, so the display would always be TEXT_POA. Obviously if you wish to remove text in a define, you remove just the text!!

 

Docs http://www.oscommerce.info/kb/osCommerce

Edited by spooks

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

The database is new. I do see the price changes but I do not see P.O.A change.

 

I meant to say that I changed define('TEXT_POA', ' P.O.A'); to define('TEXT_POA', ' ');

 

I edited

 

includes/languages/english/index.php

define('TEXT_POA', ' ');

 

and

 

includes/languages/english/advanced_search.php

define('TEXT_POA', '');

 

Through SSH. The changes were saved and rechecked.

 

if your changing the data in the dbase & you dont see it in listing, its iether the cache is on, or error causing no change, or corrupt dbase.

 

if your changing a define & not seeing result, your iether not uploading changed file or uploading in wrong place (admin?)

 

I would point out the listing does not gather the data, thats done by the calling page.

 

 

NB just reread your first, you said you removed define('TEXT_POA', ' P.O.A');

 

if you mean you deleted that line, you have undefined text, so the display would always be TEXT_POA. Obviously if you wish to remove text in a define, you remove just the text!!

 

Docs http://www.oscommerce.info/kb/osCommerce

Share this post


Link to post
Share on other sites

Hi

 

Thank you Sam for this contrib. It's work perfectly. :rolleyes:

 

After this installation, I installed the "Flash Carousel" add on. And now I have a multiple error in the new_products module in the function "thumbnail_new". :( Maybe I made a mistake during the installation. HELP ME PLEASE !!!

 

I received these errors for each product in the new_products section:

 

Notice: Undefined index: manufacturers_id in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 20

 

Notice: Undefined variable: grid in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 29

 

Notice: Undefined index: short_desc in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 33

 

Notice: Use of undefined constant display_short_price - assumed 'display_short_price' in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 34

 

Notice: Undefined index: specials_new_products_price in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 35

 

Notice: Use of undefined constant tep_get_att_price - assumed 'tep_get_att_price' in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 38

 

Notice: Undefined index: products_quantity in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 40

 

Notice: Undefined index: products_weight in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 41

 

Notice: Undefined index: products_model in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 42

 

Notice: Undefined index: manufacturers_id in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 43

 

Notice: Undefined index: manufacturers_name in C:\Program Files\xampp\htdocs\catalog\includes\modules\new_products.php on line 43

 

 

Can you please help me to understand what is my probleme ?

 

Thank You

 

Marco

Share this post


Link to post
Share on other sites

Not sure if this contrib is what I need. I want to have a drop down box for size, one for color, and another one for quantity. Will this do that? If not, could you direct me to the contrib that will?

 

Thanks

 

Joe

 

 

Product Listing Enhancements, Thumbnails & Manufacturer Headings

 

This contribution is a much changed version of Product Thumbnail Listing that I started only a short while ago, but as thumbnails is now only one part I felt it should be a new contribution.

 

I was requested to make a contribution to Group Product Listing By Manufacturer with a manufacturer short description. This does exactly that based around the original product listing, so the old admin controls apply along with some new ones.

 

The thumbnails part displays products with thumbnail images in a grid layout, you define how many boxes per line plus image & box sizes. It shows the product image in a box with product name, price, short description (if you have that) & buy now or details button. This also supports Additional Images (http://addons.oscommerce.com/info/1032) If you have this it will select the medium size image if it exists.

 

The customer can switch between thumbnails & manufacturer if you set default to either. If you change default you must select a new category to reset your display.

 

Extra setting are added to admin, additionally existing settings controling the display of Product Name & Price Are Honored.

The database query used is unchanged from the original, so order you set in admin etc will apply as before.

 

The style of the display is controlled by a new entry in your css, you can set there if you wish a background image, colours, borders etc.

 

Page views are included in the package so you can see the result.

 

Written on osC2.2 rc1 with PHP5 and has been tested on PHP 4 & 5, SQL 4 & 5, osC 2.2 ms2, rc1 & rc2a and is register_globals compatible.

 

Contribution can be found at: http://addons.oscommerce.com/info/6051

Share this post


Link to post
Share on other sites

clearly if u have errors after installing smthg else the look there, not here!!!


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

your css file has errors, so firefox is ignoring much of it!!

 

TD.subBar {

font-family: Verdana, Arial, sans-serif;

font-size: 10px;

color: #000000;

 

Your site also has html errors, suggest you get it validated & fix


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×