本文整理汇总了PHP中CPrice::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::Delete方法的具体用法?PHP CPrice::Delete怎么用?PHP CPrice::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPrice
的用法示例。
在下文中一共展示了CPrice::Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
else
CPrice::Update($ar_res["ID"], $arFields);
}
}
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);
}
}
}
}
}
示例2: array
$killed_lines++;
} else {
$bDeactivationStarted = true;
$el->Update($arr["ID"], array("ACTIVE" => "N", "TMP_ID" => $tmpid));
$killed_lines++;
}
if (!($bAllLinesLoaded = CSVCheckTimeout($max_execution_time))) {
break;
}
}
}
// delete 'not-in-file' element prices
if ($bAllLinesLoaded && $bIBlockIsCatalog && 'Y' == $bUpdatePrice && $outFileAction == "D") {
$res = CPrice::GetList(array(), array("ELEMENT_IBLOCK_ID" => $IBLOCK_ID, "!TMP_ID" => $tmpid), false, false, array("ID"));
while ($arr = $res->Fetch()) {
CPrice::Delete($arr["ID"]);
if (!($bAllLinesLoaded = CSVCheckTimeout($max_execution_time))) {
break;
}
}
}
if (!$bAllLinesLoaded) {
$bAllDataLoaded = false;
$INTERNAL_VARS_LIST = "tmpid,line_num,correct_lines,error_lines,killed_lines,arIBlockProperty,bThereIsGroups,arProductGroups,arIBlockPropertyValue,bDeactivationStarted,bUpdatePrice";
$SETUP_VARS_LIST = "IBLOCK_ID,URL_DATA_FILE,fields_type,first_names_r,delimiter_r,delimiter_other_r,first_names_f,metki_f,PATH2IMAGE_FILES,outFileAction,inFileAction,max_execution_time,IMAGE_RESIZE,USE_TRANSLIT,TRANSLIT_LANG,CLEAR_EMPTY_PRICE,CML2_LINK_IS_XML";
for ($i = 0; $i < $NUM_FIELDS; $i++) {
$SETUP_VARS_LIST .= ",field_" . $i;
}
$CUR_FILE_POS = $csvFile->GetPos();
}
}
示例3: 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);
}
}