- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/helpers/order.php
- Класс: BitrixSaleHelpersOrder
- Вызов: Order::getPublicLink
static function getPublicLink(SaleOrder $order)
{
$context = Application::getInstance()->getContext();
$scheme = $context->getRequest()->isHttps() ? 'https' : 'http';
$siteData = SiteTable::getList(array(
'filter' => array('LID' => $order->getSiteId()),
));
$site = $siteData->fetch();
$paths = unserialize(Option::get("sale", "allow_guest_order_view_paths"), ['allowed_classes' => false]);
$path = htmlspecialcharsbx($paths[$site['LID']]);
if (isset($path) && mb_strpos($path, '#order_id#'))
{
$accountNumber = urlencode(urlencode($order->getField('ACCOUNT_NUMBER')));
$path = str_replace('#order_id#', $accountNumber,$path);
if (mb_strpos($path, '/') !== 0)
{
$path = '/'.$path;
}
$path .= (mb_strpos($path, '?')) ? '&' : "?";
$path .= "access=".$order->getHash();
}
else
{
return "";
}
return $scheme.'://'.$site['SERVER_NAME'].$path;
}