<?php
namespace App;
class Task extends Model
{
public static function getTasks()
{
$tasks = App\Task::get();
return $tasks;
}
}
<?php
\Bitrix\Main\Loader::includeModule('highloadblock');
$hlBlockId = 1;
$hlObject = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlBlockId)->fetch();
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlObject);
$entity_data_class = $entity->getDataClass();
$newsList = $entity_data_class::getList([
'filter' => $filter,
'offset' => $nav->getOffset(),
'limit' => $nav->getLimit(),
]);
_blank
зашит в классе, без возможности переопределения (пример)$json[0]
не отрабатывает, потому что у вас нет 0 индекса<?php
$url = file_get_contents('https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,ETH,BCH&tsyms=BTC,USD&api_key=MY-API-KEY');
$json = json_decode($url, true);
echo 'Eth to usd: ' . $json['ETH']['USD'];
$request = Application::getInstance()->getContext()->getRequest();
$productId = intval( $request->getPost("id")
$_POST['id']
$basket = Sale\Basket::loadItemsForFUser(Sale\Fuser::getId(), Bitrix\Main\Context::getCurrent()->getSite());
$request->getPost("id") - как получить это?
<?php
$START_DATE = "01.04.2019";
$END_DATE = "31.04.2019";
$object_list = [
[
"num" => "0003000000006739",
"qr_code" => "18826807734421200000",
"entry_date" => "23.03.2019 16:43",
],
[
"num" => "0003000000006739",
"qr_code" => "18826807734421200000",
"entry_date" => "23.04.2019 16:43",
],
[
"num" => "0003000000006739",
"qr_code" => "18826807734421200000",
"entry_date" => "23.05.2019 16:43"
]
];
$ts_from = strtotime($START_DATE);
$ts_to = strtotime($END_DATE);
foreach ($object_list as $item) {
$ts = strtotime($item['entry_date']);
if ($ts > $ts_from && $ts <= $ts_to) {
echo '<pre style="color: red;">', print_r($item, true), '</pre>';
}
}
if (\Bitrix\Main\Loader::includeModule('sale')) {
$order = \Bitrix\Sale\Order::load($orderId);
$appliedDiscount = $order->getDiscount()->getApplyResult(true);
$discounts = [];
foreach ($appliedDiscount['DISCOUNT_LIST'] as $discount) {
$discounts[] = $discount['REAL_DISCOUNT_ID'];
// Информация о примененной скидке
echo '<pre style="color: red;">', print_r($discount, true), '</pre>';
}
$appliedList = Bitrix\Sale\Internals\DiscountTable::getList([
'filter' => ['=ID' => $discounts]
])->fetchAll();
// Подробная информация о скидке
echo '<pre style="color: red;">', print_r($appliedList, true), '</pre>';
}