var prdszchrt_ur115_20X = 'index.php?route=module/prdszchrt/';
var prdszchrt_url23X_30X = 'index.php?route=extension/module/prdszchrt/';
var prdszchrt_url401X = 'index.php?route=extension/prdszchrt/module/prdszchrt|';
var prdszchrt_url402X = 'index.php?route=extension/prdszchrt/module/prdszchrt.';

var prdszchrt = {
	'setpophtml': function(prdszchrt_id, title, htmldata) {		
		var pophtml = '<div class="pop pop-5" id="prdszchrt_Modal'+prdszchrt_id+'" ><div class="pop__cont"><svg class="pop-close" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.6924 7.79254C18.1025 7.38247 18.1025 6.71762 17.6924 6.30755C17.2824 5.89748 16.6175 5.89748 16.2075 6.30755L12 10.515L7.79255 6.30755C7.38248 5.89748 6.71763 5.89748 6.30756 6.30755C5.8975 6.71762 5.8975 7.38247 6.30756 7.79254L10.515 12L6.30755 16.2075C5.89748 16.6175 5.89748 17.2824 6.30755 17.6924C6.71762 18.1025 7.38247 18.1025 7.79254 17.6924L12 13.485L16.2075 17.6924C16.6175 18.1025 17.2824 18.1025 17.6925 17.6924C18.1025 17.2824 18.1025 16.6175 17.6925 16.2075L13.485 12L17.6924 7.79254Z" fill="#58595B"></path></svg><div class="pop-title h2">'+title+'</div>';
		pophtml += '<div class="pop__table table-sizes">'+htmldata+'</div>';
		pophtml += '<div class="pop__cont-bg"><img src="/assets/img/23.png" alt=""><img src="/assets/img/23.png" alt=""></div></div><div class="pop-bg"></div></div>';
		$('body').append(pophtml);
	},
	'prodpage': function() {
		var product_id = false;
		
		if($(".button-group-page input[name='product_id']").length) {
			product_id = $(".button-group-page input[name='product_id']").val();
		} else if($('#input-product-id').length) {
			product_id = $('#input-product-id').val();
		} else if($(".product-info input[name='product_id']").length) {
			product_id = $(".product-info input[name='product_id']").val();
		} else if($("#product input[name='product_id']").length) {
			product_id = $("#product input[name='product_id']").val();
		}

		if (product_id) {
			$.ajax({
				url: prdszchrt_url23X_30X + 'getcache',
				type: 'post',
				data: {product_id:product_id},
				cache: true,
				success: function(json) {
					if(json) {
						console.log(json)
						$.each( json, function( prdszchrt_id, rsval ) {
							prdszchrt.setpophtml(prdszchrt_id, rsval['sztitle'], rsval['szcontent']);
						});
					}
				}
			});
		}
	},
	'initjson': function() {
		prdszchrt.prodpage();
	}
}
$(document).ready(function() {
	prdszchrt.initjson();
});