/** * Clear compare items by condition * * @return $this */ public function clear() { $this->_catalogProductCompareItem->clearItems($this->getVisitorId(), $this->getCustomerId()); $this->_eventManager->dispatch('catalog_product_compare_item_collection_clear'); return $this; }
/** * Check has compare items by visitor/customer * * @param int $customerId * @param int $visitorId * @return bool */ public function hasItems($customerId, $visitorId) { return (bool) $this->_catalogProductCompareItem->getCount($customerId, $visitorId); }