Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Array
(
[2] => 380.00
[3] => 850.00
[6] => 310.00
[8] => 750.00
)
Array
(
[19639] => Array
(
[2] => 380.00
[3] => 850.00
[6] => 310.00
[8] => 750.00
)
[19255] => Array
(
[2] => 450.00
[3] => 240.00
[6] => 350.00
[8] => 750.00
)
)
Вот массив с товарами1. Покажите массив $id_price и как вы его заполняли.
$basketRes = Sale\Internals\BasketTable::getList(array(
'filter' => array(
'FUSER_ID' => Sale\Fuser::getId(),
'ORDER_ID' => null,
'CAN_BUY' => 'Y',
)
));
while ($item_res = $basketRes->Fetch()) {
$inBasket[] = $item_res;
}
Array
(
[0] => Array
(
[ID] => 11319
[LID] => s1
[FUSER_ID] => 1548549
[ORDER_ID] =>
[PRODUCT_ID] => 21108
[PRODUCT_PRICE_ID] => 21108
[PRICE_TYPE_ID] =>
[NAME] => BGA процессор AM6410ITJ44JB A8-6410 Реболл (Я005)
[PRICE] => 1300.0000
[CURRENCY] => RUB
[BASE_PRICE] => 1300.0000
)
[1] => Array
(
[ID] => 11320
[LID] => s1
[FUSER_ID] => 1548549
[ORDER_ID] =>
[PRODUCT_ID] => 17630
[PRODUCT_PRICE_ID] => 17630
[PRICE_TYPE_ID] =>
[NAME] => Жесткий диск WD 160 Gb 2.5" WD1600BPVT 5400rpm 8Mb SATA2
[PRICE] => 2200.0000
[CURRENCY] => RUB
[BASE_PRICE] => 2200.0000
)
[2] => Array
(
[ID] => 11321
[LID] => s1
[FUSER_ID] => 1548549
[ORDER_ID] =>
[PRODUCT_ID] => 17935
[PRODUCT_PRICE_ID] => 17935
[PRICE_TYPE_ID] =>
[NAME] => АКБ для ноутбука Acer One D255 D260 522 722 (11.1V 4400mAh) черный P/N: AL10A31, AL10B31, AL10G31
[PRICE] => 1050.0000
[CURRENCY] => RUB
[BASE_PRICE] => 1050.0000
)
)
// получим все доступные цены на товар
$dbProductPrice = CPrice::GetList(
array("PRODUCT_ID" => "ASC"),
array("PRODUCT_ID" => key($basket_id)),
false,
false,
array("ID", "PRODUCT_ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY")
);
while ($ar_price = $dbProductPrice->Fetch()) {
$allPrice[] = $ar_price;
}
Array
(
[0] => Array
(
[ID] => 52113
[PRODUCT_ID] => 21108
[CATALOG_GROUP_ID] => 2
[PRICE] => 1200.00
[CURRENCY] => RUB
)
[1] => Array
(
[ID] => 52115
[PRODUCT_ID] => 21108
[CATALOG_GROUP_ID] => 3
[PRICE] => 1400.00
[CURRENCY] => RUB
)
[2] => Array
(
[ID] => 52114
[PRODUCT_ID] => 21108
[CATALOG_GROUP_ID] => 6
[PRICE] => 1055.00
[CURRENCY] => RUB
)
[3] => Array
(
[ID] => 52112
[PRODUCT_ID] => 21108
[CATALOG_GROUP_ID] => 8
[PRICE] => 1300.00
[CURRENCY] => RUB
)
)
foreach ($allPrice as $arr_price_id => $price) {
$id_price[] = $price['PRICE'];
}
$internet_price =$id_price['8'];
$opt_price = $id_price['2'];
$retail_price = $id_price['3'];
А $basket_id это масив (19639, 19255 и т.д.) в который вы хотите запихнуть эти маленькие массивы?Еще такой момент.
А как сделать из такого массива
$new_price = array_column($id_price[$price['PRODUCT_ID']], 'PRICE');
вот такойКод:Array ( [2] => 380.00 [3] => 850.00 [6] => 310.00 [8] => 750.00 )
где [19639] этоКод:Array ( [19639] => Array ( [2] => 380.00 [3] => 850.00 [6] => 310.00 [8] => 750.00 ) [19255] => Array ( [2] => 450.00 [3] => 240.00 [6] => 350.00 [8] => 750.00 ) )
$basket_id = array_column($inBasket, 'PRICE', 'PRODUCT_ID');