Esempio n. 1
0
</form>
<br><br><br>
<div class="title">
<h2>Popshop sync</h2>
<span>Sync with Popshop</span>
</div>
<div class="form-table">
<div class="row"><span>Last Update: <span class="info"><span>Last Update Time</span></span></span><div>' . date("Y-m-d H:i:s", \query\main::get_option('popshop_lastupdate')) . '&nbsp;<button class="btn" onclick="dosync()">Sync</button>&nbsp;<button class="btn" onclick="dosync(2)">AutoImport</button>&nbsp;<button class="btn" onclick="dosync(1)">Sync+AutoImport</button></div><div id="popshop_sync_info"></div></div>
</div>
<br><br><br>
<div class="title">
<h2>Category Mapping</h2>
<span>Category Mapping for Data Automation</span>
</div>';
        $mappingdata = \plugin\Popshop\inc\actions::listMerchantTypeMapping();
        $categories_while = \query\main::while_categories(array('max' => 0, 'show' => 'subcats'));
        echo '<select name="template_category" style="display:none;">';
        foreach ($categories_while as $cat) {
            echo '<option value="' . $cat->ID . '">' . $cat->name . '</option>';
        }
        echo '</select>';
        echo '
<input type="button" value="OK" name="template_category_OK" style="display:none;"><input type="button" value="Cancel" name="template_category_Cancel" style="display:none;">
<form action="#" method="POST">
<div class="form-table">';
        foreach ($mappingdata as $km => $vm) {
            $catname = 'N/A';
            $catid = 0;
            if ($vm['catid'] && $vm['catid'] > 0) {
                foreach ($categories_while as $cat) {
Esempio n. 2
0
 <form action="#" method="POST" autocomplete="off">
 <div class="row"><span>Category:</span>
 <div><select name="coupon[Category]">';
     foreach (\query\main::group_categories(array('max' => 0)) as $cat) {
         echo '<optgroup label="' . $cat['infos']->name . '">';
         echo '<option value="' . $cat['infos']->ID . '"' . ($store['category'] == $cat['infos']->ID ? ' selected' : '') . '>' . $cat['infos']->name . '</option>';
         if (isset($cat['subcats'])) {
             foreach ($cat['subcats'] as $subcat) {
                 echo '<option value="' . $subcat->ID . '"' . ($store['category'] == $subcat->ID ? ' selected' : '') . '>' . $subcat->name . '</option>';
             }
         }
         echo '</optgroup>';
     }
     $tags = '';
     if ($coupon_p['deal_type'] != '') {
         $deal_types = \plugin\Popshop\inc\actions::listDealTypes($coupon_p['deal_type']);
         foreach ($deal_types as $deal_type) {
             if ($tags == '') {
                 $tags = $deal_type;
             } else {
                 $tags .= ', ' . $deal_type;
             }
         }
     }
     echo '</select></div></div>
 
 <div class="row"><span>Name:</span><div><input type="text" name="coupon[Title]" value="' . (isset($coupon_p['name']) ? $coupon_p['name'] : '') . '" required /></div></div>
 <div class="row"><span>Code:</span><div><input type="text" name="coupon[Code]" value="' . (isset($coupon_p['code']) ? $coupon_p['code'] : '') . '" /></div></div>
 <div class="row"><span>Coupon URL:</span><div><input type="checkbox" name="coupon[Ownlink]" value="1" id="ownlink" onclick="$(this).show_next({element:\'#link\', type:\'next\'});"' . (isset($coupon_p['url']) && $coupon_p['url'] || empty($store['link']) ? ' checked' : '') . ' /> <label for="ownlink">Use store address</label> <br />
     <input type="text" name="coupon[Link]" value="' . (isset($store['link']) ? $store['link'] : 'http://') . '" id="link"' . (isset($coupon_p['url']) && $coupon_p['url'] || empty($store['link']) ? ' style="display: none;"' : '') . ' />
     </div></div>
Esempio n. 3
0
                            $merchants_import = $ret['num_imports'];
                            $merchants_more = $merchantinfo['results']['merchants']['count'] - $page_m * 100;
                            $page_m++;
                        } else {
                            $merchants_more = 0;
                        }
                    } while ($merchants_more > 0);
                }
                //3.import deals
                $ret = \plugin\Popshop\inc\actions::importDeal($dealinfo['results']['deals']['deal']);
                $dup_deals_count = $ret['num_dups'];
                $deals_import_total += $ret['num_imports'];
                $deals_more = $dealinfo['results']['deals']['count'] - $page * 100;
                echo "imported " . $merchants_import . ' new stores ' . $ret['num_imports'] . '(' . $dup_deals_count . ') new coupons<br>';
                $page++;
            } else {
                $deals_more = 0;
            }
        } while ($deals_more > 0 && $dup_deals_count < $dup_deals_count_max);
        actions::set_option(array('popshop_lastupdate' => time()));
        echo 'sync success!<br>' . $merchants_import_total . ' new stores<br>' . $deals_import_total . ' new coupons<br>';
    }
    //4.import to couponcms data
    if (isset($_GET['auto'])) {
        $visible = isset($_GET['visible']) ? intval($_GET['visible']) : 0;
        $ret_store = \plugin\Popshop\inc\actions::add_store_auto($visible);
        $ret_item = \plugin\Popshop\inc\actions::add_item_auto();
        echo 'auto-import done!<br>store:' . $ret_store['done'] . 'done, ' . $ret_store['pass'] . 'pass, ' . $ret_store['fail'] . 'fail<br>item:' . $ret_item['done'] . 'done, ' . $ret_item['pass'] . 'pass, ' . $ret_item['fail'] . 'fail<br>';
    }
}
echo '<div><button class="btn" onclick="parent.location.reload();">Close</button></div>';