first commit

This commit is contained in:
2024-10-25 14:16:28 +02:00
commit 925276dbb2
33795 changed files with 4780077 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
{include file='./../parts/import_steps.tpl' step=4}
<p>&nbsp;</p>
<div class="clearfix"></div>
<form class="defaultForm form-horizontal" method="post" action="">
<div>
<ul class="nav nav-tabs" role="tablist">
{assign somethingToConfigure 0}
{if ($category_matching !== false)}
<li role="presentation">
<a href="#mcategories" aria-controls="mcategories" role="tab" data-toggle="tab">
{l s='Match categories' mod='pshowimporter'}
</a>
</li>
{assign somethingToConfigure 1}
{/if}
{if ($manufacturer_matching !== false)}
<li role="presentation">
<a href="#skipmanufacturers" aria-controls="skipmanufacturers" role="tab" data-toggle="tab">
{l s='Skip manufacturers' mod='pshowimporter'}
</a>
</li>
{assign somethingToConfigure 1}
{/if}
{if ($manufacturer_matching !== false)}
<li role="presentation">
<a href="#currencies" aria-controls="currencies" role="tab" data-toggle="tab">
{l s='Exchange rates' mod='pshowimporter'}
</a>
</li>
{/if}
<li role="presentation">
<a href="#replacement" aria-controls="replacement" role="tab" data-toggle="tab">
{l s='Global replacements' mod='pshowimporter'}
</a>
</li>
<li role="presentation">
<a href="#conditions" aria-controls="conditions" role="tab" data-toggle="tab">
{l s='Import conditions' mod='pshowimporter'}
</a>
</li>
</ul>
</div>
<div class="panel">
<div class="tab-content">
<div role="tabpanel" class="tab-pane active">
<div class="alert alert-info">
{if $somethingToConfigure}
<p>{l s='Select configuration tab if you want' mod='pshowimporter'}</p>
{else}
<p>{l s='You have nothing to configure here' mod='pshowimporter'}</p>
{/if}
</div>
</div>
<div role="tabpanel" class="tab-pane" id="mcategories">
{include file='./config_additional_categories.tpl'}
</div>
<div role="tabpanel" class="tab-pane" id="skipmanufacturers">
{include file='./config_additional_manufacturers.tpl'}
</div>
<div role="tabpanel" class="tab-pane" id="currencies">
{include file='./config_additional_currencies.tpl'}
</div>
<div role="tabpanel" class="tab-pane" id="replacement">
{include file='./config_additional_replacement.tpl'}
</div>
<div role="tabpanel" class="tab-pane" id="conditions">
{include file='./config_additional_conditions.tpl'}
</div>
<p>&nbsp;</p>
<div class="panel-footer">
{include file="./../helpers/config_buttons.tpl" f='config_matchcategories'}
</div>
</div>
</div>
</form>
<script>
var lang_find = "{l s='Find' mod='pshowimporter'}";
var lang_replace = "{l s='and replace it with' mod='pshowimporter'}";
var lang_regex = "{l s='Regular expressions' mod='pshowimporter'}";
var lang_regex_info = "{include file='./../parts/regex_exp_info.tpl'}";
</script>
<script src="{$smarty.const.__PS_BASE_URI__}modules/pshowimporter/views/js/config_additional.js"></script>

View File

@@ -0,0 +1,123 @@
{if !$category_matching_hasCategory}
<p>{l s='You do not matched any field to product category in step 3' mod='pshowimporter'}</p>
{elseif ($find_categories)}
<p>{l s='Searching for product categories in the file...' mod='pshowimporter'}</p>
<p>{l s='This may take several minutes depending on the size of the file ...' mod='pshowimporter'}</p>
<script>
$(function () {
var lcff = false;
$('.nav-tabs a[aria-controls="mcategories"]').click(function () {
if (lcff)
return;
lcff = true;
loadCategoriesFromFile();
});
});
</script>
{else}
<div class="row">
<div class="col-xs-8">
<div class="alert alert-info">
<p>{l s='After matching the category from the file, the products will be imported into categories fit into the category of the database store.' mod='pshowimporter'}</p>
</div>
</div>
<div class="panel col-xs-4">
<h3 class='panel-heading'>
{l s='Set for all' mod='pshowimporter'}:
</h3>
<div class="">
<a class="btn btn-default btn-xs col-xs-5 set4all-leave" href="">
{l s='leave it without changes' mod='pshowimporter'}
</a>
<a class="btn btn-default btn-xs col-xs-7 set4all-skip" href="">
{l s='do not import products from this category' mod='pshowimporter'}
</a>
<a class="btn btn-default btn-xs col-xs-12 set4all-disableNotExistingInFile" href="">
{l s='disable products from this category not existing in the file' mod='pshowimporter'}
</a>
</div>
</div>
</div>
<div class='col-xs-12'>
<div class='col-xs-12'>
<div class='col-xs-4'>
<strong>{l s='Category from file' mod='pshowimporter'}</strong>
<a href="{$link->getAdminLink('PShowImporterConfig', true)}&file={$smarty.get.file}&step=3&regenerate_categories_list=1">
{l s='Search categories from file again' mod='pshowimporter'}
</a>
</div>
<div class='col-xs-8'>
<strong>{l s='Option' mod='pshowimporter'}</strong>
</div>
</div>
<div class='clearfix'></div>
<hr>
<div id="categoriesList" style="max-height: 500px; overflow-y: scroll;">
{* here will be loaded categories from file by JS *}
</div>
</div>
<div id="categoriesListLoader" class="col-xs-12">
<button class="btn btn-default col-xs-6 col-xs-offset-3" disabled="disabled">
<strong>{l s='Loading categories list, please wait...' mod='pshowimporter'}</strong>
</button>
</div>
<div id="categoriesListLoadMore" class="col-xs-12">
<button class="btn btn-default col-xs-6 col-xs-offset-3">
{l s='Load next 10 categories' mod='pshowimporter'}
</button>
</div>
<div id="categoriesListLoadAll" class="col-xs-12" data-all-count='{count($fileCategories)}'>
<button class="btn btn-default col-xs-6 col-xs-offset-3">
{l s='Load all categories' mod='pshowimporter'} ({count($fileCategories)})
</button>
</div>
<style>
#categoriesList #content.bootstrap {
margin: 0;
padding: 0;
}
#categoriesList #main {
margin: 0;
padding: 0;
}
</style>
<script>
$(function () {
var isc = false;
$('.nav-tabs a[aria-controls="mcategories"]').click(function () {
if (isc)
return;
isc = true;
initStoreCategories('{$storeCategories}', '{$matched_categories|json_encode}');
});
});
</script>
{/if}

View File

@@ -0,0 +1,169 @@
<div class="form-group">
<label class="control-label col-lg-3">
{l s='All import conditions must be satisfied' mod='pshowimporter'}
</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="conditions[import_require_all]" id="conditions[import_require_all]_on" value="1"
{if $config['additional']['conditions']['import_require_all']}checked='checked'{/if}>
<label for="conditions[import_require_all]_on">Tak</label>
<input type="radio" name="conditions[import_require_all]" id="conditions[import_require_all]_off" value="0"
{if !$config['additional']['conditions']['import_require_all']}checked='checked'{/if}>
<label for="conditions[import_require_all]_off">Nie</label>
<a class="slide-button btn"></a>
</span>
<p class="help-block">
{l s='If this option is enabled and you add a condition with the `import` action, all conditions with this action must be satisfied to import the record.' mod='pshowimporter'}
</p>
<p class="help-block">
{l s='If this option is disabled, just one condition with the `import` action will be required to import the record.' mod='pshowimporter'}
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">
{l s='All skip conditions must be satisfied' mod='pshowimporter'}
</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="conditions[skip_require_all]" id="conditions[skip_require_all]_on" value="1"
{if $config['additional']['conditions']['skip_require_all']}checked='checked'{/if}>
<label for="conditions[skip_require_all]_on">Tak</label>
<input type="radio" name="conditions[skip_require_all]" id="conditions[skip_require_all]_off" value="0"
{if !$config['additional']['conditions']['skip_require_all']}checked='checked'{/if}>
<label for="conditions[skip_require_all]_off">Nie</label>
<a class="slide-button btn"></a>
</span>
<p class="help-block">
{l s='If this option is enabled and you add a condition with the `skip` action, all conditions with this action must be satisfied to skip the record.' mod='pshowimporter'}
</p>
<p class="help-block">
{l s='If this option is disabled, just one condition with the `skip` action will be required to skip the record.' mod='pshowimporter'}
</p>
</div>
</div>
<div class="panel">
<div class="panel-heading">
{l s='Add condition' mod='pshowimporter'}
</div>
<div class="panel-content">
<div class="form-group">
<label class="control-label col-xs-1">
{l s='If' mod='pshowimporter'}
</label>
<div class="col-xs-4">
<select id="condition_field">
{foreach from=$matchedFromFile key='k' item='v'}
<option value="{$k}">{$v}</option>
{/foreach}
</select>
</div>
<div class="col-xs-2">
<select id="condition_condition">
<option value="equals">{l s='equals' mod='pshowimporter'}</option>
<option value="not_equals">{l s='not equals' mod='pshowimporter'}</option>
<option value="include">{l s='include' mod='pshowimporter'}</option>
<option value="not_include">{l s='not include' mod='pshowimporter'}</option>
<option value="greater_than">{l s='greater than [only numbers]' mod='pshowimporter'}</option>
<option value="lower_than">{l s='lower than [only numbers]' mod='pshowimporter'}</option>
</select>
</div>
<div class="col-xs-2">
<input type="text" id="condition_value" value="" class="form-control">
</div>
<div class="col-xs-3">
<div class="control-label col-xs-2">
{l s='then' mod='pshowimporter'}
</div>
<div class="col-xs-10">
<select id="condition_action">
<option value="skip">{l s='skip' mod='pshowimporter'}</option>
<option value="import">{l s='import' mod='pshowimporter'}</option>
</select>
</div>
</div>
</div>
</div>
<div class="panel-footer">
<button class="btn-addCondition btn btn-default pull-right">
<i class="process-icon-save"></i>
{l s='Save' mod='pshowimporter'}
</button>
</div>
</div>
<div class="panel">
<div class="panel-heading">
{l s='Added conditions' mod='pshowimporter'}
</div>
<div class="table-responsive-row clearfix">
<table id="table-category" class="table tableDnD category">
<thead>
<tr class="nodrag nodrop">
<th class="fixed-width-lg">
<span class="title_box">
{l s='Prestashop field' mod='pshowimporter'}
</span>
</th>
<th class="fixed-width-lg">
<span class="title_box">
{l s='Condition' mod='pshowimporter'}
</span>
</th>
<th class="fixed-width-lg">
<span class="title_box">
{l s='Value' mod='pshowimporter'}
</span>
</th>
<th class="fixed-width-lg">
<span class="title_box">
{l s='Action' mod='pshowimporter'}
</span>
</th>
<th></th>
</tr>
</thead>
<tbody class='conditions-table'>
{* this will be filled by js *}
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,2 @@
{$form_exchange_rates}

View File

@@ -0,0 +1,100 @@
{if !$manufacturer_matching_hasManufacturer}
<p>{l s='You do not matched any field to product manufacturer in step 3' mod='pshowimporter'}</p>
{elseif ($find_manufacturers)}
<p>{l s='Searching for product manufacturers in the file...' mod='pshowimporter'}</p>
<p>{l s='This may take several minutes depending on the size of the file ...' mod='pshowimporter'}</p>
<script>
$(function () {
var lmff = false;
$('.nav-tabs a[aria-controls="skipmanufacturers"]').click(function () {
if (lmff)
return;
lmff = true;
loadManufacturersFromFile();
});
});
</script>
{else}
<div class="row">
<div class="col-xs-8">
<div class="alert alert-info">
<p>{l s='Select manufacturers which you want to skip during import' mod='pshowimporter'}</p>
</div>
<a href="{$link->getAdminLink('PShowImporterConfig', true)}&file={$smarty.get.file}&step=3&regenerate_manufacturer_list=1"
class="btn btn-default">
{l s='Regenerate list' mod='pshowimporter'}
</a>
</div>
<div class="panel col-xs-4">
<h3 class='panel-heading'>
{l s='Set for all' mod='pshowimporter'}:
</h3>
<div class="row">
<a class="btn btn-default btn-xs row col-xs-5 set4allManufacturers-skip" href="">
{l s='skip all' mod='pshowimporter'}
</a>
<a class="btn btn-default btn-xs row col-xs-5 set4allManufacturers-reset" href="">
{l s='reset' mod='pshowimporter'}
</a>
</div>
</div>
</div>
<div id="manufacturersList">
<div class='clearfix'></div>
<hr>
{* here will be loaded manufacturers from file by JS *}
</div>
<div class='clearfix'></div>
<div id="manufacturersListLoader" class="col-xs-12">
<button class="btn btn-default col-xs-6 col-xs-offset-3" disabled="disabled">
<strong>{l s='Loading manufacturers list, please wait...' mod='pshowimporter'}</strong>
</button>
</div>
<style>
#manufacturersList #content.bootstrap {
margin: 0;
padding: 0;
}
#manufacturersList #main {
margin: 0;
padding: 0;
}
</style>
<script>
$(function () {
var ism = false;
$('.nav-tabs a[aria-controls="skipmanufacturers"]').click(function () {
if (ism)
return;
ism = true;
loadFileManufacturers();
});
});
</script>
{/if}

View File

