How to work with item types after 17 Dec 2018 commit
Posted: 07 Jul 2019, 20:00
Hi there,
I have a project with an older version of Aimeos in which I was using getTypeId() and getTypeName() item methods.
I was trying to use the same methods on a new project with an updated version of Aimeos but I noticed that these methods has been removed in this commit
What is the proper way to get the same results with the current version?
Here is an example of a piece of code where I'm using these methods:
Thanks.
I have a project with an older version of Aimeos in which I was using getTypeId() and getTypeName() item methods.
I was trying to use the same methods on a new project with an updated version of Aimeos but I noticed that these methods has been removed in this commit
What is the proper way to get the same results with the current version?
Here is an example of a piece of code where I'm using these methods:
Code: Select all
$options = [];
$variantAttributes = $variantProduct->getRefItems('attribute', null, 'variant');
foreach ($variantAttributes as $variantAttribute) {
if (empty($options[$variantAttribute->getTypeId()])) {
$options[$variantAttribute->getTypeId()] = [
'attribute_id' => $variantAttribute->getTypeId(),
'attribute_code' => $variantAttribute->getType(),
'values' => [],
'label' => $variantAttribute->getTypeName(),
'code' => $variantAttribute->getType(),
'position' => 0
];
}
$options[$variantAttribute->getTypeId()]['values'][] = [
'value_index' => $variantAttribute->getId(),
'label' => $variantAttribute->getLabel()
];
}