Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Category Description to only one Category


tjmedia

Recommended Posts

Hello,

 

I was wondering if anyone would be able to help me. I have an online store and my client wants to have a description of only one category and all other categories blank. Is there a way of writing that? I know I have to specify in the code somewhere with an "if" statement that includes the specific cPath and category id or something like that. Any help would be much appreciated. Thank you in advance.

 

Thomas

Link to comment
Share on other sites

if ($current_category_id == X) echo "description";

 

Add that to index.php in the bit where index shows the subcategories.

Obviously change X to the ID of the category needed.

 

Thanks for the response. I'm sorry, but which area of the code do I put that piece of code in? I'm relatively new with php. If I wanted the description to be above the "New products for month", which line of code would I put it in. Thanks again :)

Link to comment
Share on other sites

Thanks for the response. I'm sorry, but which area of the code do I put that piece of code in? I'm relatively new with php. If I wanted the description to be above the "New products for month", which line of code would I put it in. Thanks again :)

It all depends on the category.

 

If it is a main category (top level) find in catalog/index.php around line 66

			<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

Just below that add

<?php
 if ($current_category_id == '1') {
?>
  <tr>
	<td><?php echo 'Your description here'; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>

Change 1 to the category id you need.

 

If it is a subcateogry (nested) find around line 278

			<td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

Add the same as above changing the category id to what you need.

Link to comment
Share on other sites

It all depends on the category.

 

If it is a main category (top level) find in catalog/index.php around line 66

			<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

Just below that add

<?php
 if ($current_category_id == '1') {
?>
  <tr>
	<td><?php echo 'Your description here'; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>

Change 1 to the category id you need.

 

If it is a subcateogry (nested) find around line 278

			<td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

Add the same as above changing the category id to what you need.

 

Thank you very much for your help!!! That did the trick. Much appreciated! :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...