Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JOIN `webshop_category` `cat` ON `c`.`category_id`=`cat`.`category_id` LEFT J...' at line 7

SELECT COUNT(*) AS `numrows` FROM ( SELECT `p`.`id`, `p`.`product_unique_id`, `p`.`product_name`, `p`.`brand_id`, `brands`.`name` as `brand_name`, `p`.`product_visible`, `p`.`path`, `p`.`product_introduction`, `p`.`gross`, `p`.`sale_gross`, `p`.`sale_start`, `p`.`sale_end`, `cat`.`category_id`, `cat`.`title` as `category_title`, `co`.`hex`, `co`.`name` AS `color_name`, `p`.`created_on`, SUM(v.variant_in_stock) as total_in_stock, `p`.`active` FROM `webshop_product` `p` LEFT JOIN `webshop_product_variants` `v` ON `v`.`product_id`=`p`.`id` JOIN `webshop_product_category` `c` ON `p`.`id`=`c`.`product_id` AND `c`.`category_id`= JOIN `webshop_category` `cat` ON `c`.`category_id`=`cat`.`category_id` LEFT JOIN `webshop_product_weights` `w` ON `p`.`id`=`w`.`product_id` AND `c`.`category_id`=`w`.`category_id` LEFT JOIN `webshop_colors` `co` ON `co`.`color_id`=`p`.`color` LEFT JOIN `webshop_brands` `brands` ON `p`.`brand_id`=`brands`.`brand_id` WHERE `p`.`active` = 1 AND `p`.`product_visible` = 1 GROUP BY `p`.`id`, `w`.`weight`, `cat`.`category_id` ) CI_count_all_results

Filename: models/Product_model.php

Line Number: 85