Files
interblue.pl/modules/fsadvancedurl/views/js/front-1.7.4.0.js
2024-10-25 14:16:28 +02:00

52 lines
1.7 KiB
JavaScript

/**
* 2019 ModuleFactory.co
*
* @author ModuleFactory.co <info@modulefactory.co>
* @copyright 2019 ModuleFactory.co
* @license ModuleFactory.co Commercial License
*/
var FSAU = FSAU || { };
$(document).ready(function(){
if (window.location.hash) {
var refresh_params = false;
for (var anchor in FSAU.product_urls) {
if (anchor === window.location.hash) {
console.log(anchor);
if (!FSAU.product_urls.hasOwnProperty(anchor)) {
continue;
}
refresh_params = FSAU.product_urls[anchor];
}
}
if (refresh_params) {
for (var i in refresh_params) {
if (!refresh_params.hasOwnProperty(i)) {
continue;
}
var param_group = refresh_params[i].group;
var param_value = refresh_params[i].value;
var name_selector = 'group['+param_group+']';
var input_type = $('input[name=\''+name_selector+'\']').attr('type');
if (input_type === undefined) {
input_type = 'select';
}
if (input_type === 'select') {
$('#group_'+param_group).val(param_value);
}
if (input_type === 'radio') {
$('input[name=\''+name_selector+'\']').prop('checked', '');
$('input[name=\''+name_selector+'\'][value=\''+param_value+'\']').prop('checked', 'checked');
}
}
prestashop.emit('updateProduct', { eventType: 'updatedProductCombination', event: null });
}
}
});