wpla_tooltip('When importing variable products, by default only variations which exist in your inventory report are created in WooCommerce.<br><br>Tick this box if you want to create <i>all</i> variations available on Amazon.<br>(backup your database first!)');
?>
							</label><br>

							<input type="checkbox" name="wpla_import_variations_as_simple" id="wpla_import_variations_as_simple" value="1" <?php 
if ($wpl_import_variations_as_simple) {
    echo 'checked';
}
?>
 />
							<label for="wpla_import_variations_as_simple" class="text_label">
								<?php 
echo __('Create variations as simple products', 'wpla');
?>
                                <?php 
wpla_tooltip('Enable this option if you do not want the import process to create variable products in WooCommerce, but create a single product for each variation instead.');
?>
							</label><br>

						</form>
						<br style="clear:both;"/>

						<p><?php 
echo __('Note: Processing a report will always update the information on Amazon &raquo Listings.', 'wpla');
?>
</p>

					</div>
				</div> <!-- postbox -->

			</div>
    echo $row_class1 . ' ' . $row_class2;
    ?>
">
			<td width="40%">
				<span class="wpla_field_label"><?php 
    echo $field['label'];
    ?>
</span>
				<?php 
    $field_definition = str_replace("<br />\n<br />\n", '<br />', nl2br($field['definition']));
    ?>
                <?php 
    wpla_tooltip('<b>Accepted Values</b><br>' . nl2br($field['accepted']));
    ?>
                <?php 
    wpla_tooltip('<b>Definition</b><br><i>' . $field['field'] . '</i><br>' . $field_definition);
    ?>
			</td>
			<td width="50%">

				<?php 
    if (isset($wpl_values[$field['field']])) {
        ?>

					<!-- select from a list of values -->
					<select	name="tpl_col_<?php 
        echo $field['field'];
        ?>
" id="tpl_col_<?php 
        echo $field['field'];
        ?>
    ?>
selected="selected"<?php 
}
?>
><?php 
echo __('Expert Mode (show all hidden fields)', 'wpla');
?>
</option>
							</select>

							<label for="wpl-text-allowed_html_tags" class="text_label">
								<?php 
echo __('Allowed HTML tags', 'wpla');
?>
                                <?php 
wpla_tooltip('These HTML tags will be allowed in the listing description sent to Amazon - all other tags will be removed.');
?>
							</label>
							<input type="text" name="wpla_allowed_html_tags" id="wpl-text-allowed_html_tags" value="<?php 
echo $wpl_allowed_html_tags;
?>
" class="text_input" />
							<p class="desc" style="display: block;">
								Default: <code>&lt;b&gt;&lt;i&gt;</code>
							</p>

						</div>
					</div>


</option>
							</select>

							<p class="desc fba_option" style="display: block;">
								<?php 
echo __('Enable this if all your products use FBA or to sync all FBA stock levels to WooCommerce.', 'wpla');
?>
							</p>


							<label for="wpl-fba_report_schedule" class="fba_option text_label">
								<?php 
echo __('Request FBA reports', 'wpla');
?>
                                <?php 
wpla_tooltip('If you use multi-channel fulfillment with eBay orders, you should lower this option to 6 hours.');
?>
							</label>
							<select id="wpl-fba_report_schedule" name="wpla_fba_report_schedule" class="fba_option required-entry select">
								<option value="daily"        <?php 
if ($wpl_fba_report_schedule == 'daily') {
    ?>
selected="selected"<?php 
}
?>
><?php 
echo __('Daily', 'wpla');
?>
 (default)</option>
								<option value="twelve_hours" <?php 
