Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/php_interface/wbs24.lib/lib/LetterLink/ |
Upload File : |
<?php namespace Wbs24\Lib\LetterLink; use Bitrix\Main\Loader; class Handlers { public static function OnBeforeEventAddHandler(&$event, &$lid, &$arFields) { if ($event == 'NEW_ONE_CLICK_BUY') { $productNames = []; $newProductNames = []; $basket = \Bitrix\Sale\Order::load($arFields['RS_ORDER_ID'])->getBasket(); $basketItems = $basket->getBasketItems(); foreach ($basketItems as $basketItem) { $productName = [ 'ID' => $basketItem->getField('PRODUCT_ID'), 'NAME' => 'Название: '.$basketItem->getField('NAME').', цена за единицу: '.$basketItem->getPrice().' ₽, количество: '.$basketItem->getQuantity().', стоимость: '.$basketItem->getFinalPrice().' ₽', ]; $productNames[] = $productName; } if (!\Bitrix\Main\Loader::includeModule("iblock")) return; $el = new \CIBlockElement(); foreach ($productNames as $productName) { $filter = ["ID" => $productName['ID']]; $select = ["ID", "NAME", "DETAIL_PAGE_URL", "LID"]; $result = $el->GetList(["SORT" => "ASC"], $filter, false, false, $select); if ($fields = $result->GetNext()) { if ($fields["LID"] == 's1') { $newProductName = "<a href='https://ilovecveti.ru".$fields["DETAIL_PAGE_URL"]."'>".$productName['NAME']."</a><br>"; } elseif ($fields["LID"] == 's2') { $newProductName = "<a href='https://rospirotorg.ru".$fields["DETAIL_PAGE_URL"]."'>".$productName['NAME']."</a><br>"; } elseif ($fields["LID"] == 's3') { $newProductName = "<a href='https://cvetdv.ru".$fields["DETAIL_PAGE_URL"]."'>".$productName['NAME']."</a><br>"; } } $newProductNames[] = $newProductName; } $arFields["PRODUCT_NAME"] = $newProductNames; } } }