} 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 */ try { $coupons = $feed->coupons($options = array('store' => implode(',', array_values($ids)), 'view' => !isset($_GET['import_expired']) || $_GET['import_expired'] !== 'yes' ? 'active' : '', 'date' => \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 (!admin_query::coupon_imported($coupon->ID) && ($store = admin_query::store_imported($coupon->Store_ID)) && actions::add_item(array('feedID' => $coupon->ID, 'store' => $store->ID, 'category' => $store->catID, 'popular' => 0, 'exclusive' => 0, 'name' => $coupon->Title, 'link' => $coupon->URL, 'code' => $coupon->Code, 'description' => $coupon->Description, 'tags' => $coupon->Tags, 'cashback' => 0, 'start' => $coupon->Start_Date, 'end' => $coupon->End_Date, 'publish' => 1, 'meta_title' => '', 'meta_desc' => ''))) { $csuc++; } else { $cerr++; } } usleep(500000); // let's put a break after every page, 500 000 microseconds. that means a half of a second }
} 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 */ try { $coupons = $feed->coupons($options = array('store' => implode(',', array_values($ids)), 'view' => !isset($_GET['import_expired']) || $_GET['import_expired'] !== 'yes' ? 'active' : '', 'date' => \site\utils::timeconvert($_GET['date'] . ', ' . $_GET['hour'], 'America/New_York'))); 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 (!admin_query::coupon_imported($coupon->ID) && ($store_id = admin_query::store_imported($coupon->Store_ID)) && actions::add_item(array('feedID' => $coupon->ID, 'store' => $store->ID, 'category' => $store->catID, 'popular' => 0, 'exclusive' => 0, 'name' => $coupon->Title, 'link' => $coupon->URL, 'code' => $coupon->Code, 'description' => $coupon->Description, 'tags' => $coupon->Tags, 'cashback' => 0, 'start' => $coupon->Start_Date, 'end' => $coupon->End_Date, 'publish' => 1, 'meta_title' => '', 'meta_desc' => ''))) { $csuc++; } else { $cerr++; } } usleep(500000); // let's put a break after every page, 500 000 microseconds. that means a half of a second }