This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
kiala-1-4.js
89 lines (81 loc) · 1.8 KB
/
kiala-1-4.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* PrestaShop 1.4.x compatibility file
*/
function displayKialaPoint(content)
{
$('#kiala').remove();
$('#id_carrier' + KIALA_ID_CARRIER).parents('tr').after(content);
}
$('input[name=id_carrier]').change(function(event)
{
if ($(this).val() == KIALA_ID_CARRIER)
getKialaPoint();
else
displayKialaPoint('');
if (!IS_OPC)
updateCarrierInCart($(this).val());
});
function getKialaPoint()
{
$.ajax(
{
type: 'POST',
url: KIALA_MODULE_DIR + 'ajax.php',
data: {'token' : KIALA_TOKEN,
'page_name' : PAGE_NAME},
success: function(html)
{
displayKialaPoint(html);
},
error: function(xhr, ajaxOptions, thrownError)
{
//@TODO display error tpl with displaykialapoint()
//console.log(thrownError);
// Put debug to see error detail
}
});
}
function updateCarrierInCart(id_carrier)
{
$.ajax(
{
type: 'POST',
url: KIALA_MODULE_DIR + 'ajax.php',
data: {'token' : KIALA_TOKEN,
'id_carrier' : id_carrier},
error: function(xhr, ajaxOptions, thrownError)
{
//console.log(thrownError);
// Put debug to see error detail
}
});
}
$(document).ready(function()
{
$('#search_link').live('click', function(event)
{
displayKialaPoint(
"<iframe src="+this.href+" width='540px' height='400px'>"
+"<p>Your browser does not support iframes.</p>"
+"</iframe>");
/*$.fancybox(this.href
,
{
//'autoDimensions' : true,
'width' : 550,
'height' : 400,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
'onComplete' : function()
{
// Rewrite some css properties of Fancybox
$('#fancybox-wrap').css('width', '');
$('#fancybox-content').css('background-color', '');
$('#fancybox-content').css('border', '');
}
})
;*/
event.preventDefault();
});
});