public static function getCategoriesByProductId($id)
{
$db = Factory::getDBO();
$q = 'SELECT pc.category_id, c.alias, pc.ordering' . ' FROM #__phocacart_product_categories AS pc' . ' LEFT JOIN #__phocacart_categories AS c ON c.id = pc.category_id' . ' WHERE pc.product_id = ' . (int) $id . ' ORDER BY pc.ordering';
$db->setQuery($q);
$categories = $db->loadAssocList();
return $categories;
}