Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display Products in boxes 2 or 3 in a row


Guest

Recommended Posts

Posted

Jason

 

Simple 1-2-3 Intructions on how to get, install and configure SSL

 

The Google Sandbox explained

 

Simple to follow instructions on how to change the look of your OSC

 

How To Make A Horrible OSC Website

 

my toolbox: All things WordPress-related - All things Adobe-related - PHP Designer 2007 - Codecanyon Junkie - Crimson Editor - Winmerge - phpMyAdmin - WS_FTP

 

my installed contributions: Category Banners, File Upload feature-.77, Header Tags, Sort_Product_Attributes_1, XSellv2.3, Price Break 1.11.2, wishlist 3.5, rollover_category_images_v1.2, Short_Description_v2.1, UPSXML_v1_2_3, quickbooks qbi_v2_10, allprods v4.4, Mouseover-effect for image-buttons 1.0, Ultimate_SEO, AAP 1.41, Auto Select State Value, Fast Easy Checkout, Dynamic SiteMap v2.0, Image Magic, Links Manager 1.14, Featured Products, Customer Testimonials, Article Manager, FAQ System, and I'm sure more ...

Posted

Tnx for that,

 

I've checked out the Featured Products contrib and it does what I want but looks like it only does it for selected products.

 

Is it possible to set things up so as when u broswe by category you would see all products in the Featured Product display rather than the standard category display.

 

The same site still displays categories in the old fashioned way:

http://www.westwoodprinters.com/catalog/he...-c-1_54_55.html

 

What I really want is to be able to browse by category and have all category products displayed in the Featured product style?

 

Is this possible by default or would it take some tweaking?

 

Thanks Again,

Ally

Posted
I will try and dig out the coding used.

 

 

That looks like just the ticket Stu, be well chuffed if you could post it.

 

Thanks,

Ally

Posted

My code is heavily modified as we have free products listed and do not want the price of ?0.00 displayed, so we display "FREE" instead, but from the coding below, you should get an idea.

 

Catalog/includes/modules.new_products.

 

<?php
/*
 $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 //-->
<?php
 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' 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_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);
 }

 $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']);

		$listprice = $new_products['products_price'];
		if ($listprice == 0) { $listprice1 = 'Free';
		} else {
		$listprice1 = $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']));
		} 

$linkfree = $new_products['products_price'];
		if ($linkfree == 0) { 
		$linkfree1 = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><img alt="Add to Cart" src="images/x.gif" width="54" height="20"></a>';
		} else {
		$linkfree1 = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'], 'NONSSL') . '"><img alt="Add to Cart" src="images/x.gif" width="54" height="20"></a>';
		} 


$info_box_contents[$row][$col] = array('align'  => 'center',
									   'params' => 'class="smallText" width="33%" valign="top"',
									   'text'   => '<table border="0" cellspacing="0" cellpadding="0" width="169">
<tr><td width="169" align="center" height="30" background="images/prod-top.jpg" class="products-price">' . $listprice1 . '</td></tr><tr><td width="169" background="images/prod-body.jpg" align="center" height="158" valign="top"><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><b>' . $new_products['products_name'] . '</b><br><br>' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td></tr><tr><td width="169" height="34" background="images/prod-bot.gif" valign="top" align="center"><table border="0" width="84" cellspacing="0" cellpadding="0" height="20"><tr><td width="30"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><img alt="More Info" src="images/x.gif" width="30" height="20"></a></td><td width="54">' . $linkfree1 . '</td></tr></table></td></tr></table>');

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

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

Archived

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

×
×
  • Create New...