Answer the question
In order to leave comments, you need to log in
How to merge two arrays, one obtained from the database, the other via api?
There is an array code received via api
$result_1 = $client->FindCatalog (array("ShortNumberDetail"=>$search));
$items = $result_1->FindCatalogResult->SearchedTheCatalog;
//Проверка один элемент или несколько, если один то он возвращается объектом, а не массивом
//print_r($items);
if (count($items) > 1) {
foreach ($items as $item) {
catalogTblRowCreate($item, $search,$client);
}
} else {
if (count($items) != 0) {
catalogTblRowCreate($items, $search,$client);
}
}
function catalogTblRowCreate($item, $searchCat,$client) {
$result2 = $client->GetPriceId(array("ID"=>$item->id, "FormatCurrency" => 'РУБ', "SearchCross"=>0,"IdArticleDetail"=>null));
$items_id = $result2->GetPriceIdResult->BasePriceForClient;
//print "<pre>";
//print_r($items_id);
// print "</pre>";
if (count($items_id) > 1) {
foreach ($items_id as $item) {
detailsTblRowCreate($item);
}
} else {
if (count($items_id) != 0) {
detailsTblRowCreate($items_id);
}
}
}//catalogTblRowCreate
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question