Jump to content

Filter renderList results in my new module


Recommended Posts

Hola,

he desarrollado un módulo que me va mostrando entradas que voy guardando en la base de datos. El listado lo muestro con el renderList() y utilizo el objeto $helper.

El tema esta en que quiero poder filtrar los resultados y poderlos ordenar de más grande a más pequeño pero no consigo que me funcione. Al crear el listado

utilizo el "search => true" y el "orderby => true" y defino el "$helper->simple_header = false" para poder realizar lo que quiero, pero no hay manera que me funcione.

Adjunto mi función renderList() para si veis algún error.

Muchas gracias por avanzado.

protected function renderList()
{
    $this->fields_list = array();
    $this->fields_list['id_variableattributeprice'] = array(
        'title' => $this->l('Variable Attribute Price ID'),
        'type' => 'text',
        'search' => true,
        'orderby' => true,
    );

    $this->fields_list['id_printnet'] = array(
        'title' => $this->l('Printnet ID'),
        'type' => 'text',
        'search' => true,
        'orderby' => true,
    );

    $this->fields_list['id_product'] = array(
        'title' => $this->l('Product ID'),
        'type' => 'text',
        'search' => true,
        'orderby' => true,
    );

    $this->fields_list['id_attribute'] = array(
        'title' => $this->l('Product Attribute ID'),
        'type' => 'text',
        'search' => true,
        'orderby' => true,
    );

    $this->fields_list['id_attribute_value'] = array(
        'title' => $this->l('Product Attribute Value ID'),
        'type' => 'text',
        'search' => true,
        'orderby' => true,
    );

    $this->fields_list['variable_price'] = array(
        'title' => $this->l('Variable Price'),
        'type' => 'text',
        'search' => true,
        'orderby' => true,
    );

    $this->fields_list['multiplicar'] = array(
        'title' => $this->l('Multiplicar'),
        'type' => 'text',
        'search' => true,
        'orderby' => true,
    );

    $this->fields_list['multiplicarnumpag'] = array(
        'title' => $this->l('Multiplicar Num. Pag.'),
        'type' => 'text',
        'search' => true,
        'orderby' => true,
    );

    if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
        $this->fields_list['shop_name'] = array(
            'title' => $this->l('Shop'),
            'type' => 'text',
            'search' => true,
            'orderby' => true,
        );

    $helper = new HelperList();
    $helper->shopLinkType = '';
    $helper->simple_header = false;
    $helper->identifier = 'id_variableattributeprice';
    $helper->actions = array('edit', 'delete');
    $helper->show_toolbar = true;
    $helper->imageType = 'jpg';
    $helper->toolbar_btn['new'] = array(
        'href' => AdminController::$currentIndex.'&configure='.$this->name.'&add'.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'),
        'desc' => $this->l('Add new')
    );

    $helper->title = $this->displayName;
    $helper->table = $this->name;
    $helper->token = Tools::getAdminTokenLite('AdminModules');
    $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;

    $content = $this->getListContent($this->context->language->id);

    return $helper->generateList($content, $this->fields_list);
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...