Add new templates and update existing ones for An Home Products module

- Created new index.php files for various directories to establish structure.
- Added form.tpl and index.php for form helpers to enhance form handling.
- Introduced suggestions.tpl and top.tpl for improved admin interface.
- Implemented ajax-products.tpl and banners.tpl for front-end product display.
- Developed content.tpl and widget-blocks.tpl for dynamic content rendering.
- Enhanced widget-tabs.tpl and widget-wrapper.tpl for better tabbed navigation.
- Included necessary licensing information in all new files.
This commit is contained in:
2025-05-16 14:21:29 +02:00
parent b65352c452
commit 64bcc1a6be
140 changed files with 5459 additions and 7457 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,80 @@
/**
* 2023 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2023 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
(function ($, window, undefined) {
'use strict';
function anproducts(wrapProductsClass) {
var classProductLine = $(wrapProductsClass).attr('data-classProductLine');
var classProductRemove = $(wrapProductsClass).attr('data-classProductRemove');
var classInputName = $(wrapProductsClass).attr('data-inputName');
var classSarchInput = $(wrapProductsClass).attr('data-classSarchInput');
var loc = location.pathname.split('/');
loc.pop();
var ajax_get_products = function (q) {
return $.get($(wrapProductsClass).attr('data-searchProdutsController')+'&q='+q);
};
var promise = $.when();
var ptreeinput = $('.'+classSarchInput).closest('.form-group');
ptreeinput.children('div').append($('<ul id="an_field_search_products_ajax-product-list" class="an_field_search_ajax_product_list"></ul>'));
$('#an_field_search_products_ajax-product-list').on('click', 'li', function () {
var name = $(this).find('.label').html();
var img = $(this).find('img').attr('src');
var id = $(this).data('id');
$(wrapProductsClass).append('<div class="'+classProductLine+'"><input type="hidden" name="'+classInputName+'" value="'+id+'" /><div class="js-an_field_search-line-number an-hp-hide">'+($(".js-an_productfields_products .js-an_field_search-line").length+1)+'</div><div class="label"><i class="js-anSearchProductsList-more_vert material-icons more_vert">more_vert</i>'+name+' <i class="material-icons delete '+classProductRemove+'">delete</i></div></div>');
$('.'+classSarchInput).val('');
$('#an_field_search_products_ajax-product-list').html('');
});
$('.'+classSarchInput).on('keyup', function () {
var q = $(this).val();
(function (value) {
promise = promise.then(function () {
return ajax_get_products(q);
}).then(function (response) {
if (!response) {
return false;
}
(function (products) {
ptreeinput.find('#an_field_search_products_ajax-product-list').html('');
$.each(products, function (i, product) {
ptreeinput.find('#an_field_search_products_ajax-product-list').append($('' +
'<li data-id="'+product.id+'">' +
// '<img src="'+product.image+'">' +
'<div class="label">'+product.name+'' + '</div>' +
'</li>').on('click', function () {
}));
});
})(JSON.parse(response));
});
})(q);
});
};
$(document).ready(function() {
var wrapProductsClass = '.js-an_productfields_products'; // It need to edit
anproducts(wrapProductsClass);
$(document).on('click', '.js-an_field_search_products-remove', function(){
$(this).closest('.js-an_field_search-line').remove();
});
});
})(jQuery, window);

View File

@@ -0,0 +1,59 @@
/**
* 2022 Anvanto
*
* NOTICE OF LICENSE
*
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2022 Anvanto
* @license Valid for 1 website (or project) for each purchase of license
* International Registered Trademark & Property of Anvanto
*/
(function ($, window, undefined) {
'use strict';
function showHideFields(){
var viewType = $('.an-hp-block-type input:checked').val();
$('.js-hp-block-categories').hide();
$('.js-hp-block-category').hide();
$('.js-hp-block-show_sub_cat').hide();
$('.js-hp-block-show_sort').show();
$('.js-an_productfields-search-group').hide();
if (viewType == 'categories'){
$('.js-hp-block-categories').show();
$('.js-hp-block-show_sort').hide();
}
if (viewType == 'category'){
$('.js-hp-block-category').show();
$('.js-hp-block-show_sub_cat').show();
}
if (viewType == 'best-sales'){
$('.js-hp-block-show_sort').hide();
}
if (viewType == 'products'){
$('.js-hp-block-show_sort').hide();
$('.js-an_productfields-search-group').show();
}
}
$(document).ready(function () {
showHideFields();
$('.an-hp-block-type input').on('click', function(){
showHideFields();
});
});
})(jQuery, window);

