Hello,
I'm trying to add a custom field value (text input from the customer in the product) to the header of the invoice. But this is the code for the product attributes:
<?php
if (!empty($item->product_attribute)) {
if(!class_exists('VirtueMartModelCustomfields'))require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'customfields.php');
$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
}
?>
But is it possible to somehow extract one kind of custom field? Now it's all the custom fields with a white space between them.
If you only have somple values, you can check in the $item directly and get the value
For eg.
if (!empty($item->product_attribute)) {
$atributes = json_decode ($item->product_attribute, TRUE);
}
$atributes is then all the customfields set as an array
You can use PHP var_dump or print_r ... to see what you have inside
Quote from: Studio 42 on January 31, 2020, 13:43:42 PM
If you only have somple values, you can check in the $item directly and get the value
For eg.
if (!empty($item->product_attribute)) {
$atributes = json_decode ($item->product_attribute, TRUE);
}
$atributes is then all the customfields set as an array
You can use PHP var_dump or print_r ... to see what you have inside
Ok thank you, I'll check if that works for me.