本文整理汇总了PHP中CSaleDelivery::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleDelivery::Add方法的具体用法?PHP CSaleDelivery::Add怎么用?PHP CSaleDelivery::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleDelivery
的用法示例。
在下文中一共展示了CSaleDelivery::Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (IntVal($locationGroupID) > 0) {
$arLocation4Delivery[] = array("LOCATION_ID" => $locationGroupID, "LOCATION_TYPE" => "G");
}
$dbDelivery = CSaleDelivery::GetList(array(), array("LID" => WIZARD_SITE_ID));
if (!$dbDelivery->Fetch()) {
//delivery handler
$arFields = array("NAME" => GetMessage("SALE_WIZARD_COUR"), "LID" => WIZARD_SITE_ID, "PERIOD_FROM" => 0, "PERIOD_TO" => 0, "PERIOD_TYPE" => "D", "WEIGHT_FROM" => 0, "WEIGHT_TO" => 0, "ORDER_PRICE_FROM" => 0, "ORDER_PRICE_TO" => 0, "ORDER_CURRENCY" => $defCurrency, "ACTIVE" => "Y", "PRICE" => $bRus ? "500" : "30", "CURRENCY" => $defCurrency, "SORT" => 100, "DESCRIPTION" => GetMessage("SALE_WIZARD_COUR_DESCR"), "LOCATIONS" => $arLocation4Delivery);
if ($delivery["courier"] != "Y") {
$arFields["ACTIVE"] = "N";
}
CSaleDelivery::Add($arFields);
$arFields = array("NAME" => GetMessage("SALE_WIZARD_COUR1"), "LID" => WIZARD_SITE_ID, "PERIOD_FROM" => 0, "PERIOD_TO" => 0, "PERIOD_TYPE" => "D", "WEIGHT_FROM" => 0, "WEIGHT_TO" => 0, "ORDER_PRICE_FROM" => 0, "ORDER_PRICE_TO" => 0, "ORDER_CURRENCY" => $defCurrency, "ACTIVE" => "Y", "PRICE" => 0, "CURRENCY" => $defCurrency, "SORT" => 200, "DESCRIPTION" => GetMessage("SALE_WIZARD_COUR1_DESCR"), "LOCATIONS" => $arLocation4Delivery);
if ($delivery["self"] != "Y") {
$arFields["ACTIVE"] = "N";
}
CSaleDelivery::Add($arFields);
}
$dbDelivery = CSaleDeliveryHandler::GetList();
if (!$dbDelivery->Fetch()) {
if ($bRus) {
$arFields = array("LID" => "", "ACTIVE" => "N", "HID" => "cpcr", "NAME" => GetMessage("SALE_WIZARD_SPSR"), "SORT" => 100, "DESCRIPTION" => GetMessage("SALE_WIZARD_SPSR_DESCR"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_cpcr.php", "SETTINGS" => "8", "PROFILES" => "", "TAX_RATE" => 0);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif")) {
$arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif");
}
CSaleDeliveryHandler::Set("cpcr", $arFields);
$arFields = array("LID" => "", "ACTIVE" => "Y", "HID" => "russianpost", "NAME" => GetMessage("SALE_WIZARD_MAIL"), "SORT" => 200, "DESCRIPTION" => "", "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_russianpost.php", "SETTINGS" => "23", "PROFILES" => "", "TAX_RATE" => 0);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif")) {
$arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif");
}
if ($delivery["russianpost"] != "Y") {
$arFields["ACTIVE"] = "N";
示例2: convertToNew
/**
* @param bool|false $renameTable
* @return \Bitrix\Sale\Result
* @throws Exception
* @throws \Bitrix\Main\ArgumentException
* @internal
*/
public static function convertToNew($renameTable = false)
{
$result = new \Bitrix\Sale\Result();
$con = \Bitrix\Main\Application::getConnection();
if (!$con->isTableExists("b_sale_delivery")) {
return $result;
}
if (!$con->isTableExists("b_sale_delivery2location_tmp")) {
$fields = $con->getTableFields('b_sale_delivery2location');
$con->createTable('b_sale_delivery2location_tmp', $fields, array('DELIVERY_ID', 'LOCATION_CODE', 'LOCATION_TYPE'));
$con->queryExecute('
INSERT INTO
b_sale_delivery2location_tmp(DELIVERY_ID, LOCATION_CODE, LOCATION_TYPE)
SELECT
DELIVERY_ID, LOCATION_CODE, LOCATION_TYPE FROM b_sale_delivery2location
');
$con->queryExecute('DELETE FROM b_sale_delivery2location');
}
$sqlHelper = $con->getSqlHelper();
$deliveryRes = $con->query('SELECT * FROM b_sale_delivery WHERE CONVERTED != \'Y\'');
while ($delivery = $deliveryRes->fetch()) {
$delivery["CODE"] = $delivery["ID"];
unset($delivery["ID"]);
$newId = \CSaleDelivery::Add($delivery);
if (intval($newId) <= 0) {
$result->addError(new \Bitrix\Main\Entity\EntityError("Can't convert old delivery id: " . $delivery["CODE"]));
continue;
}
$res = \Bitrix\Sale\Delivery\Restrictions\Table::add(array("DELIVERY_ID" => $newId, "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByLocation', "SORT" => 100));
$result->addErrors($res->getErrors());
if ($result->isSuccess()) {
$con->queryExecute('UPDATE b_sale_delivery SET CONVERTED=\'Y\' WHERE ID=' . $sqlHelper->forSql($delivery["CODE"]));
$con->queryExecute("UPDATE b_sale_order SET DELIVERY_ID=" . $sqlHelper->forSql($newId) . " WHERE DELIVERY_ID = " . $sqlHelper->forSql($delivery["CODE"]));
$con->queryExecute("UPDATE b_sale_order_history SET DELIVERY_ID=" . $sqlHelper->forSql($newId) . " WHERE DELIVERY_ID = " . $sqlHelper->forSql($delivery["CODE"]));
$con->queryExecute("UPDATE b_sale_delivery2paysystem SET DELIVERY_ID=" . $sqlHelper->forSql($newId) . ", LINK_DIRECTION='" . DeliveryPaySystemTable::LINK_DIRECTION_DELIVERY_PAYSYSTEM . "' WHERE DELIVERY_ID = " . $sqlHelper->forSql($delivery["CODE"]));
$con->queryExecute('
INSERT INTO
b_sale_delivery2location(DELIVERY_ID, LOCATION_CODE, LOCATION_TYPE)
SELECT
' . $sqlHelper->forSql($newId) . ', LOCATION_CODE, LOCATION_TYPE FROM b_sale_delivery2location_tmp
WHERE
DELIVERY_ID = ' . $sqlHelper->forSql($delivery["CODE"]) . '
');
$con->queryExecute('DELETE FROM b_sale_delivery2location_tmp WHERE DELIVERY_ID = ' . $sqlHelper->forSql($delivery["CODE"]));
$d2pRes = \Bitrix\Sale\Internals\DeliveryPaySystemTable::getList(array('filter' => array('DELIVERY_ID' => $newId), 'select' => array("DELIVERY_ID"), 'group' => array("DELIVERY_ID")));
if ($d2p = $d2pRes->fetch()) {
$res = \Bitrix\Sale\Delivery\Restrictions\Table::add(array("DELIVERY_ID" => $d2p["DELIVERY_ID"], "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByPaySystem', "SORT" => 100));
if (!$res->isSuccess()) {
$result->addErrors($res->getErrors());
}
}
}
}
if ($result->isSuccess()) {
$con->dropTable('b_sale_delivery2location_tmp');
if ($renameTable) {
$con->renameTable("b_sale_delivery", "b_sale_delivery_old");
}
}
return $result;
}
示例3: __IncludeLang
}
$siteID = $arParams["site_id"];
if (strlen($arParams["site_id"]) <= 0) {
$siteID = "s1";
}
$dbSite = CSite::GetByID($siteID);
if ($arSite = $dbSite->Fetch()) {
$lang = $arSite["LANGUAGE_ID"];
}
if (strlen($lang) <= 0) {
$lang = "ru";
}
$bRus = false;
if ($lang == "ru") {
$bRus = true;
}
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/step8.php", $lang));
$dbLocation = CSaleLocation::GetList(array("ID" => "ASC"), array("LID" => $lang));
if ($arLocation = $dbLocation->Fetch()) {
$arLocation4Delivery = array();
do {
$arLocation4Delivery[] = array("LOCATION_ID" => $arLocation["ID"], "LOCATION_TYPE" => "L");
} while ($arLocation = $dbLocation->Fetch());
//Location group
$dblocationGroupID = CSaleLocationGroup::GetList(array("ID" => "DESC"));
if ($arLocationGroupID = $dblocationGroupID->Fetch()) {
$locationGroupID = $arLocationGroupID["ID"];
}
$arLocation4Delivery[] = array("LOCATION_ID" => $locationGroupID, "LOCATION_TYPE" => "G");
CSaleDelivery::Add(array("NAME" => GetMessage("SALE_WIZARD_COUR"), "LID" => $siteID, "PERIOD_FROM" => 7, "PERIOD_TO" => 15, "PERIOD_TYPE" => "D", "WEIGHT_FROM" => 2000, "WEIGHT_TO" => 0, "ORDER_PRICE_FROM" => 0, "ORDER_PRICE_TO" => 0, "ORDER_CURRENCY" => $bRus ? "RUB" : "USD", "ACTIVE" => "N", "PRICE" => "55", "CURRENCY" => $bRus ? "RUB" : "USD", "SORT" => 100, "DESCRIPTION" => "", "LOCATIONS" => $arLocation4Delivery));
}
示例4: array
//pay system for delivery
if (is_set($_POST["PAY_SYSTEM"]) && is_array($_POST["PAY_SYSTEM"])) {
$arFields["PAY_SYSTEM"] = array();
$arPaySystem = $_POST["PAY_SYSTEM"];
if ($arPaySystem[0] == "") {
unset($arPaySystem[0]);
}
$arFields["PAY_SYSTEM"] = $arPaySystem;
}
if ($ID > 0) {
$delivery = new CSaleDelivery();
if (!$delivery->Update($ID, $arFields, array("EXPECT_LOCATION_CODES" => $lpEnabled))) {
$strError .= GetMessage("ERROR_EDIT_DELIVERY") . "<br>";
}
} else {
$ID = CSaleDelivery::Add($arFields, array("EXPECT_LOCATION_CODES" => $lpEnabled));
if ($ID <= 0) {
$strError .= GetMessage("ERROR_ADD_DELIVERY") . "<br>";
}
}
}
if ($strError != '') {
$bInitVars = true;
} else {
if (strlen($apply) > 0) {
LocalRedirect("sale_delivery_edit.php?ID=" . $ID . "&lang=" . LANG . "&" . $tabControl->ActiveTabParam());
} else {
LocalRedirect("sale_delivery.php?lang=" . LANG);
}
}
}