News:

Looking for documentation? Take a look on our wiki

Main Menu

How to display all product's parents on Product Page?

Started by powercoders, November 14, 2020, 02:25:50 AM

Previous topic - Next topic

powercoders

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!


pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

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

Rsn

Quote from: powercoders on November 14, 2020, 02:25:50 AM
Need to show all product's parents by text like "Parent1/Parent2/Parent3" on the product page

Hi, maybe something like this?  ;)


$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>';