-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathc1b291cb852.tpl
executable file
·79 lines (72 loc) · 2.13 KB
/
c1b291cb852.tpl
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
{if $enable === 1}
<link href="{$base_dir}modules/c1b291cb852/color-picker2.css" rel="stylesheet">
<script src="{$base_dir}modules/c1b291cb852/Sortable.min.js"></script>
<div class='c1-main-container'>
<div class='c1-available-colors'>
<ul id='c1-color-list'>
</ul>
</div>
<div class='c1-chosen-colors'>
<h4 id='c1-chosen-list-title'></h4>
<ul id='c1-chosen-list'>
</ul>
<ul id='c1-trash-list'>
<li class="c1-li-title"></li>
</ul>
</div>
<br style='clear: both'>
</div>
<script src="{$base_dir}modules/c1b291cb852/color-picker.js"></script>
<script src="{$base_dir}modules/c1b291cb852/spectrum.js"></script>
<script>
// qweqwe
// chosen color list title when empty/filled list
var colorListTitleEmpty = '{l s='Choose colors' mod='c1b291cb852'}';
var colorListTitleFilled = '{l s='Your colors:' mod='c1b291cb852'}';
{literal}
var C1 = {
dir: baseDir,
qtyObject: {},
product: {
{/literal}
id: {$product->id},
price: ({$product->price}*1.23).toFixed(2)
{literal}
}
};
(function(){
var createColors = function(){
{/literal}
{foreach from=$combinations key=id item=combination}
{if strpos($combination.group_name, "Color") !== false && $combination.quantity > 0}
new Color(
'{$combination.id_product_attribute}',
'{$combination.attribute_name}',
'{$combination.color_value}',
parseFloat({$combination.price}*1.23).toFixed(2),
C1.qtyObject['{$combination.attribute_name}'] || 0
);
{/if}
{/foreach}
{literal}
};
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: baseUri + '?rand=' + new Date().getTime(),
async: true,
cache: false,
dataType : "json",
data: 'controller=cart&ajax=true&token=' + static_token,
success: function(jsonData)
{
jsonData.products.forEach(function(product){
C1.qtyObject[product.attributes] = product.quantity;
});
createColors();
}
});
})();
{/literal}
</script>
{/if}