I tried to print custom attributes in the listview for offers, but I didn't get this working.
What I've done?
First I added following line in "default.php":
require_once JPATH_COMPONENT_SITE.'/classes/attributes/attributeservice.php';
Now I added following line in "list_view.php":
$attribute = AttributeService::getAttributeValues('transportcost');
To print the additional attribute I've added an "echo $attribute;" on the place where it should be shown, but it wont work... someone here who can help me to get this working?
One further question... Support? Anyone of them here?
Now awnser here, no awnser on direct email?
Hi,
Sorry for delay. Your question required development support and we do not usually provide it.
The function AttributeService::getAttributeValues() is used to parse the values of an attribute object and does not take a string as parameter.
In order to get the value of one attribute you have to parse the $company->customAttributes array and extract the attribute that you need. After that you can call AttributeService::getAttributeValues() function to show only the values from the specific attribute.
Hi George,
could you give me (us) an example how to do this?
Seems to be interesting for other users, too.
Maybe you could add this as a feature into the component directly to make it more perfect ;)
Hi,
We will provide you the functionality in 1-2 days.
Hi,
You can retrieve the business listing attributes by $company->customAttributes and call the function of the AttributeService class
/**
* Parse attributes and get the values for selected attribute
* @param Object $attributes
* @param string $name
*/
static function getAttributeAsString($attributes, $name){
foreach($attributes as $attribute) {
if($attribute->name == name){
return self::getAttributeValues($attribute);
}
}
return "";
}