当前位置: 首页>>代码示例>>PHP>>正文


PHP CPrice::Update方法代码示例

本文整理汇总了PHP中CPrice::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::Update方法的具体用法?PHP CPrice::Update怎么用?PHP CPrice::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPrice的用法示例。


在下文中一共展示了CPrice::Update方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addPriceProducts

	/**
	 * [addPriceProducts description]
	 * @param array $arParams
	 * @return bool
	 */
	protected function addPriceProducts($arParams){
		if (!CModule::IncludeModule("iblock") && !CModule::IncludeModule("catalog") && !CModule::IncludeModule("sale")):
			return false;
		endif;
		$PRICE_TYPE_ID = 1; // идентификатор типы базовой цены
		$arFields = Array(
		    "PRODUCT_ID" => $arParams["PRODUCT_ID"],
		    "CATALOG_GROUP_ID" => $PRICE_TYPE_ID,
		    "PRICE" => $arParams["OLD_PRICE"],
		    "CURRENCY" => "RUB",
		    "QUANTITY_FROM" => 1,
		);
		$res = CPrice::GetList(
		        array(),
		        array(
	                "PRODUCT_ID" => $arParams["PRODUCT_ID"],
	                "CATALOG_GROUP_ID" => $PRICE_TYPE_ID
	            )
		    );
		if ($arr = $res->Fetch()):
		    if (!CPrice::Update($arr["ID"], $arFields)):
		    	return false;
		    endif;
		else:
		    if (!CPrice::Add($arFields)):
		    	return false;
		    endif;
		endif;
		if (!$this->addCatalogProducts($arParams)):
			return false;
		endif;
		return true;
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:38,代码来源:addProductsPrice.php

示例2: 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;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:27,代码来源:crm_product.php

示例3: 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);
 }
开发者ID:ASDAFF,项目名称:module.markup,代码行数:15,代码来源:CQuetzalMarkupPriceUpdate.php

示例4: ReCountForBase

	function ReCountForBase(&$arFields)
	{
		static $arExtraList = array();
		$boolSearch = false;

		$arFilter = array('PRODUCT_ID' => $arFields['PRODUCT_ID'],'!CATALOG_GROUP_ID' => $arFields['CATALOG_GROUP_ID']);
		if (isset($arFields['QUANTITY_FROM']))
			$arFilter['QUANTITY_FROM'] = $arFields['QUANTITY_FROM'];
		if (isset($arFields['QUANTITY_TO']))
			$arFilter['QUANTITY_TO'] = $arFields['QUANTITY_TO'];

		$rsPrices = CPrice::GetListEx(
			array('CATALOG_GROUP_ID' => 'ASC',"QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"),
			$arFilter,
			false,
			false,
			array('ID','EXTRA_ID')
		);
		while ($arPrice = $rsPrices->Fetch())
		{
			$arPrice['EXTRA_ID'] = intval($arPrice['EXTRA_ID']);
			if ($arPrice['EXTRA_ID'] > 0)
			{
				$boolSearch = isset($arExtraList[$arPrice['EXTRA_ID']]);
				if (!$boolSearch)
				{
					$arExtra = CExtra::GetByID($arPrice['EXTRA_ID']);
					if (!empty($arExtra))
					{
						$boolSearch = true;
						$arExtraList[$arExtra['ID']] = $arExtra['PERCENTAGE'];
					}
				}
				if ($boolSearch)
				{
					$arNewPrice = array(
						'CURRENCY' => $arFields['CURRENCY'],
						'PRICE' => RoundEx($arFields["PRICE"] * (1 + DoubleVal($arExtraList[$arPrice['EXTRA_ID']])/100), CATALOG_VALUE_PRECISION),
					);
					CPrice::Update($arPrice['ID'],$arNewPrice,false);
				}
			}
		}
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:44,代码来源:price.php

示例5: foreach

     }
 }
 foreach ($arFields as $key => $value) {
     $strPriceErr = '';
     $res = CPrice::GetListEx(array(), array("PRODUCT_ID" => $value['PRODUCT_ID'], "CATALOG_GROUP_ID" => $value['CATALOG_GROUP_ID'], "QUANTITY_FROM" => $value['QUANTITY_FROM'], "QUANTITY_TO" => $value['QUANTITY_TO']), false, false, array('ID'));
     if ($arr = $res->Fetch()) {
         $boolEraseClear = false;
         if ('Y' == $CLEAR_EMPTY_PRICE) {
             $boolEraseClear = isset($value['PRICE']) && '' === $value['PRICE'] && (isset($value['CURRENCY']) && '' === $value['CURRENCY']);
         }
         if ($boolEraseClear) {
             if (!CPrice::Delete($arr["ID"])) {
                 $strPriceErr = GetMessage('CATI_ERR_PRICE_DELETE');
             }
         } 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 {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:csv_new_run.php

示例6: 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()))
开发者ID:nycmic,项目名称:bittest,代码行数:31,代码来源:iblock_list_admin.php

示例7: 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);
     }
 }
开发者ID:nycmic,项目名称:bittest,代码行数:42,代码来源:cml2.php

示例8: 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]);

//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:gpbitrix,代码行数:101,代码来源:class.php

示例9: str_replace

             if (!$ID_tmp) {
                 $strWarning .= str_replace("#PRICE#", $arCatalogFields["PRICE"], GetMessage("C2IT_ERROR_SAVEPRICE")) . "<br>";
             }
         }
     }
 }
 foreach ($arCatalogPrices as $catalogGroupID => $arCatalogPrice_tmp) {
     $intCountPrice = count($arCatalogPrice_tmp);
     for ($i = 0; $i < $intCountPrice; $i++) {
         if (strlen($arCatalogPrice_tmp[$i]["PRICE"]) > 0) {
             $arCatalogFields = array("EXTRA_ID" => $arCatalogPrice_tmp[$i]["EXTRA_ID"] > 0 ? $arCatalogPrice_tmp[$i]["EXTRA_ID"] : false, "PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => $catalogGroupID, "PRICE" => DoubleVal($arCatalogPrice_tmp[$i]["PRICE"]), "CURRENCY" => $arCatalogPrice_tmp[$i]["CURRENCY"], "QUANTITY_FROM" => $arCatalogPrice_tmp[$i]["QUANTITY_FROM"] > 0 ? $arCatalogPrice_tmp[$i]["QUANTITY_FROM"] : false, "QUANTITY_TO" => $arCatalogPrice_tmp[$i]["QUANTITY_TO"] > 0 ? $arCatalogPrice_tmp[$i]["QUANTITY_TO"] : false);
             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>";
                 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:product_edit_action.php

示例10: Array

			$arFields = Array(
					"PRODUCT_ID" => $PRODUCT_ID,
					"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"));
			}
		}
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:31,代码来源:commerceml_run.php


注:本文中的CPrice::Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。