Back to PhocacartPos class

Method isPos

public static
isPos
(mixed $forcePos = 0)

Method isPos - Source code

public static function isPos($forcePos = 0)
{
    // We check if we are located in POS view or POS controller
    $isView = PhocacartUtils::isView('pos');
    $isTypeView = PhocacartUtils::isTypeView('Pos');
    $isController = PhocacartUtils::isController('pos');
    if (!PhocacartPos::isPosEnabled()) {
        if ($isView || $isTypeView || $isController) {
            // Return the error info only in case of POS view or controller
            $app = Factory::getApplication();
            $app->enqueueMessage(Text::_('COM_PHOCACART_POS_IS_DISABLED'), 'error');
        }
        return false;
    }
    if ($forcePos) {
        // We are not located in POS view but we ask some view
        // where we need POS rules (for example - in POS we are ask Order view
        // to display invoices)
        return true;
    } else {
        if ($isView || $isTypeView || $isController) {
            return true;
        }
        return false;
    }
    return false;
}