Forums / General Questions / How to display the last category name

How to display the last category name

Started by kevin205 on 29 Oct 2013, 8:16 PM · Views: 862

Results 1 to 7 of 7
29 Oct 2013, 8:16 PM
#1
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

How to display the last category name

How do you display / extract the last (final) subcategory name in the following tree (path) by itself?

index.php?main_page=index&cPath=9_18_20

Using Zen Cart 1.5.1

29 Oct 2013, 9:11 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: How to display the last category name

A little more information about what you want to do and why. Do you want the last subcategory category name to appear in the URL?

29 Oct 2013, 9:24 PM
#3
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: How to display the last category name

If my breadcrumbs reads Home > Men's Shirts > T-shirts > V-Neck

I need to display V-Neck dynamically in my subcategory description, on the product listing page.

I hope i am making sense . Thank you of the reply.

Using Zen Cart 1.5.1

29 Oct 2013, 10:40 PM
#4
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: How to display the last category name

If I understand, it should do that already if you have the settings right and your template allows it. Please provide a link to the site.

30 Oct 2013, 12:16 AM
#5
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: How to display the last category name

Site is not live yet.

This would be in addition to the existing subcategory name encapsulated in <h1>. I need to duplicated the name of subcategory encapsulated in <he> in other ares of the page.

How can the name of subcategory being displayed on the product listing page, be replicated on that same page?

Using Zen Cart 1.5.1

30 Oct 2013, 1:15 AM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: How to display the last category name

<?php echo $breadcrumb->last(); ?>
``` This is what puts the content into the <h1>, and it will do the same elsewhere on the page.

You will need to edit /includes/templates/your_template/templates/tpl_index_product_list.php (copy from /template_default/ if you don't already have a custom copy).
30 Oct 2013, 3:11 AM
#7
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: How to display the last category name

gjh42:

<?php echo $breadcrumb->last(); ?>
> 
> You will need to edit /includes/templates/your_template/templates/tpl_index_product_list.php (copy from /template_default/ if you don't already have a custom copy).
That did it.
Thanks for the hint I was placing the 
```php
<?php echo $breadcrumb->last(); ?>

in the tpl_index_categories.php instead of **tpl_index_product_list.php.
**
Thank you.

Using Zen Cart 1.5.1