Откройте новую вкладку с помощью & quot; bulk_actions & quot; Prestashop?

У меня есть другая проблема в моем модуле в prestashop 1.6, у меня есть список, в котором пользователь может выбрать более одной строки в этом списке (изображение 1)изображение 1

введите описание изображения здесь

и когда я нажимал «Выбрать …», я хотел открыть форму на новой вкладке (Рисунок 2)изображение 2.

введите описание изображения здесь

Может ли кто-нибудь помочь мне решить эту проблему для меня? Спасибо.

список кодов:

protected function renderListDownload()
{
$table ='contabilidade_fat';

$this->fields_list = array();
$this->fields_list['data_mov'] = array(
'title' => $this->l('Data movimento'),
'type' => 'date',
'search' => false,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['data_fatura'] = array(
'title' => $this->l('Data fatura'),
'type' => 'date',
'search' => false,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['data_pagamento'] = array(
'title' => $this->l('Data pagamento'),
'type' => 'date',
'search' => false,
'orderby' => false,
'align' => 'center',
'width' => 150,
);
$this->fields_list['serie'] = array(
'title' => $this->l('Série'),
'type' => 'text',
'search' => true,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['num_doc'] = array(
'title' => $this->l('N. doc'),
'type' => 'text',
'search' => true,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['nome_cliente'] = array(
'title' => $this->l('Nome faturação'),
'type' => 'text',
'search' => true,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['nome'] = array(
'title' => $this->l('Método de pagamento'),
'type' => 'text',
'search' => false,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['nome_banco'] = array(
'title' => $this->l('Nome banco'),
'type' => 'text',
'search' => false,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['valor'] = array(
'title' => $this->l('Valor movimento'),
'type' => 'price',
'search' => true,
'orderby' => false,
'align' => 'center',
'filter_key' => 'm!valor',
);
$this->fields_list['valor_total'] = array(
'title' => $this->l('Valor fatura'),
'type' => 'price',
'search' => true,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['valor_pago'] = array(
'title' => $this->l('Valor total'),
'type' => 'price',
'search' => true,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['valor_movimento'] = array(
'title' => $this->l('Valor pagamento'),
'type' => 'price',
'search' => true,
'orderby' => false,
'align' => 'center',
);
$this->fields_list['obs'] = array(
'title' => $this->l('Observações'),
'type' => 'text',
'search' => false,
'orderby' => false,
'align' => 'Center',

);
$this->fields_list['envio_recibo'] = array(
'title' => $this->l('Email recibo'),
'type' => 'bool',
'active' => 'envio_recibo',
'search' => true,
'orderby' => false,
'align' => 'center',
'ajax' => true,
);
$ignore = false;
if (Tools::isSubmit('submitReset'.$table))
{
$this->processResetFilters($table);
$ignore = true;
}

$filters = array();
foreach($this->fields_list as $k => $field)
{
if(!$ignore and isset($field['search']) and $field['search'])
{
$filter = $value = '';
//if($field['type'] == 'date' or $field['type'] == 'datetime')
$filter_key = $table.'Filter_'.str_replace('.', '_', (isset($field['filter_key']) ? $field['filter_key'] : ''));
$filter_name = $table.'Filter_'.$k;

if(Tools::getIsset($filter_key))
{
$value = Tools::getValue($filter_key);
$filter = $field['filter_key'];
if(is_array($value))
{
foreach($value as $i => $v)
if(Tools::getValue('local_'.$filter_key)[$i] == '')
$value[$i] = '';
$this->context->cookie->__set($filter_key, serialize($value));
}
else
$this->context->cookie->__set($filter_key, $value);
}
elseif(Tools::getIsset($filter_name))
{
$value = Tools::getValue($filter_name);
$filter = $k;
if(is_array($value))
{
foreach($value as $i => $v)
if(Tools::getValue('local_'.$filter_name)[$i] == '')
$value[$i] = '';
$this->context->cookie->__set($filter_name, serialize($value));
}
else
$this->context->cookie->__set($filter_name, $value);
}
elseif(isset($field['filter_key']) and $this->context->cookie->__isset($filter_key))
{
$value = Tools::unSerialize($this->context->cookie->{$filter_key});
$filter = $field['filter_key'];
}
elseif($this->context->cookie->__isset($filter_name))
{
$value = Tools::unSerialize($this->context->cookie->{$filter_name});
$filter = $k;
}//if($k == 'active') var_dump($field['filter_key'], Tools::getValue($this->table.'Filter_'.str_replace('.', '_', $field['filter_key'])), Tools::getValue($this->table.'Filter_'.$k));
if($filter and $value != '')
{
if($field['type'] == 'date' or $field['type'] == 'datetime')
{
$filter = str_replace('!', '.', $filter);
if($value[0] != '')
$filters[] = $filter." >= '".$value[0]."'";
if($value[1] != '')
$filters[] = $filter." <= '".$value[1]."'";

$this->fields_list[$k]['value'] = $value;
}
elseif(!isset($field['type']) or $field['type'] == 'price')
{
$filter = str_replace('!', '.', $filter);
$value = str_replace(',', '.', $value);
if(strpos($value, '.') == false)
{
$filters[] = $filter." >= ".$value;
$filters[] = $filter." < ".($value + 1);
}
else
$filters[] = $filter." = ".$value;
}
elseif(!isset($field['type']) or $field['type'] == 'text')
$filters[] = $filter." LIKE '%".$value."%'";
elseif($field['type'] == 'bool' and isset($field['filter_key']))
$filters[] = $field['filter_key']." = ".$value."";
else
{
$filters[] = $filter." = '".$value."'";
}
}
else
{
// remove from cookie if no value
if(isset($field['filter_key']) and $this->context->cookie->__isset($table.'Filter_'.str_replace('.', '_', $field['filter_key'])))
$this->context->cookie->__unset($table.'Filter_'.str_replace('.', '_', $field['filter_key']));
elseif($this->context->cookie->__isset($table.'Filter_'.$k))
$value = $this->context->cookie->__unset($table.'Filter_'.$k);
}
}
}
//var_dump($_POST,$filters);exit;
$res = $this->context->cookie->write();

$id_metodopagamento = Configuration::get('CONTA_meto');
$id_contabilidade_banco = Configuration::get('CONTA_banco');
$datei = Configuration::get('CONTA_datei');
$datef = Configuration::get('CONTA_datef');

$content = $this->getListDownload($id_metodopagamento, $datei, $datef, $id_contabilidade_banco, $filters);

$helper = new HelperList();
$helper->module = $this;
$helper->shopLinkType = '';
$helper->simple_header = false;
$helper->identifier = 'id_contabilidade_faturacao';
$helper->actions = array('edit');
$helper->show_toolbar = true;
$count = '<span class="badge">'.count($content).'</span>';
$helper->title = $this->l('List Invoices Download').': '.$count;
$helper->table = $table;
$helper->{$helper->table.'_pagination'} = 50;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
$helper->force_show_bulk_actions = true;
$helper->bulk_actions = array(
'enviar_email' => array(
'text' => $this->l('Selecionar para envio email'),
'icon' => 'icon-send',
'confirm' => $this->l('Tem a certeza que selecionou corretamente?')
)
);

//var_dump($this->displayAddLink($token = null, $id, $name = null), $this->displayEnvioLink($token = null, $id, $name = null));exit;
$this->_html .= $helper->generateList($content, $this->fields_list);
}

код bulk_actions:

if (Tools::isSubmit('submitBulkenviar_emailcontabilidade_fat'))
{
$res = false;
if(!empty($_POST["contabilidade_fatBox"]))
{
$res = $this->renderFormEmailRecibo();
}
else
{
$this->_error .= $this->displayError($this->l('Nenhum item selecionado'));
}
}

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]