Jump to content

Help with Helper List Undefined index and type in db.php


Programmers Direct

Recommended Posts

Hi everyone, I am working on a new free module and it seems that a list I am creating is missing soemthing and i cannot find what please can you look over the code to see what you think as it produces four notices two for type and two for value. below are the codes from the form.

 

Errors

Notice on line 424 in file /classes/db/Db.php [8] Undefined index: type

Notice on line 427 in file /classes/db/Db.php [8] Undefined index: value

Notice on line 424 in file /classes/db/Db.php [8] Undefined index: type

Notice on line 427 in file /classes/db/Db.php [8] Undefined index: value

private function initToolbar()
{
	$this->toolbar_btn = array(
		'add' => array(
		'href' => AdminController::$currentIndex.'&configure='.$this->name.'&add'.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'),
		'desc' => $this->l('Add')),
		'remove' => array(
			'href' => AdminController::$currentIndex.'&configure='.$this->name.'&remove'.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'),
			'desc' => $this->l('Remove')
		));
	return $this->toolbar_btn;
}
protected function displayAddtoSelectionLink($token = null, $id, $name = null)
{
        $tpl = $this->context->smarty->assign(array (
                'href' => AdminController::$currentIndex . '&' . $this->identifier . '=' . $id . '&add' . $this->table . '&token=' . ($token != null ? $token : $this->token),
                'action' => $this->l('Add to Selection')
        ));
        return $tpl;
}
protected function displayRemoveSelectionLink($token = null, $id, $name = null)
{
        $tpl = $this->context->smarty->assign(array (
                'href' => AdminController::$currentIndex . '&' . $this->identifier . '=' . $id . '&remove' . $this->table . '&token=' . ($token != null ? $token : $this->token),
                'action' => $this->l('Remove from Selection')
        ));
    return $tpl;
}
protected function getCurrListForm()
{
	return $this->fields_list = array (
		'id' => array (
		'title' => $this->l('Product Id'),
		'width' => 150,
		'align' => 'center',
		'type' => 'text',
		'list' => $this->initCurrList(),
		'filter_key' => 'cl\!id',
		'orderby' => false,
		'search' => false,
		'maxlength' => 90,
		'tmpTableFilter' => false,
		'havingFilter' => false,
		'filter_type' => 'int',
		'color' => '#FFFF00',
		'hint' => $this->l('Product Ids.'),
		'ajax' => false
		),
	'name' => array (
		'title' => $this->l('Product Name'),
		'width' => 'auto',
		'align' => 'center',
		'type' => 'text',
		'list' => $this->initCurrList(),
		'filter_key' => 'cl\!name',
		'orderby' => false,
		'search' => false,
		'maxlength' => 90,
		'color' => '#FFFF00',
		'hint' => $this->l('Selected Product Name'),
		'ajax' => true),
	);
}
private function initCurrList()
{
	$options = array ();
	$sql = new DbQuery();
	$sql->select('*');
	$sql->from('category_product', 'cp');
	$sql->leftJoin('product', 'p', 'p.id_product=cp.id_product');
	$sql->leftJoin('product_lang', 'pl', 'pl.id_product=p.id_product AND pl.id_lang =' . $this->context->language->id);
	$sql->where('cp.id_category=' . (int)Configuration::get('HOME_FEATURED_CAT') . ' AND p.active=1');
	$squery_data = Db::getInstance()->executeS($sql);
	foreach ($squery_data as $currlist_values)
		{
			$options[] = array (
				'id' => $currlist_values['id_product'],
				'name' => $currlist_values['name']
			);
		}
	return $options;
}
protected function renderCurrList()
{
	$helperlist = new HelperList();
	$helperlist->shopLinkType = '';
	$helperlist->title = 'Current Products for Home Featured Selection';
	$helperlist->identifier = 'id';
	$helperlist->table = $this->name.'_product';
	$helperlist->simple_header = false;
	$helperlist->show_toolbar = true;
	$helperlist->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
	$helperlist->token = Tools::getAdminTokenLite('AdminModules');
	$helperlist->listTotal = count($this->initCurrList());
	$helperlist->actions = array ('add', 'remove');
	$helperlist->add = array ('add', $this->addToSelection(Tools::getAdminTokenLite('AdminModules'), $this->id), null);
	$helperlist->remove = array ('remove', $this->removeFromSelection(Tools::getAdminTokenLite('AdminModules'), $this->id), null);
	return $helperlist->generateList($this->initCurrList(), $this->getCurrListForm());
}
Edited by ShopSaveNEarn (see edit history)
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...