UPDATE 2 - SOLVED
I found an error in my query. Original:
JOIN mus_virtuemart_product_categories as pc ON pc.virtuemart_product_id=vmp.product_parent_id
Joomla query:
->join('INNER', $db->quoteName('#__virtuemart_product_categories','pc') .
' ON (' . $db->quoteName('pc.virtuemart_product_id') . ' = ' . $db->quoteName('vmp.virtuemart_product_id') . ')')
- The last reference should be replaced instead of
quoteName('vmp.virtuemart_product_id')
-> quoteName('vmp.product_parent_id')
So solved query is:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array(
'vmp.virtuemart_product_id as product_id',
'vmp.product_parent_id as parent_id',
'vmp.product_sku as sku',
'vmp.product_in_stock as stock',
'vmp.published as published',
'pc.virtuemart_category_id as category'
))
->from($db->quoteName('#__virtuemart_products','vmp'))
->join('INNER', $db->quoteName('#__virtuemart_product_categories','pc') .
' ON (' . $db->quoteName('pc.virtuemart_product_id') . ' = ' . $db->quoteName('vmp.product_parent_id') . ')')
->where($db->quoteName('pc.virtuemart_category_id') . ' = '. $db->quote($category). ' AND '. $db->quoteName('vmp.product_parent_id') . ' >0');
$db->setQuery($query);
$podaci = $db->loadAssocList();
THANK YOU ALL FOR HELP!