News:

Support the VirtueMart project and become a member

Main Menu

how to detect if "custom field" used

Started by guardiano78, June 27, 2017, 13:00:04 PM

Previous topic - Next topic

guardiano78

Hello,
i need to detect if customfield in present in product detail page.

I set custom field "Plugin" like "textinput".
in productdetails\default.php i need to know if that customfield is present.

How can i do this?
Thanks!!

joomla 3.7.2 and virtuemart 3.2.2

guardiano78

when i print $this->product->customfields, i see that:
1. if product has custom field the variable is empty
2. if product has not custom field the variable contains Array()

well, i tried with this:

if (!isset($this->product->customfields))
{
    //do something...
}
else
{
   //do something else ....
}


In you opinion this code may work fine?

Thanks

PRO



I use this, IT CHECKS BY POSITION

if (!empty($this->product->customfieldsSorted['MY-POSITION'])) {
// Do something here
}