webmaster69 Posted October 16, 2007 Share Posted October 16, 2007 I have seached the forums for the past 2 days trying to cure this. It's turned from a 5 minute mod to 2 days and counting mod. All I want to do is display the category that the product is in in the product info page. For some reason the sub category that the product is in, is NOT displayed but the parent category is. Here is the code I have used: 2. Open for editing catalog/product_info.php 3. Find this line: $product_check = tep_db_fetch_array($product_check_query); Add this text below: // MOD - Category Name in Product_info $categories_name_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $category = tep_db_fetch_array($categories_name_query); // END 4. Find these lines: if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; } Replace with these lines: // MOD - Category Name in Product_info if (tep_not_null($product_info['products_model'])) { $products_name = '<span class="categoryHeading">' . $category['categories_name'] . '</span><br>' . $product_info['products_name'] . '<br><span class="smallText">' . $product_info['products_model'] . ' </span>'; } else { $products_name = '<span class="categoryHeading">' . $category['categories_name'] . '</span><br>' . $product_info['products_name']; } // END Link to comment Share on other sites More sharing options...
allaboutwicker Posted October 16, 2007 Share Posted October 16, 2007 Hi, I believe this little contrib is what you are looking for as it was only a text page to download I will just paste it here for you! Best Wishes! Page Heading Title Better ------------------------- ***************************** This is a modification of Tommy Le's work so that manufacturer's names will show instead of "Let's See What We Have Here" when listing products by manufacturer. I also removed the unnecessary c.categories_image select from the SQL query. ***************************** Get rid of "Let's See What We Have Here" for SubCategories and "Categories" for Top-Categories. Replace them with the name of categories or Subcategories name. In the /catalog/index.php, there are three <?php echo HEADING_TITLE; ?> FOR CATEGORIES, just replace the first one <?php echo HEADING_TITLE; ?> TO <?php echo $category['categories_name'] ?> FOR SUBCATEGORIES, just replace the second <?php echo HEADING_TITLE; ?> TO <?php if (isset($HTTP_GET_VARS['manufacturers_id'])) { $category_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); $category = tep_db_fetch_array($category_query); if ($category['manufacturers_name'] != "") {echo $category['manufacturers_name'];} else { echo HEADING_TITLE;} } else { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); $category = tep_db_fetch_array($category_query); if ($category['categories_name'] != "") {echo $category['categories_name'];} else { echo HEADING_TITLE;} } ?> The third <?php echo HEADING_TITLE; ?> Nothing needed to modify. Link to comment Share on other sites More sharing options...
webmaster69 Posted October 16, 2007 Author Share Posted October 16, 2007 Thanks for getting back to me with this. This is not what I wanted, I was wanting to display that category at the top of the product_info page. Thanks for taking the time to reply, much apreciated. Hi, I believe this little contrib is what you are looking for as it was only a text page to download I will just paste it here for you!Best Wishes! Page Heading Title Better ------------------------- ***************************** This is a modification of Tommy Le's work so that manufacturer's names will show instead of "Let's See What We Have Here" when listing products by manufacturer. I also removed the unnecessary c.categories_image select from the SQL query. ***************************** Get rid of "Let's See What We Have Here" for SubCategories and "Categories" for Top-Categories. Replace them with the name of categories or Subcategories name. In the /catalog/index.php, there are three <?php echo HEADING_TITLE; ?> FOR CATEGORIES, just replace the first one <?php echo HEADING_TITLE; ?> TO <?php echo $category['categories_name'] ?> FOR SUBCATEGORIES, just replace the second <?php echo HEADING_TITLE; ?> TO <?php if (isset($HTTP_GET_VARS['manufacturers_id'])) { $category_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); $category = tep_db_fetch_array($category_query); if ($category['manufacturers_name'] != "") {echo $category['manufacturers_name'];} else { echo HEADING_TITLE;} } else { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); $category = tep_db_fetch_array($category_query); if ($category['categories_name'] != "") {echo $category['categories_name'];} else { echo HEADING_TITLE;} } ?> The third <?php echo HEADING_TITLE; ?> Nothing needed to modify. Link to comment Share on other sites More sharing options...
Guest Posted October 16, 2007 Share Posted October 16, 2007 If you want add some to center betwine bar with "new products for" and header the in /modules/new_product.php you can do the changes Link to comment Share on other sites More sharing options...
webmaster69 Posted October 16, 2007 Author Share Posted October 16, 2007 Hi, Sorry, I don't understand what you mean? If you want add some to center betwine bar with "new products for" and header the in /modules/new_product.php you can do the changes Link to comment Share on other sites More sharing options...
webmaster69 Posted October 18, 2007 Author Share Posted October 18, 2007 Thanks, for having a go for me, I guess it's not possible to display a sub category? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.