Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

All products page


Kjolebutikken

Recommended Posts

Hi,

 

could not find a support thread for this contribution, but have a question.

 

On my all products page I have listed products name, manufacturer and price. I would like to also list the products category, and have tried to implement it in the code, but it will not show, so I hope some of you can see what is wrong in my all_products.php file.

 

Here it is:

 

 

<?php
/*
 $Id: all_products.php,v 3.0 2004/02/21 by Ingo ([email protected])

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

 Copyright (c) 2004 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ALL_PRODUCTS);

 $breadcrumb->add(HEADING_TITLE, tep_href_link(FILENAME_ALL_PRODUCTS, '', 'NONSSL'));

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// BOF: WebMakers.com Changed: Header Tag Controller v1.0
// Replaced by header_tags.php
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
<title><?php echo HEADING_TITLE; ?> :: <?php echo TITLE; ?></title>

<?php
}
// EOF: WebMakers.com Changed: Header Tag Controller v1.0
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<style type="text/css" media="screen">
<!--
.catentry {font-family: Verdana, Arial, sans-serif; font-size: 10px; font-weight: bold; color: #EEEEF0; }
h2 {font-family: Verdana, Arial, sans-serif; font-size: 20px; font-weight: bold; }
h1, h2{margin-bottom:0px; margin-top:0px; line-height: 1em;}
-->
</style>
</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>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	  <tr>
<td class="main"><?php echo TEXT_INFORMATION; ?><?php echo '<a href="http://www.kjolebutikken.com/oscdemo1/slideshow.php">HER.</a><br>'; ?></td>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table width="100%" cellspacing="0" cellpadding=0" border="0">
<tr class="infoBoxHeading"> 
	<td align="left" class="infoBoxHeading">Varenavn</td> 
	<td align="center" class="infoBoxHeading">Designer/merke</td> 
   <td align="right" class="infoBoxHeading">Pris  </td> 
   </tr> 
<?php

$language_code = (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) ? $HTTP_GET_VARS['language'] : DEFAULT_LANGUAGE;


$products_query = tep_db_query("select p.products_id, p.products_model ,pd.products_name, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name,
pc.categories_id from " . TABLE_PRODUCTS . " p , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc 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 = '" . (int)$languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = pc.products_id and c.categories_id = pc.categories_id and products_status = '1' order by pd.products_name");

$products_array = array(); 
		while($products = tep_db_fetch_array($products_query)) 
		{ 
		   $products_array[] = array('id'=> $products['products_id'], 
							  'name'	=> $products['products_name'],
							 'category'	=> $products['categories_name'],	
							  'manufacturer'  => $products['manufacturers_name'], 
						 'price'   => $products['products_price']); 
						}

$included_categories_query = tep_db_query("SELECT c.categories_id, cd.categories_name, c.parent_id, cd.categories_name FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id AND cd.language_id = FLOOR($languages_id)");

$inc_cat = array();
while ($included_categories = tep_db_fetch_array($included_categories_query)) {
 $inc_cat[] = array (
 'id' => $included_categories['categories_id'],
 'parent' => $included_categories['parent_id'],
	 'name' => $categories['categories_name']);

 }

$cat_info = array();
for ($i=0; $i<sizeof($inc_cat); $i++)
 $cat_info[$inc_cat[$i]['id']] = array (
'parent'=> $inc_cat[$i]['parent'],
'name'  => $inc_cat[$i]['name'],
'path'  => $inc_cat[$i]['id'],
'link'  => '' );

for ($i=0; $i<sizeof($inc_cat); $i++) {
 $cat_id = $inc_cat[$i]['id'];
 while ($cat_info[$cat_id]['parent'] != 0){
$cat_info[$inc_cat[$i]['id']]['path'] = $cat_info[$cat_id]['parent'] . '_' . $cat_info[$inc_cat[$i]['id']]['path'];
$cat_id = $cat_info[$cat_id]['parent'];
}
 $link_array = split('_', $cat_info[$inc_cat[$i]['id']] ['path']);
 for ($j=0; $j<sizeof($link_array); $j++) {
$cat_info[$inc_cat[$i]['id']]['link'] .= ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cat_info[$link_array[$j]]['path']) . '"><nobr>' . $cat_info[$link_array[$j]]['name'] . '</nobr></a> - ';
}
 }


		$num_prods = sizeof($products_array);  // This optimizes that slow FOR loop... 

		for ($i = 0; $i < $num_prods; $i++)	// Traverse Rows 
		{ 
		   // Rotate Row Colors 
		   if ($i % 2)  // Odd Row 
		   { 
			  $row_col = 'class="productListing-odd"'; 
		   } 
		   else   // Guess... 
		   { 
			  $row_col = 'class="productListing-even"'; 
		   } 


		   $this_id = $products_array[$i]['id']; 
		   $this_name = $products_array[$i]['name']; 
		   $this_category = $products_array[$i]['category']; 
		   $this_manufacturer = $products_array[$i]['manufacturer']; 
		   $this_price = $products_array[$i]['price']; 
		   $this_url = tep_href_link(FILENAME_PRODUCT_INFO,  'kjolebutikken=' . str_replace(" ", "_", $this_name). '&products_id=' . $this_id . (($this_language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $this_language_code)), 'NONSSL', false); 

		   echo "<tr $row_col>"; 
		   echo "<td class='productListing-data' align='left'><a href='$this_url'>$this_name</a></td>"; 
		   echo "<td class='productListing-data' align='center'><a href='$this_url'>$this_manufacturer</a></td>"; 
		   if (tep_not_null($this_special)) 
		   { 
			  echo "<td class='productListing-data' align='right'><a href='$this_url'><span class='productSpecialPrice'>".$currencies->display_price($this_special, tep_get_tax_rate($this_tax))."</span></a></td>"; 
		   } 
		   else 
		   { 
			  echo "<td class='productListing-data' align='right'><a href='$this_url'>".$currencies->display_price($this_price, tep_get_tax_rate($this_tax))."</a></td>"; 
		   } 
		   echo "</tr>\n"; 

echo
"		  <tr>\n" .
'		   <td width="33%" class="pageheading"><span class="catentry">' . (($memory == $products['categories_id'])? '': $cat_info[$products['categories_id']]['link']) . "</span></td>\n" .
'		   <td class="pageheading"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id'] . (($language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $language_code))) . '"><span class="catentry">' . $products['products_name'] . "</span></a></td>\n" .
"		  </tr>\n";
 $memory = $products['categories_id'];
 }		 
?> 
	 </table></td>
  </tr>
  <tr>
	<td align="right" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
  </tr>
</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 //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
<!-- You are not the only one, John! -->

 

And here is the link to the all products page in my shop:

 

http://www.kjolebutikken.com/oscdemo1/all_products.php

 

 

Hope somebody out there can help me:-)

Thanks

Kjolebutikken

Best regards

Kjolebutikken

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
Have a look at lines 38-40 in that file. There are some font-size bits there, see if changing them works. (I haven't tried it though).

 

hth

 

Tamsyn

 

 

Hi Tamsyn,

 

Thanks for answering me, but unfortunately it did not work. Any other suggestions???

 

Thanks,

Kjolebutikken

Best regards

Kjolebutikken

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...