public static function updateAll($page = 0, &$total, $perPage = CAutoPriceUpdater::LIMIT)
 {
     $list = CCatalogProduct::GetList(array(), array('IBLOCK_ID' => self::enabledCatalogs()), false, array('iNumPage' => $page + 1, 'nPageSize' => $perPage), array('ID'));
     $total = $list->NavPageCount;
     if ($page + 1 > $list->NavPageCount) {
         return false;
     }
     $priceType = COption::GetOptionInt('autoprice', 'priceTypes', 0);
     while ($res = $list->Fetch()) {
         $price = CPrice::GetBasePrice($res['ID'], false, false);
         $priseRub = floatval($price * self::$usdRate);
         if ($priseRub < 1000 && self::$extras[0]) {
             self::setExtra($res['ID'], $priceType, self::$extras[0]);
         } elseif ($priseRub < 10000 && self::$extras[1]) {
             self::setExtra($res['ID'], $priceType, self::$extras[1]);
         } elseif ($priseRub < 100000 && self::$extras[2]) {
             self::setExtra($res['ID'], $priceType, self::$extras[2]);
         }
     }
     return $page + 1 < $total;
 }
Example #2
0
				$bError = false;
				if ($strSaveWithoutPrice != 'Y')
				{
					if (isset($arPrice[$arBaseGroup['ID']]))
					{
						if ($arPrice[$arBaseGroup['ID']] < 0)
						{
							$bError = true;
							$lAdmin->AddUpdateError(GetMessage('IBLIST_A_NO_BASE_PRICE', array("#ID#" => $elID)), $elID);
						}
					}
					else
					{
						$arBasePrice = CPrice::GetBasePrice(
							$elID,
							$CATALOG_QUANTITY_FROM[$elID][$arBaseGroup['ID']],
							$CATALOG_QUANTITY_FROM[$elID][$arBaseGroup['ID']],
							false
						);

						if (!is_array($arBasePrice) || $arBasePrice['PRICE'] < 0)
						{
							$bError = true;
							$lAdmin->AddUpdateError(GetMessage('IBLIST_A_NO_BASE_PRICE', array("#ID#" => $elID)), $elID);
						}
					}
				}

				if($bError)
					continue;

				$arCurrency = $CATALOG_CURRENCY[$elID];
