当前位置: 首页>>代码示例>>PHP>>正文


PHP CPrice::GetByID方法代码示例

本文整理汇总了PHP中CPrice::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::GetByID方法的具体用法?PHP CPrice::GetByID怎么用?PHP CPrice::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPrice的用法示例。


在下文中一共展示了CPrice::GetByID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: str_replace

         } else {
             $ID_tmp = CPrice::Add($arCatalogFields);
             $arUpdatedIDs[] = $ID_tmp;
             if (!$ID_tmp) {
                 $strWarning .= str_replace("#PRICE#", $arCatalogFields["PRICE"], GetMessage("C2IT_ERROR_SAVEPRICE")) . "<br>";
             }
         }
     }
 }
 foreach ($arCatalogPrices as $catalogGroupID => $arCatalogPrice_tmp) {
     $intCountPrice = count($arCatalogPrice_tmp);
     for ($i = 0; $i < $intCountPrice; $i++) {
         if (strlen($arCatalogPrice_tmp[$i]["PRICE"]) > 0) {
             $arCatalogFields = array("EXTRA_ID" => $arCatalogPrice_tmp[$i]["EXTRA_ID"] > 0 ? $arCatalogPrice_tmp[$i]["EXTRA_ID"] : false, "PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => $catalogGroupID, "PRICE" => DoubleVal($arCatalogPrice_tmp[$i]["PRICE"]), "CURRENCY" => $arCatalogPrice_tmp[$i]["CURRENCY"], "QUANTITY_FROM" => $arCatalogPrice_tmp[$i]["QUANTITY_FROM"] > 0 ? $arCatalogPrice_tmp[$i]["QUANTITY_FROM"] : false, "QUANTITY_TO" => $arCatalogPrice_tmp[$i]["QUANTITY_TO"] > 0 ? $arCatalogPrice_tmp[$i]["QUANTITY_TO"] : false);
             if ($arCatalogPrice_tmp[$i]["ID"] > 0) {
                 $arCatalogPrice = CPrice::GetByID($arCatalogPrice_tmp[$i]["ID"]);
                 if ($arCatalogPrice && $arCatalogPrice["PRODUCT_ID"] == $PRODUCT_ID) {
                     $arUpdatedIDs[] = $arCatalogPrice_tmp[$i]["ID"];
                     if (!CPrice::Update($arCatalogPrice_tmp[$i]["ID"], $arCatalogFields)) {
                         $strWarning .= str_replace("#ID#", $arCatalogPrice_tmp[$i]["ID"], GetMessage("C2IT_ERROR_PRPARAMS")) . "<br>";
                     }
                 } else {
                     $ID_tmp = CPrice::Add($arCatalogFields);
                     $arUpdatedIDs[] = $ID_tmp;
                     if (!$ID_tmp) {
                         $strWarning .= str_replace("#PRICE#", $arCatalogFields["PRICE"], GetMessage("C2IT_ERROR_SAVEPRICE")) . "<br>";
                     }
                 }
             } else {
                 $ID_tmp = CPrice::Add($arCatalogFields);
                 $arUpdatedIDs[] = $ID_tmp;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:product_edit_action.php

示例2: foreach

						<?php 
            $arCountPricesCanAccess = 0;
            foreach ($arItem["PRICES"] as $key => $arPrice) {
                if ($arPrice["CAN_ACCESS"]) {
                    $arCountPricesCanAccess++;
                }
            }
            ?>
						<?php 
            foreach ($arItem["PRICES"] as $key => $arPrice) {
                ?>
							<?php 
                if ($arPrice["CAN_ACCESS"]) {
                    ?>
								<?php 
                    $price = CPrice::GetByID($arPrice["ID"]);
                    ?>
								<?php 
                    if ($arCountPricesCanAccess > 1) {
                        ?>
<div class="price_name"><?php 
                        echo $price["CATALOG_GROUP_NAME"];
                        ?>
</div><?php 
                    }
                    ?>
									
								<span class="price">
									<?php 
                    if ($arPrice["VALUE"] > $arPrice["DISCOUNT_VALUE"]) {
                        ?>
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:31,代码来源:template.php

示例3: getDataForXml

function getDataForXml()
{
    CModule::IncludeModule("iblock");
    CModule::IncludeModule('catalog');
    $filter["ACTIVE"] = "Y";
    $filter["ACTIVE_DATE"] = "Y";
    $filter["IBLOCK_ID"] = 2;//goodies
    $rsItems = CIBlockElement::GetList(array(), $filter, false, false, array());
    $strOfferGoogle = '';
    while ($obItem = $rsItems->GetNextElement()) {
        $arItem = $obItem->GetFields();
        if (CModule::IncludeModule("catalog") && CCatalog::GetByID($arItem['IBLOCK_ID'])) {
            $arItem = $obItem->GetFields();
            $productId = $arItem['ID'];
            $rsPrices = CPrice::GetByID($productId);
            $arItem['PROPERTIES'] = $obItem->GetProperties();
            $strFile = '';
            $arItem["DETAIL_PICTURE"] = (int)$arItem["DETAIL_PICTURE"];
            $arItem["PREVIEW_PICTURE"] = (int)$arItem["PREVIEW_PICTURE"];
            if ($arItem["DETAIL_PICTURE"] > 0 || $arItem["PREVIEW_PICTURE"] > 0) {
                $pictNo = ($arItem["DETAIL_PICTURE"] > 0 ? $arItem["DETAIL_PICTURE"] : $arItem["PREVIEW_PICTURE"]);

                if ($ar_file = CFile::GetFileArray($pictNo)) {
                    if (substr($ar_file["SRC"], 0, 1) == "/")
                        $strFile = "http://" . $_SERVER['SERVER_NAME'] . CHTTP::urnEncode($ar_file['SRC'], 'utf-8');
                    else
                        $strFile = $ar_file["SRC"];
                }
            }
            $arItem['google_PICT'] = $strFile;

            if (!empty($arItem["DETAIL_TEXT"]))
                $arItem['google_DESCR'] = google_text2xml(strip_tags(stristr($arItem["DETAIL_TEXT"], '.', true)));
            else
                $arItem['google_DESCR'] = google_text2xml(strip_tags($arItem["NAME"]));

            $strOfferGoogle .= "<item>\n";
            $strOfferGoogle .= "<title>";
            $strOfferGoogle .= $arItem['NAME'];
            $strOfferGoogle .= "</title>\n";
            $strOfferGoogle .= "<link>";
            $strOfferGoogle .= "http://".$_SERVER['SERVER_NAME'].$arItem['DETAIL_PAGE_URL'];
            $strOfferGoogle .= "</link>\n";
            $strOfferGoogle .= "<description>";
            $strOfferGoogle .= $arItem['google_DESCR'];
            $strOfferGoogle .= "</description>\n";
            $strOfferGoogle .= "<g:image_link>";
            $strOfferGoogle .= $strFile;
            $strOfferGoogle .= "</g:image_link>\n";
            $strOfferGoogle .= "<g:price>";
            $strOfferGoogle .= $rsPrices['PRICE'];
            $strOfferGoogle .= "</g:price>\n";
            $strOfferGoogle .= "<g:condition>";
            $strOfferGoogle .= "новый";
            $strOfferGoogle .= "</g:condition>\n";
            $strOfferGoogle .= "<g:id>";
            $strOfferGoogle .= $arItem['CODE'];
            $strOfferGoogle .= "</g:id>\n";
            $strOfferGoogle .= "</item>\n";
            //etc etc
        }
        else
        {
            continue;
        }
    }
    writeData($strOfferGoogle);
}
开发者ID:nycmic,项目名称:bittest,代码行数:68,代码来源:google-export.php

示例4: Add2BasketByProductID

function Add2BasketByProductID($PRODUCT_ID, $QUANTITY = 1, $arRewriteFields = array(), $arProductParams = false)
{
    global $APPLICATION;
    /* for old use */
    if (false === $arProductParams) {
        $arProductParams = $arRewriteFields;
        $arRewriteFields = array();
    }
    $PRODUCT_ID = IntVal($PRODUCT_ID);
    if ($PRODUCT_ID <= 0) {
        $APPLICATION->ThrowException(GetMessage('CATALOG_ERR_EMPTY_PRODUCT_ID'), "EMPTY_PRODUCT_ID");
        return false;
    }
    $QUANTITY = DoubleVal($QUANTITY);
    if ($QUANTITY <= 0) {
        $QUANTITY = 1;
    }
    if (!CModule::IncludeModule("sale")) {
        $APPLICATION->ThrowException(GetMessage('CATALOG_ERR_NO_SALE_MODULE'), "NO_SALE_MODULE");
        return false;
    }
    if (CModule::IncludeModule("statistic") && IntVal($_SESSION["SESS_SEARCHER_ID"]) > 0) {
        $APPLICATION->ThrowException(GetMessage('CATALOG_ERR_SESS_SEARCHER'), "SESS_SEARCHER");
        return false;
    }
    $arProduct = CCatalogProduct::GetByID($PRODUCT_ID);
    if ($arProduct === false) {
        $APPLICATION->ThrowException(GetMessage('CATALOG_ERR_NO_PRODUCT'), "NO_PRODUCT");
        return false;
    }
    $CALLBACK_FUNC = "CatalogBasketCallback";
    $productProviderClass = "CCatalogProductProvider";
    //ADD PRODUCT TO SUBSCRIBE
    if (isset($arRewriteFields["SUBSCRIBE"]) && $arRewriteFields["SUBSCRIBE"] == "Y") {
        global $USER;
        if ($USER->IsAuthorized() && !isset($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()])) {
            $_SESSION["NOTIFY_PRODUCT"][$USER->GetID()] = array();
        }
        $arBuyerGroups = CUser::GetUserGroup($USER->GetID());
        $arPrice = CCatalogProduct::GetOptimalPrice($PRODUCT_ID, 1, $arBuyerGroups, "N", array(), SITE_ID, array());
        $arCallbackPrice = array("PRICE" => $arPrice["DISCOUNT_PRICE"], "VAT_RATE" => 0, "CURRENCY" => CSaleLang::GetLangCurrency(SITE_ID), "QUANTITY" => 1);
    } else {
        $arRewriteFields["SUBSCRIBE"] = "N";
        if ($arProduct["CAN_BUY_ZERO"] != 'Y' && $arProduct["QUANTITY_TRACE"] == "Y" && DoubleVal($arProduct["QUANTITY"]) <= 0) {
            $APPLICATION->ThrowException(GetMessage('CATALOG_ERR_PRODUCT_RUN_OUT'), "PRODUCT_RUN_OUT");
            return false;
        }
        $arCallbackPrice = CSaleBasket::ReReadPrice($CALLBACK_FUNC, "catalog", $PRODUCT_ID, $QUANTITY, "N", $productProviderClass);
        if (!is_array($arCallbackPrice) || empty($arCallbackPrice)) {
            $APPLICATION->ThrowException(GetMessage('CATALOG_PRODUCT_PRICE_NOT_FOUND'), "NO_PRODUCT_PRICE");
            return false;
        }
    }
    $dbIBlockElement = CIBlockElement::GetList(array(), array("ID" => $PRODUCT_ID, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R"), false, false, array("ID", "IBLOCK_ID", "XML_ID", "NAME", "DETAIL_PAGE_URL"));
    $arIBlockElement = $dbIBlockElement->GetNext();
    if ($arIBlockElement == false) {
        $APPLICATION->ThrowException(GetMessage('CATALOG_ERR_NO_IBLOCK_ELEMENT'), "NO_IBLOCK_ELEMENT");
        return false;
    }
    $arProps = array();
    $dbIBlock = CIBlock::GetList(array(), array("ID" => $arIBlockElement["IBLOCK_ID"]));
    if ($arIBlock = $dbIBlock->Fetch()) {
        $arProps[] = array("NAME" => "Catalog XML_ID", "CODE" => "CATALOG.XML_ID", "VALUE" => $arIBlock["XML_ID"]);
    }
    $arProps[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $arIBlockElement["XML_ID"]);
    $arPrice = CPrice::GetByID($arCallbackPrice["PRODUCT_PRICE_ID"]);
    $arFields = array("PRODUCT_ID" => $PRODUCT_ID, "PRODUCT_PRICE_ID" => $arCallbackPrice["PRODUCT_PRICE_ID"], "PRICE" => $arCallbackPrice["PRICE"], "CURRENCY" => $arCallbackPrice["CURRENCY"], "WEIGHT" => $arProduct["WEIGHT"], "QUANTITY" => $QUANTITY, "LID" => SITE_ID, "DELAY" => "N", "CAN_BUY" => "Y", "NAME" => $arIBlockElement["~NAME"], "MODULE" => "catalog", "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider", "NOTES" => $arPrice["CATALOG_GROUP_NAME"], "DETAIL_PAGE_URL" => $arIBlockElement["DETAIL_PAGE_URL"], "CATALOG_XML_ID" => $arIBlock["XML_ID"], "PRODUCT_XML_ID" => $arIBlockElement["XML_ID"], "VAT_RATE" => $arCallbackPrice['VAT_RATE'], "SUBSCRIBE" => $arRewriteFields["SUBSCRIBE"]);
    if ($arProduct["CAN_BUY_ZERO"] != "Y" && $arProduct["QUANTITY_TRACE"] == "Y") {
        if (IntVal($arProduct["QUANTITY"]) - $QUANTITY < 0) {
            $arFields["QUANTITY"] = DoubleVal($arProduct["QUANTITY"]);
        }
    }
    if (is_array($arProductParams) && !empty($arProductParams)) {
        foreach ($arProductParams as &$arOneProductParams) {
            $arProps[] = array("NAME" => $arOneProductParams["NAME"], "CODE" => $arOneProductParams["CODE"], "VALUE" => $arOneProductParams["VALUE"], "SORT" => $arOneProductParams["SORT"]);
        }
        if (isset($arOneProductParams)) {
            unset($arOneProductParams);
        }
    }
    $arFields["PROPS"] = $arProps;
    if (is_array($arRewriteFields) && !empty($arRewriteFields)) {
        while (list($key, $value) = each($arRewriteFields)) {
            $arFields[$key] = $value;
        }
    }
    $addres = CSaleBasket::Add($arFields);
    if ($addres) {
        if (isset($arRewriteFields["SUBSCRIBE"]) && $arRewriteFields["SUBSCRIBE"] == "Y") {
            $_SESSION["NOTIFY_PRODUCT"][$USER->GetID()][$PRODUCT_ID] = $PRODUCT_ID;
        }
        if (CModule::IncludeModule("statistic")) {
            CStatistic::Set_Event("sale2basket", "catalog", $arFields["DETAIL_PAGE_URL"]);
        }
    }
    return $addres;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:97,代码来源:include.php

示例5: Add2BasketCustom

/**
 * Добавление в корзину
 * аналогично системной функции Add2Basket за исключением использования кастомизированных функций обратного вызова
 * также в функции отключена статистика
 * 
 * @param $PRICE_ID
 * @param $QUANTITY
 * @param $arRewriteFields
 * @param $arProductParams
 */
function Add2BasketCustom($PRICE_ID, $QUANTITY = 1, $arRewriteFields=array(), $arProductParams = array())
{
	$PRICE_ID = IntVal($PRICE_ID);
	if ($PRICE_ID<=0) return false;
	$QUANTITY = DoubleVal($QUANTITY);
	if ($QUANTITY<=0) $QUANTITY = 1;

	if (!CModule::IncludeModule("sale"))
		return false;

	$arPrice = CPrice::GetByID($PRICE_ID);
	if ($arPrice===false) return false;

	$arCatalogProduct = CCatalogProduct::GetByID($arPrice["PRODUCT_ID"]);
	if ($arCatalogProduct["QUANTITY_TRACE"]=="Y" && DoubleVal($arCatalogProduct["QUANTITY"])<=0)
		return false;

//	$arProduct = GetIBlockElement($arPrice["PRODUCT_ID"]);
	$dbIBlockElement = CIBlockElement::GetList(
			array(),
			array(
					"ID" => $arPrice["PRODUCT_ID"],
					"ACTIVE_DATE" => "Y",
					"ACTIVE" => "Y",
					"CHECK_PERMISSIONS" => "Y"
				)
		);
	$arProduct = $dbIBlockElement->GetNext();

	$arProps = array();

	$dbIBlock = CIBlock::GetList(
			array(),
			array("ID" => $arProduct["IBLOCK_ID"])
		);
	if ($arIBlock = $dbIBlock->Fetch())
	{
		$arProps[] = array(
				"NAME" => "Catalog XML_ID",
				"CODE" => "CATALOG.XML_ID",
				"VALUE" => $arIBlock["XML_ID"]
			);
	}

	$arProps[] = array(
			"NAME" => "Product XML_ID",
			"CODE" => "PRODUCT.XML_ID",
			"VALUE" => $arProduct["XML_ID"]
		);
		
	$arFields = array(
			"PRODUCT_ID" => $arPrice["PRODUCT_ID"],
			"PRODUCT_PRICE_ID" => $PRICE_ID,
			"PRICE" => $arPrice["PRICE"],
			"CURRENCY" => $arPrice["CURRENCY"],
			"WEIGHT" => $arCatalogProduct["WEIGHT"],
			"QUANTITY" => $QUANTITY,
			"LID" => LANG,
			"DELAY" => "N",
			"CAN_BUY" => "Y",
			"NAME" => $arProduct["~NAME"],
			"CALLBACK_FUNC" => "CatalogBasketCustomCallback",
			"MODULE" => "catalog",
			"NOTES" => $arPrice["CATALOG_GROUP_NAME"],
			"ORDER_CALLBACK_FUNC" => "CatalogBasketOrderCustomCallback",
			"CANCEL_CALLBACK_FUNC" => "CatalogBasketCancelCallback",
			"PAY_CALLBACK_FUNC" => "CatalogPayOrderCallback",
			"DETAIL_PAGE_URL" => $arProduct["DETAIL_PAGE_URL"],
			"CATALOG_XML_ID" => $arIBlock["XML_ID"],
			"PRODUCT_XML_ID" => $arProduct["XML_ID"]
		);
		
	if ($arCatalogProduct["QUANTITY_TRACE"]=="Y")
	{
		if (DoubleVal($arCatalogProduct["QUANTITY"])-$QUANTITY<0)
			$arFields["QUANTITY"] = DoubleVal($arCatalogProduct["QUANTITY"]);
	}

	if (is_array($arProductParams) && count($arProductParams) > 0)
	{
		for ($i = 0; $i < count($arProductParams); $i++)
		{
			$arProps[] = array(
					"NAME" => $arProductParams[$i]["NAME"],
					"CODE" => $arProductParams[$i]["CODE"],
					"VALUE" => $arProductParams[$i]["VALUE"]
				);
		}
	}
	$arFields["PROPS"] = $arProps;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:alba,代码行数:101,代码来源:basket.php


注:本文中的CPrice::GetByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。