本文整理汇总了PHP中CPrice::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::Add方法的具体用法?PHP CPrice::Add怎么用?PHP CPrice::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPrice
的用法示例。
在下文中一共展示了CPrice::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPrice
public static function setPrice($productID, $priceValue = 0.0, $currency = false, $priceTypeId = false, $priceTypeId = false)
{
$productID = intval($productID);
if ($currency === false) {
$currency = CCrmCurrency::GetBaseCurrencyID();
}
if (strlen($currency) < 3) {
return false;
}
if ($priceTypeId === false) {
$priceTypeId = self::getSelectedPriceTypeId();
}
if (intval($priceTypeId) < 1) {
return false;
}
$ID = false;
$arFields = false;
if ($arFields = self::getPrice($productID, $priceTypeId)) {
$ID = $arFields["ID"];
$arFields = array("PRICE" => doubleval($priceValue), "CURRENCY" => $currency);
$ID = CPrice::Update($ID, $arFields);
} else {
$arFields = array("PRICE" => doubleval($priceValue), "CURRENCY" => $currency, "QUANTITY_FROM" => 0, "QUANTITY_TO" => 0, "EXTRA_ID" => false, "CATALOG_GROUP_ID" => $priceTypeId, "PRODUCT_ID" => $productID);
$ID = CPrice::Add($arFields);
}
return $ID ? $ID : false;
}
示例2: setExtra
private function setExtra($productId, $priceTypeId, $extraId)
{
$list = CPrice::GetList(array(), array('PRODUCT_ID' => $productId, 'CATALOG_GROUP_ID' => $priceTypeId), false, false, array('ID', 'EXTRA_ID'));
$arFields = array('PRODUCT_ID' => $productId, 'CATALOG_GROUP_ID' => $priceTypeId, 'EXTRA_ID' => $extraId, 'CURRENCY' => 'USD');
if ($res = $list->Fetch()) {
if ($res['EXTRA_ID'] != $extraId) {
CPrice::Update($res['ID'], $arFields, true);
}
} else {
CPrice::Add($arFields, true);
}
unset($list);
unset($res);
unset($resultUp);
}
示例3: add_element
function add_element($iblock_id, $section_id, $NAME, $PRICE_EUR, $P, $DETAIL_PICTURE)
{
$el = new CIBlockElement();
//test_dump($P);
$arFields = array("IBLOCK_ID" => $iblock_id, "NAME" => $NAME, "CODE" => $P["ARTNUMBER"], "ACTIVE" => "Y", "IBLOCK_SECTION_ID" => $section_id, "DETAIL_TEXT" => $P["DESCRIPTION_TEXT"], "DETAIL_TEXT_TYPE" => "html", "PROPERTY_VALUES" => $P, "DETAIL_PICTURE" => $DETAIL_PICTURE);
if ($last_el_id = $el->Add($arFields)) {
echo "New ID: " . $last_el_id . "<br>";
$arFields = array("ID" => $last_el_id, "VAT_INCLUDED" => "Y");
if (CCatalogProduct::Add($arFields)) {
echo "Добавили параметры товара к элементу каталога " . $last_el_id . "<br>";
$arFields = array("PRODUCT_ID" => $last_el_id, "CATALOG_GROUP_ID" => 1, "PRICE" => $PRICE_EUR, "CURRENCY" => "EUR");
CPrice::Add($arFields);
} else {
echo "Ошибка добавления параметров товаров";
}
} else {
echo "Error: " . $el->LAST_ERROR . "<br>";
}
}
示例4: GetMessage
}
} else {
if (CPrice::Update($arr["ID"], $value)) {
$bUpdatePrice = 'Y';
} else {
if ($ex = $APPLICATION->GetException()) {
$strPriceErr = GetMessage('CATI_ERR_PRICE_UPDATE') . $ex->GetString();
} else {
$strPriceErr = GetMessage('CATI_ERR_PRICE_UPDATE_UNKNOWN');
}
}
}
} else {
$boolEmptyNewPrice = isset($value['PRICE']) && '' === $value['PRICE'] && (isset($value['CURRENCY']) && '' === $value['CURRENCY']);
if (!$boolEmptyNewPrice) {
if (CPrice::Add($value)) {
$bUpdatePrice = 'Y';
} else {
if ($ex = $APPLICATION->GetException()) {
$strPriceErr = GetMessage('CATI_ERR_PRICE_ADD') . $ex->GetString();
} else {
$strPriceErr = GetMessage('CATI_ERR_PRICE_ADD_UNKNOWN');
}
}
}
}
if ('' != $strPriceErr) {
$strErrorR .= GetMessage("CATI_LINE_NO") . " " . $line_num . ". " . $strPriceErr . '<br>';
break;
}
}
示例5: array
elseif(!isset($CATALOG_EXTRA[$elID][$arCatalogGroup["ID"]]))
{
$arFields = array(
"PRODUCT_ID" => $elID,
"CATALOG_GROUP_ID" => $arCatalogGroup["ID"],
"PRICE" => $arPrice[$arCatalogGroup["ID"]],
"CURRENCY" => $arCurrency[$arCatalogGroup["ID"]],
"QUANTITY_FROM" => $CATALOG_QUANTITY_FROM[$elID][$arCatalogGroup["ID"]],
"QUANTITY_TO" => $CATALOG_QUANTITY_TO[$elID][$arCatalogGroup["ID"]]
);
if($arFields["PRICE"] < 0 || trim($arFields["PRICE"]) === '')
CPrice::Delete($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]]);
elseif(intval($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]])>0)
CPrice::Update(intval($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]]), $arFields);
elseif($arFields["PRICE"] >= 0)
CPrice::Add($arFields);
}
}
}
unset($arCatalogGroup);
}
}
}
}
}
// Handle actions here
if(($arID = $lAdmin->GroupAction()))
{
if($_REQUEST['action_target']=='selected')
示例6: SetProductPrice
/**
* @param int $PRODUCT_ID
* @param array $arPrices
* @param bool|array $arDiscounts
*/
function SetProductPrice($PRODUCT_ID, $arPrices, $arDiscounts = false)
{
$arDBPrices = array();
$rsPrice = CPrice::GetList(array(), array("PRODUCT_ID" => $PRODUCT_ID));
while ($ar = $rsPrice->Fetch()) {
$arDBPrices[$ar["CATALOG_GROUP_ID"] . ":" . $ar["QUANTITY_FROM"] . ":" . $ar["QUANTITY_TO"]] = $ar["ID"];
}
$arToDelete = $arDBPrices;
if (!is_array($arPrices)) {
$arPrices = array();
}
foreach ($arPrices as $price) {
if (!isset($price[$this->mess["IBLOCK_XML2_CURRENCY"]])) {
$price[$this->mess["IBLOCK_XML2_CURRENCY"]] = $price["PRICE"]["CURRENCY"];
}
$arPrice = array("PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => $price["PRICE"]["ID"], "^PRICE" => $this->ToFloat($price[$this->mess["IBLOCK_XML2_PRICE_FOR_ONE"]]), "CURRENCY" => $this->CheckCurrency($price[$this->mess["IBLOCK_XML2_CURRENCY"]]));
foreach ($this->ConvertDiscounts($arDiscounts) as $arDiscount) {
$arPrice["QUANTITY_FROM"] = $arDiscount["QUANTITY_FROM"];
$arPrice["QUANTITY_TO"] = $arDiscount["QUANTITY_TO"];
if ($arDiscount["PERCENT"] > 0) {
$arPrice["PRICE"] = $arPrice["^PRICE"] - $arPrice["^PRICE"] / 100 * $arDiscount["PERCENT"];
} else {
$arPrice["PRICE"] = $arPrice["^PRICE"];
}
$id = $arPrice["CATALOG_GROUP_ID"] . ":" . $arPrice["QUANTITY_FROM"] . ":" . $arPrice["QUANTITY_TO"];
if (array_key_exists($id, $arDBPrices)) {
CPrice::Update($arDBPrices[$id], $arPrice);
unset($arToDelete[$id]);
} else {
CPrice::Add($arPrice);
}
}
}
foreach ($arToDelete as $id) {
CPrice::Delete($id);
}
}
示例7: AuthtorizeAfterAds
/**
* функция после добавлением элемента в инфоблока
* @param $arFields поля элемента ифоблока
* для страницы Объявления
* eсли VIP объявление то добавляет корзину
* привязывает по ID созданное объявления к товару в корзине
* редирект на необходимы url
*/
function AuthtorizeAfterAds(&$arFields){
unset($_SESSION['user777999authorize']);
if($arFields['PROPERTY_VALUES']['114']){
foreach($arFields['PROPERTY_VALUES']['114'] as $key114 => $item114){
if($item114['VALUE']){
foreach($arFields['PROPERTY_VALUES']['113'] as $key113 => $item113){
if($item113['VALUE']){
$arFields['PROPERTY_VALUES']['113'][$key113]=ConvertDateTime($item114['VALUE'], "YYYY-MM-DD HH:MI:SS");
}else{
$arFields['PROPERTY_VALUES']['113'][n0]=ConvertDateTime($item114['VALUE'], "YYYY-MM-DD HH:MI:SS");
}
}
}
}
}
if(($arFields["IBLOCK_ID"] == 16)&&(!CUser::IsAuthorized())){
global $USER;
$rsUser = CUser::GetByID($_SESSION['NEW_USER_ID']);
$arUser = $rsUser->Fetch();
$_SESSION['$arUser']=$arUser;
$USER = new CUser;
$arAuthResult = $USER->Login($arUser['LOGIN'], $arUser['PASSWORD'], "Y","N");
}
//$_SESSION['user777authorize']=$arFields;
if(($arFields["IBLOCK_ID"] == 16)&&(CModule::IncludeModule("catalog"))&&(CModule::IncludeModule("sale"))){
$price_product=floatval($arFields["PROPERTY_VALUES"][86]);
$quantity_product=floatval($arFields["PROPERTY_VALUES"][87]);
if($price_product){
$PRODUCT_ID = $arFields['ID'];
$PRICE_TYPE_ID = 1;
$arFieldsprice = Array(
"PRODUCT_ID" => $PRODUCT_ID,
"CATALOG_GROUP_ID" => $PRICE_TYPE_ID,
"PRICE" =>$price_product,
"CURRENCY" => "RUB",
"QUANTITY_FROM" => 1,
);
$res = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $PRODUCT_ID,
"CATALOG_GROUP_ID" => $PRICE_TYPE_ID
)
);
if ($arr = $res->Fetch())
{
CPrice::Update($arr["ID"], $arFieldsprice);
}
else
{
CPrice::Add($arFieldsprice,true);
}
}
}
if (
(
(($arFields["IBLOCK_ID"] == 2)&& (is_numeric($arFields["PROPERTY_VALUES"][73])))
||
(($arFields["IBLOCK_ID"] == 15)&& (is_numeric($arFields["PROPERTY_VALUES"][76])))
||
(($arFields["IBLOCK_ID"] == 14)&& (is_numeric($arFields["PROPERTY_VALUES"][78])))
)
&&
CModule::IncludeModule("catalog")
&&
CModule::IncludeModule("sale")
&&
((strstr($_SERVER['REQUEST_URI'],'/personal/moy-magazin/'))||(strstr($_SERVER['REQUEST_URI'],'/obyavleniya/add-ads/')))
)
{
switch($arFields["IBLOCK_ID"]){
case 2:
$price_product=floatval($arFields["PROPERTY_VALUES"][73]);
$quantity_product=floatval($arFields["PROPERTY_VALUES"][75]);
break;
case 14:
$price_product=floatval($arFields["PROPERTY_VALUES"][78]);
$quantity_product=floatval($arFields["PROPERTY_VALUES"][79]);
//.........这里部分代码省略.........
示例8: str_replace
if ($arCatalogPrice_tmp[$i]["ID"] > 0) {
$arCatalogPrice = CPrice::GetByID($arCatalogPrice_tmp[$i]["ID"]);
if ($arCatalogPrice && $arCatalogPrice["PRODUCT_ID"] == $PRODUCT_ID) {
$arUpdatedIDs[] = $arCatalogPrice_tmp[$i]["ID"];
if (!CPrice::Update($arCatalogPrice_tmp[$i]["ID"], $arCatalogFields)) {
$strWarning .= str_replace("#ID#", $arCatalogPrice_tmp[$i]["ID"], GetMessage("C2IT_ERROR_PRPARAMS")) . "<br>";
}
} else {
$ID_tmp = CPrice::Add($arCatalogFields);
$arUpdatedIDs[] = $ID_tmp;
if (!$ID_tmp) {
$strWarning .= str_replace("#PRICE#", $arCatalogFields["PRICE"], GetMessage("C2IT_ERROR_SAVEPRICE")) . "<br>";
}
}
} else {
$ID_tmp = CPrice::Add($arCatalogFields);
$arUpdatedIDs[] = $ID_tmp;
if (!$ID_tmp) {
$strWarning .= str_replace("#PRICE#", $arCatalogFields["PRICE"], GetMessage("C2IT_ERROR_SAVEPRICE")) . "<br>";
}
}
}
}
}
CPrice::DeleteByProduct($PRODUCT_ID, $arUpdatedIDs);
\Bitrix\Iblock\PropertyIndex\Manager::updateElementIndex($IBLOCK_ID, $PRODUCT_ID);
if ($arCatalog["SUBSCRIPTION"] == "Y") {
$arCurProductGroups = array();
$dbProductGroups = CCatalogProductGroups::GetList(array(), array("PRODUCT_ID" => $ID), false, false, array("ID", "GROUP_ID", "ACCESS_LENGTH", "ACCESS_LENGTH_TYPE"));
while ($arProductGroup = $dbProductGroups->Fetch()) {
$arCurProductGroups[IntVal($arProductGroup["GROUP_ID"])] = $arProductGroup;
示例9: orderHistory
//.........这里部分代码省略.........
$optionsOrderTypes[$order['orderType']] = $orderType;
} else {
$optionsOrderTypes[$order['orderType']] = $defaultOrderType;
}
}
// we dont need new orders without any customers (can check only for externalId)
if (!isset($order['customer']['externalId'])) {
if (!isset($order['customer']['id'])) {
continue;
}
$registerNewUser = true;
if (!isset($order['customer']['email']) || $order['customer']['email'] == '') {
$login = $order['customer']['email'] = uniqid('user_' . time()) . '@crm.com';
} else {
$dbUser = CUser::GetList($by = 'ID', $sort = 'ASC', array('=EMAIL' => $order['email']));
switch ($dbUser->SelectedRowsCount()) {
case 0:
$login = $order['customer']['email'];
break;
case 1:
$arUser = $dbUser->Fetch();
$registeredUserID = $arUser['ID'];
$registerNewUser = false;
break;
default:
$login = uniqid('user_' . time()) . '@crm.com';
break;
}
}
if ($registerNewUser === true) {
$userPassword = uniqid();
$newUser = new CUser();
$arFields = array("NAME" => self::fromJSON($order['customer']['firstName']), "LAST_NAME" => self::fromJSON($order['customer']['lastName']), "EMAIL" => $order['customer']['email'], "LOGIN" => $login, "LID" => "ru", "ACTIVE" => "Y", "PASSWORD" => $userPassword, "CONFIRM_PASSWORD" => $userPassword);
$registeredUserID = $newUser->Add($arFields);
if ($registeredUserID === false) {
self::eventLog('ICrmOrderActions::orderHistory', 'CUser::Register', 'Error register user');
continue;
}
try {
$api->customerFixExternalIds(array(array('id' => $order['customer']['id'], 'externalId' => $registeredUserID)));
} catch (\RetailCrm\Exception\CurlException $e) {
self::eventLog('ICrmOrderActions::orderHistory', 'RetailCrm\\RestApi::customerFixExternalIds::CurlException', $e->getCode() . ': ' . $e->getMessage());
continue;
}
}
$order['customer']['externalId'] = $registeredUserID;
}
// new order
$newOrderFields = array('LID' => CSite::GetDefSite(), 'PERSON_TYPE_ID' => isset($optionsOrderTypes[$order['orderType']]) ? $optionsOrderTypes[$order['orderType']] : $defaultOrderType, 'PAYED' => 'N', 'CANCELED' => 'N', 'STATUS_ID' => 'N', 'PRICE' => 0, 'CURRENCY' => CCurrency::GetBaseCurrency(), 'USER_ID' => $order['customer']['externalId'], 'PAY_SYSTEM_ID' => 0, 'PRICE_DELIVERY' => 0, 'DELIVERY_ID' => 0, 'DISCOUNT_VALUE' => 0, 'USER_DESCRIPTION' => '');
if (count($optionsSitesList) > 1 && ($lid = array_search($order['site'], $optionsSitesList))) {
$newOrderFields['LID'] = $lid;
}
$externalId = CSaleOrder::Add($newOrderFields);
if (!isset($order['externalId'])) {
try {
$api->orderFixExternalIds(array(array('id' => $order['id'], 'externalId' => $externalId)));
} catch (\RetailCrm\Exception\CurlException $e) {
self::eventLog('ICrmOrderActions::orderHistory', 'RetailCrm\\RestApi::orderFixExternalIds::CurlException', $e->getCode() . ': ' . $e->getMessage());
continue;
}
}
$order['externalId'] = $externalId;
}
if (isset($order['externalId']) && $order['externalId']) {
// custom orderType function
if (function_exists('intarocrm_set_order_type')) {
示例10: OnBeforePrologHandler
//.........这里部分代码省略.........
$strValueName = $arOldNamePropListCache[$arProp['CODE']][$arProp['VALUE_ENUM_ID']];
$intValueKey = array_search($strValueName, $arNamePropListCache[$arProp['CODE']]);
if ($intValueKey !== false) {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = $intValueKey;
}
}
}
}
}
}
} elseif ($arProp['PROPERTY_TYPE'] == 'S' || $arProp['PROPERTY_TYPE'] == 'N') {
if ($arProp['MULTIPLE'] == 'Y') {
if (is_array($arProp['~VALUE'])) {
if ($arProp['WITH_DESCRIPTION'] == 'Y') {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = array();
foreach ($arProp['~VALUE'] as $propValueKey => $propValue) {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']][] = array('VALUE' => $propValue, 'DESCRIPTION' => $arProp['~DESCRIPTION'][$propValueKey]);
}
unset($propValue, $propValueKey);
} else {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = $arProp['~VALUE'];
}
}
} else {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = $arProp['WITH_DESCRIPTION'] == 'Y' ? array('VALUE' => $arProp['~VALUE'], 'DESCRIPTION' => $arProp['~DESCRIPTION']) : $arProp['~VALUE'];
}
} else {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = $arProp['~VALUE'];
}
}
if (isset($arProp)) {
unset($arProp);
}
AddMessage2Log($arSrc['PROPERTY_VALUES']);
$intNewID = $el->Add($arSrc, true, true, true);
if ($intNewID) {
if ($boolCatalog && $boolCopyCatalog) {
$priceRes = CPrice::GetListEx(array(), array('PRODUCT_ID' => $ID), false, false, array('PRODUCT_ID', 'EXTRA_ID', 'CATALOG_GROUP_ID', 'PRICE', 'CURRENCY', 'QUANTITY_FROM', 'QUANTITY_TO'));
while ($arPrice = $priceRes->Fetch()) {
$arPrice['PRODUCT_ID'] = $intNewID;
CPrice::Add($arPrice);
}
}
if ($boolCatalog && $boolNewCatalog) {
$arProduct = array('ID' => $intNewID);
if ($boolCopyCatalog) {
$productRes = CCatalogProduct::GetList(array(), array('ID' => $ID), false, false, array('QUANTITY', 'QUANTITY_TRACE_ORIG', 'CAN_BUY_ZERO_ORIG', 'NEGATIVE_AMOUNT_TRACE_ORIG', 'SUBSCRIBE_ORIG', 'WEIGHT', 'PRICE_TYPE', 'RECUR_SCHEME_TYPE', 'RECUR_SCHEME_LENGTH', 'TRIAL_PRICE_ID', 'WITHOUT_ORDER', 'SELECT_BEST_PRICE', 'VAT_ID', 'VAT_INCLUDED', 'WIDTH', 'LENGTH', 'HEIGHT', 'PURCHASING_PRICE', 'PURCHASING_CURRENCY', 'MEASURE'));
if ($arCurProduct = $productRes->Fetch()) {
$arProduct = $arCurProduct;
$arProduct['ID'] = $intNewID;
$arProduct['QUANTITY_TRACE'] = $arProduct['QUANTITY_TRACE_ORIG'];
$arProduct['CAN_BUY_ZERO'] = $arProduct['CAN_BUY_ZERO_ORIG'];
$arProduct['NEGATIVE_AMOUNT_TRACE'] = $arProduct['NEGATIVE_AMOUNT_TRACE_ORIG'];
if (isset($arProduct['SUBSCRIBE_ORIG'])) {
$arProduct['SUBSCRIBE'] = $arProduct['SUBSCRIBE_ORIG'];
}
foreach ($arProduct as $productKey => $productValue) {
if ($productValue === null) {
unset($arProduct[$productKey]);
}
}
}
}
CCatalogProduct::Add($arProduct, false);
}
if ($_REQUEST['action'] == 'asd_move') {
示例11: foreach
}
}
foreach ($arFields as $key => $value) {
if (isset($value["PRICE"])) {
$value["PRICE"] = str_replace(",", ".", Trim($value["PRICE"]));
$value["PRICE"] = preg_replace("/[^\\d.]/i", "", $value["PRICE"]);
$value["PRICE"] = DoubleVal($value["PRICE"]);
} else {
$value["PRICE"] = false;
}
$value["TMP_ID"] = $tmpid;
$res = CPrice::GetList(array(), array("PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => $key, "QUANTITY_FROM" => $quantityFrom, "QUANTITY_TO" => $quantityTo));
if ($arr = $res->Fetch()) {
CPrice::Update($arr["ID"], $value);
} else {
CPrice::Add($value);
}
}
}
if (strlen($strErrorR) <= 0) {
$correct_lines++;
} else {
$error_lines++;
$strImportErrorMessage .= $strErrorR;
}
if (!($bAllLinesLoaded = CSVCheckTimeout($max_execution_time))) {
break;
}
} while ($arRes = $csvFile->Fetch());
}
//////////////////////////////
示例12: Array
"CATALOG_GROUP_ID" => $PRICE_ID,
"PRICE" => $OFFER_PRICE,
"CURRENCY" => $OFFER_CURRENCY
);
$res = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $PRODUCT_ID,
"CATALOG_GROUP_ID" => $PRICE_ID
)
);
if ($arr = $res->Fetch())
$khjk = CPrice::Update($arr["ID"], $arFields);
else
$khjk = CPrice::Add($arFields);
}
}
if (COption::GetOptionString("catalog", "deactivate_1c_no_price", "N")=="Y")
{
foreach ($arProductsTmpA as $keyA=>$valA)
{
foreach ($valA["arProducts"] as $keyB=>$valB)
{
$res = $el->Update(IntVal($valB), Array("ACTIVE" => "N"));
}
}
}
$strImportOKMessage .= str_replace("#TIME#", RoundEx(getmicrotime() - $startImportExecTime, 2), GetMessage("CICML_LOAD_TIME"))."<br>";
示例13: elseif
}
if (strlen($lang) <= 0) {
$lang = "ru";
}
$defCurrency = "EUR";
if ($lang == "ru") {
$shopLocalization = $wizard->GetVar("shopLocalization");
if ($shopLocalization == "ua") {
$defCurrency = "UAH";
} else {
$defCurrency = "RUB";
}
} elseif ($lang == "en") {
$defCurrency = "USD";
}
$elementPrice = CPrice::Add(array("PRODUCT_ID" => $elementID, "PRICE" => $arOffer["PRICE"], "CURRENCY" => $defCurrency, "CATALOG_GROUP_ID" => "1"));
}
// form settings
/* $f1 = 'edit1--#--'.GetMessage("WZD_OPTION_CATALOG_1").'--,--ACTIVE--#--'.GetMessage("WZD_OPTION_CATALOG_2").'--,--NAME--#--'.GetMessage("WZD_OPTION_CATALOG_3").'--,--CODE--#--'.GetMessage("WZD_OPTION_CATALOG_4").'--,--DETAIL_PICTURE--#--'.GetMessage("WZD_OPTION_CATALOG_5").'--,';
$f1 .= $fProps;
if(CCatalog::GetByID($arIBlockFur["ID"]) && CCatalog::GetByID($IBLOCK_OFFERS_ID))
{
$f1 .= '--CATALOG--#--'.GetMessage("WZD_OPTION_CATALOG_20").'--;--cedit1--#--'.GetMessage("WZD_OPTION_CATALOG_27").'--,--PREVIEW_TEXT--#--'.GetMessage("WZD_OPTION_CATALOG_6").'--,--DETAIL_TEXT--#--'.GetMessage("WZD_OPTION_CATALOG_7").'--,--cedit1_csection1--#----'.GetMessage("WZD_OPTION_CATALOG_9").'--,--SECTIONS--#--'.GetMessage("WZD_OPTION_CATALOG_30").'--;--';
$f1 .= 'cedit2--#--'.GetMessage("WZD_OPTION_CATALOG_31").'--,--OFFERS--#--'.GetMessage("WZD_OPTION_CATALOG_31").'--;--';
}
else
{
$f1 .= '--OFFERS--#--'.GetMessage("WZD_OPTION_CATALOG_20").'--;--cedit1--#--'.GetMessage("WZD_OPTION_CATALOG_27").'--,--PREVIEW_TEXT--#--'.GetMessage("WZD_OPTION_CATALOG_6").'--,--DETAIL_TEXT--#--'.GetMessage("WZD_OPTION_CATALOG_7").'--,--cedit1_csection1--#----'.GetMessage("WZD_OPTION_CATALOG_9").'--,--SECTIONS--#--'.GetMessage("WZD_OPTION_CATALOG_30").'--;--';
} */
// CUserOptions::SetOption("form", "form_element_".$arIBlockFur["ID"], array ( 'tabs' => $f1, ));
示例14: SetBasePrice
function SetBasePrice($ProductID, $Price, $Currency, $quantityFrom = false, $quantityTo = false, $bGetID = false)
{
$bGetID = ($bGetID == true);
$arFields = array();
$arFields["PRICE"] = doubleval($Price);
$arFields["CURRENCY"] = $Currency;
$arFields["QUANTITY_FROM"] = ($quantityFrom == false ? false : (int)$quantityFrom);
$arFields["QUANTITY_TO"] = ($quantityTo == false ? false : (int)$quantityTo);
$arFields["EXTRA_ID"] = false;
$ID = false;
if ($arBasePrice = CPrice::GetBasePrice($ProductID, $quantityFrom, $quantityTo, false))
{
$ID = CPrice::Update($arBasePrice["ID"], $arFields);
}
else
{
$arBaseGroup = CCatalogGroup::GetBaseGroup();
$arFields["CATALOG_GROUP_ID"] = $arBaseGroup["ID"];
$arFields["PRODUCT_ID"] = $ProductID;
$ID = CPrice::Add($arFields);
}
if (!$ID)
{
return false;
}
else
{
return ($bGetID ? $ID : true);
}
}
示例15: htmlspecialcharsback
break;
}
}
}
$arPropertySaveValues["CML2_LINK"] = $parentElement;
$arIBlockElementAdd['PROPERTY_VALUES'] = $arPropertySaveValues;
$sku = new \Bitrix\Iblock\Template\Entity\Element(0);
$sku->setFields($arIBlockElementAdd);
$arIBlockElementAdd["NAME"] = htmlspecialcharsback(\Bitrix\Iblock\Template\Engine::process($sku, $title));
unset($arIBlockElementAdd['PROPERTY_VALUES']["CML2_LINK"]);
$idNewElement = $obIBlockElement->Add($arIBlockElementAdd, false, true, true);
if ($idNewElement) {
$productData['ID'] = $idNewElement;
CCatalogProduct::Add($productData, false);
foreach ($arPriceGroup as $price) {
CPrice::Add(array("PRODUCT_ID" => $idNewElement, "CURRENCY" => $price["CURRENCY"], "PRICE" => $price["PRICE"], "CATALOG_GROUP_ID" => $price["TYPE"]));
}
$element = new \Bitrix\Iblock\InheritedProperty\ElementValues($subIBlockId, $idNewElement);
$template = new \Bitrix\Iblock\InheritedProperty\BaseTemplate($element);
$template->set(array("MY_TEMPLATE" => $title));
} else {
$errorMessage .= $obIBlockElement->LAST_ERROR;
break;
}
}
unset($productData);
if ($idNewElement) {
?>
<script type="text/javascript">
top.BX.closeWait();
if (!!top.BX.WindowManager.Get())