$tov = mysql_query("SELECT product_id FROM oc_product_to_category WHERE category_id = $cat_id", $link);
while ($result = mysql_fetch_array($tov)) {
$productId[] = $result['product_id'];
}
$searchIn = implode(',', $productId);
$sel = mysql_query("SELECT `seller_id` FROM `oc_ms_product` WHERE product_id IN ($searchIn)" , $link);
while ($resul = mysql_fetch_array($sel)) {
echo $resul['seller_id'] . '<br>';
}
$string = '<div class="remove_div" id="first" style="">
<div class="remove_div bg-info">
<div class="remove_div" style="">
/* тут вложения всякие из HTML кода и прочее которое нужно оставить */
</div>
</div>
</div>';
$string = preg_replace('/<div[^>]+class=".*remove_div.*"[^>]*>(.*)/', '', $string);
print_r($string);
$string = 'id=171:znac=1;id=203:znac=1;id=225:znac=1;id=162:znac=0.5;id=203:znac=31;';
preg_match_all('/id=(\d+)/', $string, $matches);
var_dump($matches[1]);
$elements = [];
CModule::IncludeModule("catalog");
$my_slider = CIBlockElement::GetList (
Array("NAME" => "ASC"),
Array("IBLOCK_ID" => 1),
false,
false,
Array(
'ID',
'NAME',
)
);
while($ar_fields = $my_slider->GetNext())
{
$elements[] = $ar_fields;
}
$productID = array_column($elements, 'ID');
$arSKU = CCatalogSKU::getOffersList(
$productID,
0,
array('ACTIVE' => 'Y'),
array('ID', 'NAME', 'CODE'),
array()
);
foreach ($elements as $element) {
echo $element['NAME'] . '</br>';
if ($arSKU[$element['ID']]) {
foreach ($arSKU[$element['ID']] as $offer) {
echo $offer['CODE'] . '<br>';
}
}
}
"SEF_URL_TEMPLATES" => array(
"sections" => "",
"section" => "#SECTION_CODE_PATH#/",
"element" => "#SECTION_CODE_PATH#/#ELEMENT_CODE#/",
"compare" => "compare/",
"smart_filter" => "#SECTION_CODE_PATH#/filter/#SMART_FILTER_PATH#/apply/",
)
$data = [
341 => [
'name_rm' => 'Мастер',
'type_id' => 4,
'contract_id' => 6,
'equipment' => 'CyberPower BE700ELCD',
'serial_number' => '1GS7W3002242'
],
342 => [
'name_rm' => 'Мастер',
'type_id' => 4,
'contract_id' => 6,
'equipment' => 'CyberPower BE700ELCD',
'serial_number' => '1GS7W3002242'
],
343 => [
'name_rm' => 'Мастер',
'type_id' => 4,
'contract_id' => 6,
'equipment' => 'CyberPower BE700ELCD',
'serial_number' => '1GS7W3002242'
]
];
$array = array_column($data, 'contract_id');
$array = array_unique($array);
if(count($array) > 1) {
echo 'Ошибка';
}
elseif($array[0]) {
echo $array[0];
}
public function buildTree($data) {
$childs = array();
foreach($data as &$item) {
$childs[$item['parent_id']][] = &$item;
unset($item);
}
foreach($data as &$item) {
if (isset($childs[$item['id']])) {
$item['childs'] = $childs[$item['id']];
}
}
return $childs[0];
}