Korusol
1/20/2018 - 7:38 PM

Скрипт поиска разной цены на полашопе

//<?php
\Bitrix\Main\Loader::includeModule('iblock');
$elements = [];
$arSelect = Array("ID", "PROPERTY_ITEMS", 'XML_ID');
$arFilter = Array("IBLOCK_ID"=>146, "PROPERTY_SHOW_POLASHOP"=>'true', "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->fetch())
{
    if( count ($ob['PROPERTY_ITEMS_VALUE']) > 1) {
        $elements[$ob['XML_ID']] = $ob['PROPERTY_ITEMS_VALUE'];
    }

}

foreach($elements as $mainArticle => $article) {
    $productPrices = [];
    $dbProductPrice = CPrice::GetListEx(
        array(),
        array("PRODUCT_ID" => $article, 'CATALOG_GROUP_ID' =>'5'),
        false,
        false,
        array("PRICE",)
    );

    while($ProductPrice = $dbProductPrice->fetch()) {
        $productPrices[] = $ProductPrice['PRICE'];
    }
    if (count(array_unique($productPrices)) > 1) {
        $productsWrongId[$mainArticle] =  $mainArticle;
    }

}

foreach ($productsWrongId as $val) {
    print_r($val . ' ');
}