$cnt = count($priceDynamicDatas);
for ($ind = 0; $ind < $cnt - 1; $cnt++) {
if ($ind < $cnt - 1) {
- PricesDynamic::updateAll(['active' => 0, 'date_to' => $priceDynamicDatas[$ind+1]['date_to']],
+ PricesDynamic::updateAll(['active' => 0, 'region_id' => 52, 'date_to' => $priceDynamicDatas[$ind+1]['date_to']],
['id' => $priceDynamicDatas[$ind]['id']]);
echo '1';
+ } else {
+ PricesDynamic::updateAll(['active' => 0, 'region_id' => 52, 'date_to' => $p[52][$productId][count($p[52][$productId]) - 1]['date_to']],
+ ['id' => $priceDynamicDatas[$ind]['id']]);
+ echo '2';
}
}
}