Jump to content

Display product image and checkbox in listing using custom module


Recommended Posts

I am trying to show product listing using custom module in admin panel. the product listing I am able to fetch and show, but I am unable to show product image and checkbox to select a row (that we display on extreme left side by selecting we can do bulk operation). here is my code:-

 

filename ---> custommodule.php

 

//fetch the product listing
public function getAllProductList()
{
$category = new Category(Context::getContext()->shop->getCategory(),(int)Context::getContext()->language->id);
$nb = 10000;
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10));
return $products;
}
 
//display product listing
public function generateProductList()
{
$content = $this->getAllProductList();
 
$fields_list = array(
'id_product' => array(
'title' => $this->l('ID'),
'align' => 'center',
'class' => 'fixed-width-xs'
),
'id_image' => array(
'title' => $this->l('Image'),
          'align' => 'center',
          'image' => 'p',
          'filter' => false,
          'search' => false,
          'orderby' => false,
),
'name' => array(
'title' => $this->l('Name')        
),
'manufacturer_name' => array(
'title' => $this->l('Brand'),
/*'filter_key' => 'm!manufacturer_name' */        
),
'category_default' => array(
'title' => $this->l('Category')        
),
'price' => array(
'title' => $this->l('Base Price')        
),
'reference' => array(
'title' => $this->l('Reference Code')        
)
 
);
 
 
 
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->module = $this;
//$helper->actions = array('edit','delete');
 
$helper->simple_header = false;
$helper->listTotal = count($content);
$helper->identifier = 'id_product';
$helper->title = $this->l('List Of Products');
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules',false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
$helper->toolbar_scroll = true;
$helper->toolbar_btn = $this->initToolbar();
 
return $helper->generateList($content,$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...