本文整理汇总了PHP中CCatalogProductSet::recalculateSet方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogProductSet::recalculateSet方法的具体用法?PHP CCatalogProductSet::recalculateSet怎么用?PHP CCatalogProductSet::recalculateSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogProductSet
的用法示例。
在下文中一共展示了CCatalogProductSet::recalculateSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runOperation
public function runOperation()
{
global $DB;
switch (ToUpper($DB->type)) {
case 'MYSQL':
$tableName = 'b_catalog_discount';
break;
case 'MSSQL':
$tableName = 'B_CATALOG_DISCOUNT';
break;
case 'ORACLE':
$tableName = 'B_CATALOG_DISCOUNT';
break;
}
$emptyList = true;
CTimeZone::Disable();
$filter = array('TYPE' => CCatalogProductSet::TYPE_SET, 'SET_ID' => 0);
if ($this->lastID > 0) {
$filter['>ID'] = $this->lastID;
}
$topCount = $this->maxOperationCounter > 0 ? array('nTopCount' => $this->maxOperationCounter) : false;
$productSetsIterator = CCatalogProductSet::getList(array('ID' => 'ASC'), array('TYPE' => CCatalogProductSet::TYPE_SET, 'SET_ID' => 0, '>ID' => $this->lastID), false, $topCount, array('ID', 'OWNER_ID', 'ITEM_ID', 'MODIFIED_BY', 'TIMESTAMP_X'));
while ($productSet = $productSetsIterator->Fetch()) {
$emptyList = false;
$productSet['MODIFIED_BY'] = (int) $productSet['MODIFIED_BY'];
if ($productSet['MODIFIED_BY'] == 0) {
$productSet['MODIFIED_BY'] = false;
}
CCatalogProductSet::recalculateSet($productSet['ID'], $productSet['ITEM_ID']);
$arTimeFields = array('~TIMESTAMP_X' => $DB->CharToDateFunction($productSet['TIMESTAMP_X'], "FULL"), '~MODIFIED_BY' => $productSet['MODIFIED_BY']);
$strUpdate = $DB->PrepareUpdate($tableName, $arTimeFields);
if (!empty($strUpdate)) {
$strQuery = "update " . $tableName . " set " . $strUpdate . " where ID = " . $productSet['ID'];
$DB->Query($strQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
$this->allOperationCounter++;
$this->lastID = $productSet['ID'];
if ($this->maxExecutionTime > 0 && time() - $this->startOperationTime > $this->maxExecutionTime) {
break;
}
}
CTimeZone::Enable();
if ($emptyList) {
$this->finishOperation = true;
}
}