Post by Cue4cheap » Wed Aug 17, 2016 12:28 pm

Hi,

I have installed this:

http://www.opencart.com/index.php?route ... load_id=32

The search VQMod works very well.

The product one misses brands (manufacturers).

I am certain it is in the ocextension_filterbymanufacturer_category.xml file, this query:

Code: Select all

					$query = $this->db->query("SELECT m.manufacturer_id, m.name, COUNT(p.product_id) AS products_total FROM " . DB_PREFIX . "product_to_category pc 
					LEFT JOIN " . DB_PREFIX . "product p ON (p.product_id = pc.product_id) 
					LEFT JOIN " . DB_PREFIX . "manufacturer m ON (m.manufacturer_id = p.manufacturer_id) 
					WHERE pc.category_id IN (".$category_ids.") AND p.status = 1 AND p.quantity > -1 
					GROUP BY m.manufacturer_id ORDER BY m.name ASC");
Specifically

Code: Select all

					WHERE pc.category_id IN (".$category_ids.")  
What it should do is retrieve only those manufacturers that have a status of 1 and quantity 0 and above. But it misses a bunch of manufacturers because of the WHERE pc.category_id IN (".$category_ids.").

If I adjust it to:
WHERE p.status = 1 AND p.quantity > -1
It then pulls all manufacturers but I am looking for the right code that it only pulls those manufacturers that are in the category selected, category is enabled and have a product in stock.

Any thoughts?

Thank you,
Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by Cue4cheap » Fri Aug 19, 2016 11:36 am

Okay... Now I figured out the reason why.... it has to do with categories and sub-categories.... It is interesting... IF a product is in a top level category and has a manufacturer listed, it will show those manufacturers. So something in the extensions logic doesn't pull the sub-categories and those manufacturers like it should... It has some code in there seeming like it is meant to get the manufacturers of products in sub-categories:

Code: Select all

			$categoryids_with_childs = array();
			$categoryids_with_childs = $this->model_catalog_category->getCategories($category_id);
			array_push($categoryids_with_childs, $category_id);
			$manufacturers = $this->model_catalog_manufacturer->getManufacturersByCategories($categoryids_with_childs);
But my deciphering of the logic is above me at this time....

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am
Who is online

Users browsing this forum: No registered users and 2 guests