/* Checkout - is there even some payment NOT is used reverse - used only in online shop type
* This function is different to getPossiblePaymentMethods()
*
* getPossiblePaymentMethods() - all methods they fit the criterias (e.g. amount rule, contry rule, etc.)
* isPaymentNotUsed() - all existing methods in shop which are published
*
* * IF NO PAYMENT METHOD EXIST - it is ignored when 1) skip_payment_method parameter is enabled 2) all products are digital and skip_payment_method is enabled
*
* */
public static function isPaymentNotUsed($options = array())
{
$paramsC = PhocacartUtils::getComponentParameters();
$skip_payment_method = $paramsC->get('skip_payment_method', 0);
// 1) TEST IF ANY PAYMENT METHOD EXISTS
$db = Factory::getDBO();
$query = 'SELECT a.id' . ' FROM #__phocacart_payment_methods AS a' . ' WHERE a.published = 1' . ' AND a.type IN (0,1)' . ' ORDER BY id LIMIT 1';
$db->setQuery($query);
$methods = $db->loadObjectList();
if (empty($methods) && $skip_payment_method == 2) {
return true;
}
// 2) TEST IF PAYMENT METHOD IS NOT DISABLED FOR CART WITH EMPTY PRICE (CART SUM = 0)
if (isset($options['order_amount_zero']) && $options['order_amount_zero'] == 1 && $skip_payment_method == 1) {
return true;
}
return false;
}