} } 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 } } actions::set_option(array('lfeed_check' => time())); // update time for last feed check } catch (Exception $e) { } } // you can use $csuc, $cusuc, $cerr, $cuerr variables to create logs or something ...
if ($coupons['Count']) { echo '<form action="#" method="GET"> <input type="hidden" name="route" value="feed.php" /> <input type="hidden" name="action" value="import_coupons" /> <ul class="elements-list"> <li class="head"><input type="checkbox" checkall /> ' . $LANG['name'] . '</li>'; $feed_im = ab_to(array('feed' => 'import')); if ($feed_im) { echo '<div class="bulk_options"> <button class="btn">' . $LANG['import_all'] . '</button>'; echo '</div>'; } foreach ($coupons['List'] as $item) { $imported = admin_query::coupon_imported($item->ID); $store_imported = admin_query::store_imported($item->Store_ID); echo '<li> <input type="checkbox" name="id[' . $item->ID . ']" value=""' . ($imported || !$store_imported ? ' disabled' : '') . '/> <div style="display: table;"> <img src="' . $item->Store_Image . '" alt="" style="width: 80px;" /> <div class="info-div"><h2>' . ($imported ? '<span class="msg-alert" title="' . $LANG['added_through_feed_msg'] . '">' . $LANG['added_through_feed'] . '</span> ' : '') . ($item->is_active ? '<span class="msg-success">' . $LANG['active'] . '</span> ' : '<span class="msg-error">' . $LANG['expired'] . '</span> ') . $item->Title . '</h2> ' . (!$store_imported ? '<span class="msg-error">' . $LANG['notadded_through_feed'] . '</span> ' : '') . '<a href="?route=feed.php&action=coupons&store=' . $item->Store_ID . '">' . $item->Store_Name . '</a>' . (!$store_imported ? ' / <a href="?route=feed.php&action=preview_store&id=' . $item->Store_ID . '">' . $LANG['preview_import'] . '</a>' : '') . '</div> </div> <div style="clear:both;"></div> <div class="options">';