Last active
June 18, 2021 11:01
-
-
Save iruslanalexan/2ac8761cacde4b21b8dd9609d9a1bf15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* 1. записывать в куки виды текущего пользователя | |
* 2. Создать собственную сущность c записью форматированный либо расширенной информации от пользователя через ORM | |
* 3. На эвенте "оформление заказа" либо "отправка письма менеджеру после оформления заказа" | |
* генерировать список просмотренных страниц CListPageUserVisited->getListPages() | |
*/ | |
use Bitrix\Sale; | |
if (!class_exists('CHit')) { | |
\Bitrix\Main\Loader::includeModule('statistic'); | |
} | |
$idSaleUser = Sale\Fuser::getId(); | |
class CListPageUserVisited | |
{ | |
public $user_id = 0; | |
public $saleuser_id = 0; | |
protected $orderby = 'DESC'; | |
function __construct($saleuser_id) | |
{ | |
$this->saleuser_id = $saleuser_id; | |
$this->getIDuser(); | |
} | |
function getIDuser() | |
{ | |
$resUsers = Sale\Internals\FuserTable::getList(array( | |
'filter' => array( | |
'ID' => $this->saleuser_id | |
), | |
'select' => array( | |
'USER_ID' | |
), | |
'order' => array('ID' => "DESC") | |
))->fetch(); | |
$this->user_id = !empty($resUsers) ? $resUsers['USER_ID'] : 0; | |
return true; | |
} | |
function getListPages() | |
{ | |
$arResult = []; | |
$arFilter = $this->user_id > 0 ? $arFilter['USER_ID'] = $this->user_id : []; | |
$rsData = CHit::GetList( | |
'ID', | |
$this->orderby, | |
$arFilter | |
); | |
while ($arRes = $rsData->Fetch()) { | |
$arResult[$arRes['ID']] = $arRes; | |
} | |
return $arResult; | |
} | |
} | |
/* | |
array ( | |
'ID' => '62', | |
'SESSION_ID' => '6', | |
'GUEST_ID' => '5', | |
'NEW_GUEST' => 'Y', | |
'USER_ID' => '0', | |
'USER_AUTH' => 'N', | |
'URL' => 'http://', | |
'URL_404' => 'N', | |
'URL_FROM' => '', | |
'IP' => '', | |
'METHOD' => '', | |
'COOKIES' => '', | |
'USER_AGENT' => '', | |
'STOP_LIST_ID' => '0', | |
'COUNTRY_ID' => 'N0', | |
'CITY_ID' => '1', | |
'REGION_NAME' => NULL, | |
'CITY_NAME' => NULL, | |
'SITE_ID' => 's1', | |
'DATE_HIT' => '18.06.2021 13:47:42', | |
) | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment