Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
order.php
1<?php
2namespace Bitrix\Sale\Helpers;
3
8
9class Order
10{
19 public static function isAllowGuestView(Sale\Order $order)
20 {
21 $guestStatuses = Option::get("sale", "allow_guest_order_view_status", "");
22 $guestStatuses = ($guestStatuses <> '') ? unserialize($guestStatuses, ['allowed_classes' => false]) : array();
23 return (is_array($guestStatuses) && in_array($order->getField('STATUS_ID'), $guestStatuses) && Option::get("sale", "allow_guest_order_view") === 'Y');
24 }
25
35 public static function getPublicLink(Sale\Order $order)
36 {
37 $context = Application::getInstance()->getContext();
38 $scheme = $context->getRequest()->isHttps() ? 'https' : 'http';
39 $siteData = SiteTable::getList(array(
40 'filter' => array('LID' => $order->getSiteId()),
41 ));
42 $site = $siteData->fetch();
43
44 $paths = unserialize(Option::get("sale", "allow_guest_order_view_paths"), ['allowed_classes' => false]);
45 $path = htmlspecialcharsbx($paths[$site['LID']]);
46
47 if (isset($path) && mb_strpos($path, '#order_id#'))
48 {
49 $accountNumber = urlencode(urlencode($order->getField('ACCOUNT_NUMBER')));
50 $path = str_replace('#order_id#', $accountNumber,$path);
51 if (mb_strpos($path, '/') !== 0)
52 {
53 $path = '/'.$path;
54 }
55
56 $path .= (mb_strpos($path, '?')) ? '&' : "?";
57 $path .= "access=".$order->getHash();
58 }
59 else
60 {
61 return "";
62 }
63
64 return $scheme.'://'.$site['SERVER_NAME'].$path;
65 }
66}
static getPublicLink(Sale\Order $order)
Definition order.php:35
static isAllowGuestView(Sale\Order $order)
Definition order.php:19