function isChildSections($sectionId)
{
$sectionIterator = \CIBlockSection::GetList(
['ID' => 'ASC'],
[
'SECTION_ID' => $sectionId
],
false,
['ID'],
[
'nTopCount' => 1
]
);
return (bool) $sectionIterator->SelectedRowsCount();
}
p:not(.not-pad) {padding: 20px;}
use Bitrix\Sale\Order;
use Bitrix\Sale\BasketItem;
$orderId = 1234; // id заказа, в корзине которого нужно изменить названия товаров
$basket = Order::load($orderId)->getBasket();
/** @var BasketItem $basketItem */
foreach ($basket as $basketItem) {
$basketItem->setField('NAME', 'Новое название товара');
}
$basket->save();
h1 {
display: inline-block;
position: relative;
font-size: 52px;
margin-bottom: 40px;
margin-top: 10px;
padding: 5px;
}
h1:after {
content: '';
display: block;
background: rgba(251,218,3,0.8);
position: absolute;
top: 50%;
left: 0;
margin-top: -9px;
height: 18px;
width: 100%;
z-index: -1;
}
<?php
$aMenuLinks = Array(
Array(
"Пункт меню",
"/link/",
Array(),
Array(
'noindex' => true,
),
""
),
);
use Bitrix\Sale;
$productId = 1234; // id нашего товара
// получаем корзину пользователя
$basket = Sale\Basket::loadItemsForFUser(
Sale\Fuser::getId(),
Bitrix\Main\Context::getCurrent()->getSite()
);
/** @var Sale\BasketItem $basketItem */
foreach ($basket as $basketItem) {
if ($basketItem->getProductId() == $productId) {
$basketItem->setField('QUANTITY', $basketItem->getQuantity() - 1);
}
}
$basket->save();
use Bitrix\Sale\Compatible\DiscountCompatibility;
use Bitrix\Sale\Basket;
use Bitrix\Sale\Discount\Gift;
use Bitrix\Sale\Fuser;
class DiscountsHelper
{
/**
* Возвращает массив id всех доступных подарков для товара
*
* @param int $productId - идентификатор товара
* @return array - массив с id подарков для товара
*/
public static function getGiftIds($productId)
{
$giftProductIds = [];
if (!$productId) {
return $giftProductIds;
}
DiscountCompatibility::stopUsageCompatible();
$giftManager = Gift\Manager::getInstance();
$potentialBuy = [
'ID' => $productId,
'MODULE' => 'catalog',
'PRODUCT_PROVIDER_CLASS' => 'CCatalogProductProvider',
'QUANTITY' => 1,
];
$basket = Basket::loadItemsForFUser(Fuser::getId(), SITE_ID);
$basketPseudo = $basket->copy();
foreach ($basketPseudo as $basketItem) {
$basketItem->delete();
}
$collections = $giftManager->getCollectionsByProduct($basketPseudo, $potentialBuy);
foreach ($collections as $collection) {
/** @var \Bitrix\Sale\Discount\Gift\Gift $gift */
foreach ($collection as $gift) {
$giftProductIds[] = $gift->getProductId();
}
}
DiscountCompatibility::revertUsageCompatible();
return $giftProductIds;
}
}
$iterator = \CIBlockElement::GetList(
[],
[
'ID' => $elementId,
],
false,
false,
[
'DETAIL_PAGE_URL',
]
);
if ($item = $iterator->GetNext()) {
echo $item['DETAIL_PAGE_URL'];
}
array(
'CONDITION' => "#^/catalog/test/form/#",
'PATH' => '/catalog/form.php',
),