Jump to content
Sign in to follow this  
mugitty

Catalog Listing Contrib 2795

Recommended Posts

I have amended the Catalog Listing contribution

 

http://www.oscommerce.com/community/contributions,2795

 

to show model number and special pricing, along with the product name and regular price. It returns just fine in my browser with one small problem... ONLY the items that have a special price are included.

 

Can anyone describe to me how I would amend the query so that it returns all items, wheter or not they have a special price?

 

The current query is:

	<?php
$qry = "select distinct c.categories_name, pd.products_name, pd.products_description, p.products_model, p.products_price, s.specials_new_products_price, p.products_image, m.manufacturers_name" . 
						" from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_CATEGORIES_DESCRIPTION . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m" . 
						" where p.products_id = pd.products_id and p.manufacturers_id = m.manufacturers_id and p.products_id = pc.products_id and p.products_id = s.products_id and pc.categories_id = c.categories_id AND c.language_id = '" . (int)$languages_id . "' and pd.language_id = '" . (int)$languages_id . "'" . 
						" order by trim(c.categories_name), m.manufacturers_name, trim(p.products_model) asc";
$records = tep_db_query($qry);
$num_records = tep_db_num_rows($records);

	  ?>


... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Share this post


Link to post
Share on other sites

...perhaps I'm looking at the wrong part of the file to accomplish what I'm after.

 

Is there a way to get all products included in the output - whether or not they have a "Special" price by amending some of the code in the html output section?

 

The current output area looks like this:

		<?
	$i = 0;														
	$table = mysql_fetch_array($records);
	while ($table) {
		$category1 = $table['categories_name'];
		$manufacturer1 = $table['manufacturers_name'];
	?>
		<h2 class="report" align="left"> <? echo $category1 . ": " . $manufacturer1; ?> </h2>
		<table class="report">
			<tr>
				<th width=150 align="center" class="report">Model</th>
				<th width=500 align="left" class="report">Product</th>
				<th width=80 align="center" class="report">Price</th>
				<th width=80 align="center" class="report">Special</th>
			</tr>
	<?
		do {
			$category = $table['categories_name'];
			$manufacturer = $table['manufacturers_name'];
			$model = $table['products_model'];
			$product = $table['products_name'];
			$price = $table['products_price'];
			$special = $table['specials_new_products_price'];
			$description = $table['products_description'];
			if ($category != $category1 || $manufacturer != $manufacturer1) {
				?> </table> <?
				break;
			}

			if (!($i%2)) {$color = "BGCOLOR = #FFFF99";}
			else { $color = "BGCOLOR = #FFFFFF";}											
			?> 	<tr>
					<td class="report">
						<? echo $model;?>
					<td class="report">
						<? echo $product;?>
					</td>
					<td class="price">
						<? echo number_format ($price,2,'.',',');?>
					</td>
					<td class="price">
						<? echo number_format ($special,2,'.',',');?>
					</td>
				</tr>
			<?	
			$i++;
		}	while ($table = mysql_fetch_array($records));
	}
?>

Thanks for any pointers!

Edited by mugitty

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

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  

×