public static function getNextOrder($pId, $cId)
{
$db = Factory::getDBO();
$where = 'category_id =' . (int) $cId;
$query = $db->getQuery(true)->select('MAX(ordering)')->from('#__phocacart_product_categories')->where($where);
$db->setQuery($query);
$max = (int) $db->loadResult();
return $max + 1;
}