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


PHP CPrice::SetBasePrice方法代码示例

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


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

示例1: setBasePrice

 public function setBasePrice($price, $currencyId = 'RUB')
 {
     if (!class_exists('\\CPrice')) {
         \CModule::IncludeModule('catalog');
     }
     return \CPrice::SetBasePrice($this->id, $price, $currencyId);
 }
开发者ID:AlexSmerw,项目名称:domino,代码行数:7,代码来源:Object.class.php

示例2: foreach

     foreach($fields as $code => $field) {
         if($_REQUEST[$code]) {
             $arUpdate[$code] = $_REQUEST[$code];
         }
     }  
     foreach ($props as $prop) {
         if($_REQUEST['props'][$prop["ID"]]) { 
             CIBlockElement::SetPropertyValuesEx($ID, $IBLOCK_ID, array($prop["ID"] => $_REQUEST['props'][$prop["ID"]]));
         } 
     } 
     if($bCatalog && $_REQUEST['base_price_multiplier'] && isset($_REQUEST['base_price_add']) ) {
                 $arr = CPrice::GetBasePrice($ID);
                 $price = $arr["PRICE"];  
                 $price = $price * $_REQUEST['base_price_multiplier']; 
                 $price = $price + $_REQUEST['base_price_add'];
                 CPrice::SetBasePrice($ID, $price, $arr["CURRENCY"]); 
             }
     if(count($arUpdate)) { 
         $el = new CIBlockElement;  
         $el->Update($ID, $arUpdate);
     }
     break;
 case "delete":
     if (CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_delete")) {
         @set_time_limit(0);
         $DB->StartTransaction();
         $APPLICATION->ResetException();
         if (!CIBlockElement::Delete($ID)) {
             $DB->Rollback();
             if ($ex = $APPLICATION->GetException())
                 $lAdmin->AddGroupError(GetMessage("IBLOCK_DELETE_ERROR") . " [" . $ex->GetString() . "]", $ID);
开发者ID:ASDAFF,项目名称:bitrix-modules-setprops,代码行数:31,代码来源:setprops.php

示例3: importElement

    private function importElement($arItems, $IBLOCK_ID = 0, $event = 'element')
    {
        if (!$IBLOCK_ID)
        {
            $IBLOCK_ID = $this->CATALOG_ID;
        }
        $arResult = array();
        $arOffers = array();

        $el = new \CIBlockElement;
        foreach ($arItems as $arItem)
        {
            if (!strlen($arItem['XML_ID']))
            {
                throw new \Exception('Empty element XML ID '.$arItem['name']);
            }
            $boolUpdate = true;

            if (!strlen($arItem['CODE']))
            {
                $arItem['CODE'] = \CUtil::translit($arItem['NAME'], 'ru', array(
                    "replace_space" => '-',
                    "replace_other" => '-'
                ));
            }
            $arLoadProduct = array(
                'ACTIVE'      => $arItem['ACTIVE'],
                'XML_ID'      => $arItem['XML_ID'],
                'NAME'        => $arItem['NAME'],
                'CODE'        => $arItem['CODE'],
                'DETAIL_TEXT' => $arItem['DESCRIPTION'],
            );
            $params = array(
                'select' => array('ID', 'ACTIVE'),
                'filter' => array(
                    '=IBLOCK_ID' => $IBLOCK_ID,
                    '=XML_ID'    => $arItem['XML_ID']
                )
            );
            $arElem = ElementTable::getRow($params);
            if ($arElem['ID'] > 0)
            {
                $boolUpdate = !App::compareHash($arItem);
                if ($boolUpdate || $arItem['ACTIVE'] !== $arElem['ACTIVE'])
                {
                    $el->Update($arElem['ID'], $arLoadProduct);
                    Report::update($event);
                }
            }
            else
            {
                $arSection = $this->getSectionByXML($arItem['SECTION_XML_ID'], $IBLOCK_ID);
                if (!$arSection['ID'])
                {
                    throw new \Exception('Cant find section with XML ID: '.$arItem['SECTION_XML_ID']);
                }
                $arLoadProduct = array_merge($arLoadProduct, array(
                    'IBLOCK_SECTION_ID' => $arSection['ID'],
                    'IBLOCK_ID'         => $IBLOCK_ID
                ));
                $arElem['ID'] = $el->Add($arLoadProduct);

                App::compareHash($arItem);
                Report::create($event);
            }

            // если элемент не нашли и не создали, выплюнем эксепшен
            if (!$arElem['ID'])
            {
                throw new \Exception('Cant create element');
            }
            $arResult[$arItem['XML_ID']] = $arElem['ID'];

            if ($boolUpdate)
            {
                $arCatalogProduct = array(
                    "ID"     => $arElem['ID'],
                    "WEIGHT" => $arItem['WEIGHT']
                );
                \CCatalogProduct::Add($arCatalogProduct);                      // добавим элемент в каталог
                \CPrice::SetBasePrice($arElem['ID'], $arItem['PRICE'], "RUB"); // установим базовую цену

                $arOfferProp = array();
                if (!empty($arItem['MODIFIERS']))
                {
                    foreach ($arItem['MODIFIERS'] as $arMod)
                    {
                        $arOfferProp[] = array(
                            'XML_ID'       => $this->defaultSectionID,
                            'VALUE_XML_ID' => $arMod['XML_ID'],
                            'REQUIRED'     => $arMod['REQUIRED']
                        );
                    }
                }
                if (!empty($arItem['GROUP_MODIFIERS'])) // тут то же самое, только нужно создать ТП из всего свойства, а не из конкретного значения
                {
                    foreach ($arItem['GROUP_MODIFIERS'] as $arMod)
                    {
                        $arOfferProp[] = array(
                            'XML_ID'       => $arMod['XML_ID'],
//.........这里部分代码省略.........
开发者ID:phwb,项目名称:ugraweb.iiko,代码行数:101,代码来源:import.php


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