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 .
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.
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
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
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>';
}
}
?>
Just perfect Jumbo!
Thank you very much, that is exactly what i was looking for.
Best regard
You are welcome.