40 $this->_scopeConfig = $scopeConfig;
51 $this->
_init(
'report_event',
'event_id');
69 [
'subject_id' => (
int)
$customerId,
'subtype' => 0],
70 [
'subject_id = ?' => (
int) $visitorId,
'subtype = ?' => 1,
'event_type_id IN(?)' => $types]
95 $idFieldName =
$collection->getResource()->getIdFieldName();
101 [
'event_id' =>
new \
Zend_Db_Expr(
'MAX(event_id)'),
'object_id']
103 ->where(
'event_type_id = ?', (
int) $eventTypeId)
104 ->where(
'subject_id = ?', (
int) $eventSubjectId)
105 ->where(
'subtype = ?', (
int) $subtype)
107 ->group(
'object_id');
110 if (!is_array($skipIds)) {
111 $skipIds = [(int) $skipIds];
113 $derivedSelect->where(
'object_id NOT IN(?)', $skipIds);
118 "{$idFieldName} = evt.object_id",
120 )->order(
'evt.event_id ' . \
Magento\Framework\DB\Select::SQL_DESC);
135 if ($this->_storeManager->getStore()->getId() == 0) {
136 if (
null !== $predefinedStoreIds) {
139 foreach ($this->_storeManager->getStores() as
$store) {
145 $productsScope = $this->_scopeConfig->getValue(
146 'catalog/recently_products/scope',
147 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE
149 switch ($productsScope) {
151 $resourceStore = $this->_storeManager->getStore()->getWebsite()->getStores();
154 $resourceStore = $this->_storeManager->getStore()->getGroup()->getStores();
157 $resourceStore = [$this->_storeManager->getStore()];
161 foreach ($resourceStore as
$store) {
186 [
'visitor_table' => $this->
getTable(
'customer_visitor')],
187 'event_table.subject_id = visitor_table.visitor_id',
189 )->where(
'visitor_table.visitor_id IS NULL')
190 ->where(
'event_table.subtype = ?', 1)
updateCustomerType(\Magento\Reports\Model\Event $model, $visitorId, $customerId, $types=[])
_init($mainTable, $idFieldName)
clean(\Magento\Reports\Model\Event $object)
getCurrentStoreIds(array $predefinedStoreIds=null)
applyLogToCollection(\Magento\Framework\Data\Collection\AbstractDb $collection, $eventTypeId, $eventSubjectId, $subtype, $skipIds=[])
__construct(\Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, $connectionName=null)