function category()
{
    $category = get_option('mercadopago_category');
    $category = $category === false || is_null($category) ? "others" : $category;
    //category marketplace
    $mp = new MPApi();
    $list_category = $mp->getCategories();
    $select_category = '<select name="mercadopago_category" id="category">';
    foreach ($list_category as $category_arr) {
        $selected = "";
        if ($category_arr['id'] == $category) {
            $selected = 'selected="selected"';
        }
        $select_category .= '<option value="' . $category_arr['id'] . '" id="type-checkout-' . $category_arr['description'] . '" ' . $selected . ' >' . $category_arr['description'] . '</option>';
    }
    $select_category .= "</select>";
    return $select_category;
}
    public function displayFormSettingsmercadopago()
    {
        //set MP Apis for request in api mercado pago
        $mp = new MPApi();
        $conf = Configuration::getMultiple(array('mercadopago_CLIENT_ID', 'mercadopago_CLIENT_SECRET', 'mercadopago_CATEGORY', 'mercadopago_TYPECHECKOUT', 'mercadopago_SANDBOX', 'mercadopago_COUNTRY', 'mercadopago_METHODS', 'mercadopago_INSTALLMENTS', 'mercadopago_URLPROCESS', 'mercadopago_URLSUCCESFULL', 'mercadopago_BTN', 'mercadopago_BANNER'));
        $client_id = array_key_exists('mercadopago_CLIENT_ID', $_POST) ? $_POST['mercadopago_CLIENT_ID'] : (array_key_exists('mercadopago_CLIENT_ID', $conf) ? $conf['mercadopago_CLIENT_ID'] : '');
        $client_secret = array_key_exists('mercadopago_CLIENT_SECRET', $_POST) ? $_POST['mercadopago_CLIENT_SECRET'] : (array_key_exists('mercadopago_CLIENT_SECRET', $conf) ? $conf['mercadopago_CLIENT_SECRET'] : '');
        $category = array_key_exists('mercadopago_CATEGORY', $_POST) ? $_POST['mercadopago_CATEGORY'] : (array_key_exists('mercadopago_CATEGORY', $conf) ? $conf['mercadopago_CATEGORY'] : '');
        $type_checkout = array_key_exists('mercadopago_TYPECHECKOUT', $_POST) ? $_POST['mercadopago_TYPECHECKOUT'] : (array_key_exists('mercadopago_TYPECHECKOUT', $conf) ? $conf['mercadopago_TYPECHECKOUT'] : '');
        $sandbox = array_key_exists('mercadopago_SANDBOX', $_POST) ? $_POST['mercadopago_SANDBOX'] : (array_key_exists('mercadopago_SANDBOX', $conf) ? $conf['mercadopago_SANDBOX'] : '');
        $mercado_pago_country = array_key_exists('mercadopago_COUNTRY', $_POST) ? $_POST['mercadopago_COUNTRY'] : (array_key_exists('mercadopago_COUNTRY', $conf) ? $conf['mercadopago_COUNTRY'] : '');
        $mercadopago_method = array_key_exists('mercadopago_METHODS', $_POST) ? $_POST['mercadopago_METHODS'] : (array_key_exists('mercadopago_METHODS', $conf) ? preg_split("/[\\s,]+/", $conf['mercadopago_METHODS']) : '');
        $installments = array_key_exists('mercadopago_INSTALLMENTS', $_POST) ? $_POST['mercadopago_INSTALLMENTS'] : (array_key_exists('mercadopago_INSTALLMENTS', $conf) ? $conf['mercadopago_INSTALLMENTS'] : '');
        $url_retorno = array_key_exists('pg_url_retorno', $_POST) ? $_POST['pg_url_retorno'] : (array_key_exists('mercadopago_URLPROCESS', $conf) ? $conf['mercadopago_URLPROCESS'] : '');
        $url_succesfull = array_key_exists('pg_url_succesfull', $_POST) ? $_POST['pg_url_succesfull'] : (array_key_exists('mercadopago_URLSUCCESFULL', $conf) ? $conf['mercadopago_URLSUCCESFULL'] : '');
        $btn = array_key_exists('btn_pg', $_POST) ? $_POST['btn_pg'] : (array_key_exists('mercadopago_BTN', $conf) ? $conf['mercadopago_BTN'] : '');
        $bnr = array_key_exists('banner_pg', $_POST) ? $_POST['banner_pg'] : (array_key_exists('mercadopago_BANNER', $conf) ? $conf['mercadopago_BANNER'] : '');
        //category marketplace
        $list_category = $mp->getCategories();
        $select_category = '<select name="mercadopago_CATEGORY" id="category">';
        foreach ($list_category as $category_arr) {
            $selected = "";
            if ($category_arr['id'] == $category) {
                $selected = 'selected="selected"';
            }
            $select_category .= '<option value="' . $category_arr['id'] . '" id="type-checkout-' . $category_arr['description'] . '" ' . $selected . ' >' . $category_arr['description'] . '</option>';
        }
        $select_category .= "</select>";
        //Type Checkout
        $type_checkout_options = array("Iframe", "Lightbox", "Redirect");
        $select_type_checkout = '<select name="mercadopago_TYPECHECKOUT" id="type_checkout">';
        foreach ($type_checkout_options as $select_type) {
            $selected = "";
            if ($select_type == $type_checkout) {
                $selected = 'selected="selected"';
            }
            $select_type_checkout .= '<option value="' . $select_type . '" id="type-checkout-' . $select_type . '" ' . $selected . ' >' . $select_type . '</option>';
        }
        $select_type_checkout .= "</select>";
        //sandbox
        $sandbox_options = array(array("value" => "active", "text" => "Active"), array("value" => "deactivate", "text" => "Deactivate"));
        $select_sandbox = '<select name="mercadopago_SANDBOX" id="sandbox">';
        foreach ($sandbox_options as $op_sandbox) {
            $selected = "";
            if ($op_sandbox['value'] == $sandbox) {
                $selected = 'selected="selected"';
            }
            $select_sandbox .= '<option value="' . $op_sandbox['value'] . '" id="sandbox-' . $op_sandbox['value'] . '" ' . $selected . '>' . $op_sandbox['text'] . '</option>';
        }
        $select_sandbox .= "</select>";
        //Get countries
        $countries = $mp->getCountries();
        $showcountries = '<select name="mercadopago_COUNTRY" id="country">';
        foreach ($countries as $country) {
            if ($country['id'] == $mercado_pago_country) {
                $showcountries .= '<option value="' . $country["id"] . '" selected="selected" id="' . $country["id"] . '">' . $country["name"] . '</option>';
            } else {
                $showcountries .= '<option value="' . $country['id'] . '" id="' . $country["id"] . '">' . $country["name"] . '</option>';
            }
        }
        $showcountries .= '</select>';
        //installments limit
        $qty = array(2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 24);
        $select_installments = '<select name="mercadopago_INSTALLMENTS" id="sandbox">';
        foreach ($qty as $inst) {
            $selected = "";
            if ("inst-" . $inst == $installments) {
                $selected = 'selected="selected"';
            }
            $select_installments .= '<option value="inst-' . $inst . '" id="sandbox-' . $inst . '" ' . $selected . '>' . $inst . '</option>';
        }
        $select_installments .= "</select>";
        //Get methods exclude according the country
        $mercadopago_methods = array();
        if (is_array($mercadopago_method)) {
            foreach ($mercadopago_method as $exclude) {
                $mercadopago_methods[] = $exclude;
            }
        }
        //echo "<pre>";
        //print_r($_REQUEST);
        //echo Configuration::get('mercadopago_METHODS') . "<br />";
        if ($mercado_pago_country != '' || $mercado_pago_country != null) {
            $methods = $mp->getPaymentMethods($mercado_pago_country);
            $showmethods = '';
            foreach ($methods as $method) {
                if ($method['id'] != 'account_money') {
                    if ($mercadopago_methods != null && in_array($method['id'], $mercadopago_methods)) {
                        $showmethods .= ' <input name="mercadopago_METHODS[]" type="checkbox" checked="yes" value="' . $method['id'] . '">' . $method['name'] . '<br />';
                    } else {
                        $showmethods .= '<input name="mercadopago_METHODS[]" type="checkbox" value="' . $method['id'] . '"> ' . $method['name'] . '<br />';
                    }
                }
            }
        } else {
            $showmethods = 'Select first one country, save and reload the page to show the methods';
        }
        $this->_html .= '
		<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
		<fieldset>
			<legend><img src="../img/admin/contact.gif" />' . $this->l('Configurações') . '</legend>
			<label>' . $this->l('Client ID') . ':</label>
			<div class="margin-form"><input type="text" size="33" name="mercadopago_CLIENT_ID" value="' . htmlentities($client_id, ENT_COMPAT, 'UTF-8') . '" /><a href="https://www.mercadopago.com/mlb/ferramentas/aplicacoes" target="_blank" > <b>Bra</b></a>|<a href="http://www.mercadopago.com/mla/herramientas/aplicaciones" target="_blank" ><b>Arg</b></a>|<a href="http://www.mercadopago.com/mlm/herramientas/aplicaciones" target="_blank" ><b>Mex</b></a>|<a href="http://www.mercadopago.com/mlv/herramientas/aplicaciones" target="_blank" ><b>Ven</b></a></div>
                        <br />
			
			<label>' . $this->l('Client Secret') . ':</label>
			<div class="margin-form"><input type="text" size="33" name="mercadopago_CLIENT_SECRET" value="' . $client_secret . '" /><a href="https://www.mercadopago.com/mlb/ferramentas/aplicacoes" target="_blank" > <b>Bra</b></a>|<a href="http://www.mercadopago.com/mla/herramientas/aplicaciones" target="_blank" ><b>Arg</b></a>|<a href="http://www.mercadopago.com/mlm/herramientas/aplicaciones" target="_blank" ><b>Mex</b></a>|<a href="http://www.mercadopago.com/mlv/herramientas/aplicaciones" target="_blank" ><b>Ven</b></a></div>
			<br />
                        
			<label>' . $this->l('Category') . ':</label>
			<div class="margin-form">' . $select_category . '</div>
			<br />
			
			<label>' . $this->l('Type Checkout') . ':</label>
			<div class="margin-form">' . $select_type_checkout . '</div>
			<br />

			<label>' . $this->l('Sandbox') . ':</label>
			<div class="margin-form">' . $select_sandbox . '</div>
			<br />
			
                        <label>' . $this->l('Country') . ':</label>
			<div class="margin-form">' . $showcountries . '</div>
			<br />
                    
                        <label>' . $this->l('Installments Limit') . ':</label>
			<div class="margin-form">' . $select_installments . '</div>
			<br />
			
                        <label>' . $this->l('Exclude methods') . ':</label>
			<div class="margin-form">' . $showmethods . '</div>
			<br />
                        
                        <label>' . $this->l('Url Process Payment') . ':</label>
			<div class="margin-form"><input type="text" size="33" name="pg_url_retorno" value="' . $url_retorno . '" /></div>
			<br />
			
			<label>' . $this->l('URL Aproved Payment') . ':</label>
			<div class="margin-form"><input type="text" size="33" name="pg_url_succesfull" value="' . $url_succesfull . '" /></div>
			<br />
			
			<center><input type="submit" name="submitmercadopago" value="' . $this->l('Atualizar') . '" class="button" /></center>
		</fieldset>
		</form>';
        $this->_html .= '
		
		</center>
		</fieldset>
		</form>';
    }