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/cvetdv.ru/bitrix/modules/yandex.market/lib/export/promogift/ |
Upload File : |
<?php namespace Yandex\Market\Export\PromoGift; use Yandex\Market; use Yandex\Market\Watcher; use Yandex\Market\Export\Glossary; class Model extends Market\Export\PromoProduct\Model { public static function getDataClass() { return Table::class; } public function getTagDescriptionList($offerPrimarySource = null) { if (empty($offerPrimarySource)) { $offerPrimarySource = [ 'TYPE' => Market\Export\Entity\Manager::TYPE_IBLOCK_OFFER_FIELD, 'FIELD' => 'ID' ]; } return [ [ 'TAG' => 'promo-gift', 'VALUE' => null, 'ATTRIBUTES' => [ 'offer-id' => $offerPrimarySource, 'gift-id' => $offerPrimarySource, ], 'SETTINGS' => null ] ]; } public function getSourceSelect() { $context = $this->getContext(true); $fieldSource = ( $context['HAS_OFFER'] ? Market\Export\Entity\Manager::TYPE_IBLOCK_OFFER_FIELD : Market\Export\Entity\Manager::TYPE_IBLOCK_ELEMENT_FIELD ); return [ $fieldSource => [ 'NAME', 'PREVIEW_PICTURE', 'DETAIL_PICTURE' ] ]; } public function getSetupBindEntities(Market\Export\Setup\Model $setup) { $context = $this->getContext(); if ( !$this->isExportExternalGift($context) || $setup->getIblockLinkCollection()->getByIblockId($context['IBLOCK_ID']) !== null ) { return []; } $result = [ new Watcher\Track\BindEntity(Glossary::ENTITY_OFFER, $context['IBLOCK_ID'], Glossary::ENTITY_GIFT, $setup->getId()), ]; if ($context['HAS_OFFER']) { $result[] = new Watcher\Track\BindEntity(Glossary::ENTITY_OFFER, $context['OFFER_IBLOCK_ID'], Glossary::ENTITY_GIFT, $setup->getId()); } return $result; } public function getContext($isOnlySelf = false) { $result = parent::getContext($isOnlySelf); $result['EXPORT_GIFT'] = $this->isExportExternalGift($result); return $result; } protected function isExportExternalGift(array $context) { if ($this->discount !== null) { $result = (bool)$this->discount->isExportExternalGift($context); } else { $result = ((string)$this->getField('EXPORT_GIFT') !== Table::BOOLEAN_N); } return $result; } protected function getDiscountProductFilterList($context) { $result = []; if ($this->discount !== null) { $result = $this->discount->getGiftFilterList($context); } return $result; } }