195 lines
12 KiB
Smarty
195 lines
12 KiB
Smarty
{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;">
|
|
<{$tag} {$name}="<span class="label-tooltip">{$value|htmlspecialchars}</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>
|
|
{/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;">
|
|
<{$object_tag|replace:",":"><"}>
|
|
</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;">
|
|
<{$name}>
|
|
</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;">
|
|
</{$name}>
|
|
</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;">
|
|
</{$object_tag|replace:",":"></"}>
|
|
</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> |