public static function doesExist($type)
{
switch ($type) {
case 'category':
$q = 'SELECT id FROM #__phocacart_categories ORDER BY id LIMIT 1';
break;
case 'tax':
$q = 'SELECT id FROM #__phocacart_taxes ORDER BY id LIMIT 1';
break;
case 'product':
$q = 'SELECT id FROM #__phocacart_products ORDER BY id LIMIT 1';
break;
case 'shipping':
$q = 'SELECT id FROM #__phocacart_shipping_methods ORDER BY id LIMIT 1';
break;
case 'payment':
$q = 'SELECT id FROM #__phocacart_payment_methods ORDER BY id LIMIT 1';
break;
case 'country':
$q = 'SELECT id FROM #__phocacart_countries ORDER BY id LIMIT 1';
break;
case 'region':
$q = 'SELECT id FROM #__phocacart_regions ORDER BY id LIMIT 1';
break;
case 'menu':
$q = 'SELECT id FROM #__menu WHERE client_id = 0 AND link LIKE \'index.php?option=com_phocacart%\' ORDER BY id LIMIT 1';
break;
case 'module':
$q = 'SELECT id FROM #__modules WHERE module LIKE \'mod_phocacart%\' ORDER BY id LIMIT 1';
break;
case 'option':
default:
$q = 'SELECT params FROM #__extensions WHERE type = \'component\' AND element = \'com_phocacart\' ORDER BY params LIMIT 1';
break;
}
$db = Factory::getDBO();
$db->setQuery($q);
$item = $db->loadResult();
if ($type == 'option') {
$item = str_replace('{}', '', $item);
if (isset($item) && $item != '') {
return 1;
}
} else {
if (isset($item) && (int) $item > 0) {
return 1;
}
}
return 0;
}