예제 #1
0
                    $queue->sendData();
                }
                $arResult["COMPLETED"] = true;
            } catch (\Bitrix\Sale\TradingPlatform\TimeIsOverException $e) {
                $arResult["END_POS"] = $e->getEndPosition();
            } catch (\Exception $e) {
                Ebay::log(Logger::LOG_LEVEL_ERROR, "EBAY_FEED_ERROR", $type, $e->getMessage(), $siteId);
                $arResult["ERROR"] = $e->getMessage();
            }
            break;
        case "refreshCategoriesData":
            $categories = new \Bitrix\Sale\TradingPlatform\Ebay\Api\Categories($siteId);
            $arResult["COUNT"] = $categories->refreshTableData();
            break;
        case "refreshCategoriesPropsData":
            $categoriesProps = new \Bitrix\Sale\TradingPlatform\Ebay\Api\Categories($siteId);
            $arResult["COUNT"] = $categoriesProps->refreshVariationsTableData();
            break;
        default:
            $arResult["ERROR"] = "Wrong action";
            break;
    }
} else {
    if (strlen($arResult["ERROR"]) <= 0) {
        $arResult["ERROR"] = "Access denied";
    }
}
if (isset($arResult["ERROR"])) {
    $arResult["RESULT"] = "ERROR";
} else {
    $arResult["RESULT"] = "OK";
예제 #2
0
파일: helper.php 프로젝트: Satariall/izurit
 /**
  * Returns category variations.
  * If variations no found in table get them through API and saves to table.
  * @param string $ebayCategoryId Ebay category id.
  * @param string $siteId Sitte id.
  * @param bool $localInfoOnly Get it from Ebay site if not found in table.
  * @return array
  */
 public static function getEbayCategoryVariations($ebayCategoryId, $siteId, $localInfoOnly = false)
 {
     $result = array();
     $categoriesVarResult = CategoryVariationTable::getList(array('select' => array('ID', 'NAME', 'REQUIRED'), 'order' => array('NAME' => 'ASC'), 'filter' => array("=CATEGORY_ID" => $ebayCategoryId), 'group' => array('NAME')));
     while ($var = $categoriesVarResult->fetch()) {
         $result[$var['ID']] = $var;
     }
     if (empty($result) && !$localInfoOnly) {
         $categories = new \Bitrix\Sale\TradingPlatform\Ebay\Api\Categories($siteId);
         $rfrCount = $categories->refreshVariationsTableData(array($ebayCategoryId));
         if (intval($rfrCount) > 0) {
             $result = self::getEbayCategoryVariations($ebayCategoryId, $siteId, true);
         }
     }
     return $result;
 }