@@ -0,0 +1,79 @@
<input type="hidden" name="replacement[temp]" value="OK">
<div class="panel">
<div class="panel-heading">
{l s='Paste your csv file to convert it into replacements' mod='pshowimporter'}
</div>
<div class="panel-content">
<textarea class="replacements-csv-convert" placeholder="'Find this';'Replace into this'"></textarea>
</div>
<div class="panel-footer">
<div class="col-xs-3 pull-left">
<strong>{l s='Required' mod='pshowimporter'}:</strong>
<div class="col-xs-11 pull-right">
- columns separated by a semicolon<br>
- column values in apostrophes
</div>
</div>
<div class="col-xs-2 pull-left">
<strong>{l s='Working example' mod='pshowimporter'}:</strong>
<div class="col-xs-11 pull-right">
"prestashop";"prestashow"<br>
"paid; ";"free; "
</div>
</div>
<button class="convertCsvReplacement btn btn-default pull-right">
<i class="process-icon-save"></i>
{l s='Convert' mod='pshowimporter'}
</button>
</div>
</div>
<div class="panel">
<div class="panel-heading">
{l s='Added replacements' mod='pshowimporter'}
</div>
<div class="panel-content">
<div class="replacements-container">
<div class="replacements-info alert alert-info{if $config['additional']['replacement']|count > 0} hidden{/if}">
{l s='Here you can define pairs of strings that the module will find and replace during the import.' mod='pshowimporter'}<br>
{l s='Click green button below to add new replacement.' mod='pshowimporter'}
</div>
<div class="replacements">
{assign var='replacementCounter' value=0}
{foreach from=$config['additional']['replacement'] item='r'}
{if $r['find'] == '' || $r['replace'] == ''}
{continue}
{/if}
{include file='./../helpers/replacement_line.tpl' nameKey='replacement['|cat:$replacementCounter|cat:']' r=$r}
{assign var='replacementCounter' value=($replacementCounter+1)}
{/foreach}
</div>
<script>
var replacementCounter = {($replacementCounter+1)};
</script>
<div class="form-group">
<div class="col-xs-1 col-xs-offset-11">
<button class="addReplacement btn btn-success btn-sm">
<i class="process-icon-new"></i> {l s='Add' mod='pshowimporter'}
</button>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,301 @@
{include file='./../parts/import_steps.tpl' step=4}
<p>&nbsp;</p>
<div class="clearfix"></div>
<form class="defaultForm form-horizontal" method="post" action="">
<div>
<ul class="nav nav-tabs" role="tablist">
{assign somethingToConfigure 0}
{if ($category_matching !== false)}
<li role="presentation">
<a href="#mcategories" aria-controls="mcategories" role="tab" data-toggle="tab">
{l s='Match categories' mod='pshowimporter'}
</a>
</li>
{assign somethingToConfigure 1}
{/if}
{if ($manufacturer_matching !== false)}
<li role="presentation">
<a href="#skipmanufacturers" aria-controls="skipmanufacturers" role="tab" data-toggle="tab">
{l s='Skip manufacturers' mod='pshowimporter'}
</a>
</li>
{assign somethingToConfigure 1}
{/if}
</ul>
</div>
<div class="panel">
<div class="tab-content">
<div role="tabpanel" class="tab-pane active">
<div class="alert alert-info">
{if $somethingToConfigure}
<p>{l s='Select configuration tab if you want' mod='pshowimporter'}</p>
{else}
<p>{l s='You have nothing to configure here' mod='pshowimporter'}</p>
{/if}
</div>
</div>
<div role="tabpanel" class="tab-pane" id="mcategories">
{if !$category_matching_hasCategory}
<p>{l s='You do not matched any field to product category in step 3' mod='pshowimporter'}</p>
{elseif ($find_categories)}
<p>{l s='Searching for product categories in the file...' mod='pshowimporter'}</p>
<p>{l s='This may take several minutes depending on the size of the file ...' mod='pshowimporter'}</p>
<script>
$(function () {
var lcff = false;
$('.nav-tabs a[aria-controls="mcategories"]').click(function () {
if (lcff)
return;
lcff = true;
loadCategoriesFromFile();
});
});
</script>
{else}
<div class="row">
<div class="col-xs-8">
<div class="alert alert-info">
<p>{l s='After matching the category from the file, the products will be imported into categories fit into the category of the database store.' mod='pshowimporter'}</p>
</div>
</div>
<div class="panel col-xs-4">
<h3 class='panel-heading'>
{l s='Set for all' mod='pshowimporter'}:
</h3>
<div class="row">
<a class="btn btn-default btn-xs row col-xs-5 set4all-leave" href="">
{l s='leave it without changes' mod='pshowimporter'}
</a>
<a class="btn btn-default btn-xs row col-xs-7 set4all-skip" href="">
{l s='do not import products from this category' mod='pshowimporter'}
</a>
<a class="btn btn-default btn-xs row col-xs-12 set4all-disableNotExistingInFile" href="">
{l s='disable products from this category not existing in the file' mod='pshowimporter'}
</a>
</div>
</div>
</div>
<div class='col-xs-12'>
<div class='col-xs-12'>
<div class='col-xs-4'>
<strong>{l s='Category from file' mod='pshowimporter'}</strong>
<a href="{$link->getAdminLink('PShowImporterConfig', true)}&file={$smarty.get.file}&step=3&regenerate_categories_list=1">
{l s='Search categories from file again' mod='pshowimporter'}
</a>
</div>
<div class='col-xs-8'>
<strong>{l s='Option' mod='pshowimporter'}</strong>
</div>
</div>
<div class='clearfix'></div>
<hr>
<div id="categoriesList" style="max-height: 500px; overflow-y: scroll;">
{* here will be loaded categories from file by JS *}
</div>
</div>
<div id="categoriesListLoader" class="col-xs-12">
<button class="btn btn-default col-xs-6 col-xs-offset-3" disabled="disabled">
<strong>{l s='Loading categories list, please wait...' mod='pshowimporter'}</strong>
</button>
</div>
<div id="categoriesListLoadMore" class="col-xs-12">
<button class="btn btn-default col-xs-6 col-xs-offset-3">
{l s='Load next 10 categories' mod='pshowimporter'}
</button>
</div>
<div id="categoriesListLoadAll" class="col-xs-12" data-all-count='{count($fileCategories)}'>
<button class="btn btn-default col-xs-6 col-xs-offset-3">
{l s='Load all categories' mod='pshowimporter'} ({count($fileCategories)})
</button>
</div>
<style>
#categoriesList #content.bootstrap {
margin: 0;
padding: 0;
}
#categoriesList #main {
margin: 0;
padding: 0;
}
</style>
<script>
$(function () {
var isc = false;
$('.nav-tabs a[aria-controls="mcategories"]').click(function () {
if (isc)
return;
isc = true;
initStoreCategories('{$storeCategories}', '{$matched_categories|json_encode}');
});
});
</script>
{/if}
</div>
<div role="tabpanel" class="tab-pane" id="skipmanufacturers">
{if !$manufacturer_matching_hasManufacturer}
<p>{l s='You do not matched any field to product manufacturer in step 3' mod='pshowimporter'}</p>
{elseif ($find_manufacturers)}
<p>{l s='Searching for product manufacturers in the file...' mod='pshowimporter'}</p>
<p>{l s='This may take several minutes depending on the size of the file ...' mod='pshowimporter'}</p>
<script>
$(function () {
var lmff = false;
$('.nav-tabs a[aria-controls="skipmanufacturers"]').click(function () {
if (lmff)
return;
lmff = true;
loadManufacturersFromFile();
});
});
</script>
{else}
<div class="row">
<div class="col-xs-8">
<div class="alert alert-info">
<p>{l s='Select manufacturers which you want to skip during import' mod='pshowimporter'}</p>
</div>
</div>
<div class="panel col-xs-4">
<h3 class='panel-heading'>
{l s='Set for all' mod='pshowimporter'}:
</h3>
<div class="row">
<a class="btn btn-default btn-xs row col-xs-5 set4allManufacturers-skip" href="">
{l s='skip all' mod='pshowimporter'}
</a>
<a class="btn btn-default btn-xs row col-xs-5 set4allManufacturers-reset" href="">
{l s='reset' mod='pshowimporter'}
</a>
</div>
</div>
</div>
<div id="manufacturersList">
<div class='col-xs-12'>
<div class='col-xs-4'>
<strong>{l s='Manufacturer from file' mod='pshowimporter'}</strong>
<a href="{$link->getAdminLink('PShowImporterConfig', true)}&file={$smarty.get.file}&step=3&regenerate_manufacturer_list=1">
{l s='Regenerate list' mod='pshowimporter'}
</a>
</div>
<div class='col-xs-8'>
<strong>{l s='Option' mod='pshowimporter'}</strong>
</div>
</div>
<div class='clearfix'></div>
<hr>
{* here will be loaded manufacturers from file by JS *}
</div>
<div id="manufacturersListLoader" class="col-xs-12">
<button class="btn btn-default col-xs-6 col-xs-offset-3" disabled="disabled">
<strong>{l s='Loading manufacturers list, please wait...' mod='pshowimporter'}</strong>
</button>
</div>
{*<div id="manufacturersListLoadMore" class="col-xs-12">
<button class="btn btn-default col-xs-6 col-xs-offset-3">
{l s='Load more' mod='pshowimporter'}
</button>
</div>*}
<style>
#manufacturersList #content.bootstrap {
margin: 0;
padding: 0;
}
#manufacturersList #main {
margin: 0;
padding: 0;
}
</style>
<script>
$(function () {
var ism = false;
$('.nav-tabs a[aria-controls="skipmanufacturers"]').click(function () {
if (ism)
return;
ism = true;
loadFileManufacturers();
});
});
</script>
{/if}
</div>
<p>&nbsp;</p>
<div class="panel-footer">
{include file="./../helpers/config_buttons.tpl" f='config_matchcategories'}
</div>
</div>
</div>
</form>

View File

