/** * 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; }
function OnInit($args) { $result = array(); $res = \Bitrix\Sale\TradingPlatformTable::getList(array('select' => array("ID", "CODE", "CATALOG_SECTION_TAB_CLASS_NAME"), 'filter' => array('=ACTIVE' => 'Y'))); while ($arRes = $res->fetch()) { if (strlen($arRes["CATALOG_SECTION_TAB_CLASS_NAME"]) > 0 && class_exists($arRes["CATALOG_SECTION_TAB_CLASS_NAME"])) { $tabHandler = new $arRes["CATALOG_SECTION_TAB_CLASS_NAME"](); if (!$tabHandler instanceof TabHandler) { throw new SystemException("TabHandler (" . $arRes["CODE"] . ") has wrong instance. (" . __CLASS__ . "::" . __METHOD__ . ")"); } self::$tabHandlers[$arRes["CODE"]] = $tabHandler; } } if (!empty(self::$tabHandlers)) { //todo: iblock filter $result = array("TABSET" => "SALE_TRADING_PLATFORM", "GetTabs" => array("\\Bitrix\\Sale\\TradingPlatform\\CatalogSectionTab", "GetTabs"), "ShowTab" => array("\\Bitrix\\Sale\\TradingPlatform\\CatalogSectionTab", "ShowTab"), "Action" => array("\\Bitrix\\Sale\\TradingPlatform\\CatalogSectionTab", "Action"), "Check" => array("\\Bitrix\\Sale\\TradingPlatform\\CatalogSectionTab", "Check")); } return $result; }
/** * @return bool Is deletion successful?. */ public function uninstall() { if ($this->isInstalled()) { $this->unsetActive(); $res = TradingPlatformTable::delete($this->getId()); } else { $res = new Result(); } unset(self::$instances[$this->getCode()]); $this->isInstalled = false; return $res->isSuccess(); }