本文整理汇总了PHP中CPrice::CheckFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::CheckFields方法的具体用法?PHP CPrice::CheckFields怎么用?PHP CPrice::CheckFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPrice
的用法示例。
在下文中一共展示了CPrice::CheckFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Add
function Add($arFields, $boolRecalc = false)
{
global $DB;
if (!CPrice::CheckFields("ADD", $arFields, 0)) {
return false;
}
$boolBase = false;
$arFields['RECALC'] = $boolRecalc === true ? true : false;
$events = GetModuleEvents("catalog", "OnBeforePriceAdd");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
if (!empty($arFields['RECALC']) && $arFields['RECALC'] === true) {
CPrice::ReCountFromBase($arFields, $boolBase);
}
$arInsert = $DB->PrepareInsert("b_catalog_price", $arFields);
$strSql = "INSERT INTO b_catalog_price(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
if ($ID > 0 && $boolBase == true) {
CPrice::ReCountForBase($arFields);
}
$events = GetModuleEvents("catalog", "OnPriceAdd");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
// strange copy-paste bug
$events = GetModuleEvents("sale", "OnPriceAdd");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
return $ID;
}
示例2: Add
function Add($arFields, $boolRecalc = false)
{
global $DB;
$boolBase = false;
$arFields['RECALC'] = $boolRecalc === true;
foreach (GetModuleEvents("catalog", "OnBeforePriceAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
if (!CPrice::CheckFields("ADD", $arFields, 0)) {
return false;
}
if (isset($arFields['RECALC']) && $arFields['RECALC'] === true) {
CPrice::ReCountFromBase($arFields, $boolBase);
if (!$boolBase && $arFields['EXTRA_ID'] <= 0) {
return false;
}
}
$arInsert = $DB->PrepareInsert("b_catalog_price", $arFields);
$strSql = "INSERT INTO b_catalog_price(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = (int) $DB->LastID();
if ($ID > 0 && $boolBase) {
CPrice::ReCountForBase($arFields);
}
foreach (GetModuleEvents("catalog", "OnPriceAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
// strange copy-paste bug
foreach (GetModuleEvents("sale", "OnPriceAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
return $ID;
}
示例3: Update
function Update($ID, $arFields, $boolRecalc = false)
{
global $DB;
$ID = IntVal($ID);
if ($ID <= 0) {
return False;
}
if (!CPrice::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$boolBase = false;
$arFields['RECALC'] = $boolRecalc === true ? true : false;
$db_events = GetModuleEvents("catalog", "OnBeforePriceUpdate");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
if (!empty($arFields['RECALC']) && $arFields['RECALC'] === true) {
CPrice::ReCountFromBase($arFields, $boolBase);
}
$strUpdate = $DB->PrepareUpdate("b_catalog_price", $arFields);
$strSql = "UPDATE b_catalog_price SET " . $strUpdate . " WHERE ID = " . $ID . " ";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($boolBase == true) {
CPrice::ReCountForBase($arFields);
}
$events = GetModuleEvents("catalog", "OnPriceUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
return $ID;
}
示例4: Update
function Update($ID, $arFields,$boolRecalc = false)
{
global $DB;
$ID = intval($ID);
if ($ID <= 0)
return false;
$boolBase = false;
$arFields['RECALC'] = ($boolRecalc === true ? true : false);
foreach (GetModuleEvents("catalog", "OnBeforePriceUpdate", true) as $arEvent)
{
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields))===false)
return false;
}
if (!CPrice::CheckFields("UPDATE", $arFields, $ID))
return false;
if (isset($arFields['RECALC']) && $arFields['RECALC'] === true)
{
CPrice::ReCountFromBase($arFields, $boolBase);
if (!$boolBase && 0 >= $arFields['EXTRA_ID'])
{
return false;
}
}
$strUpdate = $DB->PrepareUpdate("b_catalog_price", $arFields);
if (!empty($strUpdate))
{
$strSql = "UPDATE b_catalog_price SET ".$strUpdate." WHERE ID = ".$ID;
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
}
if ($boolBase)
{
CPrice::ReCountForBase($arFields);
}
foreach (GetModuleEvents("catalog", "OnPriceUpdate", true) as $arEvent)
{
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
return $ID;
}