Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can you see any problems with this code


Guest

Recommended Posts

Posted

Hi, I've recently changed from a windows server to a linux one and I’m now experiencing some problems with the code below on the new server. The code is from product_info and it fetches all the categories the product is listed in and then displays them under the product's description (to see it in action click here) .

 

The problem I am having is some of the cpaths in the link's URLs are wrong. Some have an extra category added on the end. All of the links should contain a maximum of three subcategories in the URLs like this:

index.php?cPath=11_111_1111

but some look like this

Index.php&cpath=11_111_1111_1111 extra category added to the end "1111"

 

I’m guessing the linux server doesn’t like something in the code below because it worked perfectly on the windows server that I was hosted on before and I haven’t changed anything. All Suggestions welcome. Thanks, David.

 

 

<tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
				<tr>
					<td class="main"><b>For use with the following:</b></td>
				</tr>
	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
<?php
$categories_query = tep_db_query("SELECT p2c.*, pd.categories_name  FROM products_to_categories p2c , categories_description pd WHERE p2c.categories_id = pd.categories_id and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

$number_of_categories = tep_db_num_rows($categories_query);

$rows = 0;
while ($categories = tep_db_fetch_array($categories_query)) {
  $rows++;
  $cPath_new = tep_get_path($categories['categories_id']);
  $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
  echo '				<td align="left" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a></td>' . "\n";
  if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
	echo '			  </tr>' . "\n";
	echo '			  <tr>' . "\n";
  }
}
?>
		  </tr>
		</table></td>
	  </tr>
	 </table></td>
   </tr>

Archived

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

×
×
  • Create New...