Files
interblue.pl/modules/pshowimporter/views/templates/admin/config_matchxmlfields_old.tpl
2024-10-25 14:16:28 +02:00

323 lines
14 KiB
Smarty

<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>