Hi !!
I need to create a custom subpanel for module ‘Contacts’ and I tried many ways without success… somebody knows how can I develop a subpanel step by step?
I tried this :
in custom/Extension/modules/Contacts/Ext/Layoutdefs/MmsLayoutdefs.php
$layout_defs["Contacts"]["subpanel_setup"]['opportunities'] = array(
'order' => 100,
'module' => 'Opportunities',
'subpanel_name' => 'default',
'get_subpanel_data' => 'function:get_closed_lost_closed_won_opportunities',
'generate_select' => true,
'add_subpanel_data' => 'id',
'title_key' => 'LBL_OPPORTUNITIES_WITH_CLOSED_LOST',
'top_buttons' => array(),
'function_parameters' => array(
'import_function_file' => 'custom/modules/Contacts/customOpportunitiesSubpanel.php',
'sales_stage' => 'Closed Lost',
'account_id' => $this->_focus->id,
'return_as_array' => 'true'
),
);
and /custom/modules/Contacts/customOpportunitiesSubpanel.php
function get_closed_lost_closed_won_opportunities($params) {
$args = func_get_args();
$opportunitiesSalesStage = $args[0]['sales_stage'];
$accountId = $args[0]['account_id'];
$return_array['select'] = " SELECT opportunities.*";
$return_array['from'] = " FROM opportunities ";
$return_array['where'] = " WHERE opportunities.deleted = '0' AND opportunities.sales_stage = '" . $opportunitiesSalesStage . "'";
$return_array['join'] = " INNER JOIN accounts_opportunities ON accounts_opportunities.opportunity_id = opportunities.id AND accounts_opportunities.deleted = '0' INNER JOIN accounts ON accounts.id = accounts_opportunities.account_id AND accounts.deleted = '0' AND accounts.id = '" . $accountId . "'";
$return_array['join_tables'] = '';
return $return_array;
}
…
but not works please help!!