24 $apiHelper =
new ApiHelper($this->exportId);
26 $productsFromVk = $apiHelper->getProductsFromVk($this->vkGroupId);
27 $productsMapped = Vk\Map::getMappedProducts($this->exportId);
30 $productsMappedToRemove = array();
31 foreach ($productsMapped as $key => $productMapped)
33 if (!isset($productsFromVk[$productMapped[
"VK_ID"]]))
35 $productsMappedToRemove[] = array(
"VALUE_EXTERNAL" => $productMapped[
"VK_ID"]);
36 unset($productsMapped[$key]);
40 if (!empty($productsMappedToRemove))
41 Vk\Map::removeProductMapping($productsMappedToRemove, $this->exportId);
46 foreach ($productsMapped as $chunk)
48 $resDelete = $this->executer->executeMarketProductDelete(array(
49 "owner_id" => $this->vkGroupId,
51 "count" => count($chunk),
54 foreach ($resDelete as $res)
56 if ($res[
"flag_product_delete_result"])
57 $productsMappedToRemove[] = array(
"VALUE_EXTERNAL" => $res[
"VK_ID"]);
61 if (!empty($productsMappedToRemove))
62 Vk\Map::removeProductMapping($productsMappedToRemove, $this->exportId);
65 if ($timer !== NULL && !$timer->check())
71 $vkExportedData->removeData();