Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Thumbnail Listing


spooks

Recommended Posts

  • 1 month later...
  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Sam,

Awesome contrib, I think it does exactly what I am looking for (small image of the product, in a grid with some descriptors underneath). I installed everything, and ran the setup , but when I go to my page it appears the same as it did before. I tried refreshing, clearing the cache - even tried another browser - all to no avail. Anything else I can try? Thanks again,

Link to comment
Share on other sites

Hi - just installed and am getting lots of errors. This one here I can't figure out what's wrong:

 

"Parse error: syntax error, unexpected $end in /home/bellafav/public_html/store/includes/modules/product_listing.php on line 229"

 

Here's my code, can someone help please:

 

<?php
/*
 $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

if (PRODUCT_THUMBNAIL_VIEW == 'false') { 
 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php


 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   switch ($column_list[$col]) {
     case 'PRODUCT_LIST_MODEL':
       $lc_text = TABLE_HEADING_MODEL;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_NAME':
       $lc_text = TABLE_HEADING_PRODUCTS;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_MANUFACTURER':
       $lc_text = TABLE_HEADING_MANUFACTURER;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_PRICE':
       $lc_text = TABLE_HEADING_PRICE;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_QUANTITY':
       $lc_text = TABLE_HEADING_QUANTITY;
       $lc_align = 'right';
       break;
	//Minimum quantity code
     case 'PRODUCT_LIST_MINORDER':
       $lc_text = TABLE_HEADING_MINORDER;
       $lc_align = 'right';
       break;
//End Minimum quantity code
     case 'PRODUCT_LIST_WEIGHT':
       $lc_text = TABLE_HEADING_WEIGHT;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_IMAGE':
       $lc_text = TABLE_HEADING_IMAGE;
       $lc_align = 'center';
       break;
     case 'PRODUCT_LIST_BUY_NOW':
       $lc_text = TABLE_HEADING_DETAIL;
       $lc_align = 'center';
       break;
   }

   if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
     $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
   }

   $list_box_contents[0][] = array('align' => $lc_align,
                                   'params' => 'class="productListing-heading"',
                                   'text' => ' ' . $lc_text . ' ');
 }

 if ($listing_split->number_of_rows > 0) {
   $rows = 0;
   $listing_query = tep_db_query($listing_split->sql_query);
   while ($listing = tep_db_fetch_array($listing_query)) {
     $rows++;

     if (($rows/2) == floor($rows/2)) {
       $list_box_contents[] = array('params' => 'class="productListing-even"');
     } else {
       $list_box_contents[] = array('params' => 'class="productListing-odd"');
     }

     $cur_row = sizeof($list_box_contents) - 1;

     for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
       $lc_align = '';

       switch ($column_list[$col]) {
         case 'PRODUCT_LIST_MODEL':
           $lc_align = '';
           $lc_text = ' ' . $listing['products_model'] . ' ';
           break;
         case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . 
$HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '"><b>' . $listing['products_name'] . '</a></b><br><span class="short">' . 
$listing['short_desc'] . '</span></b>';
               } else {
              $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . 
$listing['products_id']) . '"><b>' . $listing['products_name'] . '</a></b>' . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br><span class="short">' . $listing['short_desc'] . '</span>' : '');} 
           break;
         case 'PRODUCT_LIST_MANUFACTURER':
           $lc_align = '';
           $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
           break;
         case 'PRODUCT_LIST_PRICE':
           $lc_align = 'right';
		$price = (function_exists(display_short_price)) ? $currencies->display_short_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])); 
           if (tep_not_null($listing['specials_new_products_price'])) {
             $lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
           } else {
$lc_text = ($listing['products_price'] > 0 ? ' ' . $price . ' ' : ' ' . TEXT_POA); 
if (function_exists(tep_get_att_price)) $lc_text .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ; 
           }
           break;
         case 'PRODUCT_LIST_QUANTITY':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_quantity'] . ' ';
           break;
		//Minimum quantity code
         case 'PRODUCT_LIST_MINORDER':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['minorder'] . ' ';
           break;
//End Minimum quantity code
         case 'PRODUCT_LIST_WEIGHT':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_weight'] . ' ';
           break;
         case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
           }
           break;
         case 'PRODUCT_LIST_BUY_NOW':
   $lc_align = 'center';
$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a> ';





   break;
}

       $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                              'params' => 'class="productListing-data"',
                                              'text'  => $lc_text);
     }
   }

   new productListingBox($list_box_contents);
 } else {
   $list_box_contents = array();

   $list_box_contents[0] = array('params' => 'class="productListing-odd"');
   $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                  'text' => TEXT_NO_PRODUCTS);

   new productListingBox($list_box_contents);
 }

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php

} else {  //thumbnail

 $row = 0;
 $col = 0;

$border = '<table class="infoBoxProducts" cellpadding="4" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'"><tr><td>';
$borderend = '</td></tr></table>';
$info_box_contents = array();
$listing_query = tep_db_query($listing_sql);
while ($products = tep_db_fetch_array($listing_query)) {
  	if ($row == 0) { 
	$info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' =>  ' '); $row ++;
	               }
	$image = $products['products_image']; 
	if (file_exists(DIR_WS_CLASSES . 'displayimages.php')) { 	// Additional Images Present
	$image_query = tep_db_query( "SELECT medium_images FROM " . TABLE_ADDITIONAL_IMAGES . " WHERE products_id = '".(int)$products['products_id']."'");
   $selected_image = tep_db_fetch_array($image_query);$image = $selected_image['medium_images']; }

	$button = (LISTING_BUTTON != 'none' ? (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('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ' : (LISTING_BUTTON == 'small 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('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a> ' )) : '');

	$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'])); 					  
	$show_price = '<font size="'.PRODUCT_PRICE_SIZE.'">' . ($products['products_price'] > 0 ? $price : 'P.O.A') . '</font>';
   if (!PRODUCT_LIST_PRICE) $show_price = '';

   $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => $border . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $image, $products['products_name'], PRODUCT_IMAGE_WIDTH, '') . '</a>' . '<br><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">'. (PRODUCT_LIST_NAME ? '<b>' . $products['products_name'] . '</b>' : '' ) . '</a><br><br>' . ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? $products['short_desc'] . '<br><br>' : '') . $show_price . $borderend . $button);



   $col ++;
   if ($col > PRODUCTS_PER_ROW-1) {
     $col = 0;
     $row ++;
   }
}  
	$col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' =>  ' ');
  new contentBox($info_box_contents);

}	
?>

Link to comment
Share on other sites

This contrib has much changed so has become Product Listing Enhancements, Thumbnails & Manufacturer Headings

with many new features:

 

Group Product Listing By Manufacturer with a manufacturer short description. 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. Thumbnail also now has a pure 'grid' mode.

 

You can select block mode display in list/manufacturer listings similar to the 'new products' display.

You can also apply the thumbnail display to the new_products module & products_new page. NOTE: These files have an exrta date function, original will just list product to set limit, this adds a max age for product (default is 60days) to change edit the commented line.

 

As some of the listing styles remove the heading (you can select to remove in other modes too) where a user would select sort mode (if they realised, its not obvious) I`ve add a drop down to select sort order, that appears at the base of the product display, it will list according to what you have set in admin. Also added a drop down for user to select number of products shown per page.

 

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

 

If your store does'nt have manufacturers or your listing via search, the manufacturer mode will revert to list mode automatically.

 

There is now a pull down for sort order and a pull down for max results per page.

 

This updated version is available at: http://addons.oscommerce.com/info/6051

Forum thread at : http://www.oscommerce.com/forums/index.php?showtopic=307010

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...