This file contains hidden or 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
| namespace Shell\Service; | |
| use GuzzleHttp\Exception\ClientException; | |
| use Psr\Log\LoggerInterface; | |
| class DeliveryService | |
| { | |
| private $logger; |
This file contains hidden or 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
| $ftpPath = trim(\Bitrix\Main\Config\Option::get("grain.customsettings","ftp_path"), '/'); | |
| $rs = FileTable::getList([ | |
| 'filter' => ['ID' => $lastProduct['PROPERTY_IMAGES_VALUE']], | |
| 'select' => ['ID', 'SUBDIR', 'ORIGINAL_NAME', 'FILE_NAME'], | |
| ]); | |
| while ($fileInfo = $rs->Fetch()) { | |
| $newFileName = str_replace($lastProduct['CODE'], $modelCode, $fileInfo['ORIGINAL_NAME']); | |
| copy($_SERVER["DOCUMENT_ROOT"] . $ftpPath . '/' . $newFileName, $_SERVER["DOCUMENT_ROOT"] . 'upload/' . $fileInfo['SUBDIR'] . '/' . $fileInfo['FILE_NAME']); | |
| $filesTable[$fileInfo["ID"]] = $fileInfo; | |
| } |
This file contains hidden or 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
| protected function indexModels($arFilter, $indexToReindex = false, $deleteNotExistsOffers = false) | |
| { | |
| if ($indexToReindex) { | |
| $index = $indexToReindex; | |
| } else { | |
| $index = $this->index; | |
| } | |
| // получим товары | |
| $arModels = $this->getModels($arFilter); |
This file contains hidden or 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
| На всякий случай: | |
| http://epages.su/blog/dobavlenie-v-rezultat-poiska-1s-bitriks-neaktivnye-elementy-infobloka.html | |
| https://bxapi.ru/src/?module_id=iblock&name=CIBlock%3A%3AOnSearchReindex |
This file contains hidden or 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
| $entity = \Bitrix\Iblock\Model\Section::compileEntityByIblock(IB_Catalog); | |
| $section = $entity::getList(array( | |
| 'select' => | |
| [ | |
| 'ID', | |
| 'CODE', | |
| 'IBLOCK_ID', | |
| 'DETAIL_PICTURE', | |
| 'PICTURE', | |
| 'UF_ICON', |
This file contains hidden or 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
| Array | |
| ( | |
| [index] => products | |
| [type] => models | |
| [sort] => Array | |
| ( | |
| [0] => SORT:desc | |
| ) | |
| [body] => Array |
This file contains hidden or 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
| $offerId = 1648187; | |
| $productId = 2758189; | |
| CIBlockElement::SetPropertyValuesEx($offerId, IB_TradeOffers, array("SKU_PROPERTY_ID" => $productId)); |
This file contains hidden or 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
| use Bitrix\Main\Entity\Event; | |
| use Aero\Tools\Module; | |
| public static function onAfterUpdate(Event $event) | |
| { | |
| \BXClearCache(); | |
| } |
This file contains hidden or 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
| function getCsvData($fileName) | |
| { | |
| $fp = fopen($fileName, 'r'); | |
| $head = fgetcsv($fp, 4096, ';', '"'); | |
| $res = array(); | |
| $counter = 1; | |
| while ($column = fgetcsv($fp, 0, ';', '"')) { | |
| $counter++; | |
| $column = array_combine($head, $column); | |
| $res[] = $column; |
This file contains hidden or 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
| $db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter, false, ["nTopCount" => 1], ["ID", "STATUS_ID"]); | |
| if($sale = $db_sales->Fetch()) | |
| { | |
| $lastOrderId = $sale["ID"]; | |
| $arProps = array(); | |
| $orderProps = CSaleOrderPropsValue::GetList( | |
| [], | |
| array( | |
| "ORDER_ID" => $lastOrderId, | |
| "CODE" => ["DELIVERY_SHOP_ID"] |
NewerOlder