Skip to content

Instantly share code, notes, and snippets.

@chetanmadaan
Created February 16, 2021 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chetanmadaan/30b535d747b027855e21487dd5e121c3 to your computer and use it in GitHub Desktop.
Save chetanmadaan/30b535d747b027855e21487dd5e121c3 to your computer and use it in GitHub Desktop.
Hikashop.php finder plugin for Joomla fix for excluding duplicates in search results of products that are in multiple categories
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.product_id AS id, a.product_name AS title, a.product_alias AS alias, "" AS link, a.product_description AS summary')
->select('a.product_keywords AS metakey, a.product_meta_description AS metadesc, "" AS metadata, a.product_access AS access')
->select('"" AS created_by_alias, a.product_modified AS modified, "" AS modified_by')
->select('a.product_sale_start AS publish_start_date, a.product_sale_end AS publish_end_date')
->select('a.product_published AS state, a.product_sale_start AS start_date, 1 AS access')
->select('brand.category_name AS brand, brand.category_alias as brandalias, brand.category_published AS brand_state, 1 AS brand_access')
->from('#__hikashop_product AS a')
->join('LEFT', '#__hikashop_category AS brand ON a.product_manufacturer_id = brand.category_id');
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment