Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
img.amazonimageprev {
|
||||
border:0;
|
||||
max-width:50px;
|
||||
max-height:50px;
|
||||
}
|
||||
|
||||
table.sendarticlepopuptable > tbody >tr {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
table#newoffertable tbody tr + tr td:nth-child(1),
|
||||
table#searchresults tbody tr + tr td:nth-child(2) {
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
}
|
||||
div#searchresultsdiv {
|
||||
max-height: 250px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
var ShopImporterAmazon = function ($) {
|
||||
'use strict';
|
||||
|
||||
var me = {
|
||||
storage: {
|
||||
shopId: null,
|
||||
invoiceUploadIds: null
|
||||
},
|
||||
init: function() {
|
||||
$('#resetinvoices').on('click', function() {
|
||||
me.storage.invoiceUploadIds = [];
|
||||
$('#shopimporter_amazon_invoice_upload').find(':checked').each(function(){
|
||||
me.storage.invoiceUploadIds.push($(this).data('id'));
|
||||
});
|
||||
if(me.storage.invoiceUploadIds.length > 0) {
|
||||
$.ajax({
|
||||
url: 'index.php?module=onlineshops&action=edit&id='+
|
||||
$('#resetinvoices').data('shopid') +'&cmd=resetinvoiceuploads',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
invoiceUploadIds: me.storage.invoiceUploadIds,
|
||||
},
|
||||
success: function() {
|
||||
$('#shopimporter_amazon_invoice_upload').DataTable().ajax.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
$('#sellectallinvoices').on('change', function(){
|
||||
$('#shopimporter_amazon_invoice_upload').find('input').prop('checked', $(this).prop('checked'));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
init: me.init
|
||||
};
|
||||
|
||||
}(jQuery);
|
||||
|
||||
$(document).ready(function () {
|
||||
ShopImporterAmazon.init();
|
||||
});
|
||||
@@ -0,0 +1,245 @@
|
||||
var ShopImporterAmazonAttachedOffers = function ($) {
|
||||
'use strict';
|
||||
|
||||
var me = {
|
||||
storage: {
|
||||
shopId: null,
|
||||
articleInputValue: null
|
||||
},
|
||||
selector: {
|
||||
attachedOffersTable: '#shopimporter_amazon_attachedoffers',
|
||||
newOfferTable: '#newoffertable',
|
||||
popupAttached: '#popupattatch',
|
||||
popupArticle: '#popuparticle',
|
||||
popupArticleInfo: '#popuparticleinfo',
|
||||
},
|
||||
reloadAttachedOffersTable: function()
|
||||
{
|
||||
$(me.selector.attachedOffersTable).DataTable().ajax.reload();
|
||||
},
|
||||
addEmptyArticleWarning: function() {
|
||||
if($(me.selector.popupArticle).val()+'' === '') {
|
||||
$(me.selector.popupArticleInfo).html('Pflichtfeld!');
|
||||
return true;
|
||||
}
|
||||
$(me.selector.popupArticleInfo).html('');
|
||||
return false;
|
||||
},
|
||||
init: function() {
|
||||
me.storage.shopId = $(me.selector.popupAttached).data('id');
|
||||
$(me.selector.attachedOffersTable).on('afterreload',function(){
|
||||
$('#shopimporter_amazon_attachedoffers img.delete').on('click',function(){
|
||||
if(confirm('Wiklich löschen?')) {
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=attachedoffers&id='+
|
||||
me.storage.shopId +'&cmd=delete',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
element: $(this).data('id')
|
||||
},
|
||||
success: function(data) {
|
||||
me.reloadAttachedOffersTable();
|
||||
},
|
||||
beforeSend: function() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
$(me.selector.popupAttached).dialog(
|
||||
{
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
minWidth: 1440,
|
||||
title:'',
|
||||
buttons: {
|
||||
'ERSTELLEN': function()
|
||||
{
|
||||
if(me.addEmptyArticleWarning()) {
|
||||
return;
|
||||
}
|
||||
$('#frmnewoffer').trigger('submit');
|
||||
},
|
||||
'ABBRECHEN': function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
close: function(event, ui){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#new').on('click',function(){
|
||||
$(me.selector.popupAttached).dialog('open');
|
||||
});
|
||||
|
||||
$(me.selector.popupAttached).on('autocompleteclose',function(){
|
||||
$(me.selector.popupAttached).trigger('change');
|
||||
});
|
||||
$(me.selector.popupAttached).on('autocompletechange',function(){
|
||||
$(me.selector.popupAttached).trigger('change');
|
||||
});
|
||||
$(me.selector.popupArticle).on('change',function(){
|
||||
me.addEmptyArticleWarning();
|
||||
me.storage.articleInputValue = ($(this).val()+'').split(' ') [ 0 ];
|
||||
if(me.storage.articleInputValue === '') {
|
||||
return;
|
||||
}
|
||||
$('input.popupskufba').each(function(){
|
||||
$(this).attr('placeholder', me.storage.articleInputValue+'_'+(this.id.split('_')[ 1 ]).toUpperCase()+'_FBA');
|
||||
});
|
||||
$('input.popupskufbm').each(function(){
|
||||
$(this).attr('placeholder', me.storage.articleInputValue+'_'+(this.id.split('_')[ 1 ]).toUpperCase());
|
||||
});
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=attachedoffers&id='+
|
||||
me.storage.shopId +'&cmd=getean',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
article: $(me.selector.popupArticle).val()
|
||||
},
|
||||
success: function (data) {
|
||||
if(typeof data.ean != 'undefined'
|
||||
&& (
|
||||
$('#popupasin').val()+'' === ''
|
||||
|| data.articleid+'' !== $('#lastarticle').val()+''
|
||||
)
|
||||
) {
|
||||
$('#searchtype').val('EAN');
|
||||
$('#popupasin').val(data.ean);
|
||||
$('#lastean').val(data.ean);
|
||||
$('#lastarticle').val(data.id);
|
||||
$('#searchasin').trigger('click');
|
||||
$('.popuptitle').val('');
|
||||
$('.ownprice').val('');
|
||||
$(me.selector.newOfferTable).find('.trmarketplace').find('select').val('');
|
||||
$(me.selector.newOfferTable).find('.trmarketplace').find('select.condition').val('New');
|
||||
}
|
||||
else {
|
||||
$('#lastean').val('');
|
||||
if(data.articleid+'' !== $('#lastarticle').val()+'') {
|
||||
$('#lastarticle').val(data.articleid);
|
||||
$('#popupasin').val('');
|
||||
$('.popuptitle').val('');
|
||||
$('.ownprice').val('');
|
||||
$(me.selector.newOfferTable).find('.trmarketplace').find('select').val('');
|
||||
$(me.selector.newOfferTable).find('.trmarketplace').find('select.condition').val('New');
|
||||
}
|
||||
if($('#searchtype').val() === 'EAN'
|
||||
&& $('#popupasin').val()+'' === $('#lastean').val()+'') {
|
||||
$('#popupasin').val('');
|
||||
}
|
||||
}
|
||||
if(typeof data.prices != 'undefined') {
|
||||
$.each(data.prices, function (key, value) {
|
||||
if((key+'').length === 2) {
|
||||
$('input[name="price_'+key+'"]').attr('placeholder', value);
|
||||
}
|
||||
})
|
||||
}
|
||||
if(typeof data.articleid != 'undefined') {
|
||||
$('#lastarticle').val(data.articleid);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#popupasin').on('keypress',function(event){
|
||||
if (event.which == 13) {
|
||||
$('#searchasin').trigger('click');
|
||||
}
|
||||
});
|
||||
$('#searchasin').on('click',function(){
|
||||
var asin = $('#popupasin').val();
|
||||
if(asin+'' === '') {
|
||||
return;
|
||||
}
|
||||
$('#searchresultshead').nextAll('tr').remove();
|
||||
$('#searchresultshead').toggleClass('hide', true);
|
||||
$('#searchresultsdiv').loadingOverlay('show');
|
||||
$(me.selector.popupAttached).find('tr.trmarketplace').each(function(){
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=attachedoffers&id='+
|
||||
me.storage.shopId +'&cmd=getOffers',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
asin: $('#popupasin').val(),
|
||||
searchtype: $('#searchtype').val(),
|
||||
marketplace: $(this).data('marketplace')
|
||||
},
|
||||
success: function(data) {
|
||||
$('#searchresultsdiv').loadingOverlay('remove');
|
||||
var $tr = $(me.selector.popupAttached).find('tr.trmarketplace[data-marketplace="'+data.marketplace+'"]');
|
||||
if($tr.length === 0) {
|
||||
return;
|
||||
}
|
||||
if(data.status == 0) {
|
||||
$($tr).hide();
|
||||
$($tr).find('input').val('');
|
||||
$($tr).find('.prices').html('');
|
||||
}
|
||||
else {
|
||||
$($tr).show();
|
||||
$($tr).find('.prices').html(data.prices);
|
||||
$($tr).find('.popuptitle').val(data.title);
|
||||
$($tr).find('.curreny').val(data.currency);
|
||||
}
|
||||
if(typeof data.tr != 'undefined') {
|
||||
$('#searchresultshead').toggleClass('hide', false);
|
||||
$('#searchresultshead').after(data.tr);
|
||||
}
|
||||
$('#searchresults span.childrenasin').off('click');
|
||||
$('#searchresults span.parentasin').off('click');
|
||||
$('#searchresults img.useasin').off('click');
|
||||
$('#searchresults span.childrenasin').on('click', function(){
|
||||
$('#popupasin').val($(this).data('asin'));
|
||||
$('#searchtype').val('ASIN');
|
||||
$('#searchasin').trigger('click');
|
||||
});
|
||||
$('#searchresults span.parentasin').on('click', function(){
|
||||
$('#popupasin').val($(this).data('asin'));
|
||||
$('#searchtype').val('ASIN');
|
||||
$('#searchasin').trigger('click');
|
||||
});
|
||||
$('#searchresults img.useasin').on('click', function(){
|
||||
if($($(this).parents('tr').find('td.asin')).html()+'' != '') {
|
||||
$('#popupasin').val($($(this).parents('tr').find('td.asin')).html()+'');
|
||||
$('#searchtype').val('ASIN');
|
||||
$('#searchasin').trigger('click');
|
||||
return;
|
||||
}
|
||||
var $tr = $('tr.trmarketplace[data-marketplace="'+$(this).data('marketplace')+'"]');
|
||||
if($tr.length) {
|
||||
$($tr).show();
|
||||
$($tr).find('.popuptitle').val($($(this).parents('tr').find('td.title')).html());
|
||||
$($tr).find('.popupasin').val($($(this).parents('tr').find('td.asin')).html());
|
||||
}
|
||||
});
|
||||
if($('#searchtype').val()==='ASIN') {
|
||||
$('input.popupasin').val($('#popupasin').val());
|
||||
}
|
||||
if($(me.selector.popupArticle).val()+'' !== '') {
|
||||
$(me.selector.popupArticle).trigger('change');
|
||||
}
|
||||
},
|
||||
beforeSend: function() {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
init: me.init
|
||||
};
|
||||
|
||||
}(jQuery);
|
||||
|
||||
$(document).ready(function () {
|
||||
ShopImporterAmazonAttachedOffers.init();
|
||||
});
|
||||
@@ -0,0 +1,293 @@
|
||||
var ShopImporterAmazonSendArticles = function ($) {
|
||||
'use strict';
|
||||
|
||||
var me = {
|
||||
storage: {
|
||||
templateTarget: null
|
||||
},
|
||||
selector: {
|
||||
flatFileTable: '#shopimporter_amazon_flatfile',
|
||||
articlePopup: '#getarticlediv',
|
||||
articlePopupForm: '#getarticlefrm',
|
||||
templatePopup: '#popupTemplate',
|
||||
flatFileTemplateInfo: '#flatFileTemplateInfo',
|
||||
deleteIcon: 'img.deletearticle',
|
||||
getIcon: 'img.getarticle'
|
||||
},
|
||||
reloadFlatFileTable: function () {
|
||||
$(me.selector.flatFileTable).DataTable().ajax.reload();
|
||||
},
|
||||
updateAutoComplete: function () {
|
||||
$(me.selector.articlePopupForm + ' input').each(function () {
|
||||
if (typeof this.id != 'undefined') {
|
||||
if (this.id === 'article') {
|
||||
$(this).autocomplete({
|
||||
source: 'index.php?module=ajax&action=filter&filtername=artikelnummer',
|
||||
select: function (event, ui) {
|
||||
var i = ui.item.value;
|
||||
var zahl = i.indexOf(' ');
|
||||
var text = i.slice(0, zahl);
|
||||
$('input#article').val(text);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else if (typeof this.id != 'undefined') {
|
||||
$(this).autocomplete({
|
||||
source: 'index.php?module=ajax&action=filter&filtername=amazongetarticle&flatfile='
|
||||
+ encodeURI($('#flatfile').val())
|
||||
+ '&feedproducttype='
|
||||
+ encodeURI($('#feed_product_type').val())
|
||||
+ '&elementid='
|
||||
+ this.id
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
deleteArticle: function (id) {
|
||||
if (!confirm('Wirklich löschen?')) {
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=sendarticles&cmd=deletearticle',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
article_ids: id
|
||||
},
|
||||
success: function () {
|
||||
me.reloadFlatFileTable();
|
||||
},
|
||||
beforeSend: function () {
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
createImportTemplate: function (template)
|
||||
{
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=sendarticles&cmd=createImportTemplate',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
template: template,
|
||||
},
|
||||
success: function (data) {
|
||||
if(typeof data.id != 'undefined') {
|
||||
$(me.selector.flatFileTemplateInfo).html(
|
||||
'Importvorlage: <a href="index.php?module=importvorlage&action=edit&id='
|
||||
+data.id+'" target="_blank">'+data.bezeichnung+'</a>'
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
createExportTemplate: function (template)
|
||||
{
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=sendarticles&cmd=createExportTemplate',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
template: template,
|
||||
},
|
||||
success: function (data) {
|
||||
if(typeof data.id != 'undefined') {
|
||||
$(me.selector.flatFileTemplateInfo).html(
|
||||
'Exportvorlage: <a href="index.php?module=exportvorlage&action=edit&id='
|
||||
+data.id+'" target="_blank">'+data.bezeichnung+'</a>'
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getArticle: function (id) {
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=sendarticles&cmd=getarticle',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
article_id: id,
|
||||
flatfile_id: $('#flatfile').val(),
|
||||
shopid: $(me.selector.articlePopup).data('shopid')
|
||||
},
|
||||
success: function (data) {
|
||||
$(me.selector.articlePopupForm).html(data.html);
|
||||
me.updateAutoComplete();
|
||||
|
||||
$(me.selector.articlePopupForm + ' input[data-required]').on('change',
|
||||
function () {
|
||||
if (trim($(this).val() + '') === ''
|
||||
&&
|
||||
(typeof $(this).attr('placeholder') == 'undefined'
|
||||
|| trim($(this).attr('placeholder') + '') === '')
|
||||
) {
|
||||
$(this).next('span').remove();
|
||||
$(this).after('<span class="red">Pflichtfeld</span>');
|
||||
} else {
|
||||
$(this).next('span').remove();
|
||||
}
|
||||
}
|
||||
);
|
||||
$('#feed_product_type').on('change', function () {
|
||||
me.updateAutoComplete();
|
||||
});
|
||||
$('#flatarticletabs').tabs();
|
||||
$(me.selector.articlePopupForm + ' input[data-required]').trigger('change');
|
||||
$('img.delprevimage').on('click', function () {
|
||||
$('#' + $(this).data('field')).val('');
|
||||
$('#' + $(this).data('field')).parents('tr').first().find('img.amazonimageprev').attr(
|
||||
'src',
|
||||
'./themes/new/images/keinbild_hell.png'
|
||||
);
|
||||
});
|
||||
$('img.getprevimage').on('click', function () {
|
||||
var val = ($('#amazonimgprevdiv').find(':checked').val()) + '';
|
||||
if (val !== '') {
|
||||
$('#' + $(this).data('field')).val(val);
|
||||
$('#' + $(this).data('field')).parents('tr').first().find('img.amazonimageprev').attr(
|
||||
'src',
|
||||
'index.php?module=ajax&action=thumbnail&cmd=artikel&id=' + val
|
||||
);
|
||||
}
|
||||
});
|
||||
$(me.selector.articlePopup).dialog('open');
|
||||
},
|
||||
beforeSend: function () {
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
openTemplate: function(){
|
||||
me.storage.templateTarget = 'articlePopup';
|
||||
$(me.selector.flatFileTemplateInfo).html('');
|
||||
$(me.selector.templatePopup).dialog('open');
|
||||
},
|
||||
init: function () {
|
||||
if ($(me.selector.articlePopup).length === 0) {
|
||||
return;
|
||||
}
|
||||
$(me.selector.articlePopup).dialog(
|
||||
{
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
minWidth: 1040,
|
||||
title: '',
|
||||
buttons: {
|
||||
'SPEICHERN': function () {
|
||||
$(me.selector.articlePopupForm + ' input[data-required]').trigger('change');
|
||||
if ($(me.selector.articlePopupForm + ' span.red').length
|
||||
&& !confirm('Es sind nicht alle Pflichtfelder ausgewählt wirklich speicher?')) {
|
||||
return;
|
||||
}
|
||||
$(me.selector.articlePopupForm).trigger('submit');
|
||||
},
|
||||
ABBRECHEN: function () {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
close: function (event, ui) {
|
||||
|
||||
}
|
||||
});
|
||||
$(me.selector.templatePopup).dialog({
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
minWidth: 1040,
|
||||
title: '',
|
||||
buttons: {
|
||||
'WEITER': function () {
|
||||
if($('#flatfile').val()+'' !== '') {
|
||||
if(me.storage.templateTarget === 'articlePopup') {
|
||||
$(this).dialog('close');
|
||||
me.getArticle(0);
|
||||
}
|
||||
if(me.storage.templateTarget === 'exportTemplate') {
|
||||
me.createExportTemplate($('#flatfile').val());
|
||||
}
|
||||
if(me.storage.templateTarget === 'importTemplate') {
|
||||
me.createImportTemplate($('#flatfile').val());
|
||||
}
|
||||
}
|
||||
},
|
||||
'ABBRECHEN': function () {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
close: function (event, ui) {
|
||||
|
||||
}
|
||||
});
|
||||
$('#new').on('click', function () {
|
||||
me.openTemplate();
|
||||
});
|
||||
$('#newExportSendArticles').on('click', function (){
|
||||
me.storage.templateTarget = 'exportTemplate';
|
||||
$(me.selector.flatFileTemplateInfo).html('');
|
||||
$(me.selector.templatePopup).dialog('open');
|
||||
});
|
||||
$('#newImportSendArticles').on('click', function (){
|
||||
me.storage.templateTarget = 'importTemplate';
|
||||
$(me.selector.flatFileTemplateInfo).html('');
|
||||
$(me.selector.templatePopup).dialog('open');
|
||||
});
|
||||
$('#send').on('click', function () {
|
||||
var data_ids = '';
|
||||
$(me.selector.flatFileTable + ' input:checked').each(function () {
|
||||
data_ids += ',' + $(this).data('id');
|
||||
});
|
||||
if (data_ids !== '') {
|
||||
if ($('#selaction').val() === 'send') {
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=sendarticles&cmd=sendarticles',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
article_ids: data_ids
|
||||
},
|
||||
success: function (data) {
|
||||
me.reloadFlatFileTable();
|
||||
}
|
||||
});
|
||||
} else if ($('#selaction').val() === 'delete') {
|
||||
if (!confirm('Wirklich löschen?')) {
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: 'index.php?module=shopimporter_amazon&action=sendarticles&cmd=deletearticle',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
article_ids: data_ids
|
||||
},
|
||||
success: function (data) {
|
||||
me.reloadFlatFileTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
alert('Sie haben keine Artikel ausgewählt');
|
||||
}
|
||||
});
|
||||
$(me.selector.flatFileTable).on('afterreload', function () {
|
||||
$(this).find(me.selector.getIcon).off('click');
|
||||
$(this).find(me.selector.deleteIcon).off('click');
|
||||
$(this).find(me.selector.getIcon).on('click', function () {
|
||||
me.getArticle($(this).data('id'));
|
||||
});
|
||||
$(this).find(me.selector.deleteIcon).on('click', function () {
|
||||
me.deleteArticle($(this).data('id'));
|
||||
});
|
||||
});
|
||||
$(me.selector.flatFileTable).trigger('afterreload');
|
||||
}
|
||||
};
|
||||
return {
|
||||
init: me.init
|
||||
};
|
||||
|
||||
}(jQuery);
|
||||
|
||||
$(document).ready(function () {
|
||||
ShopImporterAmazonSendArticles.init();
|
||||
});
|
||||
Reference in New Issue
Block a user