View File

@@ -0,0 +1,41 @@
/**
* 2022 Anvanto
*
* NOTICE OF LICENSE
*
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2022 Anvanto
* @license Valid for 1 website (or project) for each purchase of license
* International Registered Trademark & Property of Anvanto
*/
(function ($, window, undefined) {
'use strict';
function showHideFields(){
var slider = $('input[name=an_hp_slider]:checked').val();
$('.js-hp-setting-load_more').hide();
$('.js-hp-setting-slider-option').hide();
if (slider == '0'){
$('.js-hp-setting-load_more').show();
} else {
$('.js-hp-setting-slider-option').show();
}
}
$(document).ready(function () {
showHideFields();
$('input[name=an_hp_slider]').on('click', function(){
showHideFields();
});
});
})(jQuery, window);

View File

@@ -0,0 +1,143 @@
/**
* 2021 Anvanto
*
* NOTICE OF LICENSE
*
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2021 Anvanto
* @license Valid for 1 website (or project) for each purchase of license
* International Registered Trademark & Property of Anvanto
*/
(function ($, window, undefined) {
'use strict';
$(document).on('click','.js-an_homeproducts-tab', function() {
var self = this;
if(!$(self).hasClass('tab-loaded')) {
getData(
$('.js-an_homeproducts').attr('data-url'),
$(self).attr('data-block-id'),
1,
'',
'tab',
function(data){
$(self).closest('.js-an_homeproducts').find('.js-an_homeproducts-container').append(data.products);
$(self).addClass('tab-loaded');
if (!$('.js-an_homeproducts-content[data-block-id='+$(self).attr('data-block-id')+']').find('.products').hasClass('owl-loaded')) {
$('.js-an_homeproducts-content[data-block-id='+$(self).attr('data-block-id')+']').find('.products').addClass('owl-carousel');
if (typeof anhp_slider_init === "function") {
anhp_slider_init($('.js-an_homeproducts-content[data-block-id='+$(self).attr('data-block-id')+']'));
}
}
$('.js-an_homeproducts-tab, .js-an_homeproducts-content').removeClass('active');
$(self).addClass('active');
$('.js-an_homeproducts-content[data-block-id='+$(self).attr('data-block-id')+']').addClass('active');
},
);
} else {
$('.js-an_homeproducts-tab, .js-an_homeproducts-content').removeClass('active');
$(self).addClass('active');
$('.js-an_homeproducts-content[data-block-id='+$(self).attr('data-block-id')+']').addClass('active');
}
});
$(document).on('click','.js-an_homeproducts-category', function() {
var self = this;
getData(
$('.js-an_homeproducts').attr('data-url'),
$(self).closest('.js-an_homeproducts-content').attr('data-block-id'),
1, // page
$(self).val(), // sort
'sort',
function(data){
$(self).siblings('.js-an_homeproducts-category').removeClass('active');
$(self).addClass('active');
$(self).closest('.js-an_homeproducts-content').find('.products').html(data.products);
if (typeof anhp_slider_init === "function") {
anhp_slider_init($('.js-an_homeproducts-content[data-block-id='+$(self).attr('data-block-id')+']'));
}
},
$(this).attr('data-cat')
);
});
$(document).on('change','.js-an_homeproducts-sort', function() {
var self = this;
getData(
$('.js-an_homeproducts').attr('data-url'),
$(self).closest('.js-an_homeproducts-content').attr('data-block-id'),
1, // page
$(self).val(), // sort
'sort',
function(data){
$(self).closest('.js-an_homeproducts-content').find('.products').html(data.products);
if (typeof anhp_slider_init === "function") {
anhp_slider_init($('.js-an_homeproducts-content[data-block-id='+$(self).attr('data-block-id')+']'));
}
},
$('.js-an_homeproducts-category.active').attr('data-cat')
);
});
$(document).on('click','.js-an_homeproducts-loadmore', function() {
var self = this;
$(self).append('<div class="js-anhp-loader anhp-loader"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background-image: none; display: block; shape-rendering: auto; animation-play-state: running; animation-delay: 0s; background-position: initial initial; background-repeat: initial initial;" width="254px" height="254px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><path fill="none" stroke="#1d0e0b" stroke-width="3" stroke-dasharray="42.76482137044271 42.76482137044271" d="M24.3 30C11.4 30 5 43.3 5 50s6.4 20 19.3 20c19.3 0 32.1-40 51.4-40 C88.6 30 95 43.3 95 50s-6.4 20-19.3 20C56.4 70 43.6 30 24.3 30z" stroke-linecap="round" style="transform: scale(0.22); transform-origin: 50px 50px; animation-play-state: running; animation-delay: 0s;"> <animate attributeName="stroke-dashoffset" repeatCount="indefinite" dur="1s" keyTimes="0;1" values="0;256.58892822265625" style="animation-play-state: running; animation-delay: 0s;"></animate></path></svg></div>');
getData(
$('.js-an_homeproducts').attr('data-url'),
$(self).closest('.js-an_homeproducts-content').attr('data-block-id'),
$(self).attr('data-page'),
$(self).closest('.js-an_homeproducts-content').find('.js-an_homeproducts-sort').val(),
'loadMore',
function(data){
if (data.products){
$(self).closest('.js-an_homeproducts-content').find('.products').append(data.products);
$(self).attr('data-page', parseInt($(self).attr('data-page')) + 1);
if (data.productsNextPage < 1) {
$(self).hide();
}
} else {
$(self).hide();
}
},
);
});
function getData(url, blockId, page, sort, type, callback, idCategory = false){
let hpContainer;
if ($('.js-an_homeproducts').hasClass('an_homeproducts-type-tabs')) {
hpContainer = $('.js-an_homeproducts-container');
} else {
hpContainer = $('.js-an_homeproducts-content[data-block-id='+blockId+']');
}
hpContainer.append('<div class="js-anhp-loader anhp-loader"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background-image: none; display: block; shape-rendering: auto; animation-play-state: running; animation-delay: 0s; background-position: initial initial; background-repeat: initial initial;" width="254px" height="254px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><path fill="none" stroke="#1d0e0b" stroke-width="3" stroke-dasharray="42.76482137044271 42.76482137044271" d="M24.3 30C11.4 30 5 43.3 5 50s6.4 20 19.3 20c19.3 0 32.1-40 51.4-40 C88.6 30 95 43.3 95 50s-6.4 20-19.3 20C56.4 70 43.6 30 24.3 30z" stroke-linecap="round" style="transform: scale(0.22); transform-origin: 50px 50px; animation-play-state: running; animation-delay: 0s;"> <animate attributeName="stroke-dashoffset" repeatCount="indefinite" dur="1s" keyTimes="0;1" values="0;256.58892822265625" style="animation-play-state: running; animation-delay: 0s;"></animate></path></svg></div>');
$.ajax({
type: "POST",
url: url,
data: { action: "getProducts", blockId: blockId, page: page, sort: sort, type: type, idCategory: idCategory },
dataType: 'json',
}).done(function(data){
callback(data);
}).always(function() {
hpContainer.find('.js-anhp-loader').remove();
});
}
})(jQuery, window);

