VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: sandomatyas on March 12, 2025, 15:30:33 PM

Title: Extra Related Products
Post by: sandomatyas on March 12, 2025, 15:30:33 PM
Hi,

I installed a fresh VirtueMart 4.4.6 and found a custom field type called "Extra Related Products." I have added it, but I can't see how it should work.

My goal is to add grouped related products—for example, when selling smartphones, I would like to add "related cases," "related chargers," "related screen protectors," etc.

Is this field intended for this purpose? If not, what is it used for? Also, what would you suggest for adding grouped related products?

Thanks in advance!
Title: Re: Extra Related Products
Post by: hazael on March 12, 2025, 22:02:32 PM
You have so many forum posts written and you don't know that?  ???

When you publish this custom field, then in the settings of the selected product in the last tab where the custom fields are - above you will find the related products. Enter the SKU code or product name in this field and when it appears, add it.

In order for these related products to be displayed on the front page in the product of your choice, you need to add PHP code in the user interface template

If in productdetails
<?php echo shopFunctionsF::renderVmSubLayout('customfields_related',array('product'=>$this->product,'position'=>'related_products','class'=> 'product-related-products','customTitle' => true ));?>
If you don't want unnecessary html code, then try to display it like this
<?php foreach ($this->product->customfieldsSorted['related_products'] as $rp); echo $rp->display?>

PS.
In my opinion, this custom field has a flaw - I think it is a bug. Because if I add other related products to the selected product, and in the future they are physically removed from the list of products, then errors start to appear on the site - this should not be the case and this problem has never been fixed.
Title: Re: Extra Related Products
Post by: sandomatyas on March 14, 2025, 14:06:17 PM
Hi,

Hmm, if I understand correctly, you wrote about "related products," but I was asking about "extra related products."

(https://i.postimg.cc/ZRk7Qfpf/k-p.png)

When I assign it, I don't see any changes while typing.


(https://i.postimg.cc/TYFTwx6h/k-p.png)

The goal is to have multiple, separate "related products" groups.

I also tried adding a second "Related Products" field, but it doesn't appear in the "custom fields" tab when editing a product.

Title: Re: Extra Related Products
Post by: hazael on March 15, 2025, 15:45:13 PM
Hello, Ok now I understand. From my observations it seems that this addon you are asking about works, but is not supported by the vmadmin template. You would have to look for a bug in the template. All you have to do now is uncheck the [ ] New Admin Template in the settings

extra.png