Exemple #1
0
 public function save()
 {
     if (!empty($this->ebaySettings[$this->siteId]["FEEDS"])) {
         $this->ebaySettings[$this->siteId]["FEEDS"] = \Bitrix\Sale\TradingPlatform\Ebay\Agent::update($this->siteId, $this->ebaySettings[$this->siteId]["FEEDS"]);
     }
     return parent::save();
 }
Exemple #2
0
$defaultSite = "";
$rsSites = CSite::GetList($by = "sort", $order = "asc", array("ACTIVE" => "Y"));
while ($arRes = $rsSites->Fetch()) {
    $siteList[$arRes['ID']] = $arRes['NAME'];
    if ($arRes["DEF"] == "Y") {
        $defaultSite = $arRes['ID'];
    }
}
if (isset($_POST["SITE_ID"]) && array_key_exists($_POST["SITE_ID"], $siteList)) {
    $SITE_ID = $_POST["SITE_ID"];
} else {
    $SITE_ID = $defaultSite;
}
$settings = $ebay->getSettings();
if (isset($_POST["EBAY_SETTINGS"]) && is_array($_POST["EBAY_SETTINGS"])) {
    $_POST["EBAY_SETTINGS"]["FEEDS"] = \Bitrix\Sale\TradingPlatform\Ebay\Agent::update($SITE_ID, $_POST["EBAY_SETTINGS"]["FEEDS"]);
    $settings[$SITE_ID] = array_merge($settings[$SITE_ID], $_POST["EBAY_SETTINGS"]);
    $bSaved = $ebay->saveSettings($settings);
}
$siteSettings = $settings[$SITE_ID];
unset($settings);
$ebayCategoriesCount = 0;
$ebayCategoriesUpdateDate = "";
$res = \Bitrix\Sale\TradingPlatform\Ebay\CategoryTable::getList(array("select" => array("CNT", "LAST_UPDATE"), "runtime" => array(new \Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(1)'), new \Bitrix\Main\Entity\ExpressionField('LAST_UPDATE', 'MAX(LAST_UPDATE)'))));
if ($cat = $res->fetch()) {
    if (!empty($cat["CNT"])) {
        $ebayCategoriesCount = $cat["CNT"];
    }
    if (!empty($cat["LAST_UPDATE"])) {
        $ebayCategoriesUpdateDate = $cat["LAST_UPDATE"]->toString();
    }