View File

@@ -0,0 +1,137 @@
/**
* 2022 Anvanto
*
* NOTICE OF LICENSE
*
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2022 Anvanto
* @license Valid for 1 website (or project) for each purchase of license
* International Registered Trademark & Property of Anvanto
*/
(function ($, window, undefined) {
'use strict';
})(jQuery, window);
function anhp_slider_init(slider_id) {
$('.an_homeproducts-slider .js-an_homeproducts-content .products').each(function(i, val) {
var slider_id = '.js-an_homeproducts-content[data-block-id=' + $(this).parents('.js-an_homeproducts-content').data('block-id') + ']';
let responsive_items;
if ($(slider_id).data('items') == 4) {
responsive_items = {
0: {
items: 1
},
240: {
items: 1
},
380: {
margin: 30,
items: 2
},
720: {
margin: 30,
items: 3
},
960: {
margin: 30,
items: $(slider_id).data('items')
}
}
}
if ($(slider_id).data('items') == 5) {
responsive_items = {
0: {
items: 1
},
240: {
items: 1
},
380: {
margin: 30,
items: 2
},
720: {
margin: 30,
items: 3
},
960: {
margin: 30,
items: 4
},
1200: {
margin: 30,
items: $(slider_id).data('items')
}
}
}
if ($(slider_id).data('items') == 6) {
responsive_items = {
0: {
items: 1
},
240: {
items: 1
},
400: {
items: 2
},
600: {
margin: 5,
items: 4
},
800: {
margin: 5,
items: 4
},
1000: {
margin: 5,
items: 5
},
1200: {
margin: 5,
items: $(slider_id).data('items')
}
}
}
//$('.js-an_homeproducts-container').append('<div class="js-anhp-loader anhp-loader"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background-image: none; display: block; shape-rendering: auto; animation-play-state: running; animation-delay: 0s; background-position: initial initial; background-repeat: initial initial;" width="254px" height="254px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><path fill="none" stroke="#1d0e0b" stroke-width="3" stroke-dasharray="42.76482137044271 42.76482137044271" d="M24.3 30C11.4 30 5 43.3 5 50s6.4 20 19.3 20c19.3 0 32.1-40 51.4-40 C88.6 30 95 43.3 95 50s-6.4 20-19.3 20C56.4 70 43.6 30 24.3 30z" stroke-linecap="round" style="transform: scale(0.22); transform-origin: 50px 50px; animation-play-state: running; animation-delay: 0s;"> <animate attributeName="stroke-dashoffset" repeatCount="indefinite" dur="1s" keyTimes="0;1" values="0;256.58892822265625" style="animation-play-state: running; animation-delay: 0s;"></animate></path></svg></div>');
$(slider_id).find('.owl-carousel').trigger('destroy.owl.carousel');
$(slider_id).find('.owl-carousel').owlCarouselAnBS({
loop: $(slider_id).data('loop'),
nav: $(slider_id).data('nav'),
dots: $(slider_id).data('dots'),
rows: 1,
autoplay: 0,
navText: ['<svg \n' +
' xmlns="http://www.w3.org/2000/svg"\n' +
' xmlns:xlink="http://www.w3.org/1999/xlink"\n' +
' width="6px" height="8px">\n' +
'<path fill-rule="evenodd" fill="rgb(134, 134, 134)"\n' +
' d="M0.517,3.870 L5.546,7.351 L5.546,0.389 L0.517,3.870 Z"/>\n' +
'</svg>','<svg \n' +
' xmlns="http://www.w3.org/2000/svg"\n' +
' xmlns:xlink="http://www.w3.org/1999/xlink"\n' +
' width="6px" height="8px">\n' +
'<path fill-rule="evenodd" fill="rgb(134, 134, 134)"\n' +
' d="M5.483,3.870 L0.454,7.351 L0.454,0.389 L5.483,3.870 Z"/>\n' +
'</svg>'],
autoplayTimeout: 5000,
responsive: responsive_items,
//onChanged: anhp_slider_loaded(),
});
});
}
/*
function anhp_slider_loaded() {
$('.js-an_homeproducts-container').find('.js-anhp-loader').remove();
}
*/
$(document).ready(function(){
$('.an_homeproducts-slider .js-an_homeproducts-content').find('.products').addClass('owl-carousel');
anhp_slider_init($('.an_homeproducts-slider .js-an_homeproducts-content[data-block-id='+1+']'));
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
/**
* 2022 Anvanto
*
* NOTICE OF LICENSE
*
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2022 Anvanto
* @license Valid for 1 website (or project) for each purchase of license
* International Registered Trademark & Property of Anvanto
*/
! function(t) {
"use strict";
t(document).ready(function() {
var e = t(".js-an_productfields_products")[0];
return "undefined" != typeof e && void new Sortable(e, {
group: "name",
sort: !0,
handle: '.js-anSearchProductsList-more_vert',
delay: 0,
disabled: !1,
draggable: ".js-an_field_search-line",
store: null,
animation: 150
})
})
}(jQuery);