News:

Looking for documentation? Take a look on our wiki

Main Menu

Back to parent category

Started by roman5527, April 14, 2021, 21:45:08 PM

Previous topic - Next topic

roman5527

Hi, can I add link on category page - back to parent category page ?

example from level 3 child category to level 2 category and .....

thanks .

pinochico

What is about the question?

Quotecan I

Answer: Of course, you can.

But I think you want code for this, isn't?
Then the right question is:

"Can anyone write me the exact code I have to put on the web and where, if I want to add a link to the parent category to the category view?"

BTW - this link exists in the BreadCrumbs module, therefore this module is added to the view category of the eshop.
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

roman5527

Yes, you're right . My question was asked wrongly.
So I ask again.
Can anyone help me with the code to display the link back to the parent category in the category view? well thank you

ksfbjoern

Hello together,

i got basicly the same question as roman5527. Has anybody a code to implement to get a separate button "Back to parent category" in a subcategory or is a button like that eventually already integrated in virtuemart, like the back to category button in the product details? That this link is existing in the breadcrumb is quit not bad, but for a non coder it is hard to extract to work only with virtuemart categorys (for example this button should not be shown in a parent category/when there is no category above).

I would be very happy about any help or tips

best regards

Jumbo!

You can use the following codes in category page layout override, i.e. templates/YOUR-TEMPLATE/html/com_virtuemart/category/default.php

<?php
if (!empty($this->category))
{
$categoryModel  VmModel::getModel('Category');
$parentCategory $categoryModel->getParentCategory($this->category->virtuemart_category_id);

if (!empty($parentCategory) && !empty($parentCategory->virtuemart_category_id))
{
echo 'Go back to : <a href="' JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' $parentCategory->virtuemart_category_id) . '">' $parentCategory->category_name '</a>';
}
}
?>

ksfbjoern

Just perfect Jumbo!

Thank you very much, that is exactly what i was looking for.

Best regard

Jumbo!