VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: cat1910 on May 30, 2017, 09:36:03 AM

Title: Parent Category as Title in the categories view
Post by: cat1910 on May 30, 2017, 09:36:03 AM
Is it possible to show the parent category as the title (h1) of the page in the pages that display the different categories of a parent category ?
I can't find it.
Joomla 3.7.2 / Virtuemart 3.2.2

Thanks!
Catherine
Title: Re: Parent Category as Title in the categories view
Post by: jenkinhill on May 30, 2017, 12:55:20 PM
See http://demo.virtuemart.net/wear  - the parent category title is shown under the search/sort block using this code:
<h1><?php echo vmText::_($this->category->category_name); ?></h1>

If you want to move the locateion then edit and override components/com_virtuemart/views/category/tmpl/default.php - or if already using overrides then edit the relevant override file.
Title: Re: Parent Category as Title in the categories view
Post by: cat1910 on May 30, 2017, 14:31:52 PM
Yes, I found it, thanks a lot !
Title: Re: Parent Category as Title in the categories view
Post by: marvays on October 14, 2022, 07:32:09 AM
Quote from: jenkinhill on May 30, 2017, 12:55:20 PM
See http://demo.virtuemart.net/wear  - the parent category title is shown under the search/sort block using this code:
<h1><?php echo vmText::_($this->category->category_name); ?></h1>

If you want to move the locateion then edit and override components/com_virtuemart/views/category/tmpl/default.php - or if already using overrides then edit the relevant override file.

Holla. This solution dont work on J4 and VM4. Can you help me?
I oweride /templates/my_template/html/com_virtuemart/sublayouts/categories.php
<div class="category-view">
<?php if (!empty($this->category->category_name)) { ?>
<h1><?php echo vmText::_($this->category->category_name); ?></h1>
<?php ?>
......


error: Using $this when not in object context

Title: Re: Parent Category as Title in the categories view
Post by: GJC Web Design on October 14, 2022, 11:13:21 AM
 ::)

$category->category_name
Title: Re: Parent Category as Title in the categories view
Post by: jenkinhill on October 14, 2022, 13:14:40 PM
Quote from: marvays on October 14, 2022, 07:32:09 AM

Holla. This solution dont work on J4 and VM4. Can you help me?


I'm not surprised. That "fix" was posted for versions over 5 years ago!