Page 1 of 1

Defaults admin product filter

Posted: Fri Jul 08, 2016 5:31 pm
by tjsystems
Hi,

Is there a way to set the product filter default? Now all products are shown, I only want the Active products to show.

Thanks,
Tim

Re: Defaults admin product filter

Posted: Fri Jul 08, 2016 7:33 pm
by straightlight
In admin - > catalog - > products, you can already use the filter from the status dropdown menu whether choosing enabled or disabled option. This will return the results accordingly.

Re: Defaults admin product filter

Posted: Fri Jul 08, 2016 7:35 pm
by AlexDW
Just use Status->Enabled in Product list

And if you need to quick bulk edit statuses - look on free extension EnableDisable Products

Re: Defaults admin product filter

Posted: Fri Jul 08, 2016 7:36 pm
by straightlight
AlexDW wrote:Just use Status->Enabled in Product list
Isn't that what I just indicated above?

Re: Defaults admin product filter

Posted: Fri Jul 08, 2016 7:47 pm
by AlexDW
straightlight wrote:
AlexDW wrote:Just use Status->Enabled in Product list
Isn't that what I just indicated above?
Sorry, but English is not my native language, some time need on translate ;)

Re: Defaults admin product filter

Posted: Sat Jul 09, 2016 12:34 am
by tjsystems
Yes this is clear to me. I do this every day now.

I want to set the default of the filter on 'enabled'. So I don't have to do this every time I login into the admin.

Re: Defaults admin product filter

Posted: Sat Jul 09, 2016 12:52 am
by straightlight
Ah ! so the default value forced to enabled from the product status.

In admin/view/template/catalog/product_list.php file,

replace with:

Code: Select all

<select name="filter_status" id="input-status" class="form-control">
                  <option value="*"></option>
                  <?php if ($filter_status) { ?>
                  <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                  <?php } else { ?>
                  <option value="1"><?php echo $text_enabled; ?></option>
                  <?php } ?>
                  <?php if (!$filter_status && !is_null($filter_status)) { ?>
                  <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                  <?php } else { ?>
                  <option value="0"><?php echo $text_disabled; ?></option>
                  <?php } ?>
                </select>
with:

Code: Select all

<select name="filter_status" id="input-status" class="form-control">
                  <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                                 </select>

Re: Defaults admin product filter

Posted: Sat Jul 09, 2016 1:58 am
by AlexDW
I think better use this method:

in file admin\controller\common\menu.php

find line

Code: Select all

$data['product'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'], 'SSL');
and replace to

Code: Select all

$data['product'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&filter_status=1', 'SSL');
(for version 2200 instead of 'SSL' here is true)

and don't forget refresh modification cache after replacement

With this method you can continue to choose the status, and by default it will be enabled

Re: Defaults admin product filter

Posted: Sat Jul 09, 2016 2:04 am
by straightlight
AlexDW wrote:I think better use this method:

in file admin\controller\common\menu.php

find line

Code: Select all

$data['product'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'], 'SSL');
and replace to

Code: Select all

$data['product'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&filter_status=1', 'SSL');
(for version 2200 instead of 'SSL' here is true)

and don't forget refresh modification cache after replacement

With this method you can continue to choose the status, and by default it will be enabled
By using this method, any users would be able to change the value on the URL which the select form would be able to handle both methods since the array would still pull the one being last inputed into the URL as the status value while my method above forces the issue on using specifically the enabled feature on the list.

Both methods would be a good approach, I presume.

Re: Defaults admin product filter

Posted: Sun Jul 10, 2016 8:55 pm
by straightlight
If the site redirection issue is still in effect on this topic, I would suggest trying this tweak: http://forum.opencart.com/viewtopic.php?f=24&t=165085

Re: Defaults admin product filter

Posted: Wed Jul 13, 2016 9:04 pm
by tjsystems
Thanks guys, I'll try to make a ocmod so we can all use it.

Re: Defaults admin product filter

Posted: Thu Jul 14, 2016 3:12 am
by tjsystems
Made these mods. Are not working for me on OC2200, I can only test on my live shop. Could be that other mod are in the way. Any change that someone can test these?

Re: Defaults admin product filter

Posted: Thu Jul 14, 2016 3:27 am
by straightlight
What differentiate the first and second XML file?

Re: Defaults admin product filter

Posted: Thu Jul 14, 2016 4:12 am
by tjsystems
straightlight wrote:What differentiate the first and second XML file?
the two methods that are in this topic.