commerce_pricing_attributes.module in Commerce Pricing Attributes 7.2
File
commerce_pricing_attributes.module
View source
<?php
function commerce_pricing_attributes_entity_info() {
$info['commerce_pricing_attibutes'] = array(
'label' => t('Commerce Pricing Attributes'),
'entity class' => 'EntityAPIController',
'controller class' => 'EntityAPIController',
'base table' => 'commerce_pricing_attributes',
'fieldable' => TRUE,
'entity keys' => array(
'id' => 'attribute_id',
'label' => 'name',
'bundle' => 'type',
),
'access callback' => 'commerce_pricing_attributes_access',
'module' => 'commerce_pricing_attributes',
'bundle keys' => array(
'bundle' => 'type',
),
'bundles' => array(),
);
return $info;
}
function commerce_pricing_attributes_access($op, $entity, $customer, $entity_type) {
return TRUE;
}
function commerce_pricing_attributes_enabled_product_types() {
$types = array();
foreach (commerce_product_types() as $product_type) {
$type = $product_type['type'];
if (variable_get('commerce_pricing_atrributes_' . $type . '_enabled', 0)) {
$types[$type] = $product_type;
}
}
return $types;
}