Jump to content

Custom action in module.


GoksaP

Recommended Posts

Hello!

 

Thread is about grid with records in back-office.

 

I have a grid with my records which I get from database.

 

Everything is ok, but I would like to add at each record, special column with link or a button (submit).

After press it I would like to do something for the current $id and after all display message with status.

 

I've tried following code:

public function __construct() {
	$this->table = 'gp_auto_resend';
	$this->className = 'CodesResend';
	$this->context = Context::getContext();
	$this->_select = '  ...';
	$this->_join = '...';
	parent :: __construct();
	$this->fields_list = array(
		'id_gp_auto_resend' => array(
			'title' => '#',
			'width' => 25
		),
		//(...)
		'resend_id' => array(
			'title' => $this->module->l(' '),
			'width' => 125,
			'align' => 'center',
			'callback' => 'getResendButton',
			'orderby' => false,
			'search' => false,
			'remove_onclick' => true
		)
	);
	$this->actions = array('edit');
}

public function getResendButton($echo, $row) {
	$resend_id = $row['resend_id'];
	$link = $this->context->link;
	$string = '<a style="text-decoration: underline" href="' . $link->getAdminLink('AdminCodesResend') . "&resendCodes&resend_id=" . $resend_id; //"\"><img src=\"../img/admin/tab-invoice.gif\" alt=\"invoice\" /></a>";
	$string .= '">Wyślij</a>';
	return $string;
}
public function resendCodes()
{
	echo '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>';
}

 

Please help me :)

Edited by GoksaP (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...