Post by dazoosh » Tue Feb 09, 2016 10:08 pm

Is there an easy was to add all filters to all categories?

Perhaps a sql query in phpmyadmin?

The autocomplete and add is so uneconomical a clickable/selectable list would be much more convenient.

If you've got 50-100 filters and the same number of categories, it's going to take a couple of hours to do manually.

Any ideas on an easy way to do this?

Thanks.

New member

Posts

Joined
Mon Dec 10, 2012 6:10 pm

Post by labeshops » Tue Feb 09, 2016 10:41 pm

There are several extensions that do this - search for "filters" in the extension store. I use one for v1.5 but am sure I saw one for v2 as well.

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by dazoosh » Wed Feb 10, 2016 1:13 am

labeshops wrote:There are several extensions that do this - search for "filters" in the extension store. I use one for v1.5 but am sure I saw one for v2 as well.
There appears to be extension(s) that automatically show filters in categories where they have been added to the products within a category,

But nothing to show all filters for all categories per se.

New member

Posts

Joined
Mon Dec 10, 2012 6:10 pm

Post by dazoosh » Wed Feb 10, 2016 1:41 am

As a work around to help make the existing assignment method a little easier I have changed /admin/controller/catalog/filter.php

Code: Select all

public function autocomplete() {
		$json = array();

		if (isset($this->request->get['filter_name'])) {
			$this->load->model('catalog/filter');

			$filter_data = array(
				'filter_name' => $this->request->get['filter_name'],
				'start'       => 0,
				'limit'       => 5
			);

			$filters = $this->model_catalog_filter->getFilters($filter_data);

			foreach ($filters as $filter) {
				$json[] = array(
					'filter_id' => $filter['filter_id'],
					'name'      => strip_tags(html_entity_decode($filter['group'] . ' > ' . $filter['name'], ENT_QUOTES, 'UTF-8'))
				);
			}
		}
Replacing where it says 5 with 100

The autocomplete will then show a list of 100 attributes so you can simply click them in turn, instead of having to type and then click matching attributes.

New member

Posts

Joined
Mon Dec 10, 2012 6:10 pm

Post by dazoosh » Wed Feb 10, 2016 2:01 am

Found an even simpler solution:

1. Go to a category in which the required filters have been set.
2. Open web inspector
3. Find "<div id="category-filter" class="well well-sm" style="height: 150px; overflow: auto;">...</div>"
4. Right click and "Copy as HTML"
5. Go to category where you want same attributes and find "<div id="category-filter" class="well well-sm" style="height: 150px; overflow: auto;">...</div>" and right click and "Edit as HTML"
6. Replace existing HTML by pasting that copied.
7. Save

New member

Posts

Joined
Mon Dec 10, 2012 6:10 pm

Post by labeshops » Wed Feb 10, 2016 2:02 am

dazoosh wrote:
labeshops wrote:There are several extensions that do this - search for "filters" in the extension store. I use one for v1.5 but am sure I saw one for v2 as well.
There appears to be extension(s) that automatically show filters in categories where they have been added to the products within a category,

But nothing to show all filters for all categories per se.
Yeah, the one I use does. I don't assign any filters to categories at all. I think this is the one I use. http://www.opencart.com/index.php?route ... n_id=15984

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by dazoosh » Wed Feb 10, 2016 2:13 am

labeshops wrote:
dazoosh wrote:
labeshops wrote:There are several extensions that do this - search for "filters" in the extension store. I use one for v1.5 but am sure I saw one for v2 as well.
There appears to be extension(s) that automatically show filters in categories where they have been added to the products within a category,

But nothing to show all filters for all categories per se.
Yeah, the one I use does. I don't assign any filters to categories at all. I think this is the one I use. http://www.opencart.com/index.php?route ... n_id=15984
Thanks for your suggestion anyway, shame it did't add filters to categories regardless of not been assigned to products for it to show in the category.

Hopefully a solution/extension will be created for anyone in future.

I managed to do it in a few minutes by copy and pasting into the source via web inspector, but not ideal solution.

Thanks again.

New member

Posts

Joined
Mon Dec 10, 2012 6:10 pm
Who is online

Users browsing this forum: No registered users and 9 guests