Is your feature request related to a problem? Please describe.
Employee get's shown a huge list of order states in the selectbox, but usually he uses only a few of them for order management.
Describe the solution you'd like
Add an option to hide some states from order administration.
Technically
Add a boolean field hide_admin to DB and OrderState definition.
Add possibility to manage this via checkbox on OrderState edit page.
Add parameter to function getOrderStates which, if true, will select only states with hide_admin = 1.
Call getOrderStates from AdminOrdersController with this parameter enabled.
Edit:
SPECS
A column should be added on the order status list after Email template, to display if the status is displayed or not in the status dropdown list in the order pages.
And on edit/add status form, we could add a switch button to display the order status or not in the dropdown list.
By default, the status is displayed. So every drop-down list for updating the order status have to take into account if the status should be display or not.
A button is displayed on the list to display or not the status:
WORDING
Before the toggle:
Display on the Orders page
The description below the input:
When enabled, this option allows the status to be used on the Orders page of the back office. If you do not need this label to handle your orders, just disable this option.
Hi @Hlavtox,
Thanks for your report.
Ping @colinegin, @marionf what do you think? is it possible to disable some order status?
For security reasons, we cannot delete default order statuses, but it is possible to add the disable option.
Thanks!
+1, i've done this modification few times for customers
As a workaround, you can delete or make an order state removable from ps_order_state
table in the database. To delete it, just change 0 to 1 in the deleted
row. To make it removable from the BO, change 1 to 0 in the unremovabale
column.
@rdy4ever Dangerous idea, some functionality could rely on the preset states.
They are defined in the code and not checked if they exist during execution.
@Hlavtox Yes. You should only do it if you know what you鈥檙e doing and you should test functionality after.
Thank @Hlavtox for your request. As @kpavlovsky said, from our differents merchant interviews we have been told the same feedbacks. Let's see if we can include in the 1.7.7 Roadmap.
I will let you know for any updates
SPECS
A column should be added on the order status list after Email template, to display if the status is displayed or not in the status dropdown list in the order pages.
And on edit/add status form, we could add a switch button to display the order status or not in the dropdown list.
By default, the status is displayed. So every drop-down list for updating the order status have to take into account if the status should be display or not.
DESIGN
@TristanLDD, Wdyt?
WORDING
@LouiseBonnard, I let you challenge my wording, we need to be careful with the wording. I'm afraid that some users think as activated or deactivated feature instead of only managing the display.
What about:
Hide from status list
If enabled, the status will not be visible in the dropdown, when changing order status.
What about:
Hide from status list
If enabled, the status will not be visible in the dropdown, when changing order status.
Yes, it is. I just made the specs for the configuration in the form and the status list but display or not it will affect the list when you want to change the status. I updated the specs to make it clearer.
@Matshir It was only a suggestion for wording :-D :-D I get the functionality :-)
Oh :sweat_smile:, my bad. Thank you.
@LouiseBonnard don't forget to look a @Hlavtox suggestion
@Hlavtox, what bothers me a bit with this wording is that the users won't know which dropdown list we are talking about. If the wording is displayed on the Shop Parameters > Order Settings > Statuses tab while it regards the Orders > Orders page, it might be confusing.
I suggest the following wording, feel free to challenge it as well. ;-)
Display on the Orders page / When enabled, this option allows the status to be used on the Orders page of the back office. If you do not need this label to handle your orders, just disable this option.
I think it would be easier for merchants to be able to hide / display some status directly from the status list:
I'm thinking about something like that :
(please note that this isn't final design)
@TristanLDD, please make the wording note that it is linked to the Orders page, perhaps something like _Hide on Orders page_?
After discussion, a filter on the droplist seems to add too much complexity in UX and technically for a small value. But to add a position index to order them as the merchant wishes seems a nice idea from @jolelievre
@MatShir
It's like 5 lines of code and a database column.
You don't have to add the eye icon.
@MatShir
It's like 5 lines of code and a database column.
You don't have to add the eye icon.
No it's not 5 lines of code and a database column. If you add "5 lines of code and a database column" you will see what you want to see but you will introduce multiple behavior changes that will have side-effects on other BO pages and might create issues with existing modules behavior.
Please trust us when we say "a filter on the droplist seems to add too much complexity". It means we actually explored this feature and checked all possible side-effects for multiple and different usecases involving PrestaShop use.
PrestaShop is a complex software and modifying its behavior is consequently complex as we have to consider the potential 300,000 different installs and usages of the store.
You can add these 5 lines of code and a database column into your codebase 馃槈 this will work perfectly for you. But in order to merge this feature smoothly and not to break existing behaviors or usages into the software requires much more code and checks.
@matks I have done this mod a long time ago and it works fine (in my case). That's why I proposed it here.
My previous comment was on a basis of me looking through the code, because if I'm not overseeing anything, the function is used only on 2 places.
That's I was suprised about too much complexity @MatShir commented about.
But I get your point, better be safe.
@MatShir
It's like 5 lines of code and a database column.
You don't have to add the eye icon.
@Hlavtox
For those who are interested like me, can you specify the 5 lines of code please.
Thank you
@W4U-TOURS Ok, here you go.
Go to your SQL manager and run this, change prefix if needed:
ALTER TABLE 'ps_order_state' ADD 'hide_admin' tinyint(1) unsigned NOT NULL DEFAULT '0';
This will add it to OrderState definition and change the function called. It's an optional parameter added to the function so if anything other uses it, it will still work just fine.
A) Add
/** @var bool Hide in BO order view */
public $hide_admin;
after
public $deleted = 0;
B) Add
'hide_admin' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
after
'hidden' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
C) Find
public static function getOrderStates($id_lang)
{
.....
}
and change it to
public static function getOrderStates($id_lang, $hide_admin = false)
{
// Exclude order states for order admin
if ($hide_admin == true) {
$cache_id = 'OrderState::getOrderStates_hide_admin'.(int)$id_lang;
$sql_where = 'WHERE deleted = 0 AND hide_admin = 0';
} else {
$cache_id = 'OrderState::getOrderStates_'.(int)$id_lang;
$sql_where = 'WHERE deleted = 0';
}
if (!Cache::isStored($cache_id)) {
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *
FROM `'._DB_PREFIX_.'order_state` os
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$id_lang.')
' . $sql_where . '
ORDER BY `name` ASC');
Cache::store($cache_id, $result);
return $result;
}
return Cache::retrieve($cache_id);
}
This will get our states without the states we don't want.
Change
'states' => OrderState::getOrderStates($this->context->language->id),
to
'states' => OrderState::getOrderStates($this->context->language->id, true),
Now, we add it to order status admin.
A) Add
array(
'type' => 'checkbox',
'name' => 'hide_admin',
'values' => array(
'query' => array(
array('id' => 'on', 'name' => $this->trans('Hide on order screen', array(), 'Admin.Shopparameters.Feature'), 'val' => '1'),
),
'id' => 'id',
'name' => 'name',
),
),
after
array(
'type' => 'checkbox',
'name' => 'logable',
'values' => array(
xxxxxx
),
),
B) Add
'hide_admin_on' => $this->getFieldValue($obj, 'hide_admin'),
after
'logable_on' => $this->getFieldValue($obj, 'logable'),
C) Add
$_POST['hide_admin'] = (int)Tools::getValue('hide_admin_on');
after
$_POST['logable'] = (int) Tools::getValue('logable_on');
If more people show interest for this feature, here the option to consider:
Most helpful comment
If more people show interest for this feature, here the option to consider: