public function addItem($id = 0, $catid = 0)
{
if ($id > 0) {
$app = Factory::getApplication();
$count = count($this->items);
if ($count > 2) {
$message = Text::_('COM_PHOCACART_ONLY_THREE_PRODUCTS_CAN_BE_LISTED_IN_COMPARISON_LIST');
$app->enqueueMessage($message, 'error');
return false;
}
if (isset($this->items[$id]) && (int) $this->items[$id] > 0) {
$message = Text::_('COM_PHOCACART_PRODUCT_INCLUDED_IN_COMPARISON_LIST');
$app->enqueueMessage($message, 'error');
return false;
} else {
$this->items[$id]['id'] = $id;
$this->items[$id]['catid'] = $catid;
$session = Factory::getSession();
$session->set('compare', $this->items, 'phocaCart');
}
return true;
}
return false;
}