VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: AbsoluteVM on June 13, 2012, 11:35:58 AM

Title: $field->display for related products is rubbish
Post by: AbsoluteVM on June 13, 2012, 11:35:58 AM
I'm probably not the first one to find the related products template a little narrow minded.

I want to be able to have a custom HTML structure for my related products, yet all the template contains is field->display which outputs HTML from the core.

Has anyone got an answer for me, as this seems unfinished and completely different to how the rest of VM is done?

Is there a way I can override field->display's output, as it looks like I am going to have to make a custom php function to select related products?
Title: Re: $field->display for related products is rubbish
Post by: exolut on June 29, 2012, 18:39:29 PM
I also need to know! pleaseee help!!!
Title: Re: $field->display for related products is rubbish
Post by: fire2 on November 30, 2012, 10:52:44 AM
Did you ever figure this out? I need this too!
Title: Re: $field->display for related products is rubbish
Post by: AbsoluteVM on February 05, 2013, 11:58:16 AM
Hello,

I actually didn't bother and just worked around this. You can't really access any of the objects without some high PHP knowledge, they aren't immediately available to you.

At this present time, I guess the related products scope is fairly limited.
Title: Re: $field->display for related products is rubbish
Post by: okmit on March 28, 2013, 12:52:38 PM
It's not that easy as it should be, but you can menage it by editing component/com_virtuemart/models/customfield/customfields.php


line 986 -    public function displayProductCustomfieldFE (&$product, $customfield, $row = '')

there is a switch section there you can edit case 'R': to achive your goal

I wanted to have only image in related products so i have changed
return JHTML::link (JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $value . '&virtuemart_category_id=' . $related->virtuemart_category_id), $thumb   . $related->product_name, array('title' => $related->product_name));
break;


to

return JHTML::link (JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $value . '&virtuemart_category_id=' . $related->virtuemart_category_id), $thumb , array('title' => $related->product_name));
break;