Back to PhocacartShipping class

Method isShippingMethodActive

public static
isShippingMethodActive
(mixed $id)

Method isShippingMethodActive - Source code

/*
 * Used in POS - we can define forced shipping method in Global Configuration
 * But if user unpublish this method, we need to test it
 */
public static function isShippingMethodActive($id)
{
    $db = Factory::getDBO();
    $query = 'SELECT a.id' . ' FROM #__phocacart_shipping_methods AS a' . ' WHERE a.published = 1' . ' AND a.type IN (0,2)' . ' AND a.id = ' . (int) $id . ' ORDER BY id LIMIT 1';
    $db->setQuery($query);
    $method = $db->loadResult();
    if ((int) $method > 0) {
        return true;
    }
    return false;
}