if ($wpl_fba_report_schedule == 'twelve_hours') {
if ($wpl_account->active == 0) {
    echo 'selected';
}
?>
 ><?php 
echo __('Inactive', 'wpla');
?>
</option>
							</select>
	
							<label for="wpl-account_is_reg_brand" class="text_label">
								<?php 
echo __('Brand Registry', 'wpla');
?>
                                <?php 
wpla_tooltip('If you registered your brand with Amazon, you are allowed to create new catalog products without providing a UPC/EAN.');
?>
							</label>
							<select id="wpl-account_is_reg_brand" name="wpla_account_is_reg_brand" title="Type" class=" required-entry select">
								<option value="0" <?php 
if ($wpl_account->is_reg_brand == 0) {
    echo 'selected';
}
?>
 ><?php 
echo __('No', 'wpla');
?>
</option>
								<option value="1" <?php 
if ($wpl_account->is_reg_brand == 1) {
    echo 'selected';
echo __('Profile name', 'wpla');
?>
 *</label>
									<input type="text" name="wpla_profile_name" size="30" value="<?php 
echo $wpl_profile->profile_name;
?>
" id="title" autocomplete="off" style="width:65%;">
								</div>
							</div>

							<label for="wpl-text-profile_description" class="text_label">
								<?php 
echo __('Profile description', 'wpla');
?>
                                <?php 
wpla_tooltip('A profile description is optional and only used within WP-Lister.');
?>
							</label>
							<input type="text" name="wpla_profile_description" id="wpl-text-profile_description" value="<?php 
echo str_replace('"', '&quot;', $wpl_profile->profile_description);
?>
" class="text_input" />
							<br class="clear" />

						</div>
					</div>


					<?php 
include 'profile/edit_template_data.php';
?>
							<p>
								<?php 
echo __('Feed templates are required to list new products which do not exist on Amazon yet.', 'wpla');
?>
								<?php 
echo __('Select a feed template to see all available options.', 'wpla');
?>
							</p>

							<label for="wpl-text-tpl_id" class="text_label">
								<?php 
echo __('Feed Template', 'wpla');
?>
                                <?php 
wpla_tooltip('Each main category on Amazon uses a different feed template with special fields for that particular category.<br>You need to select the right template for your category and make sure all the required fields are filled in - or are populated from product details or attributes.');
?>
							</label>
							<select id="wpl-text-tpl_id" name="wpla_tpl_id" class="required-entry select">
							<option value="">-- <?php 
echo __('Select feed template', 'wpla');
?>
 --</option> 
							<optgroup label="Generic Feeds">
								<?php 
foreach ($wpl_liloader_templates as $tpl) {
    ?>
									<option value="<?php 
    echo $tpl->id;
    ?>
" 
						</div>
					</div>

					<div class="postbox" id="VariationOptionsBox">
						<h3><span><?php 
echo __('Variations', 'wpla');
?>
</span></h3>
						<div class="inside">

							<label for="wpl-variations_mode" class="text_label">
								<?php 
echo __('Enable variations', 'wpla');
?>
                                <?php 
wpla_tooltip('If you disable variations, WP-Lister will omit the variation relationship data in the feed, which will result in each variation showing up as a separate product on Amazon.<br>Use this with care!<br>The default is "Yes".');
?>
							</label>
							<select id="wpl-variations_mode" name="wpla_variations_mode" title="Type" class=" required-entry select">
								<option value="default" <?php 
if (isset($wpl_profile_details['variations_mode']) && $wpl_profile_details['variations_mode'] == 'default') {
    echo 'selected';
}
?>
 ><?php 
echo __('Yes', 'wpla');
?>
</option>
								<option value="flat"    <?php 
if (isset($wpl_profile_details['variations_mode']) && $wpl_profile_details['variations_mode'] == 'flat') {
    echo 'selected';
    function display_feed_template_selector()
    {
        global $post;
        // get templates
        $templates = WPLA_AmazonFeedTemplate::getAll();
        $custom_feed_tpl_id = get_post_meta($post->ID, '_wpla_custom_feed_tpl_id', true);
        // separate ListingLoader templates
        $category_templates = array();
        $liloader_templates = array();
        foreach ($templates as $tpl) {
            if ($tpl->title == 'Offer') {
                $tpl->title = "Listing Loader";
                $liloader_templates[] = $tpl;
            } else {
                $category_templates[] = $tpl;
            }
        }
        // compatibility with profile code
        $wpl_category_templates = $category_templates;
        $wpl_liloader_templates = $liloader_templates;
        ?>
							<label for="wpl-text-tpl_id" class="text_label">
								<?php 
        echo __('Feed Template', 'wpla');
        ?>
                                <?php 
        wpla_tooltip('Each main category on Amazon uses a different feed template with special fields for that particular category.<br>You need to select the right template for your category and make sure all the required fields are filled in - or are populated from product details or attributes.');
        ?>
							</label>
							<select id="wpl-text-tpl_id" name="wpla_tpl_id" class="required-entry select">
							<option value="">-- <?php 
        echo __('Select feed template', 'wpla');
        ?>
 --</option> 
							<optgroup label="Generic Feeds">
								<?php 
        foreach ($wpl_liloader_templates as $tpl) {
            ?>
									<option value="<?php 
            echo $tpl->id;
            ?>
" 
										<?php 
            if ($custom_feed_tpl_id == $tpl->id) {
                ?>
											selected="selected"
										<?php 
            }
            ?>
										<?php 
            $site = new WPLA_AmazonMarket($tpl->site_id);
            ?>
										><?php 
            echo $tpl->title;
            ?>
 (<?php 
            echo $site ? $site->code : '?';
            ?>
)</option>
								<?php 
        }
        ?>
							</optgroup>
							<optgroup label="Category Specific Feeds">
								<?php 
        foreach ($wpl_category_templates as $tpl) {
            ?>
									<option value="<?php 
            echo $tpl->id;
            ?>
" 
										<?php 
            if ($custom_feed_tpl_id == $tpl->id) {
                ?>
											selected="selected"
										<?php 
            }
            ?>
										<?php 
            $site = new WPLA_AmazonMarket($tpl->site_id);
            ?>
										><?php 
            echo $tpl->title;
            ?>
 (<?php 
            echo $site ? $site->code : '?';
            ?>
)</option>
								<?php 
        }
        ?>
							</optgroup>
							</select>
							<br class="clear" />
							<p class="desc" style="">
								<?php 
        $link = sprintf('<a href="%s">%s</a>', 'admin.php?page=wpla-settings&tab=categories', __('Amazon &raquo; Settings &raquo; Categories', 'wpla'));
        ?>
								<?php 
        echo sprintf(__('You can add additional feed templates at %s.', 'wpla'), $link);
        ?>
							</p>


					<div id="FeedDataBox">
						<hr>
						<!-- <h3><span><?php 
        echo __('Feed Attributes', 'wpla');
        ?>
</span></h3> -->
						<div class="x-inside" id="wpla_feed_data_wrapper">
						</div>
					</div>

					<!-- hidden ajax categories tree -->
					<div id="amazon_categories_tree_wrapper">
						<div id="amazon_categories_tree_container">TEST</div>
					</div>

		<?php 
    }
>60 days</option>
								<option value="90"  <?php 
if ($wpl_feeds_days_limit == '90') {
    ?>
selected="selected"<?php 
}
?>
>90 days (default)</option>
							</select>

							<label for="wpl-option-orders_days_limit" class="text_label">
								<?php 
echo __('Keep sales data for', 'wpla');
?>
                                <?php 
wpla_tooltip('Select how long Amazon orders should be kept. Older orders are removed from WP-Lister automatically but will remain in WooCommerce. The default is forever.');
?>
							</label>
							<select id="wpl-option-orders_days_limit" name="wpla_orders_days_limit" class=" required-entry select">
								<option value=""    <?php 
if ($wpl_orders_days_limit == '') {
    ?>
selected="selected"<?php 
}
?>
>forever (default)</option>
								<option value="90"  <?php 
if ($wpl_orders_days_limit == '90') {
    ?>
selected="selected"<?php 
}