Post by tjsystems » Fri Jul 08, 2016 5:31 pm

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

Live with 2.2.0.0 fully SSL.


Active Member

Posts

Joined
Sun Aug 26, 2012 5:39 pm
Location - NL, Amsterdam

Post by straightlight » Fri Jul 08, 2016 7:33 pm

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by AlexDW » Fri Jul 08, 2016 7:35 pm

Just use Status->Enabled in Product list

And if you need to quick bulk edit statuses - look on free extension EnableDisable Products
Last edited by AlexDW on Fri Jul 08, 2016 7:42 pm, edited 1 time in total.

Useful Opencart extensions


User avatar
New member

Posts

Joined
Sun Jun 05, 2016 3:32 am

Post by straightlight » Fri Jul 08, 2016 7:36 pm

AlexDW wrote:Just use Status->Enabled in Product list
Isn't that what I just indicated above?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by AlexDW » Fri Jul 08, 2016 7:47 pm

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 ;)

Useful Opencart extensions


User avatar
New member

Posts

Joined
Sun Jun 05, 2016 3:32 am

Post by tjsystems » Sat Jul 09, 2016 12:34 am

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.

Live with 2.2.0.0 fully SSL.


Active Member

Posts

Joined
Sun Aug 26, 2012 5:39 pm
Location - NL, Amsterdam

Post by straightlight » Sat Jul 09, 2016 12:52 am

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>

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by AlexDW » Sat Jul 09, 2016 1:58 am

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

Useful Opencart extensions


User avatar
New member

Posts

Joined
Sun Jun 05, 2016 3:32 am

Post by straightlight » Sat Jul 09, 2016 2:04 am

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Sun Jul 10, 2016 8:55 pm

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

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by tjsystems » Wed Jul 13, 2016 9:04 pm

Thanks guys, I'll try to make a ocmod so we can all use it.

Live with 2.2.0.0 fully SSL.


Active Member

Posts

Joined
Sun Aug 26, 2012 5:39 pm
Location - NL, Amsterdam

Post by tjsystems » Thu Jul 14, 2016 3:12 am

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?

Live with 2.2.0.0 fully SSL.


Active Member

Posts

Joined
Sun Aug 26, 2012 5:39 pm
Location - NL, Amsterdam

Post by straightlight » Thu Jul 14, 2016 3:27 am

What differentiate the first and second XML file?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by tjsystems » Thu Jul 14, 2016 4:12 am

straightlight wrote:What differentiate the first and second XML file?
the two methods that are in this topic.

Live with 2.2.0.0 fully SSL.


Active Member

Posts

Joined
Sun Aug 26, 2012 5:39 pm
Location - NL, Amsterdam
Who is online

Users browsing this forum: Mike Guenther and 228 guests