Jump to content

HOw to make work action view in hook DisplayAdminCustomers


Recommended Posts

Hi. Im super new in prestashop dev.

I have a wishlist module already installed. I just try to modify to include in customer tab, the wishlist of tihs client.

I already show all the wishlist of the cliente, but i want to add a view action to show the products of that wishlist.

I cant get the action working. i paste my code:

	 public function renderWishlistAdminList()
    {
		$db = Db::getInstance();
		$sql='SELECT * FROM ' . _DB_PREFIX_ . 'wbfeature_wishlist WHERE id_customer='. Tools::getValue('id_customer');
		$results=$db->ExecuteS($sql);

		$this->fields_list = array(
			'id_wishlist' => array(
				'title' => $this->l('ID'),
				'width' => 'auto',
				'type' => 'text'
			),
			'name' => array(
				'title' => $this->l('Nombre'),
				'width' => 'auto',
				'type' => 'text'
			),
			'default' => array(
				'title' => $this->l('Defecto'),
				'width' => 'auto',
				'type' => 'bool'
			)
		);

		$helper = new HelperList();
		$helper->shopLinkType = '';
		$helper->simple_header = false;
		$helper->identifier = 'id_wishlist';
		$helper->listTotal = count($results);
		$helper->actions = array('view');
		$helper->title =  $this->l('Listas de Deseos');
		$helper->token = Tools::getAdminTokenLite('AdminCustomers');		
	    $helper->show_toolbar = true;
		$helper->tpl_vars['icon'] = 'icon-gift';
		$helper->table ='wbfeature_wishlist';		 
		$helper->toolbar_btn['a'] = array('desc' => '');
		$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;		
		$helper->position_identifier = 'id_wishlist';
		$helper->orderBy = 'id_wishlist';
		$helper->orderWay = 'ASC';
		return $helper->generateList($results,$this->fields_list);
    }
    public function hookDisplayAdminCustomers()
    {
        $this->html = '';

        $this->html .= $this->renderWishlistAdminList();

        return $this->html;
    }

Whats wrong? What im no doing???

Many many thanks!

Screenshot_2019-02-26 Clientes Información del cliente R Escrol • Burgocar Motorrad.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...