@@ -0,0 +1,388 @@
{include file='./../parts/import_steps.tpl' step=2}
<p>&nbsp;</p>
{if isset($correct_file) && !$correct_file}
<div class="alert alert-danger">
<p>{l s='Your file is probably incorrect.' mod='pshowimporter'} {l s='Check the file structure.' mod='pshowimporter'}</p>
<p>&nbsp;</p>
<p>{l s='An example of the correct structure of the csv file' mod='pshowimporter'}:</p>
<p><i>id,name,reference,description,price</i></p>
<p><i>1,"Name 1",REF1,"&lt;span style=\"color: red;\"&gt;description&lt;span&gt;",1.00</i></p>
<p><i>2,"Name 2",REF2,"&lt;span style=\"color: green;\"&gt;next description&lt;span&gt;",5.00</i></p>
</div>
{/if}
<div class="clearfix"></div>
<br>
<div class="col-xs-12">
<div class="panel panel-filecontents">
<div class="panel-heading">
<a ng-show="ableToHightlight" ng-click="highlightContents()"
class="pull-right btn btn-default">{l s='Highlight syntax' mod='pshowimporter'}</a>
<a ng-show="fileNotLoaded" ng-click="loadFileContents()"
class="pull-right btn btn-success">{l s='Load file' mod='pshowimporter'}</a>
<span id="fileloadstatus" class="pull-right">[[fileloadstatus]]</span>
({l s='grab to move' mod='pshowimporter'})&nbsp;&nbsp;&nbsp;
{l s='File contents' mod='pshowimporter'}
</div>
<div class="panel-wrapper" style="min-height: 120px; max-height: 500px; height: 90%; overflow: scroll;">
<pre ng-show="filecontents" style="width:3000px; height: 95%;"><code class="xml">[[filecontents]]</code></pre>
</div>
</div>
</div>
<div class="col-xs-12" style="min-height: 500px;">
<div class="alert alert-info dataLoader">
<p>{l s='Loading data' mod='pshowimporter'}... <span class="dots"></span></p>
</div>
<div class="loadedData" style="display: none;">
<form class="defaultForm form-horizontal" id="primaryConfiguration" method="post" action="">
<div class="panel">
{if isset($fromURL) && $fromURL}
<div class="panel-heading clearfix">
{l s='You added this file by URL address, do you want to update this file before importing?' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="form-group">
<div class="col-md-12">
<label for="updateWithDownload" class="control-label col-md-4"></label>
<div class="col-md-4">
<input name="updateWithDownload" type="checkbox" value="1" id="updateWithDownload">
{l s='Update this file from URL address before every import' mod='pshowimporter'}
</div>
</div>
</div>
</div>
<p>&nbsp;</p>
{/if}
<div class="panel-wrapper">
<div class="form-group">
<label class="control-label col-lg-4">
{l s='Re-encode file with UTF-8' mod='pshowimporter'}
</label>
<div class="col-lg-8">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="re_encode_utf8" id="re_encode_utf8_on" value="1"
{if $primary_config['re_encode_utf8']}checked='checked'{/if}>
<label for="re_encode_utf8_on">Tak</label>
<input type="radio" name="re_encode_utf8" id="re_encode_utf8_off" value="0"
{if !$primary_config['re_encode_utf8']}checked='checked'{/if}>
<label for="re_encode_utf8_off">Nie</label>
<a class="slide-button btn"></a>
</span>
<p class="help-block">
{l s='With large files it can slow down the transition to step 5.' mod='pshowimporter'}
</p>
<p class="help-block">
{l s='Enable this option if you have problems with XML encoding' mod='pshowimporter'} {l s='(Eg if you see errors in the log such as: %s)' mod='pshowimporter' sprintf='"Error in XML reading: Input is not proper UTF-8, indicate encoding !"'}<br>
<u>{l s='If you have the correct encoding in the file - DO NOT TURN ON THE OPTION!' mod='pshowimporter'}</u>
</p>
</div>
</div>
</div>
{*<p>&nbsp;</p>
<div class="panel-wrapper">
<div class="form-group">
<label class="control-label col-lg-4">
{l s='Number of threads' mod='pshowimporter'}<br>[experimental]
</label>
<div class="col-lg-8">
<input type='number' name='number_of_threads' max='24' min='1'
value='{if isset($primary_config['number_of_threads'])}{$primary_config['number_of_threads']}{else}1{/if}'>
<p class="help-block">
{l s='The higher number of threads increases the speed of import, but it also puts a strain on the server.' mod='pshowimporter'}
</p>
<p class="help-block">
<strong>{l s='Warning!' mod='pshowimporter'}</strong>
{l s='Activate only if the order of imported objects does not matter!' mod='pshowimporter'}
</p>
</div>
</div>
</div>*}
<p>&nbsp;</p>
<div class="panel-heading clearfix">
{l s='Main import options' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="col-md-12">
<label class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='What to do with object which has got incorrect one or more fields?' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-6">
<p>
<label class="radioCheck">
<input type="radio" name="objectWithError" value="alwaysTry"
{if (isset($primary_config['objectWithError']) && $primary_config['objectWithError'] == 'alwaysTry' || !isset($primary_config['objectWithError']))}checked{/if}>
{l s='Always try to fix and import even if the values contain errors' mod='pshowimporter'} ({l s='default' mod='pshowimporter'})
</label>
</p>
<p>
<label class="radioCheck">
<input type="radio" name="objectWithError" value="skipObject"
{if (isset($primary_config['objectWithError']) && $primary_config['objectWithError'] == 'skipObject')}checked{/if}>
{l s='Skip object' mod='pshowimporter'}
</label>
</p>
<p>
<label class="radioCheck">
<input type="radio" name="objectWithError" value="tryFixAndSkip"
{if isset($primary_config['objectWithError']) && $primary_config['objectWithError'] == 'tryFixAndSkip'}checked{/if}>
{l s='Try to fix incorrect value (e.g. by removing characters from value) and skip object if module cannot fix incorrect value' mod='pshowimporter'}
</label>
</p>
<p>
<label class="radioCheck">
<input type="radio" name="objectWithError" value="tryFixAndSetEmpty"
{if isset($primary_config['objectWithError']) && $primary_config['objectWithError'] == 'tryFixAndSetEmpty'}checked{/if}>
{l s='Try to fix incorrect value (e.g. by removing characters from value), next try to set empty or default value and skip object if module cannot fix incorrect value' mod='pshowimporter'}
</label>
</p>
{*<p>
<label class="radioCheck">
<input type="radio" name="objectWithError" value="forceImport"
{if (isset($primary_config['objectWithError']) && $primary_config['objectWithError'] == 'forceImport')}checked{/if}>
{l s='Force import even if the values contain errors' mod='pshowimporter'}
</label>
</p>*}
</div>
</div>
{if count($languages) > 1}
<p>&nbsp;</p>
<div class="col-md-12">
<label for="lang" class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Select import language' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-6">
<select name="lang" ng-model="importlang"
ng-init="importlang = '{if isset($primary_config['lang_id'])}{$primary_config['lang_id']}{else}0{/if}'">
<option value="0">{l s='All languages' mod='pshowimporter'}</option>
{foreach from=$languages item='lang'}
<option value="{$lang['id_lang']}">{$lang['name']}</option>
{/foreach}
</select>
</div>
</div>
{else}
<input type="hidden" name="lang" value="0">
{/if}
{if isset($shops) && count($shops) > 1}
<p>&nbsp;</p>
<div class="col-md-12 shopsList">
<label for="shop" class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Select import shops' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-6">
<ul class="nav nav-tabs" style="margin-left: 10px;">
{assign active "active"}
{foreach from=$shop_groups item='s'}
<li class="{$active}">
<a data-toggle="tab" href="#shop-group-{$s->id}">
{$s->name}
</a>
</li>
{assign active ""}
{/foreach}
</ul>
<div class="tab-content">
{assign active "in active"}
{foreach from=$shop_groups item='s'}
<div id="shop-group-{$s->id}" class="tab-pane fade {$active} panel">
{foreach from=$shops item='shop'}
{if $shop['id_shop_group'] != $s->id}
{continue}
{/if}
<div class="form-group">
<input type="checkbox" name="import_shop_{$shop['id_shop']}" id="import_shop_{$shop['id_shop']}"
value="1" {if !$multistore_addon}disabled="disabled"{/if}
{if !$multistore_addon and $shop == $shops|reset}checked="checked"{/if}>
&nbsp;&nbsp;&nbsp;<label for="import_shop_{$shop['id_shop']}">{$shop['name']}</label>
</div>
{/foreach}
</div>
{assign active ""}
{/foreach}
</div>
{if !$multistore_addon}
<div class="alert alert-info">
<a href="http://prestashow.pl/en//26-.html" target="_blank">
{l s='Buy multistore addon to change shops.' mod='pshowimporter'}
</a>
</div>
{/if}
</div>
</div>
{else}
<input type="hidden" name="shop" value="0">
{/if}
{if isset($shop_groups) && count($shop_groups)}
{else}
<input type="hidden" name="shopgroup" value="0">
{/if}
</div>
<div class="clearfix"></div>
<p>&nbsp;</p>
<div class="panel-heading clearfix">
{l s='What the file contains?' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="col-md-12">
<label for="file_contains" class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Select data type to import' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-6">
<select name="file_contains" id="file_contains" ng-model="file_contains" required
{if isset($primary_config['file_contains'])}ng-init="file_contains = '{$primary_config['file_contains']}'"{/if}>
<option value="data_product">{l s='Products data' mod='pshowimporter'}</option>
<option value="data_feature">{l s='Product features' mod='pshowimporter'}</option>
<option value="data_category">{l s='Product categories' mod='pshowimporter'}</option>
<option value="data_attributegroup">{l s='Product attributes' mod='pshowimporter'}</option>
<option value="data_combination">{l s='Product combinations' mod='pshowimporter'}</option>
</select>
</div>
</div>
<p ng-show="file_contains">&nbsp;</p>
<div class="col-md-12" ng-show="file_contains">
<label for="what_import" class="control-label col-md-4 required"
{if isset($primary_config['what_import'])}ng-init="what_import = '{$primary_config['what_import']}'"{/if}>
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Which data do you want to import from this file?' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-6">
<select name="what_import" ng-model="what_import">
<option value="all">
{l s='Import all data from file' mod='pshowimporter'}
</option>
<option value="not_exists" ng-hide="(['data_attributegroup','data_feature']).indexOf(file_contains) > -1">
{l s='Import only data which not exists in store database' mod='pshowimporter'}
</option>
<option value="exists" ng-hide="(['data_attributegroup','data_feature']).indexOf(file_contains) > -1">
{l s='Update only data which exists in store database' mod='pshowimporter'}
</option>
<option value="exists_or_not" ng-hide="(['data_attributegroup','data_feature']).indexOf(file_contains) > -1">
{l s='Update existing, add non existing in store database' mod='pshowimporter'}
</option>
</select><br>
{*<div class="alert alert-info" ng-hide="(['data_combination']).indexOf(file_contains) <= -1">
<p>{l s='If you want to update combinations in the future you must import combination reference.' mod='pshowimporter'}</p>
</div>
<div class="alert alert-info" ng-hide="(['data_combination']).indexOf(file_contains) <= -1">
<p>{l s='If combination from file exists in store, PShowImporter will remove old combination and add new one' mod='pshowimporter'} - <u>{l s='always import full combination data' mod='pshowimporter'}</u>.</p>
</div>*}
</div>
</div>
<div class="clearfix"></div>
</div>
<p>&nbsp;</p>
<div ng-show="file_contains == 'data_product' && what_import">
{include file="./config_index_products.tpl"}
</div>
<div ng-show="file_contains == 'data_category' && what_import">
{include file="./config_index_categories.tpl"}
</div>
<div ng-show="file_contains == 'data_attributegroup' && what_import">
{include file="./config_index_attributes.tpl"}
</div>
<div ng-show="file_contains == 'data_combination' && what_import">
{include file="./config_index_combinations.tpl"}
</div>
<div class="panel-footer">
{include file="./../helpers/config_buttons.tpl" f='config_index'}
</div>
</div>
</form>
</div>
</div>
<div class="clearfix"></div>

View File

@@ -0,0 +1,16 @@
<div class="panel-wrapper">
<div class="form-group">
<div class="col-md-12">
<label for="attribute_separator" class="control-label col-md-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Attributes separator' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<input id="attribute_separator" maxlength="1" type="text" value="{if isset($primary_config['attribute_separator'])}{$primary_config['attribute_separator']}{else},{/if}" name="attribute_separator">
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,40 @@
<div class="panel-heading clearfix" ng-show="import_exists_data || import_not_exists_data">
{l s='Which data is unique for category?' mod='pshowimporter'}
</div>
<div class="panel-wrapper" ng-show="what_import != 'all'">
<div class="form-group">
<div class="col-md-12">
<label for="lang" class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Select unique data' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<select name="cat_unique_data" ng-model="unique_data"
{if isset($primary_config['unique_data'])}ng-init="unique_data = '{$primary_config['unique_data']}'"{/if}>
<option value="id">{l s='Category ID' mod='pshowimporter'}</option>
</select>
</div>
</div>
<p ng-show="unique_data == 'reference'">&nbsp;</p>
<div class="col-md-12" ng-show="unique_data == 'reference'">
<label for="updateOnce" class="control-label col-md-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Update only one' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<input id="updateOnce" type="checkbox"
name="cat_updateOnce"
ng-model="updateOnce"
ng-checked="{isset($primary_config['updateOnce'])}">
{l s='All categories with this unique value will be updated only once, other rows in file with this unique value will be ignored.' mod='pshowimporter'}
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,70 @@
<div class="panel-heading clearfix" ng-show="import_exists_data || import_not_exists_data">
{l s='Which data is unique for combinations?' mod='pshowimporter'}
</div>
<div class="panel-heading clearfix">
{l s='Import operations on unique fields' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="form-group" ng-show="what_import != 'all'">
<div class="col-md-12">
<label for="lang" class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Select unique data' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<select name="unique_data" ng-model="unique_data"
{if isset($primary_config['unique_data'])}ng-init="unique_data = '{$primary_config['unique_data']}'"{/if}>
<option value="reference">{l s='Combination code' mod='pshowimporter'}</option>
<option value="ean13">{l s='Combination EAN13' mod='pshowimporter'}</option>
</select>
</div>
</div>
</div>
</div>
<p>&nbsp;</p>
<div class="panel-heading clearfix">
{l s='Additional options' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="col-md-12">
<label for="remove_old_combinations" class="col-md-offset-4 col-md-4">
<input type="checkbox" name="remove_old_combinations" id="remove_old_combinations" value="1">
{l s='Remove combinations added before import to associated product' mod='pshowimporter'}
</label>
</div>
<p>&nbsp;</p>
<div class="col-md-12">
<label for="remove_product_images" class="col-md-offset-4 col-md-4">
<input type="checkbox" name="remove_product_images" id="remove_product_images" value="1">
{l s='Remove images added before import to associated product' mod='pshowimporter'}
</label>
</div>
<p>&nbsp;</p>
<div class="col-md-12">
<label for="gen_combinations" class="col-md-offset-4 col-md-4">
<input type="checkbox" name="gen_combinations" id="gen_combinations" value="1">
{l s='Generate all available combinations with current product combinations' mod='pshowimporter'}
</label>
<div class="col-md-offset-4 col-md-4">
<small>
{l s='It\'s not working in ssh/cron import' mod='pshowimporter'}
</small>
</div>
</div>
<div class="clearfix"></div>
</div>

View File

@@ -0,0 +1,45 @@
<div class="panel-heading clearfix">
{l s='Primary CSV file configuration' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="form-group">
<div class="col-md-12">
<label for="delimiter" class="control-label col-md-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='One char which split data in row' mod='pshowimporter'}">
{l s='Data delimiter' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<input id="delimiter" type="text" value="{if isset($primary_config['delimiter'])}{$primary_config['delimiter']}{else};{/if}" name="delimiter">
<div>
<small>
{l s='For tabulation enter' mod='pshowimporter'}: <strong>tab</strong>
</small>
</div>
<div>
<small>
{l s='Column delimiter in the file' mod='pshowimporter'}
</small>
</div>
</div>
</div>
<p>&nbsp;</p>
<div class="col-md-12">
<label for="firstLine" class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Start import from line' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<input required id="firstLine" type="text" value="{if isset($primary_config['firstLine'])}{$primary_config['firstLine']}{else}1{/if}" name="firstLine">
</div>
</div>
</div>
</div>
<p>&nbsp;</p>

View File

@@ -0,0 +1,260 @@
<script>
{literal}
$(function () {
$('.full-screen-loader').fadeIn();
});
$(document).ready(function () {
$('.dataLoader').addClass('hidden');
$('.loadedData').show();
setTimeout(function () {
{/literal}
{foreach from=$primary_config key='key' item='conf'}
{if ($conf == '0')}{continue}{/if}
console.log("{$key}");
{literal}$('#{/literal}{$key}{literal}').click();{/literal}
{/foreach}
{*
{if isset($primary_config['import_to_shops'])}
var shops = '{$primary_config['import_to_shops']}'.split(',');
for (x in shops) {
{literal}$('#{/literal}import_shop_' + shops[x]{literal}).click();{/literal}
}
{else}
{literal}$('.shopsList input[type="checkbox"]').click();{/literal}
{/if}*}
{literal}
setTimeout(function () {
$('.full-screen-loader').fadeOut();
}, 1000);
}, 2000);
});
{/literal}
</script>
<div class="panel-heading clearfix" ng-show="import_exists_data || import_not_exists_data">
{l s='Which data is unique for products?' mod='pshowimporter'}
</div>
<div class="panel-heading clearfix">
{l s='Import operations on unique fields' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="form-group" ng-show="what_import != 'all'">
<div class="col-md-12">
<label for="lang" class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Select unique data' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<select name="unique_data" ng-model="unique_data"
{if isset($primary_config['unique_data'])}ng-init="unique_data = '{$primary_config['unique_data']}'"{/if}>
<option value="id">{l s='Product ID' mod='pshowimporter'}</option>
<option value="reference">{l s='Product reference' mod='pshowimporter'}</option>
<option value="ean13">{l s='Product EAN13' mod='pshowimporter'}</option>
</select>
</div>
</div>
<p ng-show="unique_data == 'reference' || unique_data == 'id'">&nbsp;</p>
<div class="col-md-12" ng-show="unique_data == 'reference' || unique_data == 'id'">
<label for="updateOnce" class="control-label col-md-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Update only one' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<input id="updateOnce" type="checkbox"
name="updateOnce"
ng-model="updateOnce" value="1"><br>
<p>{l s='All products with this unique value will be updated only once, other rows in file with this unique value will be ignored.' mod='pshowimporter'}</p>
</div>
</div>
<p ng-show="what_import != 'all' && (unique_data == 'reference' || unique_data == 'id')">&nbsp;</p>
<div class="col-md-12" ng-show="what_import != 'all' && (unique_data == 'reference' || unique_data == 'id')">
<label for="disableNonExisting" class="control-label col-md-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Disable products non existing in the file' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<input id="disableNonExisting" type="checkbox"
name="disableNonExisting"
ng-model="disableNonExisting" value="1"><br>
<p>{l s='It also applies to products imported from another file or added manually, which do not exist in this file.' mod='pshowimporter'}</p>
</div>
</div>
<p ng-show="what_import != 'all' && (unique_data == 'reference' || unique_data == 'id')">&nbsp;</p>
<div class="col-md-12" ng-show="what_import != 'all' && (unique_data == 'reference' || unique_data == 'id')">
<label for="setZeroForNonExisting" class="control-label col-md-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Set stock to zero for products non existing in the file' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<input id="setZeroForNonExisting" type="checkbox"
name="setZeroForNonExisting"
ng-model="setZeroForNonExisting" value="1"><br>
<p>{l s='It also applies to products imported from another file or added manually, which do not exist in this file.' mod='pshowimporter'}</p>
</div>
</div>
</div>
<div class="form-group" ng-show="what_import == 'all'">
<div class="col-md-12">
<label for="updateOnce" class="control-label col-md-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Import only once' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-6">
<input id="updateOnce" type="checkbox"
name="updateOnce"
ng-model="updateOnce" value="1">
{l s='All products with this unique value will be importer only once, other rows in file with this unique value will be ignored.' mod='pshowimporter'}
</div>
</div>
<p>&nbsp;</p>
<div class="col-md-12" ng-show="updateOnce">
<label for="lang" class="control-label col-md-4 required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Select unique data' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<select name="unique_data" ng-model="unique_data"
{if isset($primary_config['unique_data'])}ng-init="unique_data = '{$primary_config['unique_data']}'"{/if}>
<option value="id">{l s='Product ID' mod='pshowimporter'}</option>
<option value="reference">{l s='Product code' mod='pshowimporter'}</option>
</select>
</div>
</div>
</div>
</div>
{if isset($shops) && count($shops) > 1}
<p>&nbsp;</p>
<div class="panel-heading clearfix">
{l s='Do you want to activate products only in selected shops?' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="col-md-12">
<label for="shop_selectable_product_activation" class="col-md-offset-4 col-md-6">
<input type="checkbox" name="shop_selectable_product_activation" ng-model="shop_selectable_product_activation"
id="shop_selectable_product_activation" value="1" {if !$multistore_addon}disabled="disabled"{/if}>
{l s='Yes, I want to select shops where I want to activate products' mod='pshowimporter'}
</label>
{if !$multistore_addon}
<div class="col-md-offset-4 col-md-6 alert alert-info">
<a href="http://prestashow.pl/en//26-.html" target="_blank">
{l s='Buy multistore addon to select shops.' mod='pshowimporter'}
</a>
</div>
{/if}
</div>
<p ng-show="shop_selectable_product_activation">&nbsp;</p>
<div class="col-md-12" ng-show="shop_selectable_product_activation">
<label for="shop_selectable_product_activation_shops" class="control-label col-md-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="">
{l s='Shop IDs' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-4">
<input id="shop_selectable_product_activation_shops" type="text"
value="{if isset($primary_config['shop_selectable_product_activation_shops'])}{$primary_config['shop_selectable_product_activation_shops']}{/if}"
name="shop_selectable_product_activation_shops">
<div>
<small>
{l s='Enter shop IDs separated by comma, example: 1,5,7,12' mod='pshowimporter'}
</small>
</div>
<div>
<small>
{l s='This option enables products regardless of the configured product status changes in step 3.' mod='pshowimporter'}
</small>
</div>
</div>
</div>
<div class="clearfix"></div>
</div>
{/if}
<p>&nbsp;</p>
<div class="panel-heading clearfix">
{l s='Additional options for combinations' mod='pshowimporter'}
</div>
<div class="panel-wrapper">
<div class="col-md-12">
<label class="control-label col-lg-4">
{l s='Generate all possible combinations' mod='pshowimporter'}
</label>
<div class="col-lg-8">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="gen_combinations" id="gen_combinations_on" value="1"
{if $primary_config['gen_combinations']}checked='checked'{/if}>
<label for="gen_combinations_on">{l s='Yes' mod='pshowimporter'}</label>
<input type="radio" name="gen_combinations" id="gen_combinations_off" value="0"
{if !$primary_config['gen_combinations']}checked='checked'{/if}>
<label for="gen_combinations_off">{l s='No' mod='pshowimporter'}</label>
<a class="slide-button btn"></a>
</span>
<p class="help-block">
{l s='If enabled, module will generate all possible combinations from attributes of imported products.' mod='pshowimporter'}
</p>
<p class="help-block">
{l s='It\'s not working in ssh/cron import' mod='pshowimporter'}
</p>
<p class="help-block">
{l s='Combinations will be generated after imported all file or when you click on finish button.' mod='pshowimporter'}
</p>
</div>
</div>
<div class="clearfix"></div>
</div>

View File

@@ -0,0 +1,80 @@
{foreach item='cat' key='key' from=$fileCategories}
{if (empty($cat))}{continue}{/if}
<div class='col-xs-12'>
<div class='col-xs-4'>
{$cat}
</div>
<div class='col-xs-8'>
<div class='col-xs-12'>
<div class='col-xs-12'>
<label><input type="radio" class="option_type" name="{$cat|md5}"
data-index="{$key}" value="leave">
{l s='leave it without changes' mod='pshowimporter'}
</label>
</div>
</div>
<div class='col-xs-12'>
<div class='col-xs-3'>
{if (isset($matched_categories[$cat|md5]) && $matched_categories[$cat|md5] != "leave"
&& $matched_categories[$cat|md5] != "skip")}
<label>
<input type="radio" class="option_type loadCategoriesNow" name="{$cat|md5}"
data-index="{$key}" value="match" checked="checked">
{l s='match to' mod='pshowimporter'}:
</label>
{else}
<label>
<input type="radio" class="option_type" name="{$cat|md5}"
data-index="{$key}" value="match">
{l s='match to' mod='pshowimporter'}:
</label>
{/if}
</div>
<div class='col-xs-9 categoriesFromStore_{$key}'>
<select class='form-control' name="categoryFromStore_{$cat|md5}"></select>
</div>
</div>
<div class='col-xs-12'>
<div class='col-xs-12'>
<label><input type="radio" class="option_type" name="{$cat|md5}"
data-index="{$key}" value="skip">
{l s='do not import products from this category' mod='pshowimporter'}
</label>
</div>
</div>
<div class='col-xs-12'>
<div class='col-xs-12'>
<label><input type="radio" class="option_type" name="{$cat|md5}"
data-index="{$key}" value="disableNotExistingInFile">
{l s='disable products from this category which not exists in the file' mod='pshowimporter'}
</label>
</div>
</div>
</div>
</div>
<script>
$(function () {
//setTimeout(function () {
{if isset($matched_categories[$cat|md5])}
elem = $('input[value="{$matched_categories[$cat|md5]}"][name="{$cat|md5}"]');
if (elem.length === 0)
elem = $('input[value="match"][name="{$cat|md5}"]');
{else}
elem = $('input[value="leave"][name="{$cat|md5}"]');
{/if}
elem.click();
//}, 1000);
});
</script>
<div class='clearfix'></div>
<hr>
{/foreach}
<input type='hidden' name="categoriesLoaded" value="1">

View File

@@ -0,0 +1,27 @@
{foreach item='cat' key='key' from=$fileManufacturers}
{if (empty($cat))}{continue}{/if}
<div class="form-group col-md-12 col-lg-5">
<label class="control-label col-lg-7">{$cat}</label>
<div class="col-lg-5">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="manufacturer_{$cat|md5}" id="manufacturer_{$cat|md5}_off" value="0" class="importManufacturer"
{if (!isset($skipped_manufacturers) || !isset($skipped_manufacturers[md5($cat)]) || !$skipped_manufacturers[md5($cat)])}checked='checked'{/if}>
<label for="manufacturer_{$cat|md5}_off">{l s='Import' mod='pshowimporter'}</label>
<input type="radio" name="manufacturer_{$cat|md5}" id="manufacturer_{$cat|md5}_on" value="1" class="skipManufacturer"
{if (isset($skipped_manufacturers) && isset($skipped_manufacturers[md5($cat)]) && $skipped_manufacturers[md5($cat)])}checked='checked'{/if}>
<label for="manufacturer_{$cat|md5}_on">{l s='Skip' mod='pshowimporter'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
{/foreach}
<input type='hidden' name="manufacturersLoaded" value="1">

View File

@@ -0,0 +1,133 @@
<script>
var should_match = JSON.parse('{$should_match}');
</script>
{include file='./../parts/import_steps.tpl' step=3}
<p>&nbsp;</p>
{include file='./../parts/config.tpl'}
<div class="clearfix">
</div>
<div class="col-sm-12">
<div class="panel panel-filecontents">
<div class="panel-heading">
<a ng-show="ableToHightlight" ng-click="highlightContents()"
class="pull-right btn btn-default">{l s='Highlight syntax' mod='pshowimporter'}</a>
<a ng-show="fileNotLoaded" ng-click="loadFileContents()"
class="pull-right btn btn-success">{l s='Load file' mod='pshowimporter'}</a>
<span id="fileloadstatus" class="pull-right">[[fileloadstatus]]</span>
({l s='grab to move' mod='pshowimporter'})&nbsp;&nbsp;&nbsp;
{l s='File contents' mod='pshowimporter'}
</div>
<div class="panel-wrapper" style="min-height: 120px; max-height: 500px; height: 90%; overflow: scroll;">
{*<div class="alert alert-info hidden tip" id="before_work_with_xml">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<p>
{l s='Before starting work, see the information from this address:' mod='pshowimporter'}
<a href="https://pl.wikipedia.org/wiki/XML">{l s='XML' mod='pshowimporter'}</a>
</p>
</div>*}
<pre ng-show="filecontents" style="width:3000px; height: 95%;"><code class="xml">[[filecontents]]</code></pre>
</div>
</div>
</div>
<form class="col-xs-12 defaultForm form-horizontal" id="matchingFields" method="post" action="{$link->getAdminLink('PShowImporterConfig', true)}&file={$smarty.get.file}&step=2">
<div class="alert alert-info">
<div class="col-xs-9">
<p>{l s='You can match two or more the same fields to merge data. ' mod='pshowimporter'}</p>
<p>{l s='For example select twice \'product name\' and check \'merge\' field to merge two file fields into product name.' mod='pshowimporter'}</p>
</div>
<div class="col-xs-3">
<img class="img-responsive" src="{$smarty.const._PS_BASE_URI_}/modules/pshowimporter/views/img/merge_fields.png">
</div>
<div class="clearfix"></div>
</div>
<div class="panel">
<div class="panel-content">
<div class="col-md-12">
<div class="col-md-3 text-right">
<strong>{l s='First column values from CSV file' mod='pshowimporter'}</strong>
</div>
<div class="col-md-2">
<strong>{l s='PrestaShop field' mod='pshowimporter'}</strong>
</div>
<div class="col-md-1 text-center">
<strong>{l s='Merge the same fields' mod='pshowimporter'}</strong>
</div>
<div class="col-md-2 text-right">
<strong>{l s='Prepend' mod='pshowimporter'}</strong>
</div>
<div class="col-md-2">
<strong>{l s='Append' mod='pshowimporter'}</strong>
</div>
<div class="col-md-1 text-right">
<strong>{l s='Cut from start' mod='pshowimporter'}</strong>
</div>
<div class="col-md-1">
<strong>{l s='Cut from end' mod='pshowimporter'}</strong>
</div>
</div>
<table class="table col-md-12">
{assign var='number' value=1}
{assign var='fieldId' value=0}
{foreach from=reset($rows) key='k' item='own'}
<tr>
<td class="col-md-3 text-right">
{$own}
</td>
<td class="col-md-2">
{include file="../helpers/config_matchxml_dbfield.tpl" fieldId=$number matched=$matched attr='own' elem="own"|cat:$number db_tables=$db_tables val=($matched_fields[$number][0]|cat:'.'|cat:$matched_fields[$number][1])}
</td>
<td class="col-md-1 text-center">
<input type="checkbox" name="merge{{$number}}" class="" value="1" {if $merge[$number]}checked="checked"{/if}>
</td>
<td class="col-md-2 has-success">
<input type="text" name="prepend{{$number}}" class="form-control text-right" value="{$prepend[$number]}">
</td>
<td class="col-md-2 has-success">
<input type="text" name="append{{$number}}" class="form-control" value="{$append[$number]}">
</td>
<td class="col-md-1 has-error">
<input type="number" name="cutStart{{$number}}" min="0" class="form-control text-right" value="{$cutStart[$number]}">
</td>
<td class="col-md-1 has-error">
<input type="number" name="cutEnd{{$number}}" min="0" class="form-control" value="{$cutEnd[$number]}">
</td>
</tr>
{assign var='number' value=($number+1)}
{assign var='fieldId' value=($fieldId+1)}
{/foreach}
</table>
</div>
<div class="clearfix"></div>
<div class="panel-footer">
{include file="./../helpers/config_buttons.tpl" f='config_matchfields' category_matching=$category_matching}
</div>
</div>
</form>
<div class="clearfix"></div>

View File

@@ -0,0 +1,115 @@
{include file='./../parts/import_steps.tpl' step=3}
<p>&nbsp;</p>
<div class="clearfix"></div>
<div class="col-xs-12">
<div class="panel panel-filecontents">
<div class="panel-heading">
<a ng-show="ableToHightlight" ng-click="highlightContents()"
class="pull-right btn btn-default">{l s='Highlight syntax' mod='pshowimporter'}</a>
<a ng-show="fileNotLoaded" ng-click="loadFileContents()"
class="pull-right btn btn-success">{l s='Load file' mod='pshowimporter'}</a>
<span id="fileloadstatus" class="pull-right">[[fileloadstatus]]</span>
({l s='grab to move' mod='pshowimporter'})&nbsp;&nbsp;&nbsp;
{l s='File contents' mod='pshowimporter'}
</div>
<div class="panel-wrapper" style="min-height: 120px; max-height: 500px; height: 90%; overflow: scroll;">
<pre ng-show="filecontents" style="width:3000px; height: 95%;"><code class="xml">[[filecontents]]</code></pre>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="alert alert-info">
<p><strong>{l s='Priorities' mod='pshowimporter'}</strong></p>
<p>{l s='Matches from each tabs has its own priority during import. We placed priority level in each names of tabs below.' mod='pshowimporter'}</p>
<p>{l s='For example if you match product name in tab \'Custom matches\' and in tab \'Custom values\' - value from \'Custom values\' tab will override value from \'Custom matches\' tab.' mod='pshowimporter'}</p>
</div>
<form class="col-xs-12 defaultForm form-horizontal" id="matchingFields" method="post" action="{$link->getAdminLink('PShowImporterConfig', true)}&file={$smarty.get.file}&step=2">
<div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="{if (isset($smarty.get.tabpane) && $smarty.get.tabpane != 'fieldsBox') or !$smarty.get.tabpane}active{/if}">
<a href="#objectTag" aria-controls="objectTag" role="tab" data-toggle="tab">
{l s='Change object tag' mod='pshowimporter'}
</a>
</li>
<li role="presentation" class='objectTagRequired hidden'>
<a href="#own" aria-controls="own" role="tab" data-toggle="tab">
{l s='Matches' mod='pshowimporter'} [{l s='Priority' mod='pshowimporter'}: {l s='high' mod='pshowimporter'}]
</a>
</li>
<li role="presentation" class='objectTagRequired hidden'>
<a href="#custom" aria-controls="custom" role="tab" data-toggle="tab">
{l s='Custom values' mod='pshowimporter'} [{l s='Priority' mod='pshowimporter'}: {l s='medium' mod='pshowimporter'}]
</a>
</li>
<li role="presentation" class='objectTagRequired hidden'>
<a href="#custom-matches" aria-controls="custom-matches" role="tab" data-toggle="tab">
{l s='Custom matches' mod='pshowimporter'} [{l s='Priority' mod='pshowimporter'}: {l s='low' mod='pshowimporter'}]
</a>
</li>
</ul>
</div>
<div class="panel">
<div class="tab-content">
<div role="tabpanel" class="tab-pane" id="custom-matches">
{include file="./config_matchxmlfields_custommatches.tpl"}
</div>
<div role="tabpanel" class="tab-pane" id="custom">
{include file="./config_matchxmlfields_customvalues.tpl"}
</div>
<div role="tabpanel" class="tab-pane fieldsBox" id="own">
</div>
<div role="tabpanel" class="tab-pane active" id="objectTag">
{include file="./config_matchxmlfields_objecttag.tpl"}
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="clearfix"></div>
<div class="panel-footer hidden" id="saveAndNext">
{include file="./../helpers/config_buttons.tpl" f='config_matchfields' category_matching=$category_matching fieldId=0}
</div>
</form>
<div class="clearfix"></div>
<script>
var lang_find = "{l s='Find' mod='pshowimporter'}";
var lang_replace = "{l s='Replace' mod='pshowimporter'}";
var lang_regex = "{l s='Regular expressions' mod='pshowimporter'}";
var lang_regex_info = "{include file='./../parts/regex_exp_info.tpl'}";
var maxInputVars = {$max_input_vars|intval};
var maxInputVarsMsg = "{$max_input_vars_msg|replace:"<br>":'\n'}";
</script>
<script src="{$smarty.const.__PS_BASE_URI__}modules/pshowimporter/views/js/config_matchxmlfields.js"></script>

View File

@@ -0,0 +1,122 @@
<div class="alert alert-info">
<h4>{l s='How it works?' mod='pshowimporter'}</h4>
<p>{l s='You can manually specify the path to value from the XML file.' mod='pshowimporter'}</p>
<hr>
<p><strong>{l s='Example of XML' mod='pshowimporter'}:</strong></p>
<p>&lt;tags&gt;</p>
<p>{'&nbsp;'|str_repeat:4}&lt;<span style="color:darkmagenta">tagName</span> <span style="color:blue">attrName</span>="<span style="color:pink">attrValue1</span>"&gt;<span style="color:red">10</span>&lt;/tagName&gt;</p>
<p>{'&nbsp;'|str_repeat:4}&lt;<span style="color:darkmagenta">tagName</span> <span style="color:blue">attrName</span>="<span style="color:green">attrValue2</span>"&gt;<span style="color:orange">20</span>&lt;/tagName&gt;</p>
<p>{'&nbsp;'|str_repeat:4}&lt;<span style="color:darkmagenta">tagName</span> <span style="color:blue">attrName</span>="<span style="color:turquoise">attrValue3</span>"&gt;<span style="color:hotpink">30</span>&lt;/tagName&gt;</p>
<p>&lt;/tags&gt;</p>
<p><strong>{l s='Example of custom matching' mod='pshowimporter'}:</strong></p>
<table class="table">
<thead>
<tr>
<th>Your custom path</th>
<th>Value from example basing on your custom path</th>
</tr>
</thead>
<tbody>
<tr>
<td>tags</td>
<td>{l s='collection' mod='pshowimporter'} (&lt;tagName attrName="attrValue1"&gt;10&lt;/tagName&gt;&lt;tagName attrName="attrValue2"&gt;20&lt;/tagName&gt;&lt;tagName attrName="attrValue3"&gt;30&lt;/tagName&gt;)</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span></td>
<td>{l s='collection' mod='pshowimporter'} (<span style="color:red">10</span>, <span style="color:orange">20</span>, <span style="color:hotpink">30</span>)</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span>[@<span style="color:blue">attrName</span>="<span style="color:pink">attrValue1</span>"]</td>
<td>{l s='collection' mod='pshowimporter'} (<span style="color:red">10</span>)</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span>[@<span style="color:blue">attrName</span>="<span style="color:green">attrValue2</span>"]</td>
<td>{l s='collection' mod='pshowimporter'} (<span style="color:orange">20</span>)</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span>[@<span style="color:blue">attrName</span>="<span style="color:green">attrValue2</span>"][. < 20]</td>
<td>{l s='collection' mod='pshowimporter'} ()</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span>[. mod 6 = 0]</td>
<td>{l s='collection' mod='pshowimporter'} (<span style="color:orange">30</span>)</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span>[. < 15]</td>
<td>{l s='collection' mod='pshowimporter'} (<span style="color:red">10</span>)</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span>[. > 10]</td>
<td>{l s='collection' mod='pshowimporter'} (<span style="color:orange">20</span>, <span style="color:hotpink">30</span>)</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span>/@<span style="color:blue">attrName</span></td>
<td>{l s='collection' mod='pshowimporter'} (<span style="color:pink">attrValue1</span>, <span style="color:green">attrValue2</span>, <span style="color:turquoise">attrValue3</span>)</td>
</tr>
<tr>
<td>tags/<span style="color:darkmagenta">tagName</span>[. < 15] | tags/<span style="color:darkmagenta">tagName</span>[. > 20]</td>
<td>{l s='collection' mod='pshowimporter'} (<span style="color:red">10</span>, <span style="color:hotpink">30</span>)</td>
</tr>
</tbody>
</table>
<p>
{l s='More informations in PHP documentation' mod='pshowimporter'}:
<a href="http://php.net/manual/en/simplexmlelement.xpath.php" target="_blank">http://php.net/manual/en/simplexmlelement.xpath.php</a>
</p>
<p>
{l s='and in MSDN' mod='pshowimporter'}:
<a href="https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx" target="_blank">https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx</a>
</p>
<p>
<strong>{l s='Test your custom matches here' mod='pshowimporter'}:</strong>
<a href="http://www.xpathtester.com/xpath" target="_blank">http://www.xpathtester.com/xpath</a>
</p>
</div>
<table class="table table-hover">
<thead>
<tr class="active">
<td class="col-md-6 text-right">
<strong>{l s='Your custom path' mod='pshowimporter'}</strong>
</td>
<td class="col-md-6">
<strong>{l s='PrestaShop field' mod='pshowimporter'}</strong>
</td>
</tr>
</thead>
<tbody>
{for $i=1 to 50}
<tr>
<td class="col-md-5">
<div class="input-group">
<div class="input-group-addon putObjectTagHere"></div>
<input type="text" class="form-control" name="matched[custommatches][{$i}][key]"
{if $config["matched"]["custommatches"][$i]["key"]}value="{$config["matched"]["custommatches"][$i]["key"]}"{/if}>
</div>
</td>
<td class="col-md-5">
{include file="../helpers/config_matchxml_dbfield.tpl" type='custommatches' md5=$i}
</td>
<td class="col-md-2 text-right">
<div class="btn-group-action">
<div class="btn-group pull-right">
<a title="Edit" class="edit btn btn-default fieldSettingsBtn">
<i class="icon-cog"></i> {l s='Show/hide settings' mod='pshowimporter'}
</a>
</div>
</div>
</td>
</tr>
{include file="./config_matchxmlfields_options_fields.tpl" type='custommatches' md5=$i}
{/for}
</tbody>
</table>

View File

@@ -0,0 +1,50 @@
<div class="alert alert-info">
<p>{l s='How it works?' mod='pshowimporter'}</p>
<p>{l s='Eg. if in field "Your custom value" you type "SONY" and you match it as "Manufacturer - name" each importing (or updating) object will be complemented by this field. In this way you can add and/or update any value that eg. not exist in your file.' mod='pshowimporter'}</p>
<p><strong>{l s='Warning! All data below will be added to all importing objects! Own values have a higher priority than the matched in.' mod='pshowimporter'}</strong></p>
</div>
<table class="table table-hover">
<thead>
<tr class="active">
<td class="col-md-6 text-right">
<strong>{l s='Your custom value' mod='pshowimporter'}</strong>
</td>
<td class="col-md-6">
<strong>{l s='PrestaShop field' mod='pshowimporter'}</strong>
</td>
</tr>
</thead>
<tbody>
{for $i=1 to 70}
<tr>
<td class="col-md-5">
<input type="text" class="form-control text-right" name="matched[customvalues][{$i}][key]"
{if isset($config["matched"]["customvalues"][$i]["key"])}value="{$config["matched"]["customvalues"][$i]["key"]}"{/if}>
</td>
<td class="col-md-5">
{include file="../helpers/config_matchxml_dbfield.tpl" type='customvalues' md5=$i}
</td>
<td class="col-md-2 text-right">
<div class="btn-group-action">
<div class="btn-group pull-right">
<a title="Edit" class="edit btn btn-default fieldSettingsBtn">
<i class="icon-cog"></i> {l s='Show/hide settings' mod='pshowimporter'}
</a>
</div>
</div>
</td>
</tr>
{include file="./config_matchxmlfields_options_fields.tpl" type='custommatches' md5=$i hideModificators=true}
{/for}
</tbody>
</table>

View File

@@ -0,0 +1,195 @@
{function getFieldId value=''}{foreach from=$allValues item='v' key='fieldId'}{if $value|md5 == $v}{{$fieldId}}{break}{/if}{/foreach}{/function}
{function getXPath}{$path}{/function}
{function xmlattr level=0}
{assign var='_path' value=$path}
{foreach from=$data key='name' item='value'}
{if $_path != ''}
{assign var='path' value=$_path|cat:"/@"|cat:$name}
{else}
{assign var='path' value='@'|cat:$name}
{/if}
<tr>
<td class="col-md-5" style="padding-left: {(($level+1)*10)}px;">
<label class="control-label" style="font-size: 10px; text-align: left;">
&lt;{$tag} {$name}="<span class="label-tooltip">{$value|htmlspecialchars}</span>"&gt;
</label>
</td>
<td class="col-md-3">
{include file="../helpers/config_matchxml_dbfield.tpl" fieldId={getXPath path=$path} matched=$matched elem="{getXPath path=$path}" db_tables=$db_tables val=($own[0]|cat:'.'|cat:$own[1])}
</td>
<td class="text-center">
<input type="checkbox" name="{getFieldId value="$path$value"}_merge" value="1" class="" {if $merge[{getXPath path=$path}]}checked="checked"{/if}>
</td>
<td class="col-md-1 has-success">
<input type="text" name="{getFieldId value="$path$value"}_prepend" class="form-control text-right" value="{$prepend[$path]}">
</td>
<td class="col-md-1 has-success">
<input type="text" name="{getFieldId value="$path$value"}_append" class="form-control" value="{$append[$path]}">
</td>
<td class="col-md-1 has-error">
<input type="text" name="{getFieldId value="$path$value"}_cutStart" min="0" class="form-control text-right" value="{$cutStart[$path]}">
</td>
<td class="col-md-1 has-error">
<input type="text" name="{getFieldId value="$path$value"}_cutEnd" min="0" class="form-control" value="{$cutEnd[$path]}">
</td>
</tr>
{/foreach}
{/function}
{function xmltag level=0 path=''}
{assign var='_path' value=$path}
{if $level == 0}
<tr>
<td class="col-md-3" style="padding-left: {($level*15)}px;">
<label class="control-label" style="font-size: 10px; text-align: left; font-weight: 900;">
&lt;{$object_tag|replace:",":"&gt;&lt;"}&gt;
</label>
</td>
<td colspan="5"></td>
</tr>
{assign 'lastTag' value=($object_tag|substr:(($object_tag|strpos:",")+(($object_tag|explode:",")|count)-1):100)}
{xmlattr data=$data->attributes() tag=$lastTag}
{/if}
{foreach from=$data key='name' item='value'}
{if $_path != ''}
{assign var='path' value=$_path|cat:"/"|cat:$name}
{else}
{assign var='path' value=$name}
{/if}
<tr>
<td class="col-md-5" style="padding-left: {(($level+1)*10)}px;">
<label class="control-label" style="padding: 0; font-size: 10px; text-align: left;">
&lt;{$name}&gt;
</label>
</td>
<td colspan="5"></td>
</tr>
{if !is_string($value)}
{xmlattr data=$value->attributes() tag=$name level=$level+1}
<tr>
<td class="col-md-5" style="padding-left: {(($level+2)*10)}px;">
<label class="control-label" style="font-size: 10px; text-align: left;">
{assign replaceEmptyTag "<"|cat:$name|cat:"/>"}
{assign tagString "~\<"|cat:$name|cat:"(.*)\>(.*)\<(.*)\>~"}
{assign var="regexVal" value=($value->asXML()|regex_replace:$tagString:"\\2":$value->asXML())}
{if $regexVal == ""}
{assign tagString "<"|cat:$name|cat:">"}
{assign tagString2 "</"|cat:$name|cat:">"}
{assign var="regexVal" value=($value->asXML()|replace:$tagString:"":$value->asXML()|replace:$tagString2:"":$value->asXML())}
{/if}
{assign regexVal $regexVal|replace:$replaceEmptyTag:""}
<span class="label-tooltip">
{if $regexVal|strlen > 200}
{$regexVal|substr:0:100|htmlspecialchars} <strong>......</strong> {$regexVal|substr:($regexVal|strlen-100):100|htmlspecialchars}
{else}
{$regexVal|htmlspecialchars}
{/if}
</span>
</label>
</td>
<td class="col-md-3">
{include file="../helpers/config_matchxml_dbfield.tpl" fieldId={getXPath path=$path} matched=$matched elem="{getXPath path=$path}" db_tables=$db_tables val=($own[0]|cat:'.'|cat:$own[1])}
</td>
<td class="text-center">
<input type="checkbox" name="{getFieldId value="$path$value"}_merge" value="1" class="" {if $merge[{getXPath path=$path}]}checked="checked"{/if}>
</td>
<td class="col-md-1 has-success">
<input type="text" name="{getFieldId value="$path$value"}_prepend" class="form-control text-right" value="{$prepend[$path]}">
</td>
<td class="col-md-1 has-success">
<input type="text" name="{getFieldId value="$path$value"}_append" class="form-control" value="{$append[$path]}">
</td>
<td class="col-md-1 has-error">
<input type="text" name="{getFieldId value="$path$value"}_cutStart" min="0" class="form-control text-right" value="{$cutStart[$path]}">
</td>
<td class="col-md-1 has-error">
<input type="text" name="{getFieldId value="$path$value"}_cutEnd" min="0" class="form-control" value="{$cutEnd[$path]}">
</td>
</tr>
{/if}
{if $value|count != 0}
{xmlattr data=$value->attributes() tag=$name level=$level+1}
{xmltag data=$value level=$level+1 path=$path}
{/if}
<tr>
<td class="col-md-5" style="padding-left: {(($level+1)*10)}px;">
<label class="control-label" style="padding: 0; font-size: 10px; text-align: left;">
&lt;/{$name}&gt;
</label>
</td>
<td colspan="5"></td>
</tr>
{/foreach}
{if $level == 0}
<tr>
<td class="col-md-5" style="padding-left: {($level*10)}px;">
<label class="control-label" style="font-size: 10px; text-align: left; font-weight: 900;">
&lt;/{$object_tag|replace:",":"&gt;&lt;/"}&gt;
</label>
</td>
<td colspan="5"></td>
</tr>
{/if}
{/function}
<div class="alert alert-info">
<div class="col-xs-9">
<p><strong>{l s='Merge the same fields' mod='pshowimporter'}</strong></p>
<p>{l s='You can match two or more the same fields to merge data.' mod='pshowimporter'}</p>
<p>{l s='For example select twice \'product name\' and check \'merge\' field to merge two file fields into product name.' mod='pshowimporter'}</p>
<p><strong>{l s='Prepend' mod='pshowimporter'}</strong> - {l s='This allows you to add some value before the value from file.' mod='pshowimporter'}</p>
<p><strong>{l s='Append' mod='pshowimporter'}</strong> - {l s='This allows you to add some value after the value from file.' mod='pshowimporter'}</p>
<p><strong>{l s='Cut from start' mod='pshowimporter'}</strong> - {l s='This allows you to cut letters from start of value from file.' mod='pshowimporter'}</p>
<p><strong>{l s='Cut from end' mod='pshowimporter'}</strong> - {l s='This allows you to cut letters from end of value from file.' mod='pshowimporter'}</p>
</div>
<div class="col-xs-3">
<img class="img-responsive" src="{$smarty.const.__PS_BASE_URI__}modules/pshowimporter/views/img/merge_fields.png">
</div>
<div class="clearfix"></div>
</div>
<table class="table table-hover">
<thead class="matchHeading">
<tr class="active">
<td class="col-md-5">
<strong>{l s='XML field path' mod='pshowimporter'}</strong>
</td>
<td class="col-md-3">
<strong>{l s='PrestaShop field' mod='pshowimporter'}</strong>
</td>
<td class="text-center">
<small><strong>{l s='Merge' mod='pshowimporter'}</strong></small>
</td>
<td class="col-md-1 text-right">
<strong>{l s='Prepend' mod='pshowimporter'}</strong>
</td>
<td class="col-md-1">
<strong>{l s='Append' mod='pshowimporter'}</strong>
</td>
<td class="col-md-1 text-right">
<strong>{l s='Cut from start' mod='pshowimporter'}</strong>
</td>
<td class="col-md-1">
<strong>{l s='Cut from end' mod='pshowimporter'}</strong>
</td>
</tr>
</thead>
<tbody>
{xmltag data=$data level=0 object_tag=$objectTag fieldId=0}
</tbody>
</table>
<script src="{$smarty.const.__PS_BASE_URI__}modules/pshowimporter/views/js/config_matchfieldsxml.js"></script>

View File

@@ -0,0 +1,183 @@
{function xmlattr level=0}
{assign var='_path' value=$path}
{foreach from=$data key='name' item='value'}
{if $_path != ''}
{assign var='path' value=$_path|cat:"/@"|cat:$name}
{else}
{assign var='path' value='@'|cat:$name}
{/if}
<tr class="info">
<td class="col-md-6" style="padding-left: {(($level+1)*10)}px;">
<label class="control-label" style="font-size: 10px; text-align: left;">
&lt;{$tag} {$name}="<span class="label-tooltip" data-original-value='{$regexVal|htmlspecialchars_decode|htmlspecialchars}'>{$value|htmlspecialchars_decode|htmlspecialchars}</span>"&gt;
</label>
</td>
<td class="col-md-4">
<input type="hidden" name="matched[matches][{$path|md5}][key]" value="{$path}">
{include file="../helpers/config_matchxml_dbfield.tpl" type='matches' md5=$path|md5}
</td>
<td class="col-md-2 text-right">
<div class="btn-group-action">
<div class="btn-group pull-right">
<a title="Settings" class="edit btn btn-default fieldSettingsBtn">
<i class="icon-cog"></i> {l s='Show/hide settings' mod='pshowimporter'}
</a>
</div>
</div>
</td>
</tr>
{include file="./config_matchxmlfields_options_fields.tpl" type='matches' md5=$path|md5}
<tr><td></td></tr>
{/foreach}
{/function}
{function xmltag level=0 path=''}
{assign var='_path' value=$path}
{if $level == 0}
<tr>
<td class="col-md-3" style="padding-left: {($level*15)}px;">
<label class="control-label" style="font-size: 10px; text-align: left; font-weight: 900;">
&lt;{$object_tag|replace:",":"&gt;&lt;"}&gt;
</label>
</td>
<td colspan="5"></td>
</tr>
{assign 'lastTag' value=($object_tag|substr:(($object_tag|strpos:",")+(($object_tag|explode:",")|count)-1):100)}
{xmlattr data=$data->attributes() tag=$lastTag}
{/if}
{foreach from=$data key='name' item='value'}
{if $_path != ''}
{assign var='path' value=$_path|cat:"/"|cat:$name}
{else}
{assign var='path' value=$name}
{/if}
<tr>
<td class="col-md-5" style="padding-left: {(($level+1)*10)}px;">
<label class="control-label" style="padding: 0; font-size: 10px; text-align: left;">
&lt;{$name}&gt;
</label>
</td>
<td colspan="5"></td>
</tr>
{if !is_string($value)}
{xmlattr data=$value->attributes() tag=$name level=$level+1}
<tr class="info">
<td class="col-md-6" style="padding-left: {(($level+2)*10)}px;">
{assign replaceEmptyTag "<"|cat:$name|cat:"/>"}
{assign tagString "~\<"|cat:$name|cat:"(.*)\>(.*)\<(.*)\>~"}
{assign var="regexVal" value=($value->asXML()|regex_replace:$tagString:"\\2":$value->asXML())}
{if $regexVal == ""}
{assign tagString "<"|cat:$name|cat:">"}
{assign tagString2 "</"|cat:$name|cat:">"}
{assign var="regexVal" value=($value->asXML()|replace:$tagString:"":$value->asXML()|replace:$tagString2:"":$value->asXML())}
{/if}
{assign regexVal $regexVal|replace:$replaceEmptyTag:""}
<div class="control-label" style="font-size: 10px; text-align: left;">
<span class="label-tooltip" data-original-value='{$regexVal|htmlspecialchars_decode|htmlspecialchars}'>
{if $regexVal|strlen > 200}
{$regexVal|substr:0:100|htmlspecialchars_decode|htmlspecialchars} <strong>......</strong> {$regexVal|substr:($regexVal|strlen-100):100|htmlspecialchars_decode|htmlspecialchars}
{else}
{$regexVal|htmlspecialchars_decode|htmlspecialchars}
{/if}
</span>
</div>
</td>
<td class="col-md-4">
<input type="hidden" name="matched[matches][{$path|md5}][key]" value="{$path}">
{include file="../helpers/config_matchxml_dbfield.tpl" type='matches' md5=$path|md5}
</td>
<td class="col-md-2 text-right">
<div class="btn-group-action">
<div class="btn-group pull-right">
<a title="Edit" class="edit btn btn-default fieldSettingsBtn">
<i class="icon-cog"></i> {l s='Show/hide settings' mod='pshowimporter'}
</a>
</div>
</div>
</td>
</tr>
{include file="./config_matchxmlfields_options_fields.tpl" type='matches' md5=$path|md5}
<tr><td></td></tr>
{/if}
{if $value|count != 0}
{xmlattr data=$value->attributes() tag=$name level=$level+1}
{xmltag data=$value level=$level+1 path=$path}
{/if}
<tr>
<td class="col-md-5" style="padding-left: {(($level+1)*10)}px;">
<label class="control-label" style="padding: 0; font-size: 10px; text-align: left;">
&lt;/{$name}&gt;
</label>
</td>
<td colspan="5"></td>
</tr>
{/foreach}
{if $level == 0}
<tr>
<td class="col-md-5" style="padding-left: {($level*10)}px;">
<label class="control-label" style="font-size: 10px; text-align: left; font-weight: 900;">
&lt;/{$object_tag|replace:",":"&gt;&lt;/"}&gt;
</label>
</td>
<td colspan="5"></td>
</tr>
{/if}
{/function}
<div class="matchHeading" style="display: none;">
<div class="col-md-7">
<strong>{l s='XML field path' mod='pshowimporter'}</strong>
</div>
<div class="col-md-5">
<strong>{l s='PrestaShop field' mod='pshowimporter'}</strong>
</div>
<div class="col-md-2">
</div>
</div>
<table class="table matchHeadingTable">
<thead>
<tr class="active">
<td class="col-md-5">
<strong>{l s='XML field path' mod='pshowimporter'}</strong>
</td>
<td class="col-md-5">
<strong>{l s='PrestaShop field' mod='pshowimporter'}</strong>
</td>
<td class="col-md-2">
</td>
</tr>
</thead>
<tbody>
{xmltag data=$data level=0 object_tag=$objectTag fieldId=0}
</tbody>
</table>
<script src="{$smarty.const.__PS_BASE_URI__}modules/pshowimporter/views/js/config_matchxmlfields_matches.js"></script>

View File

@@ -0,0 +1,68 @@
<div class="alert alert-info">
<p>{l s='The tag object is the outermost tag describing one product.' mod='pshowimporter'}</p>
</div>
<div class="col-md-12 well well-sm">
<div class="col-md-12 text-center">
<strong>{l s='Example' mod='pshowimporter'}:</strong>
</div>
<div class="col-md-12">
<p>&lt;product&gt;</p>
<p>&emsp;&lt;name&gt;ProductName&lt;/name&gt;</p>
<p>&emsp;&lt;desc&gt;ProductDescription&lt;/desc&gt;</p>
<p>&lt;/product&gt;</p>
<hr>
</div>
<div class="col-md-3 text-right">
<p><strong>{l s='Object tag' mod='pshowimporter'}:</strong></p>
</div>
<div class="col-md-9">
<p>product</p>
</div>
</div>
<div class="col-md-12">
<label for="objectTag" class="control-label col-md-4 text-right">
<span title="" data-toggle="tooltip" class="label-tooltip"
data-original-title="{l s='' mod='pshowimporter'}">
{l s='Object tag' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-8">
{if 'OBJECTS,OBJECT,'|in_array:$tags}
<select ng-model="objectTag" name="matched[objectTag]" ng-init="objectTag = 'OBJECTS,OBJECT,'">
<option value="OBJECTS,OBJECT,">&lt;{'OBJECTS,OBJECT,'|substr:0:(($tag|strlen)-1)|replace:",":"&gt;&lt;"}&gt;</option>
</select>
{else}
<select ng-model="objectTag" name="matched[objectTag]"
{if isset($config['matched']['objectTag']) && $config['matched']['objectTag'] != '? string:? undefined:undefined ? ?'}
ng-init="objectTag = '{$config['matched']['objectTag']}'"
{/if}>
{foreach from=$tags item=tag}
<option value="{$tag}">&lt;{$tag|substr:0:(($tag|strlen)-1)|replace:",":"&gt;&lt;"}&gt;</option>
{/foreach}
</select>
{/if}
</div>
</div>
<div class="clearfix"></div>
<div class="panel-footer">
<button name="matchfields" class="btn btn-default pull-right">
<i class="process-icon-edit"></i> {l s='Match fields' mod='pshowimporter'}
</button>
</div>

View File

@@ -0,0 +1,323 @@
<script>
var should_match = JSON.parse('{$should_match}');
</script>
{include file='./../parts/import_steps.tpl' step=3}
<p>&nbsp;</p>
{include file='./../parts/config.tpl'}
<div class="clearfix">
</div>
<div class="col-sm-12">
<div class="panel panel-filecontents">
<div class="panel-heading">
<a ng-show="ableToHightlight" ng-click="highlightContents()"
class="pull-right btn btn-default">{l s='Highlight syntax' mod='pshowimporter'}</a>
<a ng-show="fileNotLoaded" ng-click="loadFileContents()"
class="pull-right btn btn-success">{l s='Load file' mod='pshowimporter'}</a>
<span id="fileloadstatus" class="pull-right">[[fileloadstatus]]</span>
({l s='grab to move' mod='pshowimporter'})&nbsp;&nbsp;&nbsp;
{l s='File contents' mod='pshowimporter'}
</div>
<div class="panel-wrapper" style="min-height: 120px; max-height: 500px; height: 90%; overflow: scroll;">
<div class="alert alert-info hidden tip" id="before_work_with_xml">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<p>
{l s='Before starting work, see the information from this address:' mod='pshowimporter'}
<a href="https://pl.wikipedia.org/wiki/XML">{l s='XML' mod='pshowimporter'}</a>
</p>
</div>
<pre ng-show="filecontents" style="width:3000px; height: 95%;"><code class="xml">[[filecontents]]</code></pre>
</div>
</div>
</div>
<form class="col-xs-12 defaultForm form-horizontal" id="matchingFields" method="post" action="{$link->getAdminLink('PShowImporterConfig', true)}&file={$smarty.get.file}&step=2">
<div class="alert alert-warning">
<p>
<strong>{l s='Remember!' mod='pshowimporter'}</strong>
{l s='Not adapts many times the same field.' mod='pshowimporter'}
</p>
</div>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#objectTag" aria-controls="objectTag" role="tab" data-toggle="tab">
{l s='Object tag' mod='pshowimporter'}
</a>
</li>
<li role="presentation" ng-show="!objectTag">
<a class="text-muted">
{l s='Select object tag to select matches' mod='pshowimporter'}
</a>
</li>
<li role="presentation" ng-show="objectTag">
<a class="text-muted">
{l s='Matches' mod='pshowimporter'}:
</a>
</li>
<li role="presentation" ng-show="objectTag">
<a href="#own" aria-controls="own" role="tab" data-toggle="tab">
{l s='Own' mod='pshowimporter'}
</a>
</li>
</ul>
</div>
<div class="panel">
<div class="objectTagLoader">
<img src="https://media.giphy.com/media/u2Prjtt7QYD0A/giphy.gif" style="width: 30%; "><br>
{l s='loading...' mod='pshowimporter'}
</div>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="objectTag">
<div class="alert alert-info">
<p>{l s='The tag object is the outermost tag describing one product.' mod='pshowimporter'}</p>
</div>
<div class="col-md-12 well well-sm">
<div class="col-md-12 text-center">
<strong>{l s='Example' mod='pshowimporter'}:</strong>
</div>
<div class="col-md-12">
<p>&lt;product&gt;</p>
<p>&emsp;&lt;name&gt;ProductName&lt;/name&gt;</p>
<p>&emsp;&lt;desc&gt;ProductDescription&lt;/desc&gt;</p>
<p>&lt;/product&gt;</p>
<hr>
</div>
<div class="col-md-3 text-right">
<p><strong>{l s='Object tag' mod='pshowimporter'}:</strong></p>
</div>
<div class="col-md-9">
<p>product</p>
</div>
</div>
<div class="col-md-12">
<label for="objectTag" class="control-label col-md-4 text-right">
<span title="" data-toggle="tooltip" class="label-tooltip"
data-original-title="{l s='' mod='pshowimporter'}">
{l s='Object tag' mod='pshowimporter'}:
</span>
</label>
<div class="col-md-8">
<select ng-model="objectTag" name="objectTag"
{if isset($matched_fields['objectTag'])}
ng-init="objectTag = '{$matched_fields['objectTag'][0]}'"
{/if}>
{foreach from=$tags item=tag}
<option value="{$tag}">{$tag}</option>
{/foreach}
</select>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="own">
<div class="alert alert-info hidden tip" id="own_matching_definition">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<div class="col-md-12">
{l s='Here you can define own matchings' mod='pshowimporter'}.
</div>
<div class="col-md-12">
{l s='Example of xml file' mod='pshowimporter'}:
</div>
<div class="col-md-12">
<pre>&lt;product id="123"&gt;
&lt;baseinfo&gt;
&lt;name&gt;{l s='Desktop' mod='pshowimporter'}&lt;/name&gt;
&lt;price&gt;12.58&lt;/price&gt;
&lt;/baseinfo&gt;
&lt;manufacturer name="{l s='Some manufacturer name' mod='pshowimporter'}"/&gt;
&lt;data&gt;
&lt;x name="{l s='Category' mod='pshowimporter'}"&gt;{l s='Category name' mod='pshowimporter'}&lt;/x&gt;
&lt;/data&gt;
&lt;/product&gt;</pre>
</div>
<div class="col-md-12">
{l s='As you see product name and manufacturer name are in tag' mod='pshowimporter'}: <strong>&lt;name&gt;</strong>
</div>
<div class="col-md-12">
{l s='So it is not available to match this fields in normal way - you must use own matching.' mod='pshowimporter'}<br>
</div>
<div class="col-md-12">
<strong>
{l s='Below is the example how it should be done for' mod='pshowimporter'} objectTag = product:<br>
</strong>
</div>
<div class="col-md-12">
<div class="col-md-6">
<input type="text" class="form-control" readonly value="/product.id">
</div>
<div class="col-md-6">
<select disabled='disabled' class="form-control">
<option>product: id</option>
</select>
</div>
<div class="col-md-6">
<input type="text" class="form-control" readonly value="/baseinfo/name">
</div>
<div class="col-md-6">
<select disabled='disabled' class="form-control">
<option>product: name</option>
</select>
</div>
<div class="col-md-6">
<input type="text" class="form-control" readonly value="/manufacturer.name">
</div>
<div class="col-md-6">
<select disabled='disabled' class="form-control">
<option>product: manufacturer name</option>
</select>
</div>
<div class="col-md-6">
<input type="text" class="form-control" readonly value="/product/baseinfo/price">
</div>
<div class="col-md-6">
<select disabled='disabled' class="form-control">
<option>product: price</option>
</select>
</div>
<div class="col-md-6">
<input type="text" class="form-control" readonly value="/product/data/x.name.Category">
</div>
<div class="col-md-6">
<select disabled='disabled' class="form-control">
<option>product: category name</option>
</select>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="col-md-12">
<div class="col-md-3 text-right">
<strong>{l s='XML field path' mod='pshowimporter'}</strong>
</div>
<div class="col-md-3">
<strong>{l s='PrestaShop field' mod='pshowimporter'}</strong>
</div>
<div class="col-md-2 text-right">
<strong>{l s='Prepend' mod='pshowimporter'}</strong>
</div>
<div class="col-md-2">
<strong>{l s='Append' mod='pshowimporter'}</strong>
</div>
<div class="col-md-1 text-right">
<strong>{l s='Cut from start' mod='pshowimporter'}</strong>
</div>
<div class="col-md-1">
<strong>{l s='Cut from end' mod='pshowimporter'}</strong>
</div>
</div>
<div class="col-md-12">
<div class="ownfields">
{assign var='number' value=1}
{foreach from=$matched_fields key='k' item='own'}
{if ($k[0] != '/')}{continue}{/if}
<div class="col-md-3">
<input type="text" name="own{{$number}}" class="form-control" pattern="/(.*)" value="{{$k}}">
</div>
<div class="col-md-3">
{include file="../helpers/config_matchxml_dbfield.tpl" attr='own' elem="own"|cat:$number db_tables=$db_tables val=($own[0]|cat:'.'|cat:$own[1])}
</div>
<div class="col-md-2">
<input type="text" name="prepend{{$number}}" class="form-control text-right" value="{$prepend[$k]}">
</div>
<div class="col-md-2">
<input type="text" name="append{{$number}}" class="form-control" value="{$append[$k]}">
</div>
<div class="col-md-1">
<input type="number" name="cutStart{{$number}}" min="0" class="form-control text-right" value="{$cutStart[$k]}">
</div>
<div class="col-md-1">
<input type="number" name="cutEnd{{$number}}" min="0" class="form-control" value="{$cutEnd[$k]}">
</div>
<div class="clearfix"></div>
{assign var='number' value=($number+1)}
{/foreach}
<div class="ownfieldbox">
<div class="col-md-3">
<input type="text" name="own{{$number}}" class="form-control" pattern="/(.*)">
</div>
<div class="col-md-3">
{include file="../helpers/config_matchxml_dbfield.tpl" attr='yy' elem="own"|cat:$number db_tables=$db_tables}
</div>
<div class="col-md-2">
<input type="text" name="prepend{{$number}}" class="form-control" value="">
</div>
<div class="col-md-2">
<input type="text" name="append{{$number}}" class="form-control" value="">
</div>
<div class="col-md-1">
<input type="number" name="cutStart{{$number}}" min="0" class="form-control text-right" value="0">
</div>
<div class="col-md-1">
<input type="number" name="cutEnd{{$number}}" min="0" class="form-control" value="0">
</div>
</div>
</div>
<script> var ownboxcounter = {{$number}}; var _ownboxcounter = {{$number}};</script>
</div>
<div class="clearfix"></div>
<p>&nbsp;</p>
<button class="btn btn-succes btn-addownfieldbox pull-right">
<i class="process-icon-new"></i> {l s='Add field' mod='pshowimporter'}
</button>
<div class="clearfix"></div>
</div>
</div>
<div class="clearfix"></div>
<div class="panel-footer">
{include file="./../helpers/config_buttons.tpl" f='config_matchfields' category_matching=$category_matching}
</div>
</div>
</form>
<div class="clearfix"></div>

View File

@@ -0,0 +1,177 @@
<tr class="active trFieldSettings" style="display: none">
<td colspan='3'>
<div class='col-xs-6'>
{if !isset($hideModificators) || $hideModificators == null}
<p>&nbsp;</p>
<div class="form-wrapper">
<div class="form-group">
<label class="control-label col-lg-3" for="matched[{$type}][{$md5}][options][prepend]">
{l s='Prepend' mod='pshowimporter'}
</label>
<div class="col-lg-9">
<input type="text" name="matched[{$type}][{$md5}][options][prepend]" class="form-control editValueJs"
id="matched[{$type}][{$md5}][options][prepend]" value="{$config['matched'][$type][$md5]['options']['prepend']|escape:'htmlall':'UTF-8'}">
<p class="help-block">
{l s='This allows you to add some value before the value from file.' mod='pshowimporter'}
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="matched[{$type}][{$md5}][options][append]">
{l s='Append' mod='pshowimporter'}
</label>
<div class="col-lg-9">
<input type="text" name="matched[{$type}][{$md5}][options][append]" class="form-control editValueJs"
id="matched[{$type}][{$md5}][options][append]" value="{$config['matched'][$type][$md5]['options']['append']|escape:'htmlall':'UTF-8'}">
<p class="help-block">
{l s='This allows you to add some value after the value from file.' mod='pshowimporter'}
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="matched[{$type}][{$md5}][options][cutStart]">
{l s='Cut from start' mod='pshowimporter'}
</label>
<div class="col-lg-9">
<input type="number" name="matched[{$type}][{$md5}][options][cutStart]" class="form-control editValueJs"
id="matched[{$type}][{$md5}][options][cutStart]" value="{$config['matched'][$type][$md5]['options']['cutStart']}">
<p class="help-block">
{l s='This allows you to cut letters from start of value from file.' mod='pshowimporter'}
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="matched[{$type}][{$md5}][options][cutEnd]">
{l s='Cut from end' mod='pshowimporter'}
</label>
<div class="col-lg-9">
<input type="number" name="matched[{$type}][{$md5}][options][cutEnd]" class="form-control editValueJs"
id="matched[{$type}][{$md5}][options][cutEnd]" value="{$config['matched'][$type][$md5]['options']['cutEnd']}">
<p class="help-block">
{l s='This allows you to cut letters from end of value from file.' mod='pshowimporter'}
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">
{l s='Merge' mod='pshowimporter'}
</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="matched[{$type}][{$md5}][options][merge]"
id="matched[{$type}][{$md5}][options][merge]_on"
value="1" kl_vkbd_parsed="true"
{if isset($config['matched'][$type][$md5]['options']['merge']) && $config['matched'][$type][$md5]['options']['merge']}checked="checked"{/if}>
<label for="matched[{$type}][{$md5}][options][merge]_on">Tak</label>
<input type="radio" name="matched[{$type}][{$md5}][options][merge]"
id="matched[{$type}][{$md5}][options][merge]_off"
value="0" kl_vkbd_parsed="true"
{if !isset($config['matched'][$type][$md5]['options']['merge']) || !$config['matched'][$type][$md5]['options']['merge']}checked="checked"{/if}>
<label for="matched[{$type}][{$md5}][options][merge]_off">Nie</label>
<a class="slide-button btn"></a>
</span>
<p class="help-block">
{l s='You can match two or more the same fields to merge data.' mod='pshowimporter'}<br>
{l s='For example select twice \'product name\' and check \'merge\' field to merge two file fields into product name.' mod='pshowimporter'}
</p>
</div>
</div>
<div class="replacements-container">
<div class="col-xs-12"><h3>{l s='Replacements' mod='pshowimporter'}</h3></div>
<div class="replacements-info alert alert-info{if $config['matched'][$type][$md5]['options']['replacement']|count > 0} hidden{/if}">
{l s='Here you can define pairs of strings that the module will find and replace during the import.' mod='pshowimporter'}<br>
{l s='Click green button below to add new replacement.' mod='pshowimporter'}
</div>
<div class="replacements" data-md5="{$md5}" data-type="{$type}">
{assign var='replacementCounter' value=0}
{foreach from=$config['matched'][$type][$md5]['options']['replacement'] item='r'}
{if $r['find'] == '' || $r['replace'] == ''}
{continue}
{/if}
{include file='./../helpers/replacement_line.tpl' nameKey='matched['|cat:$type|cat:']['|cat:$md5|cat:'][options][replacement]['|cat:$replacementCounter|cat:']' r=$r}
{assign var='replacementCounter' value=($replacementCounter+1)}
{/foreach}
</div>
<script>
var replacementCounter = {($replacementCounter+1)};
</script>
<div class="form-group">
<div class="col-xs-1 col-xs-offset-11">
<button class="addReplacement btn btn-success btn-sm">
<i class="icon-plus-sign"></i> {l s='Add' mod='pshowimporter'}
</button>
</div>
</div>
</div>
</div>
<p>&nbsp;</p>
{/if}
</div>
<div class='col-xs-6 field-settings'>
{* load in JS *}
</div>
</td>
</tr>

View File

@@ -0,0 +1,89 @@
{include file='./../parts/import_steps.tpl' step=5}
<p>&nbsp;</p>
{include file='./../parts/import_queue.tpl' import_queue=$import_queue import_button=0}
<div class="col-xs-12 panel">
<div class="panel-heading">
{l s='Generating combinations' mod='pshowimporter'}
</div>
<div class="panel-content">
<p>
<strong>{l s='Number of pending products' mod='pshowimporter'}:</strong>
<span class="numberOfPendingProducts"></span>
</p>
<p>
<strong>{l s='Status' mod='pshowimporter'}:</strong>
<span class="status"></span>
</p>
</div>
</div>
<div class="clearfix"></div>
<div class="panel">
<div class="panel-heading">
{l s='Import log' mod='pshowimporter'}
</div>
<div id="log_content" style="height: 300px; overflow-y: scroll;">
{$log_content|nl2br}
</div>
</div>
<div class="clearfix"></div>
<script>
var numberOfPendingProducts = {$numberOfPendingProducts};
window.log_url = "{$link->getAdminLink('PShowImporterMain', true)}&page=getlog&filename={$filename|urlencode}";
window.gen_url = "{$link->getAdminLink('PShowImporterImport', true)}&page=gencomb&import=1&ajax=1";
window.import_url = "{$link->getAdminLink('PShowImporterImport', true)}&page=import";
function getlog() {
$.get(window.log_url, function (data) {
$('#log_content').html(data);
var objDiv = document.getElementById("log_content");
objDiv.scrollTop = objDiv.scrollHeight;
setTimeout('getlog()', 3000);
});
}
function call() {
$.get(window.gen_url, function (data) {
console.log(data);
try {
data = JSON.parse(data);
} catch (ex) {
return false;
}
if (parseInt(data.numberOfPendingProducts) <= 0) {
document.location.href = window.import_url;
return;
}
$('.numberOfPendingProducts').text(data.numberOfPendingProducts);
call();
});
}
window.numberOfDots = 1;
function dots() {
++window.numberOfDots;
if (window.numberOfDots > 5) {
window.numberOfDots = 1;
}
$('.status').text("{l s='Generating' mod='pshowimporter'}"+'.'.repeat(window.numberOfDots));
setTimeout('dots()', 800);
}
$(function () {
$('.numberOfPendingProducts').text(numberOfPendingProducts);
dots();
getlog();
call();
});
</script>

View File

@@ -0,0 +1,979 @@
{include file='./../parts/import_steps.tpl' step=5}
<p>&nbsp;</p>
{include file='./../parts/import_queue.tpl' import_queue=$import_queue import_button=0}
<div ng-show="(threads <= 0)">
<div class="col-xs-3">
<a href="{$link->getAdminLink('PShowImporterImport', true)}&page=import&clearcounter=1&file={$filename}"
class="btn btn-default pull-right col-xs-12"
id="clearcounter"
onclick="window.importing = true;
$('#import-status-').text('{l s='Clearing' mod='pshowimporter'}...');">
<i class="icon-mail-reply"></i> {l s='Start import from the beginning' mod='pshowimporter'}
</a>
<div class="clearfix"></div><br>
<a href="{$link->getAdminLink('PShowImporterImport', true)}&page=import&importfirst=1"
class="btn btn-default pull-right col-xs-12"
id="clearcounter"
onclick="window.importing = true;
$('#import-status-').text('{l s='Cleaning' mod='pshowimporter'}...');">
<i class="icon-fast-backward"></i> {l s='Import first object again' mod='pshowimporter'}
</a>
<div class="clearfix"></div><br>
<a href="{$link->getAdminLink('PShowImporterImport', true)}&page=import&skipobject=1"
class="btn btn-default pull-right col-xs-12"
id="skipThisRow"
onclick="window.importing = true;
$('#import-status-').text('{l s='Skipping' mod='pshowimporter'}...');">
<i class="icon-forward"></i> {l s='Skip one object' mod='pshowimporter'}
</a>
<div class="clearfix"></div><br>
<a href="{$link->getAdminLink('PShowImporterImport', true)}&page=import&importnextrow=1"
class="btn btn-default pull-right col-xs-12"
id="importNextRow"
onclick="window.importing = true;
$('#import-status-').text('{l s='Importing' mod='pshowimporter'}...');">
<i class="icon-download"></i> {l s='Import next object' mod='pshowimporter'}: {if $importStatus["actual_row"] != 'None'}{$importStatus["actual_row"]+1}{else}{$first_line}{/if}
</a>
<div class="clearfix"></div><br>
<a href="{$link->getAdminLink('PShowImporterImport', true)}&page=import&importnextrow=1&debug=1"
class="btn btn-default pull-right col-xs-12"
id="importNextRow"
onclick="window.importing = true;
$('#import-status-').text('{l s='Debugging' mod='pshowimporter'}...');">
<i class="icon-download"></i> {l s='Debug next object' mod='pshowimporter'}: {if $importStatus["actual_row"] != 'None'}{$importStatus["actual_row"]+1}{else}{$first_line}{/if}
</a>
</div>
<div class="panel col-xs-6">
<div class="col-xs-12 text-center">
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='File' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
{$filename}
</div>
</div>
{if $importStatus["actual_row"] >= 0}
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Last imported row' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="actual_row_">{$importStatus["actual_row"]}</span>
</div>
</div>
{/if}
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Imported rows' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="counter_imported_rows_">{$importStatus["counter_imported_rows"]}</span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Skipped rows' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="counter_skipped_rows_">{$importStatus["counter_skipped_rows"]}</span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Rows with errors' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="counter_error_rows_">{$importStatus["counter_error_rows"]}</span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Rows count in file' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="rows_count_">{$rowsCount}</span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Max number of threads' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span>1{*{$number_of_threads}*}</span>
</div>
</div>
<div class="col-md-12 hidden">
<div class="col-md-6 text-right">
{l s='Prepared rows' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="cached_rows_">{$cached_rows}</span>
</div>
</div>
<div class="clearfix"></div>
<p>&nbsp;</p>
<div class="progress" style="background: lightgray;">
<div class="progress-bar" role="progressbar"
aria-valuenow="{$importStatus["actual_row"]}"
aria-valuemin="0"
aria-valuemax="{$rowsCount}"
style="width: {($importStatus["actual_row"]/$rowsCount)*100}%;">
</div>
<div class="progress-bar-counter1">
{(($importStatus["actual_row"]/$rowsCount)*100)|round:2}%
</div>
</div>
<div class="text-center">
<strong>{l s='Importer status' mod='pshowimporter'}:</strong>
<span id="import-status-">{l s='Ready' mod='pshowimporter'}...</span>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
<div class="col-xs-3">
<a href="{$link->getAdminLink('PShowImporterImport', true)}&page=import&clear=1"
class="btn btn-default pull-right {if $isSomethingToImport}hidden{/if} col-xs-12"
id="clearImportData">
<i class="process-icon-save"></i> {l s='Finish import' mod='pshowimporter'}
</a>
{if $isSomethingToImport}
<a href="#" class="btn btn-success pull-right col-xs-12 hideOnFinish" id="startAutoImport">
<i class="icon-play icon-custom"></i> {l s='Start auto importing' mod='pshowimporter'}
</a>
<div class="clearfix"></div><br>
<a href="{$link->getAdminLink('PShowImporterMain', true)}" class="btn btn-warning col-xs-12 hideOnFinish"
onclick="javascript: if (window.importing) {
alert('Stop importing...');
return false;
}">
<i class="icon-pause icon-custom"></i> {l s='I\'ll back later' mod='pshowimporter'}
</a>
<div class="clearfix"></div><br>
<a href="{$link->getAdminLink('PShowImporterImport', true)}&page=stop"
class="btn btn-danger col-xs-12 hideOnFinish"
onclick="javascript: if (window.importing) {
alert('Stop importing...');
return false;
}
if (!confirm('{l s='Are you sure?' mod='pshowimporter'}'))
return false;">
<i class="icon-stop icon-custom"></i> {l s='Cancel' mod='pshowimporter'} import
</a>
{/if}
</div>
</div>
<div ng-show="(threads > 0)" >
<div class="panel col-xs-12">
<div class="col-xs-12 text-center">
<div class="col-md-6">
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='File' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
{$filename}
</div>
</div>
{if $importStatus["actual_row"] >= 0}
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Last imported row' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="actual_row">{$importStatus["actual_row"]}</span>
</div>
</div>
{/if}
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Imported rows' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="counter_imported_rows">{$importStatus["counter_imported_rows"]}</span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Skipped rows' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="counter_skipped_rows">{$importStatus["counter_skipped_rows"]}</span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Rows with errors' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="counter_error_rows">{$importStatus["counter_error_rows"]}</span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Rows count in file' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="rows_count">{$rowsCount}</span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 text-right">
{l s='Prepared rows' mod='pshowimporter'}:
</div>
<div class="col-md-6 text-left">
<span id="cached_rows">{$cached_rows}</span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="col-md-12 text-center">
<div class="col-md-6 text-right">
<strong>{l s='Importer status' mod='pshowimporter'}:</strong>
</div>
<div class="col-md-6 text-left">
<span id="import-status">{l s='Ready' mod='pshowimporter'}...</span>
</div>
</div>
<div class="col-md-12" ng-show="(threads > 0 && hideImportStats != 1)">
<div class="col-md-6 text-right">
<strong>{l s='Import speed' mod='pshowimporter'}:</strong>
</div>
<div class="col-md-6 text-left">
<span id="import-speed"></span>
</div>
</div>
<div class="col-md-12" ng-show="(threads > 0 && hideImportStats != 1)">
<div class="col-md-6 text-right">
<strong>{l s='Estimation time' mod='pshowimporter'}:</strong>
</div>
<div class="col-md-6 text-left">
<span id="import-estimation"></span>
</div>
</div>
{*<div class="col-md-12" ng-show="(threads > 0 && hideImportStats != 1)">
<div class="col-md-6 text-right">
<strong>{l s='Memory usage' mod='pshowimporter'}:</strong>
</div>
<div class="col-md-6 text-left">
<span id="memory_usage"></span>
</div>
</div>
<div class="col-md-12" ng-show="(threads > 0 && hideImportStats != 1)">
<div class="col-md-6 text-right">
<strong>{l s='CPU usage' mod='pshowimporter'}:</strong>
</div>
<div class="col-md-6 text-left">
<span id="cpu_usage"></span>
</div>
</div>*}
<div class="col-md-12" ng-init="threads = 0">
<div class="col-md-6 text-right">
<strong>{l s='Running threads' mod='pshowimporter'}:</strong>
</div>
<div class="col-md-6 text-left">
<span>[[threads]]</span>
</div>
</div>
</div>
<div class="clearfix"></div>
<p>&nbsp;</p>
<div class="progress2" style="background: lightgray; height: 20px; padding: 2px;">
<div class="progress-bar" role="progressbar"
aria-valuenow="{$importStatus["actual_row"]}"
aria-valuemin="0"
aria-valuemax="{$rowsCount}"
style="width: {($importStatus["actual_row"]/$rowsCount)*100}%;">
</div>
<div class="progress-bar-counter2">
{(($importStatus["actual_row"]/$rowsCount)*100)|round:2}%
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
<div class="col-xs-12">
<a href="#" class="btn btn-danger pull-right col-xs-12" id="stopAutoImport">
<i class="process-icon-cancel"></i> {l s='Stop auto importing' mod='pshowimporter'}
</a>
</div>
</div>
<div class="clearfix"></div>
<div class="panel hidden" ng-init="startedAutoImport = false" ng-show="startedAutoImport">
<div class="panel-heading">
{l s='Import errors' mod='pshowimporter'}
</div>
<div class="panel-wrapper" style="max-height: 300px; overflow-y: auto;">
<div class="table-responsive-row">
<div ng-repeat="error in errors">
<div class="alert alert-[[error.type]]">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<span ng-bind-html="error.message | renderHTMLCorrectly"></span>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="panel">
<div class="panel-heading">
<span>{l s='Import log' mod='pshowimporter'}</span>
<span data-toggle="tooltip" class="switch prestashop-switch fixed-width-sm pull-left label-tooltip" style="margin-left: 15px;"
data-original-title="{l s='Show real time log updates (enabled may slow down import)' mod='pshowimporter'}"
data-html="true" data-placement="right">
<input onclick="getlog(true);" type="radio" name="getLog" id="getLog_on" value="1">
<label for="getLog_on" class="radioCheck">
{l s='Yes' mod='pshowimporter'}
</label>
<input onclick="getlog(false);" type="radio" name="getLog" id="getLog_off" value="0" checked="checked">
<label for="getLog_off" class="radioCheck">
{l s='No' mod='pshowimporter'}
</label>
<a class="slide-button btn"></a>
</span>
<a href="{$smarty.const.__PS_BASE_URI__}modules/pshowimporter/import-log/{$filename}/?token={$log_dir|md5}"
target="_blank" class="btn btn-default pull-right topps15">
{l s='Open full log in new tab' mod='pshowimporter'}
</a>
</div>
<div id="log_content" style="height: 300px; overflow-y: scroll;">
{$log_content|nl2br}
</div>
</div>
{literal}
<style>
.modulecontainer .btn-default,
.modulecontainer .btn-success,
.modulecontainer .btn-danger {
margin-bottom: 6px;
}
.process-icon-back-later {
background-image: url('/presta16/modules/pshowimporter/views/img/back-later.png');
background-repeat: no-repeat;
}
</style>
{/literal}
{*literal}
<script>
var pshowimporter = {};
pshowimporter.import = function (callback) {
$.get("http://127.0.0.1/modules/pshowimporter/ajax_import.php?securekey={/literal}{$smarty.const._IMPORT_SECURE_KEY_}{literal}", function (result) {
console.log(result);
callback(result);
});
};
pshowimporter.stop = function (callback) {
$.get("http://127.0.0.1/modules/pshowimporter/ajax_stop.php?securekey={/literal}{$smarty.const._IMPORT_SECURE_KEY_}{literal}", function (result) {
console.log(result);
callback(result);
});
};
pshowimporter.status = function (callback) {
$.get("http://127.0.0.1/modules/pshowimporter/ajax_status.php?securekey={/literal}{$smarty.const._IMPORT_SECURE_KEY_}{literal}", function (result) {
console.log(result);
callback(result);
});
};
var pshowimporter_ui = {};
pshowimporter_ui.start_import = function () {
pshowimporter.import('pshowimporter.status');
var func = function () {
pshowimporter.status(function (result) {
try {
data = JSON.parse(result);
updateImportStatus(data);
} catch (ex) {
console.error('Failed to parse JSON: ' + result);
}
});
};
var pshowimporter_ui.status_interval = setInterval(func, 2000);
};
pshowimporter_ui.stop_import = function () {
pshowimporter.stop();
clearInterval(pshowimporter_ui.status_interval);
};
</script>
{/literal*}
<script>
var objDiv = document.getElementById("log_content");
objDiv.scrollTop = objDiv.scrollHeight;
window.rows_count = {$rowsCount};
window.set_cache_url = "{$link->getAdminLink('PShowImporterImport', true)}&page=import&loadAllObjectsByPathToCache=1";
window.import_url = "{$link->getAdminLink('PShowImporterImport', true)}&page=import&importnextrow=1&ajax=1";
window.status_url = "{$link->getAdminLink('PShowImporterImport', true)}&page=getstatus&ajax=1";
window.log_url = "{$link->getAdminLink('PShowImporterMain', true)}&page=getlog&filename={$filename|urlencode}&ajax=1";
window.importing = false;
window.times = [];
window.internal_errors = 0;
window.firstTimeStart = {$firstTimeStart};
{literal}
var _GET_LOG_ = false;
function getlog(newStatus)
{
if (typeof newStatus !== 'undefined') {
_GET_LOG_ = newStatus;
return;
}
if (!_GET_LOG_) {
setTimeout(function () {
getlog();
}, 1000);
return;
}
$.get(window.log_url, function (data) {
x = data.replace(/\[/g, '<strong>[')
.replace(/\]/g, ']</strong>')
.replace(/\*\*\*/g, '<strong>***</strong>')
.replace(/Skipped/g, '<span style="color: darkblue; font-weight: bold;">Skipped</span>')
.replace(/Error/g, '<span style="color: darkred; font-weight: bold;">Error</span>');
$('#log_content').html(x);
var objDiv = document.getElementById("log_content");
objDiv.scrollTop = objDiv.scrollHeight;
setTimeout(function () {
getlog();
}, 1000);
});
}
getlog();
var getstatus_init = false;
function getstatus()
{
if (getstatus_init) {
return;
}
getstatus_init = true;
$.get(window.status_url, function (data) {
//console.log(data);
try {
data = JSON.parse(data);
} catch (ex) {
return false;
}
window.internal_errors = 0;
updateImportStatus(data);
if (angular.element('[ng-controller=psiController]').scope().threads > 0) {
setTimeout(function () {
getstatus_init = false;
getstatus();
}, 2000);
}
});
}
function updateImportStatus2(data)
{
if (data.actual_row > rows_count)
data.actual_row = rows_count;
if (data.counter_imported_rows > rows_count)
data.counter_imported_rows = rows_count;
$('#import-speed').text(data.importedThisTime + " / " + data.time + " s");
var oneRowTime = data.time / data.importedThisTime;
if (window.times === null)
window.times = [];
if (window.times.length > 20)
window.times.splice(0, 1);
window.times.push(Math.round(oneRowTime * 100) / 100);
var averageTime = 0;
var i = 0;
for (time in window.times)
{
++i;
averageTime = averageTime + window.times[time];
}
averageTime = averageTime / i;
var sec = Math.floor((rows_count - data.actual_row) * averageTime);
var min = 0;
var hou = 0;
if (sec > 60)
{
min = Math.floor(sec / 60);
sec = sec - (min * 60);
}
if (min > 60)
{
hou = Math.floor(min / 60);
min = min - (hou * 60);
}
if (sec < 10)
sec = "0" + sec;
if (min < 10)
min = "0" + min;
if (hou < 10)
hou = "0" + hou;
$('#import-estimation').text(' ~' + hou + ":" + min);
for (err in data.error)
{
if (data.error[err] !== true && data.error[err].length > 0)
{
angular.element('[ng-controller=psiController]').scope()
.errors.push({type: 'warning', message: data.error[err]});
angular.element('[ng-controller=psiController]').scope().$apply();
}
}
}
function updateImportStatus(data)
{
if (data.actual_row > rows_count)
data.actual_row = rows_count;
if (data.counter_imported_rows > rows_count)
data.counter_imported_rows = rows_count;
$('#actual_row').text(data.actual_row);
$('#counter_imported_rows').text(data.counter_imported_rows);
$('#counter_skipped_rows').text(data.counter_skipped_rows);
$('#counter_error_rows').text(data.counter_error_rows);
$('#actual_row_').text(data.actual_row);
$('#counter_imported_rows_').text(data.counter_imported_rows);
$('#counter_skipped_rows_').text(data.counter_skipped_rows);
$('#counter_error_rows_').text(data.counter_error_rows);
//$('#memory_usage').text(data.memory_usage);
//$('#cpu_usage').text(data.cpu_usage);
$('#memory_limit').text(data.memory_limit);
rows_count = parseInt($('#rows_count').text());
percent = ((data.actual_row / rows_count) * 100);
percent = percent.toFixed(2);
if (percent > 100)
percent = 100;
if (percent < 10)
percent = "0" + percent;
$('.progress .progress-bar').attr("aria-valuemax", rows_count);
$('.progress .progress-bar').attr("aria-valuenow", data.actual_row);
$('.progress .progress-bar').css("width", percent + "%");
$('.progress-bar-counter1').text(percent + "%");
$('.progress2 .progress-bar').attr("aria-valuemax", rows_count);
$('.progress2 .progress-bar').attr("aria-valuenow", data.actual_row);
$('.progress2 .progress-bar').css("width", percent + "%");
$('.progress-bar-counter2').text(percent + "%");
document.title = 'IMPORT: ' + percent + ' %';
if (window.importing && data.isSomethingToImport)
{
$('#import-status').text("{/literal}{l s='Importing' mod='pshowimporter'}{literal}...");
} else
{
angular.element('[ng-controller=psiController]').scope().threads -= 1;
angular.element('[ng-controller=psiController]').scope().$apply();
}
if (!data.isSomethingToImport)
{
window.importing = false;
}
if (!window.importing && angular.element('[ng-controller=psiController]').scope().threads <= 0)
{
$('#import-status').text("{/literal}{l s='Ready' mod='pshowimporter'}{literal}...");
$('#stopAutoImport').hide();
$('#startAutoImport').show();
$('#importNextRow').show();
}
if (!data.isSomethingToImport && angular.element('[ng-controller=psiController]').scope().threads <= 0)
{
$('#stopAutoImport').hide();
$('#startAutoImport').hide();
$('#importNextRow').hide();
$('#clearImportData').removeClass('hidden');
$('.hideOnFinish').hide();
document.title = '! IMPORT COMPLETE !';
$('#import-status').text("{/literal}{l s='Completed' mod='pshowimporter'}{literal}!");
}
}
$(document).ajaxError(function (event, jqxhr, settings, thrownError) {
angular.element('[ng-controller=psiController]').scope()
.errors.push({type: 'warning', message: "Row: " + $('#actual_row').text() + " Request error: " + thrownError});
angular.element('[ng-controller=psiController]').scope().$apply();
});
function callAjaxRequest(thread)
{
$.ajax({
url: window.import_url,
async: true,
statusCode: {
500: function () {
//window.internal_errors += 1;
/*if (window.internal_errors >= 5)
{
$('#stopAutoImport').click();
function skipThisRow()
{
if (!window.importing)
document.location.href = $('#skipThisRow').attr('href');
else
setTimeout('skipThisRow()', 1500);
}
skipThisRow();
}*/
$('#log_content').parent().prepend('<div class="alert alert-danger">Error 500</div>');
angular
.element('[ng-controller=psiController]')
.scope()
.errors
.push({
type: 'warning',
message: "{/literal}{l s='Connection error. Resuming ...' mod='pshowimporter'}{literal}"
});
angular.element('[ng-controller=psiController]').scope().$apply();
},
404: function () {
angular
.element('[ng-controller=psiController]')
.scope()
.errors
.push({
type: 'warning',
message: "{/literal}{l s='Your server is a little slow so I must try import this row again...' mod='pshowimporter'}{literal}"
});
angular.element('[ng-controller=psiController]').scope().$apply();
}
},
beforeSend: function (xhr) {
console.log('request by thread: ' + thread);
}
})
.always(function (data) {
console.log(data);
if (data === 'refresh_now')
{
document.location.href = "{/literal}{$link->getAdminLink('PShowImporterImport', true)}{literal}";
return;
}
if (data === 'genCombination') {
document.location.href = "{/literal}{$link->getAdminLink('PShowImporterImport', true)}{literal}&page=gencomb";
return;
}
if (data === 'importFinished') {
$('#stopAutoImport').hide();
$('#startAutoImport').hide();
$('#importNextRow').hide();
$('#clearImportData').removeClass('hidden');
$('.hideOnFinish').hide();
document.title = '! IMPORT COMPLETE !';
$('#import-status').text("{/literal}{l s='Completed' mod='pshowimporter'}{literal}!");
angular.element('[ng-controller=psiController]').scope().threads -= 1;
angular.element('[ng-controller=psiController]').scope().$apply();
percent = 100;
$('.progress .progress-bar').css("width", percent + "%");
$('.progress-bar-counter1').text(percent + "%");
$('.progress2 .progress-bar').css("width", percent + "%");
$('.progress-bar-counter2').text(percent + "%");
return;
}
try {
data = JSON.parse(data);
} catch (ex) {
//window.internal_errors += 1;
$('#log_content').parent().prepend('<div class="alert alert-danger">Parsing error</div>');
/*if (window.internal_errors >= 5)
{
$('#stopAutoImport').click();
function skipThisRow()
{
if (!window.importing)
document.location.href = $('#skipThisRow').attr('href');
else
setTimeout('skipThisRow()', 1500);
}
skipThisRow();
}*/
}
if (!window.importing)
{
angular.element('[ng-controller=psiController]').scope().threads -= 1;
angular.element('[ng-controller=psiController]').scope().$apply();
return;
}
callAjaxRequest(thread);
})
.done(function (data) {
try {
data = JSON.parse(data);
} catch (ex) {
return false;
}
window.internal_errors = 0;
updateImportStatus2(data);
});
}
function importNextRow()
{
THREADS = 1;//{/literal}{$number_of_threads}{literal};
angular.element('[ng-controller=psiController]').scope().threads = THREADS;
angular.element('[ng-controller=psiController]').scope().$apply();
getstatus();
for (x = 1; x <= THREADS; ++x)
{
console.info("starting thread..." + x);
callAjaxRequest(x);
}
}
var org = window.onload;
window.onload = function ()
{
org();
angular.element('[ng-controller=psiController]').scope().errors = [];
angular.element('[ng-controller=psiController]').scope().$apply();
};
function genCacheFromFile()
{
angular.element('[ng-controller=psiController]').scope().threads = 1;
angular.element('[ng-controller=psiController]').scope().hideImportStats = 1;
angular.element('[ng-controller=psiController]').scope().$apply();
$('#import-status').text("{/literal}{l s='Preparing rows to import' mod='pshowimporter'}{literal}...");
setTimeout(function () {
$.get(window.set_cache_url, function (data) {
console.log(data);
data = parseInt(data);
percent = ((data / window.rows_count) * 100);
percent = percent.toFixed(2);
if (percent > 100)
percent = 100;
if (percent < 10)
percent = "0" + percent;
$('.progress2 .progress-bar').attr("aria-valuemax", window.rows_count);
$('.progress2 .progress-bar').attr("aria-valuenow", data);
$('.progress2 .progress-bar').css("width", percent + "%");
$('.progress-bar-counter2').text(percent + "%");
if (!window.importing)
{
angular.element('[ng-controller=psiController]').scope().hideImportStats = 0;
angular.element('[ng-controller=psiController]').scope().threads = 0;
angular.element('[ng-controller=psiController]').scope().$apply();
$('#import-status').text("{/literal}{l s='Ready' mod='pshowimporter'}{literal}...");
$('#stopAutoImport').hide();
$('#startAutoImport').show();
$('#importNextRow').show();
return;
}
$('#cached_rows_').text(data);
$('#cached_rows').text(data);
if (data !== 0)
genCacheFromFile();
else
{
angular.element('[ng-controller=psiController]').scope().hideImportStats = 0;
angular.element('[ng-controller=psiController]').scope().threads = 0;
angular.element('[ng-controller=psiController]').scope().$apply();
startImporting();
}
});
}, 2000);
}
function startImporting()
{
importNextRow();
$('#import-status').text("{/literal}{l s='Importing' mod='pshowimporter'}{literal}...");
}
$(function () {
// prevent import on refresh
newUrl = window.location.href.replace("&importnextrow=1", "");
window.history.pushState('import-page', 'Import', newUrl);
$('#stopAutoImport').hide();
$('#startAutoImport').click(function (e) {
e.preventDefault();
angular.element('[ng-controller=psiController]').scope().startedAutoImport = true;
angular.element('[ng-controller=psiController]').scope().$apply();
window.importing = true;
$('#startAutoImport').hide();
$('#stopAutoImport').show();
$('#importNextRow').hide();
startImporting();
{/literal}
{*if (false && {/literal}{$smarty.const._PS_CACHE_ENABLED_}{literal} && confirm('Prepare rows from file to cache for fast import?'))
{
genCacheFromFile()
} else
{
startImporting()
}*}
{literal}
return false;
});
$('#stopAutoImport').click(function (e) {
e.preventDefault();
window.importing = false;
$('#stopAutoImport').hide();
$('#import-status').html("{/literal}{l s='Stopping' mod='pshowimporter'}{literal}...");
return false;
});
{/literal}{if $autostart_import}{literal}
setTimeout(function () {
$('#startAutoImport').click();
}, 1000);
{/literal}{/if}{literal}
});
{/literal}
</script>

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../');
exit;

View File

@@ -0,0 +1,134 @@
{showTip id='csv_convert_to_xml' type='warning' message={l s='From v2.173 we decided to support CSV in the same way as XML format. ' mod='pshowimporter'}|cat:{l s='Module will convert all your past, recent and every new file from CSV to XML. ' mod='pshowimporter'}|cat:{l s='This step will standarize the process of import for XML and CSV files. ' mod='pshowimporter'}|cat:{l s='To convert your CSV file to XML document please select `Convert to XML` option on the files list below.' mod='pshowimporter'}}
{showTip id='primary_config_moved_to_step_3' type='warning' message={l s='In version v2.179, most options were moved from step 2 (basic configuration) to step 3 (data matching). ' mod='pshowimporter'}|cat:{l s='As a result of these changes, all files have to be reconfigured. ' mod='pshowimporter'}|cat:{l s='If you have any problems, please feel free to create bug reports using this URL: http://helpdesk.prestashow.pl/open.php' mod='pshowimporter'}}
{if $isDuringImport && $isDuringCronImport}
<div class="text-center">
<div class="panel-heading" style="color: #fff;">
<span class="text-danger">
{l s='Direct import not finished!' mod='pshowimporter'}
</span>
</div>
<div class="panel-wrapper">
<p>{l s='At this time, someone directly imports file' mod='pshowimporter'}: {$isDuringImport}</p>
<p>{l s='You cannot start new import before finish last one.' mod='pshowimporter'}</p>
<p>{l s='Import started' mod='pshowimporter'}: {$importStartDate}</p>
<p>{l s='Import last updated' mod='pshowimporter'}: {$importUpdateDate}</p>
<p>{l s='Imported' mod='pshowimporter'}: {$imported}</p>
<p>{l s='You cannot start new import before finish last one.' mod='pshowimporter'}</p>
<p>{l s='What you want to do?' mod='pshowimporter'}</p>
</div>
<div class="panel-footer">
<a href="{$link->getAdminLink('PShowImporterMain', true)}&page=stop"
class="btn btn-default"
onclick="javascript: return confirm('{l s='Are you sure you want to stop import?' mod='pshowimporter'}');">
<i class="process-icon-cancel"></i> {l s='Stop' mod='pshowimporter'}</a>
</div>
</div>
</div>
<div class="panel">
{elseif $isDuringImport}
<div class="text-center">
<div class="panel-heading" style="color: #fff;">
<span class="text-danger">
{l s='You not finished last import!' mod='pshowimporter'}
</span>
</div>
<div class="panel-wrapper">
<p>{l s='Name' mod='pshowimporter'}: {$isDuringImport}</p>
<p>{l s='You cannot start new import before finish last one.' mod='pshowimporter'}</p>
<p>{l s='Import started' mod='pshowimporter'}: {$importStartDate}</p>
<p>{l s='Import last updated' mod='pshowimporter'}: {$importUpdateDate}</p>
<p>{l s='Imported' mod='pshowimporter'}: {$imported}</p>
<p>{l s='What you want to do?' mod='pshowimporter'}</p>
</div>
<div class="panel-footer">
<a href="{$link->getAdminLink('PShowImporterMain', true)}&page=stop"
class="btn btn-default"
onclick="javascript: return confirm('{l s='Are you sure you want to stop import?' mod='pshowimporter'}');">
<i class="process-icon-cancel"></i> {l s='Stop' mod='pshowimporter'}</a>
<a href="{$link->getAdminLink('PShowImporterImport', true)}&page=import" class="btn btn-default">
<i class="process-icon-save"></i>{l s='Continue' mod='pshowimporter'}</a>
</div>
</div>
</div>
<div class="panel">
{/if}
{if !$writeableImportConfig}
<div class="alert alert-warning">
<p>
{l s='Module do not have write permissions to' mod='pshowimporter'}:
{$modulePath}import-config
</p>
</div>
</div>
<div class="panel">
{/if}
{if !$writeableImportLog}
<div class="alert alert-warning">
<p>
{l s='Module do not have write permissions to' mod='pshowimporter'}:
{$modulePath}import-log
</p>
</div>
</div>
<div class="panel">
{/if}
{if !$writeableImportStatus}
<div class="alert alert-warning">
<p>
{l s='Module do not have write permissions to' mod='pshowimporter'}:
{$modulePath}import-status
</p>
</div>
</div>
<div class="panel">
{/if}
{if !$writeableUpload}
<div class="alert alert-warning">
<p>
{l s='Module do not have write permissions to' mod='pshowimporter'}:
{$modulePath}upload
</p>
</div>
</div>
<div class="panel">
{/if}
{if !$writeableUpdate}
<div class="alert alert-warning">
<p>
{l s='Module do not have write permissions to' mod='pshowimporter'}:
{$modulePath}update
</p>
</div>
</div>
<div class="panel">
{/if}
{include file='./../parts/import_steps.tpl' step=1}
</div>
{include file='./../parts/import_queue.tpl' import_queue=$import_queue import_button=!$isDuringImport}
<div class="panel">
{include file='../parts/files_list.tpl'}

View File

@@ -0,0 +1,17 @@
<div class="panel-heading">
{l s='Here you can reinstall module overrides' mod='pshowimporter'}
</div>
<div class="panel-content">
<p>{l s='Overrides are files that contain code that changes the basic operation of the store.' mod='pshowimporter'}</p>
<p><strong>{l s='Proceed with caution, the changes are irreversible.' mod='pshowimporter'}</strong></p>
<p><strong>{l s='Backup `/override` directory from your shop before this operation.' mod='pshowimporter'}</strong></p>
<a href="{$link->getAdminLink('PShowImporterMain')}&page=reinstallOverrides&start=1" class="btn btn-default">{l s='Start' mod='pshowimporter'}</a>
</div>