Кнопка "подробнее о заказе" выдаёт пустую страницу.
Какую функцию и где прописать, чтобы кнопочка работала и выдавала информацию?
Ниже код класса обработчика.
Loc::loadMessages(__FILE__);
/**
* RaifHandler
* Class BillHandler
* @package Sale\Handlers\PaySystem
*/
class RaifHandler
extends PaySystem\BaseServiceHandler
implements PaySystem\IPdf
{
/**
* @param Sale\Payment $payment
* @param Request|null $request
* @return PaySystem\ServiceResult
* @throws \Bitrix\Main\ArgumentException
* @throws \Bitrix\Main\ArgumentNullException
* @throws \Bitrix\Main\LoaderException
* @throws \Bitrix\Main\NotImplementedException
*/
public function initiatePay(Sale\Payment $payment, Request $request = null)
{
$template = 'template';
if (array_key_exists('pdf', $_REQUEST)) {
$template .= '_pdf';
}
$extraParams = $this->getPreparedParams($payment, $request);
$this->setExtraParams($extraParams);
\CCurrencyLang::disableUseHideZero();
include __DIR__ . '/lib/Raif.php';
/** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
$paymentCollection = $payment->getCollection();
/** @var \Bitrix\Sale\Order $order */
$order = $paymentCollection->getOrder();
if ($paymentCollection->isPaid() === false) {
$class = new Raif("QR", []);
if (!isset($_SESSION['QR']) || $_SESSION['ORDER_ID'] != $order->getId()) {
$generate = $class->qrGenerate([
'order_id' => $order->getId(),
'price' => $order->getPrice(),
]);
$_SESSION['ORDER_ID'] = $order->getId();
$_SESSION['QR'] = $generate;
}
$orderProps = \Bitrix\Sale\Order::load($order->getId());
$orderCollection = $orderProps->getPropertyCollection();
$props = $orderCollection->getArray();
$propValue = $orderCollection->getItemByOrderPropertyId(96);
$propValue->setValue($_SESSION['QR']['qrId']);
$orderProps->save();
}
$link = "/order/payment/?ORDER_ID={$extraParams['TAXES'][0]['ORDER_ID']}&PAYMENT_ID={$extraParams['ACCOUNT_NUMBER']}";
$url = ((!empty($_SERVER['HTTPS'])) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$url = explode('?', $url);
$url = $url[0];
if ($_SERVER['REQUEST_URI'] != $link && $url == 'https://www.kubaninstrument.ru/order/') {
Header("Location: $link");
echo "<script type='text/javascript'>window.location.href = '$link';</script>";
}
return $this->showTemplate($payment, $template);
}
/**
* @param Sale\Payment $payment
* @param Request|null $request
* @return array
* @throws \Bitrix\Main\ArgumentException
* @throws \Bitrix\Main\ArgumentNullException
* @throws \Bitrix\Main\LoaderException
* @throws \Bitrix\Main\NotImplementedException
*/
protected function getPreparedParams(Sale\Payment $payment, Request $request = null)
{
/** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
$paymentCollection = $payment->getCollection();
/** @var \Bitrix\Sale\Order $order */
$order = $paymentCollection->getOrder();
$extraParams = array(
'ACCOUNT_NUMBER' => (IsModuleInstalled('intranet')) ? $order->getField('ACCOUNT_NUMBER') : $payment->getField('ACCOUNT_NUMBER'),
'CURRENCY' => $payment->getField('CURRENCY'),
'DATE_BILL' => $payment->getField('DATE_BILL'),
'SUM' => Sale\PriceMaths::roundPrecision($order->getPrice()),
'SUM_PAID' => Sale\PriceMaths::roundPrecision($paymentCollection->getPaidSum()),
'DISCOUNT_PRICE' => Sale\PriceMaths::roundPrecision($order->getDiscountPrice())
);
$taxes = $order->getTax();
$extraParams['TAXES'] = $taxes->getTaxList();
/** @var \Bitrix\Sale\ShipmentCollection $shipmentCollection */
$shipmentCollection = $order->getShipmentCollection();
/** @var \Bitrix\Sale\Shipment $shipment */
foreach ($shipmentCollection as $shipment)
{
if (!$shipment->isSystem())
{
$extraParams['DELIVERY_NAME'] = $shipment->getDeliveryName();
$extraParams['DELIVERY_PRICE'] = $shipment->getPrice();
$extraParams['DELIVERY_VAT_RATE'] = $shipment->getVatRate();
break;
}
}
$basket = $order->getBasket();
$extraParams['BASKET_ITEMS'] = array();
$userColumns = $this->getBusinessValue($payment, 'USER_COLUMNS');
$ids = array();
if ($userColumns !== null)
{
$extraParams['USER_COLUMNS'] = array();
$userColumns = unserialize($userColumns, ['allowed_classes' => false]);
if ($userColumns)
{
foreach ($userColumns as $id => $columns)
{
$extraParams['USER_COLUMNS']['PROPERTY_'.$id] = array(
'NAME' => $columns['NAME'],
'SORT' => $columns['SORT']
);
$ids[] = $id;
}
}
}
$productProps = [];
/** @var \Bitrix\Sale\BasketItem $basketItem */
foreach ($basket->getBasketItems() as $basketItem)
{
$productProps[$basketItem->getProductId()] = array();
$item = array(
'NAME' => $basketItem->getField("NAME"),
'IS_VAT_IN_PRICE' => $basketItem->isVatInPrice(),
'PRODUCT_ID' => $basketItem->getProductId(),
'PRICE' => $basketItem->getPrice(),
'VAT_RATE' => $basketItem->getVatRate(),
'QUANTITY' => $basketItem->getQuantity(),
'MEASURE_NAME' => $basketItem->getField("MEASURE_NAME"),
'CURRENCY' => $basketItem->getCurrency(),
);
$item['PROPS'] = array();
foreach ($basketItem->getPropertyCollection() as $basketPropertyItem)
{
$item['PROPS'][] = array(
'CODE' => $basketPropertyItem->getField('CODE'),
'NAME' => $basketPropertyItem->getField('NAME'),
'VALUE' => $basketPropertyItem->getField('VALUE')
);
}
$extraParams['BASKET_ITEMS'][$basketItem->getId()] = $item;
}
if ($ids && Loader::includeModule('crm') && Loader::includeModule('iblock'))
{
$productIdsByCatalogMap = [];
$dbRes = \CCrmProduct::GetList([], ['ID' => array_keys($productProps)], ['ID', 'CATALOG_ID']);
while ($data = $dbRes->Fetch())
{
$catalogId = isset($data['CATALOG_ID']) ? intval($data['CATALOG_ID']) : \CCrmCatalog::EnsureDefaultExists();
if (!isset($productIdsByCatalogMap[$catalogId]))
{
$productIdsByCatalogMap[$catalogId] = [];
}
$productIdsByCatalogMap[$catalogId][] = $data['ID'];
}
if ($productIdsByCatalogMap)
{
foreach ($productIdsByCatalogMap as $catalogId => $ids)
{
\CIBlockElement::GetPropertyValuesArray($productProps, $catalogId, array('ID' => $ids));
}
}
foreach ($extraParams['BASKET_ITEMS'] as $i => $row)
{
foreach ($productProps[$row['PRODUCT_ID']] as $property)
{
$extraParams['BASKET_ITEMS'][$i]['PROPERTY_'.$property['ID']] = $property['VALUE'];
}
}
}
return $extraParams;
}
/**
* @return array
*/
public function getCurrencyList()
{
return array('RUB');
}
/**
* @return bool
*/
public function isAffordPdf()
{
return true;
}
/**
* @return array
* @throws \Bitrix\Main\LoaderException
* @throws \Bitrix\Main\ObjectException
*/
public function getDemoParams()
{
return [];
}
/**
* @param Payment $payment
* @return mixed|string
* @throws \Bitrix\Main\ArgumentException
* @throws \Bitrix\Main\ArgumentNullException
* @throws \Bitrix\Main\LoaderException
* @throws \Bitrix\Main\NotImplementedException
*/
public function getContent(Payment $payment)
{
return $result->getTemplate();
}
/**
* @param Payment $payment
* @return array|bool|false|mixed|null
* @throws \Bitrix\Main\ObjectException
*/
public function getFile(Payment $payment)
{
}
/**
* @param Payment $payment
* @return mixed
*/
public function isGenerated(Payment $payment)
{
return true;
}
}