Ejemplo n.º 1
0
             }
         } 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 ...
Ejemplo n.º 2
0
                                foreach ($cat['subcats'] as $subcat) {
                                    echo '<option value="' . $subcat->ID . '">' . $subcat->name . '</option>';
                                }
                            }
                            echo '</optgroup>';
                        }
                        echo '</select>

    <input type="checkbox" name="coupons" value="yes" checked> ' . $LANG['feed_icouponstoo'] . '

    <button class="btn">' . $LANG['import_all'] . '</button>';
                        echo '</div>';
                    }
                    foreach ($stores['List'] as $item) {
                        echo '<li>
      <input type="checkbox" name="id[' . $item->ID . ']" value=""' . ($imported = admin_query::store_imported($item->ID) ? ' disabled' : '') . ' />

      <div style="display: table;">

      <img src="' . \query\main::store_avatar($item->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->Name . '</h2>
      ' . (empty($item->Coupons) ? $LANG['no_coupons_store'] : '<a href="?route=feed.php&amp;action=coupons&amp;store=' . $item->ID . '">' . sprintf($LANG['nr_coupons_store'], $item->Coupons) . '</a>') . '</div>

      </div>

      <div style="clear:both;"></div>

      <div class="options">';
                        if (!$imported && $feed_im) {
                            echo '<a href="javasript:void(0)" onclick="$(this).parents(\'li\').children(\'input\').click(); return false;">' . $LANG['checkun'] . '</a>';
                            echo '<a href="?route=feed.php&amp;action=preview_store&amp;id=' . $item->ID . '">' . $LANG['preview_import'] . '</a>';