Esempio n. 1
0
    }
}
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"])) {
    $settings[$SITE_ID] = array_merge($settings[$SITE_ID], $_POST["EBAY_SETTINGS"]);
    $bSaved = $ebay->saveSettings($settings);
}
$siteSettings = $settings[$SITE_ID];
$details = new \Bitrix\Sale\TradingPlatform\Ebay\Api\Details($SITE_ID);
unset($settings);
$arDeliveryList = Helper::getDeliveryList($SITE_ID);
$arTabs = array(array("DIV" => "policy_default", "TAB" => Loc::getMessage("SALE_EBAY_TAB_DEFAULT"), "TITLE" => Loc::getMessage("SALE_EBAY_TAB_DEFAULT_TITLE")), array("DIV" => "policy_payment", "TAB" => Loc::getMessage("SALE_EBAY_TAB_PAYMENT"), "TITLE" => Loc::getMessage("SALE_EBAY_TAB_PAYMENT_TITLE")), array("DIV" => "policy_shipping", "TAB" => Loc::getMessage("SALE_EBAY_TAB_SHIPPING"), "TITLE" => Loc::getMessage("SALE_EBAY_TAB_SHIPPING_TITLE")));
$tabControl = new CAdminTabControl("tabControl", $arTabs);
$policy = null;
if (isset($siteSettings["API"]["AUTH_TOKEN"]) && strlen($siteSettings["API"]["AUTH_TOKEN"]) > 0) {
    $policy = new \Bitrix\Sale\TradingPlatform\Ebay\Policy($siteSettings["API"]["AUTH_TOKEN"], $SITE_ID);
} elseif (!isset($siteSettings["API"]["AUTH_TOKEN"]) || strlen($siteSettings["API"]["AUTH_TOKEN"]) <= 0) {
    $errorMsg = "You must set API token first!\n";
}
$APPLICATION->SetTitle(Loc::getMessage("SALE_EBAY_TITLE"));
require_once $DOCUMENT_ROOT . BX_ROOT . "/modules/main/include/prolog_admin_after.php";
if (strlen($errorMsg) > 0) {
    CAdminMessage::ShowMessage(array("MESSAGE" => $errorMsg, "TYPE" => "ERROR"));
}
if ($bSaved) {
    CAdminMessage::ShowMessage(array("MESSAGE" => GetMessage("SALE_EBAY_SETTINGS_SAVED"), "TYPE" => "OK"));
Esempio n. 2
0
        public function getHtml()
        {
            $result = '';
            $details = new \Bitrix\Sale\TradingPlatform\Ebay\Api\Details($this->siteId);
            if ($details) {
                $arDeliveryList = Helper::getDeliveryList($this->siteId);
                foreach ($details->getListShipping() as $service => $serviceDescription) {
                    $result .= '
					<tr>
						<td>' . $serviceDescription . ':</td>
						<td>
							<select name="EBAY_SETTINGS[MAPS][SHIPMENT][' . $service . ']">
								<option value="">' . Loc::getMessage('SALE_EBAY_W_STEP_SHP_LINK_NOT_SET') . '</option>';
                    foreach ($arDeliveryList as $deliveryId => $deliveryName) {
                        $result .= '<option value="' . $deliveryId . '"' . (isset($this->ebaySettings[$this->siteId]["MAPS"]["SHIPMENT"][$service]) && $this->ebaySettings[$this->siteId]["MAPS"]["SHIPMENT"][$service] == $deliveryId ? " selected" : "") . '>' . $deliveryName . '</option>';
                    }
                    $result .= '
							</select>
						</td>
					</tr>
					';
                }
                $result = '<table>' . $result . '</table>' . '<br><br><hr><br>' . Loc::getMessage('SALE_EBAY_W_STEP_SHP_LINK_DESCR') . '.';
            }
            return $result;
        }