本文整理汇总了PHP中CPrice::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::getList方法的具体用法?PHP CPrice::getList怎么用?PHP CPrice::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPrice
的用法示例。
在下文中一共展示了CPrice::getList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
{
$img = CFile::GetFileArray($viewed[$fields['ID']]['DETAIL_PICTURE']);
if($img)
$viewed[$fields['ID']]['DETAIL_PICTURE'] = $img['SRC'];
else
$viewed[$fields['ID']]['DETAIL_PICTURE'] = false;
}
else
{
$viewed[$fields['ID']]['DETAIL_PICTURE'] = false;
}
}
// Prices
$priceIterator = CPrice::getList(array(), array("PRODUCT_ID" => $filter['ID']), false, false, array("PRODUCT_ID", "PRICE", "CURRENCY"));
while($price = $priceIterator->fetch())
{
if(!isset($viewed[$price['PRODUCT_ID']]['PRICE']))
{
$viewed[$price['PRODUCT_ID']]['PRICE'] = $price['PRICE'];
$viewed[$price['PRODUCT_ID']]['CURRENCY'] = $price['CURRENCY'];
}
}
}
//
$arViewedResult = fDeleteDoubleProduct($viewed, $arFilterRecommended, 'N');
if (empty($arViewedResult["ITEMS"]))
$displayNoneViewed = "none";
$tabBasket = "tabs";
示例2: 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::getList(array(), array('PRODUCT_ID' => $ids, 'CATALOG_GROUP_ID' => $id), false, false, array('PRODUCT_ID', 'PRICE', 'CURRENCY'));
while ($arPrice = $dbPrice->fetch()) {
$result[$id][$arPrice["PRODUCT_ID"]] = array('PRICE' => $arPrice['PRICE'], 'CURRENCY' => $arPrice['CURRENCY']);
}
}
}
}
return $result;
}
示例3: array
$row =& $lAdmin->AddRow($arItems["ID"], $arItems);
$isProductExistSKU = false;
if (!$boolSubscribe) {
$isProductExistSKU = $arCatalogProduct['EXIST_SKU'];
}
$arResult = array();
if ($isProductExistSKU) {
$arResult = GetProductSku($buyerId, $lid, $arItems["ID"], $arItems["NAME"], '', $arItems);
$arSKUId = $arSKUPricesResult = array();
if (isset($arResult["SKU_ELEMENTS"]) && !empty($arResult["SKU_ELEMENTS"]) && is_array($arResult["SKU_ELEMENTS"])) {
foreach ($arResult["SKU_ELEMENTS"] as $sku) {
$arSKUId[] = $sku["ID"];
}
}
foreach ($arPrices as $price) {
$dbPrice = CPrice::getList(array(), array('PRODUCT_ID' => $arSKUId, 'CATALOG_GROUP_ID' => $price['ID']), false, false, array('PRODUCT_ID', 'PRICE'));
while ($arPrice = $dbPrice->fetch()) {
$arSKUPricesResult[$price['ID']][$arPrice["PRODUCT_ID"]] = $arPrice["PRICE"];
}
}
$active = $arItems["ACTIVE"] == 'Y' ? GetMEssage('SPS_PRODUCT_ACTIVE') : GetMEssage('SPS_PRODUCT_NO_ACTIVE');
if (!empty($arResult["SKU_ELEMENTS"])) {
$OfferIblockId = $arResult["OFFERS_IBLOCK_ID"];
$row->AddField("ACTIVE", $active);
$row->AddField("ACT", '<input type="button" onclick="fShowSku(this, ' . CUtil::PhpToJSObject($arResult["SKU_ELEMENTS"]) . ');" name="btn_show_sku_' . $arItems["ID"] . '" value="' . GetMessage("SPS_SKU_SHOW") . '">');
$row->AddViewField("PREVIEW_PICTURE", CFileInput::Show('NO_FIELDS[' . $arItems['ID'] . '][PREVIEW_PICTURE]', $arItems['PREVIEW_PICTURE'], array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxImageSize, "MIN_SIZE" => $minImageSize), array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false)));
$row->AddViewField("DETAIL_PICTURE", CFileInput::Show('NO_FIELDS[' . $arItems['ID'] . '][DETAIL_PICTURE]', $arItems['DETAIL_PICTURE'], array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxImageSize, "MIN_SIZE" => $minImageSize), array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false)));
$arProperties = array();
if (!empty($arSelectedProps)) {
$rsProperties = CIBlockElement::GetProperty($iblockId, $arItems["ID"]);
while ($ar = $rsProperties->Fetch()) {
示例4: array
));
while($viewed = $viewedIterator->fetch())
{
$viewed['MODULE'] = 'catalog';
$arViewed[$viewedCount] = $viewed;
$arViewedIds[] = $viewed['PRODUCT_ID'];
$mapViewed[$viewed['PRODUCT_ID']] = $viewedCount;
$viewedCount++;
}
unset($viewedCount);
$baseGroup = CCatalogGroup::getBaseGroup();
if (!empty($arViewedIds))
{
$priceIterator = CPrice::getList(
array(),
array("PRODUCT_ID" => $arViewedIds, 'CATALOG_GROUP_ID' => $baseGroup['ID']), false, false, array("PRODUCT_ID", "PRICE", "CURRENCY"));
while($productPrice = $priceIterator->fetch() )
{
if (isset($mapViewed[$productPrice['PRODUCT_ID']]))
{
$key = $mapViewed[$productPrice['PRODUCT_ID']];
$arViewed[$key]["PRICE"] = $productPrice["PRICE"];
$arViewed[$key]["CURRENCY"] = $productPrice["CURRENCY"];
}
}
}
$viewedCnt = count($arViewed);
$arViewed = array_slice($arViewed, 0, 2);
if (count($arViewed) <= 0)
$displayNoneViewed = "none";
示例5: GetList
/**
* The function select viewed product
*
* @param array $arOrder - array to sort
* @param array $arFilter - array to filter
* @param array $arGroupBy - array to group records
* @param array $arNavStartParams - array to parameters
* @param array $arSelectFields - array to selectes fields
* @return object $dbRes - object result
*/
public static function GetList($arOrder = array("ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
global $DB;
if (array_key_exists("DATE_FROM", $arFilter)) {
$arFilter[">=DATE_VISIT"] = trim($arFilter["DATE_FROM"]);
unset($arFilter["DATE_FROM"]);
}
if (array_key_exists("DATE_TO", $arFilter)) {
$arFilter["<=DATE_VISIT"] = trim($arFilter["DATE_TO"]);
unset($arFilter["DATE_TO"]);
}
if (!$arSelectFields || count($arSelectFields) <= 0 || in_array("*", $arSelectFields)) {
$arSelectFields = array("ID", "FUSER_ID", "DATE_VISIT", "PRODUCT_ID", "MODULE", "LID", "NAME", "DETAIL_PAGE_URL", "CURRENCY", "PRICE", "NOTES", "PREVIEW_PICTURE", "DETAIL_PICTURE", "CALLBACK_FUNC", "PRODUCT_PROVIDER_CLASS");
}
if (\Bitrix\Main\Loader::includeModule("catalog")) {
if (\Bitrix\Main\Config\Option::get("sale", "viewed_capability", "") == "Y") {
foreach ($arFilter as $key => $value) {
if ($key == "LID") {
$arFilter['SITE_ID'] = $value;
unset($arFilter['LID']);
}
}
$limit = 100;
if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) >= 0) {
$limit = IntVal($arNavStartParams["nTopCount"]);
}
$viewedIterator = \Bitrix\Catalog\CatalogViewedProductTable::getList(array("filter" => $arFilter, "select" => array("ID", "PRODUCT_ID", "DATE_VISIT", "LID" => "SITE_ID", "NAME" => "ELEMENT.NAME"), "order" => array("DATE_VISIT" => "DESC"), "limit" => $limit));
$viewed = array();
while ($row = $viewedIterator->fetch()) {
$row['MODULE'] = "catalog";
$row['DATE_VISIT'] = $row['DATE_VISIT']->toString();
$viewed[$row['PRODUCT_ID']] = $row;
}
if (count($viewed)) {
// Map to parent sku
$newIds = array();
$ids = array_keys($viewed);
$catalogIterator = CCatalog::getList();
while ($catalog = $catalogIterator->fetch()) {
if ($catalog['IBLOCK_TYPE_ID'] == "offers") {
$elementIterator = CIBlockElement::getList(array(), array("ID" => $ids, "IBLOCK_ID" => $catalog['IBLOCK_ID']), false, false, array("ID", "IBLOCK_ID", "PROPERTY_" . $catalog['SKU_PROPERTY_ID']));
while ($item = $elementIterator->fetch()) {
$propertyName = "PROPERTY_" . $catalog['SKU_PROPERTY_ID'] . "_VALUE";
$parentId = $item[$propertyName];
if (!empty($parentId)) {
$newIds[$item['ID']] = $parentId;
} else {
$newIds[$item['ID']] = $item['ID'];
}
}
}
}
// Push missing
foreach ($ids as $id) {
if (!isset($newIds[$id])) {
$newIds[$id] = $id;
}
}
$filter = array("ID" => array_values($newIds));
if (!count($filter['ID'])) {
$filter = array("ID" => -1);
}
$mapped = array();
if (in_array("DETAIL_PAGE_URL", $arSelectFields) || in_array("PREVIEW_PICTURE", $arSelectFields) || in_array("DETAIL_PICTURE", $arSelectFields)) {
$elementIterator = CIBlockElement::GetList(array(), $filter);
while ($elementObj = $elementIterator->GetNextElement()) {
$fields = $elementObj->GetFields();
$mapped[$fields['ID']]['PREVIEW_PICTURE'] = $fields['PREVIEW_PICTURE'];
$mapped[$fields['ID']]['DETAIL_PICTURE'] = $fields['DETAIL_PICTURE'];
}
}
foreach ($newIds as $natural => $tr) {
$viewed[$natural]['PREVIEW_PICTURE'] = $mapped[$tr]['DETAIL_PICTURE'];
$viewed[$natural]['DETAIL_PICTURE'] = $mapped[$tr]['PREVIEW_PICTURE'];
$viewed[$natural]['PRODUCT_ID'] = $tr;
}
if (in_array("CURRENCY", $arSelectFields) || in_array("PRICE", $arSelectFields)) {
// Prices
$priceIterator = CPrice::getList(array(), array("PRODUCT_ID" => $ids), false, false, array("PRODUCT_ID", "PRICE", "CURRENCY"));
while ($price = $priceIterator->fetch()) {
if (!isset($viewed[$price['PRODUCT_ID']]['PRICE'])) {
$viewed[$price['PRODUCT_ID']]['PRICE'] = $price['PRICE'];
$viewed[$price['PRODUCT_ID']]['CURRENCY'] = $price['CURRENCY'];
}
}
}
}
// resort
$dbresult = new CDBResult();
$dbresult->InitFromArray(array_values($viewed));
//.........这里部分代码省略.........