Example #3
0
    /**
     * функция после добавлением элемента в инфоблока
     * @param $arFields поля элемента ифоблока
     * для страницы Объявления
     * eсли VIP объявление то добавляет корзину
     * привязывает по ID созданное объявления к товару в корзине
     * редирект на необходимы url
     */
     function AuthtorizeAfterAds(&$arFields){
         unset($_SESSION['user777999authorize']);
         if($arFields['PROPERTY_VALUES']['114']){
             foreach($arFields['PROPERTY_VALUES']['114'] as $key114 => $item114){
                 if($item114['VALUE']){
                     foreach($arFields['PROPERTY_VALUES']['113'] as $key113 => $item113){
                         if($item113['VALUE']){
                             $arFields['PROPERTY_VALUES']['113'][$key113]=ConvertDateTime($item114['VALUE'], "YYYY-MM-DD HH:MI:SS");
                         }else{
                             $arFields['PROPERTY_VALUES']['113'][n0]=ConvertDateTime($item114['VALUE'], "YYYY-MM-DD HH:MI:SS");
                         }

                     }
                 }
             }
         }

        if(($arFields["IBLOCK_ID"] == 16)&&(!CUser::IsAuthorized())){
            global $USER;
            $rsUser = CUser::GetByID($_SESSION['NEW_USER_ID']);
            $arUser = $rsUser->Fetch();
            $_SESSION['$arUser']=$arUser;
            $USER = new CUser;
            $arAuthResult = $USER->Login($arUser['LOGIN'], $arUser['PASSWORD'], "Y","N");
        }
         //$_SESSION['user777authorize']=$arFields;


         if(($arFields["IBLOCK_ID"] == 16)&&(CModule::IncludeModule("catalog"))&&(CModule::IncludeModule("sale"))){

             $price_product=floatval($arFields["PROPERTY_VALUES"][86]);
             $quantity_product=floatval($arFields["PROPERTY_VALUES"][87]);
             if($price_product){
             $PRODUCT_ID = $arFields['ID'];
             $PRICE_TYPE_ID = 1;

             $arFieldsprice = Array(
                 "PRODUCT_ID" => $PRODUCT_ID,
                 "CATALOG_GROUP_ID" => $PRICE_TYPE_ID,
                 "PRICE" =>$price_product,
                 "CURRENCY" => "RUB",
                 "QUANTITY_FROM" => 1,
             );

             $res = CPrice::GetList(
                 array(),
                 array(
                     "PRODUCT_ID" => $PRODUCT_ID,
                     "CATALOG_GROUP_ID" => $PRICE_TYPE_ID
                 )
             );

             if ($arr = $res->Fetch())
             {
                 CPrice::Update($arr["ID"], $arFieldsprice);
             }
             else
             {
                 CPrice::Add($arFieldsprice,true);
             }
             }

         }

         if (
             (
                 (($arFields["IBLOCK_ID"] == 2)&& (is_numeric($arFields["PROPERTY_VALUES"][73])))
                 ||
                 (($arFields["IBLOCK_ID"] == 15)&& (is_numeric($arFields["PROPERTY_VALUES"][76])))
                 ||
                 (($arFields["IBLOCK_ID"] == 14)&& (is_numeric($arFields["PROPERTY_VALUES"][78])))
             )
             &&
             CModule::IncludeModule("catalog")
             &&
             CModule::IncludeModule("sale")
             &&
             ((strstr($_SERVER['REQUEST_URI'],'/personal/moy-magazin/'))||(strstr($_SERVER['REQUEST_URI'],'/obyavleniya/add-ads/')))
         )
         {


             switch($arFields["IBLOCK_ID"]){
                 case 2:
                     $price_product=floatval($arFields["PROPERTY_VALUES"][73]);
                     $quantity_product=floatval($arFields["PROPERTY_VALUES"][75]);

                     break;
                 case 14:
                     $price_product=floatval($arFields["PROPERTY_VALUES"][78]);
                     $quantity_product=floatval($arFields["PROPERTY_VALUES"][79]);

                     break;
                 case 15:
                     $price_product=floatval($arFields["PROPERTY_VALUES"][76]);
                     $quantity_product=floatval($arFields["PROPERTY_VALUES"][77]);

                     break;
             }
             if($price_product){
                 $PRODUCT_ID = $arFields['ID'];
                 $PRICE_TYPE_ID = 1;
                 if($quantity_product){
                     $ar_res_product=CCatalogProduct::GetByID($PRODUCT_ID);
                     if($ar_res_product['QUANTITY']!=""){
                         $arFields_quant = array(
                             'QUANTITY' => $quantity_product
                         );
                         CCatalogProduct::Update($PRODUCT_ID, $arFields_quant);

                     }else{
                         $arFields_quant = array(
                             'ID'=>$PRODUCT_ID,
                             'QUANTITY' => $quantity_product
                         );
                         CCatalogProduct::Add($arFields_quant);
                     }
                 }
                 $arFieldsprice = Array(
                     "PRODUCT_ID" => $PRODUCT_ID,
                     "CATALOG_GROUP_ID" => $PRICE_TYPE_ID,
                     "PRICE" =>$price_product,
                     "CURRENCY" => "RUB",
                 );

                 $res = CPrice::GetList(
                     array(),
                     array(
                         "PRODUCT_ID" => $PRODUCT_ID,
                         "CATALOG_GROUP_ID" => $PRICE_TYPE_ID
                     )
                 );

                 if ($arr = $res->Fetch())
                 {
                     CPrice::Update($arr["ID"], $arFieldsprice,true);
                     $_SESSION['price_add']=$arr;
                 }
                 else
                 {
                     CPrice::Add($arFieldsprice,true);
                 }
             }

         }


        // добавление в корзину vip и поднять
        if(($arFields["IBLOCK_ID"] == 16)&&(($arFields["PROPERTY_VALUES"][81][0]==40)||($arFields["PROPERTY_VALUES"][81][0]==46))){
            
            unset($_SESSION['ELEMENT_ADS_ID']);
            if(($_REQUEST['CODE'])&&(CModule::IncludeModule("iblock"))){

                if((CModule::IncludeModule("catalog"))&&(CModule::IncludeModule("sale"))){

                    $dbBasketItems = CSaleBasket::GetList(
                        array(),
                        array(
                            "FUSER_ID" => CSaleBasket::GetBasketUserID(),
                            "LID" => SITE_ID,
				            "ORDER_ID" => "NULL"
                        ),
                        false,
                        false,
                        array("ID", "NAME")
                    );
                    if($arFields["PROPERTY_VALUES"][81][0]==46){
                        $test_ads="TEST_ADSUP";
                    }
                    if($arFields["PROPERTY_VALUES"][81][0]==40){
                        $test_ads="TEST_VIP";
                    }
                    while ($arBasketItems = $dbBasketItems->Fetch())
                    {
                        $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasketItems["ID"]));
                        if($arProp = $dbProp -> GetNext())
                        {
                            $props[] = $arProp;
                            $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasketItems["ID"]));
                            if($arProp = $dbProp -> GetNext())
                            {
                                

                                if($arProp['CODE']==$test_ads){
                                    $ELEMENT_ID = intval($arProp['VALUE']);
                                    if($ELEMENT_ID==$_REQUEST['CODE']){
                                        $vip=true;
                                    }
                                }

                            }
                        }
                    }
                }
            }
            //var_dump($vip);die();
            if(!$vip){
            $arPropsBasket = array();
            if($arFields["PROPERTY_VALUES"][81][0]==46){
                $code_price="up-ads";
                $arPropsBasket[] = array(
                    "NAME" => "Название: ".$arFields['NAME'],
                    "CODE" => "TEST_ADSUP",
                    "VALUE" => $arFields['ID']
                );
            }
            if($arFields["PROPERTY_VALUES"][81][0]==40){
                $code_price="vip-ads";
                $arPropsBasket[] = array(
                    "NAME" => "Название: ".$arFields['NAME'],
                    "CODE" => "TEST_VIP",
                    "VALUE" => $arFields['ID']
                );
            }
            $arSelect2 = Array("ID", "IBLOCK_ID", "NAME","PROPERTY_*");
            $arFilter2 = Array("IBLOCK_ID"=>17, "CODE"=>$code_price, "ACTIVE"=>"Y");
            $res2 = CIBlockElement::GetList(Array(), $arFilter2, false, Array("nPageSize"=>1), $arSelect2);
            while($ob2 = $res2->GetNextElement()){
                $arFieldIdAds = $ob2->GetFields();
                if (CModule::IncludeModule("sale"))
                {

                    $base_price=CPrice::GetBasePrice($arFieldIdAds['ID']);
                    $arFieldsB = array(
                        "PRODUCT_ID" => $arFieldIdAds['ID'],
                        "PRICE" => $base_price['PRICE'],
                        "CURRENCY" => "RUB",
                        "QUANTITY" => 1,
                        "LID" => LANG,
                        "NAME" => $arFieldIdAds['NAME'],
                    );

                    $arFieldsB["PROPS"] = $arPropsBasket;

                    $id_basket = CSaleBasket::Add($arFieldsB);

                    $db_res = CSaleBasket::GetPropsList(
                        array(
                            "SORT" => "ASC",
                            "NAME" => "ASC"
                        ),
                        array("BASKET_ID" => $id_basket)
                    );
                    while ($ar_res = $db_res->Fetch())
                    {
                        $_SESSION['order_fields_after'][]= $ar_res["NAME"]."=".$ar_res["VALUE"]."<br>";
                    }
                }
            }




            }


            unset($_SESSION['NEW_USER_ID']);
            LocalRedirect('/personal/cart/');

        }

         if(($arFields["IBLOCK_ID"] == 16)&&($arFields["PROPERTY_VALUES"][81][0]==47)){
             $_SESSION['ELEMENT_ADS_ID']=$arFields['ID'];

         }



         }
