Back to PhocacartAccessRights class

Method canDisplayAddtocartPrice

public
canDisplayAddtocartPrice
(mixed $item, mixed $price)

Method canDisplayAddtocartPrice - Source code

public function canDisplayAddtocartPrice($item, $price)
{
    if ($this->canDisplayAddtocart()) {
        if (isset($item->id) && (int) $item->id > 0) {
            $hide_add_to_cart_zero_price = $this->params->get('hide_add_to_cart_zero_price', 0);
            if ($hide_add_to_cart_zero_price == 1 && $price < 0.01) {
                // PhocacartLog::add(3, 'Warning', $item->id, 'Product could not be added to cart or ordered because its price is zero and option \'Hide Add To Cart Button (Zero Price)\' is enabled' . ' ' . JText::_('COM_PHOCACART_PRODUCT') . ': ' . $item->title);
                return false;
            } else {
                return true;
            }
        }
    }
    return false;
}