-
Notifications
You must be signed in to change notification settings - Fork 12
/
e_header.php
99 lines (74 loc) · 2.1 KB
/
e_header.php
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
90
91
92
93
94
95
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
if(deftrue('USER_AREA'))
{
// prevents inclusion of JS/CSS/meta in the admin area.
e107::css('vstore', 'vstore.css');
e107::js('vstore', 'js/vstore.js');
e107::lan('vstore', false, true); // e107_plugins/vstore/languages/English_front.php
$vstore_prefs = e107::pref('vstore');
e107::js('settings', array('vstore' => array(
'url' => e107::url('vstore', 'index'),
'cart' => array(
'url' => e107::url('vstore', 'cart'),
'addtocart' => LAN_VSTORE_001, // 'Add to cart',
'outofstock' => empty($vstore_prefs['caption_outofstock'][e_LANGUAGE])
? 'Out of stock'
: $vstore_prefs['caption_outofstock'][e_LANGUAGE],
'available' => 'In stock',
),
'ImageZoom' => array('url' => '')
)
));
if(!empty($vstore_prefs['custom_css']))
{
// Add any custom css to the page
e107::css('inline', "
/* vstore custom css */
" . $vstore_prefs['custom_css']);
}
}
// TODO move this into vstore.class.php as a static method.
if(!class_exists('vstore_cart_icon'))
{
class vstore_cart_icon
{
function __construct()
{
// require_once(e_PLUGIN.'vstore/vstore.class.php');
if(e_ADMIN_AREA !== true)
{
$vst = e107::getSingleton('vstore', e_PLUGIN . 'vstore/vstore.class.php');
$data = $vst->getCartData();
//$count = count($data);
// Sum up cart quantity for badge instead of only number of different products (items)
$count = 0;
if($data && count($data))
{
foreach($data as $row)
{
$count += $row['cart_qty'];
}
}
}
else
{
$count = 5;
}
$style = empty($count) ? '' : "class='active'";
$text = '<span id="vstore-cart-icon" ' . $style . '>' . e107::getParser()->toGlyph("fa-shopping-cart") . '<span class="badge">' . $count . '</span></span>';
if(!defined('LAN_PLUGIN_VSTORE_CARTICON'))
{
define('LAN_PLUGIN_VSTORE_CARTICON', $text);
}
}
}
}
new vstore_cart_icon;