Jump to content

Adding a new order state during module installation


Recommended Posts

HI , I have a problem with adding and delete order state during install and uninstall module.

I have something like this in install method:
 

$order_state = new OrderState();
$order_state->send_email = false;
$order_state->color = '#151400';
$order_state->hidden = true;
$order_state->delivery = false;
$order_state->logable = false;
$order_state->invoice = false;
$order_state->name = 'MY_CUSTOM_NAME';
if ($order_state->add()) {
	Configuration::updateValue('MODULE_MY_CUSTOM_NAME', $order_state->id);
}

and this in uninstall:
 

$order_state = new OrderState(Configuration::get('MODULE_MY_CUSTOM_NAME'));
if ($order_state->existsInDatabase(Configuration::get('MODULE_MY_CUSTOM_NAME'), 'order_state')) {
    $order_state->delete();
}

but i got error 500 during installation if I don't comment this;)

Any help ? suggestion ?

Edited by Stepel (see edit history)
Link to comment
Share on other sites

  • Stepel changed the title to Adding a new order state during module installation

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