$ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($arResult["IBLOCK_ID"], $arResult["ID"]);
$arResult["IPROPERTY_VALUES"] = $ipropValues->getValues();
// Например ALT картинки анонса элемента
echo $arResult['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_ALT'];
// Например TITLE картинки анонса элемента
echo $arResult['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE'];
// Например ALT детальной картинки элементов
echo $arResult['IPROPERTY_VALUES']['ELEMENT_DETAIL_PICTURE_FILE_ALT'];
// Например TITLE детальной картинки элементов
echo $arResult['IPROPERTY_VALUES']['ELEMENT_DETAIL_PICTURE_FILE_TITLE'];
$text = '
<a href="http://ya.ru">Яндекс</a>
<a href="http://google.ru">Google</a>
<a href="http://mail.ru">Mail.ru</a>
';
preg_match_all('/<a.*?href=["\'](.*?)["\'].*?>/i', $text, $matches);
print_r($matches[1]);
Array
(
[0] => http://ya.ru
[1] => http://google.ru
[2] => http://mail.ru
)
$text = '
<a href="http://ya.ru">Яндекс</a>
<a href="http://google.ru">Google</a>
<a href="http://mail.ru">Mail.ru</a>
';
preg_match_all('/<a.*?>(.*?)<\/a>/i', $text, $matches);
print_r($matches[1]);
Array
(
[0] => Яндекс
[1] => Google
[2] => Mail.ru
)
$data = array(
'amount' => array(
"currency" => 'RUB',
"value" => '1.00'
),
"comment" => "Подписка на услуги",
"expirationDateTime" => "$date",
"customer" => array(
"phone" => "+7123456789",
"email" => "mail@yandex.ru",
"account" => "account-name"
),
"flags" => array(
"CHECK_CARD" ,
"BIND_PAYMENT_TOKEN"
),
);
$data = json_encode($data);
var result = [];
var request = new XMLHttpRequest();
request.responseType = "json";
request.open("GET", "https://spreadsheets.google.com/feeds/cells/1371WG6WudEXfukqMMakOTJSK_P33cOyXOG69LoN8tyg/1/public/full?alt=json");
request.onload = (req) => {
let gscell = req.srcElement.response.feed.entry.map( (e) => e.gs$cell);
let col_row = parseInt(gscell[gscell.length-1].row)+1;
let i = 1;
while (i < col_row) {
let res_row = gscell.filter( e => parseInt(e.row) == i);
this_row = {};
this_row.id = ( res_row.filter( e => parseInt(e.col) == 1).length) ? res_row.filter( e => parseInt(e.col) == 1)[0].inputValue : null;
this_row.english = ( res_row.filter( e => parseInt(e.col) == 2).length) ? res_row.filter( e => parseInt(e.col) == 2)[0].inputValue : null;
this_row.translation = ( res_row.filter( e => parseInt(e.col) == 3).length) ? res_row.filter( e => parseInt(e.col) == 3)[0].inputValue : null;
this_row.video = ( res_row.filter( e => parseInt(e.col) == 4).length) ? res_row.filter( e => parseInt(e.col) == 4)[0].inputValue : null;
this_row.video_format = ( res_row.filter( e => parseInt(e.col) == 5).length) ? res_row.filter( e => parseInt(e.col) == 5)[0].inputValue : null;
result.push(this_row);
i++;
}
console.log(result);
}
request.send();
use \Bitrix\Sale;
use Bitrix\Main\Context,
Bitrix\Currency\CurrencyManager,
Bitrix\Sale\Order,
Bitrix\Sale\Basket;
Bitrix\Main\Loader::includeModule("sale");
Bitrix\Main\Loader::includeModule("catalog");
Bitrix\Main\Loader::includeModule('iblock');
$basket = Sale\Basket::loadItemsForFUser(Sale\Fuser::getId(), Bitrix\Main\Context::getCurrent()->getSite());
$fields = [
[
'PRODUCT_ID' => 7050,
'QUANTITY' => 22
],
[
'PRODUCT_ID' => 7130,
'QUANTITY' => 1
],
];
foreach($fields as $field) {
$res = CIBlockElement::GetByID($ITEM['PRODUCT_ID']);
if($PRODUCT_INFO = $res->GetNext()){
if ($item = $basket->getExistsItem('basket', $field['PRODUCT_ID']))
{
$item->setField('QUANTITY' , $field['QUANTITY']);
}
else
{
$PRICE_INFO = CPrice::GetBasePrice($field['PRODUCT_ID']);
$dbPrice = CPrice::GetList(
array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC", "SORT" => "ASC"),
array("PRODUCT_ID" => $field['PRODUCT_ID']),
false,
false,
array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO")
);
while ($arPrice = $dbPrice->Fetch())
{
$arDiscounts = CCatalogDiscount::GetDiscountByPrice(
$arPrice["ID"],
1,
"N",
SITE_ID
);
$discountPrice = CCatalogProduct::CountPriceWithDiscount(
$arPrice["PRICE"],
$arPrice["CURRENCY"],
$arDiscounts
);
}
$item = $basket->createItem('basket', $field['PRODUCT_ID']);
$item->setFields(array(
'QUANTITY' => 1,
'NAME' => $PRODUCT_INFO['NAME'],
'PRICE' => $discountPrice,
'CURRENCY' => Bitrix\Currency\CurrencyManager::getBaseCurrency(),
'LID' => Bitrix\Main\Context::getCurrent()->getSite(),
'PRODUCT_PROVIDER_CLASS' => 'CCatalogProductProvider',
));
}
$basket->save();
}
}
$temp_arr = [
['CS'=> 3, 'CV'=> 9, 'V' => 9],
['CS'=> 3, 'CV'=> 9, 'V' => 9],
['CS'=> 3, 'CV'=> 9, 'V' => 9],
];
$json_temp = json_encode($temp_arr);
var_dump($json_temp );
string(68) "[{"CS":3,"CV":9,"V":9},{"CS":0,"CV":13,"V":4},{"CS":0,"CV":6,"V":6}]"
$text = "[{'CS': 3, 'CV': 9, 'V': 9}, {'CS': 0, 'CV': 13, 'V': 4}, {'CS': 0, 'CV': 6, 'V': 6}]";
$array = json_decode(str_replace('\'','"',$text));
var_dump($array);
array(3) {
[0]=>
object(stdClass)#1 (3) {
["CS"]=>
int(3)
["CV"]=>
int(9)
["V"]=>
int(9)
}
[1]=>
object(stdClass)#2 (3) {
["CS"]=>
int(0)
["CV"]=>
int(13)
["V"]=>
int(4)
}
[2]=>
object(stdClass)#3 (3) {
["CS"]=>
int(0)
["CV"]=>
int(6)
["V"]=>
int(6)
}
}
<?php
$arr = [
[
'name' => 'Найк',
'desc' => 'Кросовки',
],
[
'name' => 'Адидас',
'desc' => 'Кеды',
],
[
'name' => 'Найк',
'desc' => 'Тапки',
],
];
$result = [
'mark' => array_unique(array_column($arr, 'name')),
'type' => array_unique(array_column($arr, 'desc'))
];
?>
<video class="main-section__bg autoplay" preload="auto" loop muted="muted" playsinline preload="yes" poster="img/video-poster.jpg">
<source src="img/bg-video.webm" type="video/webm">
<source src="img/bg-video.mp4" type="video/mp4">
</video>
$(document).ready(function(){
$('.autoplay').trigger("play");
});