$csuc = $cusuc = $cerr = $cuerr = 0; if (!empty($ids)) { $last_check = \query\main::get_option('lfeed_check'); /* UPDATE COUPONS */ if ((int) \query\main::get_option('feed_moddt') !== 0) { try { $coupons = $feed->coupons($options = array('store' => implode(',', array_values($ids)), 'update' => \site\utils::timeconvert(date('Y-m-d, H:i:s', $last_check), $feed->timezone))); if (!empty($coupons['Count'])) { for ($cp = 1; $cp <= ceil($coupons['Count'] / 10); $cp++) { if ($cp != 1) { $coupons = $feed->coupons(array_merge(array('page' => $cp), $options)); } foreach ($coupons['List'] as $coupon) { if (($couponi = admin_query::coupon_imported($coupon->ID)) && actions::edit_item2($couponi->ID, array('name' => $coupon->Title, 'link' => $coupon->URL, 'code' => $coupon->Code, 'description' => $coupon->Description, 'tags' => $coupon->Tags, 'start' => $coupon->Start_Date, 'end' => $coupon->End_Date))) { $cusuc++; } else { $cuerr++; } } usleep(500000); // let's put a break after every page, 500 000 microseconds. that means a half of a second } } } catch (Exception $e) { } } /* IMPORT COUPONS */