Author Topic: Product relate categories, remove target="blank"  (Read 330 times)


  • Jr. Member
  • **
  • Posts: 185
Product relate categories, remove target="blank"
« on: August 23, 2018, 11:34:39 am »

In product page, the related categories open in a new browser tab because of target="_blank".
I would like to change that. Also, I don't want the category images which are loaded in the HTML.

I am pasting the relevant relatedcategories template code I am looking to tweak.

Code: [Select]

 <div class="product-related-categories">
 <?php foreach ($this->product->customfieldsSorted['related_categories'] as $field) { 
        if (
$field->display) { ?>

<div class="product-field product-field-type-<?php echo $field->field_type ?>">
    <span class="product-field-display"><?php echo $field->display ?></span>


The resulting HTML is like so:

Code: [Select]

<div class="product-field product-field-type-Z">
    <span class="product-field-display"><a href="/category" title="category" target="_blank"><img src="/images/stories/virtuemart/category/resized/mycategory.jpg" alt="My Category"  /> Category Name</a></span>




  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27345
  • Always on vacation
    • Jenkin Hill Internet
Re: Product relate categories, remove target="blank"
« Reply #1 on: August 23, 2018, 13:39:33 pm »
Look in components/com_virtuemart/sublayouts/related.php

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 VM on Joomla 3.9.5 PHP 7.0.33
Testing VM on Joomla 3.9.5