Jump to content

how to add the bulk actions with dropdown prestashop v 1.5.6.1


ganeshgp

Recommended Posts

Hi, I have one problem. I need a button that will change the status of the selected orders to "sended". Can you help me? I add this button to template: 

$this->bulk_actions = array('sended' => array('text' => 'Oznacz jako wysłane', 'confirm' => 'Na pewno chcesz zmienić status dla zaznaczonych zamówień?'));

and now I wonder what to do next.

Link to comment
Share on other sites

I added:

 

1.This code:

$this->bulk_actions = array('sended' => array('text' => 'Mark as sent', 'confirm' => 'your message to user'));

In file AdminOrdersController.php, in public function __construct()

 

2. This code:

protected function processBulkSended(){
	if (is_array($this->boxes) && !empty($this->boxes)){
		$employee_id = $this->context->employee->id;
		$new_order_state = 4; // id state
			
		$dbQuery = Db::getInstance();
		foreach ($this->boxes as $id_order){
			$result = $dbQuery->query('UPDATE '._DB_PREFIX_.'orders SET current_state =                          '.$new_order_state.' WHERE id_order = '.$id_order);
		}
	}
}

In AdminController.php

 

 

3. Add 'sended' to: 

protected $actions_available = array('view', 'edit', 'delete', 'duplicate', 'sended');

In AdminController.php

  • Like 1
Link to comment
Share on other sites

I added:

 

1.This code:

$this->bulk_actions = array('sended' => array('text' => 'Mark as sent', 'confirm' => 'your message to user'));

In file AdminOrdersController.php, in public function __construct()

 

2. This code:

protected function processBulkSended(){
	if (is_array($this->boxes) && !empty($this->boxes)){
		$employee_id = $this->context->employee->id;
		$new_order_state = 4; // id state
			
		$dbQuery = Db::getInstance();
		foreach ($this->boxes as $id_order){
			$result = $dbQuery->query('UPDATE '._DB_PREFIX_.'orders SET current_state =                          '.$new_order_state.' WHERE id_order = '.$id_order);
		}
	}
}

In AdminController.php

 

 

3. Add 'sended' to: 

protected $actions_available = array('view', 'edit', 'delete', 'duplicate', 'sended');

In AdminController.php

ok thanks how to get the  $new_order_state from the order grid view ..? please help me...

Link to comment
Share on other sites

Ok  thanks admin panel i want how to show the order statuses are included in drop down that  code i need...

For example this is your $this->bulk_actions = array('sended' => array('text' => 'Mark as sent', 'confirm' => 'your message to user'));

this code produce  "Mark as sent" button similarly i need the code for dropdown with order status..Thanks

Link to comment
Share on other sites

Hi,

 

I  added the gift voucher from admin side. It was displayed properly in cart summary. I need automatically apply for the check out without  selecting the voucher code if it is applicable  the order

 

Thanks

Ganesan

 

Link to comment
Share on other sites

  • 11 months later...

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