Author Topic: Parent Category as Title in the categories view  (Read 2615 times)

cat1910

  • Beginner
  • *
  • Posts: 8
Parent Category as Title in the categories view
« 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

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28471
  • Always on vacation
    • Jenkin Hill Internet
Re: Parent Category as Title in the categories view
« Reply #1 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.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 4.0.12 10777  J 3.10.11 PHP 7.4.30

cat1910

  • Beginner
  • *
  • Posts: 8
Re: Parent Category as Title in the categories view
« Reply #2 on: May 30, 2017, 14:31:52 pm »
Yes, I found it, thanks a lot !

marvays

  • Jr. Member
  • **
  • Posts: 451
    • richta.cz
  • Skype Name: marvays
Re: Parent Category as Title in the categories view
« Reply #3 on: October 14, 2022, 07:32:09 am »
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
Code: [Select]
<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


GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10701
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: Parent Category as Title in the categories view
« Reply #4 on: October 14, 2022, 11:13:21 am »
 ::)

$category->category_name
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28471
  • Always on vacation
    • Jenkin Hill Internet
Re: Parent Category as Title in the categories view
« Reply #5 on: October 14, 2022, 13:14:40 pm »

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!
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 4.0.12 10777  J 3.10.11 PHP 7.4.30