Author Topic: How to display all product's parents on Product Page?  (Read 481 times)

powercoders

  • Beginner
  • *
  • Posts: 2
  • A beginner
  • Skype Name: damarkuzz
How to display all product's parents on Product Page?
« on: November 14, 2020, 02:25:50 am »
Hi there!
Need to show all product's parents by text like "Parent1/Parent2/Parent3" on the product page. It's like breadcrubms but little different and use for another goals.
But don't know how to do it. Help, please!

powercoders

  • Beginner
  • *
  • Posts: 2
  • A beginner
  • Skype Name: damarkuzz
Re: How to display all product's parents on Product Page?
« Reply #1 on: November 15, 2020, 03:22:05 am »
Help please!

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 813
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27954
  • Always on vacation
    • Jenkin Hill Internet
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 3.8.7 10374 on Joomla 3.9.23 PHP 7.4.12

Rsn

  • Jr. Member
  • **
  • Posts: 55
  • Advanced user
    • Blog InformResource
Re: How to display all product's parents on Product Page?
« Reply #4 on: November 16, 2020, 06:06:36 am »
Need to show all product's parents by text like "Parent1/Parent2/Parent3" on the product page

Hi, maybe something like this?  ;)

Code: [Select]
$cat_model = VmModel::getModel('category');
$parent_cat = $cat_model->getCategory($this->product->virtuemart_category_id);
$parent_cats = $parent_cat->parents;
// echo '<pre>'; print_r($parent_cats); echo '</pre>';