本文整理汇总了PHP中CPrice::getListEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::getListEx方法的具体用法?PHP CPrice::getListEx怎么用?PHP CPrice::getListEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPrice
的用法示例。
在下文中一共展示了CPrice::getListEx方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFromDatabase
protected function loadFromDatabase()
{
if (!isset($this->fields)) {
$pricesList = \CPrice::getListEx(array(), array("=PRODUCT_ID" => $this->id, "+<=QUANTITY_FROM" => 1, "+>=QUANTITY_TO" => 1), false, false, array("PRICE", "CURRENCY", "CATALOG_GROUP_ID", "CATALOG_GROUP_CODE"));
$this->fields = array();
while ($priceInfo = $pricesList->fetch()) {
$price_id = $priceInfo["CATALOG_GROUP_ID"];
$price = \FormatCurrency($priceInfo["PRICE"], $priceInfo["CURRENCY"]);
$this->addField($price_id, $price_id, $price);
$this->addField($priceInfo["CATALOG_GROUP_CODE"], $price_id, $price);
}
}
return is_array($this->fields);
}
示例2: loadElementPrices
/**
* Fills member elementPrices member with prices.
*
* @param integer[] $productList Identifiers of the elements.
*
* @return void
*/
protected function loadElementPrices(array $productList)
{
$priceList = \CPrice::getListEx(array(), array('PRODUCT_ID' => $productList), false, false, array('ID', 'PRODUCT_ID', 'CATALOG_GROUP_ID', 'PRICE', 'CURRENCY', 'QUANTITY_FROM', 'QUANTITY_TO'));
while ($price = $priceList->fetch()) {
if (!isset($this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]])) {
$this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]] = array();
}
$priceValue = doubleval($price["PRICE"]);
$this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]][$priceValue] = $priceValue;
}
foreach ($this->elementPrices as $catalogGroupId => $currencyPrices) {
foreach ($currencyPrices as $currency => $prices) {
if (count($prices) > 2) {
$this->elementPrices[$catalogGroupId][$currency] = array(min($prices), max($prices));
}
}
}
}
示例3: getSkuPrices
protected function getSkuPrices()
{
$result = array();
if ($this->offers) {
$ids = array();
foreach ($this->offers as $id => $offers) {
foreach ($offers as $offer) {
$ids[] = $offer['ID'];
}
}
if ($ids) {
$priceIds = $this->getVisiblePrices();
foreach ($priceIds as $id) {
$dbPrice = \CPrice::getListEx(array(), array('PRODUCT_ID' => $ids, 'CATALOG_GROUP_ID' => $id), false, false, array('PRODUCT_ID', 'PRICE', 'CURRENCY', 'QUANTITY_FROM', 'QUANTITY_TO'));
while ($arPrice = $dbPrice->fetch()) {
$arPrice['QUANTITY_FROM'] = (int) $arPrice['QUANTITY_FROM'];
$arPrice['QUANTITY_TO'] = (int) $arPrice['QUANTITY_TO'];
if (!isset($result[$id][$arPrice["PRODUCT_ID"]]) || $result[$id][$arPrice["PRODUCT_ID"]]['QUANTITY_FROM'] > $arPrice['QUANTITY_FROM']) {
$result[$id][$arPrice["PRODUCT_ID"]] = array('PRICE' => $arPrice['PRICE'], 'CURRENCY' => $arPrice['CURRENCY'], 'QUANTITY_FROM' => $arPrice['QUANTITY_FROM'], 'QUANTITY_TO' => $arPrice['QUANTITY_TO']);
}
}
unset($arPrice, $dbPrice);
}
}
}
return $result;
}
示例4: loadElementPrices
/**
* Fills member elementPrices member with prices.
*
* @param integer[] $productList Identifiers of the elements.
*
* @return void
*/
protected function loadElementPrices(array $productList)
{
$priceList = \CPrice::getListEx(array(), array('PRODUCT_ID' => $productList), false, false, array('ID', 'PRODUCT_ID', 'CATALOG_GROUP_ID', 'PRICE', 'CURRENCY', 'QUANTITY_FROM', 'QUANTITY_TO'));
while ($price = $priceList->fetch()) {
if (!$price["QUANTITY_FROM"] && !$price["QUANTITY_TO"]) {
if (!isset($this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]])) {
$this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]] = array();
}
$this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]][] = $price["PRICE"];
}
}
}