function _parseSubProductTypes($types) { $def = array('operators' => array('=', '+', '*', '-', '%', '-%'), 'min' => 0, 'max' => 1, 'minQtyEach' => 1, 'maxQtyEach' => 1); foreach ($types as $key => $type) { $type = array_merge($def, (array) $type); if (empty($type['label'])) { $type['label'] = __(Inflector::humanize($key), true); } else { $type['label'] = __($type['label'], true); } if (empty($type['name'])) { $type['name'] = $key; } $type['operators'] = (array) $type['operators']; if (!empty($type['children'])) { $type['children'] = ShopConfig::_parseSubProductTypes($type['children']); } $types[$key] = $type; } return $types; }