Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbf01834f8 | ||
|
|
4250fddbe4 | ||
|
|
b1e130854f | ||
|
|
cd5a54afd1 | ||
|
|
756f1aa10e | ||
|
|
ca80cbc4b1 | ||
|
|
87af65d2e2 | ||
|
|
6b24f5203d | ||
|
|
3259b70a3c | ||
|
|
4815e5d2f5 | ||
|
|
9039939c7d | ||
|
|
b6515eaa17 | ||
|
|
5900ba8d1c | ||
|
|
04be7149e5 | ||
|
|
0d50493737 | ||
|
|
6ea5d45b39 | ||
|
|
0b374458ec | ||
|
|
88823dc5eb | ||
|
|
c72240fb9f | ||
|
|
b7baa30c6c | ||
|
|
d7eba5476f | ||
|
|
fa8e87432a | ||
|
|
0cca874c81 | ||
|
|
af786b1e0a | ||
|
|
ccec86cb0b | ||
|
|
18e8b087d3 | ||
|
|
0817e3bc08 | ||
|
|
b76c949926 | ||
|
|
18c576ff5b | ||
|
|
3e76816edb | ||
|
|
3b6b4c174c | ||
|
|
54b631fc78 | ||
|
|
4efb673969 | ||
|
|
d69c97f145 | ||
|
|
a8263ee9ad | ||
|
|
2c960d9bee | ||
|
|
747cfd729b | ||
|
|
e8ad797150 | ||
|
|
49c1f7e870 | ||
|
|
ae58669d4a | ||
|
|
13f0dc7403 | ||
|
|
2107741896 | ||
|
|
c4c69c3aee | ||
|
|
0ffbb332c5 | ||
|
|
e0a39bed57 | ||
|
|
98f5c3629a | ||
|
|
34428a7dab | ||
|
|
f9258b8779 | ||
|
|
c8d1619d0a | ||
|
|
77a78537e7 | ||
|
|
4bdeb8dce7 | ||
|
|
1728cd923b | ||
|
|
96bf42e183 | ||
|
|
90a3cc6a45 | ||
|
|
7149dacb74 | ||
|
|
a30d9539a2 | ||
|
|
f8117d50ce | ||
|
|
22d1771142 | ||
|
|
793cdb720c | ||
|
|
8d8593d3de | ||
|
|
9158cadf6c | ||
|
|
2366a2cc8a | ||
|
|
100703b2f8 | ||
|
|
24421b248f | ||
|
|
7767a81011 | ||
|
|
a920359f1d | ||
|
|
66dc8389dd | ||
|
|
218236c1ee | ||
|
|
f0c11404bb | ||
|
|
e930b5d08f | ||
|
|
0f56795f2f | ||
|
|
ea35da0a1a | ||
|
|
fce1d9a60d | ||
|
|
f4d03c95db | ||
|
|
a22276d161 | ||
|
|
d16dfdab01 | ||
|
|
62c3e09cc6 | ||
|
|
b37a36eba5 | ||
|
|
58f7fb1c03 | ||
|
|
cd14749055 | ||
|
|
656f87440d | ||
|
|
b57854c3da | ||
|
|
22d4e61e54 | ||
|
|
2ce01cc89e | ||
|
|
78a39a3fbc | ||
|
|
8f2f4b3be4 | ||
|
|
121d9abc2c | ||
|
|
ee34eeab59 | ||
|
|
7c9d4ee5db | ||
|
|
d62949ed65 | ||
|
|
356348f90a | ||
|
|
a3f9f55291 | ||
|
|
aebc243b87 | ||
|
|
c45bbc958c | ||
|
|
1384d579d4 | ||
|
|
57ff2be0e5 | ||
|
|
116221b382 | ||
|
|
0835613ee2 | ||
|
|
f07f7712af | ||
|
|
7fca32e3dc | ||
|
|
13b93ddaef | ||
|
|
db081565c3 | ||
|
|
0a30c492fd | ||
|
|
bca8b9d275 | ||
|
|
6e027b2d19 | ||
|
|
26624d9f2f | ||
|
|
02fac949bf | ||
|
|
ae796bedfa | ||
|
|
b51a097ae0 | ||
|
|
9e54583319 | ||
|
|
d3529c7d73 | ||
|
|
a1d01b0986 | ||
|
|
f03879cdf2 | ||
|
|
d30f381961 | ||
|
|
57dcc5b694 | ||
|
|
e056653fed | ||
|
|
ad4c7dec2b | ||
|
|
f782f88006 | ||
|
|
bd28cc6e4b | ||
|
|
9665448bd2 | ||
|
|
ff0bdb5532 | ||
|
|
6b62f6c3ed | ||
|
|
34c85b6114 | ||
|
|
8b459e499e | ||
|
|
a90af8cd44 | ||
|
|
7eec6c7294 | ||
|
|
acb7dd35ed | ||
|
|
691d6b3851 | ||
|
|
785834c4e1 | ||
|
|
f2233e08d0 | ||
|
|
096bc90802 | ||
|
|
412cae1d51 | ||
|
|
63737a93ec | ||
|
|
14615f68cf | ||
|
|
6a8af608ed | ||
|
|
7e2e5caf20 | ||
|
|
d2a11f04a4 | ||
|
|
87bd54df2d | ||
|
|
8fce66e370 | ||
|
|
eb398f1a9f | ||
|
|
9db5f5729a | ||
|
|
d6df4781c5 | ||
|
|
a4c8e9823f | ||
|
|
66757871af | ||
|
|
9986903af7 | ||
|
|
da117efe58 | ||
|
|
6a5d3f8e0e | ||
|
|
27780c81b4 | ||
|
|
791b15dc07 | ||
|
|
a33e23e100 | ||
|
|
a32bd610ab | ||
|
|
fdcd40e055 | ||
|
|
4f2683dfa6 | ||
|
|
cc0dd39784 | ||
|
|
f9dac67c18 | ||
|
|
fe2542ef07 | ||
|
|
39d14f3713 | ||
|
|
c766c393a1 | ||
|
|
4f9c604d33 | ||
|
|
ce5109ea1d | ||
|
|
4c5328f03d | ||
|
|
00ae6f21d9 | ||
|
|
9273c14e87 | ||
|
|
4e39c6d41e | ||
|
|
863e540c0d | ||
|
|
988f0480eb | ||
|
|
c17d577131 | ||
|
|
63a11e0bb4 | ||
|
|
cfb8b89481 | ||
|
|
3ce1a5e5d9 | ||
|
|
ace372812d | ||
|
|
b519556a62 | ||
|
|
bb704d1550 | ||
|
|
b269ebe1a9 | ||
|
|
f01147ebd8 | ||
|
|
b8184785d1 | ||
|
|
0c0fa767b5 | ||
|
|
4ec108f632 | ||
|
|
fb4b137f65 | ||
|
|
723320062b | ||
|
|
e6b13787f3 | ||
|
|
810692e577 | ||
|
|
8c991aea82 | ||
|
|
d084167163 | ||
|
|
29ec710ed1 | ||
|
|
d94785b76a | ||
|
|
23a13e7121 | ||
|
|
d7bd6c7181 | ||
|
|
b87f534566 | ||
|
|
b2ba507b03 | ||
|
|
506117423f | ||
|
|
26c3e81764 | ||
|
|
7a20095102 | ||
|
|
e6cdcfd266 | ||
|
|
303bfdd00c | ||
|
|
a606873630 | ||
|
|
09cb7eff9b | ||
|
|
7a54d4b647 | ||
|
|
78db02cafb | ||
|
|
ba1e9b59e5 | ||
|
|
31bc0a7867 | ||
|
|
367496bfe8 | ||
|
|
ff27b55c3a | ||
|
|
1effa0b026 | ||
|
|
951a6ba171 | ||
|
|
8fbd0cc439 | ||
|
|
fe99abfc57 | ||
|
|
30ea30c6f4 | ||
|
|
d5dfb4cfdb | ||
|
|
758a0cead8 | ||
|
|
a711041580 | ||
|
|
4e3dbfb5cb | ||
|
|
f691d01bce | ||
|
|
e1c0bcf502 | ||
|
|
17285402c3 | ||
|
|
cd815caaed | ||
|
|
93a3b6f617 | ||
|
|
75a19e7e26 | ||
|
|
84941bc9a3 | ||
|
|
248efe091c | ||
|
|
7828d5990c | ||
|
|
8dbc25825e | ||
|
|
f7ffb002df | ||
|
|
cab8b2b251 | ||
|
|
681302369f | ||
|
|
ad370ee93c | ||
|
|
d2cfbf4c88 | ||
|
|
6ecc41aef2 | ||
|
|
15d23c2bef | ||
|
|
0dacaa5802 | ||
|
|
2cd8a77b6c | ||
|
|
d29a1efd19 | ||
|
|
c7fe97d5d3 | ||
|
|
b572d67367 | ||
|
|
bb73414e79 | ||
|
|
3a72ee0d5d | ||
|
|
6c39413878 | ||
|
|
a342ee66f2 | ||
|
|
e832255c15 | ||
|
|
0992092a83 | ||
|
|
7dc2d930ac | ||
|
|
cfd04410e3 | ||
|
|
eb86772dd5 | ||
|
|
2628e92f50 | ||
|
|
7af140d285 | ||
|
|
cf395ce0ca | ||
|
|
2500044f02 | ||
|
|
e5a9972694 | ||
|
|
ca50c363a3 | ||
|
|
61d4e45a1a | ||
|
|
aabef58c30 | ||
|
|
65858ff28c | ||
|
|
055f87d757 | ||
|
|
0473de59d3 | ||
|
|
248c4e9c9e | ||
|
|
dc35aaa83c | ||
|
|
9bc7869e2b | ||
|
|
a594a9a21d | ||
|
|
75cbe6f6ec | ||
|
|
93a30017e8 | ||
|
|
6034497158 | ||
|
|
f12b0a3b3d | ||
|
|
c15f528f78 | ||
|
|
06a0953eef | ||
|
|
6723ecce83 | ||
|
|
d975f571b3 | ||
|
|
5761c8af29 | ||
|
|
71d5f6fbe5 | ||
|
|
33d172e720 | ||
|
|
66e01b5f67 | ||
|
|
f39226c85e | ||
|
|
3940cb70ce | ||
|
|
d6937e9d94 | ||
|
|
2eaea9cb80 | ||
|
|
040ff69c10 | ||
|
|
c5a85a4cfa | ||
|
|
713fd39fcc | ||
|
|
511cfac95a | ||
|
|
b0f363bcc3 | ||
|
|
c9592c4101 | ||
|
|
38cc37536d | ||
|
|
e0d1459701 | ||
|
|
9fae45b209 | ||
|
|
2acb3d6f5f | ||
|
|
71bd9ce8a1 | ||
|
|
3ab0e214b5 | ||
|
|
1fe456ce71 | ||
|
|
15a5e7fa6c | ||
|
|
f106616521 | ||
|
|
73728fe9b4 | ||
|
|
b08fb5ab7f | ||
|
|
8bf12a6daa | ||
|
|
b2a616aba3 | ||
|
|
2016c46568 | ||
|
|
9e5da97084 | ||
|
|
8c0a47ef3a | ||
|
|
2f17afcc30 | ||
|
|
b5a0c212de | ||
|
|
073808a853 | ||
|
|
73adcdf9b0 | ||
|
|
4f7f921120 | ||
|
|
868eaa32fd | ||
|
|
b284210026 | ||
|
|
8d4efa7dec | ||
|
|
a37c3bfea2 | ||
|
|
2f361c3bde | ||
|
|
7597decfba | ||
|
|
1dec53057d | ||
|
|
954d067119 | ||
|
|
f5a192e27e | ||
|
|
8abbcecc54 | ||
|
|
a1923c21a7 | ||
|
|
f8408b1099 | ||
|
|
744a221075 | ||
|
|
e8b686d928 | ||
|
|
649cb9af43 | ||
|
|
8343cb58d5 | ||
|
|
1b72cbdee1 | ||
|
|
b06cb8d6e2 | ||
|
|
7c160a8073 | ||
|
|
647070205b | ||
|
|
0296058d15 | ||
|
|
03d4350fca | ||
|
|
c51c83edc0 | ||
|
|
acc15c9e55 | ||
|
|
2ea9ef528f | ||
|
|
9074e8ed52 | ||
|
|
e7f6e0f2b9 | ||
|
|
e802d2669a | ||
|
|
6d3bed914a | ||
|
|
3c2973aa02 | ||
|
|
ce3e408315 | ||
|
|
fd02884d76 | ||
|
|
a6a2c63aa9 | ||
|
|
351e8f0eda | ||
|
|
a5f5a7fad7 | ||
|
|
b8cf0fe3e4 | ||
|
|
81e6d2c488 | ||
|
|
ff23b59fe2 | ||
|
|
b3b7a1f9b9 | ||
|
|
249808e175 | ||
|
|
099ad93161 | ||
|
|
88545619f2 | ||
|
|
259f1e5fe7 | ||
|
|
ddbd363946 | ||
|
|
49ab58a185 | ||
|
|
0b6ce64392 | ||
|
|
8e198c6e74 | ||
|
|
5de4802237 | ||
|
|
042356615a | ||
|
|
7be37af016 | ||
|
|
7a2eeea33f | ||
|
|
53b29b879b | ||
|
|
b029115994 | ||
|
|
1341b40e5b | ||
|
|
d3e2a6811a | ||
|
|
991938edad | ||
|
|
ae4ebb9a1f | ||
|
|
2128d67569 | ||
|
|
51179caeff | ||
|
|
64648e0826 | ||
|
|
0b98d953d2 | ||
|
|
7b10eb5f32 | ||
|
|
17d3312a60 | ||
|
|
d1b864fa6f | ||
|
|
923216dfa4 | ||
|
|
fd36dd7130 | ||
|
|
74b71ae1fb | ||
|
|
a1311dba2d | ||
|
|
98a0e4ddc1 | ||
|
|
52b881723f | ||
|
|
28a95c3dd0 | ||
|
|
bd3b4657f4 | ||
|
|
be6d51c91f | ||
|
|
99f70c236e | ||
|
|
be8152e15b | ||
|
|
17f7f1ade9 | ||
|
|
486e156a91 | ||
|
|
20095a4276 | ||
|
|
1997bf6efb | ||
|
|
718e6a3b55 | ||
|
|
aa894d037b | ||
|
|
4d56b1a250 | ||
|
|
8f02c15e0b | ||
|
|
851fcb1dc0 | ||
|
|
b45cc923ad | ||
|
|
72d36e4878 | ||
|
|
d3cb83022b | ||
|
|
5582d8a1a9 | ||
|
|
d8c4a9013a | ||
|
|
f38fbe8d1a | ||
|
|
09db9501ae | ||
|
|
7a5a1eae90 | ||
|
|
1af491ee06 | ||
|
|
eac104f017 | ||
|
|
98d07a75a0 | ||
|
|
5eb6a331cd | ||
|
|
5c42986c13 | ||
|
|
b63dbdeb83 | ||
|
|
dc45e6c19a | ||
|
|
d782798926 | ||
|
|
c6038d7e92 | ||
|
|
5068e5a413 | ||
|
|
a2e58f645c | ||
|
|
125cb023e6 | ||
|
|
ed3fb8daaa | ||
|
|
5f26752083 | ||
|
|
97245ef94a | ||
|
|
447d86b6c6 | ||
|
|
9eb888533c | ||
|
|
5959b96b2e | ||
|
|
9c778c181f | ||
|
|
9b10959334 | ||
|
|
3d6119fc64 | ||
|
|
6a01c12854 | ||
|
|
6e559febd0 | ||
|
|
f2953a3b6c | ||
|
|
1cd518a67c | ||
|
|
0f8348b77a | ||
|
|
1c16baec21 | ||
|
|
7842e563d0 | ||
|
|
0819f09899 | ||
|
|
59fc3c388f | ||
|
|
5b0354f7ce | ||
|
|
fb5e6841a8 | ||
|
|
13e466a268 | ||
|
|
e91b3d8a2c | ||
|
|
5d044d3e91 | ||
|
|
dce088b5b4 | ||
|
|
c0cb57d5f8 | ||
|
|
676cbfbf49 | ||
|
|
02b59d164d | ||
|
|
03943fe896 | ||
|
|
ece13322e1 | ||
|
|
e1bb609176 | ||
|
|
3cfcf0124b | ||
|
|
aee0fa85e6 | ||
|
|
943f83f2ee | ||
|
|
817c319620 | ||
|
|
641d2b296b | ||
|
|
3c1c6fb7e0 | ||
|
|
dce26dab08 | ||
|
|
8a1bf45ae0 | ||
|
|
07007e3a02 | ||
|
|
23743b6561 | ||
|
|
f0d03142f3 | ||
|
|
d8c404bda7 | ||
|
|
9327d5d6be | ||
|
|
a706fa1cea | ||
|
|
a50320270a | ||
|
|
f5590a4230 | ||
|
|
3caca74140 | ||
|
|
a6150e4e28 | ||
|
|
58c9e3baa5 | ||
|
|
6eeeb37b9e | ||
|
|
f87876d494 | ||
|
|
eb3b7e564b | ||
|
|
b37c0dc297 | ||
|
|
5db490c0e2 | ||
|
|
fb0ce1bcbd | ||
|
|
9099ec040f | ||
|
|
9413d97e45 | ||
|
|
41a79ee53f | ||
|
|
ea78daf330 | ||
|
|
5e0505cf05 | ||
|
|
5867b2ff20 | ||
|
|
6e5469b9e3 | ||
|
|
8fc6e8f3ab | ||
|
|
f6dd6ced3b | ||
|
|
a0a405e974 | ||
|
|
35e7fa4c4d | ||
|
|
0119a39358 | ||
|
|
7f38dfdb1f | ||
|
|
5cefe6f822 | ||
|
|
24c58e35ed | ||
|
|
9357b43172 | ||
|
|
3622a3362c | ||
|
|
2342294493 | ||
|
|
2efce57799 | ||
|
|
8a5ee83850 | ||
|
|
640d07e356 | ||
|
|
01e1f8af09 | ||
|
|
369a94466a | ||
|
|
db52d33267 | ||
|
|
528392a746 | ||
|
|
a8faffe2ce | ||
|
|
d1a6dc44bb | ||
|
|
3b221c3b44 | ||
|
|
e87f6d9bc6 | ||
|
|
b867115dd7 | ||
|
|
476a2959fd | ||
|
|
0fd642237f | ||
|
|
5565791f61 | ||
|
|
346d047c1d | ||
|
|
deb1f96b0c | ||
|
|
0289bb6b3e | ||
|
|
51c48dc083 | ||
|
|
54eedabc12 | ||
|
|
4e3ffe58cc | ||
|
|
98e4df8889 | ||
|
|
6f3d6f2635 | ||
|
|
7b10496294 | ||
|
|
5e5e16a056 | ||
|
|
7c9d5e5efa | ||
|
|
0445e6f140 | ||
|
|
f219a108bd | ||
|
|
14a0d8eb84 | ||
|
|
c9ff52e949 | ||
|
|
9ef9e6a7b6 | ||
|
|
fa55df1634 | ||
|
|
28e689b25f | ||
|
|
2cadcf694c | ||
|
|
d04c50ce77 | ||
|
|
788364120e | ||
|
|
462df22866 | ||
|
|
e47e2f4c51 | ||
|
|
6fa6a37361 | ||
|
|
97df2a2095 | ||
|
|
b2b29c4270 | ||
|
|
3e46c466a8 | ||
|
|
32b0f72b74 | ||
|
|
d7d2e08050 | ||
|
|
7b35975139 | ||
|
|
40fb308337 | ||
|
|
add5ab42ea | ||
|
|
70bec3b36d | ||
|
|
7c24c50d9b | ||
|
|
6f375155d2 | ||
|
|
9ea230bb0a | ||
|
|
12420b5b67 | ||
|
|
021272870f | ||
|
|
fa866d7057 | ||
|
|
baf17b2ed4 | ||
|
|
e806afacb2 | ||
|
|
785232d450 | ||
|
|
7447131226 | ||
|
|
19d6ec53e4 | ||
|
|
2239cfe7ae | ||
|
|
9a511f6775 | ||
|
|
1aed09363b | ||
|
|
b8c048c47b | ||
|
|
753f07f69a | ||
|
|
1f6dceea85 | ||
|
|
df596c0889 | ||
|
|
034e6a7e7f | ||
|
|
8d51b1e56e | ||
|
|
a4965d51d2 | ||
|
|
a2036766ed | ||
|
|
92df33378e | ||
|
|
d22dee0237 | ||
|
|
90d54cae7a | ||
|
|
e321f30f4e | ||
|
|
47402f886a | ||
|
|
24630365bd | ||
|
|
92ddfdef29 | ||
|
|
e9322d3938 | ||
|
|
42595bf71c | ||
|
|
dd23a5ceaf | ||
|
|
cd3dce4a82 | ||
|
|
8562c2c9b4 | ||
|
|
cf48d1793b | ||
|
|
168bda9273 | ||
|
|
4584db99fe | ||
|
|
208bc3d810 | ||
|
|
04c342a1b9 | ||
|
|
adcdca708d | ||
|
|
a0560569a4 | ||
|
|
4f26efba41 | ||
|
|
cb24a781b3 | ||
|
|
062f497b0b | ||
|
|
dbcff517b4 | ||
|
|
40057f1f74 | ||
|
|
9c47a9b59d |
+5
-297
@@ -66,11 +66,6 @@ if (Tools::isSubmit('installBoughtModule'))
|
|||||||
die(displayJavascriptAlert('Module copied to disk'));
|
die(displayJavascriptAlert('Module copied to disk'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayJavascriptAlert($s)
|
|
||||||
{
|
|
||||||
echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('ajaxReferrers'))
|
if (Tools::isSubmit('ajaxReferrers'))
|
||||||
{
|
{
|
||||||
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
|
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
|
||||||
@@ -136,16 +131,6 @@ if (Tools::isSubmit('ajaxStates') AND Tools::isSubmit('id_country'))
|
|||||||
die($list);
|
die($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tools::isSubmit('submitCustomerNote') AND $id_customer = (int)Tools::getValue('id_customer'))
|
|
||||||
{
|
|
||||||
$note = html_entity_decode(Tools::getValue('note'));
|
|
||||||
if (!empty($note) AND !Validate::isCleanHtml($note))
|
|
||||||
die ('error:validation');
|
|
||||||
if (!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'customer SET `note` = "'.pSQL($note, true).'" WHERE id_customer = '.(int)$id_customer.' LIMIT 1'))
|
|
||||||
die ('error:update');
|
|
||||||
die('ok');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::getValue('form_language_id'))
|
if (Tools::getValue('form_language_id'))
|
||||||
{
|
{
|
||||||
if (!($context->cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
|
if (!($context->cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
|
||||||
@@ -153,74 +138,6 @@ if (Tools::getValue('form_language_id'))
|
|||||||
die ('Form language updated.');
|
die ('Form language updated.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tools::getValue('submitPublishProduct'))
|
|
||||||
{
|
|
||||||
if (Tools::getIsset('id_product'))
|
|
||||||
{
|
|
||||||
$id_product = (int)(Tools::getValue('id_product'));
|
|
||||||
$id_tab_catalog = (int)(Tab::getIdFromClassName('AdminProducts'));
|
|
||||||
$token = Tools::getAdminToken('AdminProducts'.(int)($id_tab_catalog).(int)$context->employee->id);
|
|
||||||
$bo_product_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminProducts&id_product='.$id_product.'&updateproduct&token='.$token;
|
|
||||||
|
|
||||||
if (Tools::getValue('redirect'))
|
|
||||||
die($bo_product_url);
|
|
||||||
|
|
||||||
$profileAccess = Profile::getProfileAccess($context->employee->id_profile, $id_tab_catalog);
|
|
||||||
if($profileAccess['edit'])
|
|
||||||
{
|
|
||||||
$product = new Product((int)(Tools::getValue('id_product')));
|
|
||||||
if (!Validate::isLoadedObject($product))
|
|
||||||
die('error: invalid id');
|
|
||||||
|
|
||||||
$product->active = 1;
|
|
||||||
|
|
||||||
if ($product->save())
|
|
||||||
die($bo_product_url);
|
|
||||||
else
|
|
||||||
die('error: saving');
|
|
||||||
|
|
||||||
} else {
|
|
||||||
die('error: permissions');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
die ('error: parameters');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::getValue('submitPublishCMS'))
|
|
||||||
{
|
|
||||||
if (Tools::getIsset('id_cms'))
|
|
||||||
{
|
|
||||||
$id_cms = (int)(Tools::getValue('id_cms'));
|
|
||||||
$id_tab_cms = (int)(Tab::getIdFromClassName('AdminCmsContent'));
|
|
||||||
$token = Tools::getAdminToken('AdminCmsContent'.(int)($id_tab_cms).(int)$context->employee->id);
|
|
||||||
$bo_cms_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminCmsContent&id_cms='.(int)$id_cms.'&updatecms&token='.$token;
|
|
||||||
|
|
||||||
if (Tools::getValue('redirect'))
|
|
||||||
die($bo_cms_url);
|
|
||||||
|
|
||||||
$profileAccess = Profile::getProfileAccess($context->employee->id_profile, $id_tab_cms);
|
|
||||||
if($profileAccess['edit'])
|
|
||||||
{
|
|
||||||
$cms = new CMS((int)(Tools::getValue('id_cms')));
|
|
||||||
if (!Validate::isLoadedObject($cms))
|
|
||||||
die('error: invalid id');
|
|
||||||
|
|
||||||
$cms->active = 1;
|
|
||||||
|
|
||||||
if ($cms->save())
|
|
||||||
die($bo_cms_url);
|
|
||||||
else
|
|
||||||
die('error: saving');
|
|
||||||
|
|
||||||
} else {
|
|
||||||
die('error: permissions');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
die ('error: parameters');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('submitTrackClickOnHelp'))
|
if (Tools::isSubmit('submitTrackClickOnHelp'))
|
||||||
{
|
{
|
||||||
$label = Tools::getValue('label');
|
$label = Tools::getValue('label');
|
||||||
@@ -230,36 +147,6 @@ if (Tools::isSubmit('submitTrackClickOnHelp'))
|
|||||||
HelpAccess::trackClick($label, $version);
|
HelpAccess::trackClick($label, $version);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tools::isSubmit('saveImportMatchs'))
|
|
||||||
{
|
|
||||||
$match = implode('|', Tools::getValue('type_value'));
|
|
||||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'import_match` (
|
|
||||||
`id_import_match` ,
|
|
||||||
`name` ,
|
|
||||||
`match`,
|
|
||||||
`skip`
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
NULL ,
|
|
||||||
\''.pSQL(Tools::getValue('newImportMatchs')).'\',
|
|
||||||
\''.pSQL($match).'\',
|
|
||||||
\''.pSQL(Tools::getValue('skip')).'\'
|
|
||||||
)');
|
|
||||||
|
|
||||||
die('{"id" : "'.Db::getInstance()->Insert_ID().'"}');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('deleteImportMatchs'))
|
|
||||||
{
|
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('loadImportMatchs'))
|
|
||||||
{
|
|
||||||
$return = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
|
|
||||||
die('{"id" : "'.$return[0]['id_import_match'].'", "matchs" : "'.$return[0]['match'].'", "skip" : "'.$return[0]['skip'].'"}');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('toggleScreencast'))
|
if (Tools::isSubmit('toggleScreencast'))
|
||||||
{
|
{
|
||||||
if (Validate::isLoadedObject($context->employee))
|
if (Validate::isLoadedObject($context->employee))
|
||||||
@@ -269,190 +156,6 @@ if (Tools::isSubmit('toggleScreencast'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tools::isSubmit('getHookableList'))
|
|
||||||
{
|
|
||||||
/* PrestaShop demo mode */
|
|
||||||
if (_PS_MODE_DEMO_)
|
|
||||||
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
|
|
||||||
/* PrestaShop demo mode*/
|
|
||||||
|
|
||||||
if (!count(Tools::getValue('hooks_list')))
|
|
||||||
die('{"hasError" : true, "errors" : ["Live Edit : no module on this page"]}');
|
|
||||||
|
|
||||||
$modules_list = Tools::getValue('modules_list');
|
|
||||||
$hooks_list = Tools::getValue('hooks_list');
|
|
||||||
$hookableList = array();
|
|
||||||
|
|
||||||
foreach ($modules_list as $module)
|
|
||||||
{
|
|
||||||
$module = trim($module);
|
|
||||||
if (!$module)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
$moduleInstance = Module::getInstanceByName($module);
|
|
||||||
foreach ($hooks_list as $hook_name)
|
|
||||||
{
|
|
||||||
$hook_name = trim($hook_name);
|
|
||||||
if (!$hook_name)
|
|
||||||
continue;
|
|
||||||
if (!array_key_exists($hook_name, $hookableList))
|
|
||||||
$hookableList[$hook_name] = array();
|
|
||||||
if ($moduleInstance->isHookableOn($hook_name))
|
|
||||||
array_push($hookableList[$hook_name], str_replace('_', '-', $module));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
$hookableList['hasError'] = false;
|
|
||||||
die(Tools::jsonEncode($hookableList));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('getHookableModuleList'))
|
|
||||||
{
|
|
||||||
/* PrestaShop demo mode */
|
|
||||||
if (_PS_MODE_DEMO_)
|
|
||||||
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
|
|
||||||
/* PrestaShop demo mode*/
|
|
||||||
|
|
||||||
include('../init.php');
|
|
||||||
$hook_name = Tools::getValue('hook');
|
|
||||||
$hookableModulesList = array();
|
|
||||||
$modules = Db::getInstance()->executeS('SELECT id_module, name FROM `'._DB_PREFIX_.'module` ');
|
|
||||||
foreach ($modules as $module)
|
|
||||||
{
|
|
||||||
if (file_exists(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php'))
|
|
||||||
{
|
|
||||||
include_once(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php');
|
|
||||||
$mod = new $module['name']();
|
|
||||||
if ($mod->isHookableOn($hook_name))
|
|
||||||
$hookableModulesList[] = array('id' => (int)$mod->id, 'name' => $mod->displayName, 'display' => Hook::exec($hook_name, array(), (int)$mod->id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
die(Tools::jsonEncode($hookableModulesList));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('saveHook'))
|
|
||||||
{
|
|
||||||
/* PrestaShop demo mode */
|
|
||||||
if (_PS_MODE_DEMO_)
|
|
||||||
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
|
|
||||||
|
|
||||||
$hooks_list = explode(',', Tools::getValue('hooks_list'));
|
|
||||||
$id_shop = (int)Tools::getValue('id_shop');
|
|
||||||
if (!$id_shop)
|
|
||||||
$id_shop = Context::getContext()->shop->id;
|
|
||||||
|
|
||||||
$res = true;
|
|
||||||
$hookableList = array();
|
|
||||||
// $_POST['hook'] is an array of id_module
|
|
||||||
$hooks_list = Tools::getValue('hook');
|
|
||||||
foreach ($hooks_list as $id_hook => $modules)
|
|
||||||
{
|
|
||||||
// 1st, drop all previous hooked modules
|
|
||||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'hook_module`
|
|
||||||
WHERE `id_hook` = '.(int)$id_hook.'
|
|
||||||
AND id_shop = '.$id_shop;
|
|
||||||
$res &= Db::getInstance()->execute($sql);
|
|
||||||
|
|
||||||
$i = 1;
|
|
||||||
$value = '';
|
|
||||||
$ids = array();
|
|
||||||
// then prepare sql query to rehook all chosen modules(id_module, id_shop, id_hook, position)
|
|
||||||
// position is i (autoincremented)
|
|
||||||
foreach ($modules as $id_module)
|
|
||||||
{
|
|
||||||
if (!in_array($id_module, $ids))
|
|
||||||
{
|
|
||||||
$ids[] = $id_module;
|
|
||||||
$value .= '('.(int)$id_module.', '.$id_shop.', '.(int)$id_hook.', '.$i.'),';
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$value = rtrim($value, ',');
|
|
||||||
$res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'hook_module`
|
|
||||||
(id_module, id_shop, id_hook, position)
|
|
||||||
VALUES '.$value);
|
|
||||||
|
|
||||||
}
|
|
||||||
if ($res)
|
|
||||||
$hasError = true;
|
|
||||||
else
|
|
||||||
$hasError = false;
|
|
||||||
die('{"hasError" : false, "errors" : ""}');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('getAdminHomeElement'))
|
|
||||||
{
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
$protocol = Tools::usingSecureMode() ? 'https' : 'http';
|
|
||||||
$isoUser = Context::getContext()->language->iso_code;
|
|
||||||
$isoCountry = Context::getContext()->country->iso_code;
|
|
||||||
$stream_context = @stream_context_create(array('http' => array('method'=> 'GET', 'timeout' => 5)));
|
|
||||||
|
|
||||||
// SCREENCAST
|
|
||||||
if (@fsockopen('api.prestashop.com', 80, $errno, $errst, 3))
|
|
||||||
$result['screencast'] = 'OK';
|
|
||||||
else
|
|
||||||
$result['screencast'] = 'NOK';
|
|
||||||
|
|
||||||
// PREACTIVATION
|
|
||||||
$content = @file_get_contents($protocol.'://api.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&date_creation='._PS_CREATION_DATE_.'&v='._PS_VERSION_.'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
|
|
||||||
if (!$content)
|
|
||||||
$result['partner_preactivation'] = 'NOK';
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$content = explode('|', $content);
|
|
||||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[2]) && Validate::isCleanHtml($content[1]))
|
|
||||||
{
|
|
||||||
$result['partner_preactivation'] = $content[2];
|
|
||||||
$content[1] = explode('#%#', $content[1]);
|
|
||||||
foreach ($content[1] as $partnerPopUp)
|
|
||||||
if ($partnerPopUp)
|
|
||||||
{
|
|
||||||
$partnerPopUp = explode('%%', $partnerPopUp);
|
|
||||||
if (!Configuration::get('PS_PREACTIVATION_'.strtoupper($partnerPopUp[0])))
|
|
||||||
{
|
|
||||||
$result['partner_preactivation'] .= $partnerPopUp[1];
|
|
||||||
Configuration::updateValue('PS_PREACTIVATION_'.strtoupper($partnerPopUp[0]), 'TRUE');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$result['partner_preactivation'] = 'NOK';
|
|
||||||
}
|
|
||||||
|
|
||||||
// PREACTIVATION PAYPAL WARNING
|
|
||||||
$content = @file_get_contents('https://api.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Context::getContext()->country->iso_code).'&iso_lang='.Tools::strtolower(Context::getContext()->language->iso_code).'&id_lang='.(int)Context::getContext()->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
|
|
||||||
$content = explode('|', $content);
|
|
||||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
|
|
||||||
Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', $content[1]);
|
|
||||||
else
|
|
||||||
Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', '');
|
|
||||||
|
|
||||||
// DISCOVER PRESTASHOP
|
|
||||||
$content = @file_get_contents($protocol.'://api.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id, false, $stream_context);
|
|
||||||
if (!$content)
|
|
||||||
$result['discover_prestashop'] = 'NOK';
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$content = explode('|', $content);
|
|
||||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
|
|
||||||
$result['discover_prestashop'] = $content[1];
|
|
||||||
else
|
|
||||||
$result['discover_prestashop'] = 'NOK';
|
|
||||||
|
|
||||||
if (@fsockopen('api.prestashop.com', 80, $errno, $errst, 3))
|
|
||||||
$result['discover_prestashop'] .= '<iframe frameborder="no" style="margin: 0px; padding: 0px; width: 315px; height: 290px;" src="'.$protocol.'://api.prestashop.com/rss/news2.php?v='._PS_VERSION_.'&lang='.$isoUser.'"></iframe>';
|
|
||||||
|
|
||||||
$content = @file_get_contents($protocol.'://api.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id, false, $stream_context);
|
|
||||||
$content = explode('|', $content);
|
|
||||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
|
|
||||||
$result['discover_prestashop'] .= $content[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
die(Tools::jsonEncode($result));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent'))
|
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent'))
|
||||||
{
|
{
|
||||||
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
|
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
|
||||||
@@ -627,3 +330,8 @@ if (Tools::isSubmit('getZones'))
|
|||||||
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
||||||
die(Tools::jsonEncode($html));
|
die(Tools::jsonEncode($html));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function displayJavascriptAlert($s)
|
||||||
|
{
|
||||||
|
echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* 2007-2012 PrestaShop
|
|
||||||
*
|
|
||||||
* NOTICE OF LICENSE
|
|
||||||
*
|
|
||||||
* This source file is subject to the Open Software License (OSL 3.0)
|
|
||||||
* that is bundled with this package in the file LICENSE.txt.
|
|
||||||
* It is also available through the world-wide-web at this URL:
|
|
||||||
* http://opensource.org/licenses/osl-3.0.php
|
|
||||||
* If you did not receive a copy of the license and are unable to
|
|
||||||
* obtain it through the world-wide-web, please send an email
|
|
||||||
* to license@prestashop.com so we can send you a copy immediately.
|
|
||||||
*
|
|
||||||
* DISCLAIMER
|
|
||||||
*
|
|
||||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
||||||
* versions in the future. If you wish to customize PrestaShop for your
|
|
||||||
* needs please refer to http://www.prestashop.com for more information.
|
|
||||||
*
|
|
||||||
* @author PrestaShop SA <contact@prestashop.com>
|
|
||||||
* @copyright 2007-2012 PrestaShop SA
|
|
||||||
* @version Release: $Revision: 6844 $
|
|
||||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
|
||||||
*/
|
|
||||||
define('_PS_ADMIN_DIR_', getcwd());
|
|
||||||
include_once(dirname(__FILE__).'/../config/config.inc.php');
|
|
||||||
|
|
||||||
/* Getting cookie or logout */
|
|
||||||
require_once(dirname(__FILE__).'/init.php');
|
|
||||||
if (Tools::getValue('token') != Tools::getAdminTokenLite('AdminEmails'))
|
|
||||||
die(Tools::displayError());
|
|
||||||
$smtpChecked = (trim($_POST['mailMethod']) == 'smtp');
|
|
||||||
$smtpServer = $_POST['smtpSrv'];
|
|
||||||
$content = urldecode($_POST['testMsg']);
|
|
||||||
$content = utf8_encode(html_entity_decode($content));
|
|
||||||
$subject = urldecode($_POST['testSubject']);
|
|
||||||
$type = 'text/html';
|
|
||||||
$to = $_POST['testEmail'];
|
|
||||||
$from = Configuration::get('PS_SHOP_EMAIL');
|
|
||||||
$smtpLogin = $_POST['smtpLogin'];
|
|
||||||
$smtpPassword = (!empty($_POST['smtpPassword'])) ? urldecode($_POST['smtpPassword']) : Configuration::get('PS_MAIL_PASSWD');
|
|
||||||
$smtpPort = $_POST['smtpPort'];
|
|
||||||
$smtpEncryption = $_POST['smtpEnc'];
|
|
||||||
|
|
||||||
$result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
|
|
||||||
die($result === true ? 'ok' : $result);
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* 2007-2012 PrestaShop
|
|
||||||
*
|
|
||||||
* NOTICE OF LICENSE
|
|
||||||
*
|
|
||||||
* This source file is subject to the Open Software License (OSL 3.0)
|
|
||||||
* that is bundled with this package in the file LICENSE.txt.
|
|
||||||
* It is also available through the world-wide-web at this URL:
|
|
||||||
* http://opensource.org/licenses/osl-3.0.php
|
|
||||||
* If you did not receive a copy of the license and are unable to
|
|
||||||
* obtain it through the world-wide-web, please send an email
|
|
||||||
* to license@prestashop.com so we can send you a copy immediately.
|
|
||||||
*
|
|
||||||
* DISCLAIMER
|
|
||||||
*
|
|
||||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
||||||
* versions in the future. If you wish to customize PrestaShop for your
|
|
||||||
* needs please refer to http://www.prestashop.com for more information.
|
|
||||||
*
|
|
||||||
* @author PrestaShop SA <contact@prestashop.com>
|
|
||||||
* @copyright 2007-2012 PrestaShop SA
|
|
||||||
* @version Release: $Revision$
|
|
||||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 1.5.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('_PS_ADMIN_DIR_', getcwd());
|
|
||||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
|
||||||
|
|
||||||
if (!Context::getContext()->employee->id)
|
|
||||||
Tools::redirectAdmin('index.php?controller=AdminLogin');
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Functions allowed
|
|
||||||
*/
|
|
||||||
$functions = array(
|
|
||||||
'id_supply_order' => 'exportSupplyOrder',
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Depending on $_GET, call the corresponding function
|
|
||||||
*/
|
|
||||||
foreach ($functions as $var => $function)
|
|
||||||
{
|
|
||||||
if (isset($_GET[$var]))
|
|
||||||
{
|
|
||||||
call_user_func($function);
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function used for SupplyOrder
|
|
||||||
*/
|
|
||||||
function exportSupplyOrder()
|
|
||||||
{
|
|
||||||
//@TODO Checks if employee has enough access to export
|
|
||||||
if (!isset($_GET['id_supply_order']))
|
|
||||||
die (Tools::displayError('Missing supply order ID'));
|
|
||||||
|
|
||||||
$id_supply_order = (int)$_GET['id_supply_order'];
|
|
||||||
$supply_order = new SupplyOrder($id_supply_order);
|
|
||||||
|
|
||||||
if (!Validate::isLoadedObject($supply_order))
|
|
||||||
die(Tools::displayError('Cannot find this supply order in the database'));
|
|
||||||
|
|
||||||
$details = $supply_order->getEntriesCollection($supply_order->id_lang);
|
|
||||||
exportCSV($details, 'supply_order_'.$supply_order->reference.'_details');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main function to export CSV
|
|
||||||
* @param object|Array $object
|
|
||||||
* @param string $template
|
|
||||||
*/
|
|
||||||
function exportCSV(&$object, $filename)
|
|
||||||
{
|
|
||||||
$csv = new CSV($object, $filename);
|
|
||||||
$csv->export();
|
|
||||||
}
|
|
||||||
@@ -499,3 +499,31 @@ ul.listForm li {padding-bottom:3px;}
|
|||||||
.selected-line {background:#fff1b5;}
|
.selected-line {background:#fff1b5;}
|
||||||
|
|
||||||
#changedFiles ul{list-style-type: square; padding-left: 40px;}
|
#changedFiles ul{list-style-type: square; padding-left: 40px;}
|
||||||
|
|
||||||
|
.tooltip { position: relative; }
|
||||||
|
.tooltip .tooltip_content {
|
||||||
|
z-index: 100;
|
||||||
|
text-align: left;
|
||||||
|
display: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
position: absolute;
|
||||||
|
padding: 5px 5px;
|
||||||
|
background: black;
|
||||||
|
color: white;
|
||||||
|
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
.tooltip .tooltip_label { cursor: pointer; }
|
||||||
|
.tooltip .title { text-align: center; padding-bottom: 5px; display: block; font-weight: bold }
|
||||||
|
.tooltip:hover .tooltip_content { display: block; }
|
||||||
|
.tooltip_button {
|
||||||
|
border: 1px solid silver;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 0 3px;
|
||||||
|
background: -moz-linear-gradient(top, #ddd, #aaa);
|
||||||
|
background: -o-linear-gradient(top, #ddd, #aaa);
|
||||||
|
background: -webkit-linear-gradient(top, #ddd, #aaa);
|
||||||
|
background: linear-gradient(top, #ddd, #aaa);
|
||||||
|
color: #666
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,29 +147,29 @@ a.module_toggle_all{color: #268CCD;}
|
|||||||
/*toolbarBox*/
|
/*toolbarBox*/
|
||||||
.toolbarBox { background-color: #F8F8F8; border: 1px solid #CCCCCC; margin-bottom:10px; padding: 10px 0; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px;}
|
.toolbarBox { background-color: #F8F8F8; border: 1px solid #CCCCCC; margin-bottom:10px; padding: 10px 0; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px;}
|
||||||
.toolbarBox .pageTitle { margin-left:10px; line-height:48px}
|
.toolbarBox .pageTitle { margin-left:10px; line-height:48px}
|
||||||
.toolbarBox .pageTitle h3 {font-size: 2em; font-weight: bold; line-height: 48px; margin: 0; padding: 0;}
|
.toolbarBox .pageTitle h3 {font-size: 2em; font-weight: bold; line-height: 48px; margin: 0; padding: 0}
|
||||||
.toolbarBox ul.cc_button {float:right;margin:0;padding:0;}
|
.toolbarBox ul.cc_button {float:right;margin:0;padding:0}
|
||||||
.toolbarBox ul.cc_button li {color: #666666; float: left; height: 48px; list-style: none outside none; padding: 1px 1px 3px 4px; text-align: center;}
|
.toolbarBox ul.cc_button li {color: #666666; float: left; height: 48px; list-style: none outside none; padding: 1px 1px 3px 4px; text-align: center}
|
||||||
.toolbarBox a.toolbar_btn { border-width: 1px;font-size:11px;cursor: pointer; display: block; float: left; padding: 1px 5px; white-space: nowrap; text-shadow: 0 1px 0 #ffffff;;}
|
.toolbarBox a.toolbar_btn { border-width: 1px;font-size:11px;cursor: pointer; display: block; float: left; padding: 1px 5px; white-space: nowrap; text-shadow: 0 1px 0 #ffffff}
|
||||||
.toolbarBox a.toolbar_btn:hover {}
|
.toolbarBox a.toolbar_btn:hover {}
|
||||||
.toolbarBox .toolbar_btn span{ display: block;float: none;height: 32px;margin: 0 auto;width: 32px;}
|
.toolbarBox .toolbar_btn span{ display: block;float: none;height: 32px;margin: 0 auto;width: 32px}
|
||||||
.toolbarBox .process-icon-delete { background-image: url('../img/process-icon-delete.png');}
|
.toolbarBox .process-icon-delete { background-image: url('../img/process-icon-delete.png')}
|
||||||
.toolbarBox .process-icon-duplicate { background-image: url('../img/process-icon-duplicate.png');}
|
.toolbarBox .process-icon-duplicate { background-image: url('../img/process-icon-duplicate.png')}
|
||||||
.toolbarBox .process-icon-preview { background-image: url('../img/process-icon-preview.png');}
|
.toolbarBox .process-icon-preview { background-image: url('../img/process-icon-preview.png')}
|
||||||
.toolbarBox .process-icon-stats { background-image: url('../img/process-icon-stats.png');}
|
.toolbarBox .process-icon-stats { background-image: url('../img/process-icon-stats.png')}
|
||||||
.toolbarBox .process-icon-cancel { background-image: url('../img/process-icon-cancel.png');}
|
.toolbarBox .process-icon-cancel { background-image: url('../img/process-icon-cancel.png')}
|
||||||
.toolbarBox .process-icon-new, .toolbarBox .process-icon-newAttributes{ background-image: url('../img/process-icon-new.png');}
|
.toolbarBox .process-icon-new, .toolbarBox .process-icon-newAttributes{ background-image: url('../img/process-icon-new.png')}
|
||||||
.toolbarBox .process-icon-save, .toolbarBox .process-icon-save-settings { background-image: url('../img/process-icon-save.png');}
|
.toolbarBox .process-icon-save, .toolbarBox .process-icon-save-settings { background-image: url('../img/process-icon-save.png')}
|
||||||
.toolbarBox .process-icon-save-and-stay { background-image: url('../img/process-icon-save-and-stay.png');}
|
.toolbarBox .process-icon-save-and-stay { background-image: url('../img/process-icon-save-and-stay.png')}
|
||||||
.toolbarBox .process-icon-edit { background-image: url('../img/process-icon-edit.png');}
|
.toolbarBox .process-icon-edit { background-image: url('../img/process-icon-edit.png')}
|
||||||
.toolbarBox .process-icon-back { background-image: url('../img/process-icon-back.png');}
|
.toolbarBox .process-icon-back { background-image: url('../img/process-icon-back.png')}
|
||||||
.toolbarBox .process-icon-refresh-index { background-image: url('../img/process-icon-refresh-index.png');}
|
.toolbarBox .process-icon-refresh-index { background-image: url('../img/process-icon-refresh-index.png')}
|
||||||
.toolbarBox .process-icon-refresh-cache { background-image: url('../img/process-icon-refresh-cache.png');}
|
.toolbarBox .process-icon-refresh-cache { background-image: url('../img/process-icon-refresh-cache.png')}
|
||||||
.toolbarBox .process-icon-save-calendar { background-image: url('../img/process-icon-save-calendar.png');}
|
.toolbarBox .process-icon-save-calendar { background-image: url('../img/process-icon-save-calendar.png')}
|
||||||
.toolbarBox .process-icon-new-module { background-image: url('../img/process-icon-new-module.png');}
|
.toolbarBox .process-icon-new-module { background-image: url('../img/process-icon-new-module.png')}
|
||||||
.toolbarBox .process-icon-new-module-addon { background-image: url('../img/process-icon-new-module-addon.png');}
|
.toolbarBox .process-icon-new-module-addon { background-image: url('../img/process-icon-new-module-addon.png')}
|
||||||
|
|
||||||
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:1;}
|
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:1}
|
||||||
|
|
||||||
/*button upload files*/
|
/*button upload files*/
|
||||||
.qq-upload-button {background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent;
|
.qq-upload-button {background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent;
|
||||||
@@ -231,7 +231,8 @@ form#product, form#access_form{ background-color:#ebedf4; border:1px solid #cc
|
|||||||
#moduleContainer .moduleDesc .metadata dl dt { font-weight:bold; padding-right:5px;}
|
#moduleContainer .moduleDesc .metadata dl dt { font-weight:bold; padding-right:5px;}
|
||||||
#moduleContainer .moduleDesc p.desc { color:#666; font-size:12px; display:block; clear:both;}
|
#moduleContainer .moduleDesc p.desc { color:#666; font-size:12px; display:block; clear:both;}
|
||||||
#moduleContainer .setup {background-color:#6db300; font-size:10px; color:#fff; text-transform:uppercase; position:relative; left:10px; padding:0px 4px; display: inline-block; border-radius:3px;}
|
#moduleContainer .setup {background-color:#6db300; font-size:10px; color:#fff; text-transform:uppercase; position:relative; left:10px; padding:0px 4px; display: inline-block; border-radius:3px;}
|
||||||
#moduleContainer .setup.non-install { background-color:#ec7000;}
|
#moduleContainer .setup.non-install { border: solid 1px #ec7000; background-color: #ffedb1; color: #ec7000}
|
||||||
|
#moduleContainer .setup.must-have { background-color: #ec7000;}
|
||||||
#moduleContainer .setup.off{ background-color:#ccc;}
|
#moduleContainer .setup.off{ background-color:#ccc;}
|
||||||
#moduleContainer .row-actions-module span { padding-right:5px;}
|
#moduleContainer .row-actions-module span { padding-right:5px;}
|
||||||
#moduleContainer .row-actions-module span a { font-size:12px;}
|
#moduleContainer .row-actions-module span a { font-size:12px;}
|
||||||
@@ -243,7 +244,6 @@ form#product, form#access_form{ background-color:#ebedf4; border:1px solid #cc
|
|||||||
#moduleContainer .moduleName {font-size:12px; color:#3A6EA7;font-weight:bold;}
|
#moduleContainer .moduleName {font-size:12px; color:#3A6EA7;font-weight:bold;}
|
||||||
#moduleContainer .moduleFavDesc { font-family:Georgia; font-style:italic; color:#666;}
|
#moduleContainer .moduleFavDesc { font-family:Georgia; font-style:italic; color:#666;}
|
||||||
|
|
||||||
|
|
||||||
/*FOOTER*/
|
/*FOOTER*/
|
||||||
#footer {height:40px; font-size:12px;clear:both;font-size:0.9em;color:#666666}
|
#footer {height:40px; font-size:12px;clear:both;font-size:0.9em;color:#666666}
|
||||||
#footer .footer_link, #footer .footer_link:hover {color:#D41958;}
|
#footer .footer_link, #footer .footer_link:hover {color:#D41958;}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
perfect_access_js_gestion(this, perm, id_tab, tabsize, tabnumber, table, '{$id_tab_access}');
|
perfect_access_js_gestion(this, perm, id_tab, tabsize, tabnumber, table);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{$link->getAdminLink('AdminAccess')}",
|
url: "{$link->getAdminLink('AdminAccess')}",
|
||||||
@@ -122,15 +122,16 @@
|
|||||||
var perm = tout[1];
|
var perm = tout[1];
|
||||||
var id_profile = tout[2];
|
var id_profile = tout[2];
|
||||||
var enabled = $(this).is(':checked') ? 1 : 0;
|
var enabled = $(this).is(':checked') ? 1 : 0;
|
||||||
|
var enabled_attr = $(this).is(':checked') ? true : false;
|
||||||
var table = 'table#table_module_'+id_profile;
|
var table = 'table#table_module_'+id_profile;
|
||||||
|
|
||||||
if (id_module == -1)
|
if (id_module == -1)
|
||||||
$(table+' .ajax-ma-'+perm).each(function(key, value) {
|
$(table+' .ajax-ma-'+perm).each(function(key, value) {
|
||||||
$(this).attr("checked", enabled);
|
$(this).attr("checked", enabled_attr);
|
||||||
});
|
});
|
||||||
else if (!enabled)
|
else if (!enabled)
|
||||||
$(table+' #ajax-ma-'+perm+'-master').each(function(key, value) {
|
$(table+' #ajax-ma-'+perm+'-master').each(function(key, value) {
|
||||||
$(this).attr("checked", enabled);
|
$(this).attr("checked", enabled_attr);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|||||||
@@ -78,9 +78,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="float: left; width: 570px;">
|
<div style="float: left; width: 570px;">
|
||||||
<div class="hint" style="width: 570px; padding-left: 45px; margin-bottom: 15px; display: block; position: inherit;">{l s='The Combinations Generator is a tool which allows you to easily create a series of combinations by selecting the related attributes. For example, if you are selling T-Shirts, in 3 different sizes and 2 different colors, the Generator will create 6 combinations for you.'}</div>
|
<div class="hint" style="width: 570px; padding-left: 45px; margin-bottom: 15px; display: block; position: inherit;">{l s='The Combinations Generator is a tool which allows you to easily create a series of combinations by selecting the related attributes. For example, if you are selling T-Shirts in 3 different sizes and 2 different colors, the Generator will create 6 combinations for you.'}</div>
|
||||||
<p>{l s='You are currently generating combinations for the following product:'} <b>{$product_name|escape:'htmlall':'UTF-8'}</b></p>
|
<p>{l s='You are currently generating combinations for the following product:'} <b>{$product_name|escape:'htmlall':'UTF-8'}</b></p>
|
||||||
<h4>{l s='Step 1: On the left side, Select the attributes you want to use (Holding down the "CTRL" Key on your keyboard and validating by clicking on "Add"'}</h4>
|
<h4>{l s='Step 1: On the left side, Select the attributes you want to use (Hold down the "CTRL" Key on your keyboard and validate by clicking on "Add")'}</h4>
|
||||||
<div>
|
<div>
|
||||||
{foreach $attribute_groups as $k => $attribute_group}
|
{foreach $attribute_groups as $k => $attribute_group}
|
||||||
{if isset($attribute_js[$attribute_group['id_attribute_group']])}
|
{if isset($attribute_js[$attribute_group['id_attribute_group']])}
|
||||||
|
|||||||
@@ -28,6 +28,16 @@
|
|||||||
|
|
||||||
{block name="override_header"}
|
{block name="override_header"}
|
||||||
|
|
||||||
|
{if isset($backup_url) && isset($backup_weight)}
|
||||||
|
<fieldset>
|
||||||
|
<legend><img src="../img/admin/AdminBackup.gif" alt="" class="icon" /> {l s='Download'}</legend>
|
||||||
|
<p style="font-size: 13px;">
|
||||||
|
<a href="{$backup_url}"><img src="../img/admin/AdminBackup.gif" alt="" class="icon" /></a>
|
||||||
|
<b><a href="{$backup_url}">{l s='Download the Backup file'} ({$backup_weight}{l s='MB'})</a></b><br /><br />
|
||||||
|
{l s='Tip: You can also download this file over your FTP. Backup files are located in "admin/backups" directory.'}</p>
|
||||||
|
</fieldset><br /><br />
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="error width1" style="float: left; margin-right: 10px;">
|
<div class="error width1" style="float: left; margin-right: 10px;">
|
||||||
<p>{l s='Disclaimer before creating a new Backup'}</p>
|
<p>{l s='Disclaimer before creating a new Backup'}</p>
|
||||||
<ol style="font-size: 11px; font-weight: normal; line-height: 20px; padding-left: 10px;">
|
<ol style="font-size: 11px; font-weight: normal; line-height: 20px; padding-left: 10px;">
|
||||||
|
|||||||
@@ -55,20 +55,6 @@
|
|||||||
<div id="country_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
<div id="country_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
|
||||||
<p><strong>{l s='Selected countries'}</strong></p>
|
|
||||||
<select name="country_select[]" id="country_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
|
||||||
{foreach from=$countries.selected item='country'}
|
|
||||||
<option value="{$country.id_country|intval}"> {$country.name|escape}</option>
|
|
||||||
{/foreach}
|
|
||||||
</select><br /><br />
|
|
||||||
<a
|
|
||||||
id="country_select_remove"
|
|
||||||
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
|
||||||
>
|
|
||||||
{l s='Remove'} >>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td style="padding-left:20px;">
|
<td style="padding-left:20px;">
|
||||||
<p><strong>{l s='Unselected countries'}</strong></p>
|
<p><strong>{l s='Unselected countries'}</strong></p>
|
||||||
<select id="country_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
<select id="country_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
@@ -80,7 +66,21 @@
|
|||||||
id="country_select_add"
|
id="country_select_add"
|
||||||
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
>
|
>
|
||||||
<< {l s='Add'}
|
{l s='Add'} >>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p><strong>{l s='Selected countries'}</strong></p>
|
||||||
|
<select name="country_select[]" id="country_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
|
{foreach from=$countries.selected item='country'}
|
||||||
|
<option value="{$country.id_country|intval}"> {$country.name|escape}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select><br /><br />
|
||||||
|
<a
|
||||||
|
id="country_select_remove"
|
||||||
|
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
|
>
|
||||||
|
<< {l s='Remove'}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -93,20 +93,6 @@
|
|||||||
<div id="carrier_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
<div id="carrier_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
|
||||||
<p><strong>{l s='Selected carriers'}</strong></p>
|
|
||||||
<select name="carrier_select[]" id="carrier_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
|
||||||
{foreach from=$carriers.selected item='carrier'}
|
|
||||||
<option value="{$carrier.id_carrier|intval}"> {$carrier.name|escape}</option>
|
|
||||||
{/foreach}
|
|
||||||
</select><br /><br />
|
|
||||||
<a
|
|
||||||
id="carrier_select_remove"
|
|
||||||
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
|
||||||
>
|
|
||||||
{l s='Remove'} >>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td style="padding-left:20px;">
|
<td style="padding-left:20px;">
|
||||||
<p><strong>{l s='Unselected carriers'}</strong></p>
|
<p><strong>{l s='Unselected carriers'}</strong></p>
|
||||||
<select id="carrier_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
<select id="carrier_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
@@ -118,7 +104,21 @@
|
|||||||
id="carrier_select_add"
|
id="carrier_select_add"
|
||||||
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
>
|
>
|
||||||
<< {l s='Add'}
|
{l s='Add'} >>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p><strong>{l s='Selected carriers'}</strong></p>
|
||||||
|
<select name="carrier_select[]" id="carrier_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
|
{foreach from=$carriers.selected item='carrier'}
|
||||||
|
<option value="{$carrier.id_carrier|intval}"> {$carrier.name|escape}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select><br /><br />
|
||||||
|
<a
|
||||||
|
id="carrier_select_remove"
|
||||||
|
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
|
>
|
||||||
|
<< {l s='Remove'}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -132,20 +132,6 @@
|
|||||||
<div id="group_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
<div id="group_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
|
||||||
<p><strong>{l s='Selected groups'}</strong></p>
|
|
||||||
<select name="group_select[]" id="group_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
|
||||||
{foreach from=$groups.selected item='group'}
|
|
||||||
<option value="{$group.id_group|intval}"> {$group.name|escape}</option>
|
|
||||||
{/foreach}
|
|
||||||
</select><br /><br />
|
|
||||||
<a
|
|
||||||
id="group_select_remove"
|
|
||||||
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
|
||||||
>
|
|
||||||
{l s='Remove'} >>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td style="padding-left:20px;">
|
<td style="padding-left:20px;">
|
||||||
<p><strong>{l s='Unselected groups'}</strong></p>
|
<p><strong>{l s='Unselected groups'}</strong></p>
|
||||||
<select id="group_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
<select id="group_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
@@ -157,7 +143,21 @@
|
|||||||
id="group_select_add"
|
id="group_select_add"
|
||||||
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
>
|
>
|
||||||
<< {l s='Add'}
|
{l s='Add'} >>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p><strong>{l s='Selected groups'}</strong></p>
|
||||||
|
<select name="group_select[]" id="group_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
|
{foreach from=$groups.selected item='group'}
|
||||||
|
<option value="{$group.id_group|intval}"> {$group.name|escape}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select><br /><br />
|
||||||
|
<a
|
||||||
|
id="group_select_remove"
|
||||||
|
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
|
>
|
||||||
|
<< {l s='Remove'}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -171,20 +171,6 @@
|
|||||||
<div id="cart_rule_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
<div id="cart_rule_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
|
||||||
<p><strong>{l s='Combinable cart rules'}</strong></p>
|
|
||||||
<select name="cart_rule_select[]" id="cart_rule_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
|
||||||
{foreach from=$cart_rules.selected item='cart_rule'}
|
|
||||||
<option value="{$cart_rule.id_cart_rule|intval}"> {$cart_rule.name|escape}</option>
|
|
||||||
{/foreach}
|
|
||||||
</select><br /><br />
|
|
||||||
<a
|
|
||||||
id="cart_rule_select_remove"
|
|
||||||
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
|
||||||
>
|
|
||||||
{l s='Remove'} >>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td style="padding-left:20px;">
|
<td style="padding-left:20px;">
|
||||||
<p><strong>{l s='Uncombinable cart rules'}</strong></p>
|
<p><strong>{l s='Uncombinable cart rules'}</strong></p>
|
||||||
<select id="cart_rule_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple="">
|
<select id="cart_rule_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple="">
|
||||||
@@ -196,7 +182,21 @@
|
|||||||
id="cart_rule_select_add"
|
id="cart_rule_select_add"
|
||||||
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
>
|
>
|
||||||
<< {l s='Add'}
|
{l s='Add'} >>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p><strong>{l s='Combinable cart rules'}</strong></p>
|
||||||
|
<select name="cart_rule_select[]" id="cart_rule_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
|
{foreach from=$cart_rules.selected item='cart_rule'}
|
||||||
|
<option value="{$cart_rule.id_cart_rule|intval}"> {$cart_rule.name|escape}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select><br /><br />
|
||||||
|
<a
|
||||||
|
id="cart_rule_select_remove"
|
||||||
|
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
|
>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -221,20 +221,6 @@
|
|||||||
<div id="shop_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
<div id="shop_restriction_div" style="border:1px solid #AAAAAA;margin-top:10px;padding:0 10px 10px 10px;background-color:#FFF5D3">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
|
||||||
<p><strong>{l s='Selected shops'}</strong></p>
|
|
||||||
<select name="shop_select[]" id="shop_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
|
||||||
{foreach from=$shops.selected item='shop'}
|
|
||||||
<option value="{$shop.id_shop|intval}"> {$shop.name|escape}</option>
|
|
||||||
{/foreach}
|
|
||||||
</select><br /><br />
|
|
||||||
<a
|
|
||||||
id="shop_select_remove"
|
|
||||||
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
|
||||||
>
|
|
||||||
{l s='Remove'} >>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td style="padding-left:20px;">
|
<td style="padding-left:20px;">
|
||||||
<p><strong>{l s='Unselected shops'}</strong></p>
|
<p><strong>{l s='Unselected shops'}</strong></p>
|
||||||
<select id="shop_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
<select id="shop_select_1" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
@@ -246,7 +232,21 @@
|
|||||||
id="shop_select_add"
|
id="shop_select_add"
|
||||||
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
>
|
>
|
||||||
<< {l s='Add'}
|
{l s='Add'} >>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p><strong>{l s='Selected shops'}</strong></p>
|
||||||
|
<select name="shop_select[]" id="shop_select_2" style="border:1px solid #AAAAAA;width:400px;height:160px" multiple>
|
||||||
|
{foreach from=$shops.selected item='shop'}
|
||||||
|
<option value="{$shop.id_shop|intval}"> {$shop.name|escape}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select><br /><br />
|
||||||
|
<a
|
||||||
|
id="shop_select_remove"
|
||||||
|
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
|
>
|
||||||
|
<< {l s='Remove'}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
+19
-19
@@ -1,5 +1,23 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td style="padding-left:20px">
|
||||||
|
<p><strong>{l s='Unselected'}</strong></p>
|
||||||
|
<select
|
||||||
|
id="product_rule_select_{$product_rule_group_id|intval}_{$product_rule_id|intval}_1"
|
||||||
|
style="border:1px solid #AAAAAA;width:400px;height:160px"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
{foreach from=$product_rule_itemlist.unselected item='item'}
|
||||||
|
<option value="{$item.id|intval}"> {$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select><br /><br />
|
||||||
|
<a
|
||||||
|
id="product_rule_select_{$product_rule_group_id|intval}_{$product_rule_id|intval}_add"
|
||||||
|
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
|
>
|
||||||
|
{l s='Add'} >>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p><strong>{l s='Selected'}</strong></p>
|
<p><strong>{l s='Selected'}</strong></p>
|
||||||
<select
|
<select
|
||||||
@@ -17,25 +35,7 @@
|
|||||||
id="product_rule_select_{$product_rule_group_id}_{$product_rule_id}_remove"
|
id="product_rule_select_{$product_rule_group_id}_{$product_rule_id}_remove"
|
||||||
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||||
>
|
>
|
||||||
{l s='Remove'} >>
|
<< {l s='Remove'}
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td style="padding-left:20px">
|
|
||||||
<p><strong>{l s='Unselected'}</strong></p>
|
|
||||||
<select
|
|
||||||
id="product_rule_select_{$product_rule_group_id|intval}_{$product_rule_id|intval}_1"
|
|
||||||
style="border:1px solid #AAAAAA;width:400px;height:160px"
|
|
||||||
multiple
|
|
||||||
>
|
|
||||||
{foreach from=$product_rule_itemlist.unselected item='item'}
|
|
||||||
<option value="{$item.id|intval}"> {$item.name}</option>
|
|
||||||
{/foreach}
|
|
||||||
</select><br /><br />
|
|
||||||
<a
|
|
||||||
id="product_rule_select_{$product_rule_group_id|intval}_{$product_rule_id|intval}_add"
|
|
||||||
style="cursor:pointer;text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
|
||||||
>
|
|
||||||
<< {l s='Add'}
|
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">{displayWtPriceWithCurrency price=$product.product_price currency=$currency}</td>
|
<td align="center">{displayWtPriceWithCurrency price=$product.product_price currency=$currency}</td>
|
||||||
<td align="center" class="productQuantity">{math equation='x - y' x=$product.cart_quantity y=$product.customization_quantity}</td>
|
<td align="center" class="productQuantity">{math equation='x - y' x=$product.cart_quantity y=$product.customization_quantity|intval}</td>
|
||||||
<td align="center" class="productQuantity">{$product.qty_in_stock}</td>
|
<td align="center" class="productQuantity">{$product.qty_in_stock}</td>
|
||||||
<td align="right">{displayWtPriceWithCurrency price=$product.product_total currency=$currency}</td>
|
<td align="right">{displayWtPriceWithCurrency price=$product.product_total currency=$currency}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -25,6 +25,29 @@
|
|||||||
*}
|
*}
|
||||||
{extends file="helpers/form/form.tpl"}
|
{extends file="helpers/form/form.tpl"}
|
||||||
|
|
||||||
|
{block name="input"}
|
||||||
|
{if $input.type == 'file'}
|
||||||
|
{if isset($input.display_image) && $input.display_image}
|
||||||
|
{if isset($fields_value.image) && $fields_value.image}
|
||||||
|
<div id="image">
|
||||||
|
{$fields_value.image}
|
||||||
|
<p align="center">{l s='File size'} {$fields_value.size}kb</p>
|
||||||
|
{if $shared_category}
|
||||||
|
<p class="warn">{l s='If you delete this picture it\'s will be deleted for all shared shop'}</p>
|
||||||
|
{/if}
|
||||||
|
<br>
|
||||||
|
<a href="{$current}&{$identifier}={$form_id}&token={$token}&{if $shared_category}forcedeleteImage=1{else}deleteImage=1{/if}">
|
||||||
|
<img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'}
|
||||||
|
</a>
|
||||||
|
</div><br />
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
<input type="file" name="{$input.name}" {if isset($input.id)}id="{$input.id}"{/if} />
|
||||||
|
{if !empty($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||||
|
{else}
|
||||||
|
{$smarty.block.parent}
|
||||||
|
{/if}
|
||||||
|
{/block}
|
||||||
{block name="description"}
|
{block name="description"}
|
||||||
{$smarty.block.parent}
|
{$smarty.block.parent}
|
||||||
{if ($input.name == 'groupBox')}
|
{if ($input.name == 'groupBox')}
|
||||||
@@ -35,4 +58,4 @@
|
|||||||
<span>{$input.customer}</span><br />
|
<span>{$input.customer}</span><br />
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetLayout(defaultLayout, type) {
|
function resetLayout(defaultLayout, type) {
|
||||||
if (confirm("{l s='Are you sure you want to restore the default address format for this country?'}"))
|
if (confirm("{l s='Are you sure you want to restore the default address format for this country?' js=1}"))
|
||||||
$("#ordered_fields").val(unescape(defaultLayout.replace(/\+/g, " ")));
|
$("#ordered_fields").val(unescape(defaultLayout.replace(/\+/g, " ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
{if !empty($message.id_product) && empty($message.id_employee)}
|
{if !empty($message.id_product) && empty($message.id_employee)}
|
||||||
<dl>
|
<dl>
|
||||||
<dt>{l s='Product #'}</dt>
|
<dt>{l s='Product #'}</dt>
|
||||||
<dd><a href="index.php?tab=AdminOrders&id_order={$id_order_product}&vieworder&token={getAdminToken tab='AdminOrders'}" title="{l s='View order'}">
|
<dd><a href="index.php?tab=AdminProducts&id_product={$message.id_product}&updateproduct&token={getAdminToken tab='AdminProducts'}" title="{l s='View order'}">
|
||||||
{$message.id_product} <img src="../img/admin/search.gif" alt="{l s='view'}" />
|
{$message.id_product} <img src="../img/admin/search.gif" alt="{l s='view'}" />
|
||||||
</a></dd>
|
</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|||||||
@@ -35,8 +35,8 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "ajax.php",
|
url: "index.php",
|
||||||
data: "submitCustomerNote=1&id_customer={$customer->id}¬e="+noteContent,
|
data: "token={getAdminToken tab='AdminCustomers'}&tab=AdminCustomers&ajax=1&action=updateCustomerNote&id_customer={$customer->id}¬e="+noteContent,
|
||||||
async : true,
|
async : true,
|
||||||
success: function(r) {
|
success: function(r) {
|
||||||
$('#note_feedback').html('').hide();
|
$('#note_feedback').html('').hide();
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
<div class="info-customer-left">
|
<div class="info-customer-left">
|
||||||
<div style="float: right">
|
<div style="float: right">
|
||||||
<a href="{$current}&addcustomer&id_customer={$customer->id}&token={$token}">
|
<a href="{$current}&updatecustomer&id_customer={$customer->id}&token={$token}">
|
||||||
<img src="../img/admin/edit.gif" />
|
<img src="../img/admin/edit.gif" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
<div>
|
<div>
|
||||||
{l s='This customer is registered as'} <b>{l s='guest'}</b>
|
{l s='This customer is registered as'} <b>{l s='guest'}</b>
|
||||||
{if !$customer_exists}
|
{if !$customer_exists}
|
||||||
<form method="POST" action="index.php?tab=AdminCustomers&id_customer={$customer->id}&token={getAdminToken tab='AdminCustomers'}">
|
<form method="post" action="index.php?tab=AdminCustomers&id_customer={$customer->id}&token={getAdminToken tab='AdminCustomers'}">
|
||||||
<input type="hidden" name="id_lang" value="{$id_lang}" />
|
<input type="hidden" name="id_lang" value="{$id_lang}" />
|
||||||
<p class="center"><input class="button" type="submit" name="submitGuestToCustomer" value="{l s='Transform to customer account'}" /></p>
|
<p class="center"><input class="button" type="submit" name="submitGuestToCustomer" value="{l s='Transform to customer account'}" /></p>
|
||||||
{l s='This feature generates a random password and sends an e-mail to the customer'}
|
{l s='This feature generates a random password and sends an e-mail to the customer'}
|
||||||
@@ -161,9 +161,9 @@
|
|||||||
{if $groups AND count($groups)}
|
{if $groups AND count($groups)}
|
||||||
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="10px"></col>
|
<col width="10px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="70px"></col>
|
<col width="70px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th height="39px" class="right">{l s='ID'}</th>
|
<th height="39px" class="right">{l s='ID'}</th>
|
||||||
@@ -192,13 +192,13 @@
|
|||||||
</h3>
|
</h3>
|
||||||
<table cellspacing="0" cellpadding="0" class="table" style="width:100%; text-align:left;">
|
<table cellspacing="0" cellpadding="0" class="table" style="width:100%; text-align:left;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="10px"></col>
|
<col width="10px">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
<col width="80px"></col>
|
<col width="80px">
|
||||||
<col width="70px"></col>
|
<col width="70px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th height="39px" class="center">{l s='ID'}</th>
|
<th height="39px" class="center">{l s='ID'}</th>
|
||||||
@@ -229,13 +229,13 @@
|
|||||||
<h3 style="color:red;font-weight:normal;">{l s='Invalid orders:'} {$count_ko}</h3>
|
<h3 style="color:red;font-weight:normal;">{l s='Invalid orders:'} {$count_ko}</h3>
|
||||||
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="10px"></col>
|
<col width="10px">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width="52px"></col>
|
<col width="52px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th height="39px" class="center">{l s='ID'}</th>
|
<th height="39px" class="center">{l s='ID'}</th>
|
||||||
@@ -270,10 +270,10 @@
|
|||||||
<h2>{l s='Products'} ({count($products)})</h2>
|
<h2>{l s='Products'} ({count($products)})</h2>
|
||||||
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="60px"></col>
|
<col width="60px">
|
||||||
<col width="70px"></col>
|
<col width="70px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th height="39px" class="center">{l s='Date'}</th>
|
<th height="39px" class="center">{l s='Date'}</th>
|
||||||
@@ -297,12 +297,12 @@
|
|||||||
{if count($addresses)}
|
{if count($addresses)}
|
||||||
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="120px"></col>
|
<col width="120px">
|
||||||
<col width="120px"></col>
|
<col width="120px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width="170px"></col>
|
<col width="170px">
|
||||||
<col width="70px"></col>
|
<col width="70px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th height="39px">{l s='Company'}</th>
|
<th height="39px">{l s='Company'}</th>
|
||||||
@@ -371,11 +371,11 @@
|
|||||||
{if $carts AND count($carts)}
|
{if $carts AND count($carts)}
|
||||||
<table cellspacing="0" cellpadding="0" class="table" style="width:100%">
|
<table cellspacing="0" cellpadding="0" class="table" style="width:100%">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
<col width="150px"></col>
|
<col width="150px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="70px"></col>
|
<col width="70px">
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th height="39px" class="center">{l s='ID'}</th>
|
<th height="39px" class="center">{l s='ID'}</th>
|
||||||
@@ -404,9 +404,9 @@
|
|||||||
<h2>{l s='Products'} ({count($interested)})</h2>
|
<h2>{l s='Products'} ({count($interested)})</h2>
|
||||||
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="10px"></col>
|
<col width="10px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
{foreach $interested as $key => $p}
|
{foreach $interested as $key => $p}
|
||||||
<tr {if $key %2}class="alt_row"{/if} style="cursor: pointer" onclick="document.location = '{$p['url']}'">
|
<tr {if $key %2}class="alt_row"{/if} style="cursor: pointer" onclick="document.location = '{$p['url']}'">
|
||||||
@@ -426,11 +426,11 @@
|
|||||||
<h2>{l s='Last connections'}</h2>
|
<h2>{l s='Last connections'}</h2>
|
||||||
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="150px"></col>
|
<col width="150px">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="150px"></col>
|
<col width="150px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th height="39px;">{l s='Date'}</th>
|
<th height="39px;">{l s='Date'}</th>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
{if $input['type'] == 'modules'}
|
{if $input['type'] == 'modules'}
|
||||||
<div style="{if !$form_id}display:none{/if}">
|
<div style="{if !$form_id}display:none{/if}">
|
||||||
<div class="separation"></div>
|
<div class="separation"></div>
|
||||||
<label>{l s='Modules restrictions:'}</label>
|
<label>{l s='Module restrictions:'}</label>
|
||||||
</div>
|
</div>
|
||||||
{elseif $input['type'] == 'group_discount_category'}
|
{elseif $input['type'] == 'group_discount_category'}
|
||||||
<div style="{if !$form_id}display:none{/if}">
|
<div style="{if !$form_id}display:none{/if}">
|
||||||
|
|||||||
@@ -44,14 +44,16 @@
|
|||||||
<p>{l s='To receive PrestaShop update warnings, you need to activate'} <b>allow_url_fopen</b> [<a href="http://www.php.net/manual/{$isoUser}/ref.filesystem.php">{l s='more info on php.net'}</a>]</p>
|
<p>{l s='To receive PrestaShop update warnings, you need to activate'} <b>allow_url_fopen</b> [<a href="http://www.php.net/manual/{$isoUser}/ref.filesystem.php">{l s='more info on php.net'}</a>]</p>
|
||||||
<p>{l s='If you don\'t know how to do this, please contact your hosting provider!'}</p><br />
|
<p>{l s='If you don\'t know how to do this, please contact your hosting provider!'}</p><br />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{* Screencast deprecated, but I keep the code in case it is updated later
|
||||||
{if $employee->bo_show_screencast}
|
{if $employee->bo_show_screencast}
|
||||||
<div id="adminpresentation" style="display:block;">
|
<div id="adminpresentation" style="display:block">
|
||||||
<h2>{l s='Video'}</h2>
|
<h2>{l s='Video'}</h2>
|
||||||
<div id="video">
|
<div id="video">
|
||||||
<a href="{$protocol}://screencasts.prestashop.com/v1.5/screencast.php?iso_lang={$isoUser}" id="screencast_fancybox"><img height="128" width="220" src="../img/admin/preview_fr.jpg" /><span class="mask-player"></span></a>
|
<a href="{$protocol}://screencasts.prestashop.com/v1.5/screencast.php?iso_lang={$isoUser}" id="screencast_fancybox"><img height="128" width="220" src="../img/admin/preview_fr.jpg" /><span class="mask-player"></span></a>
|
||||||
</div>
|
</div>
|
||||||
<div id="video-content">
|
<div id="video-content">
|
||||||
<p>{l s='Take part in the e-commerce adventure with PrestaShop, the fast, powerful, and customizable e-commerce solution. With more than 275 features, PrestaShop will help you create a world of opportunities without limits. Discover the solution that has already conquered more than 120,000 merchants worldwide!'}</p>
|
<p>{l s='Take part in the e-commerce adventure with PrestaShop, the fast, powerful, and customizable e-commerce solution. With more than 275 features, PrestaShop will help you create a world of opportunities without limits. Discover the solution that already powers more than 120,000 active stores worldwide!'}</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="footer_iframe_home">
|
<div id="footer_iframe_home">
|
||||||
<!--<a href="#">{l s='View more video tutorials'}</a>-->
|
<!--<a href="#">{l s='View more video tutorials'}</a>-->
|
||||||
@@ -95,6 +97,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{/if}
|
{/if}
|
||||||
|
*}
|
||||||
|
|
||||||
<h2>{l s='Quick links'}</h2>
|
<h2>{l s='Quick links'}</h2>
|
||||||
<ul class="F_list clearfix">
|
<ul class="F_list clearfix">
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
<div style="display: none">
|
<div style="display: none">
|
||||||
<div id="upload_file_import" style="padding-left: 10px; background-color: #EBEDF4; border: 1px solid #CCCED7">
|
<div id="upload_file_import" style="padding-left: 10px; background-color: #EBEDF4; border: 1px solid #CCCED7">
|
||||||
<div class="clear"> </div>
|
<div class="clear"> </div>
|
||||||
<form action="{$current}&token={$token}" method="POST" enctype="multipart/form-data">
|
<form action="{$current}&token={$token}" method="post" enctype="multipart/form-data">
|
||||||
<label class="clear" style="width:160px; text-align: left;">{l s='Select your CSV file'} </label>
|
<label class="clear" style="width:160px; text-align: left;">{l s='Select your CSV file'} </label>
|
||||||
<div class="margin-form" style="padding-left:190px;">
|
<div class="margin-form" style="padding-left:190px;">
|
||||||
<input name="file" type="file" />
|
<input name="file" type="file" />
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clear">
|
<div class="clear">
|
||||||
<br /><br />{l s='* Required field'}
|
<br /><br />{l s='*Required field'}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
{block name="override_tpl"}
|
{block name="override_tpl"}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var errorEmpty = "{l s='Please name your matching configuration to save.'}"
|
var errorEmpty = "{l s='Please name your matching configuration to save.'}"
|
||||||
|
var token = '{$token}';
|
||||||
</script>
|
</script>
|
||||||
<div id="container-customer">
|
<div id="container-customer">
|
||||||
<h2>{l s='View your data'}</h2>
|
<h2>{l s='View your data'}</h2>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<input type="radio" name="{$key}" id="{$key}_off" value="0" {if !$field['value']} checked="checked"{/if}{if isset($field['js']['off'])} {$field['js']['off']}{/if}/>
|
<input type="radio" name="{$key}" id="{$key}_off" value="0" {if !$field['value']} checked="checked"{/if}{if isset($field['js']['off'])} {$field['js']['off']}{/if}/>
|
||||||
<label class="t" for="{$key}_off"> {l s='No'}</label>
|
<label class="t" for="{$key}_off"> {l s='No'}</label>
|
||||||
{if !$field['mod_rewrite']}
|
{if !$field['mod_rewrite']}
|
||||||
<span class="warning_mod_rewrite">{l s='URL rewriting (mod_rewrite) is not active on your server. If you want to use Friendly URL you must activate this mod.'}</span>
|
<span class="warning_mod_rewrite">{l s='URL rewriting (mod_rewrite) is not active on your server. If you want to use Friendly URLs you must activate this mod.'}</span>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
{/if}
|
{/if}
|
||||||
{else}
|
{else}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
|
|
||||||
|
{if $add_permission eq '1'}
|
||||||
{if isset($logged_on_addons)}
|
{if isset($logged_on_addons)}
|
||||||
|
|
||||||
<!--start addons login-->
|
<!--start addons login-->
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
<!--start filter module-->
|
<!--start filter module-->
|
||||||
<style>.ac_results { border:1px solid #C2C4D9; }</style>
|
<style>.ac_results { border:1px solid #C2C4D9; }</style>
|
||||||
@@ -87,8 +87,9 @@
|
|||||||
|
|
||||||
<select name="module_type" id="module_type_filter" {if $showTypeModules ne 'allModules' && $showTypeModules ne ''}style="background-color:#49B2FF;color:white;"{/if}>
|
<select name="module_type" id="module_type_filter" {if $showTypeModules ne 'allModules' && $showTypeModules ne ''}style="background-color:#49B2FF;color:white;"{/if}>
|
||||||
<option value="allModules" {if $showTypeModules eq 'allModules'}selected="selected"{/if}>{l s='All Modules'}</option>
|
<option value="allModules" {if $showTypeModules eq 'allModules'}selected="selected"{/if}>{l s='All Modules'}</option>
|
||||||
<option value="nativeModules" {if $showTypeModules eq 'nativeModules'}selected="selected"{/if}>{l s='Native Modules'}</option>
|
<option value="nativeModules" {if $showTypeModules eq 'nativeModules'}selected="selected"{/if}>{l s='Free Modules'}</option>
|
||||||
<option value="partnerModules" {if $showTypeModules eq 'partnerModules'}selected="selected"{/if}>{l s='Partner Modules'}</option>
|
<option value="partnerModules" {if $showTypeModules eq 'partnerModules'}selected="selected"{/if}>{l s='Partner Modules (Free)'}</option>
|
||||||
|
<option value="mustHaveModules" {if $showTypeModules eq 'mustHaveModules'}selected="selected"{/if}>{l s='Must Have'}</option>
|
||||||
{if isset($logged_on_addons)}<option value="addonsModules" {if $showTypeModules eq 'addonsModules'}selected="selected"{/if}>{l s='Modules purchased on Addons'}</option>{/if}
|
{if isset($logged_on_addons)}<option value="addonsModules" {if $showTypeModules eq 'addonsModules'}selected="selected"{/if}>{l s='Modules purchased on Addons'}</option>{/if}
|
||||||
<optgroup label="{l s='Authors'}">
|
<optgroup label="{l s='Authors'}">
|
||||||
{foreach from=$list_modules_authors key=module_author item=status}
|
{foreach from=$list_modules_authors key=module_author item=status}
|
||||||
|
|||||||
@@ -28,14 +28,17 @@
|
|||||||
<div class="toolbarBox toolbarHead">
|
<div class="toolbarBox toolbarHead">
|
||||||
|
|
||||||
<ul class="cc_button">
|
<ul class="cc_button">
|
||||||
|
{if $add_permission eq '1'}
|
||||||
<li>
|
<li>
|
||||||
<a id="desc-module-new" class="toolbar_btn" href="#top_container" onclick="$('#module_install').slideToggle();" title="{l s='Add new module'}">
|
<a id="desc-module-new" class="toolbar_btn" href="#top_container" onclick="$('#module_install').slideToggle();" title="{l s='Add new module'}">
|
||||||
<span class="process-icon-new-module" ></span>
|
<span class="process-icon-new-module" ></span>
|
||||||
<div>{l s='Add new module'}</div>
|
<div>{l s='Add new module'}</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<div class="pageTitle">
|
<div class="pageTitle">
|
||||||
<h3><span id="current_obj" style="font-weight: normal;"><span class="breadcrumb item-0">Module</span> : <span class="breadcrumb item-1">{l s='List of modules'}</span></span></h3>
|
<h3><span id="current_obj" style="font-weight: normal;"><span class="breadcrumb item-0">Module</span> : <span class="breadcrumb item-1">{l s='List of modules'}</span></span></h3>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{if $add_permission eq '1'}
|
||||||
<div id="module_install" style="width:500px;margin-top:5px;{if !isset($smarty.post.downloadflag)}display: none;{/if}">
|
<div id="module_install" style="width:500px;margin-top:5px;{if !isset($smarty.post.downloadflag)}display: none;{/if}">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><img src="../img/admin/add.gif" alt="{l s='Add a new module'}" class="middle" /> {l s='Add a new module'}</legend>
|
<legend><img src="../img/admin/add.gif" alt="{l s='Add a new module'}" class="middle" /> {l s='Add a new module'}</legend>
|
||||||
@@ -63,5 +66,5 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,17 @@
|
|||||||
<td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td>
|
<td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="moduleDesc" id="anchor{$module->name|ucfirst}">
|
<div class="moduleDesc" id="anchor{$module->name|ucfirst}">
|
||||||
<h3>{$module->displayName}{if isset($module->id) && $module->id gt 0}<span class="setup{if isset($module->active) && $module->active eq 0} off{/if}">{l s='Installed'}</span>{else}<span class="setup non-install">{l s='Not installed'}</span>{/if}</h3>
|
<h3>{$module->displayName}
|
||||||
|
{if isset($module->type) && $module->type == 'addonsMustHave'}
|
||||||
|
<span class="setup must-have">{l s='Must Have'}</span>
|
||||||
|
{else}
|
||||||
|
{if isset($module->id) && $module->id gt 0}
|
||||||
|
<span class="setup{if isset($module->active) && $module->active eq 0} off{/if}">{l s='Installed'}</span>
|
||||||
|
{else}
|
||||||
|
<span class="setup non-install">{l s='Not installed'}</span>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</h3>
|
||||||
<div class="metadata">
|
<div class="metadata">
|
||||||
{if isset($module->author) && !empty($module->author)}
|
{if isset($module->author) && !empty($module->author)}
|
||||||
<dl class="">
|
<dl class="">
|
||||||
@@ -76,10 +86,20 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul id="list-action-button">
|
<ul id="list-action-button">
|
||||||
{if $module->id && isset($module->version_addons) && $module->version_addons}
|
{if isset($module->type) && $module->type == 'addonsMustHave'}
|
||||||
<li><a href="{$module->options.update_url}" class="button updated"><span>{l s='Update it!'}</span></a></li>
|
<li>
|
||||||
{/if}
|
<a href="{$module->addons_buy_url}" target="_blank" class="button updated"><span><img src="../img/admin/cart_addons.png"> {displayPrice price=$module->price currency=$module->id_currency}</span></a>
|
||||||
<li><a {if isset($module->id) && $module->id gt 0 && !empty($module->options.uninstall_onclick)}onclick="{$module->options.uninstall_onclick}"{/if} href="{if isset($module->id) && $module->id gt 0}{$module->options.uninstall_url}{else}{$module->options.install_url}{/if}" class="button installed"><span>{if isset($module->id) && $module->id gt 0}{l s='Uninstall'}{else}{l s='Install'}{/if}</span></a></li>
|
</li>
|
||||||
|
{else}
|
||||||
|
{if $module->id && isset($module->version_addons) && $module->version_addons}
|
||||||
|
<li><a href="{$module->options.update_url}" class="button updated"><span>{l s='Update it!'}</span></a></li>
|
||||||
|
{/if}
|
||||||
|
<li>
|
||||||
|
<a {if isset($module->id) && $module->id gt 0 && !empty($module->options.uninstall_onclick)}onclick="{$module->options.uninstall_onclick}"{/if} href="{if isset($module->id) && $module->id gt 0}{$module->options.uninstall_url}{else}{$module->options.install_url}{/if}" class="button installed">
|
||||||
|
<span>{if isset($module->id) && $module->id gt 0}{l s='Uninstall'}{else}{l s='Install'}{/if}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -72,11 +72,11 @@
|
|||||||
<a name="{$hook['name']}"/>
|
<a name="{$hook['name']}"/>
|
||||||
<table cellpadding="0" cellspacing="0" class="table widthfull space {if $hook['module_count'] >= 2} tableDnD{/if}" id="{$hook['id_hook']}">
|
<table cellpadding="0" cellspacing="0" class="table widthfull space {if $hook['module_count'] >= 2} tableDnD{/if}" id="{$hook['id_hook']}">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="10"></col>
|
<col width="10">
|
||||||
<col width="30"></col>
|
<col width="30">
|
||||||
<col width="40"></col>
|
<col width="40">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="50"></col>
|
<col width="50">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr class="nodrag nodrop"><th colspan="5"> {if $hook['module_count'] && $can_move}
|
<tr class="nodrag nodrop"><th colspan="5"> {if $hook['module_count'] && $can_move}
|
||||||
<input type="checkbox" id="Ghook{$hook['id_hook']}" style="margin-right: 2px;" onclick="hookCheckboxes({$hook['id_hook']}, 0, this)"/>
|
<input type="checkbox" id="Ghook{$hook['id_hook']}" style="margin-right: 2px;" onclick="hookCheckboxes({$hook['id_hook']}, 0, this)"/>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
{if $product.customizedDatas}
|
{if $product.customizedDatas}
|
||||||
<tr class="customized customized-{$product.id_order_detail}">
|
<tr class="customized customized-{$product.id_order_detail}">
|
||||||
<input type="hidden" class="edit_product_id_order_detail" value="{$product.id_order_detail}" />
|
<input type="hidden" class="edit_product_id_order_detail" value="{$product.id_order_detail}" />
|
||||||
<td align="center">{if ($product.image->id)}{$product.image_tag}{else}'--'{/if}</td>
|
<td align="center">{if isset($product.image) && $product.image->id}{$product.image_tag}{else}--{/if}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="index.php?controller=adminproducts&id_product={$product['product_id']}&updateproduct&token={getAdminToken tab='AdminProducts'}">
|
<a href="index.php?controller=adminproducts&id_product={$product['product_id']}&updateproduct&token={getAdminToken tab='AdminProducts'}">
|
||||||
<span class="productName">{$product['product_name']} - {l s='customized'}</span><br />
|
<span class="productName">{$product['product_name']} - {l s='customized'}</span><br />
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
<form method="POST" action="{$current_index}&viewOrder&id_order={$order->id|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
|
||||||
<label>{l s='Name'}</label>
|
<label>{l s='Name'}</label>
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
<input type="text" name="discount_name" value="" />
|
<input type="text" name="discount_name" value="" />
|
||||||
@@ -74,4 +74,4 @@
|
|||||||
<input class="button" type="submit" name="submitNewVoucher" value="{l s='Add'}" />
|
<input class="button" type="submit" name="submitNewVoucher" value="{l s='Add'}" />
|
||||||
<a href="#" id="cancel_add_voucher">{l s='Cancel'}</a>
|
<a href="#" id="cancel_add_voucher">{l s='Cancel'}</a>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
|
||||||
|
|||||||
@@ -82,12 +82,12 @@
|
|||||||
--
|
--
|
||||||
{else}
|
{else}
|
||||||
{displayPrice price=$document->total_paid_tax_incl currency=$currency->id}
|
{displayPrice price=$document->total_paid_tax_incl currency=$currency->id}
|
||||||
{if $document->getGlobalRestPaid()}
|
{if $document->getTotalPaid()}
|
||||||
<span style="color:red;font-weight:bold;">
|
<span style="color:red;font-weight:bold;">
|
||||||
{if $document->getGlobalRestPaid() >= 0}
|
{if $document->getRestPaid() > 0}
|
||||||
({displayPrice price=$document->getGlobalRestPaid() currency=$currency->id} {l s='not paid'})
|
({displayPrice price=$document->getRestPaid() currency=$currency->id} {l s='not paid'})
|
||||||
{else}
|
{else if $document->getRestPaid() < 0}
|
||||||
({displayPrice price=-$document->getGlobalRestPaid() currency=$currency->id} {l s='overpaid'})
|
({displayPrice price=-$document->getRestPaid() currency=$currency->id} {l s='overpaid'})
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -57,13 +57,43 @@
|
|||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['product_quantity_refunded']}</td>{/if}
|
{if ($order->hasBeenPaid())}
|
||||||
{if ($order->hasBeenDelivered())}<td align="center" class="productQuantity">{$product['product_quantity_return']}</td>{/if}
|
<td align="center" class="productQuantity">
|
||||||
|
{$product['product_quantity_refunded']}
|
||||||
|
{if count($product['refund_history'])}
|
||||||
|
<span class="tooltip">
|
||||||
|
<span class="tooltip_label tooltip_button">+</span>
|
||||||
|
<div class="tooltip_content">
|
||||||
|
<span class="title">{l s='Refund history'}</span>
|
||||||
|
{foreach $product['refund_history'] as $refund}
|
||||||
|
{l s='%1s - %2s' sprintf=[{dateFormat date=$refund.date_add}, {displayPrice price=$refund.amount_tax_incl}]}<br />
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
{/if}
|
||||||
|
{if $order->hasBeenDelivered() || $order->hasProductReturned()}
|
||||||
|
<td align="center" class="productQuantity">
|
||||||
|
{$product['product_quantity_return']}
|
||||||
|
{if count($product['return_history'])}
|
||||||
|
<span class="tooltip">
|
||||||
|
<span class="tooltip_label tooltip_button">+</span>
|
||||||
|
<div class="tooltip_content">
|
||||||
|
<span class="title">{l s='Return history'}</span>
|
||||||
|
{foreach $product['return_history'] as $return}
|
||||||
|
{l s='%1s - %2s - %3s' sprintf=[{dateFormat date=$return.date_add}, $return.product_quantity, $return.state]}<br />
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
{/if}
|
||||||
<td align="center" class="productQuantity product_stock">{$product['current_stock']}</td>
|
<td align="center" class="productQuantity product_stock">{$product['current_stock']}</td>
|
||||||
<td align="center" class="total_product">
|
<td align="center" class="total_product">
|
||||||
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
|
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2" style="display: none;" class="add_product_fields"> </th>
|
<td colspan="2" style="display: none;" class="add_product_fields"> </td>
|
||||||
<td align="center" class="cancelCheck standard_refund_fields current-edit" style="display:none">
|
<td align="center" class="cancelCheck standard_refund_fields current-edit" style="display:none">
|
||||||
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$product['product_quantity_return']}" />
|
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$product['product_quantity_return']}" />
|
||||||
<input type="hidden" name="totalQty" id="totalQty" value="{$product['product_quantity']}" />
|
<input type="hidden" name="totalQty" id="totalQty" value="{$product['product_quantity']}" />
|
||||||
|
|||||||
@@ -25,11 +25,11 @@
|
|||||||
*}
|
*}
|
||||||
<table class="table" width="100%" cellspacing="0" cellpadding="0" id="shipping_table">
|
<table class="table" width="100%" cellspacing="0" cellpadding="0" id="shipping_table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="15%"></col>
|
<col width="15%">
|
||||||
<col width="15%"></col>
|
<col width="15%">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="10%"></col>
|
<col width="10%">
|
||||||
<col width="20%"></col>
|
<col width="20%">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<span id="shipping_number_show">{if $line.url && $line.tracking_number}<a href="{$line.url|replace:'@':$line.tracking_number}">{$line.tracking_number}</a>{else}{$line.tracking_number}{/if}</span>
|
<span id="shipping_number_show">{if $line.url && $line.tracking_number}<a href="{$line.url|replace:'@':$line.tracking_number}">{$line.tracking_number}</a>{else}{$line.tracking_number}{/if}</span>
|
||||||
{if $line.can_edit}
|
{if $line.can_edit}
|
||||||
<form style="display: inline;" method="POST" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id|escape:'htmlall':'UTF-8'}">
|
<form style="display: inline;" method="post" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id|escape:'htmlall':'UTF-8'}">
|
||||||
<span class="shipping_number_edit" style="display:none;">
|
<span class="shipping_number_edit" style="display:none;">
|
||||||
<input type="hidden" name="id_order_carrier" value="{$line.id_order_carrier|htmlentities}" />
|
<input type="hidden" name="id_order_carrier" value="{$line.id_order_carrier|htmlentities}" />
|
||||||
<input type="text" name="tracking_number" value="{$line.tracking_number|htmlentities}" />
|
<input type="text" name="tracking_number" value="{$line.tracking_number|htmlentities}" />
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
$('#product').typeWatch({
|
$('#product').typeWatch({
|
||||||
captureLength: 1,
|
captureLength: 1,
|
||||||
highlight: true,
|
highlight: true,
|
||||||
wait: 100,
|
wait: 750,
|
||||||
callback: function(){ searchProducts(); }
|
callback: function(){ searchProducts(); }
|
||||||
});
|
});
|
||||||
$('#payment_module_name').change(function() {
|
$('#payment_module_name').change(function() {
|
||||||
@@ -69,10 +69,10 @@
|
|||||||
$('#id_currency').change(function() {
|
$('#id_currency').change(function() {
|
||||||
updateCurrency();
|
updateCurrency();
|
||||||
});
|
});
|
||||||
$('#id_lang').change(function() {
|
$('#id_lang').change(function(){
|
||||||
updateLang();
|
updateLang();
|
||||||
});
|
});
|
||||||
$('#delivery_option,#carrier_recycled_package,#order_gift,#gift_message,#id_address_delivery').change(function() {
|
$('#delivery_option,#carrier_recycled_package,#order_gift,#gift_message').change(function() {
|
||||||
updateDeliveryOption();
|
updateDeliveryOption();
|
||||||
});
|
});
|
||||||
$('#shipping_price').change(function() {
|
$('#shipping_price').change(function() {
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
$('.delete_product').live('click', function(e) {
|
$('.delete_product').live('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var to_delete = $(this).attr('rel').split('_');
|
var to_delete = $(this).attr('rel').split('_');
|
||||||
deleteProduct(to_delete[1], to_delete[2]);
|
deleteProduct(to_delete[1], to_delete[2], to_delete[3]);
|
||||||
});
|
});
|
||||||
$('.delete_discount').live('click', function(e) {
|
$('.delete_discount').live('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.duplicate_order').live('click', function(e) {
|
$('.duplicate_order').live('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
duplicateOrder($(this).attr('rel'));
|
duplicateOrder($(this).attr('rel'));
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
if ($(this).val() != cart_quantity[$(this).attr('rel')])
|
if ($(this).val() != cart_quantity[$(this).attr('rel')])
|
||||||
{
|
{
|
||||||
var product = $(this).attr('rel').split('_');
|
var product = $(this).attr('rel').split('_');
|
||||||
updateQty(product[0], product[1], $(this).val() - cart_quantity[$(this).attr('rel')]);
|
updateQty(product[0], product[1], product[2], $(this).val() - cart_quantity[$(this).attr('rel')]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.increaseqty_product, .decreaseqty_product').live('click', function(e) {
|
$('.increaseqty_product, .decreaseqty_product').live('click', function(e) {
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
var sign = '';
|
var sign = '';
|
||||||
if ($(this).hasClass('decreaseqty_product'))
|
if ($(this).hasClass('decreaseqty_product'))
|
||||||
sign = '-';
|
sign = '-';
|
||||||
updateQty(product[0], product[1], sign+1);
|
updateQty(product[0], product[1],product[2], sign+1);
|
||||||
});
|
});
|
||||||
$('#id_product').live('keydown', function(e) {
|
$('#id_product').live('keydown', function(e) {
|
||||||
$(this).click();
|
$(this).click();
|
||||||
@@ -234,10 +234,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
/*$('.fancybox').live('click', function(e) {
|
|
||||||
$(this).fancybox().trigger('click');
|
|
||||||
return false;
|
|
||||||
});*/
|
|
||||||
resetBind();
|
resetBind();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -252,7 +248,7 @@
|
|||||||
onClosed: useCart(id_cart)
|
onClosed: useCart(id_cart)
|
||||||
});*/
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_cart_rule(id_cart_rule)
|
function add_cart_rule(id_cart_rule)
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -355,7 +351,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')}",
|
||||||
async: true,
|
async: false,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
ajax: "1",
|
ajax: "1",
|
||||||
@@ -371,12 +367,12 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSummary()
|
function getSummary()
|
||||||
{
|
{
|
||||||
useCart(id_cart);
|
useCart(id_cart);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteVoucher(id_cart_rule)
|
function deleteVoucher(id_cart_rule)
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -400,7 +396,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteProduct(id_product, id_product_attribute)
|
function deleteProduct(id_product, id_product_attribute, id_customization)
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
@@ -414,6 +410,7 @@
|
|||||||
action: "deleteProduct",
|
action: "deleteProduct",
|
||||||
id_product: id_product,
|
id_product: id_product,
|
||||||
id_product_attribute: id_product_attribute,
|
id_product_attribute: id_product_attribute,
|
||||||
|
id_customization: id_customization,
|
||||||
id_cart: id_cart,
|
id_cart: id_cart,
|
||||||
id_customer: id_customer
|
id_customer: id_customer
|
||||||
},
|
},
|
||||||
@@ -470,7 +467,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url : "{$link->getAdminLink('AdminCarts')}",
|
url : "{$link->getAdminLink('AdminCarts')}",
|
||||||
async: true,
|
async: false,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
ajax: "1",
|
ajax: "1",
|
||||||
@@ -552,7 +549,7 @@
|
|||||||
var attributes_html = '';
|
var attributes_html = '';
|
||||||
var customization_html = '';
|
var customization_html = '';
|
||||||
stock = {};
|
stock = {};
|
||||||
|
|
||||||
if(res.found)
|
if(res.found)
|
||||||
{
|
{
|
||||||
$('#products_err').hide();
|
$('#products_err').hide();
|
||||||
@@ -563,14 +560,15 @@
|
|||||||
products_found += '<option '+(this.combinations.length > 0 ? 'rel="'+this.qty_in_stock+'"' : '')+' value="'+this.id_product+'">'+this.name+(this.combinations.length == 0 ? ' - '+this.formatted_price : '')+'</option>';
|
products_found += '<option '+(this.combinations.length > 0 ? 'rel="'+this.qty_in_stock+'"' : '')+' value="'+this.id_product+'">'+this.name+(this.combinations.length == 0 ? ' - '+this.formatted_price : '')+'</option>';
|
||||||
attributes_html += '<select class="id_product_attribute" id="ipa_'+this.id_product+'" style="display:none;">';
|
attributes_html += '<select class="id_product_attribute" id="ipa_'+this.id_product+'" style="display:none;">';
|
||||||
var id_product = this.id_product;
|
var id_product = this.id_product;
|
||||||
|
stock[id_product] = new Array();
|
||||||
if (this.customizable == '1')
|
if (this.customizable == '1')
|
||||||
{
|
{
|
||||||
customization_html += '<fieldset class="width3"><legend>{l s='Customization'}</legend><form id="customization_'+id_product+'" class="id_customization" method="post" enctype="multipart/form-data" action="'+admin_cart_link+'" style="display:none;">';
|
customization_html += '<fieldset class="width3"><legend>{l s='Customization'}</legend><form id="customization_'+id_product+'" class="id_customization" method="post" enctype="multipart/form-data" action="'+admin_cart_link+'" style="display:none;">';
|
||||||
customization_html += '<input type="hidden" name="id_product" value="'+id_product+'"';
|
customization_html += '<input type="hidden" name="id_product" value="'+id_product+'" />';
|
||||||
customization_html += '<input type="hidden" name="id_cart" value="'+id_cart+'"';
|
customization_html += '<input type="hidden" name="id_cart" value="'+id_cart+'" />';
|
||||||
customization_html += '<input type="hidden" name="action" value="updateCustomizationFields"';
|
customization_html += '<input type="hidden" name="action" value="updateCustomizationFields" />';
|
||||||
customization_html += '<input type="hidden" name="id_customer" value="'+id_customer+'"';
|
customization_html += '<input type="hidden" name="id_customer" value="'+id_customer+'" />';
|
||||||
customization_html += '<input type="hidden" name="ajax" value="1"';
|
customization_html += '<input type="hidden" name="ajax" value="1" />';
|
||||||
$.each(this.customization_fields, function() {
|
$.each(this.customization_fields, function() {
|
||||||
customization_html += '<p><label for="customization_'+id_product+'_'+this.id_customization_field+'">';
|
customization_html += '<p><label for="customization_'+id_product+'_'+this.id_customization_field+'">';
|
||||||
if (this.required == 1)
|
if (this.required == 1)
|
||||||
@@ -584,13 +582,13 @@
|
|||||||
});
|
});
|
||||||
customization_html += '</fieldset></form>';
|
customization_html += '</fieldset></form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each(this.combinations, function() {
|
$.each(this.combinations, function() {
|
||||||
attributes_html += '<option rel="'+this.qty_in_stock+'" '+(this.default_on == 1 ? 'selected="selected"' : '')+' value="'+this.id_product_attribute+'">'+this.attributes+' - '+this.formatted_price+'</option>';
|
attributes_html += '<option rel="'+this.qty_in_stock+'" '+(this.default_on == 1 ? 'selected="selected"' : '')+' value="'+this.id_product_attribute+'">'+this.attributes+' - '+this.formatted_price+'</option>';
|
||||||
|
stock[id_product][this.id_product_attribute] = this.qty_in_stock;
|
||||||
});
|
});
|
||||||
|
|
||||||
stock[this.id_product] = this.stock;
|
|
||||||
|
|
||||||
|
stock[this.id_product][0] = this.stock[0];
|
||||||
attributes_html += '</select>';
|
attributes_html += '</select>';
|
||||||
});
|
});
|
||||||
products_found += '</select>';
|
products_found += '</select>';
|
||||||
@@ -611,7 +609,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_product_customizations()
|
function display_product_customizations()
|
||||||
{
|
{
|
||||||
if ($('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).children().length === 0)
|
if ($('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).children().length === 0)
|
||||||
@@ -624,7 +622,7 @@
|
|||||||
$('#products_found #customization_list').css('height',$('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).height()+95+'px');
|
$('#products_found #customization_list').css('height',$('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).height()+95+'px');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_product_attributes()
|
function display_product_attributes()
|
||||||
{
|
{
|
||||||
if ($('#ipa_'+$('#id_product option:selected').val()+' option').length === 0)
|
if ($('#ipa_'+$('#id_product option:selected').val()+' option').length === 0)
|
||||||
@@ -637,17 +635,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCartProducts(products)
|
function updateCartProducts(products, gifts)
|
||||||
{
|
{
|
||||||
var cart_content = '';
|
var cart_content = '';
|
||||||
$.each(products, function() {
|
$.each(products, function() {
|
||||||
cart_quantity[this.id_product+'_'+this.id_product_attribute] = this.cart_quantity;
|
cart_quantity[Number(this.id_product)+'_'+Number(this.id_product_attribute)+'_'+Number(this.id_customization)] = this.cart_quantity;
|
||||||
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" size="7" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="'+this.price+'" /> <span class="currency_sign"></span></td><td>';
|
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" size="7" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="'+this.price+'" /> <span class="currency_sign"></span></td><td>';
|
||||||
cart_content += '<div style="float:left;"><a href="#" class="increaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'" ><img src="../img/admin/up.gif" /></a><br /><a href="#" class="decreaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'"><img src="../img/admin/down.gif" /></a></div>';
|
cart_content += '<div style="float:left;"><a href="#" class="increaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><img src="../img/admin/up.gif" /></a><br /><a href="#" class="decreaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'"><img src="../img/admin/down.gif" /></a></div>';
|
||||||
cart_content += '<div style="float:left;"><input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="cart_quantity" size="2" value="'+this.cart_quantity+'" />';
|
cart_content += '<div style="float:left;"><input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" class="cart_quantity" size="2" value="'+this.cart_quantity+'" />';
|
||||||
cart_content += '<a href="#" class="delete_product" rel="delete_'+this.id_product+'_'+this.id_product_attribute+'" ><img src="../img/admin/delete.gif" /></a>';
|
cart_content += '<a href="#" class="delete_product" rel="delete_'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><img src="../img/admin/delete.gif" /></a>';
|
||||||
cart_content += '</div></td><td>'+this.total+' <span class="currency_sign"></span></td></tr>';
|
cart_content += '</div></td><td>'+this.total+' <span class="currency_sign"></span></td></tr>';
|
||||||
});
|
});
|
||||||
|
$.each(gifts, function() {
|
||||||
|
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td>';
|
||||||
|
cart_content += '<td>{l s='Gift !'}</td><td>'+this.cart_quantity+'</td><td>{l s='Gift !'}</td></tr>';
|
||||||
|
});
|
||||||
$('#customer_cart tbody').html(cart_content);
|
$('#customer_cart tbody').html(cart_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,7 +676,7 @@
|
|||||||
|
|
||||||
function displaySummary(jsonSummary)
|
function displaySummary(jsonSummary)
|
||||||
{
|
{
|
||||||
updateCartProducts(jsonSummary.summary.products);
|
updateCartProducts(jsonSummary.summary.products, jsonSummary.summary.gift_products);
|
||||||
updateCartVouchers(jsonSummary.summary.discounts);
|
updateCartVouchers(jsonSummary.summary.discounts);
|
||||||
updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice);
|
updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice);
|
||||||
|
|
||||||
@@ -682,7 +684,7 @@
|
|||||||
$('#carriers_part,#summary_part').hide();
|
$('#carriers_part,#summary_part').hide();
|
||||||
else
|
else
|
||||||
$('#carriers_part,#summary_part').show();
|
$('#carriers_part,#summary_part').show();
|
||||||
|
|
||||||
updateDeliveryOptionList(jsonSummary.delivery_option_list);
|
updateDeliveryOptionList(jsonSummary.delivery_option_list);
|
||||||
|
|
||||||
if (jsonSummary.cart.gift == 1)
|
if (jsonSummary.cart.gift == 1)
|
||||||
@@ -697,7 +699,7 @@
|
|||||||
$('#free_shipping').attr('checked', true);
|
$('#free_shipping').attr('checked', true);
|
||||||
else
|
else
|
||||||
$('#free_shipping').removeAttr('checked');
|
$('#free_shipping').removeAttr('checked');
|
||||||
|
|
||||||
$('#gift_message').html(jsonSummary.cart.gift_message);
|
$('#gift_message').html(jsonSummary.cart.gift_message);
|
||||||
if(!changed_shipping_price)
|
if(!changed_shipping_price)
|
||||||
$('#shipping_price').html('<b>'+jsonSummary.summary.total_shipping+'</b>');
|
$('#shipping_price').html('<b>'+jsonSummary.summary.total_shipping+'</b>');
|
||||||
@@ -722,7 +724,7 @@
|
|||||||
resetBind();
|
resetBind();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateQty(id_product, id_product_attribute, qty)
|
function updateQty(id_product, id_product_attribute, id_customization, qty)
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
@@ -736,6 +738,7 @@
|
|||||||
action: "updateQty",
|
action: "updateQty",
|
||||||
id_product: id_product,
|
id_product: id_product,
|
||||||
id_product_attribute: id_product_attribute,
|
id_product_attribute: id_product_attribute,
|
||||||
|
id_customization: id_customization,
|
||||||
qty: qty,
|
qty: qty,
|
||||||
id_customer: id_customer,
|
id_customer: id_customer,
|
||||||
id_cart: id_cart,
|
id_cart: id_cart,
|
||||||
@@ -773,7 +776,7 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#products_err').hide();
|
$('#products_err').hide();
|
||||||
updateQty(id_product, $('#ipa_'+id_product+' option:selected').val(), $('#qty').val());
|
updateQty(id_product, $('#ipa_'+id_product+' option:selected').val(), 0, $('#qty').val());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,7 +882,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAddressesList(addresses, id_address_delivery, id_address_invoice)
|
function updateAddressesList(addresses, id_address_delivery, id_address_invoice)
|
||||||
{
|
{
|
||||||
var addresses_delivery_options = '';
|
var addresses_delivery_options = '';
|
||||||
@@ -905,7 +908,7 @@
|
|||||||
$('#addresses_err').hide();
|
$('#addresses_err').hide();
|
||||||
$('#address_delivery, #address_invoice').show();
|
$('#address_delivery, #address_invoice').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#id_address_delivery').html(addresses_delivery_options);
|
$('#id_address_delivery').html(addresses_delivery_options);
|
||||||
$('#id_address_invoice').html(addresses_invoice_options);
|
$('#id_address_invoice').html(addresses_invoice_options);
|
||||||
$('#address_delivery_detail').html(address_delivery_detail);
|
$('#address_delivery_detail').html(address_delivery_detail);
|
||||||
@@ -932,6 +935,7 @@
|
|||||||
success : function(res)
|
success : function(res)
|
||||||
{
|
{
|
||||||
displaySummary(res);
|
displaySummary(res);
|
||||||
|
updateDeliveryOption();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -990,12 +994,12 @@
|
|||||||
<div>
|
<div>
|
||||||
<table cellspacing="0" cellpadding="0" class="table width5" id="customer_cart">
|
<table cellspacing="0" cellpadding="0" class="table width5" id="customer_cart">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="90px"></col>
|
<col width="90px">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -1042,10 +1046,10 @@
|
|||||||
<h3>{l s='Carts:'}</h3>
|
<h3>{l s='Carts:'}</h3>
|
||||||
<table cellspacing="0" cellpadding="0" class="table width5">
|
<table cellspacing="0" cellpadding="0" class="table width5">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="10px"></col>
|
<col width="10px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="70px"></col>
|
<col width="70px">
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -1063,13 +1067,13 @@
|
|||||||
<h3>{l s='Orders:'}</h3>
|
<h3>{l s='Orders:'}</h3>
|
||||||
<table cellspacing="0" cellpadding="0" class="table width5">
|
<table cellspacing="0" cellpadding="0" class="table width5">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="10px"></col>
|
<col width="10px">
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="90px"></col>
|
<col width="90px">
|
||||||
<col width="100px"></col>
|
<col width="100px">
|
||||||
<col width="250px"></col>
|
<col width="250px">
|
||||||
<col width="50px"></col>
|
<col width="50px">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -1215,3 +1219,4 @@
|
|||||||
<div id="loader">
|
<div id="loader">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -121,10 +121,10 @@
|
|||||||
<!-- History of status -->
|
<!-- History of status -->
|
||||||
<table cellspacing="0" cellpadding="0" class="table history-status" style="width: 100%;">
|
<table cellspacing="0" cellpadding="0" class="table history-status" style="width: 100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="1%"></col>
|
<col width="1%">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="20%"></col>
|
<col width="20%">
|
||||||
<col width="20%"></col>
|
<col width="20%">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
{foreach from=$history item=row key=key}
|
{foreach from=$history item=row key=key}
|
||||||
{if ($key == 0)}
|
{if ($key == 0)}
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
{if ($customer->isGuest())}
|
{if ($customer->isGuest())}
|
||||||
{l s='This order has been placed by a guest.'}
|
{l s='This order has been placed by a guest.'}
|
||||||
{if (!Customer::customerExists($customer->email))}
|
{if (!Customer::customerExists($customer->email))}
|
||||||
<form method="POST" action="index.php?tab=AdminCustomers&id_customer={$customer->id}&token={getAdminToken tab='AdminCustomers'}">
|
<form method="post" action="index.php?tab=AdminCustomers&id_customer={$customer->id}&token={getAdminToken tab='AdminCustomers'}">
|
||||||
<input type="hidden" name="id_lang" value="{$order->id_lang}" />
|
<input type="hidden" name="id_lang" value="{$order->id_lang}" />
|
||||||
<p class="center"><input class="button" type="submit" name="submitGuestToCustomer" value="{l s='Transform guest into customer'}" /></p>
|
<p class="center"><input class="button" type="submit" name="submitGuestToCustomer" value="{l s='Transform guest into customer'}" /></p>
|
||||||
{l s='This feature will generate a random password and send an e-mail to the customer'}
|
{l s='This feature will generate a random password and send an e-mail to the customer'}
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="10%">
|
<th width="10%">
|
||||||
{l s='Order n°'}
|
{l s='Order no.'}
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
{l s='Status'}
|
{l s='Status'}
|
||||||
@@ -260,7 +260,7 @@
|
|||||||
<legend><img src="../img/admin/money.gif" /> {l s='Payment'}</legend>
|
<legend><img src="../img/admin/money.gif" /> {l s='Payment'}</legend>
|
||||||
|
|
||||||
{if (!$order->valid && sizeof($currencies) > 1)}
|
{if (!$order->valid && sizeof($currencies) > 1)}
|
||||||
<form method="post" action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
<form method="post" action="{$currentIndex}&viewOrder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
||||||
<p class="warn">{l s='Don\'t forget to update your conversion rate before make this change.'}</p>
|
<p class="warn">{l s='Don\'t forget to update your conversion rate before make this change.'}</p>
|
||||||
<label>{l s='Don\'t forget to update your conversion rate before make this change.'}</label>
|
<label>{l s='Don\'t forget to update your conversion rate before make this change.'}</label>
|
||||||
<select name="new_currency">
|
<select name="new_currency">
|
||||||
@@ -272,7 +272,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<input type="submit" class="button" name="submitChangeCurrency" value="{l s='Change'}" />
|
<input type="submit" class="button" name="submitChangeCurrency" value="{l s='Change'}" />
|
||||||
</form>
|
</form>
|
||||||
<hr />
|
<hr class="clear"/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if count($order->getOrderPayments()) > 0}
|
{if count($order->getOrderPayments()) > 0}
|
||||||
@@ -293,15 +293,15 @@
|
|||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<form id="formAddPayment" method="post" action="{$current_index}&vieworder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
<form id="formAddPayment" method="post" action="{$current_index}&vieworder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
||||||
<table class="table" width="100%" cellspacing="0" cellpadding="0">
|
<table class="table" width="100%" cellspacing="0" cellpadding="0">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="15%"></col>
|
<col width="15%">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="20%"></col>
|
<col width="20%">
|
||||||
<col width="10%"></col>
|
<col width="10%">
|
||||||
<col width="10%"></col>
|
<col width="10%">
|
||||||
<col width="1%"></col>
|
<col width="1%">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -471,9 +471,9 @@
|
|||||||
<td>{$line.type}</td>
|
<td>{$line.type}</td>
|
||||||
<td>{$line.state_name}</td>
|
<td>{$line.state_name}</td>
|
||||||
<td>
|
<td>
|
||||||
<span id="shipping_number_show">{if isset($line.url) && isset($line.tracking_number)}<a href="{$line.url|replace:'@':$line.tracking_number}">{$line.tracking_number}</a>{else if isset($line.tracking_number)}{$line.tracking_number}{/if}</span>
|
<span id="shipping_number_show">{if isset($line.url) && isset($line.tracking_number)}<a href="{$line.url|replace:'@':$line.tracking_number}">{$line.tracking_number}</a>{elseif isset($line.tracking_number)}{$line.tracking_number}{/if}</span>
|
||||||
{if $line.can_edit}
|
{if $line.can_edit}
|
||||||
<form style="display: inline;" method="POST" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&id_order_invoice={if $line.id_order_invoice}{$line.id_order_invoice|escape:'htmlall':'UTF-8'}{else}0{/if}&id_carrier={if $line.id_carrier}{$line.id_carrier|escape:'htmlall':'UTF-8'}{else}0{/if}">
|
<form style="display: inline;" method="post" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id}&id_order_invoice={if $line.id_order_invoice}{$line.id_order_invoice|escape:'htmlall':'UTF-8'}{else}0{/if}&id_carrier={if $line.id_carrier}{$line.id_carrier|escape:'htmlall':'UTF-8'}{else}0{/if}">
|
||||||
<span class="shipping_number_edit" style="display:none;">
|
<span class="shipping_number_edit" style="display:none;">
|
||||||
<input type="text" name="tracking_number" value="{$line.tracking_number|htmlentities}" />
|
<input type="text" name="tracking_number" value="{$line.tracking_number|htmlentities}" />
|
||||||
<input type="submit" class="button" name="submitShippingNumber" value="{l s='Update'}" />
|
<input type="submit" class="button" name="submitShippingNumber" value="{l s='Update'}" />
|
||||||
@@ -504,13 +504,13 @@
|
|||||||
<div class="container-command container-command-top-spacing">
|
<div class="container-command container-command-top-spacing">
|
||||||
<!-- Addresses -->
|
<!-- Addresses -->
|
||||||
{if !$order->isVirtual()}
|
{if !$order->isVirtual()}
|
||||||
<div style="width: 49%; float:left;"></contact>
|
<div style="width: 49%; float:left;">
|
||||||
<!-- Shipping address -->
|
<!-- Shipping address -->
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><img src="../img/admin/delivery.gif" alt="{l s='Shipping address'}" />{l s='Shipping address'}</legend>
|
<legend><img src="../img/admin/delivery.gif" alt="{l s='Shipping address'}" />{l s='Shipping address'}</legend>
|
||||||
|
|
||||||
{if $can_edit}
|
{if $can_edit}
|
||||||
<form method="POST" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}">
|
<form method="post" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id}">
|
||||||
<div style="margin-bottom:5px;">
|
<div style="margin-bottom:5px;">
|
||||||
<p>
|
<p>
|
||||||
<select name="id_address">
|
<select name="id_address">
|
||||||
@@ -534,13 +534,13 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div style="width: 49%; float:right;"></contact>
|
<div style="width: 49%; float:right;">
|
||||||
<!-- Invoice address -->
|
<!-- Invoice address -->
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><img src="../img/admin/invoice.gif" alt="{l s='Invoice address'}" />{l s='Invoice address'}</legend>
|
<legend><img src="../img/admin/invoice.gif" alt="{l s='Invoice address'}" />{l s='Invoice address'}</legend>
|
||||||
|
|
||||||
{if $can_edit}
|
{if $can_edit}
|
||||||
<form method="POST" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}">
|
<form method="post" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id}">
|
||||||
<div style="margin-bottom:5px;">
|
<div style="margin-bottom:5px;">
|
||||||
<p>
|
<p>
|
||||||
<select name="id_address">
|
<select name="id_address">
|
||||||
@@ -565,7 +565,7 @@
|
|||||||
<div class="clear" style="margin-bottom: 10px;"></div>
|
<div class="clear" style="margin-bottom: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form style="width: 98%" class="container-command-top-spacing" action="{$current_index}&vieworder&token={$smarty.get.token}" method="post" onsubmit="return orderDeleteProduct('{l s='Cannot return this product'}', '{l s='Quantity to cancel is greater than quantity available'}');">
|
<form style="width: 98%" class="container-command-top-spacing" action="{$current_index}&vieworder&token={$smarty.get.token}&id_order={$order->id}" method="post" onsubmit="return orderDeleteProduct('{l s='Cannot return this product'}', '{l s='Quantity to cancel is greater than quantity available'}');">
|
||||||
<input type="hidden" name="id_order" value="{$order->id}" />
|
<input type="hidden" name="id_order" value="{$order->id}" />
|
||||||
<fieldset style="width: 100%; ">
|
<fieldset style="width: 100%; ">
|
||||||
<div style="display: none">
|
<div style="display: none">
|
||||||
@@ -590,7 +590,7 @@
|
|||||||
<th style="width: 15%; text-align: center">{l s='Unit Price'} <sup>*</sup></th>
|
<th style="width: 15%; text-align: center">{l s='Unit Price'} <sup>*</sup></th>
|
||||||
<th style="width: 4%; text-align: center">{l s='Qty'}</th>
|
<th style="width: 4%; text-align: center">{l s='Qty'}</th>
|
||||||
{if ($order->hasBeenPaid())}<th style="width: 3%; text-align: center">{l s='Refunded'}</th>{/if}
|
{if ($order->hasBeenPaid())}<th style="width: 3%; text-align: center">{l s='Refunded'}</th>{/if}
|
||||||
{if ($order->hasBeenDelivered())}<th style="width: 3%; text-align: center">{l s='Returned'}</th>{/if}
|
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}<th style="width: 3%; text-align: center">{l s='Returned'}</th>{/if}
|
||||||
<th style="width: 10%; text-align: center">{l s='Available quantity'}</th>
|
<th style="width: 10%; text-align: center">{l s='Available quantity'}</th>
|
||||||
<th style="width: 10%; text-align: center">{l s='Total'} <sup>*</sup></th>
|
<th style="width: 10%; text-align: center">{l s='Total'} <sup>*</sup></th>
|
||||||
<th colspan="2" style="display: none;" class="add_product_fields"> </th>
|
<th colspan="2" style="display: none;" class="add_product_fields"> </th>
|
||||||
@@ -690,7 +690,7 @@
|
|||||||
</td>
|
</td>
|
||||||
{if $can_edit}
|
{if $can_edit}
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<a href="{$current_index}&submitDeleteVoucher&id_order_cart_rule={$discount['id_order_cart_rule']}&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}"><img src="../img/admin/delete.gif" alt="{l s='Delete voucher'}" /></a>
|
<a href="{$current_index}&submitDeleteVoucher&id_order_cart_rule={$discount['id_order_cart_rule']}&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}"><img src="../img/admin/delete.gif" alt="{l s='Delete voucher'}" /></a>
|
||||||
</td>
|
</td>
|
||||||
{/if}
|
{/if}
|
||||||
</tr>
|
</tr>
|
||||||
@@ -714,22 +714,23 @@
|
|||||||
|
|
||||||
<div style="clear:both; height:15px;"> </div>
|
<div style="clear:both; height:15px;"> </div>
|
||||||
<div style="float: right; width: 160px; display: none;" class="standard_refund_fields">
|
<div style="float: right; width: 160px; display: none;" class="standard_refund_fields">
|
||||||
{if ($order->hasBeenDelivered() && Configuration::get('PS_ORDER_RETURN'))}
|
{if ($order->hasBeenDelivered() && Configuration::get('PS_ORDER_RETURN'))}
|
||||||
<input type="checkbox" id="reinjectQuantities" name="reinjectQuantities" class="button" /> <label for="reinjectQuantities" style="float:none; font-weight:normal;">{l s='Re-stock products'}</label><br />
|
<input type="checkbox" id="reinjectQuantities" name="reinjectQuantities" class="button" /> <label for="reinjectQuantities" style="float:none; font-weight:normal;">{l s='Re-stock products'}</label><br />
|
||||||
{/if}
|
{/if}
|
||||||
{if ((!$order->hasBeenDelivered() && $order->hasBeenPaid()) || ($order->hasBeenDelivered() && Configuration::get('PS_ORDER_RETURN')))}
|
{if ((!$order->hasBeenDelivered() && $order->hasBeenPaid()) || ($order->hasBeenDelivered() && Configuration::get('PS_ORDER_RETURN')))}
|
||||||
<input type="checkbox" id="generateCreditSlip" name="generateCreditSlip" class="button" onclick="toggleShippingCost(this)" /> <label for="generateCreditSlip" style="float:none; font-weight:normal;">{l s='Generate a credit slip'}</label><br />
|
<input type="checkbox" id="generateCreditSlip" name="generateCreditSlip" class="button" onclick="toggleShippingCost(this)" /> <label for="generateCreditSlip" style="float:none; font-weight:normal;">{l s='Generate a credit slip'}</label><br />
|
||||||
<input type="checkbox" id="generateDiscount" name="generateDiscount" class="button" onclick="toggleShippingCost(this)" /> <label for="generateDiscount" style="float:none; font-weight:normal;">{l s='Generate a voucher'}</label><br />
|
<input type="checkbox" id="generateDiscount" name="generateDiscount" class="button" onclick="toggleShippingCost(this)" /> <label for="generateDiscount" style="float:none; font-weight:normal;">{l s='Generate a voucher'}</label><br />
|
||||||
<span id="spanShippingBack" style="display:none;"><input type="checkbox" id="shippingBack" name="shippingBack" class="button" /> <label for="shippingBack" style="float:none; font-weight:normal;">{l s='Repay shipping costs'}</label><br /></span>
|
<span id="spanShippingBack" style="display:none;"><input type="checkbox" id="shippingBack" name="shippingBack" class="button" /> <label for="shippingBack" style="float:none; font-weight:normal;">{l s='Repay shipping costs'}</label><br /></span>
|
||||||
{/if}
|
{/if}
|
||||||
{if (!$order->hasBeenDelivered() || ($order->hasBeenDelivered() && Configuration::get('PS_ORDER_RETURN')))}
|
{if (!$order->hasBeenDelivered() || ($order->hasBeenDelivered() && Configuration::get('PS_ORDER_RETURN')))}
|
||||||
<div style="text-align:center; margin-top:5px;">
|
<div style="text-align:center; margin-top:5px;">
|
||||||
<input type="submit" name="cancelProduct" value="{if $order->hasBeenDelivered()}{l s='Return products'}{elseif $order->hasBeenPaid()}{l s='Refund products'}{else}{l s='Cancel products'}{/if}" class="button" style="margin-top:8px;" />
|
<input type="submit" name="cancelProduct" value="{if $order->hasBeenDelivered()}{l s='Return products'}{elseif $order->hasBeenPaid()}{l s='Refund products'}{else}{l s='Cancel products'}{/if}" class="button" style="margin-top:8px;" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div style="float: right; width: 160px; display: none;" class="partial_refund_fields">
|
<div style="float: right; width: 160px; display:none;" class="partial_refund_fields">
|
||||||
<div style="text-align:center; margin-top:5px;">
|
<div style="text-align:center; margin-top:5px;">
|
||||||
|
<input type="checkbox" id="generateDiscountRefund" name="generateDiscountRefund" class="button" onclick="toggleShippingCost(this)" /> <label for="generateDiscount" style="float:none; font-weight:normal;">{l s='Generate a voucher'}</label><br />
|
||||||
<input type="submit" name="partialRefund" value="{l s='Partial refund'}" class="button" style="margin-top:8px;" />
|
<input type="submit" name="partialRefund" value="{l s='Partial refund'}" class="button" style="margin-top:8px;" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -37,13 +37,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<sup> *</sup>
|
<sup> *</sup>
|
||||||
<p class="preference_description">{l s='Maximum 32 characters.'}</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<p class="margin-form preference_description">{l s='Maximum 32 characters.'}</p>
|
||||||
<div class="clear"> </div>
|
<div class="clear"> </div>
|
||||||
<label>{l s='Description:'} </label>
|
<label>{l s='Description:'} </label>
|
||||||
<div class="margin-form translatable">
|
<div class="margin-form translatable">
|
||||||
{foreach $languages as $language}
|
{foreach $languages as $language}
|
||||||
<div id="attachment_description_{$language.id_lang}" style="display: {if $language.id_lang == $default_form_language}block{else}none{/if}; float: left;">
|
<div class="lang_{$language.id_lang}" style="display: {if $language.id_lang == $default_form_language}block{else}none{/if}; float: left;">
|
||||||
<textarea name="attachment_description_{$language.id_lang}">{$attachment_description[$language.id_lang]|escape:'htmlall':'UTF-8'}</textarea>
|
<textarea name="attachment_description_{$language.id_lang}">{$attachment_description[$language.id_lang]|escape:'htmlall':'UTF-8'}</textarea>
|
||||||
</div>
|
</div>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
@@ -90,4 +90,10 @@
|
|||||||
</table>
|
</table>
|
||||||
<div class="clear"> </div>
|
<div class="clear"> </div>
|
||||||
<input type="hidden" name="arrayAttachments" id="arrayAttachments" value="{foreach $attach1 as $attach}{$attach.id_attachment},{/foreach}" />
|
<input type="hidden" name="arrayAttachments" id="arrayAttachments" value="{foreach $attach1 as $attach}{$attach.id_attachment},{/foreach}" />
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var iso = '{$iso_tiny_mce}';
|
||||||
|
var pathCSS = '{$smarty.const._THEME_CSS_DIR_}';
|
||||||
|
var ad = '{$ad}';
|
||||||
|
</script>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -28,17 +28,24 @@
|
|||||||
<input type="hidden" name="submitted_tabs[]" value="Customization" />
|
<input type="hidden" name="submitted_tabs[]" value="Customization" />
|
||||||
<h4>{l s='Add or modify customizable properties'}</h4>
|
<h4>{l s='Add or modify customizable properties'}</h4>
|
||||||
|
|
||||||
|
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Customization"}
|
||||||
<div class="separation"></div><br />
|
<div class="separation"></div><br />
|
||||||
<table cellpadding="5" style="width:100%">
|
<table cellpadding="5" style="width:100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">{l s='File fields:'}</td>
|
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">
|
||||||
|
{include file="controllers/products/multishop/checkbox.tpl" field="uploadable_files" type="default"}
|
||||||
|
<label>{l s='File fields:'}</label>
|
||||||
|
</td>
|
||||||
<td style="padding-bottom:5px;">
|
<td style="padding-bottom:5px;">
|
||||||
<input type="text" name="uploadable_files" id="uploadable_files" size="4" value="{$uploadable_files|htmlentities}" />
|
<input type="text" name="uploadable_files" id="uploadable_files" size="4" value="{$uploadable_files|htmlentities}" />
|
||||||
<p class="preference_description">{l s='Number of upload file fields displayed'}</p>
|
<p class="preference_description">{l s='Number of upload file fields displayed'}</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">{l s='Text fields:'}</td>
|
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">
|
||||||
|
{include file="controllers/products/multishop/checkbox.tpl" field="text_fields" type="default"}
|
||||||
|
<label>{l s='Text fields:'}</label>
|
||||||
|
</td>
|
||||||
<td style="padding-bottom:5px;">
|
<td style="padding-bottom:5px;">
|
||||||
<input type="text" name="text_fields" id="text_fields" size="4" value="{$text_fields|htmlentities}" />
|
<input type="text" name="text_fields" id="text_fields" size="4" value="{$text_fields|htmlentities}" />
|
||||||
<p class="preference_description">{l s='Number of text fields displayed'}</p>
|
<p class="preference_description">{l s='Number of text fields displayed'}</p>
|
||||||
|
|||||||
@@ -38,22 +38,22 @@
|
|||||||
<br />
|
<br />
|
||||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:100%;">
|
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="300"></col>
|
<col width="300">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="300"></col>
|
<col width="300">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th height="39px">{l s='Feature'}</td>
|
<th height="39px">{l s='Feature'}</th>
|
||||||
<th>{l s='Pre-defined value'}</td>
|
<th>{l s='Pre-defined value'}</th>
|
||||||
<th><u>{l s='or'}</u> {l s='Customized value'}</td>
|
<th><u>{l s='or'}</u> {l s='Customized value'}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{foreach from=$available_features item=available_feature}
|
{foreach from=$available_features item=available_feature}
|
||||||
<table cellpadding="5" style="background-color:#fff; width: 100%;border:1px solid #ccc; border-top:none; padding:4px 6px;">
|
<table cellpadding="5" style="background-color:#fff; width: 100%;border:1px solid #ccc; border-top:none; padding:4px 6px;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="300"></col>
|
<col width="300">
|
||||||
<col width=""></col>
|
<col width="">
|
||||||
<col width="300"></col>
|
<col width="300">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{$available_feature.name}</td>
|
<td>{$available_feature.name}</td>
|
||||||
|
|||||||
@@ -27,6 +27,6 @@
|
|||||||
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
|
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
|
||||||
<label style="float: none">
|
<label style="float: none">
|
||||||
<input type="checkbox" style="vertical-align: text-bottom" onclick="$('#product-tab-content-{$product_tab} input[name^=\'multishop_check[\']').attr('checked', this.checked); ProductMultishop.checkAll{$product_tab}()" />
|
<input type="checkbox" style="vertical-align: text-bottom" onclick="$('#product-tab-content-{$product_tab} input[name^=\'multishop_check[\']').attr('checked', this.checked); ProductMultishop.checkAll{$product_tab}()" />
|
||||||
{l s='Check / uncheck all (you are editing this page for several shops, some fields like "name" or "price" are disabled, you have to check these fields in order to edit them for these shops)'}
|
{l s='Check/uncheck all (you are editing this page for several shops, some fields like "name" or "price" are disabled, you have to check these fields in order to edit them for these shops)'}
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -27,80 +27,81 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var product_url = '{$link->getAdminLink('AdminProducts', true)}';
|
var product_url = '{$link->getAdminLink('AdminProducts', true)}';
|
||||||
|
$(document).ready(function () {
|
||||||
var Customer = {
|
var Customer = {
|
||||||
"hiddenField": jQuery('#id_customer'),
|
"hiddenField": jQuery('#id_customer'),
|
||||||
"field": jQuery('#customer'),
|
"field": jQuery('#customer'),
|
||||||
"container": jQuery('#customers'),
|
"container": jQuery('#customers'),
|
||||||
"loader": jQuery('#customerLoader'),
|
"loader": jQuery('#customerLoader'),
|
||||||
"init": function() {
|
"init": function() {
|
||||||
jQuery(Customer.field).typeWatch({
|
jQuery(Customer.field).typeWatch({
|
||||||
"captureLength": 1,
|
"captureLength": 1,
|
||||||
"highlight": true,
|
"highlight": true,
|
||||||
"wait": 50,
|
"wait": 50,
|
||||||
"callback": Customer.search
|
"callback": Customer.search
|
||||||
}).focus(Customer.placeholderIn).blur(Customer.placeholderOut);
|
}).focus(Customer.placeholderIn).blur(Customer.placeholderOut);
|
||||||
},
|
},
|
||||||
"placeholderIn": function() {
|
"placeholderIn": function() {
|
||||||
if (this.value == '{l s='All customers'}') {
|
if (this.value == '{l s='All customers'}') {
|
||||||
this.value = '';
|
this.value = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"placeholderOut": function() {
|
"placeholderOut": function() {
|
||||||
if (this.value == '') {
|
if (this.value == '') {
|
||||||
this.value = '{l s='All customers'}';
|
this.value = '{l s='All customers'}';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"search": function()
|
"search": function()
|
||||||
{
|
{
|
||||||
Customer.showLoader();
|
Customer.showLoader();
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"url": "{$link->getAdminLink('AdminCustomers')}",
|
"url": "{$link->getAdminLink('AdminCustomers')}",
|
||||||
"async": true,
|
"async": true,
|
||||||
"dataType": "json",
|
"dataType": "json",
|
||||||
"data": {
|
"data": {
|
||||||
"ajax": "1",
|
"ajax": "1",
|
||||||
"token": "{getAdminToken tab='AdminCustomers'}",
|
"token": "{getAdminToken tab='AdminCustomers'}",
|
||||||
"tab": "AdminCustomers",
|
"tab": "AdminCustomers",
|
||||||
"action": "searchCustomers",
|
"action": "searchCustomers",
|
||||||
"customer_search": Customer.field.val()
|
"customer_search": Customer.field.val()
|
||||||
},
|
},
|
||||||
"success": Customer.success
|
"success": Customer.success
|
||||||
});
|
|
||||||
},
|
|
||||||
"success": function(result)
|
|
||||||
{
|
|
||||||
if(result.found) {
|
|
||||||
var html = '<ul class="clearfix">';
|
|
||||||
jQuery.each(result.customers, function() {
|
|
||||||
html += '<li><a class="fancybox" href="{$link->getAdminLink('AdminCustomers')}&id_customer='+this.id_customer+'&viewcustomer&liteDisplaying=1">'+this.firstname+' '+this.lastname+'</a>'+(this.birthday ? ' - '+this.birthday:'')+'<br/>';
|
|
||||||
html += '<a href="mailto:'+this.email+'">'+this.email+'</a><br />';
|
|
||||||
html += '<a onclick="Customer.select('+this.id_customer+', \''+this.firstname+' '+this.lastname+'\'); return false;" href="#" class="button">{l s='Choose'}</a></li>';
|
|
||||||
});
|
});
|
||||||
html += '</ul>';
|
},
|
||||||
|
"success": function(result)
|
||||||
|
{
|
||||||
|
if(result.found) {
|
||||||
|
var html = '<ul class="clearfix">';
|
||||||
|
jQuery.each(result.customers, function() {
|
||||||
|
html += '<li><a class="fancybox" href="{$link->getAdminLink('AdminCustomers')}&id_customer='+this.id_customer+'&viewcustomer&liteDisplaying=1">'+this.firstname+' '+this.lastname+'</a>'+(this.birthday ? ' - '+this.birthday:'')+'<br/>';
|
||||||
|
html += '<a href="mailto:'+this.email+'">'+this.email+'</a><br />';
|
||||||
|
html += '<a onclick="Customer.select('+this.id_customer+', \''+this.firstname+' '+this.lastname+'\'); return false;" href="#" class="button">{l s='Choose'}</a></li>';
|
||||||
|
});
|
||||||
|
html += '</ul>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
html = '<div class="warn">{l s='No customers found'}</div>';
|
||||||
|
Customer.hideLoader();
|
||||||
|
Customer.container.html(html);
|
||||||
|
jQuery('.fancybox', Customer.container).fancybox();
|
||||||
|
},
|
||||||
|
"select": function(id_customer, fullname)
|
||||||
|
{
|
||||||
|
Customer.hiddenField.val(id_customer);
|
||||||
|
Customer.field.val(fullname);
|
||||||
|
Customer.container.empty();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
"showLoader": function() {
|
||||||
|
Customer.loader.fadeIn();
|
||||||
|
},
|
||||||
|
"hideLoader": function() {
|
||||||
|
Customer.loader.fadeOut();
|
||||||
}
|
}
|
||||||
else
|
};
|
||||||
html = '<div class="warn">{l s='No customers found'}</div>';
|
Customer.init();
|
||||||
Customer.hideLoader();
|
});
|
||||||
Customer.container.html(html);
|
|
||||||
jQuery('.fancybox', Customer.container).fancybox();
|
|
||||||
},
|
|
||||||
"select": function(id_customer, fullname)
|
|
||||||
{
|
|
||||||
Customer.hiddenField.val(id_customer);
|
|
||||||
Customer.field.val(fullname);
|
|
||||||
Customer.container.empty();
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
"showLoader": function() {
|
|
||||||
Customer.loader.fadeIn();
|
|
||||||
},
|
|
||||||
"hideLoader": function() {
|
|
||||||
Customer.loader.fadeOut();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
jQuery(document).ready(Customer.init);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{* END CUSTOMER AUTO-COMPLETE / TO REFACTO *}
|
{* END CUSTOMER AUTO-COMPLETE / TO REFACTO *}
|
||||||
@@ -120,7 +121,7 @@ jQuery(document).ready(Customer.init);
|
|||||||
<label>{l s='Pre-tax wholesale price:'}</label>
|
<label>{l s='Pre-tax wholesale price:'}</label>
|
||||||
</td>
|
</td>
|
||||||
<td style="padding-bottom:5px;">
|
<td style="padding-bottom:5px;">
|
||||||
{$currency->prefix}<input size="11" maxlength="14" name="wholesale_price" id="wholesale_price" type="text" value="{$product->wholesale_price|string_format:'%.2f'}" onchange="this.value = this.value.replace(/,/g, '.');" />{$currency->suffix}
|
{$currency->prefix}<input size="11" maxlength="14" name="wholesale_price" id="wholesale_price" type="text" value="{{toolsConvertPrice price=$product->wholesale_price}|string_format:'%.2f'}" onchange="this.value = this.value.replace(/,/g, '.');" />{$currency->suffix}
|
||||||
<p class="preference_description">{l s='The wholesale price at which you bought this product'}</p>
|
<p class="preference_description">{l s='The wholesale price at which you bought this product'}</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -131,8 +132,8 @@ jQuery(document).ready(Customer.init);
|
|||||||
<label>{l s='Pre-tax retail price:'}</label>
|
<label>{l s='Pre-tax retail price:'}</label>
|
||||||
</td>
|
</td>
|
||||||
<td style="padding-bottom:5px;">
|
<td style="padding-bottom:5px;">
|
||||||
<input type="hidden" id="priceTEReal" name="price" value="{$product->price}" />
|
<input type="hidden" id="priceTEReal" name="price" value="{toolsConvertPrice price=$product->price}" />
|
||||||
{$currency->prefix}<input size="11" maxlength="14" id="priceTE" name="price_displayed" type="text" value="{$product->price|string_format:'%.2f'}" onchange="noComma('priceTE'); $('#priceTEReal').val(this.value);" onkeyup="$('#priceType').val('TE'); $('#priceTEReal').val(this.value.replace(/,/g, '.')); if (isArrowKey(event)) return; calcPriceTI();" />{$currency->suffix}
|
{$currency->prefix}<input size="11" maxlength="14" id="priceTE" name="price_displayed" type="text" value="{{toolsConvertPrice price=$product->price}|string_format:'%.2f'}" onchange="noComma('priceTE'); $('#priceTEReal').val(this.value);" onkeyup="$('#priceType').val('TE'); $('#priceTEReal').val(this.value.replace(/,/g, '.')); if (isArrowKey(event)) return; calcPriceTI();" />{$currency->suffix}
|
||||||
<p class="preference_description">{l s='The pre-tax retail price to sell this product'}</p>
|
<p class="preference_description">{l s='The pre-tax retail price to sell this product'}</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -209,7 +210,7 @@ jQuery(document).ready(Customer.init);
|
|||||||
{l s='per'} <span id="unity_second">{$product->unity}</span> {l s='with tax'}
|
{l s='per'} <span id="unity_second">{$product->unity}</span> {l s='with tax'}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
<p>{l s='e.g. per lb'}</p>
|
<p>{l s='e.g. per lb'}</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -384,7 +385,7 @@ jQuery(document).ready(Customer.init);
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table style="text-align: center;width:100%" class="table" cellpadding="0" cellspacing="0" id="specific_prices_list">
|
<table style="text-align: left;width:100%" class="table" cellpadding="0" cellspacing="0" id="specific_prices_list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="cell border" style="width: 12%;">{l s='Rule'}</th>
|
<th class="cell border" style="width: 12%;">{l s='Rule'}</th>
|
||||||
@@ -394,11 +395,10 @@ jQuery(document).ready(Customer.init);
|
|||||||
<th class="cell border" style="width: 11%;">{l s='Country'}</th>
|
<th class="cell border" style="width: 11%;">{l s='Country'}</th>
|
||||||
<th class="cell border" style="width: 13%;">{l s='Group'}</th>
|
<th class="cell border" style="width: 13%;">{l s='Group'}</th>
|
||||||
<th class="cell border" style="width: 13%;">{l s='Customer'}</th>
|
<th class="cell border" style="width: 13%;">{l s='Customer'}</th>
|
||||||
<th class="cell border" style="width: 12%;">{l s='Price'} {if $country_display_tax_label}{l s='(tax excl.)'}{/if}</th>
|
<th class="cell border" style="width: 13%;">{l s='Fixed price'}</th>
|
||||||
<th class="cell border" style="width: 10%;">{l s='Reduction'}</th>
|
<th class="cell border" style="width: 13%;">{l s='Impact'}</th>
|
||||||
<th class="cell border" style="width: 15%;">{l s='Period'}</th>
|
<th class="cell border" style="width: 15%;">{l s='Period'}</th>
|
||||||
<th class="cell border" style="width: 10%;">{l s='From (quantity)'}</th>
|
<th class="cell border" style="width: 13%;">{l s='From (quantity)'}</th>
|
||||||
<th class="cell border" style="width: 15%;">{l s='Final price'} {if $country_display_tax_label}{l s='(tax excl.)'}{/if}</th>
|
|
||||||
<th class="cell border" style="width: 2%;">{l s='Action'}</th>
|
<th class="cell border" style="width: 2%;">{l s='Action'}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<p>{l s='You can manually specify the quantities for the product/each product combination, or choose to automatically determine these quantities based on your stock (if advanced stock management is activated).'}</p>
|
<p>{l s='You can manually specify the quantities for the product/each product combination, or choose to automatically determine these quantities based on your stock (if advanced stock management is activated).'}</p>
|
||||||
<p>{l s='In this case, the quantities correspond to the quantitites of the real stock in the warehouses associated to the current shop or current group of shops.'}</p>
|
<p>{l s='In this case, the quantities correspond to the quantitites of the real stock in the warehouses associated to the current shop or current group of shops.'}</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>{l s='For packs, if it has products that use the advanced stock management, you have to specify a common warehouse for these products in the pack.'}</p>
|
<p>{l s='For packs, if it has products that use advanced stock management, you have to specify a common warehouse for these products in the pack.'}</p>
|
||||||
<p>{l s='Also, please note that when a product has combinations, its default combination will be used in stock movements.'}</p>
|
<p>{l s='Also, please note that when a product has combinations, its default combination will be used in stock movements.'}</p>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<label style="float:none;font-weight:normal" for="depends_on_stock_1">
|
<label style="float:none;font-weight:normal" for="depends_on_stock_1">
|
||||||
{l s='Available quantities for current product and its combinations are based on stock in the warehouses'}
|
{l s='Available quantities for current product and its combinations are based on stock in the warehouses'}
|
||||||
{if ($stock_management_active == 0 || $product->advanced_stock_management == 0) && !$product->cache_is_pack}
|
{if ($stock_management_active == 0 || $product->advanced_stock_management == 0) && !$product->cache_is_pack}
|
||||||
- <b>{l s='This requires you to enable the advanced stock management globally or for this product.'}</b>
|
- <b>{l s='This requires you to enable advanced stock management globally or for this product.'}</b>
|
||||||
{else if $product->cache_is_pack}
|
{else if $product->cache_is_pack}
|
||||||
- <b>{l s='This parameter depends on the product(s) in the pack.'}</b>
|
- <b>{l s='This parameter depends on the product(s) in the pack.'}</b>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -117,8 +117,8 @@
|
|||||||
<td valign="top" style="text-align:left;vertical-align:top;">
|
<td valign="top" style="text-align:left;vertical-align:top;">
|
||||||
<table class="table" cellpadding="0" cellspacing="0" style="width:100%;">
|
<table class="table" cellpadding="0" cellspacing="0" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="50"></col>
|
<col width="50">
|
||||||
<col></col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
onmousedown="updateFriendlyURLByName();">{l s='Generate'}</a>
|
onmousedown="updateFriendlyURLByName();">{l s='Generate'}</a>
|
||||||
{l s='Friendly URL from product name.'}<br /><br />
|
{l s='Friendly URL from product name.'}<br /><br />
|
||||||
{l s='Product link will look like this:'}
|
{l s='Product link will look like this:'}
|
||||||
{if $ps_ssl_enabled}https://{else}http://{/if}{$smarty.server.SERVER_NAME}{$smarty.const.__PS_BASE_URI__}{if isset($product->id)}{$product->id}{else}<b>id_product</b>{/if}-<span id="friendly-url">{$product->link_rewrite[$default_language]}</span>.html</p>
|
{$curent_shop_url|escape:'htmlall':'UTF-8'}lang/{if isset($product->id)}{$product->id}{else}<b>id_product</b>{/if}-<span id="friendly-url">{$product->link_rewrite[$default_language]}</span>.html</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-left"><label>{l s='Additional shipping cost:'}</label></td>
|
<td class="col-left"><label>{l s='Additional shipping cost (per quantity):'}</label></td>
|
||||||
<td style="padding-bottom:5px;">{$currency->prefix}<input type="text" name="additional_shipping_cost"
|
<td style="padding-bottom:5px;">{$currency->prefix}<input type="text" name="additional_shipping_cost"
|
||||||
value="{$product->additional_shipping_cost|htmlentities}" />{$currency->suffix}
|
value="{$product->additional_shipping_cost|htmlentities}" />{$currency->suffix}
|
||||||
{if $country_display_tax_label}{l s='tax excl.'}{/if}
|
{if $country_display_tax_label}{l s='tax excl.'}{/if}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
{* [begin] virtual product *}
|
{* [begin] virtual product *}
|
||||||
<div id="virtual_good" {if !$product->productDownload->id || $product->productDownload->active}style="display:none"{/if} >
|
<div id="virtual_good" {if !$product->productDownload->id || $product->productDownload->active}style="display:none"{/if} >
|
||||||
<div>
|
<div>
|
||||||
<label>{l s='Does this product has an associated file?'}</label>
|
<label>{l s='Does this product have an associated file?'}</label>
|
||||||
<label style="width:50px"><input type="radio" value="1" name="is_virtual_file" {if $product_downloaded}checked="checked"{/if} />{l s='Yes'}</label>
|
<label style="width:50px"><input type="radio" value="1" name="is_virtual_file" {if $product_downloaded}checked="checked"{/if} />{l s='Yes'}</label>
|
||||||
<label style="width:50px;"><input type="radio" value="0" name="is_virtual_file" {if !$product_downloaded}checked="checked"{/if} />{l s='No'}</label>
|
<label style="width:50px;"><input type="radio" value="0" name="is_virtual_file" {if !$product_downloaded}checked="checked"{/if} />{l s='No'}</label>
|
||||||
</div><br />
|
</div><br />
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
<li>
|
<li>
|
||||||
{l s='The field `request_uri` is the URL from which the customers come to your website.'}<br />
|
{l s='The field `request_uri` is the URL from which the customers come to your website.'}<br />
|
||||||
{l s='For example, if the visitor accesses a product page, the URL will be'} "{$uri}music-ipods/1-ipod-nano.html".<br />
|
{l s='For example, if the visitor accesses a product page, the URL will be'} "{$uri}music-ipods/1-ipod-nano.html".<br />
|
||||||
{l s='This is interesting because you can add some tags or tokens in the links pointing to your website.'}
|
{l s='This is helpful because you can add some tags or tokens in the links pointing to your website.'}
|
||||||
{l s='For example, you can post a link "%dindex.php?prestashop" in the forum and get statistics by entering "%prestashop" in the field `request_uri`. You will get all the visitors coming from the forum.'}
|
{l s='For example, you can post a link "%dindex.php?prestashop" in the forum and get statistics by entering "%prestashop" in the field `request_uri`. You will get all the visitors coming from the forum.'}
|
||||||
{l s='This method is more reliable than the `http_referer` one, but there is a danger: if a search engine read a page with your link, then it will be displayed in its results and you will have not only the forum visitors, but also the ones from the search engine.'}
|
{l s='This method is more reliable than the `http_referer` one, but there is a danger: if a search engine read a page with your link, then it will be displayed in its results and you will have not only the forum visitors, but also the ones from the search engine.'}
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
{extends file="helpers/list/list_header.tpl"}
|
{extends file="helpers/list/list_header.tpl"}
|
||||||
|
|
||||||
{block name="override_header"}
|
{block name="override_header"}
|
||||||
<script language="javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
||||||
var btn_submit_calendar = $('#submitDatePicker');
|
var btn_submit_calendar = $('#submitDatePicker');
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
{extends file="helpers/view/view.tpl"}
|
{extends file="helpers/view/view.tpl"}
|
||||||
|
|
||||||
{block name="override_tpl"}
|
{block name="override_tpl"}
|
||||||
<script language="javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
||||||
var btn_submit_calendar = $('#submitDatePicker');
|
var btn_submit_calendar = $('#submitDatePicker');
|
||||||
|
|||||||
@@ -28,12 +28,12 @@
|
|||||||
|
|
||||||
{block name="input"}
|
{block name="input"}
|
||||||
{if $input.type == 'text_customer'}
|
{if $input.type == 'text_customer'}
|
||||||
{$customer->firstname} {$customer->lastname}
|
<span class="normal-text">{$customer->firstname} {$customer->lastname}</span>
|
||||||
<p style="clear: both">
|
<p style="clear: both">
|
||||||
<a href="{$url_customer}">{l s='View details on customer page'}</a>
|
<a href="{$url_customer}">{l s='View details on customer page'}</a>
|
||||||
</p>
|
</p>
|
||||||
{elseif $input.type == 'text_order'}
|
{elseif $input.type == 'text_order'}
|
||||||
{$text_order}
|
<span class="normal-text">{$text_order}</span>
|
||||||
<p style="clear: both">
|
<p style="clear: both">
|
||||||
<a href="{$url_order}">{l s='View details on order page'}</a>
|
<a href="{$url_order}">{l s='View details on order page'}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ $(function() {
|
|||||||
{/if}
|
{/if}
|
||||||
{if isset($customers)}
|
{if isset($customers)}
|
||||||
{if !$customers}
|
{if !$customers}
|
||||||
<h3>{l s='No customers matching your query'} : {$query}</h3>
|
<h3>{l s='There are no customers matching your query'} : {$query}</h3>
|
||||||
{else}
|
{else}
|
||||||
<h3>{l s='Customer matching your query'} : {$query}</h3>
|
<h3>{l s='Customer matching your query'} : {$query}</h3>
|
||||||
{$customers}
|
{$customers}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="multishop-left">
|
<div class="multishop-left">
|
||||||
<div class="multishop-title">{l s='Multishop tree'}</div>
|
<div class="multishop-title">{l s='Multistore tree'}</div>
|
||||||
{include file="controllers/shop/tree.tpl" selected_tree_id=$selected_tree_id}
|
{include file="controllers/shop/tree.tpl" selected_tree_id=$selected_tree_id}
|
||||||
</div>
|
</div>
|
||||||
<div class="multishop-right">{$content}</div>
|
<div class="multishop-right">{$content}</div>
|
||||||
|
|||||||
@@ -114,6 +114,10 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
|
var ids_category = new Array();
|
||||||
|
{foreach $ids_category as $key => $id_category}
|
||||||
|
ids_category[{$key}] = {$id_category};
|
||||||
|
{/foreach}
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('input[name=useImportData]').click(function() {
|
$('input[name=useImportData]').click(function() {
|
||||||
if ($(this).attr('id') == 'useImportData_on')
|
if ($(this).attr('id') == 'useImportData_on')
|
||||||
@@ -121,5 +125,21 @@
|
|||||||
else
|
else
|
||||||
$('#shop_list, #data_list').slideUp('slow');
|
$('#shop_list, #data_list').slideUp('slow');
|
||||||
});
|
});
|
||||||
|
$('#id_category, #importFromShop').change(function(){
|
||||||
|
shop_id = $('#importFromShop').val();
|
||||||
|
category_id = $('#id_category').val();
|
||||||
|
if (ids_category[shop_id] != category_id)
|
||||||
|
disableProductsDuplication();
|
||||||
|
else
|
||||||
|
enableProductsDuplication();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
function disableProductsDuplication()
|
||||||
|
{
|
||||||
|
$('input[name="importData[product_attribute]"], input[name="importData[image]"], input[name="importData[product]"], input[name="importData[stock_available]"], input[name="importData[discount]"]').removeAttr('checked').attr('disabled', 'disabled');
|
||||||
|
}
|
||||||
|
function enableProductsDuplication()
|
||||||
|
{
|
||||||
|
$('input[name="importData[product_attribute]"], input[name="importData[image]"], input[name="importData[product]"], input[name="importData[stock_available]"], input[name="importData[discount]"]').removeAttr('disabled').attr('checked', 'checked');
|
||||||
|
}
|
||||||
{/block}
|
{/block}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
{extends file="helpers/view/view.tpl"}
|
{extends file="helpers/view/view.tpl"}
|
||||||
|
|
||||||
{block name="override_tpl"}
|
{block name="override_tpl"}
|
||||||
<script language="javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
||||||
var btn_submit_calendar = $('#submitDatePicker');
|
var btn_submit_calendar = $('#submitDatePicker');
|
||||||
|
|||||||
@@ -49,13 +49,13 @@
|
|||||||
<h3><a href="?tab=AdminProducts&id_product={$product->id}&updateproduct&token={getAdminToken tab='AdminProducts'}">{$product->name}</a></h3>
|
<h3><a href="?tab=AdminProducts&id_product={$product->id}&updateproduct&token={getAdminToken tab='AdminProducts'}">{$product->name}</a></h3>
|
||||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:100%;">
|
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:100%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col></col>
|
<col>
|
||||||
<col width="190"></col>
|
<col width="190">
|
||||||
<col width="190"></col>
|
<col width="190">
|
||||||
<col width="80"></col>
|
<col width="80">
|
||||||
<col width="80"></col>
|
<col width="80">
|
||||||
<col width="80"></col>
|
<col width="80">
|
||||||
<col width="80"></col>
|
<col width="80">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="height:40px;">{l s='Attribute name'}</th>
|
<th style="height:40px;">{l s='Attribute name'}</th>
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
*}
|
*}
|
||||||
{extends file="helpers/list/list_header.tpl"}
|
{extends file="helpers/list/list_header.tpl"}
|
||||||
{block name=override_header}
|
{block name=override_header}
|
||||||
<script language="javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('input.quantity_received_today').live('click', function() {
|
$('input.quantity_received_today').live('click', function() {
|
||||||
/* checks checkbox when the input is clicked */
|
/* checks checkbox when the input is clicked */
|
||||||
|
|||||||
@@ -31,31 +31,31 @@
|
|||||||
<h3>{l s='Products'}</h3>
|
<h3>{l s='Products'}</h3>
|
||||||
<table class="double_select">
|
<table class="double_select">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
|
||||||
<select multiple id="select_left" name="products[]">
|
|
||||||
{foreach from=$field.products item='product'}
|
|
||||||
<option value="{$product.id_product}">{$product.name}</option>
|
|
||||||
{/foreach}
|
|
||||||
</select>
|
|
||||||
<span class="hint" name="help_box">{l s='Double-click to move to other column'}<span class="hint-pointer"> </span></span>
|
|
||||||
<br /><br />
|
|
||||||
<a href="#" id="move_to_right" class="multiple_select_remove">
|
|
||||||
{l s='Remove'} >>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td style="padding-left:20px;">
|
<td style="padding-left:20px;">
|
||||||
<select multiple id="select_right">
|
<select multiple id="select_left">
|
||||||
{foreach from=$field.products_unselected item='product'}
|
{foreach from=$field.products_unselected item='product'}
|
||||||
<option value="{$product.id_product}">{$product.name}</option>
|
<option value="{$product.id_product}">{$product.name}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
<span class="hint" name="help_box">{l s='Double-click to move to other column'}<span class="hint-pointer"> </span></span>
|
<span class="hint" name="help_box">{l s='Double-click to move to other column'}<span class="hint-pointer"> </span></span>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<a href="#" id="move_to_left" class="multiple_select_add">
|
<a href="#" id="move_to_right" class="multiple_select_add">
|
||||||
<< {l s='Add'}
|
{l s='Add'} >>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<select multiple id="select_right" name="products[]">
|
||||||
|
{foreach from=$field.products item='product'}
|
||||||
|
<option value="{$product.id_product}">{$product.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
<span class="hint" name="help_box">{l s='Double-click to move to other column'}<span class="hint-pointer"> </span></span>
|
||||||
|
<br /><br />
|
||||||
|
<a href="#" id="move_to_left" class="multiple_select_remove">
|
||||||
|
<< {l s='Remove'}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -198,7 +198,7 @@
|
|||||||
<div style="float:left;">
|
<div style="float:left;">
|
||||||
<input type="submit" value="{l s=' Copy '}" name="submitCopyLang" class="button" style="margin:25px 0px 0px 25px;" />
|
<input type="submit" value="{l s=' Copy '}" name="submitCopyLang" class="button" style="margin:25px 0px 0px 25px;" />
|
||||||
</div>
|
</div>
|
||||||
<p style="clear: left; padding: 16px 0px 0px 0px;"><span style="font-style: bold; color: red;">*</span> {l s='Language files (as indicated at Tools > Languages > Edition) must be complete to allow copying of translations'}</p>
|
<p style="clear: left; padding: 16px 0px 0px 0px;"><span style="font-style: bold; color: red;">*</span> {l s='Language files must be complete to allow copying of translations'}</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
{/block}
|
{/block}
|
||||||
+2
-2
@@ -108,10 +108,10 @@
|
|||||||
{$missing_translations_module = 0}
|
{$missing_translations_module = 0}
|
||||||
{/if}
|
{/if}
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend style="cursor : pointer" onclick="$('#{$theme_name}_{$module_name}_{$template_name}').slideToggle();">{if $theme_name === 'default'}{l s='default'}{else}{$theme_name}{/if} - {$template_name}
|
<legend style="cursor : pointer" onclick="$('#{$theme_name}_{$module_name}_{$template_name|replace:'.':'_'}').slideToggle();">{if $theme_name === 'default'}{l s='default'}{else}{$theme_name}{/if} - {$template_name}
|
||||||
<font color="blue">{$newLang|count}</font> {l s='expressions'} (<font color="red">{$missing_translations_module}</font>)
|
<font color="blue">{$newLang|count}</font> {l s='expressions'} (<font color="red">{$missing_translations_module}</font>)
|
||||||
</legend>
|
</legend>
|
||||||
<div name="{$type}_div" id="{$theme_name}_{$module_name}_{$template_name}" style="display:{if $missing_translations_module}block{else}none{/if}">
|
<div name="{$type}_div" id="{$theme_name}_{$module_name}_{$template_name|replace:'.':'_'}" style="display:{if $missing_translations_module}block{else}none{/if}">
|
||||||
<table cellpadding="2">
|
<table cellpadding="2">
|
||||||
{foreach $newLang as $key => $value}
|
{foreach $newLang as $key => $value}
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -202,11 +202,11 @@
|
|||||||
{foreach $tabs AS $t}
|
{foreach $tabs AS $t}
|
||||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||||
<span class="title">
|
<span class="title">
|
||||||
<img src="{$t.img}" alt="" />{$t.name}
|
<img src="{$t.img}" alt="" />{if $t.name eq ''}{$t.class_name}{else}{$t.name}{/if}
|
||||||
</span>
|
</span>
|
||||||
<ul class="submenu">
|
<ul class="submenu">
|
||||||
{foreach from=$t.sub_tabs item=t2}
|
{foreach from=$t.sub_tabs item=t2}
|
||||||
<li><a href="{$t2.href}">{$t2.name}</a></li>
|
<li><a href="{$t2.href}">{if $t2.name eq ''}{$t2.class_name}{else}{$t2.name}{/if}</a></li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ function check_all_shop() {
|
|||||||
{assign var=checked value=false}
|
{assign var=checked value=false}
|
||||||
{/if}
|
{/if}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td {if $groupData['disable_shops']}style="font-style:italic;background-color:#CFC4FF"{/if}>
|
||||||
<img style="vertical-align:middle;" alt="" src="../img/admin/lv3_{if $j < count($groupData['shops']) - 1}b{else}f{/if}.png" />
|
<img style="vertical-align:middle;" alt="" src="../img/admin/lv3_{if $j < count($groupData['shops']) - 1}b{else}f{/if}.png" />
|
||||||
<label class="child">
|
<label class="child">
|
||||||
<input class="input_shop"
|
<input class="input_shop"
|
||||||
@@ -118,7 +118,9 @@ function check_all_shop() {
|
|||||||
shop_id="{$shopID}"
|
shop_id="{$shopID}"
|
||||||
name="checkBoxShopAsso_{$table}[{$shopID}]"
|
name="checkBoxShopAsso_{$table}[{$shopID}]"
|
||||||
id="checkedBox_{$shopID}"
|
id="checkedBox_{$shopID}"
|
||||||
{if $checked} checked="checked"{/if} />
|
{if $checked} checked="checked"{/if}
|
||||||
|
{if $groupData['disable_shops']} readonly="readonly" onclick="return false"{/if}
|
||||||
|
/>
|
||||||
{$shopData['name']}
|
{$shopData['name']}
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
{foreach $fieldset.form as $key => $field}
|
{foreach $fieldset.form as $key => $field}
|
||||||
{if $key == 'legend'}
|
{if $key == 'legend'}
|
||||||
<legend>
|
<legend>
|
||||||
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title|escape:'htmlall':'UTF-8'}}" />{/if}
|
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title|escape:'htmlall':'UTF-8'}" />{/if}
|
||||||
{$field.title}
|
{$field.title}
|
||||||
</legend>
|
</legend>
|
||||||
{elseif $key == 'description' && $field}
|
{elseif $key == 'description' && $field}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@
|
|||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
<a href="{$href}" class="default" title="{$action}" {if isset($name)}name="{$name}{/if}">
|
<a href="{$href}" class="default" title="{$action}" {if isset($name)}name="{$name}"{/if}>
|
||||||
<img src="../img/admin/asterisk.gif" alt="{$action}" />
|
<img src="../img/admin/asterisk.gif" alt="{$action}" />
|
||||||
</a>
|
</a>
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if !$categoryData['hide_multishop_checkbox'] && $use_multishop}
|
{if !$categoryData['hide_multishop_checkbox'] && $use_multishop}
|
||||||
<input type="checkbox" style="vertical-align: text-top" onclick="checkAllMultishopDefaultValue(this)" /> <b>{l s='Check / uncheck all'}</b> {l s='(check boxes if you want to set a custom value for this shop or group shop context)'}
|
<input type="checkbox" style="vertical-align: text-top" onclick="checkAllMultishopDefaultValue(this)" /> <b>{l s='Check/uncheck all'}</b> {l s='(check boxes if you want to set a custom value for this shop or group shop context)'}
|
||||||
<div class="separation"></div>
|
<div class="separation"></div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -105,13 +105,12 @@
|
|||||||
<label class="t" for="{$key}_{$k}"> {$v}</label><br />
|
<label class="t" for="{$key}_{$k}"> {$v}</label><br />
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<br />
|
<br />
|
||||||
{*{elseif $field['type'] == 'checkbox'}
|
{elseif $field['type'] == 'checkbox'}
|
||||||
{foreach $field['choices'] AS $k => $v}
|
{foreach $field['choices'] AS $k => $v}
|
||||||
<input type="checkbox" name="{$key}" id="{$key}{$k}_on" value="{$k|intval}"{if $k == $field['value']} checked="checked"{/if}{if isset($field['js'][$k])} {$field['js'][$k]}{/if}/>
|
<input type="checkbox" name="{$key}" id="{$key}{$k}_on" value="{$k|intval}"{if $k == $field['value']} checked="checked"{/if}{if isset($field['js'][$k])} {$field['js'][$k]}{/if}/>
|
||||||
<label class="t" for="{$key}{$k}_on"> {$v}</label><br />
|
<label class="t" for="{$key}{$k}_on"> {$v}</label><br />
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<br />
|
<br />
|
||||||
*}
|
|
||||||
{elseif $field['type'] == 'text'}
|
{elseif $field['type'] == 'text'}
|
||||||
<input type="{$field['type']}"{if isset($field['id'])} id="{$field['id']}"{/if} size="{if isset($field['size'])}{$field['size']|intval}{else}5{/if}" name="{$key}" value="{$field['value']|escape:'htmlall':'UTF-8'}" {if isset($field['autocomplete']) && !$field['autocomplete']}autocomplete="off"{/if}/>
|
<input type="{$field['type']}"{if isset($field['id'])} id="{$field['id']}"{/if} size="{if isset($field['size'])}{$field['size']|intval}{else}5{/if}" name="{$key}" value="{$field['value']|escape:'htmlall':'UTF-8'}" {if isset($field['autocomplete']) && !$field['autocomplete']}autocomplete="off"{/if}/>
|
||||||
{if isset($field['suffix'])} {$field['suffix']|strval}{/if}
|
{if isset($field['suffix'])} {$field['suffix']|strval}{/if}
|
||||||
|
|||||||
@@ -38,7 +38,8 @@
|
|||||||
{/foreach}
|
{/foreach}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<script language="javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
|
var submited = false
|
||||||
$(function() {
|
$(function() {
|
||||||
//get reference on save link
|
//get reference on save link
|
||||||
btn_save = $('span[class~="process-icon-save"]').parent();
|
btn_save = $('span[class~="process-icon-save"]').parent();
|
||||||
@@ -82,6 +83,11 @@
|
|||||||
//submit the form
|
//submit the form
|
||||||
{block name=formSubmit}
|
{block name=formSubmit}
|
||||||
btn_save.click(function() {
|
btn_save.click(function() {
|
||||||
|
// Avoid double click
|
||||||
|
if (submited)
|
||||||
|
return false;
|
||||||
|
submited = true;
|
||||||
|
|
||||||
//add hidden input to emulate submit button click when posting the form -> field name posted
|
//add hidden input to emulate submit button click when posting the form -> field name posted
|
||||||
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />');
|
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />');
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -278,9 +278,12 @@ class AddressCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (isset(self::$_idCountries[$id_address]))
|
if (isset(self::$_idCountries[$id_address]))
|
||||||
return self::$_idCountries[$id_address];
|
return self::$_idCountries[$id_address];
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
if ($id_address)
|
||||||
SELECT `id_country`, `id_state`, `vat_number`, `postcode` FROM `'._DB_PREFIX_.'address`
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
WHERE `id_address` = '.(int)$id_address);
|
SELECT `id_country`, `id_state`, `vat_number`, `postcode` FROM `'._DB_PREFIX_.'address`
|
||||||
|
WHERE `id_address` = '.(int)$id_address);
|
||||||
|
else
|
||||||
|
$result = false;
|
||||||
self::$_idCountries[$id_address] = $result;
|
self::$_idCountries[$id_address] = $result;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,10 +474,11 @@ abstract class AdminTabCore
|
|||||||
/* Checking for maximum multilingual fields size */
|
/* Checking for maximum multilingual fields size */
|
||||||
foreach ($rules['sizeLang'] as $fieldLang => $maxLength)
|
foreach ($rules['sizeLang'] as $fieldLang => $maxLength)
|
||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
|
{
|
||||||
if (Tools::getValue($fieldLang.'_'.$language['id_lang']) !== false && Tools::strlen(Tools::getValue($fieldLang.'_'.$language['id_lang'])) > $maxLength)
|
if (Tools::getValue($fieldLang.'_'.$language['id_lang']) !== false && Tools::strlen(Tools::getValue($fieldLang.'_'.$language['id_lang'])) > $maxLength)
|
||||||
$this->_errors[] = sprintf(Tools::displayError('field %1$s is too long. (%2$d chars max, html chars including)'), call_user_func(array($className, 'displayFieldName'), $fieldLang, $className), $maxLength);
|
$this->_errors[] = sprintf(Tools::displayError('field %1$s is too long. (%2$d chars max, html chars including)'), call_user_func(array($className, 'displayFieldName'), $fieldLang, $className), $maxLength);
|
||||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max, html chars including').')';
|
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max, html chars including').')';
|
||||||
|
}
|
||||||
/* Overload this method for custom checking */
|
/* Overload this method for custom checking */
|
||||||
$this->_childValidation();
|
$this->_childValidation();
|
||||||
|
|
||||||
@@ -1304,10 +1305,10 @@ abstract class AdminTabCore
|
|||||||
$whereShop = Shop::addSqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
|
$whereShop = Shop::addSqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
|
||||||
}
|
}
|
||||||
|
|
||||||
$assos = Shop::getAssoTables();
|
$asso = Shop::getAssoTable($this->table);
|
||||||
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
|
if ($asso !== false && $assos['type'] == 'shop')
|
||||||
{
|
{
|
||||||
$filterKey = $assos[$this->table]['type'];
|
$filterKey = $asso['type'];
|
||||||
$idenfierShop = Shop::getContextListShopID();
|
$idenfierShop = Shop::getContextListShopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-20
@@ -73,30 +73,19 @@ class AttributeCore extends ObjectModel
|
|||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->executeS('
|
if (!$this->hasMultishopEntries())
|
||||||
SELECT `id_product_attribute`
|
|
||||||
FROM `'._DB_PREFIX_.'product_attribute_combination`
|
|
||||||
WHERE `'.$this->def['primary'].'` = '.(int)$this->id
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($result === false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$combination_ids = array();
|
|
||||||
if (Db::getInstance()->numRows())
|
|
||||||
{
|
{
|
||||||
foreach ($result as $row)
|
|
||||||
$combination_ids[] = (int)$row['id_product_attribute'];
|
|
||||||
|
|
||||||
$combinations = new Collection('Combination');
|
$combinations = new Collection('Combination');
|
||||||
$combinations->where('id_product', '=', $this->id);
|
$combinations->where($this->def['primary'], '=', $this->id);
|
||||||
foreach ($combinations as $combination)
|
foreach ($combinations as $combination)
|
||||||
$combination->delete();
|
$combination->delete();
|
||||||
|
|
||||||
|
// Delete associated restrictions on cart rules
|
||||||
|
CartRule::cleanProductRuleIntegrity('attributes', $this->id);
|
||||||
|
|
||||||
|
/* Reinitializing position */
|
||||||
|
$this->cleanPositions((int)$this->id_attribute_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reinitializing position */
|
|
||||||
$this->cleanPositions((int)$this->id_attribute_group);
|
|
||||||
|
|
||||||
$return = parent::delete();
|
$return = parent::delete();
|
||||||
if ($return)
|
if ($return)
|
||||||
Hook::exec('actionAttributeDelete', array('id_attribute' => $this->id));
|
Hook::exec('actionAttributeDelete', array('id_attribute' => $this->id));
|
||||||
@@ -354,4 +343,4 @@ class AttributeCore extends ObjectModel
|
|||||||
|
|
||||||
return (is_numeric($position)) ? $position : -1;
|
return (is_numeric($position)) ? $position : -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-28
@@ -110,33 +110,36 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
/* Select children in order to find linked combinations */
|
if (!$this->hasMultishopEntries())
|
||||||
$attribute_ids = Db::getInstance()->executeS('
|
{
|
||||||
SELECT `id_attribute`
|
/* Select children in order to find linked combinations */
|
||||||
FROM `'._DB_PREFIX_.'attribute`
|
$attribute_ids = Db::getInstance()->executeS('
|
||||||
WHERE `id_attribute_group` = '.(int)$this->id
|
SELECT `id_attribute`
|
||||||
);
|
FROM `'._DB_PREFIX_.'attribute`
|
||||||
if ($attribute_ids === false)
|
WHERE `id_attribute_group` = '.(int)$this->id
|
||||||
return false;
|
);
|
||||||
/* Removing attributes to the found combinations */
|
if ($attribute_ids === false)
|
||||||
$to_remove = array();
|
return false;
|
||||||
foreach ($attribute_ids as $attribute)
|
/* Removing attributes to the found combinations */
|
||||||
$to_remove[] = (int)$attribute['id_attribute'];
|
$to_remove = array();
|
||||||
if (!empty($to_remove) && Db::getInstance()->execute('
|
foreach ($attribute_ids as $attribute)
|
||||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
$to_remove[] = (int)$attribute['id_attribute'];
|
||||||
WHERE `id_attribute`
|
if (!empty($to_remove) && Db::getInstance()->execute('
|
||||||
IN ('.implode(', ', $to_remove).')') === false)
|
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||||
return false;
|
WHERE `id_attribute`
|
||||||
/* Remove combinations if they do not possess attributes anymore */
|
IN ('.implode(', ', $to_remove).')') === false)
|
||||||
if (!AttributeGroup::cleanDeadCombinations())
|
return false;
|
||||||
return false;
|
/* Remove combinations if they do not possess attributes anymore */
|
||||||
/* Also delete related attributes */
|
if (!AttributeGroup::cleanDeadCombinations())
|
||||||
if (Db::getInstance()->execute('
|
return false;
|
||||||
DELETE FROM `'._DB_PREFIX_.'attribute_lang`
|
/* Also delete related attributes */
|
||||||
WHERE `id_attribute`
|
if (Db::getInstance()->execute('
|
||||||
IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id.')') === false ||
|
DELETE FROM `'._DB_PREFIX_.'attribute_lang`
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id) === false)
|
WHERE `id_attribute`
|
||||||
return false;
|
IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id.')') === false ||
|
||||||
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id) === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$return = parent::delete();
|
$return = parent::delete();
|
||||||
if ($return)
|
if ($return)
|
||||||
Hook::exec('actionAttributeGroupDelete', array('id_attribute_group' => $this->id));
|
Hook::exec('actionAttributeGroupDelete', array('id_attribute_group' => $this->id));
|
||||||
@@ -157,6 +160,7 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
return Db::getInstance()->executeS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'attribute` a
|
FROM `'._DB_PREFIX_.'attribute` a
|
||||||
|
'.Shop::addSqlAssociation('attribute', 'a').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
|
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
|
||||||
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
|
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
|
||||||
WHERE a.`id_attribute_group` = '.(int)$id_attribute_group.'
|
WHERE a.`id_attribute_group` = '.(int)$id_attribute_group.'
|
||||||
@@ -176,8 +180,9 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
return array();
|
return array();
|
||||||
|
|
||||||
return Db::getInstance()->executeS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT DISTINCT agl.`name`, ag.*, agl.*
|
||||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
FROM `'._DB_PREFIX_.'attribute_group` ag
|
||||||
|
'.Shop::addSqlAssociation('attribute_group', 'ag').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
|
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
|
||||||
ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND `id_lang` = '.(int)$id_lang.')
|
ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND `id_lang` = '.(int)$id_lang.')
|
||||||
ORDER BY `name` ASC
|
ORDER BY `name` ASC
|
||||||
|
|||||||
+17
-7
@@ -149,7 +149,7 @@ class CarrierCore extends ObjectModel
|
|||||||
|
|
||||||
protected static $cache_tax_rule = array();
|
protected static $cache_tax_rule = array();
|
||||||
|
|
||||||
protected $webserviceParameters = array(
|
protected $webserviceParameters = array(
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'deleted' => array(),
|
'deleted' => array(),
|
||||||
'is_module' => array(),
|
'is_module' => array(),
|
||||||
@@ -183,11 +183,9 @@ class CarrierCore extends ObjectModel
|
|||||||
$this->position = Carrier::getHigherPosition() + 1;
|
$this->position = Carrier::getHigherPosition() + 1;
|
||||||
if (!parent::add($autodate, $null_values) || !Validate::isLoadedObject($this))
|
if (!parent::add($autodate, $null_values) || !Validate::isLoadedObject($this))
|
||||||
return false;
|
return false;
|
||||||
if (!Db::getInstance()->executeS('SELECT `id_carrier` FROM `'._DB_PREFIX_.$this->def['table'].'` WHERE `deleted` = 0'))
|
if (!$count = Db::getInstance()->getValue('SELECT count(`id_carrier`) FROM `'._DB_PREFIX_.$this->def['table'].'` WHERE `deleted` = 0'))
|
||||||
return false;
|
return false;
|
||||||
if (!$num_rows = Db::getInstance()->NumRows())
|
if ($count == 1)
|
||||||
return false;
|
|
||||||
if ((int)$num_rows == 1)
|
|
||||||
Configuration::updateValue('PS_CARRIER_DEFAULT', (int)$this->id);
|
Configuration::updateValue('PS_CARRIER_DEFAULT', (int)$this->id);
|
||||||
|
|
||||||
// Register reference
|
// Register reference
|
||||||
@@ -991,11 +989,23 @@ class CarrierCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getTaxesRate(Address $address)
|
public function getTaxesRate(Address $address)
|
||||||
{
|
{
|
||||||
$tax_manager = TaxManagerFactory::getManager($address, $this->getIdTaxRulesGroup());
|
$tax_calculator = $this->getTaxCalculator($address);
|
||||||
$tax_calculator = $tax_manager->getTaxCalculator();
|
|
||||||
return $tax_calculator->getTotalRate();
|
return $tax_calculator->getTotalRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the taxes calculator associated to the carrier
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
* @param Address $address
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public function getTaxCalculator(Address $address)
|
||||||
|
{
|
||||||
|
$tax_manager = TaxManagerFactory::getManager($address, $this->getIdTaxRulesGroup());
|
||||||
|
return $tax_manager->getTaxCalculator();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tricky method generates a sql clause to check if ranged data are overloaded by multishop
|
* This tricky method generates a sql clause to check if ranged data are overloaded by multishop
|
||||||
*
|
*
|
||||||
|
|||||||
+123
-39
@@ -470,10 +470,11 @@ class CartCore extends ObjectModel
|
|||||||
if (Customization::isFeatureActive())
|
if (Customization::isFeatureActive())
|
||||||
{
|
{
|
||||||
$sql->select('cu.`id_customization`, cu.`quantity` AS customization_quantity');
|
$sql->select('cu.`id_customization`, cu.`quantity` AS customization_quantity');
|
||||||
$sql->leftJoin('customization', 'cu', 'p.`id_product` = cu.`id_product`');
|
$sql->leftJoin('customization', 'cu',
|
||||||
|
'p.`id_product` = cu.`id_product` AND cp.`id_product_attribute` = cu.id_product_attribute AND cu.id_cart='.(int)$this->id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$sql->select('0 AS customization_quantity');
|
$sql->select('0 AS customization_quantity, 0 AS id_customization');
|
||||||
|
|
||||||
if (Combination::isFeatureActive())
|
if (Combination::isFeatureActive())
|
||||||
{
|
{
|
||||||
@@ -498,7 +499,6 @@ class CartCore extends ObjectModel
|
|||||||
'p.`reference` AS reference, p.`supplier_reference` AS supplier_reference, p.`ean13`,
|
'p.`reference` AS reference, p.`supplier_reference` AS supplier_reference, p.`ean13`,
|
||||||
p.`upc` AS upc, product_shop.`minimal_quantity` AS minimal_quantity'
|
p.`upc` AS upc, product_shop.`minimal_quantity` AS minimal_quantity'
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Db::getInstance()->executeS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
// Reset the cache before the following return, or else an empty cart will add dozens of queries
|
// Reset the cache before the following return, or else an empty cart will add dozens of queries
|
||||||
@@ -1259,9 +1259,10 @@ class CartCore extends ObjectModel
|
|||||||
*
|
*
|
||||||
* @param boolean $withTaxes With or without taxes
|
* @param boolean $withTaxes With or without taxes
|
||||||
* @param integer $type Total type
|
* @param integer $type Total type
|
||||||
|
* @param boolean $use_cache Allow using cache of the method CartRule::getContextualValue
|
||||||
* @return float Order total
|
* @return float Order total
|
||||||
*/
|
*/
|
||||||
public function getOrderTotal($with_taxes = true, $type = Cart::BOTH, $products = null, $id_carrier = null)
|
public function getOrderTotal($with_taxes = true, $type = Cart::BOTH, $products = null, $id_carrier = null, $use_cache = true)
|
||||||
{
|
{
|
||||||
if (!$this->id)
|
if (!$this->id)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1312,8 +1313,12 @@ class CartCore extends ObjectModel
|
|||||||
if ($type == Cart::ONLY_PRODUCTS_WITHOUT_SHIPPING)
|
if ($type == Cart::ONLY_PRODUCTS_WITHOUT_SHIPPING)
|
||||||
$type = Cart::ONLY_PRODUCTS;
|
$type = Cart::ONLY_PRODUCTS;
|
||||||
|
|
||||||
|
$param_product = true;
|
||||||
if (is_null($products))
|
if (is_null($products))
|
||||||
|
{
|
||||||
|
$param_product = false;
|
||||||
$products = $this->getProducts();
|
$products = $this->getProducts();
|
||||||
|
}
|
||||||
|
|
||||||
if ($type == Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING)
|
if ($type == Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING)
|
||||||
{
|
{
|
||||||
@@ -1444,7 +1449,7 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
// If the cart rule offers free shipping, add the shipping cost
|
// If the cart rule offers free shipping, add the shipping cost
|
||||||
if ($with_shipping && $cart_rule['obj']->free_shipping)
|
if ($with_shipping && $cart_rule['obj']->free_shipping)
|
||||||
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_SHIPPING), 2);
|
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_SHIPPING, ($param_product ? $package : null), $use_cache), 2);
|
||||||
|
|
||||||
// If the cart rule is a free gift, then add the free gift value only if the gift is in this package
|
// If the cart rule is a free gift, then add the free gift value only if the gift is in this package
|
||||||
if ((int)$cart_rule['obj']->gift_product)
|
if ((int)$cart_rule['obj']->gift_product)
|
||||||
@@ -1458,13 +1463,13 @@ class CartCore extends ObjectModel
|
|||||||
$in_order = true;
|
$in_order = true;
|
||||||
|
|
||||||
if ($in_order)
|
if ($in_order)
|
||||||
$order_total_discount += $cart_rule['obj']->getContextualValue($with_taxes, null, CartRule::FILTER_ACTION_GIFT, $package);
|
$order_total_discount += $cart_rule['obj']->getContextualValue($with_taxes, null, CartRule::FILTER_ACTION_GIFT, $package, $use_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the cart rule offers a reduction, the amount is prorated (with the products in the package)
|
// If the cart rule offers a reduction, the amount is prorated (with the products in the package)
|
||||||
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0)
|
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0)
|
||||||
{
|
{
|
||||||
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package), 2);
|
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1782,6 +1787,7 @@ class CartCore extends ObjectModel
|
|||||||
* unique_carrier => true, // Does this option use a unique carrier
|
* unique_carrier => true, // Does this option use a unique carrier
|
||||||
* total_price_with_tax => 12.5,
|
* total_price_with_tax => 12.5,
|
||||||
* total_price_without_tax => 12.5,
|
* total_price_without_tax => 12.5,
|
||||||
|
* position => 5, // Average of the carrier position
|
||||||
* ),
|
* ),
|
||||||
* ),
|
* ),
|
||||||
* );
|
* );
|
||||||
@@ -1798,8 +1804,10 @@ class CartCore extends ObjectModel
|
|||||||
$carrier_collection = array();
|
$carrier_collection = array();
|
||||||
$package_list = $this->getPackageList();
|
$package_list = $this->getPackageList();
|
||||||
|
|
||||||
|
// Foreach addresses
|
||||||
foreach ($package_list as $id_address => $packages)
|
foreach ($package_list as $id_address => $packages)
|
||||||
{
|
{
|
||||||
|
// Initialize vars
|
||||||
$delivery_option_list[$id_address] = array();
|
$delivery_option_list[$id_address] = array();
|
||||||
$carriers_price[$id_address] = array();
|
$carriers_price[$id_address] = array();
|
||||||
$common_carriers = null;
|
$common_carriers = null;
|
||||||
@@ -1807,13 +1815,16 @@ class CartCore extends ObjectModel
|
|||||||
$best_grade_carriers = array();
|
$best_grade_carriers = array();
|
||||||
$carriers_instance = array();
|
$carriers_instance = array();
|
||||||
|
|
||||||
|
// Get country
|
||||||
if ($id_address)
|
if ($id_address)
|
||||||
{
|
{
|
||||||
$address = new Address($id_address);
|
$address = new Address($id_address);
|
||||||
$country = new Country($address->id_country);
|
$country = new Country($address->id_country);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
$country = $default_country;
|
$country = $default_country;
|
||||||
|
|
||||||
|
// Foreach packages, get the carriers with best price, best position and best grade
|
||||||
foreach ($packages as $id_package => $package)
|
foreach ($packages as $id_package => $package)
|
||||||
{
|
{
|
||||||
// No carriers available
|
// No carriers available
|
||||||
@@ -1825,6 +1836,7 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
$carriers_price[$id_address][$id_package] = array();
|
$carriers_price[$id_address][$id_package] = array();
|
||||||
|
|
||||||
|
// Get all common carriers for each packages to the same address
|
||||||
if (is_null($common_carriers))
|
if (is_null($common_carriers))
|
||||||
$common_carriers = $package['carrier_list'];
|
$common_carriers = $package['carrier_list'];
|
||||||
else
|
else
|
||||||
@@ -1835,10 +1847,12 @@ class CartCore extends ObjectModel
|
|||||||
$best_grade = null;
|
$best_grade = null;
|
||||||
$best_grade_carrier = null;
|
$best_grade_carrier = null;
|
||||||
|
|
||||||
|
// Foreach carriers of the package, calculate his price, check if it the best price, position and grade
|
||||||
foreach ($package['carrier_list'] as $id_carrier)
|
foreach ($package['carrier_list'] as $id_carrier)
|
||||||
{
|
{
|
||||||
if (!isset($carriers_instance[$id_carrier]))
|
if (!isset($carriers_instance[$id_carrier]))
|
||||||
$carriers_instance[$id_carrier] = new Carrier($id_carrier);
|
$carriers_instance[$id_carrier] = new Carrier($id_carrier);
|
||||||
|
|
||||||
$price_with_tax = $this->getPackageShippingCost($id_carrier, true, $country, $package['product_list']);
|
$price_with_tax = $this->getPackageShippingCost($id_carrier, true, $country, $package['product_list']);
|
||||||
$price_without_tax = $this->getPackageShippingCost($id_carrier, false, $country, $package['product_list']);
|
$price_without_tax = $this->getPackageShippingCost($id_carrier, false, $country, $package['product_list']);
|
||||||
if (is_null($best_price) || $price_with_tax < $best_price)
|
if (is_null($best_price) || $price_with_tax < $best_price)
|
||||||
@@ -1862,9 +1876,11 @@ class CartCore extends ObjectModel
|
|||||||
$best_grade_carriers[$id_package] = $best_grade_carrier;
|
$best_grade_carriers[$id_package] = $best_grade_carrier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset $best_price_carrier, it's now an array
|
||||||
$best_price_carrier = array();
|
$best_price_carrier = array();
|
||||||
$key = '';
|
$key = '';
|
||||||
|
|
||||||
|
// Get the delivery option with the lower price
|
||||||
foreach ($best_price_carriers as $id_package => $id_carrier)
|
foreach ($best_price_carriers as $id_package => $id_carrier)
|
||||||
{
|
{
|
||||||
$key .= $id_carrier.',';
|
$key .= $id_carrier.',';
|
||||||
@@ -1882,6 +1898,7 @@ class CartCore extends ObjectModel
|
|||||||
$best_price_carrier[$id_carrier]['instance'] = $carriers_instance[$id_carrier];
|
$best_price_carrier[$id_carrier]['instance'] = $carriers_instance[$id_carrier];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the delivery option with best price as best price
|
||||||
$delivery_option_list[$id_address][$key] = array(
|
$delivery_option_list[$id_address][$key] = array(
|
||||||
'carrier_list' => $best_price_carrier,
|
'carrier_list' => $best_price_carrier,
|
||||||
'is_best_price' => true,
|
'is_best_price' => true,
|
||||||
@@ -1889,9 +1906,11 @@ class CartCore extends ObjectModel
|
|||||||
'unique_carrier' => (count($best_price_carrier) <= 1)
|
'unique_carrier' => (count($best_price_carrier) <= 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Reset $best_grade_carrier, it's now an array
|
||||||
$best_grade_carrier = array();
|
$best_grade_carrier = array();
|
||||||
$key = '';
|
$key = '';
|
||||||
|
|
||||||
|
// Get the delivery option with the best grade
|
||||||
foreach ($best_grade_carriers as $id_package => $id_carrier)
|
foreach ($best_grade_carriers as $id_package => $id_carrier)
|
||||||
{
|
{
|
||||||
$key .= $id_carrier.',';
|
$key .= $id_carrier.',';
|
||||||
@@ -1908,16 +1927,17 @@ class CartCore extends ObjectModel
|
|||||||
$best_grade_carrier[$id_carrier]['product_list'] = array_merge($best_grade_carrier[$id_carrier]['product_list'], $packages[$id_package]['product_list']);
|
$best_grade_carrier[$id_carrier]['product_list'] = array_merge($best_grade_carrier[$id_carrier]['product_list'], $packages[$id_package]['product_list']);
|
||||||
$best_grade_carrier[$id_carrier]['instance'] = $carriers_instance[$id_carrier];
|
$best_grade_carrier[$id_carrier]['instance'] = $carriers_instance[$id_carrier];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the delivery option with best grade as best grade
|
||||||
if (!isset($delivery_option_list[$id_address][$key]))
|
if (!isset($delivery_option_list[$id_address][$key]))
|
||||||
$delivery_option_list[$id_address][$key] = array(
|
$delivery_option_list[$id_address][$key] = array(
|
||||||
'carrier_list' => $best_grade_carrier,
|
'carrier_list' => $best_grade_carrier,
|
||||||
'is_best_price' => false,
|
'is_best_price' => false,
|
||||||
'unique_carrier' => (count($best_grade_carrier) <= 1)
|
'unique_carrier' => (count($best_grade_carrier) <= 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
$delivery_option_list[$id_address][$key]['is_best_grade'] = true;
|
$delivery_option_list[$id_address][$key]['is_best_grade'] = true;
|
||||||
|
|
||||||
|
// Get all delivery options with a unique carrier
|
||||||
foreach ($common_carriers as $id_carrier)
|
foreach ($common_carriers as $id_carrier)
|
||||||
{
|
{
|
||||||
$price = 0;
|
$price = 0;
|
||||||
@@ -1956,35 +1976,75 @@ class CartCore extends ObjectModel
|
|||||||
else
|
else
|
||||||
$delivery_option_list[$id_address][$key]['unique_carrier'] = (count($delivery_option_list[$id_address][$key]['carrier_list']) <= 1);
|
$delivery_option_list[$id_address][$key]['unique_carrier'] = (count($delivery_option_list[$id_address][$key]['carrier_list']) <= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($delivery_option_list as $id_address => $delivery_option)
|
|
||||||
foreach ($delivery_option as $key => $value)
|
|
||||||
{
|
|
||||||
$total_price_with_tax = 0;
|
|
||||||
$total_price_without_tax = 0;
|
|
||||||
foreach ($value['carrier_list'] as $id_carrier => $data)
|
|
||||||
{
|
|
||||||
$total_price_with_tax += $data['price_with_tax'];
|
|
||||||
$total_price_without_tax += $data['price_without_tax'];
|
|
||||||
|
|
||||||
if (!isset($carrier_collection[$id_carrier]))
|
|
||||||
$carrier_collection[$id_carrier] = new Carrier($id_carrier);
|
|
||||||
$delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['instance'] = $carrier_collection[$id_carrier];
|
|
||||||
|
|
||||||
if (file_exists(_PS_SHIP_IMG_DIR_.$id_carrier.'.jpg'))
|
|
||||||
$delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['logo'] = _THEME_SHIP_DIR_.$id_carrier.'.jpg';
|
|
||||||
else
|
|
||||||
$delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['logo'] = false;
|
|
||||||
}
|
|
||||||
$delivery_option_list[$id_address][$key]['total_price_with_tax'] = $total_price_with_tax;
|
|
||||||
$delivery_option_list[$id_address][$key]['total_price_without_tax'] = $total_price_without_tax;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For each delivery options :
|
||||||
|
// - Set the carrier list
|
||||||
|
// - Calculate the price
|
||||||
|
// - Calculate the average position
|
||||||
|
foreach ($delivery_option_list as $id_address => $delivery_option)
|
||||||
|
foreach ($delivery_option as $key => $value)
|
||||||
|
{
|
||||||
|
$total_price_with_tax = 0;
|
||||||
|
$total_price_without_tax = 0;
|
||||||
|
$position = 0;
|
||||||
|
foreach ($value['carrier_list'] as $id_carrier => $data)
|
||||||
|
{
|
||||||
|
$total_price_with_tax += $data['price_with_tax'];
|
||||||
|
$total_price_without_tax += $data['price_without_tax'];
|
||||||
|
|
||||||
|
if (!isset($carrier_collection[$id_carrier]))
|
||||||
|
$carrier_collection[$id_carrier] = new Carrier($id_carrier);
|
||||||
|
$delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['instance'] = $carrier_collection[$id_carrier];
|
||||||
|
|
||||||
|
if (file_exists(_PS_SHIP_IMG_DIR_.$id_carrier.'.jpg'))
|
||||||
|
$delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['logo'] = _THEME_SHIP_DIR_.$id_carrier.'.jpg';
|
||||||
|
else
|
||||||
|
$delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['logo'] = false;
|
||||||
|
|
||||||
|
$position += $carrier_collection[$id_carrier]->position;
|
||||||
|
}
|
||||||
|
$delivery_option_list[$id_address][$key]['total_price_with_tax'] = $total_price_with_tax;
|
||||||
|
$delivery_option_list[$id_address][$key]['total_price_without_tax'] = $total_price_without_tax;
|
||||||
|
$delivery_option_list[$id_address][$key]['position'] = $position / count($value['carrier_list']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort delivery option list
|
||||||
|
foreach ($delivery_option_list as &$array)
|
||||||
|
uasort ($array, array('Cart', 'sortDeliveryOptionList'));
|
||||||
|
|
||||||
$cache = $delivery_option_list;
|
$cache = $delivery_option_list;
|
||||||
return $delivery_option_list;
|
return $delivery_option_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Sort list of option delivery by parameters define in the BO
|
||||||
|
* @param $option1
|
||||||
|
* @param $option2
|
||||||
|
* @return int -1 if $option 1 must be placed before and 1 if the $option1 must be placed after the $option2
|
||||||
|
*/
|
||||||
|
public static function sortDeliveryOptionList($option1, $option2)
|
||||||
|
{
|
||||||
|
static $order_by_price = null;
|
||||||
|
static $order_way = null;
|
||||||
|
if (is_null($order_by_price))
|
||||||
|
$order_by_price = !Configuration::get('PS_CARRIER_DEFAULT_SORT');
|
||||||
|
if (is_null($order_way))
|
||||||
|
$order_way = Configuration::get('PS_CARRIER_DEFAULT_ORDER');
|
||||||
|
|
||||||
|
if ($order_by_price)
|
||||||
|
if ($order_way)
|
||||||
|
return ($option1['total_price_with_tax'] < $option2['total_price_with_tax']) * 2 - 1; // return -1 or 1
|
||||||
|
else
|
||||||
|
return ($option1['total_price_with_tax'] >= $option2['total_price_with_tax']) * 2 - 1; // return -1 or 1
|
||||||
|
else
|
||||||
|
if ($order_way)
|
||||||
|
return ($option1['position'] < $option2['position']) * 2 - 1; // return -1 or 1
|
||||||
|
else
|
||||||
|
return ($option1['position'] >= $option2['position']) * 2 - 1; // return -1 or 1
|
||||||
|
}
|
||||||
|
|
||||||
public function carrierIsSelected($id_carrier, $id_address)
|
public function carrierIsSelected($id_carrier, $id_address)
|
||||||
{
|
{
|
||||||
$delivery_option = $this->getDeliveryOption();
|
$delivery_option = $this->getDeliveryOption();
|
||||||
@@ -2183,8 +2243,12 @@ class CartCore extends ObjectModel
|
|||||||
* Get the delivery option seleted, or if no delivery option was selected, the cheapest option for each address
|
* Get the delivery option seleted, or if no delivery option was selected, the cheapest option for each address
|
||||||
* @return array delivery option
|
* @return array delivery option
|
||||||
*/
|
*/
|
||||||
public function getDeliveryOption($default_country = null, $dontAutoSeletectOptions = false)
|
public function getDeliveryOption($default_country = null, $dontAutoSeletectOptions = false, $use_cache = true)
|
||||||
{
|
{
|
||||||
|
static $cache = array(0 => false, 1 => false);
|
||||||
|
if ($cache[(int)$dontAutoSeletectOptions] !== false && $use_cache)
|
||||||
|
return $cache[(int)$dontAutoSeletectOptions];
|
||||||
|
|
||||||
$delivery_option_list = $this->getDeliveryOptionList($default_country);
|
$delivery_option_list = $this->getDeliveryOptionList($default_country);
|
||||||
|
|
||||||
// The delivery option was selected
|
// The delivery option was selected
|
||||||
@@ -2200,7 +2264,10 @@ class CartCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($validated)
|
if ($validated)
|
||||||
|
{
|
||||||
|
$cache[(int)$dontAutoSeletectOptions] = $delivery_option;
|
||||||
return $delivery_option;
|
return $delivery_option;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dontAutoSeletectOptions)
|
if ($dontAutoSeletectOptions)
|
||||||
@@ -2209,13 +2276,31 @@ class CartCore extends ObjectModel
|
|||||||
// No delivery option selected or delivery option selected is not valid, get the better for all options
|
// No delivery option selected or delivery option selected is not valid, get the better for all options
|
||||||
$delivery_option = array();
|
$delivery_option = array();
|
||||||
foreach ($delivery_option_list as $id_address => $options)
|
foreach ($delivery_option_list as $id_address => $options)
|
||||||
|
{
|
||||||
foreach ($options as $key => $option)
|
foreach ($options as $key => $option)
|
||||||
if ($option['is_best_price'])
|
if (Configuration::get('PS_CARRIER_DEFAULT') == -1 && $option['is_best_price'])
|
||||||
|
{
|
||||||
|
$delivery_option[$id_address] = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
elseif (Configuration::get('PS_CARRIER_DEFAULT') == -2 && $option['is_best_grade'])
|
||||||
|
{
|
||||||
|
$delivery_option[$id_address] = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
elseif ($option['unique_carrier'] && in_array(Configuration::get('PS_CARRIER_DEFAULT'), array_keys($option['carrier_list'])))
|
||||||
{
|
{
|
||||||
$delivery_option[$id_address] = $key;
|
$delivery_option[$id_address] = $key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset($options);
|
||||||
|
if (!isset($delivery_option[$id_address]))
|
||||||
|
$delivery_option[$id_address] = key($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cache[(int)$dontAutoSeletectOptions] = $delivery_option;
|
||||||
|
|
||||||
return $delivery_option;
|
return $delivery_option;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2230,7 +2315,7 @@ class CartCore extends ObjectModel
|
|||||||
public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null)
|
public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null)
|
||||||
{
|
{
|
||||||
if (is_null($delivery_option))
|
if (is_null($delivery_option))
|
||||||
$delivery_option = $this->getDeliveryOption($default_country);
|
$delivery_option = $this->getDeliveryOption($default_country, false, false);
|
||||||
|
|
||||||
$total_shipping = 0;
|
$total_shipping = 0;
|
||||||
$delivery_option_list = $this->getDeliveryOptionList();
|
$delivery_option_list = $this->getDeliveryOptionList();
|
||||||
@@ -2458,7 +2543,7 @@ class CartCore extends ObjectModel
|
|||||||
$free_fees_price = 0;
|
$free_fees_price = 0;
|
||||||
if (isset($configuration['PS_SHIPPING_FREE_PRICE']))
|
if (isset($configuration['PS_SHIPPING_FREE_PRICE']))
|
||||||
$free_fees_price = Tools::convertPrice((float)$configuration['PS_SHIPPING_FREE_PRICE'], Currency::getCurrencyInstance((int)$this->id_currency));
|
$free_fees_price = Tools::convertPrice((float)$configuration['PS_SHIPPING_FREE_PRICE'], Currency::getCurrencyInstance((int)$this->id_currency));
|
||||||
$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING);
|
$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false);
|
||||||
if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0)
|
if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0)
|
||||||
return $shipping_cost;
|
return $shipping_cost;
|
||||||
|
|
||||||
@@ -2571,7 +2656,7 @@ class CartCore extends ObjectModel
|
|||||||
$total_weight = 0;
|
$total_weight = 0;
|
||||||
foreach ($products as $product)
|
foreach ($products as $product)
|
||||||
{
|
{
|
||||||
if (is_null($product['weight_attribute']))
|
if (!isset($product['weight_attribute']) || is_null($product['weight_attribute']))
|
||||||
$total_weight += $product['weight'] * $product['cart_quantity'];
|
$total_weight += $product['weight'] * $product['cart_quantity'];
|
||||||
else
|
else
|
||||||
$total_weight += $product['weight_attribute'] * $product['cart_quantity'];
|
$total_weight += $product['weight_attribute'] * $product['cart_quantity'];
|
||||||
@@ -2717,7 +2802,6 @@ class CartCore extends ObjectModel
|
|||||||
'formattedAddresses' => $formatted_addresses,
|
'formattedAddresses' => $formatted_addresses,
|
||||||
'products' => array_values($products),
|
'products' => array_values($products),
|
||||||
'gift_products' => $gift_products,
|
'gift_products' => $gift_products,
|
||||||
//'products_raw' => $this->getProducts(false),
|
|
||||||
'discounts' => $cart_rules,
|
'discounts' => $cart_rules,
|
||||||
'is_virtual_cart' => (int)$this->isVirtualCart(),
|
'is_virtual_cart' => (int)$this->isVirtualCart(),
|
||||||
'total_discounts' => $total_discounts,
|
'total_discounts' => $total_discounts,
|
||||||
|
|||||||
+114
-40
@@ -97,7 +97,7 @@ class CartRuleCore extends ObjectModel
|
|||||||
'product_restriction' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'product_restriction' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'shop_restriction' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'shop_restriction' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'free_shipping' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'free_shipping' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'reduction_percent' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
'reduction_percent' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPercentage'),
|
||||||
'reduction_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
'reduction_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||||
'reduction_tax' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'reduction_tax' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'reduction_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
'reduction_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||||
@@ -252,6 +252,7 @@ class CartRuleCore extends ObjectModel
|
|||||||
$cart_rule['value'] = 0;
|
$cart_rule['value'] = 0;
|
||||||
$cart_rule['minimal'] = $cart_rule['minimum_amount'];
|
$cart_rule['minimal'] = $cart_rule['minimum_amount'];
|
||||||
$cart_rule['cumulable'] = !$cart_rule['cart_rule_restriction'];
|
$cart_rule['cumulable'] = !$cart_rule['cart_rule_restriction'];
|
||||||
|
$cart_rule['id_discount_type'] = false;
|
||||||
if ($cart_rule['free_shipping'])
|
if ($cart_rule['free_shipping'])
|
||||||
$cart_rule['id_discount_type'] = Discount::FREE_SHIPPING;
|
$cart_rule['id_discount_type'] = Discount::FREE_SHIPPING;
|
||||||
elseif ($cart_rule['reduction_percent'] > 0)
|
elseif ($cart_rule['reduction_percent'] > 0)
|
||||||
@@ -401,27 +402,6 @@ class CartRuleCore extends ObjectModel
|
|||||||
return (!$display_error) ? false : Tools::displayError('You cannot use this voucher anymore (usage limit reached)');
|
return (!$display_error) ? false : Tools::displayError('You cannot use this voucher anymore (usage limit reached)');
|
||||||
}
|
}
|
||||||
|
|
||||||
$otherCartRules = $context->cart->getCartRules();
|
|
||||||
if (count($otherCartRules))
|
|
||||||
foreach ($otherCartRules as $otherCartRule)
|
|
||||||
{
|
|
||||||
if ($otherCartRule['id_cart_rule'] == $this->id && !$alreadyInCart)
|
|
||||||
return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart');
|
|
||||||
if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id)
|
|
||||||
{
|
|
||||||
$combinable = Db::getInstance()->getValue('
|
|
||||||
SELECT id_cart_rule_1
|
|
||||||
FROM '._DB_PREFIX_.'cart_rule_combination
|
|
||||||
WHERE (id_cart_rule_1 = '.(int)$this->id.' AND id_cart_rule_2 = '.(int)$otherCartRule['id_cart_rule'].')
|
|
||||||
OR (id_cart_rule_2 = '.(int)$this->id.' AND id_cart_rule_1 = '.(int)$otherCartRule['id_cart_rule'].')');
|
|
||||||
if (!$combinable)
|
|
||||||
{
|
|
||||||
$cart_rule = new CartRule($otherCartRule['cart_rule_restriction'], $context->cart->id_lang);
|
|
||||||
return (!$display_error) ? false : Tools::displayError('This voucher is not combinable with an other voucher already in your cart:').' '.$cart_rule->name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get an intersection of the customer groups and the cart rule groups (if the customer is not logged in, the default group is 1)
|
// Get an intersection of the customer groups and the cart rule groups (if the customer is not logged in, the default group is 1)
|
||||||
if ($this->group_restriction)
|
if ($this->group_restriction)
|
||||||
{
|
{
|
||||||
@@ -508,13 +488,17 @@ class CartRuleCore extends ObjectModel
|
|||||||
// If a product is given for free in this rule and already in the cart, the price is subtracted
|
// If a product is given for free in this rule and already in the cart, the price is subtracted
|
||||||
if ($this->gift_product && $alreadyInCart)
|
if ($this->gift_product && $alreadyInCart)
|
||||||
{
|
{
|
||||||
$in_cart = (bool)Db::getInstance()->getValue('
|
$query = new DbQuery();
|
||||||
SELECT id_product
|
|
||||||
FROM '._DB_PREFIX_.'cart_product
|
$query->select('id_product');
|
||||||
WHERE id_product = '.(int)$this->gift_product.'
|
$query->from('cart_product');
|
||||||
AND id_product_attribute = '.(int)$this->gift_product_attribute.'
|
$query->where('id_product = '.(int)$this->gift_product);
|
||||||
AND id_cart = '.(int)$context->cart->id);
|
$query->where('id_cart = '.(int)$context->cart->id);
|
||||||
if ($in_cart)
|
|
||||||
|
if ((int)$this->gift_product_attribute)
|
||||||
|
$query->where('id_product_attribute = '.(int)$this->gift_product_attribute);
|
||||||
|
|
||||||
|
if (Db::getInstance()->getValue($query))
|
||||||
{
|
{
|
||||||
$ref = false;
|
$ref = false;
|
||||||
$product_price = Product::getPriceStatic(
|
$product_price = Product::getPriceStatic(
|
||||||
@@ -534,6 +518,35 @@ class CartRuleCore extends ObjectModel
|
|||||||
if ($cartTotal < $minimum_amount)
|
if ($cartTotal < $minimum_amount)
|
||||||
return (!$display_error) ? false : Tools::displayError('You have not reached the minimum amount required to use this voucher');
|
return (!$display_error) ? false : Tools::displayError('You have not reached the minimum amount required to use this voucher');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the voucher is already in the cart of if a non compatible voucher is in the cart
|
||||||
|
// Important note: this MUST be the last check, because if the tested cart rule has priority over a non combinable one in the cart, we will switch them
|
||||||
|
$otherCartRules = $context->cart->getCartRules();
|
||||||
|
if (count($otherCartRules))
|
||||||
|
foreach ($otherCartRules as $otherCartRule)
|
||||||
|
{
|
||||||
|
if ($otherCartRule['id_cart_rule'] == $this->id && !$alreadyInCart)
|
||||||
|
return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart');
|
||||||
|
if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id)
|
||||||
|
{
|
||||||
|
$combinable = Db::getInstance()->getValue('
|
||||||
|
SELECT id_cart_rule_1
|
||||||
|
FROM '._DB_PREFIX_.'cart_rule_combination
|
||||||
|
WHERE (id_cart_rule_1 = '.(int)$this->id.' AND id_cart_rule_2 = '.(int)$otherCartRule['id_cart_rule'].')
|
||||||
|
OR (id_cart_rule_2 = '.(int)$this->id.' AND id_cart_rule_1 = '.(int)$otherCartRule['id_cart_rule'].')');
|
||||||
|
if (!$combinable)
|
||||||
|
{
|
||||||
|
$cart_rule = new CartRule($otherCartRule['cart_rule_restriction'], $context->cart->id_lang);
|
||||||
|
// The cart rules are not combinable and the cart rule currently in the cart has priority over the one tested
|
||||||
|
if ($cart_rule->priority <= $this->priority)
|
||||||
|
return (!$display_error) ? false : Tools::displayError('This voucher is not combinable with an other voucher already in your cart:').' '.$cart_rule->name;
|
||||||
|
// But if the cart rule that is tested has priority over the one in the cart, we remove the one in the cart and keep this new one
|
||||||
|
else
|
||||||
|
$context->cart->removeCartRule($cart_rule->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$display_error)
|
if (!$display_error)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -599,7 +612,7 @@ class CartRuleCore extends ObjectModel
|
|||||||
break;
|
break;
|
||||||
case 'categories':
|
case 'categories':
|
||||||
$cartCategories = Db::getInstance()->executeS('
|
$cartCategories = Db::getInstance()->executeS('
|
||||||
SELECT cp.quantity, cp.`id_product`, catp.`id_category`
|
SELECT cp.quantity, cp.`id_product`, cp.`id_product_attribute`, catp.`id_category`
|
||||||
FROM `'._DB_PREFIX_.'cart_product` cp
|
FROM `'._DB_PREFIX_.'cart_product` cp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_product` catp ON cp.id_product = catp.id_product
|
LEFT JOIN `'._DB_PREFIX_.'category_product` catp ON cp.id_product = catp.id_product
|
||||||
WHERE cp.`id_cart` = '.(int)$context->cart->id.'
|
WHERE cp.`id_cart` = '.(int)$context->cart->id.'
|
||||||
@@ -607,13 +620,18 @@ class CartRuleCore extends ObjectModel
|
|||||||
$countMatchingProducts = 0;
|
$countMatchingProducts = 0;
|
||||||
$matchingProductsList = array();
|
$matchingProductsList = array();
|
||||||
foreach ($cartCategories as $cartCategory)
|
foreach ($cartCategories as $cartCategory)
|
||||||
if (in_array($cartCategory['id_category'], $productRule['values']))
|
if (in_array($cartCategory['id_category'], $productRule['values'])
|
||||||
|
// We also check that the product is not already in the matching product list, because there are doubles in the query results (when the product is in multiple categories)
|
||||||
|
&& !in_array($cartCategory['id_product'].'-'.$cartCategory['id_product_attribute'], $matchingProductsList))
|
||||||
{
|
{
|
||||||
$countMatchingProducts += $cartCategory['quantity'];
|
$countMatchingProducts += $cartCategory['quantity'];
|
||||||
$matchingProductsList[] = $cartCategory['id_product'].'-0';
|
$matchingProductsList[] = $cartCategory['id_product'].'-'.$cartCategory['id_product_attribute'];
|
||||||
}
|
}
|
||||||
if ($countMatchingProducts < $productRuleGroup['quantity'])
|
if ($countMatchingProducts < $productRuleGroup['quantity'])
|
||||||
return (!$display_error) ? false : Tools::displayError('You cannot use this voucher with these products');
|
return (!$display_error) ? false : Tools::displayError('You cannot use this voucher with these products');
|
||||||
|
// Attribute id is not important for this filter in the global list, so the ids are replaced by 0
|
||||||
|
foreach ($matchingProductsList as &$matchingProduct)
|
||||||
|
$matchingProduct = preg_replace('/^([0-9]+)-[0-9]+$/', '$1-0', $matchingProduct);
|
||||||
$eligibleProductsList = CartRule::array_uintersect($eligibleProductsList, $matchingProductsList);
|
$eligibleProductsList = CartRule::array_uintersect($eligibleProductsList, $matchingProductsList);
|
||||||
break;
|
break;
|
||||||
case 'manufacturers':
|
case 'manufacturers':
|
||||||
@@ -699,9 +717,10 @@ class CartRuleCore extends ObjectModel
|
|||||||
*
|
*
|
||||||
* @param bool $use_tax
|
* @param bool $use_tax
|
||||||
* @param Context $context
|
* @param Context $context
|
||||||
|
* @param boolean $use_cache Allow using cache to avoid multiple free gift using multishipping
|
||||||
* @return float|int|string
|
* @return float|int|string
|
||||||
*/
|
*/
|
||||||
public function getContextualValue($use_tax, Context $context = null, $filter = null, $package = null)
|
public function getContextualValue($use_tax, Context $context = null, $filter = null, $package = null, $use_cache = true)
|
||||||
{
|
{
|
||||||
if (!CartRule::isFeatureActive())
|
if (!CartRule::isFeatureActive())
|
||||||
return 0;
|
return 0;
|
||||||
@@ -799,8 +818,12 @@ class CartRuleCore extends ObjectModel
|
|||||||
if ($this->reduction_amount)
|
if ($this->reduction_amount)
|
||||||
{
|
{
|
||||||
$prorata = 1;
|
$prorata = 1;
|
||||||
if (!is_null($package))
|
if (!is_null($package) && count($all_products))
|
||||||
$prorata = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS, $package['products']) / $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS);
|
{
|
||||||
|
$total_products = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS);
|
||||||
|
if ($total_products)
|
||||||
|
$prorata = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS, $package['products']) / $total_products;
|
||||||
|
}
|
||||||
|
|
||||||
$reduction_amount = $this->reduction_amount;
|
$reduction_amount = $this->reduction_amount;
|
||||||
// If we need to convert the voucher value to the cart currency
|
// If we need to convert the voucher value to the cart currency
|
||||||
@@ -878,16 +901,17 @@ class CartRuleCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$id_address = (is_null($package) ? 0 : $package['id_address']);
|
$id_address = (is_null($package) ? 0 : $package['id_address']);
|
||||||
foreach ($package_products as $product)
|
foreach ($package_products as $product)
|
||||||
if ($product['id_product'] == $this->gift_product && $product['id_product_attribute'] == $this->gift_product_attribute)
|
if ($product['id_product'] == $this->gift_product && ($product['id_product_attribute'] == $this->gift_product_attribute || !(int)$this->gift_product_attribute))
|
||||||
{
|
{
|
||||||
// The free gift coupon must be applied to one product only (needed for multi-shipping which manage multiple product lists)
|
// The free gift coupon must be applied to one product only (needed for multi-shipping which manage multiple product lists)
|
||||||
if (!isset(CartRule::$only_one_gift[$this->id.'-'.$this->gift_product])
|
if (!isset(CartRule::$only_one_gift[$this->id.'-'.$this->gift_product])
|
||||||
|| CartRule::$only_one_gift[$this->id.'-'.$this->gift_product] == $id_address
|
|| CartRule::$only_one_gift[$this->id.'-'.$this->gift_product] == $id_address
|
||||||
|| CartRule::$only_one_gift[$this->id.'-'.$this->gift_product] == 0
|
|| CartRule::$only_one_gift[$this->id.'-'.$this->gift_product] == 0
|
||||||
|| $id_address == 0)
|
|| $id_address == 0
|
||||||
|
|| !$use_cache)
|
||||||
{
|
{
|
||||||
$reduction_value += ($use_tax ? $product['price_wt'] : $product['price']);
|
$reduction_value += ($use_tax ? $product['price_wt'] : $product['price']);
|
||||||
if (!isset(CartRule::$only_one_gift[$this->id.'-'.$this->gift_product]) || CartRule::$only_one_gift[$this->id.'-'.$this->gift_product] == 0)
|
if ($use_cache && (!isset(CartRule::$only_one_gift[$this->id.'-'.$this->gift_product]) || CartRule::$only_one_gift[$this->id.'-'.$this->gift_product] == 0))
|
||||||
CartRule::$only_one_gift[$this->id.'-'.$this->gift_product] = $id_address;
|
CartRule::$only_one_gift[$this->id.'-'.$this->gift_product] = $id_address;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -896,6 +920,15 @@ class CartRuleCore extends ObjectModel
|
|||||||
|
|
||||||
return $reduction_value;
|
return $reduction_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure caches are empty
|
||||||
|
* Must be called before calling multiple time getContextualValue()
|
||||||
|
*/
|
||||||
|
public static function cleanCache()
|
||||||
|
{
|
||||||
|
self::$only_one_gift = array();
|
||||||
|
}
|
||||||
|
|
||||||
protected function getCartRuleCombinations()
|
protected function getCartRuleCombinations()
|
||||||
{
|
{
|
||||||
@@ -939,9 +972,9 @@ class CartRuleCore extends ObjectModel
|
|||||||
$shop_list = '';
|
$shop_list = '';
|
||||||
if ($type == 'shop')
|
if ($type == 'shop')
|
||||||
{
|
{
|
||||||
$shop_list = ' AND t.id_shop IN (';
|
|
||||||
$shops = Context::getContext()->employee->getAssociatedShops();
|
$shops = Context::getContext()->employee->getAssociatedShops();
|
||||||
$shop_list .= implode(array_map('intval', $shops), ',').')';
|
if (count($shops))
|
||||||
|
$shop_list = ' AND t.id_shop IN ('.implode(array_map('intval', $shops), ',').') ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Validate::isLoadedObject($this) OR $this->{$type.'_restriction'} == 0)
|
if (!Validate::isLoadedObject($this) OR $this->{$type.'_restriction'} == 0)
|
||||||
@@ -1056,6 +1089,7 @@ class CartRuleCore extends ObjectModel
|
|||||||
ORDER BY priority');
|
ORDER BY priority');
|
||||||
|
|
||||||
$cartRules = ObjectModel::hydrateCollection('CartRule', $result);
|
$cartRules = ObjectModel::hydrateCollection('CartRule', $result);
|
||||||
|
|
||||||
foreach ($cartRules as $cartRule)
|
foreach ($cartRules as $cartRule)
|
||||||
if ($cartRule->checkValidity($context, false, false))
|
if ($cartRule->checkValidity($context, false, false))
|
||||||
$context->cart->addCartRule($cartRule->id);
|
$context->cart->addCartRule($cartRule->id);
|
||||||
@@ -1069,6 +1103,46 @@ class CartRuleCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
return (bool)Configuration::get('PS_CART_RULE_FEATURE_ACTIVE');
|
return (bool)Configuration::get('PS_CART_RULE_FEATURE_ACTIVE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When an entity associated to a product rule (product, category, attribute, supplier, manufacturer...) is deleted, the product rules must be updated */
|
||||||
|
public static function cleanProductRuleIntegrity($type, $list)
|
||||||
|
{
|
||||||
|
// Type must be available in the 'type' enum of the table cart_rule_product_rule
|
||||||
|
if (!in_array($type, array('products', 'categories', 'attributes', 'manufacturers', 'suppliers')))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// This check must not be removed because this var is used a few lines below
|
||||||
|
$list = (is_array($list) ? implode(',', array_map('intval', $list)) : (int)$list);
|
||||||
|
if (!preg_match('/^[0-9,]+$/', $list))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Delete associated restrictions on cart rules
|
||||||
|
Db::getInstance()->execute('
|
||||||
|
DELETE crprv
|
||||||
|
FROM `'._DB_PREFIX_.'cart_rule_product_rule` crpr
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'cart_rule_product_rule_value` crprv ON crpr.`id_product_rule` = crprv.`id_product_rule`
|
||||||
|
WHERE crpr.`type` = "'.pSQL($type).'"
|
||||||
|
AND crprv.`id_item` IN ('.$list.')'); // $list is checked a few lines above
|
||||||
|
|
||||||
|
// Delete the product rules that does not have any values
|
||||||
|
if (Db::getInstance()->Affected_Rows() > 0)
|
||||||
|
Db::getInstance()->execute('
|
||||||
|
DELETE FROM `'._DB_PREFIX_.'cart_rule_product_rule`
|
||||||
|
WHERE `id_product_rule` NOT IN (SELECT id_product_rule FROM `'._DB_PREFIX_.'cart_rule_product_rule_value`)');
|
||||||
|
// If the product rules were the only conditions of a product rule group, delete the product rule group
|
||||||
|
if (Db::getInstance()->Affected_Rows() > 0)
|
||||||
|
Db::getInstance()->execute('
|
||||||
|
DELETE FROM `'._DB_PREFIX_.'cart_rule_product_rule_group`
|
||||||
|
WHERE `id_product_rule_group` NOT IN (SELECT id_product_rule_group FROM `'._DB_PREFIX_.'cart_rule_product_rule`)');
|
||||||
|
// If the product rule group were the only restrictions of a cart rule, update de cart rule restriction cache
|
||||||
|
if (Db::getInstance()->Affected_Rows() > 0)
|
||||||
|
Db::getInstance()->execute('
|
||||||
|
UPDATE `'._DB_PREFIX_.'cart_rule` cr
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'cart_rule_product_rule_group` crprg ON cr.id_cart_rule = crprg.id_cart_rule
|
||||||
|
SET product_restriction = IF(crprg.id_product_rule_group IS NULL, 0, 1)');
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
|
|||||||
+46
-74
@@ -79,12 +79,6 @@ class CategoryCore extends ObjectModel
|
|||||||
|
|
||||||
public $groupBox;
|
public $groupBox;
|
||||||
|
|
||||||
/** @var boolean does the product have to be removed during the delete process */
|
|
||||||
public $remove_products = true;
|
|
||||||
|
|
||||||
/** @var boolean does the product have to be disable during the delete process */
|
|
||||||
public $disable_products = false;
|
|
||||||
|
|
||||||
protected static $_links = array();
|
protected static $_links = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -256,12 +250,18 @@ class CategoryCore extends ObjectModel
|
|||||||
$children[] = $categ->recurseLiteCategTree($max_depth, $current_depth + 1, $id_lang, $excluded_ids_array);
|
$children[] = $categ->recurseLiteCategTree($max_depth, $current_depth + 1, $id_lang, $excluded_ids_array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_array($this->description))
|
||||||
|
foreach ($this->description as $lang => $description)
|
||||||
|
$this->description[$lang] = Category::getDescriptionClean($description);
|
||||||
|
else
|
||||||
|
$this->description = Category::getDescriptionClean($this->description);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'id' => (int)$this->id_category,
|
'id' => (int)$this->id_category,
|
||||||
'link' => Context::getContext()->link->getCategoryLink($this->id, $this->link_rewrite),
|
'link' => Context::getContext()->link->getCategoryLink($this->id, $this->link_rewrite),
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'desc'=> Category::getDescriptionClean($this->description),
|
'desc'=> $this->description,
|
||||||
'children' => $children
|
'children' => $children
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -305,72 +305,31 @@ class CategoryCore extends ObjectModel
|
|||||||
|
|
||||||
$this->clearCache();
|
$this->clearCache();
|
||||||
|
|
||||||
/* Get childs categories */
|
$all_cat = $this->getAllChildren();
|
||||||
$to_delete = array((int)$this->id);
|
$all_cat[] = $this;
|
||||||
$this->recursiveDelete($to_delete, (int)$this->id);
|
foreach ($all_cat as $cat)
|
||||||
$to_delete = array_unique($to_delete);
|
|
||||||
|
|
||||||
/* Delete category and its child from database */
|
|
||||||
$list = count($to_delete) > 1 ? implode(',', array_map('intval', $to_delete)) : (int)$this->id;
|
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category` WHERE `id_category` IN ('.$list.')');
|
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_lang` WHERE `id_category` IN ('.$list.')');
|
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_category` IN ('.$list.')');
|
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` IN ('.$list.')');
|
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_shop` WHERE `id_category` IN ('.$list.')');
|
|
||||||
|
|
||||||
Category::cleanPositions($this->id_parent);
|
|
||||||
|
|
||||||
/* Delete category images and its children images */
|
|
||||||
$tmp_category = new Category();
|
|
||||||
foreach ($to_delete as $id_category)
|
|
||||||
{
|
{
|
||||||
$tmp_category->id = (int)$id_category;
|
parent::delete();
|
||||||
$tmp_category->deleteImage();
|
if (!$this->hasMultishopEntries())
|
||||||
}
|
|
||||||
|
|
||||||
/* Delete or link products which were not in others categories */
|
|
||||||
$result = Db::getInstance()->executeS('
|
|
||||||
SELECT `id_product`
|
|
||||||
FROM `'._DB_PREFIX_.'product`
|
|
||||||
WHERE `id_product` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'category_product`)
|
|
||||||
');
|
|
||||||
foreach ($result as $p)
|
|
||||||
{
|
|
||||||
$product = new Product((int)$p['id_product']);
|
|
||||||
if (Validate::isLoadedObject($product))
|
|
||||||
{
|
{
|
||||||
if ($this->remove_products || $this->id_parent == 0)
|
$cat->deleteImage();
|
||||||
$product->delete();
|
$cat->cleanGroups();
|
||||||
else
|
$cat->cleanAssoProducts();
|
||||||
{
|
// Delete associated restrictions on cart rules
|
||||||
if ($this->disable_products)
|
CartRule::cleanProductRuleIntegrity('categories', array($cat->id));
|
||||||
$product->active = 0;
|
Category::cleanPositions($cat->id_parent);
|
||||||
|
/* Delete Categories in GroupReduction */
|
||||||
$product->addToCategories($this->id_parent);
|
if (GroupReduction::getGroupReductionByCategoryId((int)$cat->id))
|
||||||
$product->save();
|
GroupReduction::deleteCategory($cat->id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set category default to Home category where categorie no more exists */
|
|
||||||
$result = Db::getInstance()->execute('
|
|
||||||
UPDATE `'._DB_PREFIX_.'product_shop`
|
|
||||||
SET `id_category_default` = '.(int)Configuration::get('PS_HOME_CATEGORY').'
|
|
||||||
WHERE `id_category_default`
|
|
||||||
NOT IN (SELECT `id_category` FROM `'._DB_PREFIX_.'category`)
|
|
||||||
');
|
|
||||||
|
|
||||||
/* Rebuild the nested tree */
|
/* Rebuild the nested tree */
|
||||||
if (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree)
|
if (!$this->hasMultishopEntries() && (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree))
|
||||||
Category::regenerateEntireNtree();
|
Category::regenerateEntireNtree();
|
||||||
|
|
||||||
Hook::exec('actionCategoryDelete', array('category' => $this));
|
Hook::exec('actionCategoryDelete', array('category' => $this));
|
||||||
|
|
||||||
/* Delete Categories in GroupReduction */
|
|
||||||
foreach ($to_delete as $category)
|
|
||||||
if (GroupReduction::getGroupReductionByCategoryId((int)$category))
|
|
||||||
GroupReduction::deleteCategory($category);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,9 +475,11 @@ class CategoryCore extends ObjectModel
|
|||||||
SELECT c.`id_category`, cl.`name`
|
SELECT c.`id_category`, cl.`name`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
||||||
|
'.Shop::addSqlAssociation('category', 'c').'
|
||||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||||
|
AND c.`id_category` != '.Configuration::get('PS_ROOT_CATEGORY').'
|
||||||
GROUP BY c.id_category
|
GROUP BY c.id_category
|
||||||
ORDER BY c.`position`');
|
ORDER BY c.`id_category`, category_shop.`position`');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShopID()
|
public function getShopID()
|
||||||
@@ -877,12 +838,15 @@ class CategoryCore extends ObjectModel
|
|||||||
return self::$_links[$id_category.'-'.$id_lang];
|
return self::$_links[$id_category.'-'.$id_lang];
|
||||||
|
|
||||||
$result = Db::getInstance()->getRow('
|
$result = Db::getInstance()->getRow('
|
||||||
SELECT cl.`link_rewrite`
|
SELECT cl.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category_lang` cl
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').'
|
WHERE `id_lang` = '.(int)$id_lang.'
|
||||||
WHERE `id_lang` = '.(int)$id_lang.'
|
'.Shop::addSqlRestrictionOnLang('cl').'
|
||||||
AND c.`id_category` = '.(int)$id_category);
|
AND cl.`id_category` = '.(int)$id_category
|
||||||
|
);
|
||||||
|
|
||||||
self::$_links[$id_category.'-'.$id_lang] = $result['link_rewrite'];
|
self::$_links[$id_category.'-'.$id_lang] = $result['link_rewrite'];
|
||||||
|
|
||||||
return $result['link_rewrite'];
|
return $result['link_rewrite'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -971,7 +935,7 @@ class CategoryCore extends ObjectModel
|
|||||||
|
|
||||||
$categories = null;
|
$categories = null;
|
||||||
$id_current = $this->id;
|
$id_current = $this->id;
|
||||||
if (count(Category::getCategoriesWithoutParent()) > 1)
|
if (count(Category::getCategoriesWithoutParent()) > 1 && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) != 1)
|
||||||
$context->shop->id_category = Category::getTopCategory()->id;
|
$context->shop->id_category = Category::getTopCategory()->id;
|
||||||
elseif (!$context->shop->id)
|
elseif (!$context->shop->id)
|
||||||
$context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
$context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||||
@@ -1032,6 +996,11 @@ class CategoryCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.(int)$this->id);
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.(int)$this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function cleanAssoProducts()
|
||||||
|
{
|
||||||
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_category` = '.(int)$this->id);
|
||||||
|
}
|
||||||
|
|
||||||
public function addGroups($groups)
|
public function addGroups($groups)
|
||||||
{
|
{
|
||||||
@@ -1168,8 +1137,10 @@ class CategoryCore extends ObjectModel
|
|||||||
* @param mixed $id_category_parent
|
* @param mixed $id_category_parent
|
||||||
* @return boolean true if succeed
|
* @return boolean true if succeed
|
||||||
*/
|
*/
|
||||||
public static function cleanPositions($id_category_parent)
|
public static function cleanPositions($id_category_parent = null)
|
||||||
{
|
{
|
||||||
|
if ($id_category_parent === null)
|
||||||
|
return;
|
||||||
$return = true;
|
$return = true;
|
||||||
|
|
||||||
$id = Context::getContext()->shop->id;
|
$id = Context::getContext()->shop->id;
|
||||||
@@ -1342,6 +1313,7 @@ class CategoryCore extends ObjectModel
|
|||||||
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, cl.`id_lang`
|
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, cl.`id_lang`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
||||||
|
'.Shop::addSqlAssociation('category', 'c').'
|
||||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||||
AND c.`id_category` IN ('.implode(',', array_map('intval', $ids_category)).')
|
AND c.`id_category` IN ('.implode(',', array_map('intval', $ids_category)).')
|
||||||
');
|
');
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class CombinationCore extends ObjectModel
|
|||||||
public static $definition = array(
|
public static $definition = array(
|
||||||
'table' => 'product_attribute',
|
'table' => 'product_attribute',
|
||||||
'primary' => 'id_product_attribute',
|
'primary' => 'id_product_attribute',
|
||||||
'multishop' => true,
|
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||||
'location' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
|
'location' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
|
||||||
@@ -101,7 +100,10 @@ class CombinationCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!parent::delete())
|
if (!parent::delete())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Removes the product from StockAvailable, for the current shop
|
||||||
|
StockAvailable::removeProductFromStockAvailable((int)$this->id_product, (int)$this->id);
|
||||||
|
|
||||||
if (!$this->hasMultishopEntries() && !$this->deleteAssociations())
|
if (!$this->hasMultishopEntries() && !$this->deleteAssociations())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
@@ -138,7 +140,7 @@ class CombinationCore extends ObjectModel
|
|||||||
$ids_attributes = array();
|
$ids_attributes = array();
|
||||||
foreach ($values as $value)
|
foreach ($values as $value)
|
||||||
$ids_attributes[] = $value['id'];
|
$ids_attributes[] = $value['id'];
|
||||||
return $this->setAttributes($values);
|
return $this->setAttributes($ids_attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWsProductOptionValues()
|
public function getWsProductOptionValues()
|
||||||
|
|||||||
+45
-45
@@ -93,9 +93,9 @@ class ConfigurationCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getIdByName($key, $id_shop_group = null, $id_shop = null)
|
public static function getIdByName($key, $id_shop_group = null, $id_shop = null)
|
||||||
{
|
{
|
||||||
if (is_null($id_shop))
|
if ($id_shop === null)
|
||||||
$id_shop = Shop::getContextShopID();
|
$id_shop = Shop::getContextShopID();
|
||||||
if (is_null($id_shop_group))
|
if ($id_shop_group === null)
|
||||||
$id_shop_group = Shop::getContextShopGroupID();
|
$id_shop_group = Shop::getContextShopGroupID();
|
||||||
|
|
||||||
$sql = 'SELECT id_configuration
|
$sql = 'SELECT id_configuration
|
||||||
@@ -146,19 +146,23 @@ class ConfigurationCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function get($key, $id_lang = null, $id_shop_group = null, $id_shop = null)
|
public static function get($key, $id_lang = null, $id_shop_group = null, $id_shop = null)
|
||||||
{
|
{
|
||||||
|
// If conf if not initialized, try manual query
|
||||||
|
if (!self::$_CONF)
|
||||||
|
{
|
||||||
|
Configuration::loadConfiguration();
|
||||||
|
if (!self::$_CONF)
|
||||||
|
return Db::getInstance()->getValue('SELECT `value` FROM `'._DB_PREFIX_.'configuration` WHERE `name` = "'.pSQL($key).'"');
|
||||||
|
}
|
||||||
|
|
||||||
$id_lang = (int)$id_lang;
|
$id_lang = (int)$id_lang;
|
||||||
if (is_null($id_shop))
|
if ($id_shop === null)
|
||||||
$id_shop = Shop::getContextShopID();
|
$id_shop = Shop::getContextShopID();
|
||||||
if (is_null($id_shop_group))
|
if ($id_shop_group === null)
|
||||||
$id_shop_group = Shop::getContextShopGroupID();
|
$id_shop_group = Shop::getContextShopGroupID();
|
||||||
|
|
||||||
if (!isset(self::$_CONF[$id_lang]))
|
if (!isset(self::$_CONF[$id_lang]))
|
||||||
$id_lang = 0;
|
$id_lang = 0;
|
||||||
|
|
||||||
// If conf if not initialized, try manual query
|
|
||||||
if (!self::$_CONF)
|
|
||||||
return Db::getInstance()->getValue('SELECT `value` FROM '._DB_PREFIX_.'configuration WHERE `name` = \''.pSQL($key).'\'');
|
|
||||||
|
|
||||||
if ($id_shop && Configuration::hasKey($key, $id_lang, null, $id_shop))
|
if ($id_shop && Configuration::hasKey($key, $id_lang, null, $id_shop))
|
||||||
return self::$_CONF[$id_lang]['shop'][$id_shop][$key];
|
return self::$_CONF[$id_lang]['shop'][$id_shop][$key];
|
||||||
else if ($id_shop_group && Configuration::hasKey($key, $id_lang, $id_shop_group))
|
else if ($id_shop_group && Configuration::hasKey($key, $id_lang, $id_shop_group))
|
||||||
@@ -203,9 +207,9 @@ class ConfigurationCore extends ObjectModel
|
|||||||
throw new PrestaShopException('keys var is not an array');
|
throw new PrestaShopException('keys var is not an array');
|
||||||
|
|
||||||
$id_lang = (int)$id_lang;
|
$id_lang = (int)$id_lang;
|
||||||
if (is_null($id_shop))
|
if ($id_shop === null)
|
||||||
$id_shop = Shop::getContextShopID();
|
$id_shop = Shop::getContextShopID();
|
||||||
if (is_null($id_shop_group))
|
if ($id_shop_group === null)
|
||||||
$id_shop_group = Shop::getContextShopGroupID();
|
$id_shop_group = Shop::getContextShopGroupID();
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
@@ -246,9 +250,9 @@ class ConfigurationCore extends ObjectModel
|
|||||||
if (!Validate::isConfigName($key))
|
if (!Validate::isConfigName($key))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
if (is_null($id_shop))
|
if ($id_shop === null)
|
||||||
$id_shop = Shop::getContextShopID();
|
$id_shop = Shop::getContextShopID();
|
||||||
if (is_null($id_shop_group))
|
if ($id_shop_group === null)
|
||||||
$id_shop_group = Shop::getContextShopGroupID();
|
$id_shop_group = Shop::getContextShopGroupID();
|
||||||
|
|
||||||
if (!is_array($values))
|
if (!is_array($values))
|
||||||
@@ -293,9 +297,9 @@ class ConfigurationCore extends ObjectModel
|
|||||||
if (!Validate::isConfigName($key))
|
if (!Validate::isConfigName($key))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
if (is_null($id_shop))
|
if ($id_shop === null)
|
||||||
$id_shop = Shop::getContextShopID();
|
$id_shop = Shop::getContextShopID();
|
||||||
if (is_null($id_shop_group))
|
if ($id_shop_group === null)
|
||||||
$id_shop_group = Shop::getContextShopGroupID();
|
$id_shop_group = Shop::getContextShopGroupID();
|
||||||
|
|
||||||
if (!is_array($values))
|
if (!is_array($values))
|
||||||
@@ -379,17 +383,20 @@ class ConfigurationCore extends ObjectModel
|
|||||||
if (!Validate::isConfigName($key))
|
if (!Validate::isConfigName($key))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'configuration_lang`
|
$result = Db::getInstance()->execute('
|
||||||
WHERE `id_configuration` IN (
|
DELETE FROM `'._DB_PREFIX_.'configuration_lang`
|
||||||
SELECT `id_configuration`
|
WHERE `id_configuration` IN (
|
||||||
FROM `'._DB_PREFIX_.'configuration`
|
SELECT `id_configuration`
|
||||||
WHERE `name` = \''.pSQL($key).'\'
|
FROM `'._DB_PREFIX_.'configuration`
|
||||||
)';
|
WHERE `name` = "'.pSQL($key).'"
|
||||||
$result = Db::getInstance()->execute($sql);
|
)');
|
||||||
|
|
||||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'configuration`
|
$result2 = Db::getInstance()->execute('
|
||||||
WHERE `name` = \''.pSQL($key).'\'';
|
DELETE FROM `'._DB_PREFIX_.'configuration`
|
||||||
$result2 = Db::getInstance()->execute($sql);
|
WHERE `name` = "'.pSQL($key).'"');
|
||||||
|
|
||||||
|
self::$_CONF = null;
|
||||||
|
|
||||||
return ($result && $result2);
|
return ($result && $result2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,29 +408,22 @@ class ConfigurationCore extends ObjectModel
|
|||||||
public static function deleteFromContext($key)
|
public static function deleteFromContext($key)
|
||||||
{
|
{
|
||||||
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
||||||
$id_shop = $id_shop_group = null;
|
|
||||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
|
||||||
{
|
|
||||||
$id_shop_group = Shop::getContextShopGroupID();
|
|
||||||
$id_shop = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$id_shop_group = Shop::getContextShopGroupID();
|
|
||||||
$id_shop = Shop::getContextShopID();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$id_shop && !$id_shop_group)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
$id_shop = null;
|
||||||
|
$id_shop_group = Shop::getContextShopGroupID();
|
||||||
|
if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||||
|
$id_shop = Shop::getContextShopID();
|
||||||
|
|
||||||
$id = Configuration::getIdByName($key, $id_shop_group, $id_shop);
|
$id = Configuration::getIdByName($key, $id_shop_group, $id_shop);
|
||||||
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration
|
Db::getInstance()->execute('
|
||||||
WHERE id_configuration = '.$id;
|
DELETE FROM '._DB_PREFIX_.'configuration
|
||||||
Db::getInstance()->execute($sql);
|
WHERE id_configuration = '.(int)$id);
|
||||||
|
Db::getInstance()->execute('
|
||||||
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration_lang
|
DELETE FROM '._DB_PREFIX_.'configuration_lang
|
||||||
WHERE id_configuration = '.$id;
|
WHERE id_configuration = '.(int)$id);
|
||||||
Db::getInstance()->execute($sql);
|
|
||||||
|
self::$_CONF = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -66,12 +66,15 @@ class ContactCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getContacts($id_lang)
|
public static function getContacts($id_lang)
|
||||||
{
|
{
|
||||||
|
$shop_ids = Shop::getContextListShopID();
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM `'._DB_PREFIX_.'contact` c
|
FROM `'._DB_PREFIX_.'contact` c
|
||||||
'.Shop::addSqlAssociation('contact', 'c', false).'
|
'.Shop::addSqlAssociation('contact', 'c', false).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`)
|
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`)
|
||||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||||
|
AND contact_shop.`id_shop` IN ('.implode(', ', array_map('intval', $shop_ids)).')
|
||||||
ORDER BY `name` ASC';
|
ORDER BY `name` ASC';
|
||||||
|
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+26
-11
@@ -59,11 +59,11 @@ class CookieCore
|
|||||||
* @param $name Cookie name before encrypting
|
* @param $name Cookie name before encrypting
|
||||||
* @param $path
|
* @param $path
|
||||||
*/
|
*/
|
||||||
public function __construct($name, $path = '', $expire = null)
|
public function __construct($name, $path = '', $expire = null, $shared_urls = null)
|
||||||
{
|
{
|
||||||
$this->_content = array();
|
$this->_content = array();
|
||||||
$this->_expire = isset($expire) ? (int)($expire) : (time() + 1728000);
|
$this->_expire = isset($expire) ? (int)($expire) : (time() + 1728000);
|
||||||
$this->_name = md5($name);
|
$this->_name = md5(_PS_VERSION_.$name);
|
||||||
$this->_path = trim(Context::getContext()->shop->physical_uri.$path, '/\\').'/';
|
$this->_path = trim(Context::getContext()->shop->physical_uri.$path, '/\\').'/';
|
||||||
if ($this->_path{0} != '/') $this->_path = '/'.$this->_path;
|
if ($this->_path{0} != '/') $this->_path = '/'.$this->_path;
|
||||||
$this->_path = rawurlencode($this->_path);
|
$this->_path = rawurlencode($this->_path);
|
||||||
@@ -71,7 +71,7 @@ class CookieCore
|
|||||||
$this->_path = str_replace('%7E', '~', $this->_path);
|
$this->_path = str_replace('%7E', '~', $this->_path);
|
||||||
$this->_key = _COOKIE_KEY_;
|
$this->_key = _COOKIE_KEY_;
|
||||||
$this->_iv = _COOKIE_IV_;
|
$this->_iv = _COOKIE_IV_;
|
||||||
$this->_domain = $this->getDomain();
|
$this->_domain = $this->getDomain($shared_urls);
|
||||||
if (Configuration::get('PS_CIPHER_ALGORITHM'))
|
if (Configuration::get('PS_CIPHER_ALGORITHM'))
|
||||||
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
||||||
else
|
else
|
||||||
@@ -79,7 +79,7 @@ class CookieCore
|
|||||||
$this->update();
|
$this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDomain()
|
protected function getDomain($shared_urls = null)
|
||||||
{
|
{
|
||||||
$r = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
|
$r = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
|
||||||
preg_match ($r, Tools::getHttpHost(false, false), $out);
|
preg_match ($r, Tools::getHttpHost(false, false), $out);
|
||||||
@@ -89,8 +89,23 @@ class CookieCore
|
|||||||
return false;
|
return false;
|
||||||
if (!strstr(Tools::getHttpHost(false, false), '.'))
|
if (!strstr(Tools::getHttpHost(false, false), '.'))
|
||||||
return false;
|
return false;
|
||||||
$domain = $out[4];
|
|
||||||
|
$domain = false;
|
||||||
|
if ($shared_urls !== null)
|
||||||
|
{
|
||||||
|
foreach ($shared_urls as $shared_url)
|
||||||
|
{
|
||||||
|
if ($shared_url != $out[4])
|
||||||
|
continue;
|
||||||
|
if (preg_match('/^(?:.*\.)?([^.]*(?:.{2,3})?\..{2,3})$/Ui', $shared_url, $res))
|
||||||
|
{
|
||||||
|
$domain = '.'.$res[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$domain)
|
||||||
|
$domain = $out[4];
|
||||||
return $domain;
|
return $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,8 +273,8 @@ class CookieCore
|
|||||||
{
|
{
|
||||||
$tmpTab2 = explode('|', $keyAndValue);
|
$tmpTab2 = explode('|', $keyAndValue);
|
||||||
if (count($tmpTab2) == 2)
|
if (count($tmpTab2) == 2)
|
||||||
$this->_content[$tmpTab2[0]] = $tmpTab2[1];
|
$this->_content[$tmpTab2[0]] = $tmpTab2[1];
|
||||||
}
|
}
|
||||||
/* Blowfish fix */
|
/* Blowfish fix */
|
||||||
if (isset($this->_content['checksum']))
|
if (isset($this->_content['checksum']))
|
||||||
$this->_content['checksum'] = (int)($this->_content['checksum']);
|
$this->_content['checksum'] = (int)($this->_content['checksum']);
|
||||||
@@ -294,7 +309,7 @@ class CookieCore
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$content = 0;
|
$content = 0;
|
||||||
$time = time() - 1;
|
$time = 1;
|
||||||
}
|
}
|
||||||
if (PHP_VERSION_ID <= 50200) /* PHP version > 5.2.0 */
|
if (PHP_VERSION_ID <= 50200) /* PHP version > 5.2.0 */
|
||||||
return setcookie($this->_name, $content, $time, $this->_path, $this->_domain, 0);
|
return setcookie($this->_name, $content, $time, $this->_path, $this->_domain, 0);
|
||||||
@@ -303,8 +318,8 @@ class CookieCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save cookie with setcookie()
|
* Save cookie with setcookie()
|
||||||
*/
|
*/
|
||||||
public function write()
|
public function write()
|
||||||
{
|
{
|
||||||
$cookie = '';
|
$cookie = '';
|
||||||
|
|||||||
+38
-7
@@ -177,7 +177,7 @@ class CustomerCore extends ObjectModel
|
|||||||
'max_payment_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false),
|
'max_payment_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false),
|
||||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
||||||
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
||||||
'note' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 65000, 'copy_post' => false),
|
'note' => array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml', 'size' => 65000, 'copy_post' => false),
|
||||||
'is_guest' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
'is_guest' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
||||||
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false),
|
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false),
|
||||||
'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false),
|
'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false),
|
||||||
@@ -198,7 +198,10 @@ class CustomerCore extends ObjectModel
|
|||||||
$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
|
$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
|
||||||
$this->secure_key = md5(uniqid(rand(), true));
|
$this->secure_key = md5(uniqid(rand(), true));
|
||||||
$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes'));
|
$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes'));
|
||||||
|
|
||||||
|
if ($this->newsletter && !Validate::isDate($this->newsletter_date_add))
|
||||||
|
$this->newsletter_date_add = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
if ($this->id_default_group == _PS_DEFAULT_CUSTOMER_GROUP_)
|
if ($this->id_default_group == _PS_DEFAULT_CUSTOMER_GROUP_)
|
||||||
if ($this->is_guest)
|
if ($this->is_guest)
|
||||||
$this->id_default_group = Configuration::get('PS_GUEST_GROUP');
|
$this->id_default_group = Configuration::get('PS_GUEST_GROUP');
|
||||||
@@ -216,9 +219,11 @@ class CustomerCore extends ObjectModel
|
|||||||
public function update($nullValues = false)
|
public function update($nullValues = false)
|
||||||
{
|
{
|
||||||
$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
|
$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
|
||||||
if ($this->newsletter && !$this->newsletter_date_add)
|
|
||||||
|
if ($this->newsletter && !Validate::isDate($this->newsletter_date_add))
|
||||||
$this->newsletter_date_add = date('Y-m-d H:i:s');
|
$this->newsletter_date_add = date('Y-m-d H:i:s');
|
||||||
$this->updateGroup($this->groupBox);
|
if (Context::getContext()->controller->controller_type == 'admin')
|
||||||
|
$this->updateGroup($this->groupBox);
|
||||||
return parent::update(true);
|
return parent::update(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,6 +285,24 @@ class CustomerCore extends ObjectModel
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve customers by email address
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @param $email
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getCustomersByEmail($email)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM `'._DB_PREFIX_.'customer`
|
||||||
|
WHERE `email` = \''.pSQL($email).'\'
|
||||||
|
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER);
|
||||||
|
|
||||||
|
return Db::getInstance()->ExecuteS($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check id the customer is active or not
|
* Check id the customer is active or not
|
||||||
*
|
*
|
||||||
@@ -531,7 +554,7 @@ class CustomerCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getGroupsStatic($id_customer)
|
public static function getGroupsStatic($id_customer)
|
||||||
{
|
{
|
||||||
if (!Group::isFeatureActive())
|
if (!Group::isFeatureActive() || $id_customer == 0)
|
||||||
return array(Configuration::get('PS_CUSTOMER_GROUP'));
|
return array(Configuration::get('PS_CUSTOMER_GROUP'));
|
||||||
|
|
||||||
if (!isset(self::$_customer_groups[$id_customer]))
|
if (!isset(self::$_customer_groups[$id_customer]))
|
||||||
@@ -645,7 +668,14 @@ class CustomerCore extends ObjectModel
|
|||||||
Mail::l('Your guest account has been transformed to customer account', (int)$id_lang),
|
Mail::l('Your guest account has been transformed to customer account', (int)$id_lang),
|
||||||
$vars,
|
$vars,
|
||||||
$this->email,
|
$this->email,
|
||||||
$this->firstname.' '.$this->lastname
|
$this->firstname.' '.$this->lastname,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
_PS_MAIL_DIR_,
|
||||||
|
false,
|
||||||
|
(int)$this->id_shop
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -730,7 +760,8 @@ class CustomerCore extends ObjectModel
|
|||||||
$query = new DbQuery();
|
$query = new DbQuery();
|
||||||
$query->select('SUM(op.amount)');
|
$query->select('SUM(op.amount)');
|
||||||
$query->from('order_payment', 'op');
|
$query->from('order_payment', 'op');
|
||||||
$query->leftJoin('orders', 'o', 'op.id_order = o.id_order');
|
$query->leftJoin('order_invoice_payment', 'oip', 'op.id_order_payment = oip.id_order_payment');
|
||||||
|
$query->leftJoin('orders', 'o', 'oip.id_order = o.id_order');
|
||||||
$query->groupBy('o.id_customer');
|
$query->groupBy('o.id_customer');
|
||||||
$query->where('o.id_customer = '.(int)$this->id);
|
$query->where('o.id_customer = '.(int)$this->id);
|
||||||
$total_rest = (float)Db::getInstance()->getValue($query->build());
|
$total_rest = (float)Db::getInstance()->getValue($query->build());
|
||||||
|
|||||||
+155
-110
@@ -51,15 +51,15 @@ class DispatcherCore
|
|||||||
'rule' => '{category:/}{id}-{rewrite}{-:ean13}.html',
|
'rule' => '{category:/}{id}-{rewrite}{-:ean13}.html',
|
||||||
'keywords' => array(
|
'keywords' => array(
|
||||||
'id' => array('regexp' => '[0-9]+', 'param' => 'id_product'),
|
'id' => array('regexp' => '[0-9]+', 'param' => 'id_product'),
|
||||||
'rewrite' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'ean13' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'ean13' => array('regexp' => '[0-9\pL]*'),
|
||||||
'category' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'category' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'categories' => array('regexp' => '[/a-zA-Z0-9-\pL]*'),
|
'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*'),
|
||||||
'reference' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'reference' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_keywords' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_title' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'manufacturer' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'manufacturer' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'supplier' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'supplier' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'price' => array('regexp' => '[0-9\.,]*'),
|
'price' => array('regexp' => '[0-9\.,]*'),
|
||||||
'tags' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'tags' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
||||||
),
|
),
|
||||||
@@ -71,9 +71,9 @@ class DispatcherCore
|
|||||||
'id' => array('regexp' => '[0-9]+', 'param' => 'id_category'),
|
'id' => array('regexp' => '[0-9]+', 'param' => 'id_category'),
|
||||||
/* Selected filters is used by the module blocklayered */
|
/* Selected filters is used by the module blocklayered */
|
||||||
'selected_filters' => array('regexp' => '.*', 'param' => 'selected_filters'),
|
'selected_filters' => array('regexp' => '.*', 'param' => 'selected_filters'),
|
||||||
'rewrite' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_keywords' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_title' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'category_rule' => array(
|
'category_rule' => array(
|
||||||
@@ -81,9 +81,9 @@ class DispatcherCore
|
|||||||
'rule' => '{id}-{rewrite}',
|
'rule' => '{id}-{rewrite}',
|
||||||
'keywords' => array(
|
'keywords' => array(
|
||||||
'id' => array('regexp' => '[0-9]+', 'param' => 'id_category'),
|
'id' => array('regexp' => '[0-9]+', 'param' => 'id_category'),
|
||||||
'rewrite' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_keywords' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_title' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'supplier_rule' => array(
|
'supplier_rule' => array(
|
||||||
@@ -91,9 +91,9 @@ class DispatcherCore
|
|||||||
'rule' => '{id}__{rewrite}',
|
'rule' => '{id}__{rewrite}',
|
||||||
'keywords' => array(
|
'keywords' => array(
|
||||||
'id' => array('regexp' => '[0-9]+', 'param' => 'id_supplier'),
|
'id' => array('regexp' => '[0-9]+', 'param' => 'id_supplier'),
|
||||||
'rewrite' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_keywords' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_title' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'manufacturer_rule' => array(
|
'manufacturer_rule' => array(
|
||||||
@@ -101,9 +101,9 @@ class DispatcherCore
|
|||||||
'rule' => '{id}_{rewrite}',
|
'rule' => '{id}_{rewrite}',
|
||||||
'keywords' => array(
|
'keywords' => array(
|
||||||
'id' => array('regexp' => '[0-9]+', 'param' => 'id_manufacturer'),
|
'id' => array('regexp' => '[0-9]+', 'param' => 'id_manufacturer'),
|
||||||
'rewrite' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_keywords' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_title' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'cms_rule' => array(
|
'cms_rule' => array(
|
||||||
@@ -111,9 +111,9 @@ class DispatcherCore
|
|||||||
'rule' => 'content/{id}-{rewrite}',
|
'rule' => 'content/{id}-{rewrite}',
|
||||||
'keywords' => array(
|
'keywords' => array(
|
||||||
'id' => array('regexp' => '[0-9]+', 'param' => 'id_cms'),
|
'id' => array('regexp' => '[0-9]+', 'param' => 'id_cms'),
|
||||||
'rewrite' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_keywords' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_title' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'cms_category_rule' => array(
|
'cms_category_rule' => array(
|
||||||
@@ -121,17 +121,17 @@ class DispatcherCore
|
|||||||
'rule' => 'content/category/{id}-{rewrite}',
|
'rule' => 'content/category/{id}-{rewrite}',
|
||||||
'keywords' => array(
|
'keywords' => array(
|
||||||
'id' => array('regexp' => '[0-9]+', 'param' => 'id_cms_category'),
|
'id' => array('regexp' => '[0-9]+', 'param' => 'id_cms_category'),
|
||||||
'rewrite' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_keywords' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
'meta_title' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'module' => array(
|
'module' => array(
|
||||||
'controller' => null,
|
'controller' => null,
|
||||||
'rule' => 'module/{module}{/:controller}',
|
'rule' => 'module/{module}{/:controller}',
|
||||||
'keywords' => array(
|
'keywords' => array(
|
||||||
'module' => array('regexp' => '[a-zA-Z0-9_-]+', 'param' => 'module'),
|
'module' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'module'),
|
||||||
'controller' => array('regexp' => '[a-zA-Z0-9_-]+', 'param' => 'controller'),
|
'controller' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'controller'),
|
||||||
),
|
),
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'fc' => 'module',
|
'fc' => 'module',
|
||||||
@@ -143,7 +143,9 @@ class DispatcherCore
|
|||||||
* @var bool If true, use routes to build URL (mod rewrite must be activated)
|
* @var bool If true, use routes to build URL (mod rewrite must be activated)
|
||||||
*/
|
*/
|
||||||
protected $use_routes = false;
|
protected $use_routes = false;
|
||||||
|
|
||||||
|
protected $multilang_activated = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array List of loaded routes
|
* @var array List of loaded routes
|
||||||
*/
|
*/
|
||||||
@@ -218,15 +220,17 @@ class DispatcherCore
|
|||||||
$this->controller_not_found = 'pagenotfound';
|
$this->controller_not_found = 'pagenotfound';
|
||||||
$this->default_controller = 'index';
|
$this->default_controller = 'index';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setRequestUri();
|
||||||
|
|
||||||
|
// Switch language if needed (only on front)
|
||||||
|
if ($this->front_controller == self::FC_FRONT)
|
||||||
|
Tools::switchLanguage();
|
||||||
|
|
||||||
|
if (Language::isMultiLanguageActivated())
|
||||||
|
$this->multilang_activated = true;
|
||||||
|
|
||||||
$this->loadRoutes();
|
$this->loadRoutes();
|
||||||
|
|
||||||
// Get request uri (HTTP_X_REWRITE_URL is used by IIS)
|
|
||||||
if (isset($_SERVER['REQUEST_URI']))
|
|
||||||
$this->request_uri = $_SERVER['REQUEST_URI'];
|
|
||||||
else if (isset($_SERVER['HTTP_X_REWRITE_URL']))
|
|
||||||
$this->request_uri = $_SERVER['HTTP_X_REWRITE_URL'];
|
|
||||||
$this->request_uri = rawurldecode($this->request_uri);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,15 +239,6 @@ class DispatcherCore
|
|||||||
public function dispatch()
|
public function dispatch()
|
||||||
{
|
{
|
||||||
$controller_class = '';
|
$controller_class = '';
|
||||||
$this->request_uri = preg_replace('#^'.preg_quote(Context::getContext()->shop->getBaseURI(), '#').'#i', '/', $this->request_uri);
|
|
||||||
|
|
||||||
// If there are several languages, get language from uri
|
|
||||||
if ($this->use_routes && Language::isMultiLanguageActivated())
|
|
||||||
if (preg_match('#^/([a-z]{2})/#', $this->request_uri, $m))
|
|
||||||
{
|
|
||||||
$_GET['isolang'] = $m[1];
|
|
||||||
$this->request_uri = substr($this->request_uri, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get current controller
|
// Get current controller
|
||||||
$this->getController();
|
$this->getController();
|
||||||
@@ -255,7 +250,7 @@ class DispatcherCore
|
|||||||
{
|
{
|
||||||
// Dispatch front office controller
|
// Dispatch front office controller
|
||||||
case self::FC_FRONT :
|
case self::FC_FRONT :
|
||||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_, _PS_OVERRIDE_DIR_.'controllers/front/');
|
||||||
|
|
||||||
$controllers['index'] = 'IndexController';
|
$controllers['index'] = 'IndexController';
|
||||||
if (isset($controllers['auth']))
|
if (isset($controllers['auth']))
|
||||||
@@ -315,7 +310,7 @@ class DispatcherCore
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$controllers = Dispatcher::getControllers(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
|
$controllers = Dispatcher::getControllers(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_, _PS_OVERRIDE_DIR_.'controllers/admin/'));
|
||||||
if (!isset($controllers[$this->controller]))
|
if (!isset($controllers[$this->controller]))
|
||||||
$this->controller = $this->controller_not_found;
|
$this->controller = $this->controller_not_found;
|
||||||
$controller_class = $controllers[$this->controller];
|
$controller_class = $controllers[$this->controller];
|
||||||
@@ -357,41 +352,67 @@ class DispatcherCore
|
|||||||
$e->displayMessage();
|
$e->displayMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set request uri and iso lang
|
||||||
|
*/
|
||||||
|
protected function setRequestUri()
|
||||||
|
{
|
||||||
|
// Get request uri (HTTP_X_REWRITE_URL is used by IIS)
|
||||||
|
if (isset($_SERVER['REQUEST_URI']))
|
||||||
|
$this->request_uri = $_SERVER['REQUEST_URI'];
|
||||||
|
else if (isset($_SERVER['HTTP_X_REWRITE_URL']))
|
||||||
|
$this->request_uri = $_SERVER['HTTP_X_REWRITE_URL'];
|
||||||
|
$this->request_uri = rawurldecode($this->request_uri);
|
||||||
|
|
||||||
|
$this->request_uri = preg_replace('#^'.preg_quote(Context::getContext()->shop->getBaseURI(), '#').'#i', '/', $this->request_uri);
|
||||||
|
|
||||||
|
// If there are several languages, get language from uri
|
||||||
|
if ($this->use_routes && Language::isMultiLanguageActivated())
|
||||||
|
if (preg_match('#^/([a-z]{2})/#', $this->request_uri, $m))
|
||||||
|
{
|
||||||
|
$_GET['isolang'] = $m[1];
|
||||||
|
$this->request_uri = substr($this->request_uri, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load default routes
|
* Load default routes group by languages
|
||||||
*/
|
*/
|
||||||
protected function loadRoutes()
|
protected function loadRoutes()
|
||||||
{
|
{
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
foreach ($this->default_routes as $id => $route)
|
|
||||||
$this->addRoute(
|
// Set default routes
|
||||||
$id,
|
foreach (Language::getLanguages() as $lang)
|
||||||
$route['rule'],
|
foreach ($this->default_routes as $id => $route)
|
||||||
$route['controller'],
|
$this->addRoute(
|
||||||
$route['keywords'],
|
$id,
|
||||||
isset($route['params']) ? $route['params'] : array()
|
$route['rule'],
|
||||||
);
|
$route['controller'],
|
||||||
|
$lang['id_lang'],
|
||||||
|
$route['keywords'],
|
||||||
|
isset($route['params']) ? $route['params'] : array()
|
||||||
|
);
|
||||||
|
|
||||||
if ($this->use_routes)
|
if ($this->use_routes)
|
||||||
{
|
{
|
||||||
|
// Get iso lang
|
||||||
|
$iso_lang = Tools::getValue('isolang');
|
||||||
|
$id_lang = $context->language->id;
|
||||||
|
if (!empty($iso_lang))
|
||||||
|
$id_lang = Language::getIdByIso($iso_lang);
|
||||||
|
|
||||||
// Load routes from meta table
|
// Load routes from meta table
|
||||||
$sql = 'SELECT m.page, ml.url_rewrite
|
$sql = 'SELECT m.page, ml.url_rewrite, ml.id_lang
|
||||||
FROM `'._DB_PREFIX_.'meta` m
|
FROM `'._DB_PREFIX_.'meta` m
|
||||||
LEFT JOIN `'._DB_PREFIX_.'meta_lang` ml ON (m.id_meta = ml.id_meta'.Shop::addSqlRestrictionOnLang('ml').')
|
LEFT JOIN `'._DB_PREFIX_.'meta_lang` ml ON (m.id_meta = ml.id_meta'.Shop::addSqlRestrictionOnLang('ml').')
|
||||||
WHERE id_lang = '.(int)$context->language->id.'
|
|
||||||
ORDER BY LENGTH(ml.url_rewrite) DESC';
|
ORDER BY LENGTH(ml.url_rewrite) DESC';
|
||||||
if ($results = Db::getInstance()->executeS($sql))
|
if ($results = Db::getInstance()->executeS($sql))
|
||||||
foreach ($results as $row)
|
foreach ($results as $row)
|
||||||
{
|
{
|
||||||
if ($row['url_rewrite'])
|
if ($row['url_rewrite'])
|
||||||
$this->addRoute($row['page'], $row['url_rewrite'], $row['page']);
|
$this->addRoute($row['page'], $row['url_rewrite'], $row['page'], $row['id_lang']);
|
||||||
else
|
|
||||||
$this->empty_route = array(
|
|
||||||
'routeID' => $row['page'],
|
|
||||||
'rule' => '',
|
|
||||||
'controller' => $row['page'],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set default empty route if no empty route (that's weird I know)
|
// Set default empty route if no empty route (that's weird I know)
|
||||||
@@ -405,24 +426,30 @@ class DispatcherCore
|
|||||||
// Load custom routes
|
// Load custom routes
|
||||||
foreach ($this->default_routes as $route_id => $route_data)
|
foreach ($this->default_routes as $route_id => $route_data)
|
||||||
if ($custom_route = Configuration::get('PS_ROUTE_'.$route_id))
|
if ($custom_route = Configuration::get('PS_ROUTE_'.$route_id))
|
||||||
$this->addRoute(
|
foreach (Language::getLanguages() as $lang)
|
||||||
$route_id,
|
$this->addRoute(
|
||||||
$custom_route,
|
$route_id,
|
||||||
$route_data['controller'],
|
$custom_route,
|
||||||
$route_data['keywords'],
|
$route_data['controller'],
|
||||||
isset($route_data['params']) ? $route_data['params'] : array()
|
$lang['id_lang'],
|
||||||
);
|
$route_data['keywords'],
|
||||||
|
isset($route_data['params']) ? $route_data['params'] : array()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $id Name of the route (need to be uniq, a second route with same name will override the first)
|
* @param string $route_id Name of the route (need to be uniq, a second route with same name will override the first)
|
||||||
* @param string $rule Url rule
|
* @param string $rule Url rule
|
||||||
* @param string $controller Controller to call if request uri match the rule
|
* @param string $controller Controller to call if request uri match the rule
|
||||||
|
* @param int $id_lang
|
||||||
*/
|
*/
|
||||||
public function addRoute($route_id, $rule, $controller, array $keywords = array(), array $params = array())
|
public function addRoute($route_id, $rule, $controller, $id_lang = null, array $keywords = array(), array $params = array())
|
||||||
{
|
{
|
||||||
|
if (is_null($id_lang))
|
||||||
|
$id_lang = Context::getContext()->language->id;
|
||||||
|
|
||||||
$regexp = preg_quote($rule, '#');
|
$regexp = preg_quote($rule, '#');
|
||||||
if ($keywords)
|
if ($keywords)
|
||||||
{
|
{
|
||||||
@@ -456,7 +483,10 @@ class DispatcherCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
$regexp = '#^/'.$regexp.'(\?.*)?$#u';
|
$regexp = '#^/'.$regexp.'(\?.*)?$#u';
|
||||||
$this->routes[$route_id] = array(
|
if (!isset($this->routes[$id_lang]))
|
||||||
|
$this->routes[$id_lang] = array();
|
||||||
|
|
||||||
|
$this->routes[$id_lang][$route_id] = array(
|
||||||
'rule' => $rule,
|
'rule' => $rule,
|
||||||
'regexp' => $regexp,
|
'regexp' => $regexp,
|
||||||
'controller' => $controller,
|
'controller' => $controller,
|
||||||
@@ -469,26 +499,31 @@ class DispatcherCore
|
|||||||
* Check if a route exists
|
* Check if a route exists
|
||||||
*
|
*
|
||||||
* @param string $route_id
|
* @param string $route_id
|
||||||
|
* @param int $id_lang
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasRoute($route_id)
|
public function hasRoute($route_id, $id_lang = null)
|
||||||
{
|
{
|
||||||
return isset($this->routes[$route_id]);
|
if (is_null($id_lang))
|
||||||
|
$id_lang = Context::getContext()->language->id;
|
||||||
|
|
||||||
|
return isset($this->routes[$id_lang]) && isset($this->routes[$id_lang][$route_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a keyword is written in a route rule
|
* Check if a keyword is written in a route rule
|
||||||
*
|
*
|
||||||
* @param string $route_id
|
* @param string $route_id
|
||||||
|
* @param int $id_lang
|
||||||
* @param string $keyword
|
* @param string $keyword
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasKeyword($route_id, $keyword)
|
public function hasKeyword($route_id, $id_lang, $keyword)
|
||||||
{
|
{
|
||||||
if (!isset($this->routes[$route_id]))
|
if (!isset($this->routes[$id_lang]) && !isset($this->routes[$id_lang][$route_id]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return preg_match('#\{([^{}]+:)?'.preg_quote($keyword, '#').'(:[^{}])?\}#', $this->routes[$route_id]['rule']);
|
return preg_match('#\{([^{}]+:)?'.preg_quote($keyword, '#').'(:[^{}])?\}#', $this->routes[$id_lang][$route_id]['rule']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -515,18 +550,23 @@ class DispatcherCore
|
|||||||
* Create an url from
|
* Create an url from
|
||||||
*
|
*
|
||||||
* @param string $route_id Name the route
|
* @param string $route_id Name the route
|
||||||
|
* @param int $id_lang
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @param bool $use_routes If false, don't use to create this url
|
* @param bool $use_routes If false, don't use to create this url
|
||||||
* @param string $anchor Optional anchor to add at the end of this url
|
* @param string $anchor Optional anchor to add at the end of this url
|
||||||
*/
|
*/
|
||||||
public function createUrl($route_id, array $params = array(), $force_routes = false, $anchor = '')
|
public function createUrl($route_id, $id_lang = null, array $params = array(), $force_routes = false, $anchor = '')
|
||||||
{
|
{
|
||||||
if (!isset($this->routes[$route_id]))
|
if (!$id_lang)
|
||||||
|
$id_lang = Context::getContext()->language->id;
|
||||||
|
|
||||||
|
if (!isset($this->routes[$id_lang][$route_id]))
|
||||||
{
|
{
|
||||||
$query = http_build_query($params, '', '&');
|
$query = http_build_query($params, '', '&');
|
||||||
return ($route_id == 'index') ? 'index.php'.(($query) ? '?'.$query : '') : 'index.php?controller='.$route_id.(($query) ? '&'.$query : '').$anchor;
|
$index_link = $this->use_routes ? '' : 'index.php';
|
||||||
|
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : 'index.php?controller='.$route_id.(($query) ? '&'.$query : '').$anchor;
|
||||||
}
|
}
|
||||||
$route = $this->routes[$route_id];
|
$route = $this->routes[$id_lang][$route_id];
|
||||||
|
|
||||||
// Check required fields
|
// Check required fields
|
||||||
$query_params = isset($route['params']) ? $route['params'] : array();
|
$query_params = isset($route['params']) ? $route['params'] : array();
|
||||||
@@ -575,7 +615,11 @@ class DispatcherCore
|
|||||||
|
|
||||||
if (!empty($route['controller']))
|
if (!empty($route['controller']))
|
||||||
$query_params['controller'] = $route['controller'];
|
$query_params['controller'] = $route['controller'];
|
||||||
$url = 'index.php?'.http_build_query(array_merge($add_params, $query_params), '', '&');
|
$query = http_build_query(array_merge($add_params, $query_params), '', '&');
|
||||||
|
if ($this->multilang_activated)
|
||||||
|
$query .= (!empty($query) ? '&' : '').'id_lang='.(int)$id_lang;
|
||||||
|
$url = 'index.php?'.$query;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url.$anchor;
|
return $url.$anchor;
|
||||||
@@ -614,34 +658,35 @@ class DispatcherCore
|
|||||||
|
|
||||||
// Add empty route as last route to prevent this greedy regexp to match request uri before right time
|
// Add empty route as last route to prevent this greedy regexp to match request uri before right time
|
||||||
if ($this->empty_route)
|
if ($this->empty_route)
|
||||||
$this->addRoute($this->empty_route['routeID'], $this->empty_route['rule'], $this->empty_route['controller']);
|
$this->addRoute($this->empty_route['routeID'], $this->empty_route['rule'], $this->empty_route['controller'], Context::getContext()->language->id);
|
||||||
|
|
||||||
foreach ($this->routes as $route)
|
if (isset($this->routes[Context::getContext()->language->id]))
|
||||||
if (preg_match($route['regexp'], $this->request_uri, $m))
|
foreach ($this->routes[Context::getContext()->language->id] as $route)
|
||||||
{
|
if (preg_match($route['regexp'], $this->request_uri, $m))
|
||||||
// Route found ! Now fill $_GET with parameters of uri
|
|
||||||
foreach ($m as $k => $v)
|
|
||||||
if (!is_numeric($k))
|
|
||||||
$_GET[$k] = $v;
|
|
||||||
|
|
||||||
$controller = $route['controller'] ? $route['controller'] : $_GET['controller'];
|
|
||||||
if (!empty($route['params']))
|
|
||||||
foreach ($route['params'] as $k => $v)
|
|
||||||
$_GET[$k] = $v;
|
|
||||||
|
|
||||||
// A patch for module friendly urls
|
|
||||||
if (preg_match('#module-([a-z0-9_-]+)-([a-z0-9]+)$#i', $controller, $m))
|
|
||||||
{
|
{
|
||||||
$_GET['module'] = $m[1];
|
// Route found ! Now fill $_GET with parameters of uri
|
||||||
$_GET['fc'] = 'module';
|
foreach ($m as $k => $v)
|
||||||
$controller = $m[2];
|
if (!is_numeric($k))
|
||||||
|
$_GET[$k] = $v;
|
||||||
|
|
||||||
|
$controller = $route['controller'] ? $route['controller'] : $_GET['controller'];
|
||||||
|
if (!empty($route['params']))
|
||||||
|
foreach ($route['params'] as $k => $v)
|
||||||
|
$_GET[$k] = $v;
|
||||||
|
|
||||||
|
// A patch for module friendly urls
|
||||||
|
if (preg_match('#module-([a-z0-9_-]+)-([a-z0-9]+)$#i', $controller, $m))
|
||||||
|
{
|
||||||
|
$_GET['module'] = $m[1];
|
||||||
|
$_GET['fc'] = 'module';
|
||||||
|
$controller = $m[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['fc']) && $_GET['fc'] == 'module')
|
||||||
|
$this->front_controller = self::FC_MODULE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['fc']) && $_GET['fc'] == 'module')
|
|
||||||
$this->front_controller = self::FC_MODULE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($controller == 'index' || $this->request_uri == '/index.php')
|
if ($controller == 'index' || $this->request_uri == '/index.php')
|
||||||
$controller = $this->default_controller;
|
$controller = $this->default_controller;
|
||||||
$this->controller = $controller;
|
$this->controller = $controller;
|
||||||
|
|||||||
+3
-2
@@ -84,6 +84,7 @@ class FeatureCore extends ObjectModel
|
|||||||
return Db::getInstance()->executeS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'feature` f
|
FROM `'._DB_PREFIX_.'feature` f
|
||||||
|
'.Shop::addSqlAssociation('feature', 'f').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl
|
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl
|
||||||
ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.')
|
ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.')
|
||||||
ORDER BY f.`position` ASC
|
ORDER BY f.`position` ASC
|
||||||
@@ -263,12 +264,12 @@ class FeatureCore extends ObjectModel
|
|||||||
* @param integer $position
|
* @param integer $position
|
||||||
* @return boolean Update result
|
* @return boolean Update result
|
||||||
*/
|
*/
|
||||||
public function updatePosition($way, $position, $id_feature)
|
public function updatePosition($way, $position, $id_feature = null)
|
||||||
{
|
{
|
||||||
if (!$res = Db::getInstance()->executeS('
|
if (!$res = Db::getInstance()->executeS('
|
||||||
SELECT `position`, `id_feature`
|
SELECT `position`, `id_feature`
|
||||||
FROM `'._DB_PREFIX_.'feature`
|
FROM `'._DB_PREFIX_.'feature`
|
||||||
WHERE `id_feature` = '.(int)($id_feature ? $id_feature : 1).'
|
WHERE `id_feature` = '.(int)($id_feature ? $id_feature : $this->id).'
|
||||||
ORDER BY `position` ASC'
|
ORDER BY `position` ASC'
|
||||||
))
|
))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class FeatureValueCore extends ObjectModel
|
|||||||
ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
||||||
WHERE `value` = \''.pSQL($name).'\'
|
WHERE `value` = \''.pSQL($name).'\'
|
||||||
AND fv.`id_feature` = '.(int)$id_feature.'
|
AND fv.`id_feature` = '.(int)$id_feature.'
|
||||||
AND fv.`custom` = 0
|
AND fv.`custom` = 1
|
||||||
GROUP BY fv.`id_feature_value` LIMIT 1
|
GROUP BY fv.`id_feature_value` LIMIT 1
|
||||||
');
|
');
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -78,7 +78,7 @@ class GroupCore extends ObjectModel
|
|||||||
$shop_criteria = Shop::addSqlAssociation('group', 'g');
|
$shop_criteria = Shop::addSqlAssociation('group', 'g');
|
||||||
|
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT g.`id_group`, g.`reduction`, g.`price_display_method`, gl.`name`
|
SELECT DISTINCT g.`id_group`, g.`reduction`, g.`price_display_method`, gl.`name`
|
||||||
FROM `'._DB_PREFIX_.'group` g
|
FROM `'._DB_PREFIX_.'group` g
|
||||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)$id_lang.')
|
||||||
'.$shop_criteria.'
|
'.$shop_criteria.'
|
||||||
|
|||||||
+2
-2
@@ -376,7 +376,7 @@ class HookCore extends ObjectModel
|
|||||||
$exceptions = $moduleInstance->getExceptions($array['id_hook']);
|
$exceptions = $moduleInstance->getExceptions($array['id_hook']);
|
||||||
if (in_array(Dispatcher::getInstance()->getController(), $exceptions))
|
if (in_array(Dispatcher::getInstance()->getController(), $exceptions))
|
||||||
continue;
|
continue;
|
||||||
if (isset($context->employee) && !$moduleInstance->getPermission('view', $context->employee))
|
if (Validate::isLoadedObject($context->employee) && !$moduleInstance->getPermission('view', $context->employee))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Check which / if method is callable
|
// Check which / if method is callable
|
||||||
@@ -392,7 +392,7 @@ class HookCore extends ObjectModel
|
|||||||
else if ($hook_retro_callable)
|
else if ($hook_retro_callable)
|
||||||
$display = $moduleInstance->{'hook'.$retro_hook_name}($hook_args);
|
$display = $moduleInstance->{'hook'.$retro_hook_name}($hook_args);
|
||||||
// Live edit
|
// Live edit
|
||||||
if ($array['live_edit'] && ((Tools::isSubmit('live_edit') && Tools::getValue('ad') && (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_)))))
|
if ($array['live_edit'] && Tools::isSubmit('live_edit') && Tools::getValue('ad') && Tools::getValue('liveToken') == Tools::getAdminToken('AdminModulesPositions'.(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee')))
|
||||||
{
|
{
|
||||||
$live_edit = true;
|
$live_edit = true;
|
||||||
$output .= self::wrapLiveEdit($display, $moduleInstance, $array['id_hook']);
|
$output .= self::wrapLiveEdit($display, $moduleInstance, $array['id_hook']);
|
||||||
|
|||||||
+1
-1
@@ -385,7 +385,7 @@ class ImageCore extends ObjectModel
|
|||||||
* Delete the product image from disk and remove the containing folder if empty
|
* Delete the product image from disk and remove the containing folder if empty
|
||||||
* Handles both legacy and new image filesystems
|
* Handles both legacy and new image filesystems
|
||||||
*/
|
*/
|
||||||
public function deleteImage()
|
public function deleteImage($force_delete = false)
|
||||||
{
|
{
|
||||||
if (!$this->id)
|
if (!$this->id)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class ImageManagerCore
|
|||||||
*/
|
*/
|
||||||
public static function checkImageMemoryLimit($image)
|
public static function checkImageMemoryLimit($image)
|
||||||
{
|
{
|
||||||
$infos = getimagesize($image);
|
$infos = @getimagesize($image);
|
||||||
|
|
||||||
$memory_limit = Tools::getMemoryLimit();
|
$memory_limit = Tools::getMemoryLimit();
|
||||||
// memory_limit == -1 => unlimited memory
|
// memory_limit == -1 => unlimited memory
|
||||||
@@ -114,7 +114,7 @@ class ImageManagerCore
|
|||||||
* @param string $file_type
|
* @param string $file_type
|
||||||
* @return boolean Operation result
|
* @return boolean Operation result
|
||||||
*/
|
*/
|
||||||
public static function resize($src_file, $dst_file, $dst_width = null, $dst_height = null, $file_type = 'jpg')
|
public static function resize($src_file, $dst_file, $dst_width = null, $dst_height = null, $file_type = 'jpg', $force_type = false)
|
||||||
{
|
{
|
||||||
if (!file_exists($src_file))
|
if (!file_exists($src_file))
|
||||||
return false;
|
return false;
|
||||||
@@ -124,7 +124,7 @@ class ImageManagerCore
|
|||||||
// This allow for higher quality and for transparency. JPG source files will also benefit from a higher quality
|
// This allow for higher quality and for transparency. JPG source files will also benefit from a higher quality
|
||||||
// because JPG reencoding by GD, even with max quality setting, degrades the image.
|
// because JPG reencoding by GD, even with max quality setting, degrades the image.
|
||||||
if (Configuration::get('PS_IMAGE_QUALITY') == 'png_all'
|
if (Configuration::get('PS_IMAGE_QUALITY') == 'png_all'
|
||||||
|| (Configuration::get('PS_IMAGE_QUALITY') == 'png' && $type == IMAGETYPE_PNG))
|
|| (Configuration::get('PS_IMAGE_QUALITY') == 'png' && $type == IMAGETYPE_PNG) && !$force_type)
|
||||||
$file_type = 'png';
|
$file_type = 'png';
|
||||||
|
|
||||||
if (!$src_width)
|
if (!$src_width)
|
||||||
@@ -225,6 +225,30 @@ class ImageManagerCore
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if image file extension is correct
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @param $filename real filename
|
||||||
|
* @return bool true if it's correct
|
||||||
|
*/
|
||||||
|
public static function isCorrectImageFileExt($filename)
|
||||||
|
{
|
||||||
|
// Filter on file extension
|
||||||
|
$authorized_extensions = array('gif', 'jpg', 'jpeg', 'jpe', 'png');
|
||||||
|
$name_explode = explode('.', $filename);
|
||||||
|
if (count($name_explode))
|
||||||
|
{
|
||||||
|
$current_extension = strtolower($name_explode[count($name_explode) - 1]);
|
||||||
|
if (!in_array($current_extension, $authorized_extensions))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate image upload (check image type and weight)
|
* Validate image upload (check image type and weight)
|
||||||
*
|
*
|
||||||
@@ -240,7 +264,7 @@ class ImageManagerCore
|
|||||||
$file['size'] / 1000,
|
$file['size'] / 1000,
|
||||||
$max_file_size / 1000
|
$max_file_size / 1000
|
||||||
);
|
);
|
||||||
if (!ImageManager::isRealImage($file['tmp_name'], $file['type']))
|
if (!ImageManager::isRealImage($file['tmp_name'], $file['type']) || !ImageManager::isCorrectImageFileExt($file['name']))
|
||||||
return Tools::displayError('Image format not recognized, allowed formats are: .gif, .jpg, .png');
|
return Tools::displayError('Image format not recognized, allowed formats are: .gif, .jpg, .png');
|
||||||
if ($file['error'])
|
if ($file['error'])
|
||||||
return sprintf(Tools::displayError('Error while uploading image; please change your server\'s settings. (Error code: %s)'), $file['error']);
|
return sprintf(Tools::displayError('Error while uploading image; please change your server\'s settings. (Error code: %s)'), $file['error']);
|
||||||
|
|||||||
+75
-55
@@ -83,6 +83,7 @@ class LanguageCore extends ObjectModel
|
|||||||
'errors' => '_ERRORS',
|
'errors' => '_ERRORS',
|
||||||
'admin' => '_LANGADM',
|
'admin' => '_LANGADM',
|
||||||
'pdf' => '_LANGPDF',
|
'pdf' => '_LANGPDF',
|
||||||
|
'tabs' => 'tabs',
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct($id = null, $id_lang = null)
|
public function __construct($id = null, $id_lang = null)
|
||||||
@@ -113,11 +114,23 @@ class LanguageCore extends ObjectModel
|
|||||||
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
|
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
|
||||||
mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
|
mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
|
||||||
foreach ($this->translationsFilesAndVars as $file => $var)
|
foreach ($this->translationsFilesAndVars as $file => $var)
|
||||||
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php'))
|
{
|
||||||
file_put_contents(_PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php', '<?php
|
$path_file = _PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php';
|
||||||
|
if (!file_exists($path_file))
|
||||||
|
if ($file != 'tabs')
|
||||||
|
file_put_contents($path_file, '<?php
|
||||||
global $'.$var.';
|
global $'.$var.';
|
||||||
$'.$var.' = array();
|
$'.$var.' = array();
|
||||||
?>');
|
?>');
|
||||||
|
else
|
||||||
|
file_put_contents($path_file, '<?php
|
||||||
|
$'.$var.' = array();
|
||||||
|
return $'.$var.';
|
||||||
|
?>');
|
||||||
|
|
||||||
|
@chmod($path_file, 0777);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,7 +261,7 @@ class LanguageCore extends ObjectModel
|
|||||||
$mPath_to = _PS_MAIL_DIR_.(string)$iso_to.'/';
|
$mPath_to = _PS_MAIL_DIR_.(string)$iso_to.'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
$lFiles = array('admin.php', 'errors.php', 'fields.php', 'pdf.php');
|
$lFiles = array('admin.php', 'errors.php', 'fields.php', 'pdf.php', 'tabs.php');
|
||||||
|
|
||||||
// Added natives mails files
|
// Added natives mails files
|
||||||
$mFiles = array(
|
$mFiles = array(
|
||||||
@@ -282,7 +295,8 @@ class LanguageCore extends ObjectModel
|
|||||||
'shipped.html', 'shipped.txt',
|
'shipped.html', 'shipped.txt',
|
||||||
'test.html', 'test.txt',
|
'test.html', 'test.txt',
|
||||||
'voucher.html', 'voucher.txt',
|
'voucher.html', 'voucher.txt',
|
||||||
'voucher_new.html', 'voucher_new.txt'
|
'voucher_new.html', 'voucher_new.txt',
|
||||||
|
'order_changed.html', 'order_changed.txt'
|
||||||
);
|
);
|
||||||
|
|
||||||
$number = -1;
|
$number = -1;
|
||||||
@@ -451,64 +465,70 @@ class LanguageCore extends ObjectModel
|
|||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if (empty($this->iso_code))
|
if (!$this->hasMultishopEntries())
|
||||||
$this->iso_code = Language::getIsoById($this->id);
|
|
||||||
|
|
||||||
// Database translations deletion
|
|
||||||
$result = Db::getInstance()->executeS('SHOW TABLES FROM `'._DB_NAME_.'`');
|
|
||||||
foreach ($result as $row)
|
|
||||||
if (preg_match('/_lang/', $row['Tables_in_'._DB_NAME_]))
|
|
||||||
if (!Db::getInstance()->execute('DELETE FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)$this->id))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Delete tags
|
|
||||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'tag WHERE id_lang = '.(int)$this->id);
|
|
||||||
|
|
||||||
// Delete search words
|
|
||||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'search_word WHERE id_lang = '.(int)$this->id);
|
|
||||||
|
|
||||||
// Files deletion
|
|
||||||
foreach (Language::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
|
|
||||||
if (file_exists($key))
|
|
||||||
unlink($key);
|
|
||||||
$modList = scandir(_PS_MODULE_DIR_);
|
|
||||||
foreach ($modList as $mod)
|
|
||||||
{
|
{
|
||||||
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod.'/mails/'.$this->iso_code);
|
if (empty($this->iso_code))
|
||||||
$files = @scandir(_PS_MODULE_DIR_.$mod.'/mails/');
|
$this->iso_code = Language::getIsoById($this->id);
|
||||||
if (count($files) <= 2)
|
|
||||||
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod.'/mails/');
|
// Database translations deletion
|
||||||
|
$result = Db::getInstance()->executeS('SHOW TABLES FROM `'._DB_NAME_.'`');
|
||||||
if (file_exists(_PS_MODULE_DIR_.$mod.'/'.$this->iso_code.'.php'))
|
foreach ($result as $row)
|
||||||
|
if (preg_match('/_lang/', $row['Tables_in_'._DB_NAME_]))
|
||||||
|
if (!Db::getInstance()->execute('DELETE FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)$this->id))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
// Delete tags
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'tag WHERE id_lang = '.(int)$this->id);
|
||||||
|
|
||||||
|
// Delete search words
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'search_word WHERE id_lang = '.(int)$this->id);
|
||||||
|
|
||||||
|
// Files deletion
|
||||||
|
foreach (Language::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
|
||||||
|
if (file_exists($key))
|
||||||
|
unlink($key);
|
||||||
|
$modList = scandir(_PS_MODULE_DIR_);
|
||||||
|
foreach ($modList as $mod)
|
||||||
{
|
{
|
||||||
unlink(_PS_MODULE_DIR_.$mod.'/'.$this->iso_code.'.php');
|
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod.'/mails/'.$this->iso_code);
|
||||||
$files = @scandir(_PS_MODULE_DIR_.$mod);
|
$files = @scandir(_PS_MODULE_DIR_.$mod.'/mails/');
|
||||||
if (count($files) <= 2)
|
if (count($files) <= 2)
|
||||||
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod);
|
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod.'/mails/');
|
||||||
|
|
||||||
|
if (file_exists(_PS_MODULE_DIR_.$mod.'/'.$this->iso_code.'.php'))
|
||||||
|
{
|
||||||
|
unlink(_PS_MODULE_DIR_.$mod.'/'.$this->iso_code.'.php');
|
||||||
|
$files = @scandir(_PS_MODULE_DIR_.$mod);
|
||||||
|
if (count($files) <= 2)
|
||||||
|
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file_exists(_PS_MAIL_DIR_.$this->iso_code))
|
||||||
|
Language::recurseDeleteDir(_PS_MAIL_DIR_.$this->iso_code);
|
||||||
|
if (file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code))
|
||||||
|
Language::recurseDeleteDir(_PS_TRANSLATIONS_DIR_.$this->iso_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists(_PS_MAIL_DIR_.$this->iso_code))
|
|
||||||
Language::recurseDeleteDir(_PS_MAIL_DIR_.$this->iso_code);
|
|
||||||
if (file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code))
|
|
||||||
Language::recurseDeleteDir(_PS_TRANSLATIONS_DIR_.$this->iso_code);
|
|
||||||
if (!parent::delete())
|
if (!parent::delete())
|
||||||
return false;
|
return false;
|
||||||
|
if (!$this->hasMultishopEntries())
|
||||||
// delete images
|
{
|
||||||
$files_copy = array('/en.jpg', '/en-default-thickbox.jpg', '/en-default-home.jpg', '/en-default-large.jpg', '/en-default-medium.jpg', '/en-default-small.jpg', '/en-default-large_scene.jpg');
|
// delete images
|
||||||
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
$files_copy = array('/en.jpg', '/en-default-thickbox.jpg', '/en-default-home.jpg', '/en-default-large.jpg', '/en-default-medium.jpg', '/en-default-small.jpg', '/en-default-large_scene.jpg');
|
||||||
foreach ($tos as $to)
|
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
||||||
foreach ($files_copy as $file)
|
foreach ($tos as $to)
|
||||||
{
|
foreach ($files_copy as $file)
|
||||||
$name = str_replace('/en', ''.$this->iso_code, $file);
|
{
|
||||||
|
$name = str_replace('/en', ''.$this->iso_code, $file);
|
||||||
if (file_exists($to.$name))
|
|
||||||
unlink($to.$name);
|
if (file_exists($to.$name))
|
||||||
if (file_exists(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg'))
|
unlink($to.$name);
|
||||||
unlink(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg');
|
if (file_exists(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg'))
|
||||||
}
|
unlink(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg');
|
||||||
|
}
|
||||||
|
}
|
||||||
return Tools::generateHtaccess();
|
return Tools::generateHtaccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+39
-40
@@ -83,22 +83,23 @@ class LinkCore
|
|||||||
public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false)
|
public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false)
|
||||||
{
|
{
|
||||||
$dispatcher = Dispatcher::getInstance();
|
$dispatcher = Dispatcher::getInstance();
|
||||||
$url = _PS_BASE_URL_.__PS_BASE_URI__;
|
|
||||||
|
|
||||||
if (!$id_lang)
|
if (!$id_lang)
|
||||||
$id_lang = Context::getContext()->language->id;
|
$id_lang = Context::getContext()->language->id;
|
||||||
|
|
||||||
// @todo use specific method ?
|
if (!$id_shop)
|
||||||
if ($id_shop && ($shop = Shop::getShop($id_shop)))
|
$shop = Context::getContext()->shop;
|
||||||
$url = 'http://'.$shop['domain'].$shop['uri'];
|
else
|
||||||
$url .= $this->getLangLink($id_lang);
|
$shop = new Shop($id_shop);
|
||||||
|
|
||||||
|
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||||
|
|
||||||
if (!is_object($product))
|
if (!is_object($product))
|
||||||
{
|
{
|
||||||
if (is_array($product) && isset($product['id_product']))
|
if (is_array($product) && isset($product['id_product']))
|
||||||
$product = new Product($product['id_product'], false, $id_lang);
|
$product = new Product($product['id_product'], false, $id_lang);
|
||||||
else if (is_numeric($product) || !$product)
|
else if (is_numeric($product) || !$product)
|
||||||
$product = new Product($product, false, $id_lang);
|
$product = new Product($product, false, $id_lang);
|
||||||
else
|
else
|
||||||
throw new PrestaShopException('Invalid product vars');
|
throw new PrestaShopException('Invalid product vars');
|
||||||
}
|
}
|
||||||
@@ -112,19 +113,19 @@ class LinkCore
|
|||||||
$params['meta_keywords'] = Tools::str2url($product->getFieldByLang('meta_keywords'));
|
$params['meta_keywords'] = Tools::str2url($product->getFieldByLang('meta_keywords'));
|
||||||
$params['meta_title'] = Tools::str2url($product->getFieldByLang('meta_title'));
|
$params['meta_title'] = Tools::str2url($product->getFieldByLang('meta_title'));
|
||||||
|
|
||||||
if ($dispatcher->hasKeyword('product_rule', 'manufacturer'))
|
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'manufacturer'))
|
||||||
$params['manufacturer'] = Tools::str2url($product->isFullyLoaded ? $product->manufacturer_name : Manufacturer::getNameById($product->id_manufacturer));
|
$params['manufacturer'] = Tools::str2url($product->isFullyLoaded ? $product->manufacturer_name : Manufacturer::getNameById($product->id_manufacturer));
|
||||||
|
|
||||||
if ($dispatcher->hasKeyword('product_rule', 'supplier'))
|
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'supplier'))
|
||||||
$params['supplier'] = Tools::str2url($product->isFullyLoaded ? $product->supplier_name : Supplier::getNameById($product->id_supplier));
|
$params['supplier'] = Tools::str2url($product->isFullyLoaded ? $product->supplier_name : Supplier::getNameById($product->id_supplier));
|
||||||
|
|
||||||
if ($dispatcher->hasKeyword('product_rule', 'price'))
|
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'price'))
|
||||||
$params['price'] = $product->isFullyLoaded ? $product->price : Product::getPriceStatic($product->id, false, null, 6, null, false, true, 1, false, null, null, null, $product->specificPrice);
|
$params['price'] = $product->isFullyLoaded ? $product->price : Product::getPriceStatic($product->id, false, null, 6, null, false, true, 1, false, null, null, null, $product->specificPrice);
|
||||||
|
|
||||||
if ($dispatcher->hasKeyword('product_rule', 'tags'))
|
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'tags'))
|
||||||
$params['tags'] = Tools::str2url($product->getTags($id_lang));
|
$params['tags'] = Tools::str2url($product->getTags($id_lang));
|
||||||
|
|
||||||
if ($dispatcher->hasKeyword('product_rule', 'categories'))
|
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'categories'))
|
||||||
{
|
{
|
||||||
$cats = array();
|
$cats = array();
|
||||||
foreach ($product->getParentCategories() as $cat)
|
foreach ($product->getParentCategories() as $cat)
|
||||||
@@ -133,7 +134,7 @@ class LinkCore
|
|||||||
}
|
}
|
||||||
$anchor = $ipa ? $product->getAnchor($ipa) : '';
|
$anchor = $ipa ? $product->getAnchor($ipa) : '';
|
||||||
|
|
||||||
return $url.$dispatcher->createUrl('product_rule', $params, $force_routes, $anchor);
|
return $url.$dispatcher->createUrl('product_rule', $id_lang, $params, $force_routes, $anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -172,7 +173,7 @@ class LinkCore
|
|||||||
$params['selected_filters'] = $selected_filters;
|
$params['selected_filters'] = $selected_filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url.Dispatcher::getInstance()->createUrl($rule, $params, $this->allow);
|
return $url.Dispatcher::getInstance()->createUrl($rule, $id_lang, $params, $this->allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -199,7 +200,7 @@ class LinkCore
|
|||||||
$params['meta_keywords'] = Tools::str2url($category->meta_keywords);
|
$params['meta_keywords'] = Tools::str2url($category->meta_keywords);
|
||||||
$params['meta_title'] = Tools::str2url($category->meta_title);
|
$params['meta_title'] = Tools::str2url($category->meta_title);
|
||||||
|
|
||||||
return $url.Dispatcher::getInstance()->createUrl('cms_category_rule', $params, $this->allow);
|
return $url.Dispatcher::getInstance()->createUrl('cms_category_rule', $id_lang, $params, $this->allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -225,19 +226,19 @@ class LinkCore
|
|||||||
// Set available keywords
|
// Set available keywords
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['id'] = $cms->id;
|
$params['id'] = $cms->id;
|
||||||
$params['rewrite'] = (!$alias) ? $cms->link_rewrite : $alias;
|
$params['rewrite'] = (!$alias) ? (is_array($cms->link_rewrite) ? $cms->link_rewrite[(int)$id_lang] : $cms->link_rewrite) : $alias;
|
||||||
|
|
||||||
if (isset($cms->meta_keywords) && !empty($cms->meta_keywords))
|
if (isset($cms->meta_keywords) && !empty($cms->meta_keywords))
|
||||||
$params['meta_keywords'] = Tools::str2url($cms->meta_keywords);
|
$params['meta_keywords'] = is_array($cms->meta_keywords) ? Tools::str2url($cms->meta_keywords[(int)$id_lang]) : Tools::str2url($cms->meta_keywords);
|
||||||
else
|
else
|
||||||
$params['meta_keywords'] = '';
|
$params['meta_keywords'] = '';
|
||||||
|
|
||||||
if (isset($cms->meta_title) && !empty($cms->meta_title))
|
if (isset($cms->meta_title) && !empty($cms->meta_title))
|
||||||
$params['meta_title'] = Tools::str2url($cms->meta_title);
|
$params['meta_title'] = is_array($cms->meta_title) ? Tools::str2url($cms->meta_title[(int)$id_lang]) : Tools::str2url($cms->meta_title);
|
||||||
else
|
else
|
||||||
$params['meta_title'] = '';
|
$params['meta_title'] = '';
|
||||||
|
|
||||||
return $url.Dispatcher::getInstance()->createUrl('cms_rule', $params, $this->allow);
|
return $url.Dispatcher::getInstance()->createUrl('cms_rule', $id_lang, $params, $this->allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -264,7 +265,7 @@ class LinkCore
|
|||||||
$params['meta_keywords'] = Tools::str2url($supplier->meta_keywords);
|
$params['meta_keywords'] = Tools::str2url($supplier->meta_keywords);
|
||||||
$params['meta_title'] = Tools::str2url($supplier->meta_title);
|
$params['meta_title'] = Tools::str2url($supplier->meta_title);
|
||||||
|
|
||||||
return $url.Dispatcher::getInstance()->createUrl('supplier_rule', $params, $this->allow);
|
return $url.Dispatcher::getInstance()->createUrl('supplier_rule', $id_lang, $params, $this->allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -291,7 +292,7 @@ class LinkCore
|
|||||||
$params['meta_keywords'] = Tools::str2url($manufacturer->meta_keywords);
|
$params['meta_keywords'] = Tools::str2url($manufacturer->meta_keywords);
|
||||||
$params['meta_title'] = Tools::str2url($manufacturer->meta_title);
|
$params['meta_title'] = Tools::str2url($manufacturer->meta_title);
|
||||||
|
|
||||||
return $url.Dispatcher::getInstance()->createUrl('manufacturer_rule', $params, $this->allow);
|
return $url.Dispatcher::getInstance()->createUrl('manufacturer_rule', $id_lang, $params, $this->allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -316,10 +317,10 @@ class LinkCore
|
|||||||
$params['controller'] = $controller ? $controller : 'default';
|
$params['controller'] = $controller ? $controller : 'default';
|
||||||
|
|
||||||
// If the module has its own route ... just use it !
|
// If the module has its own route ... just use it !
|
||||||
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller))
|
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang))
|
||||||
return $this->getPageLink('module-'.$module.'-'.$controller, $params);
|
return $this->getPageLink('module-'.$module.'-'.$controller, $params);
|
||||||
else
|
else
|
||||||
return $url.Dispatcher::getInstance()->createUrl('module', $params, $this->allow);
|
return $url.Dispatcher::getInstance()->createUrl('module', $id_lang, $params, $this->allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,8 +332,10 @@ class LinkCore
|
|||||||
*/
|
*/
|
||||||
public function getAdminLink($controller, $with_token = true)
|
public function getAdminLink($controller, $with_token = true)
|
||||||
{
|
{
|
||||||
|
$id_lang = Context::getContext()->language->id;
|
||||||
|
|
||||||
$params = $with_token ? array('token' => Tools::getAdminTokenLite($controller)) : array();
|
$params = $with_token ? array('token' => Tools::getAdminTokenLite($controller)) : array();
|
||||||
return Dispatcher::getInstance()->createUrl($controller, $params, false);
|
return Dispatcher::getInstance()->createUrl($controller, $id_lang, $params, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -404,7 +407,7 @@ class LinkCore
|
|||||||
}
|
}
|
||||||
unset($request['controller']);
|
unset($request['controller']);
|
||||||
|
|
||||||
$uri_path = Dispatcher::getInstance()->createUrl($controller, $request);
|
$uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request);
|
||||||
$url = ($ssl && $this->ssl_enable) ? Tools::getShopDomainSsl(true) : Tools::getShopDomain(true);
|
$url = ($ssl && $this->ssl_enable) ? Tools::getShopDomainSsl(true) : Tools::getShopDomain(true);
|
||||||
$url .= __PS_BASE_URI__.$this->getLangLink($id_lang).ltrim($uri_path, '/');
|
$url .= __PS_BASE_URI__.$this->getLangLink($id_lang).ltrim($uri_path, '/');
|
||||||
|
|
||||||
@@ -426,24 +429,20 @@ class LinkCore
|
|||||||
{
|
{
|
||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
$matches = array();
|
|
||||||
$request = $_SERVER['REQUEST_URI'];
|
|
||||||
preg_match('#^/([a-z]{2})/([^\?]*).*$#', $request, $matches);
|
|
||||||
if ($matches)
|
|
||||||
{
|
|
||||||
$current_iso = $matches[1];
|
|
||||||
$rewrite = $matches[2];
|
|
||||||
$url_rewrite = Meta::getEquivalentUrlRewrite($id_lang, Language::getIdByIso($current_iso), $rewrite);
|
|
||||||
$request = str_replace($rewrite, $url_rewrite, $request);
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = $_GET;
|
$params = $_GET;
|
||||||
unset($params['isolang'], $params['controller']);
|
unset($params['isolang'], $params['controller']);
|
||||||
|
|
||||||
if (!$this->allow)
|
if (!$this->allow)
|
||||||
$params['id_lang'] = $id_lang;
|
$params['id_lang'] = $id_lang;
|
||||||
|
else
|
||||||
|
unset($params['id_lang']);
|
||||||
|
|
||||||
return $this->getPageLink(Dispatcher::getInstance()->getController(), false, $id_lang, $params);
|
$controller = Dispatcher::getInstance()->getController();
|
||||||
|
if (!empty(Context::getContext()->controller->php_self))
|
||||||
|
$controller = Context::getContext()->controller->php_self;
|
||||||
|
|
||||||
|
return $this->getPageLink($controller, false, $id_lang, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function goPage($url, $p)
|
public function goPage($url, $p)
|
||||||
@@ -470,7 +469,7 @@ class LinkCore
|
|||||||
if (method_exists($this, $method_name) && isset($_GET['id_'.Dispatcher::getInstance()->getController()]))
|
if (method_exists($this, $method_name) && isset($_GET['id_'.Dispatcher::getInstance()->getController()]))
|
||||||
{
|
{
|
||||||
$type = Dispatcher::getInstance()->getController();
|
$type = Dispatcher::getInstance()->getController();
|
||||||
$id_object = $_GET['id_'.Dispatcher::getInstance()->getController()];
|
$id_object = $_GET['id_'.$type];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +504,7 @@ class LinkCore
|
|||||||
$vars[urlencode($k)] = $value;
|
$vars[urlencode($k)] = $value;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (explode('&', http_build_query(array($k => $value)), '', '&') as $key => $val)
|
foreach (explode('&', http_build_query(array($k => $value), '', '&')) as $key => $val)
|
||||||
{
|
{
|
||||||
$data = explode('=', $val);
|
$data = explode('=', $val);
|
||||||
$vars[urldecode($data[0])] = $data[1];
|
$vars[urldecode($data[0])] = $data[1];
|
||||||
@@ -519,11 +518,11 @@ class LinkCore
|
|||||||
return $url.(($this->allow == 1 || $url == $this->url) ? '?' : '&').http_build_query($vars, '', '&');
|
return $url.(($this->allow == 1 || $url == $this->url) ? '?' : '&').http_build_query($vars, '', '&');
|
||||||
$vars['requestUrl'] = $url;
|
$vars['requestUrl'] = $url;
|
||||||
|
|
||||||
if (!$this->allow == 1)
|
|
||||||
$vars['controller'] = Dispatcher::getInstance()->getController();
|
|
||||||
|
|
||||||
if ($type && $id_object)
|
if ($type && $id_object)
|
||||||
$vars['id_'.$type] = (is_object($id_object) ? (int)$id_object->id : (int)$id_object);
|
$vars['id_'.$type] = (is_object($id_object) ? (int)$id_object->id : (int)$id_object);
|
||||||
|
|
||||||
|
if (!$this->allow == 1)
|
||||||
|
$vars['controller'] = Dispatcher::getInstance()->getController();
|
||||||
return $vars;
|
return $vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,11 @@ class LocalizationPackCore
|
|||||||
$res &= $this->_installLanguages($xml, $install_mode);
|
$res &= $this->_installLanguages($xml, $install_mode);
|
||||||
|
|
||||||
if ($res && isset($this->iso_code_lang))
|
if ($res && isset($this->iso_code_lang))
|
||||||
Configuration::updateValue('PS_LANG_DEFAULT', (int)Language::getIdByIso($this->iso_code_lang));
|
{
|
||||||
|
if (!$id_lang = (int)Language::getIdByIso($this->iso_code_lang))
|
||||||
|
$id_lang = 1;
|
||||||
|
Configuration::updateValue('PS_LANG_DEFAULT', $id_lang);
|
||||||
|
}
|
||||||
|
|
||||||
if ($install_mode && $res && isset($this->iso_currency))
|
if ($install_mode && $res && isset($this->iso_currency))
|
||||||
{
|
{
|
||||||
|
|||||||
+90
-77
@@ -42,19 +42,31 @@ class MailCore
|
|||||||
* @param int $id_lang Language of the email (to translate the template)
|
* @param int $id_lang Language of the email (to translate the template)
|
||||||
* @param string $template Template: the name of template not be a var but a string !
|
* @param string $template Template: the name of template not be a var but a string !
|
||||||
* @param string $subject
|
* @param string $subject
|
||||||
* @param string $templateVars
|
* @param string $template_vars
|
||||||
* @param string $to
|
* @param string $to
|
||||||
* @param string $toName
|
* @param string $to_name
|
||||||
* @param string $from
|
* @param string $from
|
||||||
* @param string $fromName
|
* @param string $from_name
|
||||||
* @param array $fileAttachment Array with three parameters (content, mime and name). You can use an array of array to attach multiple files
|
* @param array $file_attachment Array with three parameters (content, mime and name). You can use an array of array to attach multiple files
|
||||||
* @param bool $modeSMTP
|
* @param bool $modeSMTP
|
||||||
* @param string $templatePath
|
* @param string $template_path
|
||||||
* @param bool $die
|
* @param bool $die
|
||||||
*/
|
*/
|
||||||
public static function Send($id_lang, $template, $subject, $templateVars, $to,
|
public static function Send($id_lang, $template, $subject, $template_vars, $to,
|
||||||
$toName = null, $from = null, $fromName = null, $fileAttachment = null, $modeSMTP = null, $templatePath = _PS_MAIL_DIR_, $die = false)
|
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
|
||||||
{
|
{
|
||||||
|
$theme_path = _PS_THEME_DIR_;
|
||||||
|
|
||||||
|
// Get the path of theme by id_shop if exist
|
||||||
|
if (is_numeric($id_shop) && $id_shop)
|
||||||
|
{
|
||||||
|
$shop = new Shop((int)$id_shop);
|
||||||
|
$theme_name = $shop->getTheme();
|
||||||
|
|
||||||
|
if (_THEME_NAME_ != $theme_name)
|
||||||
|
$theme_path = _PS_ROOT_DIR_.'/themes/'.$theme_name.'/';
|
||||||
|
}
|
||||||
|
|
||||||
$configuration = Configuration::getMultiple(array(
|
$configuration = Configuration::getMultiple(array(
|
||||||
'PS_SHOP_EMAIL',
|
'PS_SHOP_EMAIL',
|
||||||
'PS_MAIL_METHOD',
|
'PS_MAIL_METHOD',
|
||||||
@@ -68,47 +80,43 @@ class MailCore
|
|||||||
'PS_MAIL_TYPE'
|
'PS_MAIL_TYPE'
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION'])) $configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off';
|
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION']))
|
||||||
if (!isset($configuration['PS_MAIL_SMTP_PORT'])) $configuration['PS_MAIL_SMTP_PORT'] = 'default';
|
$configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off';
|
||||||
|
if (!isset($configuration['PS_MAIL_SMTP_PORT']))
|
||||||
|
$configuration['PS_MAIL_SMTP_PORT'] = 'default';
|
||||||
|
|
||||||
if (!isset($from)) $from = $configuration['PS_SHOP_EMAIL'];
|
// Sending an e-mail can be of vital importance for the merchant, when his password is lost for example, so we must not die but do our best to send the e-mail
|
||||||
if (!isset($fromName)) $fromName = $configuration['PS_SHOP_NAME'];
|
if (!isset($from) || !Validate::isEmail($from))
|
||||||
|
$from = $configuration['PS_SHOP_EMAIL'];
|
||||||
|
if (!Validate::isEmail($from))
|
||||||
|
$from = null;
|
||||||
|
|
||||||
if (!empty($from) && !Validate::isEmail($from))
|
// $from_name is not that important, no need to die if it is not valid
|
||||||
{
|
if (!isset($from_name) || !Validate::isMailName($from_name))
|
||||||
Tools::dieOrLog(Tools::displayError('Error: parameter "from" is corrupted'), $die);
|
$from_name = $configuration['PS_SHOP_NAME'];
|
||||||
return false;
|
if (!Validate::isMailName($from_name))
|
||||||
}
|
$from_name = null;
|
||||||
if (!empty($fromName) && !Validate::isMailName($fromName))
|
|
||||||
{
|
// It would be difficult to send an e-mail if the e-mail is not valid, so this time we can die if there is a problem
|
||||||
Tools::dieOrLog(Tools::displayError('Error: parameter "fromName" is corrupted'), $die);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!is_array($to) && !Validate::isEmail($to))
|
if (!is_array($to) && !Validate::isEmail($to))
|
||||||
{
|
{
|
||||||
Tools::dieOrLog(Tools::displayError('Error: parameter "to" is corrupted'), $die);
|
Tools::dieOrLog(Tools::displayError('Error: parameter "to" is corrupted'), $die);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($templateVars))
|
if (!is_array($template_vars))
|
||||||
{
|
$template_vars = array();
|
||||||
Tools::dieOrLog(Tools::displayError('Error: parameter "templateVars" is not an array'), $die);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not crash for this error, that may be a complicated customer name
|
// Do not crash for this error, that may be a complicated customer name
|
||||||
if (is_string($toName))
|
if (is_string($to_name) && !empty($to_name) && !Validate::isMailName($to_name))
|
||||||
{
|
$to_name = null;
|
||||||
if (!empty($toName) && !Validate::isMailName($toName))
|
|
||||||
$toName = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Validate::isTplName($template))
|
if (!Validate::isTplName($template))
|
||||||
{
|
{
|
||||||
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail template'), $die);
|
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail template'), $die);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Validate::isMailSubject($subject))
|
if (!Validate::isMailSubject($subject))
|
||||||
{
|
{
|
||||||
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail subject'), $die);
|
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail subject'), $die);
|
||||||
@@ -128,10 +136,10 @@ class MailCore
|
|||||||
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die);
|
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (is_array($toName))
|
if (is_array($to_name))
|
||||||
{
|
{
|
||||||
if ($toName && is_array($toName) && Validate::isGenericName($toName[$key]))
|
if ($to_name && is_array($to_name) && Validate::isGenericName($to_name[$key]))
|
||||||
$to_name = $toName[$key];
|
$to_name = $to_name[$key];
|
||||||
}
|
}
|
||||||
if ($to_name == null)
|
if ($to_name == null)
|
||||||
$to_name = $addr;
|
$to_name = $addr;
|
||||||
@@ -143,9 +151,9 @@ class MailCore
|
|||||||
} else {
|
} else {
|
||||||
/* Simple recipient, one address */
|
/* Simple recipient, one address */
|
||||||
$to_plugin = $to;
|
$to_plugin = $to;
|
||||||
if ($toName == null)
|
if ($to_name == null)
|
||||||
$toName = $to;
|
$to_name = $to;
|
||||||
$to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($toName).'?=');
|
$to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($to_name).'?=');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
/* Connect with the appropriate configuration */
|
/* Connect with the appropriate configuration */
|
||||||
@@ -174,7 +182,7 @@ class MailCore
|
|||||||
return false;
|
return false;
|
||||||
$swift = new Swift($connection, Configuration::get('PS_MAIL_DOMAIN'));
|
$swift = new Swift($connection, Configuration::get('PS_MAIL_DOMAIN'));
|
||||||
/* Get templates content */
|
/* Get templates content */
|
||||||
$iso = Language::getIsoById((int)($id_lang));
|
$iso = Language::getIsoById((int)$id_lang);
|
||||||
if (!$iso)
|
if (!$iso)
|
||||||
{
|
{
|
||||||
Tools::dieOrLog(Tools::displayError('Error - No ISO code for email'), $die);
|
Tools::dieOrLog(Tools::displayError('Error - No ISO code for email'), $die);
|
||||||
@@ -182,66 +190,71 @@ class MailCore
|
|||||||
}
|
}
|
||||||
$template = $iso.'/'.$template;
|
$template = $iso.'/'.$template;
|
||||||
|
|
||||||
$moduleName = false;
|
$module_name = false;
|
||||||
$overrideMail = false;
|
$override_mail = false;
|
||||||
|
|
||||||
// get templatePath
|
// get templatePath
|
||||||
if (preg_match('#'.__PS_BASE_URI__.'modules/#', $templatePath) && preg_match('#modules/([a-z0-9_-]+)/#ui', $templatePath, $res))
|
if (preg_match('#'.__PS_BASE_URI__.'modules/#', $template_path) && preg_match('#modules/([a-z0-9_-]+)/#ui', $template_path, $res))
|
||||||
$moduleName = $res[1];
|
$module_name = $res[1];
|
||||||
|
|
||||||
if ($moduleName !== false && (file_exists(_PS_THEME_DIR_.'modules/'.$moduleName.'/mails/'.$template.'.txt') ||
|
if ($module_name !== false && (file_exists($theme_path.'modules/'.$module_name.'/mails/'.$template.'.txt') ||
|
||||||
file_exists(_PS_THEME_DIR_.'modules/'.$moduleName.'/mails/'.$template.'.html')))
|
file_exists($theme_path.'modules/'.$module_name.'/mails/'.$template.'.html')))
|
||||||
$templatePath = _PS_THEME_DIR_.'modules/'.$moduleName.'/mails/';
|
$template_path = $theme_path.'modules/'.$module_name.'/mails/';
|
||||||
else if (file_exists(_PS_THEME_DIR_.'mails/'.$template.'.txt') || file_exists(_PS_THEME_DIR_.'mails/'.$template.'.html'))
|
else if (file_exists($theme_path.'mails/'.$template.'.txt') || file_exists($theme_path.'mails/'.$template.'.html'))
|
||||||
{
|
{
|
||||||
$templatePath = _PS_THEME_DIR_.'mails/';
|
$template_path = $theme_path.'mails/';
|
||||||
$overrideMail = true;
|
$override_mail = true;
|
||||||
}
|
}
|
||||||
else if (!file_exists($templatePath.$template.'.txt') || !file_exists($templatePath.$template.'.html'))
|
else if (!file_exists($template_path.$template.'.txt') || !file_exists($template_path.$template.'.html'))
|
||||||
{
|
{
|
||||||
Tools::dieOrLog(Tools::displayError('Error - The following e-mail template is missing:').' '.$templatePath.$template.'.txt', $die);
|
Tools::dieOrLog(Tools::displayError('Error - The following e-mail template is missing:').' '.$template_path.$template.'.txt', $die);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$templateHtml = file_get_contents($templatePath.$template.'.html');
|
$template_html = file_get_contents($template_path.$template.'.html');
|
||||||
$templateTxt = strip_tags(html_entity_decode(file_get_contents($templatePath.$template.'.txt'), null, 'utf-8'));
|
$template_txt = strip_tags(html_entity_decode(file_get_contents($template_path.$template.'.txt'), null, 'utf-8'));
|
||||||
|
|
||||||
if ($overrideMail && file_exists($templatePath.$iso.'/lang.php'))
|
if ($override_mail && file_exists($template_path.$iso.'/lang.php'))
|
||||||
include_once($templatePath.$iso.'/lang.php');
|
include_once($template_path.$iso.'/lang.php');
|
||||||
else if ($moduleName && file_exists($templatePath.$iso.'/lang.php'))
|
else if ($module_name && file_exists($template_path.$iso.'/lang.php'))
|
||||||
include_once(_PS_THEME_DIR_.'mails/'.$iso.'/lang.php');
|
include_once($theme_path.'mails/'.$iso.'/lang.php');
|
||||||
else
|
else
|
||||||
include_once(dirname(__FILE__).'/../mails/'.$iso.'/lang.php');
|
include_once(dirname(__FILE__).'/../mails/'.$iso.'/lang.php');
|
||||||
|
|
||||||
/* Create mail and attach differents parts */
|
/* Create mail and attach differents parts */
|
||||||
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME').'] '.$subject);
|
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME').'] '.$subject);
|
||||||
$message->headers->setEncoding('Q');
|
$message->headers->setEncoding('Q');
|
||||||
$templateVars['{shop_logo}'] = (Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL'))) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL')))) :
|
|
||||||
((file_exists(_PS_IMG_DIR_.'logo.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO')))) : '');
|
if (Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL')))
|
||||||
$templateVars['{shop_name}'] = Tools::safeOutput(Configuration::get('PS_SHOP_NAME'));
|
$template_vars['{shop_logo}'] = $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL'))));
|
||||||
$templateVars['{shop_url}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'index.php';
|
else
|
||||||
$swift->attachPlugin(new Swift_Plugin_Decorator(array($to_plugin => $templateVars)), 'decorator');
|
if (file_exists(_PS_IMG_DIR_.'logo.jpg'))
|
||||||
|
$template_vars['{shop_logo}'] = $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO'))));
|
||||||
|
else
|
||||||
|
$template_vars['{shop_logo}'] = '';
|
||||||
|
|
||||||
|
$template_vars['{shop_name}'] = Tools::safeOutput(Configuration::get('PS_SHOP_NAME'));
|
||||||
|
$template_vars['{shop_url}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'index.php';
|
||||||
|
$swift->attachPlugin(new Swift_Plugin_Decorator(array($to_plugin => $template_vars)), 'decorator');
|
||||||
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_TEXT)
|
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_TEXT)
|
||||||
$message->attach(new Swift_Message_Part($templateTxt, 'text/plain', '8bit', 'utf-8'));
|
$message->attach(new Swift_Message_Part($template_txt, 'text/plain', '8bit', 'utf-8'));
|
||||||
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_HTML)
|
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_HTML)
|
||||||
$message->attach(new Swift_Message_Part($templateHtml, 'text/html', '8bit', 'utf-8'));
|
$message->attach(new Swift_Message_Part($template_html, 'text/html', '8bit', 'utf-8'));
|
||||||
if ($fileAttachment && !empty($fileAttachment))
|
if ($file_attachment && !empty($file_attachment))
|
||||||
{
|
{
|
||||||
// Multiple attachments?
|
// Multiple attachments?
|
||||||
if (!is_array(current($fileAttachment)))
|
if (!is_array(current($file_attachment)))
|
||||||
$fileAttachment = array($fileAttachment);
|
$file_attachment = array($file_attachment);
|
||||||
|
|
||||||
foreach ($fileAttachment as $attachment)
|
foreach ($file_attachment as $attachment)
|
||||||
if (isset($attachment['content']) && isset($attachment['name']) && isset($attachment['mime']))
|
if (isset($attachment['content']) && isset($attachment['name']) && isset($attachment['mime']))
|
||||||
$message->attach(new Swift_Message_Attachment($attachment['content'], $attachment['name'], $attachment['mime']));
|
$message->attach(new Swift_Message_Attachment($attachment['content'], $attachment['name'], $attachment['mime']));
|
||||||
}
|
}
|
||||||
/* Send mail */
|
/* Send mail */
|
||||||
$send = $swift->send($message, $to, new Swift_Address($from, $fromName));
|
$send = $swift->send($message, $to, new Swift_Address($from, $from_name));
|
||||||
$swift->disconnect();
|
$swift->disconnect();
|
||||||
return $send;
|
return $send;
|
||||||
}
|
}
|
||||||
|
catch (Swift_Exception $e) {
|
||||||
catch (Swift_ConnectionException $e)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,7 +325,7 @@ class MailCore
|
|||||||
|
|
||||||
if (!is_array($_LANGMAIL))
|
if (!is_array($_LANGMAIL))
|
||||||
return (str_replace('"', '"', $string));
|
return (str_replace('"', '"', $string));
|
||||||
if (key_exists($key, $_LANGMAIL))
|
if (array_key_exists($key, $_LANGMAIL))
|
||||||
$str = $_LANGMAIL[$key];
|
$str = $_LANGMAIL[$key];
|
||||||
else
|
else
|
||||||
$str = $string;
|
$str = $string;
|
||||||
|
|||||||
@@ -117,7 +117,10 @@ class ManufacturerCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (parent::delete())
|
if (parent::delete())
|
||||||
|
{
|
||||||
|
CartRule::cleanProductRuleIntegrity('manufacturers', $this->id);
|
||||||
return $this->deleteImage();
|
return $this->deleteImage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -323,7 +326,11 @@ class ManufacturerCore extends ObjectModel
|
|||||||
$alias = '';
|
$alias = '';
|
||||||
if ($order_by == 'price')
|
if ($order_by == 'price')
|
||||||
$alias = 'product_shop.';
|
$alias = 'product_shop.';
|
||||||
elseif ($order_by == 'id_product')
|
elseif ($order_by == 'name')
|
||||||
|
$alias = 'pl.';
|
||||||
|
elseif ($order_by == 'quantity')
|
||||||
|
$alias = 'stock.';
|
||||||
|
else
|
||||||
$alias = 'p.';
|
$alias = 'p.';
|
||||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`,
|
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`,
|
||||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`,
|
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`,
|
||||||
@@ -472,4 +479,4 @@ class ManufacturerCore extends ObjectModel
|
|||||||
|
|
||||||
return ($result1 && $result2);
|
return ($result1 && $result2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -209,7 +209,7 @@ class MediaCore
|
|||||||
*/
|
*/
|
||||||
public static function getJSPath($js_uri)
|
public static function getJSPath($js_uri)
|
||||||
{
|
{
|
||||||
if (is_array($js_uri) || is_null($js_uri) || empty($js_uri))
|
if (is_array($js_uri) || $js_uri === null || empty($js_uri))
|
||||||
return false;
|
return false;
|
||||||
$url_data = parse_url($js_uri);
|
$url_data = parse_url($js_uri);
|
||||||
if (!array_key_exists('host', $url_data))
|
if (!array_key_exists('host', $url_data))
|
||||||
@@ -258,14 +258,14 @@ class MediaCore
|
|||||||
public static function getJqueryPath($version = null, $folder = null, $minifier = true)
|
public static function getJqueryPath($version = null, $folder = null, $minifier = true)
|
||||||
{
|
{
|
||||||
$add_no_conflict = false;
|
$add_no_conflict = false;
|
||||||
if (is_null($version))
|
if ($version === null)
|
||||||
$version = _PS_JQUERY_VERSION_; //set default version
|
$version = _PS_JQUERY_VERSION_; //set default version
|
||||||
else if (preg_match('/^([0-9]+\.)+[0-9]$/Ui', $version))
|
else if (preg_match('/^([0-9]+\.)+[0-9]$/Ui', $version))
|
||||||
$add_no_conflict = true;
|
$add_no_conflict = true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (is_null($folder))
|
if ($folder === null)
|
||||||
$folder = _PS_JS_DIR_.'jquery/'; //set default folder
|
$folder = _PS_JS_DIR_.'jquery/'; //set default folder
|
||||||
//check if file exist
|
//check if file exist
|
||||||
$file = $folder.'jquery-'.$version.($minifier ? '.min.js' : '.js');
|
$file = $folder.'jquery-'.$version.($minifier ? '.min.js' : '.js');
|
||||||
@@ -345,7 +345,7 @@ class MediaCore
|
|||||||
public static function getJqueryPluginPath($name, $folder)
|
public static function getJqueryPluginPath($name, $folder)
|
||||||
{
|
{
|
||||||
$plugin_path = array('js' => array(), 'css' => array());
|
$plugin_path = array('js' => array(), 'css' => array());
|
||||||
if (is_null($folder))
|
if ($folder === null)
|
||||||
$folder = _PS_JS_DIR_.'jquery/plugins/'; //set default folder
|
$folder = _PS_JS_DIR_.'jquery/plugins/'; //set default folder
|
||||||
|
|
||||||
$file = 'jquery.'.$name.'.js';
|
$file = 'jquery.'.$name.'.js';
|
||||||
|
|||||||
+3
-1
@@ -56,7 +56,7 @@ class MetaCore extends ObjectModel
|
|||||||
public static function getPages($exclude_filled = false, $add_page = false)
|
public static function getPages($exclude_filled = false, $add_page = false)
|
||||||
{
|
{
|
||||||
$selected_pages = array();
|
$selected_pages = array();
|
||||||
if (!$files = scandir(_PS_ROOT_DIR_.'/controllers/front/'))
|
if (!$files = Tools::scandir(_PS_ROOT_DIR_.'/controllers/front/', 'php', '', true))
|
||||||
die(Tools::displayError('Cannot scan root directory'));
|
die(Tools::displayError('Cannot scan root directory'));
|
||||||
|
|
||||||
// Exclude pages forbidden
|
// Exclude pages forbidden
|
||||||
@@ -68,6 +68,8 @@ class MetaCore extends ObjectModel
|
|||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
if ($file != 'index.php' && preg_match('/^[a-z0-9_.-]*\.php$/i', $file) && !in_array(strtolower(str_replace('Controller.php', '', $file)), $exlude_pages))
|
if ($file != 'index.php' && preg_match('/^[a-z0-9_.-]*\.php$/i', $file) && !in_array(strtolower(str_replace('Controller.php', '', $file)), $exlude_pages))
|
||||||
$selected_pages[strtolower(str_replace('Controller.php', '', $file))] = strtolower(str_replace('Controller.php', '', $file));
|
$selected_pages[strtolower(str_replace('Controller.php', '', $file))] = strtolower(str_replace('Controller.php', '', $file));
|
||||||
|
else if ($file != 'index.php' && preg_match('/^([a-z0-9_.-]*\/)?[a-z0-9_.-]*\.php$/i', $file) && !in_array(strtolower(str_replace('Controller.php', '', $file)), $exlude_pages))
|
||||||
|
$selected_pages[strtolower(sprintf(Tools::displayError('%1$s (in %2$s)'), dirname($file), str_replace('Controller.php', '', basename($file))))] = strtolower(str_replace('Controller.php', '', basename($file)));
|
||||||
|
|
||||||
// Add modules controllers to list (this function is cool !)
|
// Add modules controllers to list (this function is cool !)
|
||||||
foreach (glob(_PS_MODULE_DIR_.'*/controllers/front/*.php') as $file)
|
foreach (glob(_PS_MODULE_DIR_.'*/controllers/front/*.php') as $file)
|
||||||
|
|||||||
+14
-17
@@ -78,8 +78,9 @@ class NotificationCore
|
|||||||
{
|
{
|
||||||
case 'order':
|
case 'order':
|
||||||
$sql = '
|
$sql = '
|
||||||
SELECT o.`id_order`, o.`id_customer`, o.`total_paid`
|
SELECT o.`id_order`, o.`id_customer`, o.`total_paid`, o.`id_currency`, c.`firstname`, c.`lastname`
|
||||||
FROM `'._DB_PREFIX_.'orders` as o
|
FROM `'._DB_PREFIX_.'orders` as o
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'customer` as c ON (c.`id_customer` = o.`id_customer`)
|
||||||
WHERE `id_order` > '.(int)$id_last_element.
|
WHERE `id_order` > '.(int)$id_last_element.
|
||||||
Shop::addSqlRestriction(false, 'o').'
|
Shop::addSqlRestriction(false, 'o').'
|
||||||
ORDER BY `id_order` DESC
|
ORDER BY `id_order` DESC
|
||||||
@@ -97,10 +98,9 @@ class NotificationCore
|
|||||||
ORDER BY c.`id_customer_message` DESC
|
ORDER BY c.`id_customer_message` DESC
|
||||||
';
|
';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$sql = '
|
$sql = '
|
||||||
SELECT t.`id_'.bqSQL($type).'`
|
SELECT t.`id_'.bqSQL($type).'`, t.*
|
||||||
FROM `'._DB_PREFIX_.bqSQL($type).'` t
|
FROM `'._DB_PREFIX_.bqSQL($type).'` t
|
||||||
WHERE t.`deleted` = 0 AND t.`id_'.bqSQL($type).'` > '.(int)$id_last_element.
|
WHERE t.`deleted` = 0 AND t.`id_'.bqSQL($type).'` > '.(int)$id_last_element.
|
||||||
Shop::addSqlRestriction(false, 't').'
|
Shop::addSqlRestriction(false, 't').'
|
||||||
@@ -110,26 +110,23 @@ class NotificationCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
$json = array();
|
$json = array();
|
||||||
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql) as $value)
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
{
|
|
||||||
$customer = null;
|
|
||||||
$order = null;
|
|
||||||
$currency = null;
|
|
||||||
if (isset($value['id_order']))
|
|
||||||
{
|
|
||||||
$order = new Order(intval($value['id_order']));
|
|
||||||
$currency = new Currency(intval($order->id_currency));
|
|
||||||
}
|
|
||||||
if (!empty($value['id_customer']))
|
|
||||||
$customer = new Customer(intval($value['id_customer']));
|
|
||||||
|
|
||||||
|
foreach ($result as $value)
|
||||||
|
{
|
||||||
|
$customer_name = '';
|
||||||
|
if (isset($value['firstname']) && isset($value['lastname']))
|
||||||
|
$customer_name = Tools::safeOutput($value['firstname'].' '.$value['lastname']);
|
||||||
|
else if (isset($value['email']))
|
||||||
|
$customer_name = Tools::safeOutput($value['email']);
|
||||||
|
|
||||||
$json[] = array(
|
$json[] = array(
|
||||||
'id_order' => ((!empty($value['id_order'])) ? (int)$value['id_order'] : 0),
|
'id_order' => ((!empty($value['id_order'])) ? (int)$value['id_order'] : 0),
|
||||||
'id_customer' => ((!empty($value['id_customer'])) ? (int)$value['id_customer'] : 0),
|
'id_customer' => ((!empty($value['id_customer'])) ? (int)$value['id_customer'] : 0),
|
||||||
'id_customer_message' => ((!empty($value['id_customer_message'])) ? (int)$value['id_customer_message'] : 0),
|
'id_customer_message' => ((!empty($value['id_customer_message'])) ? (int)$value['id_customer_message'] : 0),
|
||||||
'id_customer_thread' => ((!empty($value['id_customer_thread'])) ? (int)$value['id_customer_thread'] : 0),
|
'id_customer_thread' => ((!empty($value['id_customer_thread'])) ? (int)$value['id_customer_thread'] : 0),
|
||||||
'total_paid' => ((!empty($value['total_paid']) && $currency != null) ? Tools::displayPrice((float)$value['total_paid'], $currency, false) : 0),
|
'total_paid' => ((!empty($value['total_paid'])) ? Tools::displayPrice((float)$value['total_paid'], (int)$value['id_currency'], false) : 0),
|
||||||
'customer_name' => (($customer != null) ? $customer->firstname.' '.$customer->lastname : (isset($value['email']) ? $value['email'] : ''))
|
'customer_name' => $customer_name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+87
-75
@@ -134,6 +134,11 @@ abstract class ObjectModelCore
|
|||||||
* @var array List of specific fields to update (all fields if null)
|
* @var array List of specific fields to update (all fields if null)
|
||||||
*/
|
*/
|
||||||
protected $update_fields = null;
|
protected $update_fields = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Db An instance of the db in order to avoid calling Db::getInstance() thousands of time
|
||||||
|
*/
|
||||||
|
protected static $db = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns object validation rules (fields validity)
|
* Returns object validation rules (fields validity)
|
||||||
@@ -163,10 +168,13 @@ abstract class ObjectModelCore
|
|||||||
*/
|
*/
|
||||||
public function __construct($id = null, $id_lang = null, $id_shop = null)
|
public function __construct($id = null, $id_lang = null, $id_shop = null)
|
||||||
{
|
{
|
||||||
|
if (!ObjectModel::$db)
|
||||||
|
ObjectModel::$db = Db::getInstance();
|
||||||
|
|
||||||
$this->def = self::getDefinition($this);
|
$this->def = self::getDefinition($this);
|
||||||
$this->setDefinitionRetrocompatibility();
|
$this->setDefinitionRetrocompatibility();
|
||||||
|
|
||||||
if (!is_null($id_lang))
|
if ($id_lang !== null)
|
||||||
$this->id_lang = (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
|
$this->id_lang = (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
|
||||||
|
|
||||||
if ($id_shop && $this->isMultishop())
|
if ($id_shop && $this->isMultishop())
|
||||||
@@ -200,10 +208,10 @@ abstract class ObjectModelCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get shop informations
|
// Get shop informations
|
||||||
if (!empty($this->def['multishop']))
|
if (Shop::isTableAssociated($this->def['table']))
|
||||||
$sql->leftJoin($this->def['table'].'_shop', 'c', 'a.'.$this->def['primary'].' = c.'.$this->def['primary'].' AND c.id_shop = '.(int)$this->id_shop);
|
$sql->leftJoin($this->def['table'].'_shop', 'c', 'a.'.$this->def['primary'].' = c.'.$this->def['primary'].' AND c.id_shop = '.(int)$this->id_shop);
|
||||||
|
|
||||||
Cache::store($cache_id, Db::getInstance()->getRow($sql));
|
Cache::store($cache_id, ObjectModel::$db->getRow($sql));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Cache::retrieve($cache_id);
|
$result = Cache::retrieve($cache_id);
|
||||||
@@ -219,7 +227,7 @@ abstract class ObjectModelCore
|
|||||||
$sql = 'SELECT * FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_lang`
|
$sql = 'SELECT * FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_lang`
|
||||||
WHERE `'.$this->def['primary'].'` = '.(int)$id
|
WHERE `'.$this->def['primary'].'` = '.(int)$id
|
||||||
.(($this->id_shop && $this->isLangMultishop()) ? ' AND `id_shop` = '.$this->id_shop : '');
|
.(($this->id_shop && $this->isLangMultishop()) ? ' AND `id_shop` = '.$this->id_shop : '');
|
||||||
$result = Db::getInstance()->executeS($sql);
|
$result = ObjectModel::$db->executeS($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
foreach ($row as $key => $value)
|
foreach ($row as $key => $value)
|
||||||
@@ -258,7 +266,7 @@ abstract class ObjectModelCore
|
|||||||
$fields = $this->formatFields(self::FORMAT_COMMON);
|
$fields = $this->formatFields(self::FORMAT_COMMON);
|
||||||
|
|
||||||
// For retro compatibility
|
// For retro compatibility
|
||||||
if (!empty($this->def['multishop']))
|
if (Shop::isTableAssociated($this->def['table']))
|
||||||
$fields = array_merge($fields, $this->getFieldsShop());
|
$fields = array_merge($fields, $this->getFieldsShop());
|
||||||
|
|
||||||
// Ensure that we get something to insert
|
// Ensure that we get something to insert
|
||||||
@@ -299,7 +307,7 @@ abstract class ObjectModelCore
|
|||||||
$is_lang_multishop = $this->isLangMultishop();
|
$is_lang_multishop = $this->isLangMultishop();
|
||||||
|
|
||||||
$fields = array();
|
$fields = array();
|
||||||
if (is_null($this->id_lang))
|
if ($this->id_lang === null)
|
||||||
foreach (Language::getLanguages(false) as $language)
|
foreach (Language::getLanguages(false) as $language)
|
||||||
{
|
{
|
||||||
$fields[$language['id_lang']] = $this->formatFields(self::FORMAT_LANG, $language['id_lang']);
|
$fields[$language['id_lang']] = $this->formatFields(self::FORMAT_LANG, $language['id_lang']);
|
||||||
@@ -310,9 +318,9 @@ abstract class ObjectModelCore
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fields = array($this->id_lang => $this->formatFields(self::FORMAT_LANG, $this->id_lang));
|
$fields = array($this->id_lang => $this->formatFields(self::FORMAT_LANG, $this->id_lang));
|
||||||
$fields['id_lang'] = $this->id_lang;
|
$fields[$this->id_lang]['id_lang'] = $this->id_lang;
|
||||||
if ($this->id_shop && $is_lang_multishop)
|
if ($this->id_shop && $is_lang_multishop)
|
||||||
$fields['id_shop'] = (int)$this->id_shop;
|
$fields[$this->id_lang]['id_shop'] = (int)$this->id_shop;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
@@ -428,6 +436,9 @@ abstract class ObjectModelCore
|
|||||||
*/
|
*/
|
||||||
public function add($autodate = true, $null_values = false)
|
public function add($autodate = true, $null_values = false)
|
||||||
{
|
{
|
||||||
|
if (!ObjectModel::$db)
|
||||||
|
ObjectModel::$db = Db::getInstance();
|
||||||
|
|
||||||
// @hook actionObject*AddBefore
|
// @hook actionObject*AddBefore
|
||||||
Hook::exec('actionObjectAddBefore', array('object' => $this));
|
Hook::exec('actionObjectAddBefore', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this));
|
||||||
@@ -439,44 +450,40 @@ abstract class ObjectModelCore
|
|||||||
$this->date_upd = date('Y-m-d H:i:s');
|
$this->date_upd = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
// Database insertion
|
// Database insertion
|
||||||
if (!$result = Db::getInstance()->insert($this->def['table'], $this->getFields(), $null_values))
|
if (!$result = ObjectModel::$db->insert($this->def['table'], $this->getFields(), $null_values))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Get object id in database
|
// Get object id in database
|
||||||
$this->id = Db::getInstance()->Insert_ID();
|
$this->id = ObjectModel::$db->Insert_ID();
|
||||||
|
|
||||||
// Database insertion for multishop fields related to the object
|
// Database insertion for multishop fields related to the object
|
||||||
if (!empty($this->def['multishop']))
|
if (Shop::isTableAssociated($this->def['table']))
|
||||||
{
|
{
|
||||||
$fields = $this->getFieldsShop();
|
|
||||||
$fields[$this->def['primary']] = (int)$this->id;
|
|
||||||
|
|
||||||
$id_shop_list = Shop::getContextListShopID();
|
$id_shop_list = Shop::getContextListShopID();
|
||||||
if (count($this->id_shop_list) > 0)
|
if (count($this->id_shop_list) > 0)
|
||||||
$id_shop_list = $this->id_shop_list;
|
$id_shop_list = $this->id_shop_list;
|
||||||
|
|
||||||
|
$fields = $this->getFieldsShop();
|
||||||
|
$fields[$this->def['primary']] = (int)$this->id;
|
||||||
|
|
||||||
foreach ($id_shop_list as $id_shop)
|
foreach ($id_shop_list as $id_shop)
|
||||||
{
|
{
|
||||||
$fields['id_shop'] = (int)$id_shop;
|
$fields['id_shop'] = (int)$id_shop;
|
||||||
$result &= Db::getInstance()->insert($this->def['table'].'_shop', $fields, $null_values);
|
$result &= ObjectModel::$db->insert($this->def['table'].'_shop', $fields, $null_values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!Shop::isFeatureActive() && Shop::isTableAssociated($this->def['table']))
|
|
||||||
$result &= $this->associateTo(Context::getContext()->shop->id);
|
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$assos = Shop::getAssoTables();
|
|
||||||
|
|
||||||
// Database insertion for multilingual fields related to the object
|
// Database insertion for multilingual fields related to the object
|
||||||
if (!empty($this->def['multilang']))
|
if (!empty($this->def['multilang']))
|
||||||
{
|
{
|
||||||
$fields = $this->getFieldsLang();
|
$fields = $this->getFieldsLang();
|
||||||
|
|
||||||
// @todo : try to do something better than this
|
|
||||||
$shops = Shop::getCompleteListOfShopsID();
|
|
||||||
if ($fields && is_array($fields))
|
if ($fields && is_array($fields))
|
||||||
|
{
|
||||||
|
$shops = Shop::getCompleteListOfShopsID();
|
||||||
|
$asso = Shop::getAssoTable($this->def['table'].'_lang');
|
||||||
foreach ($fields as $field)
|
foreach ($fields as $field)
|
||||||
{
|
{
|
||||||
foreach (array_keys($field) as $key)
|
foreach (array_keys($field) as $key)
|
||||||
@@ -484,17 +491,18 @@ abstract class ObjectModelCore
|
|||||||
throw new PrestaShopException('key '.$key.' is not table or identifier, ');
|
throw new PrestaShopException('key '.$key.' is not table or identifier, ');
|
||||||
$field[$this->def['primary']] = (int)$this->id;
|
$field[$this->def['primary']] = (int)$this->id;
|
||||||
|
|
||||||
if (isset($assos[$this->def['table'].'_lang']) && $assos[$this->def['table'].'_lang']['type'] == 'fk_shop')
|
if ($asso !== false && $asso['type'] == 'fk_shop')
|
||||||
{
|
{
|
||||||
foreach ($shops as $id_shop)
|
foreach ($shops as $id_shop)
|
||||||
{
|
{
|
||||||
$field['id_shop'] = (int)$id_shop;
|
$field['id_shop'] = (int)$id_shop;
|
||||||
$result &= Db::getInstance()->insert($this->def['table'].'_lang', $field);
|
$result &= ObjectModel::$db->insert($this->def['table'].'_lang', $field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$result &= Db::getInstance()->insert($this->def['table'].'_lang', $field);
|
$result &= ObjectModel::$db->insert($this->def['table'].'_lang', $field);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @hook actionObject*AddAfter
|
// @hook actionObject*AddAfter
|
||||||
@@ -512,6 +520,9 @@ abstract class ObjectModelCore
|
|||||||
*/
|
*/
|
||||||
public function update($null_values = false)
|
public function update($null_values = false)
|
||||||
{
|
{
|
||||||
|
if (!ObjectModel::$db)
|
||||||
|
ObjectModel::$db = Db::getInstance();
|
||||||
|
|
||||||
// @hook actionObject*UpdateBefore
|
// @hook actionObject*UpdateBefore
|
||||||
Hook::exec('actionObjectUpdateBefore', array('object' => $this));
|
Hook::exec('actionObjectUpdateBefore', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'UpdateBefore', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'UpdateBefore', array('object' => $this));
|
||||||
@@ -523,11 +534,11 @@ abstract class ObjectModelCore
|
|||||||
$this->date_upd = date('Y-m-d H:i:s');
|
$this->date_upd = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
// Database update
|
// Database update
|
||||||
if (!$result = Db::getInstance()->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id, 0, $null_values))
|
if (!$result = ObjectModel::$db->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id, 0, $null_values))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Database insertion for multishop fields related to the object
|
// Database insertion for multishop fields related to the object
|
||||||
if (!empty($this->def['multishop']))
|
if (Shop::isTableAssociated($this->def['table']))
|
||||||
{
|
{
|
||||||
$fields = $this->getFieldsShop();
|
$fields = $this->getFieldsShop();
|
||||||
$fields[$this->def['primary']] = (int)$this->id;
|
$fields[$this->def['primary']] = (int)$this->id;
|
||||||
@@ -554,11 +565,11 @@ abstract class ObjectModelCore
|
|||||||
|
|
||||||
// A little explanation of what we do here : we want to create multishop entry when update is called, but
|
// A little explanation of what we do here : we want to create multishop entry when update is called, but
|
||||||
// only if we are in a shop context (if we are in all context, we just want to update entries that alread exists)
|
// only if we are in a shop context (if we are in all context, we just want to update entries that alread exists)
|
||||||
$shop_exists = Db::getInstance()->getValue('SELECT '.$this->def['primary'].' FROM '._DB_PREFIX_.$this->def['table'].'_shop WHERE '.$where);
|
$shop_exists = ObjectModel::$db->getValue('SELECT '.$this->def['primary'].' FROM '._DB_PREFIX_.$this->def['table'].'_shop WHERE '.$where);
|
||||||
if ($shop_exists)
|
if ($shop_exists)
|
||||||
$result &= Db::getInstance()->update($this->def['table'].'_shop', $fields, $where, 0, $null_values);
|
$result &= ObjectModel::$db->update($this->def['table'].'_shop', $fields, $where, 0, $null_values);
|
||||||
else if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
else if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||||
$result &= Db::getInstance()->insert($this->def['table'].'_shop', $all_fields, $null_values);
|
$result &= ObjectModel::$db->insert($this->def['table'].'_shop', $all_fields, $null_values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,18 +591,17 @@ abstract class ObjectModelCore
|
|||||||
$id_shop_list = Shop::getContextListShopID();
|
$id_shop_list = Shop::getContextListShopID();
|
||||||
if (count($this->id_shop_list) > 0)
|
if (count($this->id_shop_list) > 0)
|
||||||
$id_shop_list = $this->id_shop_list;
|
$id_shop_list = $this->id_shop_list;
|
||||||
|
|
||||||
foreach ($id_shop_list as $id_shop)
|
foreach ($id_shop_list as $id_shop)
|
||||||
{
|
{
|
||||||
$field['id_shop'] = (int)$id_shop;
|
$field['id_shop'] = (int)$id_shop;
|
||||||
$where = pSQL($this->def['primary']).' = '.(int)$this->id
|
$where = pSQL($this->def['primary']).' = '.(int)$this->id
|
||||||
.' AND id_lang = '.(int)$field['id_lang']
|
.' AND id_lang = '.(int)$field['id_lang']
|
||||||
.' AND id_shop = '.$field['id_shop'];
|
.' AND id_shop = '.(int)$id_shop;
|
||||||
|
|
||||||
if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '.pSQL(_DB_PREFIX_.$this->def['table']).'_lang WHERE '.$where))
|
if (ObjectModel::$db->getValue('SELECT COUNT(*) FROM '.pSQL(_DB_PREFIX_.$this->def['table']).'_lang WHERE '.$where))
|
||||||
$result &= Db::getInstance()->update($this->def['table'].'_lang', $field, $where);
|
$result &= ObjectModel::$db->update($this->def['table'].'_lang', $field, $where);
|
||||||
else
|
else
|
||||||
$result &= Db::getInstance()->insert($this->def['table'].'_lang', $field);
|
$result &= ObjectModel::$db->insert($this->def['table'].'_lang', $field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If this table is not linked to multishop system ...
|
// If this table is not linked to multishop system ...
|
||||||
@@ -600,9 +610,9 @@ abstract class ObjectModelCore
|
|||||||
$where = pSQL($this->def['primary']).' = '.(int)$this->id
|
$where = pSQL($this->def['primary']).' = '.(int)$this->id
|
||||||
.' AND id_lang = '.(int)$field['id_lang'];
|
.' AND id_lang = '.(int)$field['id_lang'];
|
||||||
if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '.pSQL(_DB_PREFIX_.$this->def['table']).'_lang WHERE '.$where))
|
if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '.pSQL(_DB_PREFIX_.$this->def['table']).'_lang WHERE '.$where))
|
||||||
$result &= Db::getInstance()->update($this->def['table'].'_lang', $field, $where);
|
$result &= ObjectModel::$db->update($this->def['table'].'_lang', $field, $where);
|
||||||
else
|
else
|
||||||
$result &= Db::getInstance()->insert($this->def['table'].'_lang', $field, 'INSERT');
|
$result &= ObjectModel::$db->insert($this->def['table'].'_lang', $field, 'INSERT');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -622,36 +632,36 @@ abstract class ObjectModelCore
|
|||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
|
if (!ObjectModel::$db)
|
||||||
|
ObjectModel::$db = Db::getInstance();
|
||||||
|
|
||||||
// @hook actionObject*DeleteBefore
|
// @hook actionObject*DeleteBefore
|
||||||
Hook::exec('actionObjectDeleteBefore', array('object' => $this));
|
Hook::exec('actionObjectDeleteBefore', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'DeleteBefore', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'DeleteBefore', array('object' => $this));
|
||||||
|
|
||||||
$this->clearCache();
|
$this->clearCache();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
// Remove association to multishop table
|
// Remove association to multishop table
|
||||||
if (!empty($this->def['multishop']))
|
if (Shop::isTableAssociated($this->def['table']))
|
||||||
{
|
{
|
||||||
$id_shop_list = Shop::getContextListShopID();
|
$id_shop_list = Shop::getContextListShopID();
|
||||||
if (count($this->id_shop_list))
|
if (count($this->id_shop_list))
|
||||||
$id_shop_list = $this->id_shop_list;
|
$id_shop_list = $this->id_shop_list;
|
||||||
|
|
||||||
$result &= Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.(int)$this->id.' AND id_shop IN ('.implode(', ', $id_shop_list).')');
|
$result &= ObjectModel::$db->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.(int)$this->id.' AND id_shop IN ('.implode(', ', $id_shop_list).')');
|
||||||
}
|
}
|
||||||
else if (Shop::isTableAssociated($this->def['table']))
|
|
||||||
$result &= Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.(int)$this->id);
|
|
||||||
|
|
||||||
// Database deletion
|
// Database deletion
|
||||||
$has_multishop_entries = !empty($this->def['multishop']) ? $this->hasMultishopEntries() : false;
|
$has_multishop_entries = $this->hasMultishopEntries();
|
||||||
if ($result && !$has_multishop_entries)
|
if ($result && !$has_multishop_entries)
|
||||||
$result &= Db::getInstance()->delete($this->def['table'], '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
$result &= ObjectModel::$db->delete($this->def['table'], '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Database deletion for multilingual fields related to the object
|
// Database deletion for multilingual fields related to the object
|
||||||
if (!empty($this->def['multilang']) && !$has_multishop_entries)
|
if (!empty($this->def['multilang']) && !$has_multishop_entries)
|
||||||
$result &= Db::getInstance()->delete($this->def['table'].'_lang', '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
$result &= ObjectModel::$db->delete($this->def['table'].'_lang', '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
||||||
|
|
||||||
// @hook actionObject*DeleteAfter
|
// @hook actionObject*DeleteAfter
|
||||||
Hook::exec('actionObjectDeleteAfter', array('object' => $this));
|
Hook::exec('actionObjectDeleteAfter', array('object' => $this));
|
||||||
@@ -943,7 +953,7 @@ abstract class ObjectModelCore
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (is_null($ws_params_attribute_name))
|
if ($ws_params_attribute_name === null)
|
||||||
$ws_params_attribute_name = 'webserviceParameters';
|
$ws_params_attribute_name = 'webserviceParameters';
|
||||||
|
|
||||||
if (!isset($this->{$ws_params_attribute_name}['objectNodeName']))
|
if (!isset($this->{$ws_params_attribute_name}['objectNodeName']))
|
||||||
@@ -1004,11 +1014,10 @@ abstract class ObjectModelCore
|
|||||||
|
|
||||||
public function getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)
|
public function getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)
|
||||||
{
|
{
|
||||||
$assoc = Shop::getAssoTables();
|
$assoc = Shop::getAssoTable($this->def['table']);
|
||||||
|
if ($assoc !== false)
|
||||||
if (array_key_exists($this->def['table'], $assoc))
|
|
||||||
{
|
{
|
||||||
$multi_shop_join = ' LEFT JOIN `'._DB_PREFIX_.bqSQL($this->def['table']).'_'.bqSQL($assoc[$this->def['table']]['type']).'`
|
$multi_shop_join = ' LEFT JOIN `'._DB_PREFIX_.bqSQL($this->def['table']).'_'.bqSQL($assoc['type']).'`
|
||||||
AS multi_shop_'.bqSQL($this->def['table']).'
|
AS multi_shop_'.bqSQL($this->def['table']).'
|
||||||
ON (main.'.bqSQL($this->def['primary']).' = multi_shop_'.bqSQL($this->def['table']).'.'.bqSQL($this->def['primary']).')';
|
ON (main.'.bqSQL($this->def['primary']).' = multi_shop_'.bqSQL($this->def['table']).'.'.bqSQL($this->def['primary']).')';
|
||||||
$class_name = WebserviceRequest::$ws_current_classname;
|
$class_name = WebserviceRequest::$ws_current_classname;
|
||||||
@@ -1068,7 +1077,7 @@ abstract class ObjectModelCore
|
|||||||
*/
|
*/
|
||||||
public function isAssociatedToShop($id_shop = null)
|
public function isAssociatedToShop($id_shop = null)
|
||||||
{
|
{
|
||||||
if (is_null($id_shop))
|
if ($id_shop === null)
|
||||||
$id_shop = Context::getContext()->shop->id;
|
$id_shop = Context::getContext()->shop->id;
|
||||||
|
|
||||||
$sql = 'SELECT id_shop
|
$sql = 'SELECT id_shop
|
||||||
@@ -1148,22 +1157,22 @@ abstract class ObjectModelCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there is entries in associated shop table for current entity
|
* Check if there is more than one entries in associated shop table for current entity
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasMultishopEntries()
|
public function hasMultishopEntries()
|
||||||
{
|
{
|
||||||
if (empty($this->def['multishop']))
|
if (!Shop::isTableAssociated($this->def['table']) || !Shop::isFeatureActive())
|
||||||
return false;
|
return false;
|
||||||
|
//check if there is more than one entries in associated shop table
|
||||||
return (bool)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id);
|
return (bool)(Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id) > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isMultishop()
|
public function isMultishop()
|
||||||
{
|
{
|
||||||
return !empty($this->def['multishop']) || !empty($this->def['multilang_shop']);
|
return Shop::isTableAssociated($this->def['table']) || !empty($this->def['multilang_shop']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isLangMultishop()
|
public function isLangMultishop()
|
||||||
@@ -1211,30 +1220,33 @@ abstract class ObjectModelCore
|
|||||||
*
|
*
|
||||||
* @return bool success
|
* @return bool success
|
||||||
*/
|
*/
|
||||||
public function deleteImage()
|
public function deleteImage($force_delete = false)
|
||||||
{
|
{
|
||||||
if (!$this->id)
|
if (!$this->id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Deleting object images and thumbnails (cache) */
|
if ($force_delete || !$this->hasMultishopEntries())
|
||||||
if ($this->image_dir)
|
|
||||||
{
|
{
|
||||||
if (file_exists($this->image_dir.$this->id.'.'.$this->image_format)
|
/* Deleting object images and thumbnails (cache) */
|
||||||
&& !unlink($this->image_dir.$this->id.'.'.$this->image_format))
|
if ($this->image_dir)
|
||||||
|
{
|
||||||
|
if (file_exists($this->image_dir.$this->id.'.'.$this->image_format)
|
||||||
|
&& !unlink($this->image_dir.$this->id.'.'.$this->image_format))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (file_exists(_PS_TMP_IMG_DIR_.$this->def['table'].'_'.$this->id.'.'.$this->image_format)
|
||||||
|
&& !unlink(_PS_TMP_IMG_DIR_.$this->def['table'].'_'.$this->id.'.'.$this->image_format))
|
||||||
return false;
|
return false;
|
||||||
|
if (file_exists(_PS_TMP_IMG_DIR_.$this->def['table'].'_mini_'.$this->id.'.'.$this->image_format)
|
||||||
|
&& !unlink(_PS_TMP_IMG_DIR_.$this->def['table'].'_mini_'.$this->id.'.'.$this->image_format))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$types = ImageType::getImagesTypes();
|
||||||
|
foreach ($types as $image_type)
|
||||||
|
if (file_exists($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format)
|
||||||
|
&& !unlink($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (file_exists(_PS_TMP_IMG_DIR_.$this->def['table'].'_'.$this->id.'.'.$this->image_format)
|
|
||||||
&& !unlink(_PS_TMP_IMG_DIR_.$this->def['table'].'_'.$this->id.'.'.$this->image_format))
|
|
||||||
return false;
|
|
||||||
if (file_exists(_PS_TMP_IMG_DIR_.$this->def['table'].'_mini_'.$this->id.'.'.$this->image_format)
|
|
||||||
&& !unlink(_PS_TMP_IMG_DIR_.$this->def['table'].'_mini_'.$this->id.'.'.$this->image_format))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$types = ImageType::getImagesTypes();
|
|
||||||
foreach ($types as $image_type)
|
|
||||||
if (file_exists($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format)
|
|
||||||
&& !unlink($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format))
|
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+121
-87
@@ -140,25 +140,31 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
|
$message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
|
||||||
$secure_key = false, Shop $shop = null)
|
$secure_key = false, Shop $shop = null)
|
||||||
{
|
{
|
||||||
$cart = new Cart($id_cart);
|
$this->context->cart = new Cart($id_cart);
|
||||||
$this->context->cart = $cart;
|
$this->context->customer = new Customer($this->context->cart->id_customer);
|
||||||
|
$this->context->language = new Language($this->context->cart->id_lang);
|
||||||
|
$this->context->shop = ($shop ? $shop : new Shop($this->context->cart->id_shop));
|
||||||
|
$id_currency = $currency_special ? (int)$currency_special : (int)$this->context->cart->id_currency;
|
||||||
|
$this->context->currency = new Currency($id_currency, null, $this->context->shop->id);
|
||||||
|
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery')
|
||||||
|
$context_country = $this->context->country;
|
||||||
|
|
||||||
$order_status = new OrderState((int)$id_order_state, (int)$cart->id_lang);
|
$order_status = new OrderState((int)$id_order_state, (int)$this->context->language->id);
|
||||||
if (!Validate::isLoadedObject($order_status))
|
if (!Validate::isLoadedObject($order_status))
|
||||||
throw new PrestaShopException('Can\'t load Order state status');
|
throw new PrestaShopException('Can\'t load Order state status');
|
||||||
|
|
||||||
if (!$this->active)
|
if (!$this->active)
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
// Does order already exists ?
|
// Does order already exists ?
|
||||||
if (Validate::isLoadedObject($cart) && $cart->OrderExists() == false)
|
if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists() == false)
|
||||||
{
|
{
|
||||||
if ($secure_key !== false && $secure_key != $cart->secure_key)
|
if ($secure_key !== false && $secure_key != $this->context->cart->secure_key)
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
// For each package, generate an order
|
// For each package, generate an order
|
||||||
$delivery_option_list = $cart->getDeliveryOptionList();
|
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
|
||||||
$package_list = $cart->getPackageList();
|
$package_list = $this->context->cart->getPackageList();
|
||||||
$cart_delivery_option = $cart->getDeliveryOption();
|
$cart_delivery_option = $this->context->cart->getDeliveryOption();
|
||||||
|
|
||||||
// If some delivery options are not defined, or not valid, use the first valid option
|
// If some delivery options are not defined, or not valid, use the first valid option
|
||||||
foreach ($delivery_option_list as $id_address => $package)
|
foreach ($delivery_option_list as $id_address => $package)
|
||||||
@@ -174,16 +180,13 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$reference = Order::generateReference();
|
$reference = Order::generateReference();
|
||||||
$this->currentOrderReference = $reference;
|
$this->currentOrderReference = $reference;
|
||||||
|
|
||||||
$id_currency = $currency_special ? (int)$currency_special : (int)$cart->id_currency;
|
|
||||||
$currency = new Currency($id_currency);
|
|
||||||
|
|
||||||
$order_creation_failed = false;
|
$order_creation_failed = false;
|
||||||
$cart_total_paid = (float)Tools::ps_round((float)$cart->getOrderTotal(true, Cart::BOTH), 2);
|
$cart_total_paid = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH), 2);
|
||||||
|
|
||||||
if ($cart->orderExists())
|
if ($this->context->cart->orderExists())
|
||||||
{
|
{
|
||||||
$error = Tools::displayError('An order has already been placed using this cart.');
|
$error = Tools::displayError('An order has already been placed using this cart.');
|
||||||
Logger::addLog($error, 4, '0000001', 'Cart', intval($cart->id));
|
Logger::addLog($error, 4, '0000001', 'Cart', intval($this->context->cart->id));
|
||||||
die($error);
|
die($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,16 +195,25 @@ abstract class PaymentModuleCore extends Module
|
|||||||
foreach ($data['package_list'] as $id_package)
|
foreach ($data['package_list'] as $id_package)
|
||||||
$package_list[$id_address][$id_package]['id_carrier'] = $id_carrier;
|
$package_list[$id_address][$id_package]['id_carrier'] = $id_carrier;
|
||||||
|
|
||||||
|
// Make sure CarRule caches are empty
|
||||||
|
CartRule::cleanCache();
|
||||||
|
|
||||||
foreach ($package_list as $id_address => $packageByAddress)
|
foreach ($package_list as $id_address => $packageByAddress)
|
||||||
foreach ($packageByAddress as $id_package => $package)
|
foreach ($packageByAddress as $id_package => $package)
|
||||||
{
|
{
|
||||||
$order = new Order();
|
$order = new Order();
|
||||||
$order->product_list = $package['product_list'];
|
$order->product_list = $package['product_list'];
|
||||||
|
|
||||||
$carrier = null;
|
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery')
|
||||||
if (!$cart->isVirtualCart() && isset($package['id_carrier']))
|
|
||||||
{
|
{
|
||||||
$carrier = new Carrier($package['id_carrier'], $cart->id_lang);
|
$address = new Address($id_address);
|
||||||
|
$this->context->country = new Country($address->id_country, $this->context->cart->id_lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
$carrier = null;
|
||||||
|
if (!$this->context->cart->isVirtualCart() && isset($package['id_carrier']))
|
||||||
|
{
|
||||||
|
$carrier = new Carrier($package['id_carrier'], $this->context->cart->id_lang);
|
||||||
$order->id_carrier = (int)$carrier->id;
|
$order->id_carrier = (int)$carrier->id;
|
||||||
$id_carrier = (int)$carrier->id;
|
$id_carrier = (int)$carrier->id;
|
||||||
}
|
}
|
||||||
@@ -211,57 +223,47 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$id_carrier = 0;
|
$id_carrier = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->id_customer = (int)$cart->id_customer;
|
$order->id_customer = (int)$this->context->cart->id_customer;
|
||||||
$order->id_address_invoice = (int)$cart->id_address_invoice;
|
$order->id_address_invoice = (int)$this->context->cart->id_address_invoice;
|
||||||
$order->id_address_delivery = (int)$id_address;
|
$order->id_address_delivery = (int)$id_address;
|
||||||
$order->id_currency = $id_currency;
|
$order->id_currency = $this->context->currency->id;
|
||||||
$order->id_lang = (int)$cart->id_lang;
|
$order->id_lang = (int)$this->context->cart->id_lang;
|
||||||
$order->id_cart = (int)$cart->id;
|
$order->id_cart = (int)$this->context->cart->id;
|
||||||
$order->reference = $reference;
|
$order->reference = $reference;
|
||||||
|
$order->id_shop = (int)$this->context->shop->id;
|
||||||
|
$order->id_shop_group = (int)$this->context->shop->id_shop_group;
|
||||||
|
|
||||||
if (($shop != null) && (Shop::getContext() == Shop::CONTEXT_SHOP))
|
$order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($this->context->customer->secure_key));
|
||||||
{
|
|
||||||
$order->id_shop = (int)$shop->id;
|
|
||||||
$order->id_shop_group = (int)$shop->id_shop_group;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$order->id_shop = (int)$cart->id_shop;
|
|
||||||
$order->id_shop_group = (int)$cart->id_shop_group;
|
|
||||||
}
|
|
||||||
|
|
||||||
$customer = new Customer($order->id_customer);
|
|
||||||
$order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($customer->secure_key));
|
|
||||||
$order->payment = $payment_method;
|
$order->payment = $payment_method;
|
||||||
if (isset($this->name))
|
if (isset($this->name))
|
||||||
$order->module = $this->name;
|
$order->module = $this->name;
|
||||||
$order->recyclable = $cart->recyclable;
|
$order->recyclable = $this->context->cart->recyclable;
|
||||||
$order->gift = (int)$cart->gift;
|
$order->gift = (int)$this->context->cart->gift;
|
||||||
$order->gift_message = $cart->gift_message;
|
$order->gift_message = $this->context->cart->gift_message;
|
||||||
$order->conversion_rate = $currency->conversion_rate;
|
$order->conversion_rate = $this->context->currency->conversion_rate;
|
||||||
$amount_paid = !$dont_touch_amount ? Tools::ps_round((float)$amount_paid, 2) : $amount_paid;
|
$amount_paid = !$dont_touch_amount ? Tools::ps_round((float)$amount_paid, 2) : $amount_paid;
|
||||||
$order->total_paid_real = 0;
|
$order->total_paid_real = 0;
|
||||||
|
|
||||||
$order->total_products = (float)$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS, $order->product_list, $id_carrier);
|
$order->total_products = (float)$this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS, $order->product_list, $id_carrier);
|
||||||
$order->total_products_wt = (float)$cart->getOrderTotal(true, Cart::ONLY_PRODUCTS, $order->product_list, $id_carrier);
|
$order->total_products_wt = (float)$this->context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS, $order->product_list, $id_carrier);
|
||||||
|
|
||||||
$order->total_discounts_tax_excl = (float)abs($cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS, $order->product_list, $id_carrier));
|
$order->total_discounts_tax_excl = (float)abs($this->context->cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS, $order->product_list, $id_carrier));
|
||||||
$order->total_discounts_tax_incl = (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS, $order->product_list, $id_carrier));
|
$order->total_discounts_tax_incl = (float)abs($this->context->cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS, $order->product_list, $id_carrier));
|
||||||
$order->total_discounts = $order->total_discounts_tax_incl;
|
$order->total_discounts = $order->total_discounts_tax_incl;
|
||||||
|
|
||||||
$order->total_shipping_tax_excl = (float)$cart->getPackageShippingCost((int)$id_carrier, false, null, $order->product_list);
|
$order->total_shipping_tax_excl = (float)$this->context->cart->getPackageShippingCost((int)$id_carrier, false, null, $order->product_list);
|
||||||
$order->total_shipping_tax_incl = (float)$cart->getPackageShippingCost((int)$id_carrier, true, null, $order->product_list);
|
$order->total_shipping_tax_incl = (float)$this->context->cart->getPackageShippingCost((int)$id_carrier, true, null, $order->product_list);
|
||||||
$order->total_shipping = $order->total_shipping_tax_incl;
|
$order->total_shipping = $order->total_shipping_tax_incl;
|
||||||
|
|
||||||
if (!is_null($carrier) && Validate::isLoadedObject($carrier))
|
if (!is_null($carrier) && Validate::isLoadedObject($carrier))
|
||||||
$order->carrier_tax_rate = $carrier->getTaxesRate(new Address($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
$order->carrier_tax_rate = $carrier->getTaxesRate(new Address($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||||
|
|
||||||
$order->total_wrapping_tax_excl = (float)abs($cart->getOrderTotal(false, Cart::ONLY_WRAPPING, $order->product_list, $id_carrier));
|
$order->total_wrapping_tax_excl = (float)abs($this->context->cart->getOrderTotal(false, Cart::ONLY_WRAPPING, $order->product_list, $id_carrier));
|
||||||
$order->total_wrapping_tax_incl = (float)abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $order->product_list, $id_carrier));
|
$order->total_wrapping_tax_incl = (float)abs($this->context->cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $order->product_list, $id_carrier));
|
||||||
$order->total_wrapping = $order->total_wrapping_tax_incl;
|
$order->total_wrapping = $order->total_wrapping_tax_incl;
|
||||||
|
|
||||||
$order->total_paid_tax_excl = (float)Tools::ps_round((float)$cart->getOrderTotal(false, Cart::BOTH, $order->product_list, $id_carrier), 2);
|
$order->total_paid_tax_excl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(false, Cart::BOTH, $order->product_list, $id_carrier), 2);
|
||||||
$order->total_paid_tax_incl = (float)Tools::ps_round((float)$cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier), 2);
|
$order->total_paid_tax_incl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier), 2);
|
||||||
$order->total_paid = $order->total_paid_tax_incl;
|
$order->total_paid = $order->total_paid_tax_incl;
|
||||||
|
|
||||||
$order->invoice_date = '0000-00-00 00:00:00';
|
$order->invoice_date = '0000-00-00 00:00:00';
|
||||||
@@ -284,7 +286,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
|
|
||||||
// Insert new Order detail list using cart for the current order
|
// Insert new Order detail list using cart for the current order
|
||||||
$order_detail = new OrderDetail(null, null, $this->context);
|
$order_detail = new OrderDetail(null, null, $this->context);
|
||||||
$order_detail->createList($order, $cart, $id_order_state, $order->product_list, 0, true, $package_list[$id_address][$id_package]['id_warehouse']);
|
$order_detail->createList($order, $this->context->cart, $id_order_state, $order->product_list, 0, true, $package_list[$id_address][$id_package]['id_warehouse']);
|
||||||
$order_detail_list[] = $order_detail;
|
$order_detail_list[] = $order_detail;
|
||||||
|
|
||||||
// Adding an entry in order_carrier table
|
// Adding an entry in order_carrier table
|
||||||
@@ -299,6 +301,10 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$order_carrier->add();
|
$order_carrier->add();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The country can only change if the address used for the calculation is the delivery address, and if multi-shipping is activated
|
||||||
|
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery')
|
||||||
|
$this->context->country = $context_country;
|
||||||
|
|
||||||
// Register Payment only if the order status validate the order
|
// Register Payment only if the order status validate the order
|
||||||
if ($order_status->logable)
|
if ($order_status->logable)
|
||||||
@@ -313,8 +319,12 @@ abstract class PaymentModuleCore extends Module
|
|||||||
// Next !
|
// Next !
|
||||||
$only_one_gift = false;
|
$only_one_gift = false;
|
||||||
$cart_rule_used = array();
|
$cart_rule_used = array();
|
||||||
$products = $cart->getProducts();
|
$products = $this->context->cart->getProducts();
|
||||||
$cart_rules = $cart->getCartRules();
|
$cart_rules = $this->context->cart->getCartRules();
|
||||||
|
|
||||||
|
// Make sure CarRule caches are empty
|
||||||
|
CartRule::cleanCache();
|
||||||
|
|
||||||
foreach ($order_detail_list as $key => $order_detail)
|
foreach ($order_detail_list as $key => $order_detail)
|
||||||
{
|
{
|
||||||
$order = $order_list[$key];
|
$order = $order_list[$key];
|
||||||
@@ -338,7 +348,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
|
|
||||||
// Insert new Order detail list using cart for the current order
|
// Insert new Order detail list using cart for the current order
|
||||||
//$orderDetail = new OrderDetail(null, null, $this->context);
|
//$orderDetail = new OrderDetail(null, null, $this->context);
|
||||||
//$orderDetail->createList($order, $cart, $id_order_state);
|
//$orderDetail->createList($order, $this->context->cart, $id_order_state);
|
||||||
|
|
||||||
// Construct order detail table for the email
|
// Construct order detail table for the email
|
||||||
$products_list = '';
|
$products_list = '';
|
||||||
@@ -371,9 +381,9 @@ abstract class PaymentModuleCore extends Module
|
|||||||
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
|
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
|
||||||
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
|
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
|
||||||
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.Tools::displayError('Customized').(!empty($customization_text) ? ' - '.$customization_text : '').'</strong></td>
|
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.Tools::displayError('Customized').(!empty($customization_text) ? ' - '.$customization_text : '').'</strong></td>
|
||||||
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $currency, false).'</td>
|
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $this->context->currency, false).'</td>
|
||||||
<td style="padding: 0.6em 0.4em; text-align: center;">'.$customization_quantity.'</td>
|
<td style="padding: 0.6em 0.4em; text-align: center;">'.$customization_quantity.'</td>
|
||||||
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice($customization_quantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $currency, false).'</td>
|
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice($customization_quantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $this->context->currency, false).'</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,9 +392,9 @@ abstract class PaymentModuleCore extends Module
|
|||||||
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
|
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
|
||||||
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
|
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
|
||||||
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</strong></td>
|
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</strong></td>
|
||||||
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $currency, false).'</td>
|
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $this->context->currency, false).'</td>
|
||||||
<td style="padding: 0.6em 0.4em; text-align: center;">'.((int)$product['cart_quantity'] - $customization_quantity).'</td>
|
<td style="padding: 0.6em 0.4em; text-align: center;">'.((int)$product['cart_quantity'] - $customization_quantity).'</td>
|
||||||
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(((int)$product['cart_quantity'] - $customization_quantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $currency, false).'</td>
|
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(((int)$product['cart_quantity'] - $customization_quantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $this->context->currency, false).'</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
// Check if is not a virutal product for the displaying of shipping
|
// Check if is not a virutal product for the displaying of shipping
|
||||||
@@ -441,19 +451,21 @@ abstract class PaymentModuleCore extends Module
|
|||||||
CartRule::copyConditions($cart_rule['obj']->id, $voucher->id);
|
CartRule::copyConditions($cart_rule['obj']->id, $voucher->id);
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $currency, false),
|
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
|
||||||
'{voucher_num}' => $voucher->code,
|
'{voucher_num}' => $voucher->code,
|
||||||
'{firstname}' => $customer->firstname,
|
'{firstname}' => $this->context->customer->firstname,
|
||||||
'{lastname}' => $customer->lastname,
|
'{lastname}' => $this->context->customer->lastname,
|
||||||
'{id_order}' => $order->reference
|
'{id_order}' => $order->reference,
|
||||||
|
'{order_name}' => $order->getUniqReference()
|
||||||
);
|
);
|
||||||
Mail::Send(
|
Mail::Send(
|
||||||
(int)$order->id_lang,
|
(int)$order->id_lang,
|
||||||
'voucher',
|
'voucher',
|
||||||
sprintf(Mail::l('New voucher regarding your order %s', (int)$order->id_lang), $order->reference),
|
sprintf(Mail::l('New voucher regarding your order %s', (int)$order->id_lang), $order->reference),
|
||||||
$params,
|
$params,
|
||||||
$customer->email,
|
$this->context->customer->email,
|
||||||
$customer->firstname.' '.$customer->lastname
|
$this->context->customer->firstname.' '.$this->context->customer->lastname,
|
||||||
|
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,29 +483,50 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$cart_rules_list .= '
|
$cart_rules_list .= '
|
||||||
<tr style="background-color:#EBECEE;">
|
<tr style="background-color:#EBECEE;">
|
||||||
<td colspan="4" style="padding:0.6em 0.4em;text-align:right">'.Tools::displayError('Voucher name:').' '.$cart_rule['obj']->name.'</td>
|
<td colspan="4" style="padding:0.6em 0.4em;text-align:right">'.Tools::displayError('Voucher name:').' '.$cart_rule['obj']->name.'</td>
|
||||||
<td style="padding:0.6em 0.4em;text-align:right">'.($values['tax_incl'] != 0.00 ? '-' : '').Tools::displayPrice($values['tax_incl'], $currency, false).'</td>
|
<td style="padding:0.6em 0.4em;text-align:right">'.($values['tax_incl'] != 0.00 ? '-' : '').Tools::displayPrice($values['tax_incl'], $this->context->currency, false).'</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specify order id for message
|
// Specify order id for message
|
||||||
$old_message = Message::getMessageByCartId((int)$cart->id);
|
$old_message = Message::getMessageByCartId((int)$this->context->cart->id);
|
||||||
if ($old_message)
|
if ($old_message)
|
||||||
{
|
{
|
||||||
$message = new Message((int)$old_message['id_message']);
|
$message = new Message((int)$old_message['id_message']);
|
||||||
$message->id_order = (int)$order->id;
|
$message->id_order = (int)$order->id;
|
||||||
$message->update();
|
$message->update();
|
||||||
|
|
||||||
|
// Add this message in the customer thread
|
||||||
|
$customer_thread = new CustomerThread();
|
||||||
|
$customer_thread->id_contact = 0;
|
||||||
|
$customer_thread->id_customer = (int)$order->id_customer;
|
||||||
|
$customer_thread->id_shop = (int)$this->context->shop->id;
|
||||||
|
$customer_thread->id_order = (int)$order->id;
|
||||||
|
$customer_thread->id_lang = (int)$this->context->language->id;
|
||||||
|
$customer_thread->email = $this->context->customer->email;
|
||||||
|
$customer_thread->status = 'open';
|
||||||
|
$customer_thread->token = Tools::passwdGen(12);
|
||||||
|
$customer_thread->add();
|
||||||
|
|
||||||
|
$customer_message = new CustomerMessage();
|
||||||
|
$customer_message->id_customer_thread = $customer_thread->id;
|
||||||
|
$customer_message->id_employee = 0;
|
||||||
|
$customer_message->message = htmlentities($message->message, ENT_COMPAT, 'UTF-8');
|
||||||
|
$customer_message->private = 0;
|
||||||
|
|
||||||
|
if (!$customer_message->add())
|
||||||
|
$this->errors[] = Tools::displayError('An error occurred while saving message');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook validate order
|
// Hook validate order
|
||||||
Hook::exec('actionValidateOrder', array(
|
Hook::exec('actionValidateOrder', array(
|
||||||
'cart' => $cart,
|
'cart' => $this->context->cart,
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'customer' => $customer,
|
'customer' => $this->context->customer,
|
||||||
'currency' => $currency,
|
'currency' => $this->context->currency,
|
||||||
'orderStatus' => $order_status
|
'orderStatus' => $order_status
|
||||||
));
|
));
|
||||||
|
|
||||||
foreach ($cart->getProducts() as $product)
|
foreach ($this->context->cart->getProducts() as $product)
|
||||||
if ($order_status->logable)
|
if ($order_status->logable)
|
||||||
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
|
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
|
||||||
|
|
||||||
@@ -509,7 +542,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
// So you migth have two order states
|
// So you migth have two order states
|
||||||
$new_history = new OrderHistory();
|
$new_history = new OrderHistory();
|
||||||
$new_history->id_order = (int)$order->id;
|
$new_history->id_order = (int)$order->id;
|
||||||
$new_history->changeIdOrderState((int)$id_order_state, (int)$order->id);
|
$new_history->changeIdOrderState((int)$id_order_state, (int)$order->id, true);
|
||||||
$new_history->addWithemail(true, $extra_vars);
|
$new_history->addWithemail(true, $extra_vars);
|
||||||
|
|
||||||
unset($order_detail);
|
unset($order_detail);
|
||||||
@@ -518,7 +551,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$order = new Order($order->id);
|
$order = new Order($order->id);
|
||||||
|
|
||||||
// Send an e-mail to customer (one order = one email)
|
// Send an e-mail to customer (one order = one email)
|
||||||
if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $customer->id)
|
if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id)
|
||||||
{
|
{
|
||||||
$invoice = new Address($order->id_address_invoice);
|
$invoice = new Address($order->id_address_invoice);
|
||||||
$delivery = new Address($order->id_address_delivery);
|
$delivery = new Address($order->id_address_delivery);
|
||||||
@@ -526,9 +559,9 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$invoice_state = $invoice->id_state ? new State($invoice->id_state) : false;
|
$invoice_state = $invoice->id_state ? new State($invoice->id_state) : false;
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'{firstname}' => $customer->firstname,
|
'{firstname}' => $this->context->customer->firstname,
|
||||||
'{lastname}' => $customer->lastname,
|
'{lastname}' => $this->context->customer->lastname,
|
||||||
'{email}' => $customer->email,
|
'{email}' => $this->context->customer->email,
|
||||||
'{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"),
|
'{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"),
|
||||||
'{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"),
|
'{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"),
|
||||||
'{delivery_block_html}' => $this->_getFormatedAddress($delivery, '<br />', array(
|
'{delivery_block_html}' => $this->_getFormatedAddress($delivery, '<br />', array(
|
||||||
@@ -562,17 +595,17 @@ abstract class PaymentModuleCore extends Module
|
|||||||
'{invoice_state}' => $invoice->id_state ? $invoice_state->name : '',
|
'{invoice_state}' => $invoice->id_state ? $invoice_state->name : '',
|
||||||
'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,
|
'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,
|
||||||
'{invoice_other}' => $invoice->other,
|
'{invoice_other}' => $invoice->other,
|
||||||
'{order_name}' => sprintf('#%06d', (int)$order->id),
|
'{order_name}' => $order->getUniqReference(),
|
||||||
'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int)$order->id_lang, 1),
|
'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int)$order->id_lang, 1),
|
||||||
'{carrier}' => $virtual_product ? Tools::displayError('No carrier') : $carrier->name,
|
'{carrier}' => $virtual_product ? Tools::displayError('No carrier') : $carrier->name,
|
||||||
'{payment}' => Tools::substr($order->payment, 0, 32),
|
'{payment}' => Tools::substr($order->payment, 0, 32),
|
||||||
'{products}' => $this->formatProductAndVoucherForEmail($products_list),
|
'{products}' => $this->formatProductAndVoucherForEmail($products_list),
|
||||||
'{discounts}' => $this->formatProductAndVoucherForEmail($cart_rules_list),
|
'{discounts}' => $this->formatProductAndVoucherForEmail($cart_rules_list),
|
||||||
'{total_paid}' => Tools::displayPrice($order->total_paid, $currency, false),
|
'{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false),
|
||||||
'{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $currency, false),
|
'{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $this->context->currency, false),
|
||||||
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency, false),
|
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false),
|
||||||
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency, false),
|
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false),
|
||||||
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency, false));
|
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false));
|
||||||
|
|
||||||
if (is_array($extra_vars))
|
if (is_array($extra_vars))
|
||||||
$data = array_merge($data, $extra_vars);
|
$data = array_merge($data, $extra_vars);
|
||||||
@@ -588,17 +621,18 @@ abstract class PaymentModuleCore extends Module
|
|||||||
else
|
else
|
||||||
$file_attachement = null;
|
$file_attachement = null;
|
||||||
|
|
||||||
if (Validate::isEmail($customer->email))
|
if (Validate::isEmail($this->context->customer->email))
|
||||||
Mail::Send(
|
Mail::Send(
|
||||||
(int)$order->id_lang,
|
(int)$order->id_lang,
|
||||||
'order_conf',
|
'order_conf',
|
||||||
Mail::l('Order confirmation', (int)$order->id_lang),
|
Mail::l('Order confirmation', (int)$order->id_lang),
|
||||||
$data,
|
$data,
|
||||||
$customer->email,
|
$this->context->customer->email,
|
||||||
$customer->firstname.' '.$customer->lastname,
|
$this->context->customer->firstname.' '.$this->context->customer->lastname,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
$file_attachement
|
$file_attachement,
|
||||||
|
null, _PS_MAIL_DIR_, false, (int)$order->id_shop
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -612,7 +646,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
if (StockAvailable::dependsOnStock($product['product_id']))
|
if (StockAvailable::dependsOnStock($product['product_id']))
|
||||||
{
|
{
|
||||||
// synchronizes
|
// synchronizes
|
||||||
StockAvailable::synchronize($product['product_id']);
|
StockAvailable::synchronize($product['product_id'], $order->id_shop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -631,7 +665,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error = Tools::displayError('Cart cannot be loaded or an order has already been placed using this cart');
|
$error = Tools::displayError('Cart cannot be loaded or an order has already been placed using this cart');
|
||||||
Logger::addLog($error, 4, '0000001', 'Cart', intval($cart->id));
|
Logger::addLog($error, 4, '0000001', 'Cart', intval($this->context->cart->id));
|
||||||
die($error);
|
die($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+116
-98
@@ -202,6 +202,8 @@ class ProductCore extends ObjectModel
|
|||||||
* @var boolean Tells if the product uses the advanced stock management
|
* @var boolean Tells if the product uses the advanced stock management
|
||||||
*/
|
*/
|
||||||
public $advanced_stock_management = 0;
|
public $advanced_stock_management = 0;
|
||||||
|
public $out_of_stock;
|
||||||
|
public $depends_on_stock;
|
||||||
|
|
||||||
public $isFullyLoaded = false;
|
public $isFullyLoaded = false;
|
||||||
|
|
||||||
@@ -233,7 +235,6 @@ class ProductCore extends ObjectModel
|
|||||||
'primary' => 'id_product',
|
'primary' => 'id_product',
|
||||||
'multilang' => true,
|
'multilang' => true,
|
||||||
'multilang_shop' => true,
|
'multilang_shop' => true,
|
||||||
'multishop' => true,
|
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
// Classic fields
|
// Classic fields
|
||||||
'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||||
@@ -246,7 +247,6 @@ class ProductCore extends ObjectModel
|
|||||||
'depth' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
|
'depth' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
|
||||||
'weight' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
|
'weight' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
|
||||||
'quantity_discount' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'quantity_discount' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'uploadable_files' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
|
||||||
'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 13),
|
'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 13),
|
||||||
'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12),
|
'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12),
|
||||||
'cache_is_pack' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'cache_is_pack' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
@@ -267,6 +267,7 @@ class ProductCore extends ObjectModel
|
|||||||
'additional_shipping_cost' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice'),
|
'additional_shipping_cost' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice'),
|
||||||
'customizable' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
|
'customizable' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
|
||||||
'text_fields' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
|
'text_fields' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
|
||||||
|
'uploadable_files' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
|
||||||
'active' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
'active' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
||||||
'available_for_order' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
'available_for_order' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
||||||
'available_date' => array('type' => self::TYPE_DATE, 'shop' => true, 'validate' => 'isDateFormat'),
|
'available_date' => array('type' => self::TYPE_DATE, 'shop' => true, 'validate' => 'isDateFormat'),
|
||||||
@@ -670,7 +671,8 @@ class ProductCore extends ObjectModel
|
|||||||
!$this->deleteAccessories() ||
|
!$this->deleteAccessories() ||
|
||||||
!$this->deleteFromAccessories() ||
|
!$this->deleteFromAccessories() ||
|
||||||
!$this->deleteFromSupplier() ||
|
!$this->deleteFromSupplier() ||
|
||||||
!$this->deleteDownload())
|
!$this->deleteDownload() ||
|
||||||
|
!$this->deleteFromCartRules())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -688,6 +690,12 @@ class ProductCore extends ObjectModel
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteFromCartRules()
|
||||||
|
{
|
||||||
|
CartRule::cleanProductRuleIntegrity('products', $this->id);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function deleteFromSupplier()
|
public function deleteFromSupplier()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->delete('product_supplier', 'id_product = '.(int)$this->id);
|
return Db::getInstance()->delete('product_supplier', 'id_product = '.(int)$this->id);
|
||||||
@@ -754,24 +762,15 @@ class ProductCore extends ObjectModel
|
|||||||
if (empty($categories))
|
if (empty($categories))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// take the first selected category to get the category tree (nleft and nright)
|
|
||||||
$category = new Category($categories[0]);
|
|
||||||
// get max position in each categories
|
|
||||||
$and = '';
|
|
||||||
if (Shop::isFeatureActive())
|
|
||||||
$and = '
|
|
||||||
AND (c.`nleft` < '.(int)$category->nleft.'
|
|
||||||
AND c.`nright` > '.(int)$category->nright.'
|
|
||||||
AND c.`level_depth` = 1)';
|
|
||||||
$result = Db::getInstance()->executeS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT c.`id_category`
|
SELECT c.`id_category`
|
||||||
FROM `'._DB_PREFIX_.'category_product` cp
|
FROM `'._DB_PREFIX_.'category_product` cp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category` c
|
LEFT JOIN `'._DB_PREFIX_.'category` c
|
||||||
ON (c.`id_category` = cp.`id_category`)
|
ON (c.`id_category` = cp.`id_category`)
|
||||||
WHERE cp.`id_category` NOT IN('.implode(',', array_map('intval', $categories)).')
|
WHERE cp.`id_category` NOT IN('.implode(',', array_map('intval', $categories)).')
|
||||||
'.$and.'
|
AND cp.id_product = '.$this->id
|
||||||
AND cp.id_product = '.$this->id
|
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($result as $categ_to_delete)
|
foreach ($result as $categ_to_delete)
|
||||||
$this->deleteCategory($categ_to_delete['id_category']);
|
$this->deleteCategory($categ_to_delete['id_category']);
|
||||||
// if none are found, it's an error
|
// if none are found, it's an error
|
||||||
@@ -783,7 +782,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
if (!$this->setGroupReduction())
|
if (!$this->setGroupReduction())
|
||||||
return false;
|
return false;
|
||||||
|
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,6 +806,7 @@ class ProductCore extends ObjectModel
|
|||||||
if ($clean_positions === true)
|
if ($clean_positions === true)
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
$this->cleanPositions((int)$row['id_category']);
|
$this->cleanPositions((int)$row['id_category']);
|
||||||
|
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -923,7 +923,6 @@ class ProductCore extends ObjectModel
|
|||||||
$sql = 'SELECT p.*, product_shop.*, pl.* , t.`rate` AS tax_rate, m.`name` AS manufacturer_name, s.`name` AS supplier_name
|
$sql = 'SELECT p.*, product_shop.*, pl.* , t.`rate` AS tax_rate, m.`name` AS manufacturer_name, s.`name` AS supplier_name
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.Shop::addSqlAssociation('product', 'p').'
|
'.Shop::addSqlAssociation('product', 'p').'
|
||||||
INNER JOIN ps_product product_shop
|
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||||
@@ -981,15 +980,18 @@ class ProductCore extends ObjectModel
|
|||||||
return count($result) > 0;
|
return count($result) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function productAttributeExists($attributes_list, $current_product_attribute = false)
|
public function productAttributeExists($attributes_list, $current_product_attribute = false, Context $context = null)
|
||||||
{
|
{
|
||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return false;
|
return false;
|
||||||
|
if ($context === null)
|
||||||
|
$context = Context::getContext();
|
||||||
$result = Db::getInstance()->executeS(
|
$result = Db::getInstance()->executeS(
|
||||||
'SELECT pac.`id_attribute`, pac.`id_product_attribute`
|
'SELECT pac.`id_attribute`, pac.`id_product_attribute`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
|
JOIN `'._DB_PREFIX_.'product_attribute_shop` pas ON (pas.id_product_attribute = pa.id_product_attribute)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
||||||
WHERE pa.`id_product` = '.(int)$this->id
|
WHERE pas.id_shop ='.(int)$context->shop->id.' AND pa.`id_product` = '.(int)$this->id
|
||||||
);
|
);
|
||||||
|
|
||||||
/* If something's wrong */
|
/* If something's wrong */
|
||||||
@@ -1070,6 +1072,7 @@ class ProductCore extends ObjectModel
|
|||||||
StockAvailable::setProductOutOfStock((int)$this->id, 1, null, $id_product_attribute);
|
StockAvailable::setProductOutOfStock((int)$this->id, 1, null, $id_product_attribute);
|
||||||
else
|
else
|
||||||
StockAvailable::setProductOutOfStock((int)$this->id, StockAvailable::outOfStock($this->id), null, $id_product_attribute);
|
StockAvailable::setProductOutOfStock((int)$this->id, StockAvailable::outOfStock($this->id), null, $id_product_attribute);
|
||||||
|
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||||
return $id_product_attribute;
|
return $id_product_attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1123,7 +1126,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
$result &= ObjectModel::updateMultishopTable('product', array(
|
$result &= ObjectModel::updateMultishopTable('product', array(
|
||||||
'cache_default_attribute' => (int)$id_product_attribute,
|
'cache_default_attribute' => (int)$id_product_attribute,
|
||||||
), '`a.id_product` = '.(int)$this->id);
|
), 'a.`id_product` = '.(int)$this->id);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -1161,12 +1164,16 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function addSupplierReference($id_supplier, $id_product_attribute, $supplier_reference = null, $price = null, $id_currency = null)
|
public function addSupplierReference($id_supplier, $id_product_attribute, $supplier_reference = null, $price = null, $id_currency = null)
|
||||||
{
|
{
|
||||||
|
//in some case we need to add price without supplier reference
|
||||||
|
if ($supplier_reference === null)
|
||||||
|
$supplier_reference = '';
|
||||||
|
|
||||||
//Try to set the default supplier reference
|
//Try to set the default supplier reference
|
||||||
if ($id_supplier > 0 && $supplier_reference != null)
|
if ($id_supplier > 0)
|
||||||
{
|
{
|
||||||
$id_product_supplier = ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $id_supplier);
|
$id_product_supplier = (int)ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $id_supplier);
|
||||||
|
|
||||||
if (empty($id_product_supplier))
|
if (!$id_product_supplier)
|
||||||
{
|
{
|
||||||
//create new record
|
//create new record
|
||||||
$product_supplier_entity = new ProductSupplier();
|
$product_supplier_entity = new ProductSupplier();
|
||||||
@@ -1349,7 +1356,7 @@ class ProductCore extends ObjectModel
|
|||||||
$combinations->where('id_product', '=', $this->id);
|
$combinations->where('id_product', '=', $this->id);
|
||||||
foreach ($combinations as $combination)
|
foreach ($combinations as $combination)
|
||||||
$result &= $combination->delete();
|
$result &= $combination->delete();
|
||||||
|
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1373,6 +1380,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteProductFeatures()
|
public function deleteProductFeatures()
|
||||||
{
|
{
|
||||||
|
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||||
return $this->deleteFeatures();
|
return $this->deleteFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1528,7 +1536,9 @@ class ProductCore extends ObjectModel
|
|||||||
);
|
);
|
||||||
|
|
||||||
$combination = new Combination($id_product_attribute);
|
$combination = new Combination($id_product_attribute);
|
||||||
return $combination->delete();
|
$res = $combination->delete();
|
||||||
|
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1558,6 +1568,8 @@ class ProductCore extends ObjectModel
|
|||||||
$result = Db::getInstance()->execute('
|
$result = Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'feature_product`
|
DELETE FROM `'._DB_PREFIX_.'feature_product`
|
||||||
WHERE `id_product` = '.(int)$this->id);
|
WHERE `id_product` = '.(int)$this->id);
|
||||||
|
|
||||||
|
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||||
return ($result);
|
return ($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1573,7 +1585,7 @@ class ProductCore extends ObjectModel
|
|||||||
return array();
|
return array();
|
||||||
|
|
||||||
$sql = 'SELECT pa.*, product_attribute_shop.*, GROUP_CONCAT(agl.`name`, \''.pSQL($attribute_value_separator).'\',
|
$sql = 'SELECT pa.*, product_attribute_shop.*, GROUP_CONCAT(agl.`name`, \''.pSQL($attribute_value_separator).'\',
|
||||||
al.`name` SEPARATOR \''.pSQL($attribute_separator).'\') as attribute_designation
|
al.`name` ORDER BY agl.`id_attribute_group` SEPARATOR \''.pSQL($attribute_separator).'\') as attribute_designation
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
||||||
@@ -1624,6 +1636,7 @@ class ProductCore extends ObjectModel
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
|
||||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||||
|
GROUP BY pa.`id_product_attribute`, ag.`id_attribute_group`
|
||||||
ORDER BY pa.`id_product_attribute`';
|
ORDER BY pa.`id_product_attribute`';
|
||||||
|
|
||||||
$res = Db::getInstance()->executeS($sql);
|
$res = Db::getInstance()->executeS($sql);
|
||||||
@@ -1667,6 +1680,7 @@ class ProductCore extends ObjectModel
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
|
||||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||||
AND pa.`id_product_attribute` = '.(int)$id_product_attribute.'
|
AND pa.`id_product_attribute` = '.(int)$id_product_attribute.'
|
||||||
|
GROUP BY pa.`id_product_attribute`, ag.`id_attribute_group`
|
||||||
ORDER BY pa.`id_product_attribute`';
|
ORDER BY pa.`id_product_attribute`';
|
||||||
|
|
||||||
$res = Db::getInstance()->executeS($sql);
|
$res = Db::getInstance()->executeS($sql);
|
||||||
@@ -2125,6 +2139,7 @@ class ProductCore extends ObjectModel
|
|||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT cp.`id_category`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category_product` cp
|
SELECT cp.`id_category`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category_product` cp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cp.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cp.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
||||||
|
'.Shop::addSqlAssociation('category', 'cp').'
|
||||||
WHERE cp.`id_product` = '.(int)$id_product.'
|
WHERE cp.`id_product` = '.(int)$id_product.'
|
||||||
AND cl.`id_lang` = '.(int)$id_lang
|
AND cl.`id_lang` = '.(int)$id_lang
|
||||||
);
|
);
|
||||||
@@ -2253,7 +2268,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
$cur_cart = $context->cart;
|
$cur_cart = $context->cart;
|
||||||
|
|
||||||
if (isset($divisor))
|
if ($divisor !== null)
|
||||||
Tools::displayParameterAsDeprecated('divisor');
|
Tools::displayParameterAsDeprecated('divisor');
|
||||||
|
|
||||||
if (!Validate::isBool($usetax) || !Validate::isUnsignedId($id_product))
|
if (!Validate::isBool($usetax) || !Validate::isUnsignedId($id_product))
|
||||||
@@ -2282,26 +2297,15 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$condition = '';
|
$condition = '';
|
||||||
$cache_name = (int)$id_cart.'_'.(int)$id_product;
|
$cache_name = (int)$id_cart.'_'.(int)$id_product;
|
||||||
|
|
||||||
if (Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION'))
|
|
||||||
{
|
|
||||||
$cache_name = (int)$id_cart.'_'.(int)$id_product.'_'.(int)$id_product_attribute;
|
|
||||||
$condition = ' AND `id_product_attribute` = '.(int)$id_product_attribute;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset(self::$_cart_quantity[$cache_name]) || self::$_cart_quantity[$cache_name] != (int)$quantity)
|
if (!isset(self::$_cart_quantity[$cache_name]) || self::$_cart_quantity[$cache_name] != (int)$quantity)
|
||||||
{
|
|
||||||
self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
SELECT SUM(`quantity`)
|
SELECT SUM(`quantity`)
|
||||||
FROM `'._DB_PREFIX_.'cart_product`
|
FROM `'._DB_PREFIX_.'cart_product`
|
||||||
WHERE `id_product` = '.(int)$id_product.'
|
WHERE `id_product` = '.(int)$id_product.'
|
||||||
AND `id_cart` = '.(int)$id_cart.' '.$condition
|
AND `id_cart` = '.(int)$id_cart);
|
||||||
);
|
$cart_quantity = self::$_cart_quantity[$cache_name];
|
||||||
|
|
||||||
$cart_quantity = self::$_cart_quantity[$cache_name];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$quantity = ($id_cart && $cart_quantity) ? $cart_quantity : $quantity;
|
|
||||||
$id_currency = (int)Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT');
|
$id_currency = (int)Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT');
|
||||||
|
|
||||||
// retrieve address informations
|
// retrieve address informations
|
||||||
@@ -2351,7 +2355,7 @@ class ProductCore extends ObjectModel
|
|||||||
$zipcode,
|
$zipcode,
|
||||||
$id_currency,
|
$id_currency,
|
||||||
$id_group,
|
$id_group,
|
||||||
$quantity,
|
$cart_quantity,
|
||||||
$usetax,
|
$usetax,
|
||||||
$decimals,
|
$decimals,
|
||||||
$only_reduc,
|
$only_reduc,
|
||||||
@@ -2361,7 +2365,8 @@ class ProductCore extends ObjectModel
|
|||||||
$use_group_reduction,
|
$use_group_reduction,
|
||||||
$id_customer,
|
$id_customer,
|
||||||
$use_customer_price,
|
$use_customer_price,
|
||||||
$id_cart
|
$id_cart,
|
||||||
|
$quantity
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2387,7 +2392,7 @@ class ProductCore extends ObjectModel
|
|||||||
**/
|
**/
|
||||||
public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency,
|
public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency,
|
||||||
$id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction,
|
$id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction,
|
||||||
$id_customer = 0, $use_customer_price = true, $id_cart = 0)
|
$id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0)
|
||||||
{
|
{
|
||||||
static $address = null;
|
static $address = null;
|
||||||
|
|
||||||
@@ -2397,18 +2402,10 @@ class ProductCore extends ObjectModel
|
|||||||
if (!$use_customer_price)
|
if (!$use_customer_price)
|
||||||
$id_customer = 0;
|
$id_customer = 0;
|
||||||
|
|
||||||
// Caching
|
|
||||||
if ($id_product_attribute === null)
|
|
||||||
$product_attribute_label = 'null';
|
|
||||||
else
|
|
||||||
$product_attribute_label = ($id_product_attribute === false ? 'false' : $id_product_attribute);
|
|
||||||
$cache_id = $id_product.'-'.$id_shop.'-'.$id_currency.'-'.$id_country.'-'.$id_state.'-'.$zipcode.'-'.$id_group.
|
$cache_id = $id_product.'-'.$id_shop.'-'.$id_currency.'-'.$id_country.'-'.$id_state.'-'.$zipcode.'-'.$id_group.
|
||||||
'-'.$quantity.'-'.$product_attribute_label.'-'.($use_tax?'1':'0').'-'.$decimals.'-'.($only_reduc?'1':'0').
|
'-'.$quantity.'-'.(int)$id_product_attribute.'-'.($use_tax?'1':'0').'-'.$decimals.'-'.($only_reduc?'1':'0').
|
||||||
'-'.($use_reduc?'1':'0').'-'.$with_ecotax.'-'.$id_customer;
|
'-'.($use_reduc?'1':'0').'-'.$with_ecotax.'-'.$id_customer;
|
||||||
|
|
||||||
if (isset(self::$_prices[$cache_id]))
|
|
||||||
return self::$_prices[$cache_id];
|
|
||||||
|
|
||||||
// reference parameter is filled before any returns
|
// reference parameter is filled before any returns
|
||||||
$specific_price = SpecificPrice::getSpecificPrice(
|
$specific_price = SpecificPrice::getSpecificPrice(
|
||||||
(int)$id_product,
|
(int)$id_product,
|
||||||
@@ -2419,47 +2416,57 @@ class ProductCore extends ObjectModel
|
|||||||
$quantity,
|
$quantity,
|
||||||
$id_product_attribute,
|
$id_product_attribute,
|
||||||
$id_customer,
|
$id_customer,
|
||||||
$id_cart
|
$id_cart,
|
||||||
|
$real_quantity
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (isset(self::$_prices[$cache_id]))
|
||||||
|
return self::$_prices[$cache_id];
|
||||||
|
|
||||||
// fetch price & attribute price
|
// fetch price & attribute price
|
||||||
$cache_id_2 = $id_product.'-'.(int)$id_product_attribute;
|
$cache_id_2 = $id_product;
|
||||||
if (!isset(self::$_pricesLevel2[$cache_id_2]))
|
if (!isset(self::$_pricesLevel2[$cache_id_2]))
|
||||||
{
|
{
|
||||||
$sql = new DbQuery();
|
$sql = new DbQuery();
|
||||||
$sql->select('product_shop.`price`, product_shop.`ecotax`');
|
$sql->select('product_shop.`price`, product_shop.`ecotax`, NULL id_product_attribute');
|
||||||
$sql->from('product', 'p');
|
$sql->from('product', 'p');
|
||||||
$sql->join(Shop::addSqlAssociation('product', 'p'));
|
$sql->join(Shop::addSqlAssociation('product', 'p'));
|
||||||
$sql->where('p.`id_product` = '.(int)$id_product);
|
$sql->where('p.`id_product` = '.(int)$id_product);
|
||||||
|
$default_on = false;
|
||||||
if (Combination::isFeatureActive())
|
if (Combination::isFeatureActive())
|
||||||
{
|
{
|
||||||
if ($id_product_attribute)
|
$default_on = true;
|
||||||
{
|
$sql->select('pa.id_product_attribute, product_attribute_shop.`price` AS attribute_price, (SELECT product_attribute_shop.price
|
||||||
$sql->select('product_attribute_shop.`price` AS attribute_price');
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
$sql->leftJoin('product_attribute', 'pa', 'pa.`id_product_attribute` = '.(int)$id_product_attribute);
|
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false));
|
WHERE pa.id_product = '.(int)$id_product.'
|
||||||
}
|
AND product_attribute_shop.default_on = 1
|
||||||
else
|
GROUP BY pa.id_product_attribute
|
||||||
$sql->select(
|
LIMIT 1) as default_on');
|
||||||
'IFNULL(
|
$sql->leftJoin('product_attribute', 'pa', 'pa.`id_product` = '.(int)$id_product);
|
||||||
(
|
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false));
|
||||||
SELECT product_attribute_shop.price
|
}
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
|
||||||
WHERE pa.id_product = '.(int)$id_product.'
|
if ($res)
|
||||||
AND product_attribute_shop.default_on = 1
|
{
|
||||||
GROUP BY pa.id_product_attribute
|
foreach ($res as $row)
|
||||||
LIMIT 1
|
self::$_pricesLevel2[$cache_id_2][(int)$row['id_product_attribute']] = array(
|
||||||
),
|
'price' => $row['price'],
|
||||||
0
|
'ecotax' => $row['ecotax'],
|
||||||
) AS attribute_price'
|
'attribute_price' => (isset($row['attribute_price']) ? $row['attribute_price'] : null)
|
||||||
);
|
);
|
||||||
|
if ($default_on)
|
||||||
|
self::$_pricesLevel2[$cache_id_2][0] = array('price' => $row['price'],
|
||||||
|
'ecotax' => $row['ecotax'],
|
||||||
|
'attribute_price' => $row['attribute_price']);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_pricesLevel2[$cache_id_2] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
|
||||||
}
|
}
|
||||||
$result = self::$_pricesLevel2[$cache_id_2];
|
|
||||||
|
if (!isset(self::$_pricesLevel2[$cache_id_2][(int)$id_product_attribute]))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$result = self::$_pricesLevel2[$cache_id_2][(int)$id_product_attribute];
|
||||||
|
|
||||||
if (!$specific_price || $specific_price['price'] < 0)
|
if (!$specific_price || $specific_price['price'] < 0)
|
||||||
$price = (float)$result['price'];
|
$price = (float)$result['price'];
|
||||||
@@ -2471,10 +2478,10 @@ class ProductCore extends ObjectModel
|
|||||||
$price = Tools::convertPrice($price, $id_currency);
|
$price = Tools::convertPrice($price, $id_currency);
|
||||||
|
|
||||||
// Attribute price
|
// Attribute price
|
||||||
if (is_array($result) && (!$specific_price || !$specific_price['id_product_attribute']))
|
if (is_array($result) && (!$specific_price || !$specific_price['id_product_attribute'] || $specific_price['price'] < 0))
|
||||||
{
|
{
|
||||||
$attribute_price = Tools::convertPrice(array_key_exists('attribute_price', $result) ? (float)$result['attribute_price'] : 0, $id_currency);
|
$attribute_price = Tools::convertPrice($result['attribute_price'] !== null ? (float)$result['attribute_price'] : 0, $id_currency);
|
||||||
if ($id_product_attribute !== false) // If you want the default combination, please use NULL value instead
|
if ($id_product_attribute !== false && !is_null($id_product_attribute)) // If you want the default combination, please use NULL value instead
|
||||||
$price += $attribute_price;
|
$price += $attribute_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2696,9 +2703,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function sqlStock($product_alias, $product_attribute = 0, $inner_join = false, Shop $shop = null)
|
public static function sqlStock($product_alias, $product_attribute = 0, $inner_join = false, Shop $shop = null)
|
||||||
{
|
{
|
||||||
if (!$shop)
|
$id_shop = ($shop !== null ? (int)$shop->id : null);
|
||||||
$shop = Context::getContext()->shop;
|
|
||||||
|
|
||||||
$sql = (($inner_join) ? ' INNER ' : ' LEFT ').'
|
$sql = (($inner_join) ? ' INNER ' : ' LEFT ').'
|
||||||
JOIN '._DB_PREFIX_.'stock_available stock
|
JOIN '._DB_PREFIX_.'stock_available stock
|
||||||
ON (stock.id_product = '.pSQL($product_alias).'.id_product';
|
ON (stock.id_product = '.pSQL($product_alias).'.id_product';
|
||||||
@@ -2713,7 +2718,7 @@ class ProductCore extends ObjectModel
|
|||||||
$sql .= ' AND stock.id_product_attribute = IFNULL('.pSQL($product_attribute).'.id_product_attribute, 0)';
|
$sql .= ' AND stock.id_product_attribute = IFNULL('.pSQL($product_attribute).'.id_product_attribute, 0)';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= StockAvailable::addSqlShopRestriction(null, $shop->id, 'stock').' )';
|
$sql .= StockAvailable::addSqlShopRestriction(null, $id_shop, 'stock').' )';
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
@@ -2842,6 +2847,7 @@ class ProductCore extends ObjectModel
|
|||||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||||
AND al.`id_lang` = '.(int)$id_lang.'
|
AND al.`id_lang` = '.(int)$id_lang.'
|
||||||
AND agl.`id_lang` = '.(int)$id_lang.'
|
AND agl.`id_lang` = '.(int)$id_lang.'
|
||||||
|
GROUP BY id_attribute_group, id_product_attribute
|
||||||
ORDER BY ag.`position` ASC, a.`position` ASC';
|
ORDER BY ag.`position` ASC, a.`position` ASC';
|
||||||
return Db::getInstance()->executeS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
@@ -2977,6 +2983,7 @@ class ProductCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
$row = array('id_feature' => (int)$id_feature, 'id_product' => (int)$this->id, 'id_feature_value' => (int)$id_value);
|
$row = array('id_feature' => (int)$id_feature, 'id_product' => (int)$this->id, 'id_feature_value' => (int)$id_value);
|
||||||
Db::getInstance()->insert('feature_product', $row);
|
Db::getInstance()->insert('feature_product', $row);
|
||||||
|
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||||
if ($id_value)
|
if ($id_value)
|
||||||
return ($id_value);
|
return ($id_value);
|
||||||
}
|
}
|
||||||
@@ -3054,7 +3061,9 @@ class ProductCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'feature_product pf
|
FROM '._DB_PREFIX_.'feature_product pf
|
||||||
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
|
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
|
||||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
|
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
|
||||||
WHERE `id_product` IN ('.implode($product_implode, ',').')');
|
LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature)
|
||||||
|
WHERE `id_product` IN ('.implode($product_implode, ',').')
|
||||||
|
ORDER BY f.position ASC');
|
||||||
|
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
@@ -4709,7 +4718,7 @@ class ProductCore extends ObjectModel
|
|||||||
public function addWs($autodate = true, $null_values = false)
|
public function addWs($autodate = true, $null_values = false)
|
||||||
{
|
{
|
||||||
$success = parent::add($autodate, $null_values);
|
$success = parent::add($autodate, $null_values);
|
||||||
if ($success)
|
if ($success && Configuration::get('PS_SEARCH_INDEXATION'))
|
||||||
Search::indexation(false, $this->id);
|
Search::indexation(false, $this->id);
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
@@ -4717,7 +4726,7 @@ class ProductCore extends ObjectModel
|
|||||||
public function updateWs($null_values = false)
|
public function updateWs($null_values = false)
|
||||||
{
|
{
|
||||||
$success = parent::update($null_values);
|
$success = parent::update($null_values);
|
||||||
if ($success)
|
if ($success && Configuration::get('PS_SEARCH_INDEXATION'))
|
||||||
Search::indexation(false, $this->id);
|
Search::indexation(false, $this->id);
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
@@ -4739,9 +4748,6 @@ class ProductCore extends ObjectModel
|
|||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && is_null($manager))
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && is_null($manager))
|
||||||
$manager = StockManagerFactory::getManager();
|
$manager = StockManagerFactory::getManager();
|
||||||
|
|
||||||
if (is_null($id_shop))
|
|
||||||
$id_shop = Context::getContext()->shop->id;
|
|
||||||
|
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && Product::usesAdvancedStockManagement($id_product) &&
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && Product::usesAdvancedStockManagement($id_product) &&
|
||||||
StockAvailable::dependsOnStock($id_product, $id_shop))
|
StockAvailable::dependsOnStock($id_product, $id_shop))
|
||||||
return $manager->getProductRealQuantities($id_product, $id_product_attribute, $id_warehouse, true);
|
return $manager->getProductRealQuantities($id_product, $id_product_attribute, $id_warehouse, true);
|
||||||
@@ -4805,10 +4811,17 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function loadStockData()
|
public function loadStockData()
|
||||||
{
|
{
|
||||||
// By default, the product quantity correspond to the available quantity to sell in the current shop
|
if (Validate::isLoadedObject($this))
|
||||||
$this->quantity = StockAvailable::getQuantityAvailableByProduct($this->id, 0);
|
{
|
||||||
$this->out_of_stock = StockAvailable::outOfStock($this->id);
|
// By default, the product quantity correspond to the available quantity to sell in the current shop
|
||||||
$this->depends_on_stock = StockAvailable::dependsOnStock($this->id);
|
$this->quantity = StockAvailable::getQuantityAvailableByProduct($this->id, 0);
|
||||||
|
$this->out_of_stock = StockAvailable::outOfStock($this->id);
|
||||||
|
$this->depends_on_stock = StockAvailable::dependsOnStock($this->id);
|
||||||
|
if (Context::getContext()->shop->getContext() == Shop::CONTEXT_GROUP && Context::getContext()->shop->getContextShopGroup()->share_stock == 1)
|
||||||
|
$this->advanced_stock_management = Db::getInstance()->getValue('SELECT `advanced_stock_management`
|
||||||
|
FROM '._DB_PREFIX_.'product_shop
|
||||||
|
WHERE id_product='.(int)$this->id.Shop::addSqlRestriction());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4816,12 +4829,17 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getDefaultCategory()
|
public function getDefaultCategory()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->getValue('
|
$default_category = Db::getInstance()->getValue('
|
||||||
SELECT product_shop.`id_category_default`
|
SELECT product_shop.`id_category_default`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.Shop::addSqlAssociation('product', 'p').'
|
'.Shop::addSqlAssociation('product', 'p').'
|
||||||
WHERE p.`id_product` = '.(int)$this->id);
|
WHERE p.`id_product` = '.(int)$this->id);
|
||||||
|
|
||||||
|
if (!$default_category)
|
||||||
|
return array('id_category_default' => Context::getContext()->shop->id_category);
|
||||||
|
else
|
||||||
|
return $default_category;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getShopsByProduct($id_product)
|
public static function getShopsByProduct($id_product)
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ class ProductSupplierCore extends ObjectModel
|
|||||||
$query->where('id_product = '.(int)$id_product.' AND id_product_attribute = '.(int)$id_product_attribute);
|
$query->where('id_product = '.(int)$id_product.' AND id_product_attribute = '.(int)$id_product_attribute);
|
||||||
$query->where('id_supplier = '.(int)$id_supplier);
|
$query->where('id_supplier = '.(int)$id_supplier);
|
||||||
|
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query);
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query);
|
||||||
|
return $row['price_te'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class ReferrerCore extends ObjectModel
|
|||||||
'http_referer_like_not' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),
|
'http_referer_like_not' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),
|
||||||
'request_uri_like_not' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),
|
'request_uri_like_not' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),
|
||||||
'base_fee' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
'base_fee' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||||
'percent_fee' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
'percent_fee' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPercentage'),
|
||||||
'click_fee' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
'click_fee' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
),
|
),
|
||||||
|
|||||||
+6
-10
@@ -35,17 +35,15 @@ class RiskCore extends ObjectModel
|
|||||||
public $color;
|
public $color;
|
||||||
public $percent;
|
public $percent;
|
||||||
|
|
||||||
protected $fieldsRequired = array('percent');
|
|
||||||
protected $fieldsSize = array();
|
|
||||||
protected $fieldsValidate = array();
|
|
||||||
protected $fieldsRequiredLang = array('name');
|
|
||||||
protected $fieldsSizeLang = array('name' => 20);
|
|
||||||
protected $fieldsValidateLang = array('name' => 'isString');
|
|
||||||
|
|
||||||
public static $definition = array(
|
public static $definition = array(
|
||||||
'table' => 'risk',
|
'table' => 'risk',
|
||||||
'primary' => 'id_risk',
|
'primary' => 'id_risk',
|
||||||
'multilang' => true,
|
'multilang' => true,
|
||||||
|
'fields' => array(
|
||||||
|
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isString', 'required' => true, 'size' => 20),
|
||||||
|
'color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 32),
|
||||||
|
'percent' => array('type' => self::TYPE_INT, 'validate' => 'isPercentage')
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
@@ -65,9 +63,7 @@ class RiskCore extends ObjectModel
|
|||||||
public function getTranslationsFieldsChild()
|
public function getTranslationsFieldsChild()
|
||||||
{
|
{
|
||||||
$this->validateFieldsLang();
|
$this->validateFieldsLang();
|
||||||
return $this->getTranslationsFields(array(
|
return $this->getTranslationsFields(array('name'));
|
||||||
'name',
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getRisks($id_lang = null)
|
public static function getRisks($id_lang = null)
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ class SceneCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteImage()
|
public function deleteImage($force_delete = false)
|
||||||
{
|
{
|
||||||
// Hack to prevent the main scene image from being deleted in AdminController::uploadImage() when a thumb image is uploaded
|
// Hack to prevent the main scene image from being deleted in AdminController::uploadImage() when a thumb image is uploaded
|
||||||
if (isset($_FILES['thumb']) && (!isset($_FILES['image']) || empty($_FILES['image']['name'])))
|
if (isset($_FILES['thumb']) && (!isset($_FILES['image']) || empty($_FILES['image']['name'])))
|
||||||
|
|||||||
+2
-2
@@ -53,7 +53,7 @@ define('PREG_CLASS_SEARCH_EXCLUDE',
|
|||||||
'\x{2ce5}-\x{2cff}\x{2d6f}\x{2e00}-\x{3005}\x{3007}-\x{303b}\x{303d}-\x{303f}'.
|
'\x{2ce5}-\x{2cff}\x{2d6f}\x{2e00}-\x{3005}\x{3007}-\x{303b}\x{303d}-\x{303f}'.
|
||||||
'\x{3099}-\x{309e}\x{30a0}\x{30fb}\x{30fd}\x{30fe}\x{3190}-\x{319f}\x{31c0}-'.
|
'\x{3099}-\x{309e}\x{30a0}\x{30fb}\x{30fd}\x{30fe}\x{3190}-\x{319f}\x{31c0}-'.
|
||||||
'\x{31cf}\x{3200}-\x{33ff}\x{4dc0}-\x{4dff}\x{a015}\x{a490}-\x{a716}\x{a802}'.
|
'\x{31cf}\x{3200}-\x{33ff}\x{4dc0}-\x{4dff}\x{a015}\x{a490}-\x{a716}\x{a802}'.
|
||||||
'\x{a806}\x{a80b}\x{a823}-\x{a82b}\x{d800}-\x{f8ff}\x{fb1e}\x{fb29}\x{fd3e}'.
|
'\x{E000}-\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}'.
|
||||||
'\x{fd3f}\x{fdfc}-\x{fe6b}\x{feff}-\x{ff0f}\x{ff1a}-\x{ff20}\x{ff3b}-\x{ff40}'.
|
'\x{fd3f}\x{fdfc}-\x{fe6b}\x{feff}-\x{ff0f}\x{ff1a}-\x{ff20}\x{ff3b}-\x{ff40}'.
|
||||||
'\x{ff5b}-\x{ff65}\x{ff70}\x{ff9e}\x{ff9f}\x{ffe0}-\x{fffd}');
|
'\x{ff5b}-\x{ff65}\x{ff70}\x{ff9e}\x{ff9f}\x{ffe0}-\x{fffd}');
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ class SearchCore
|
|||||||
{
|
{
|
||||||
// Adjust the limit to get only "whole" products, in every languages (and at least one)
|
// Adjust the limit to get only "whole" products, in every languages (and at least one)
|
||||||
$max_possibilities = $total_languages * count(Shop::getShops(true));
|
$max_possibilities = $total_languages * count(Shop::getShops(true));
|
||||||
$limit = max(1, round($limit / $max_possibilities, 0, PHP_ROUND_HALF_DOWN) * $max_possibilities);
|
$limit = max(1, floor($limit / $max_possibilities) * $max_possibilities);
|
||||||
|
|
||||||
return Db::getInstance()->executeS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc,
|
SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc,
|
||||||
|
|||||||
+11
-11
@@ -199,7 +199,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
return preg_split('/;/', $priority);
|
return preg_split('/;/', $priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0, $id_cart = 0)
|
public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0, $id_cart = 0, $real_quantity = 0)
|
||||||
{
|
{
|
||||||
if (!SpecificPrice::isFeatureActive())
|
if (!SpecificPrice::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
@@ -208,7 +208,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
** The price must not change between the top and the bottom of the page
|
** The price must not change between the top and the bottom of the page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$key = ((int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.(int)$id_group.'-'.(int)$quantity.'-'.(int)$id_product_attribute.'-'.(int)$id_cart);
|
$key = ((int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.(int)$id_group.'-'.(int)$quantity.'-'.(int)$id_product_attribute.'-'.(int)$id_cart.'-'.(int)$real_quantity);
|
||||||
if (!array_key_exists($key, self::$_specificPriceCache))
|
if (!array_key_exists($key, self::$_specificPriceCache))
|
||||||
{
|
{
|
||||||
$now = date('Y-m-d H:i:s');
|
$now = date('Y-m-d H:i:s');
|
||||||
@@ -222,15 +222,15 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
AND `id_country` IN (0, '.(int)$id_country.')
|
AND `id_country` IN (0, '.(int)$id_country.')
|
||||||
AND `id_group` IN (0, '.(int)$id_group.')
|
AND `id_group` IN (0, '.(int)$id_group.')
|
||||||
AND `id_customer` IN (0, '.(int)$id_customer.')
|
AND `id_customer` IN (0, '.(int)$id_customer.')
|
||||||
AND `from_quantity` <= '.(int)$quantity.'
|
|
||||||
AND
|
AND
|
||||||
(
|
(
|
||||||
(`from` = \'0000-00-00 00:00:00\' OR \''.$now.'\' >= `from`)
|
(`from` = \'0000-00-00 00:00:00\' OR \''.$now.'\' >= `from`)
|
||||||
AND
|
AND
|
||||||
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
||||||
)
|
)
|
||||||
AND id_cart IN (0, '.(int)$id_cart.')
|
AND id_cart IN (0, '.(int)$id_cart.')'.
|
||||||
ORDER BY `id_specific_price_rule` ASC, `id_product_attribute` DESC, `from_quantity` DESC, `score` DESC');
|
(($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) ? ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')' : 'AND `from_quantity` <= '.(int)$real_quantity).'
|
||||||
|
ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC');
|
||||||
}
|
}
|
||||||
return self::$_specificPriceCache[$key];
|
return self::$_specificPriceCache[$key];
|
||||||
}
|
}
|
||||||
@@ -291,20 +291,20 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
AND
|
AND
|
||||||
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
||||||
)
|
)
|
||||||
ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `score` DESC
|
ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC
|
||||||
');
|
');
|
||||||
|
|
||||||
$targeted_prices = array();
|
$targeted_prices = array();
|
||||||
$last_quantity = null;
|
$last_quantity = array();
|
||||||
|
|
||||||
foreach ($res as $specific_price)
|
foreach ($res as $specific_price)
|
||||||
{
|
{
|
||||||
if (!isset($last_quantity))
|
if (!isset($last_quantity[(int)$specific_price['id_product_attribute']]))
|
||||||
$last_quantity = $specific_price['from_quantity'];
|
$last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
|
||||||
else if ($last_quantity == $specific_price['from_quantity'])
|
elseif ($last_quantity[(int)$specific_price['id_product_attribute']] == $specific_price['from_quantity'])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
$last_quantity = $specific_price['from_quantity'];
|
$last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
|
||||||
if ($specific_price['from_quantity'] > 1)
|
if ($specific_price['from_quantity'] > 1)
|
||||||
$targeted_prices[] = $specific_price;
|
$targeted_prices[] = $specific_price;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,15 +119,18 @@ class SpecificPriceRuleCore extends ObjectModel
|
|||||||
|
|
||||||
public function apply($products = false)
|
public function apply($products = false)
|
||||||
{
|
{
|
||||||
$this->resetApplication();
|
$this->resetApplication($products);
|
||||||
$products = $this->getAffectedProducts($products);
|
$products = $this->getAffectedProducts($products);
|
||||||
foreach ($products as $product)
|
foreach ($products as $product)
|
||||||
SpecificPriceRule::applyRuleToProduct((int)$this->id, (int)$product['id_product'], (int)$product['id_product_attribute']);
|
SpecificPriceRule::applyRuleToProduct((int)$this->id, (int)$product['id_product'], (int)$product['id_product_attribute']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resetApplication()
|
public function resetApplication($products = false)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'specific_price WHERE id_specific_price_rule='.(int)$this->id);
|
$where = '';
|
||||||
|
if ($products && count($products))
|
||||||
|
$where .= ' AND id_product IN ('.implode(', ', array_map('intval', $products)).')';
|
||||||
|
return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'specific_price WHERE id_specific_price_rule='.(int)$this->id.$where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function applyAllRules($products = false)
|
public static function applyAllRules($products = false)
|
||||||
@@ -178,6 +181,7 @@ class SpecificPriceRuleCore extends ObjectModel
|
|||||||
$attributes = false;
|
$attributes = false;
|
||||||
$categories = false;
|
$categories = false;
|
||||||
$features = false;
|
$features = false;
|
||||||
|
$suppliers = false;
|
||||||
$where = false;
|
$where = false;
|
||||||
|
|
||||||
if ($conditions_group)
|
if ($conditions_group)
|
||||||
@@ -185,32 +189,53 @@ class SpecificPriceRuleCore extends ObjectModel
|
|||||||
$where = '(';
|
$where = '(';
|
||||||
foreach ($conditions_group as $id_condition_group => $condition_group)
|
foreach ($conditions_group as $id_condition_group => $condition_group)
|
||||||
{
|
{
|
||||||
|
$fields = array(
|
||||||
|
'category' => array(
|
||||||
|
'name' => 'cp.id_category',
|
||||||
|
'values' => array()
|
||||||
|
),
|
||||||
|
'manufacturer' => array(
|
||||||
|
'name' => 'p.id_manufacturer',
|
||||||
|
'values' => array(),
|
||||||
|
),
|
||||||
|
'supplier' => array(
|
||||||
|
'name' => 'pss.id_supplier',
|
||||||
|
'values' => array()
|
||||||
|
),
|
||||||
|
'feature' => array(
|
||||||
|
'name' => 'fp.id_feature_value',
|
||||||
|
'values' => array()
|
||||||
|
),
|
||||||
|
'attribute' => array(
|
||||||
|
'name'=> 'pac.id_attribute',
|
||||||
|
'values' => array()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($condition_group as $condition)
|
foreach ($condition_group as $condition)
|
||||||
{
|
{
|
||||||
$field = false;
|
|
||||||
if ($condition['type'] == 'category')
|
if ($condition['type'] == 'category')
|
||||||
{
|
|
||||||
$field = 'cp.id_category';
|
|
||||||
$categories = true;
|
$categories = true;
|
||||||
}
|
|
||||||
elseif ($condition['type'] == 'manufacturer')
|
|
||||||
$field = 'p.id_manufacturer';
|
|
||||||
elseif ($condition['type'] == 'supplier')
|
|
||||||
$field = 'p.id_supplier';
|
|
||||||
elseif ($condition['type'] == 'feature')
|
elseif ($condition['type'] == 'feature')
|
||||||
{
|
|
||||||
$field = 'fp.id_feature_value';
|
|
||||||
$features = true;
|
$features = true;
|
||||||
}
|
|
||||||
elseif ($condition['type'] == 'attribute')
|
elseif ($condition['type'] == 'attribute')
|
||||||
{
|
|
||||||
$field = 'pac.id_attribute';
|
|
||||||
$attributes = true;
|
$attributes = true;
|
||||||
}
|
elseif ($condition['type'] == 'supplier')
|
||||||
if ($field)
|
$suppliers = true;
|
||||||
$where .= $field.'='.(int)$condition['value'].' AND ';
|
|
||||||
|
$fields[$condition['type']]['values'][] = $condition['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($fields as $field)
|
||||||
|
{
|
||||||
|
if (!$n_conditions = count($field['values']))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$where .= $field['name'].' IN ('.implode(',', array_map('intval', $field['values'])).') AND ';
|
||||||
|
if ($n_conditions > 1)
|
||||||
|
$query->having('COUNT('.bqSQL($field['name']).') >='.(int)$n_conditions);
|
||||||
|
}
|
||||||
|
|
||||||
$where = rtrim($where, ' AND ').') OR (';
|
$where = rtrim($where, ' AND ').') OR (';
|
||||||
}
|
}
|
||||||
$where = rtrim($where, 'OR (');
|
$where = rtrim($where, 'OR (');
|
||||||
@@ -230,9 +255,13 @@ class SpecificPriceRuleCore extends ObjectModel
|
|||||||
$query->select('NULL as id_product_attribute');
|
$query->select('NULL as id_product_attribute');
|
||||||
|
|
||||||
if ($features)
|
if ($features)
|
||||||
$query->leftJoin('feature_product', 'fp', 'p.id_product = fp.id_product');
|
$query->leftJoin('feature_product', 'fp', 'p.id_product = fp.id_product');
|
||||||
if ($categories)
|
if ($categories)
|
||||||
$query->leftJoin('category_product', 'cp', 'p.id_product = cp.id_product');
|
$query->leftJoin('category_product', 'cp', 'p.id_product = cp.id_product');
|
||||||
|
|
||||||
|
if ($suppliers)
|
||||||
|
$query->leftJoin('product_supplier', 'pss', 'p.id_product = pss.id_product');
|
||||||
|
|
||||||
if ($where)
|
if ($where)
|
||||||
$query->where($where);
|
$query->where($where);
|
||||||
|
|
||||||
|
|||||||
@@ -355,7 +355,10 @@ class SupplierCore extends ObjectModel
|
|||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if (parent::delete())
|
if (parent::delete())
|
||||||
|
{
|
||||||
|
CartRule::cleanProductRuleIntegrity('suppliers', $this->id);
|
||||||
return $this->deleteImage();
|
return $this->deleteImage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ class TabCore extends ObjectModel
|
|||||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
|
|
||||||
// Lang fields
|
// Lang fields
|
||||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 32),
|
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'required' => true, 'validate' => 'isGenericName', 'size' => 32),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -92,13 +92,13 @@ class TagCore extends ObjectModel
|
|||||||
* @param string|array $tag_list List of tags, as array or as a string with comas
|
* @param string|array $tag_list List of tags, as array or as a string with comas
|
||||||
* @return boolean Operation success
|
* @return boolean Operation success
|
||||||
*/
|
*/
|
||||||
public static function addTags($id_lang, $id_product, $tag_list)
|
public static function addTags($id_lang, $id_product, $tag_list, $separator = ',')
|
||||||
{
|
{
|
||||||
if (!Validate::isUnsignedId($id_lang))
|
if (!Validate::isUnsignedId($id_lang))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!is_array($tag_list))
|
if (!is_array($tag_list))
|
||||||
$tag_list = array_unique(array_map('trim', preg_split('/,/', $tag_list, null, PREG_SPLIT_NO_EMPTY)));
|
$tag_list = array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, null, PREG_SPLIT_NO_EMPTY)));
|
||||||
|
|
||||||
$list = array();
|
$list = array();
|
||||||
foreach ($tag_list as $tag)
|
foreach ($tag_list as $tag)
|
||||||
@@ -200,7 +200,8 @@ class TagCore extends ObjectModel
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$result &= Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'product_tag (id_product, id_tag) VALUES '.implode(',', $ids));
|
$result &= Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'product_tag (id_product, id_tag) VALUES '.implode(',', $ids));
|
||||||
$result &= Search::indexation(false);
|
if (Configuration::get('PS_SEARCH_INDEXATION'))
|
||||||
|
$result &= Search::indexation(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user