Jump to content

RenderList mostrar miniaturas de imagen


Recommended Posts

Hola,

 

He hecho un modulo y quiero mostrar las miniaturas de las imágenes en el renderlist.

 

He creado la siguiente función en el admin del módulo:

    public function renderList ()
    {
        if (!\Tools::isSubmit('addModuleItem') && !\Tools::isSubmit('updateModuleItem')) {

            $this->fields_list = array(
                'id' => array(
                    'title' => $this->l('ID'),
                    'align' => 'center',
                    'class' => 'fixed-width-xs',
                    'type' => 'int',
                    'orderBy' => true,
                    'search' => true
                ),
                'image' => array(
                    'title' => $this->l('Image'),
                    'orderBy' => false,
                    'search' => false,
                    'image' => 'myModuleImages',
                ),
                'name' => array(
                    'title' => $this->l('Name'),
                    'orderBy' => true,
                    'search' => true
                ),
                'link' => array(
                    'title' => $this->l('Link'),
                )
            );

            $helperList = new HelperList();
            $helperList->shopLinkType = '';
            $helperList->list_id = '';
            $helperList->simple_header = false;
            $helperList->actions = array('edit', 'delete',);
            $helperList->identifier = 'id';
            $helperList->show_toolbar = true;
            $helperList->orderBy = 'position';
            $helperList->position_identifier = 'id';
            $helperList->title = $this->l('Items list');
            $helperList->table = "myModule";
            $helperList->show_filters = true;
            $helperList->token = \Tools::getAdminTokenLite('AdminmyModule');
            $helperList->currentIndex = \AdminController::$currentIndex . '&configure=' . $this->name;
            $helperList->bulk_actions = array(
                'enable' => array(
                    'text' => $this->l('Enable selection'),
                    'icon' => 'icon-power-off text-success'
                ),
                'disable' => array(
                    'text' => $this->l('Disable selection'),
                    'icon' => 'icon-power-off text-danger'
                ),
                'divider' => array(
                    'text' => 'divider'
                ),
                'delete' => array(
                    'text' => $this->l('Delete selection'),
                    'icon' => 'icon-trash',
                    'confirm' => $this->l('Delete selected items?')
                )
            );
            $ListItems = \myModuleClass::getAllItems();

            return $helperList->generateList($ListItems, $this->fields_list);
        }
    }

En la configuración del módulo, donde se listan los items, se ve la columna de la imagen de la siguiente forma (Ver captura). El minicuadradito a la derecha de los números, si se inspecciona el elemento se ve lo siguiente. 

<img src="/mi_prestashop/img/tmp/myModuleImages_mini__1.?time=1530265762" alt="" class="imgm img-thumbnail">

En la parte donde pone: mini__1, debería poner un numero que seria el ID, para que quedase tal que así: mini_2_1, siendo 2 el ID del elemento.

captura.png

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...