Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with subcategories


Guest

Recommended Posts

Hi:

i bought theme with 2.2 and have problem with subcategories. First subcategorie show link to index.php and rest are bad.

 

show: www.deliverydeperfumes.com

 

any can help me?

 

thanks

Link to comment
Share on other sites

The category links in the left box work; it's just the center links that are broken. In a regular osCommerce, these would be displayed by code that looked like

	$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="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $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";
  }
}

If you can find the equivalent code in your template, post it.

Always back up before making changes.

Link to comment
Share on other sites

The category links in the left box work; it's just the center links that are broken. In a regular osCommerce, these would be displayed by code that looked like
	$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="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $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";
  }
}

If you can find the equivalent code in your template, post it.

 

 

thanks max, im testing now.

Link to comment
Share on other sites

now i show categories but subcategories images links have problem, all bad links.

 

i think error is here...

 

	$number_of_categories = tep_db_num_rows($categories_query);
$rows = 0;
while ($categories = tep_db_fetch_array($categories_query)) {

$p_pic_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>';

$p_name_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a>';



  $rows++;
  $cPath_new = tep_get_path($categories['categories_id']);
  $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
  echo '			   

	<td  align="center" width="' . $width . '">
			<table cellpadding="0" cellspacing="0" border="0">
				 <tr>
					<td style="height:16px " align="center" class="vam"><span>'.$p_name_sub.'</span></td>
				</tr>
				<tr>
					<td style="height:95px " align="center" class="pic" >'.tep_draw_prod_pic_top().''.$p_pic_sub.''.tep_draw_prod_pic_bottom().'</td>
				</tr>
			</table> 
	</td>
  ' . "\n";
			  if ($col!=(MAX_DISPLAY_CATEGORIES_PER_ROW-1)){
			  echo '
					<td class="bg_line_y">'.tep_draw_separator('spacer.gif', '1', '1').'</td>					
					';
			  }
			 else{	


  if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
	echo '			  
</tr><tr><td class="bg_line_x" colspan="'.(MAX_DISPLAY_CATEGORIES_PER_ROW + MAX_DISPLAY_CATEGORIES_PER_ROW -1).'">'.tep_draw_separator('spacer.gif', '1', '10').'</td></tr>' . "\n";
	echo '			  <tr>' . "\n";
  }
}
if ($col==MAX_DISPLAY_CATEGORIES_PER_ROW-1){
$col=0;
}else{
$col++;
}
}

Link to comment
Share on other sites

In the code I posted previously, there is a line,

	  $cPath_new = tep_get_path($categories['categories_id']);

However, in the code that you post, the first thing that I see about $cPath_new is

$p_pic_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>';

$p_name_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a>';

Is $cPath_new set somewhere above that? Or is it just missing? If it's missing, add the line that I posted in the first code box just above the code that you posted, so it looks like

	  $cPath_new = tep_get_path($categories['categories_id']);
$p_pic_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>';

$p_name_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a>';

and see if that fixes the problem.

 

If you see more references to $cPath_new higher in the file, please post them.

Always back up before making changes.

Link to comment
Share on other sites

  • 3 weeks later...

Archived

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

×
×
  • Create New...