Пример #1
0
 /**
  * Installs all necessary stuff for Ebay.
  * @return bool
  */
 public function install()
 {
     RegisterModuleDependences('main', 'OnEventLogGetAuditTypes', 'sale', '\\Bitrix\\Sale\\TradingPlatform\\Ebay\\Helper', 'OnEventLogGetAuditTypes');
     $tptAddRes = \Bitrix\Sale\TradingPlatformTable::add(array("CODE" => $this->getCode(), "ACTIVE" => "N", "NAME" => Loc::getMessage("SALE_EBAY_NAME"), "DESCRIPTION" => Loc::getMessage("SALE_EBAY_DESCRIPTION"), "CATALOG_SECTION_TAB_CLASS_NAME" => '\\Bitrix\\Sale\\TradingPlatform\\Ebay\\CatalogSectionTabHandler', "CLASS" => '\\Bitrix\\Sale\\TradingPlatform\\Ebay\\Ebay'));
     $ebay = Ebay::getInstance();
     $catMapEntRes = \Bitrix\Sale\TradingPlatform\MapEntityTable::add(array("TRADING_PLATFORM_ID" => $ebay->getId(), "CODE" => "CATEGORY"));
     $eventRes = Helper::installEvents();
     $fsRes = Helper::createFeedFileStructure();
     return $tptAddRes->isSuccess() && $catMapEntRes->isSuccess() && $eventRes && $fsRes;
 }
Пример #2
0
 /**
  * @param string $mapEntityCode Map entity code
  * @return int Map entity id.
  * @throws \Bitrix\Main\SystemException
  */
 protected static function getMapEntityId($mapEntityCode)
 {
     $result = 0;
     $ebay = Ebay::getInstance();
     $fields = array("TRADING_PLATFORM_ID" => $ebay->getId(), "CODE" => $mapEntityCode);
     $catMapVarEntRes = MapEntityTable::getList(array("filter" => $fields));
     if ($arCatVarMapEnt = $catMapVarEntRes->fetch()) {
         $result = $arCatVarMapEnt["ID"];
     } else {
         $addRes = MapEntityTable::add($fields);
         if ($addRes->isSuccess()) {
             $result = $addRes->getId();
         }
     }
     if ($result <= 0) {
         throw new SystemException("Can' t get map entity id for code: " . $mapEntityCode . ".");
     }
     return $result;
 }