Example #4
0
		array(
			"SORT" => "ASC"
		),
		array(
			"IBLOCK_ID"				=> "3",
			"PROPERTY_CML2_LINK"	=> $arItem["ID"]
		),
		false,
		array(
			"nTopCount" => 1
		),
		array()
	);
	if ($arQuery = $dbQuery->Fetch())
	{
		$arPrice = CPrice::GetBasePrice($arQuery["ID"]);
		$arItem["PRICE"] = $arPrice["PRICE"];
	}
	else
	{
	
		$arPrice = CPrice::GetList(
			array(),
			array(
				"PRODUCT_ID" => $arItem["ID"]
			),
			false,
			array(
				"nTopCount" => 1
			),
			array()
Example #5
0
 function SetBasePrice($ProductID, $Price, $Currency, $quantityFrom = false, $quantityTo = false, $bGetID = false)
 {
     $bGetID = $bGetID == true;
     $arFields = array();
     $arFields["PRICE"] = (double) $Price;
     $arFields["CURRENCY"] = $Currency;
     $arFields["QUANTITY_FROM"] = $quantityFrom == false ? false : (int) $quantityFrom;
     $arFields["QUANTITY_TO"] = $quantityTo == false ? false : (int) $quantityTo;
     $arFields["EXTRA_ID"] = false;
     if ($arBasePrice = CPrice::GetBasePrice($ProductID, $quantityFrom, $quantityTo, false)) {
         $ID = CPrice::Update($arBasePrice["ID"], $arFields);
     } else {
         $arBaseGroup = CCatalogGroup::GetBaseGroup();
         $arFields["CATALOG_GROUP_ID"] = $arBaseGroup["ID"];
         $arFields["PRODUCT_ID"] = $ProductID;
         $ID = CPrice::Add($arFields);
     }
     if (!$ID) {
         return false;
     }
     return $bGetID ? $ID : true;
 }
Example #6
0
CModule::IncludeModule("catalog");
CModule::IncludeModule("iblock");
switch ($_REQUEST["action"]) {
    case "add":
        if (intval($_REQUEST["productid"]) > 0) {
            //добавление товара в корзину
            //$allproducts = explode("-", $_REQUEST["productid"]);
            //foreach ($allproducts as $product) {
            $product = intval($_REQUEST["productid"]);
            //$product = intval($_POST["add2basket"]);
            //проверим
            $res = CIBlockElement::GetByID($product);
            if ($ar_res = $res->GetNext()) {
                $arProps = array();
                $PRODUCT = $ar_res;
                $ar_res = CPrice::GetBasePrice($PRODUCT[ID]);
                $price = $ar_res["PRICE"];
                if (intval($price) == 0) {
                    $price = 0;
                    $arFields = array("PRODUCT_ID" => $PRODUCT[ID], "QUANTITY" => $quantity, "PRODUCT_XML_ID" => $PRODUCT[ID], "PRICE" => $price, "CURRENCY" => "RUB", "LID" => "s1", "NAME" => $PRODUCT[NAME]);
                    $basket_id = CSaleBasket::Add($arFields);
                    $arItem = CSaleBasket::GetByID($basket_id);
                    if ($arItem["QUANTITY"] != $quantity) {
                        $arFields = array("QUANTITY" => $arItem["QUANTITY"] + $quantity);
                        CSaleBasket::Update($basket_id, $arFields);
                    }
                } else {
                    $basket_id = Add2BasketByProductID($product, $quantity);
                }
            }
        }
        switch ($_REQUEST['action']) {
            case "properties":
                $arUpdate = array();
                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();
Example #8
0
                <?php 
    }
    ?>
                </p>    
            </div>
        </div>


        <div class="searchBooksWrap">
            <div class="searchWidthWrapper">
                <?php 
    foreach ($arResult["SEARCH"] as $arSearch) {
        //arshow($arSearch);
        $item = CIBlockElement::GetList(array(), array("ID" => $arSearch["ITEM_ID"]), false, false, array("ID", "PROPERTY_AUTHORS", "DETAIL_PICTURE"))->Fetch();
        //arshow($item);
        $price = CPrice::GetBasePrice($arSearch["ITEM_ID"]);
        $pict = CFile::ResizeImageGet($item["DETAIL_PICTURE"], array('width' => 165, 'height' => 233), BX_RESIZE_IMAGE_EXACT, true);
        ?>
                <div class="searchBook">
                    <div>
                        <a href="<?php 
        echo $arSearch["URL"];
        ?>
">
                        <img src="<?php 
        echo $pict["src"];
        ?>
">
                        </a>
                    </div>
                    <div class="descrWrap">
Example #9
0
 $viewedIterator = \Bitrix\Catalog\CatalogViewedProductTable::getList(array('order' => array("DATE_VISIT" => "DESC"), 'filter' => $arFilterV, 'select' => array("ELEMENT_ID", "PRODUCT_ID"), 'limit' => $arParams["PAGE_ELEMENT_COUNT"]));
 while ($arItems = $viewedIterator->fetch()) {
     $arResult[$arItems["ELEMENT_ID"]] = $arItems["PRODUCT_ID"];
 }
 unset($arItems, $viewedIterator);
 if (!empty($arResult)) {
     $arIblockId = array();
     $strImageStorePath = COption::GetOptionString("main", "upload_dir", "upload");
     $arSelect = array("ID", "NAME", "IBLOCK_SECTION_ID", "IBLOCK_TYPE_ID", "IBLOCK_ID", "DETAIL_PAGE_URL", "CATALOG_GROUP_RETAIL", "PREVIEW_PICTURE", "DETAIL_PICTURE");
     $elementIterator = CIBlockElement::GetList(array(), array("ID" => array_keys($arResult), "IBLOCK_TYPE_ID" => $arParams["IBLOCK_TYPE_ID"]), false, array(), $arSelect);
     unset($arSelect);
     while ($el = $elementIterator->GetNext()) {
         $iProductId = $arResult[$el["ID"]];
         //Если запрос не вернул цену товара, то возможно это товар с торговым предложением, поэтому получаем его базовую цену этого товара
         if ($el["CATALOG_PURCHASING_PRICE"] == "") {
             $arPrice = CPrice::GetBasePrice($iProductId);
             $el["CATALOG_PURCHASING_PRICE"] = $arPrice["PRICE"];
             $el["CATALOG_PURCHASING_CURRENCY"] = $arPrice["CURRENCY"];
         }
         //получаем скидку для товара
         $arDiscounts = CCatalogDiscount::GetDiscountByProduct($iProductId, $USER->GetUserGroupArray(), "N", 1, SITE_ID);
         //получаем цену в зависимости от скидки
         $discountPrice = false;
         if ($arDiscounts) {
             $discountPrice = CCatalogProduct::CountPriceWithDiscount($el["CATALOG_PURCHASING_PRICE"], $el["CATALOG_PURCHASING_CURRENCY"], $arDiscounts);
         }
         // путь к директории, где хранятся изображения
         $imageId = empty($el["DETAIL_PICTURE"]) ? $el["PREVIEW_PICTURE"] : $el["DETAIL_PICTURE"];
         if (!empty($imageId)) {
             /*Неэффективный кусок кода*/
             $sPath = CFile::GetByID($imageId)->GetNext();
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?
foreach($arResult["ITEMS"]["AnDelCanBuy"] as &$item){
    $ar_res = CCatalogProduct::GetByIDEx($item['PRODUCT_ID']);
    $item['DETAIL_PAGE_URL'] = $ar_res['DETAIL_PAGE_URL'];
    $item['TOTAL'] = $item['PRICE']*$item['QUANTITY'];

    $item['BASE_PRICE'] = CPrice::GetBasePrice($item['PRODUCT_ID']);
    $item["BASE_PRICE"]['PRICE'] = ceil($item["BASE_PRICE"]['PRICE']);
    $item['PRICE'] = ceil($item['PRICE']);
    if($ar_res['IBLOCK_CODE']=='tyres'){
        $rsProp = CIBlockProperty::GetByID('model', false, 'tyres');
        if($arProp = $rsProp->GetNext()){
            $rsElement = CIBlockElement::GetList(array(), array('IBLOCK_ID'=>$arProp['LINK_IBLOCK_ID'], 'ID'=>$ar_res['PROPERTIES']['model']['VALUE'], 'ACTIVE'=>'Y'), false, array('nTopCount'=>1), array('ID', 'IBLOCK_ID', 'PREVIEW_PICTURE'));
            if ($obElement = $rsElement->GetNextElement()) {
                $arFields = $obElement->GetFields();
                $arProps = $obElement->GetProperties(false, array('CODE'=>array('model_season', 'model_type', 'model_pin')));

                $item['IBLOCK_CODE']='tyres';
                $item['PREVIEW_PICTURE'] = CFile::ResizeImageGet($arFields['PREVIEW_PICTURE'], array('width'=>43, 'height'=>60), BX_RESIZE_IMAGE_PROPORTIONAL, true);
                $item['PROPERTIES'] = $arProps;
            }
        }
    }elseif($ar_res['IBLOCK_CODE']=='wheels'){
        $rsProp = CIBlockProperty::GetByID('model', false, 'wheels');
        if($arProp = $rsProp->GetNext()){
            $rsElement = CIBlockElement::GetList(array(), array('IBLOCK_ID'=>$arProp['LINK_IBLOCK_ID'], 'ID'=>$ar_res['PROPERTIES']['model']['VALUE'], 'ACTIVE'=>'Y'), false, array('nTopCount'=>1), array('ID', 'IBLOCK_ID', 'PREVIEW_PICTURE'));
            if ($obElement = $rsElement->GetNextElement()) {
                $arFields = $obElement->GetFields();

                $item['IBLOCK_CODE']='wheels';
Example #11
0
 public function getBasePriceArray()
 {
     if (!class_exists('\\CPrice')) {
         \CModule::IncludeModule('catalog');
     }
     return \CPrice::GetBasePrice($this->id);
 }
Example #12
0
 /**
  * Получает информацию о товаре из Битрикса
  */
 public function loadItemInfo()
 {
     if (!$this->id) {
         return;
     }
     $elementManager = new \CIBlockElement();
     if ($info = $elementManager->GetByID($this->id)->GetNext(true, false)) {
         $this->setName($info['NAME']);
         $this->setPreviewPicture($info['PREVIEW_PICTURE']);
         $this->setDetailPicture($info['DETAIL_PICTURE']);
         $this->setUrl($info['DETAIL_PAGE_URL']);
     }
     if (Loader::includeModule('sale')) {
         $priceManager = new \CPrice();
         $price = $priceManager->GetBasePrice($this->id);
         $this->setPrice($price['PRICE']);
     }
     if (Loader::includeModule('catalog') && !$this->quantity) {
         $parameters = ['filter' => ['ID' => $this->id], 'select' => ['ID', 'QUANTITY']];
         $storeDb = ProductTable::getList($parameters);
         while ($arData = $storeDb->fetch()) {
             $this->quantity += (int) $arData['QUANTITY'];
         }
     }
     if ($this->quantity < 0) {
         $this->quantity = 0;
     }
 }
	}

		
	$res =  CIBlockElement :: GetList ($arSort, $arFilter, false,false, $arSelect);
	$current_count_element=0;
	$res_el = array();
	while($ob = $res->GetNextElement())
		{
			$current_count_element++;
			if($arParams["ELEMENT_COUNT"]!="")
			{
				if($current_count_element>$arParams["ELEMENT_COUNT"])
				{
					break;
				}
			}
			$arFields = $ob->GetFields();
			$res_el["ID"]=$arFields["ID"];
			$res_el["NAME"]=$arFields["NAME"];
			$res_el["DETAIL_PAGE_URL"]=$arFields["DETAIL_PAGE_URL"];
			$res_el["DETAIL_PICTURE"]=$arFields["DETAIL_PICTURE"];
			$res_el["PRICE"] = CPrice::GetBasePrice($arFields["ID"]);
			$res_el["ANOUNCE"] = $arFields["PREVIEW_TEXT"];
			array_push($arResult, $res_el);
		}
	$this->IncludeComponentTemplate();
	$cache->EndDataCache();
}


?>
Example #14
0
        }
        echo CCurrency::SelectBox("CAT_PURCHASING_CURRENCY", $arBaseProduct['PURCHASING_CURRENCY'], "", true, "", "id='CAT_PURCHASING_CURRENCY' {$isDisabled}");
        ?>
</td>
		</tr>
	<?php 
    }
    ?>
	<tr id="tr_BASE_PRICE" style="display: <?php 
    echo $bUseExtendedPrice ? 'none' : 'table-row';
    ?>
;">
		<td width="40%">
	<?php 
    $arBaseGroup = CCatalogGroup::GetBaseGroup();
    $arBasePrice = CPrice::GetBasePrice($PRODUCT_ID, $arPriceBoundaries[0]["FROM"], $arPriceBoundaries[0]["TO"]);
    echo GetMessage("BASE_PRICE");
    ?>
 (<?php 
    echo GetMessage('C2IT_PRICE_TYPE');
    ?>
 "<?php 
    echo htmlspecialcharsbx(!empty($arBaseGroup['NAME_LANG']) ? $arBaseGroup['NAME_LANG'] : $arBaseGroup["NAME"]);
    ?>
"):
		</td>
		<td width="60%">
<script type="text/javascript">
var arExtra = [], arExtraPrc = [];
	<?php 
    $db_extras = CExtra::GetList($by3 = "NAME", $order3 = "ASC");
Example #15
0
    <div class="row">
        <div class="carousel slide" id="myCarousel<?php 
    echo $arResult["ID"];
    ?>
">
            <div class="carousel-inner">
                <?php 
    foreach ($arResult['ITEMS'] as $key => $arItem) {
        $this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], $strElementEdit);
        $this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], $strElementDelete, $arElementDeleteParams);
        $strMainID = $this->GetEditAreaId($arItem['ID']);
        $arItemIDs = array('ID' => $strMainID, 'PICT' => $strMainID . '_pict', 'SECOND_PICT' => $strMainID . '_secondpict', 'STICKER_ID' => $strMainID . '_sticker', 'SECOND_STICKER_ID' => $strMainID . '_secondsticker', 'QUANTITY' => $strMainID . '_quantity', 'QUANTITY_DOWN' => $strMainID . '_quant_down', 'QUANTITY_UP' => $strMainID . '_quant_up', 'QUANTITY_MEASURE' => $strMainID . '_quant_measure', 'BUY_LINK' => $strMainID . '_buy_link', 'BASKET_ACTIONS' => $strMainID . '_basket_actions', 'NOT_AVAILABLE_MESS' => $strMainID . '_not_avail', 'SUBSCRIBE_LINK' => $strMainID . '_subscribe', 'COMPARE_LINK' => $strMainID . '_compare_link', 'PRICE' => $strMainID . '_price', 'DSC_PERC' => $strMainID . '_dsc_perc', 'SECOND_DSC_PERC' => $strMainID . '_second_dsc_perc', 'PROP_DIV' => $strMainID . '_sku_tree', 'PROP' => $strMainID . '_prop_', 'DISPLAY_PROP_DIV' => $strMainID . '_sku_prop', 'BASKET_PROP_DIV' => $strMainID . '_basket_prop');
        $strObName = 'ob' . preg_replace("/[^a-zA-Z0-9_]/", "x", $strMainID);
        $productTitle = isset($arItem['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE']) && $arItem['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE'] != '' ? $arItem['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE'] : $arItem['NAME'];
        $imgTitle = isset($arItem['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE']) && $arItem['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE'] != '' ? $arItem['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE'] : $arItem['NAME'];
        $itemPrice = CPrice::GetBasePrice($arItem['ID'])["PRICE"];
        //for carousel
        if ($itemnum == 0) {
            $itemclass = "item active";
            $itemnum = 1;
        } else {
            $itemclass = "item";
        }
        ?>

                    <?php 
        if ($itemnum == 1) {
            ?>
                       <div class="<?php 
            echo $itemclass;
            ?>
Example #16
0
	function ReCalculate($TYPE, $ID, $VAL)
	{
		$ID = intval($ID);
		if (0 < $ID)
		{
			if ('EXTRA' == $TYPE)
			{
				$db_res = CPrice::GetList(
					array(),
					array('EXTRA_ID' => $ID),
					false,
					false,
					array('ID', 'PRODUCT_ID', 'EXTRA_ID', 'QUANTITY_FROM', 'QUANTITY_TO')
				);
				while ($res = $db_res->Fetch())
				{
					$arFields = array();
					if ($arBasePrice = CPrice::GetBasePrice($res["PRODUCT_ID"], $res["QUANTITY_FROM"], $res["QUANTITY_TO"]))
					{
						$arFields["PRICE"] = RoundEx($arBasePrice["PRICE"] * (1 + 1 * $VAL / 100), 2);
						$arFields["CURRENCY"] = $arBasePrice["CURRENCY"];
						CPrice::Update($res["ID"], $arFields);
					}
				}
			}
			else
			{
				$db_res = CPrice::GetList(
					array(),
					array("PRODUCT_ID" => $ID),
					false,
					false,
					array('ID', 'PRODUCT_ID', 'EXTRA_ID')
				);
				while ($res = $db_res->Fetch())
				{
					$res["EXTRA_ID"] = intval($res["EXTRA_ID"]);
					if (0 < $res["EXTRA_ID"])
					{
						$res1 = CExtra::GetByID($res["EXTRA_ID"]);
						$arFields = array(
							"PRICE" => $VAL * (1 + 1 * $res1["PERCENTAGE"] / 100),
						);
						CPrice::Update($res["ID"], $arFields);
					}
				}
			}
		}
	}
Example #17
0
 function ReCalculate($TYPE, $ID, $VAL)
 {
     $ID = IntVal($ID);
     if ($TYPE == "EXTRA") {
         $db_res = CPrice::GetList(array("EXTRA_ID" => "ASC"), array("EXTRA_ID" => $ID));
         while ($res = $db_res->Fetch()) {
             unset($arFields);
             $arFields = array();
             if ($arBasePrice = CPrice::GetBasePrice($res["PRODUCT_ID"], $res["QUANTITY_FROM"], $res["QUANTITY_TO"])) {
                 $arFields["PRICE"] = RoundEx($arBasePrice["PRICE"] * (1 + 1 * $VAL / 100), 2);
                 $arFields["CURRENCY"] = $arBasePrice["CURRENCY"];
                 CPrice::Update($res["ID"], $arFields);
             }
         }
     } else {
         $db_res = CPrice::GetList(array("PRODUCT_ID" => "ASC"), array("PRODUCT_ID" => $ID));
         while ($res = $db_res->Fetch()) {
             if (IntVal($res["EXTRA_ID"]) > 0) {
                 $res1 = CExtra::GetByID($res["EXTRA_ID"]);
                 unset($arFields);
                 $arFields["PRICE"] = $VAL * (1 + 1 * $res1["PERCENTAGE"] / 100);
                 CPrice::Update($res["ID"], $arFields);
             }
         }
     }
 }