Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product in more than one category


garyw365

Recommended Posts

Posted

Hi

 

Can anyone shed some light on this please.

 

I have a bit of PHP code that shows the category the product is in when you are on the product_info.php page. The problem is if the product has been copied into a few categories it doesnt display anything.

 

I have tried to add LIMIT 1 at the end of the sql but that hasnt helped

 

     <?php

 if ($cPath) {
   if (!ereg('_', $cPath)) {
     $cPath_array = array($cPath);
   }
   $cPath_new = '';
   for($i=0; $i<sizeof($cPath_array); $i++) {
     if ($cPath_new == '') {
       $cPath_new .= $cPath_array[$i];
     } else {
       $cPath_new .= '_' . $cPath_array[$i];
     }
     $categories_query = tep_db_query("select categories_id, categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $cPath_array[$i] . "'");
     $categories = tep_db_fetch_array($categories_query);

     echo ' » <font color="black" size="1"><a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath_new, 'NONSSL') . '">' . $categories['categories_name'] . '</font></a>';
   }
 } 

echo $location; 

 

Thanks in advance for any assistance

Archived

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

×
×
  • Create New...