<tr class="table-color2">
	<td class="text"><strong>Default Theme:</strong></td>
	<td>
		<select name="theme">
			<?php
				$sql = 'SELECT Name
						FROM ' . TABLE_PREFIX . 'Modules';
				$modules = $this->Conn->GetCol($sql);

				$incommerce_only = count($modules) == 2 && in_array('In-Commerce', $modules);
				$default_theme = $incommerce_only ? 'onlinestore' : 'default';

				if ($default_theme == 'default') {
					// default theme since 5.0.2
					if (file_exists(FULL_PATH . '/themes/default')) {
						$default_theme = 'default';
					}
					elseif (file_exists(FULL_PATH . '/themes/simple')) {
						$default_theme = 'simple';
					}	
					elseif (file_exists(FULL_PATH . '/themes/advanced')) {
						$default_theme = 'advanced';
					}					
				}

				$themes = $this->toolkit->getThemes();
				$default_theme = array_search($default_theme, $themes); // convert theme name to id

				$option_tpl = '<option value="%s"%s>%s</option>';

				foreach ($themes as $theme_id => $theme_name) {
				    $selected = $theme_id == $default_theme ? ' selected' : '';
					echo sprintf($option_tpl, $theme_id, $selected, $theme_name);
				}
			?>
		</select>

		&nbsp;&nbsp;<input type="checkbox" name="install_demo_data" id="install_demo_data" value="1"/><label for="install_demo_data">Install Demo content for this theme</label>
	</td>
</tr>