function uc_class_get_attributes in Ubercart 8.4
Same name and namespace in other branches
- 5 uc_attribute/uc_attribute.module \uc_class_get_attributes()
- 6.2 uc_attribute/uc_attribute.module \uc_class_get_attributes()
- 7.3 uc_attribute/uc_attribute.module \uc_class_get_attributes()
Loads all attributes associated with a product class.
Parameters
int $pcid: The product class id.
Return value
array The attributes.
3 calls to uc_class_get_attributes()
- ProductClassAttributesAddForm::buildForm in uc_attribute/
src/ Form/ ProductClassAttributesAddForm.php - Form constructor.
- ProductClassAttributesForm::buildForm in uc_attribute/
src/ Form/ ProductClassAttributesForm.php - Form constructor.
- ProductClassOptionsForm::buildForm in uc_attribute/
src/ Form/ ProductClassOptionsForm.php - Form constructor.
File
- uc_attribute/
uc_attribute.module, line 1067 - Ubercart Attribute module.
Code
function uc_class_get_attributes($pcid) {
$attributes = [];
$connection = \Drupal::database();
$result = $connection
->query("SELECT uca.aid FROM {uc_class_attributes} uca LEFT JOIN {uc_attributes} ua ON uca.aid = ua.aid WHERE uca.pcid = :type ORDER BY uca.ordering, ua.name", [
':type' => $pcid,
]);
foreach ($result as $attribute) {
$attributes[$attribute->aid] = uc_attribute_load($attribute->aid, $pcid, 'class');
}
return $attributes;
}