Compare commits
808 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3782524898 | ||
|
|
302f7e7602 | ||
|
|
e8f0c50c21 | ||
|
|
fcce4d7bd1 | ||
|
|
0cd84c0f13 | ||
|
|
04caa74ac3 | ||
|
|
a75fece648 | ||
|
|
1c9e9e8f3f | ||
|
|
2e3b2cd56d | ||
|
|
4a8e705efa | ||
|
|
338573856b | ||
|
|
4302ad7590 | ||
|
|
3ffb0466a5 | ||
|
|
beb8206250 | ||
|
|
294af01eff | ||
|
|
4863e60cc3 | ||
|
|
6c98ff9ea8 | ||
|
|
8c613d773b | ||
|
|
2c160eb1b2 | ||
|
|
2c2b0fae9d | ||
|
|
50206f1bef | ||
|
|
1b2d7faafb | ||
|
|
55a1ad4b5e | ||
|
|
f90f8011b8 | ||
|
|
6f3196b45a | ||
|
|
672d19f22a | ||
|
|
b10a41105f | ||
|
|
49111f2d61 | ||
|
|
1129b89530 | ||
|
|
bd3524c2d5 | ||
|
|
fdfd718a5c | ||
|
|
1b22cb4b23 | ||
|
|
479461589b | ||
|
|
cd58ef1c8d | ||
|
|
fddeff7e4a | ||
|
|
17e546a3e7 | ||
|
|
64a83b9a55 | ||
|
|
d3adbb1ba4 | ||
|
|
fe7e7df605 | ||
|
|
02b2308819 | ||
|
|
266befeea5 | ||
|
|
35803ef67c | ||
|
|
58da54df23 | ||
|
|
cb5c0a088c | ||
|
|
ec021a44c3 | ||
|
|
c4b6d33b44 | ||
|
|
913160ee5f | ||
|
|
432e0122ed | ||
|
|
c0864ccedb | ||
|
|
5d2dde451a | ||
|
|
6f8368dba0 | ||
|
|
17efe5e27a | ||
|
|
9bce983280 | ||
|
|
c0bdebf11a | ||
|
|
88222d9300 | ||
|
|
01371b1dcf | ||
|
|
05d6d1801a | ||
|
|
d2626246ff | ||
|
|
721a20badd | ||
|
|
fe70700b4a | ||
|
|
6e74fd59d1 | ||
|
|
10d3b0d127 | ||
|
|
e7726cddd7 | ||
|
|
d132549d32 | ||
|
|
e7fb5ec6a4 | ||
|
|
43acfc04a4 | ||
|
|
b68412e3a1 | ||
|
|
5b554435cf | ||
|
|
71eda6c6f3 | ||
|
|
2084089d1a | ||
|
|
34b062074b | ||
|
|
7b4e94603a | ||
|
|
980cbdc6de | ||
|
|
1ae4edb9cd | ||
|
|
976ffc3455 | ||
|
|
00cb52c6f9 | ||
|
|
f3ab4f18ea | ||
|
|
d57ceb7cf4 | ||
|
|
f54d895f78 | ||
|
|
ac67819ed7 | ||
|
|
c513e21a96 | ||
|
|
ca3d9ee5ae | ||
|
|
019ece549a | ||
|
|
9fd5aca4dc | ||
|
|
a5469504cb | ||
|
|
0535b473ed | ||
|
|
a589d527a9 | ||
|
|
496a6ef4ee | ||
|
|
187b6c0781 | ||
|
|
d0666a7f53 | ||
|
|
d5eabdaee8 | ||
|
|
f81cc6e774 | ||
|
|
433382fa7c | ||
|
|
c1dc2befd6 | ||
|
|
4f6de85447 | ||
|
|
57c92993e3 | ||
|
|
afd0953f87 | ||
|
|
af7e12efae | ||
|
|
145d34a291 | ||
|
|
1d17f750a9 | ||
|
|
35ba4e2bff | ||
|
|
ba565f2add | ||
|
|
3ad3b6ea50 | ||
|
|
28d9b3cb2b | ||
|
|
1096d7dc44 | ||
|
|
b7fec2c3e5 | ||
|
|
99decb70f1 | ||
|
|
c77a8fef96 | ||
|
|
ab59c5b8bb | ||
|
|
0b9d667516 | ||
|
|
05654f808c | ||
|
|
395054d5f9 | ||
|
|
71cd43a264 | ||
|
|
fab4f5aa65 | ||
|
|
62097b8774 | ||
|
|
4b82c44dbe | ||
|
|
8367d3f958 | ||
|
|
b565a755c7 | ||
|
|
22042415fd | ||
|
|
0584d6113e | ||
|
|
07795223e5 | ||
|
|
866175603e | ||
|
|
bdf3c0bc9d | ||
|
|
1589264ecc | ||
|
|
7f2b320a3a | ||
|
|
26b1d30ef6 | ||
|
|
733a99e781 | ||
|
|
b7a507464a | ||
|
|
f20c5595d9 | ||
|
|
d67656c6c0 | ||
|
|
cf56010e90 | ||
|
|
698e1615f6 | ||
|
|
73733c76e1 | ||
|
|
9ad0b29da0 | ||
|
|
1e8536b6b3 | ||
|
|
03877da7f5 | ||
|
|
17493845c9 | ||
|
|
6f44dc6de7 | ||
|
|
4cce8e929c | ||
|
|
6e0a43f08e | ||
|
|
611f01f340 | ||
|
|
06d251156f | ||
|
|
dfa8f7bf01 | ||
|
|
f9e44fadfa | ||
|
|
fdf7bf6aeb | ||
|
|
f5bad733a5 | ||
|
|
68fad06745 | ||
|
|
72d32a7242 | ||
|
|
b1cf1031cc | ||
|
|
a91e7c4264 | ||
|
|
63ae5ba573 | ||
|
|
0ceb3ab448 | ||
|
|
15558c17c5 | ||
|
|
f07e112111 | ||
|
|
a0b97331eb | ||
|
|
9b64fecd0d | ||
|
|
9142792d30 | ||
|
|
8af50066a7 | ||
|
|
b2d29d5eaf | ||
|
|
a403dbf037 | ||
|
|
2805d8d37c | ||
|
|
76a455a216 | ||
|
|
306d13b8e3 | ||
|
|
8931c02d25 | ||
|
|
ceabc1d32e | ||
|
|
bb2b784888 | ||
|
|
accd95d3b4 | ||
|
|
82ab941146 | ||
|
|
88b3a4938d | ||
|
|
43ca5b7bf9 | ||
|
|
6aeb574863 | ||
|
|
e9c0150146 | ||
|
|
1b1acba4cd | ||
|
|
40c1b55ca8 | ||
|
|
14ccde1851 | ||
|
|
dc98b821b5 | ||
|
|
b39567ee48 | ||
|
|
0655ce189e | ||
|
|
1372eb778d | ||
|
|
f13a64351c | ||
|
|
8657b584c5 | ||
|
|
0050c43675 | ||
|
|
5a57d5851c | ||
|
|
17058c36db | ||
|
|
1a216c325d | ||
|
|
f272612eef | ||
|
|
3fae760e85 | ||
|
|
f2985f1368 | ||
|
|
c15f0f19fa | ||
|
|
fb8e8fd23a | ||
|
|
3f8239fb91 | ||
|
|
7bc8fea54b | ||
|
|
f18621b2ee | ||
|
|
eaab471e9a | ||
|
|
248ec3fbbe | ||
|
|
53c5aa7174 | ||
|
|
1b4a2e0504 | ||
|
|
1dbbcbebab | ||
|
|
3048f027e6 | ||
|
|
0521a14a3d | ||
|
|
321fa7ee3b | ||
|
|
f2caec512c | ||
|
|
43cd696220 | ||
|
|
1701efab16 | ||
|
|
3179bdf40d | ||
|
|
e46bb5c6f4 | ||
|
|
e637297bae | ||
|
|
9df166fce6 | ||
|
|
61036a1c61 | ||
|
|
b5cdfacd86 | ||
|
|
7cac3a1f93 | ||
|
|
2b7e79c180 | ||
|
|
f81effcbdc | ||
|
|
9c57a8e3e2 | ||
|
|
48117b955c | ||
|
|
d9d75d4545 | ||
|
|
459a98c1bb | ||
|
|
e9c73cde80 | ||
|
|
e58e5141bf | ||
|
|
568df5c40f | ||
|
|
471aa8d194 | ||
|
|
3a13f5c434 | ||
|
|
9abea64e99 | ||
|
|
66c63059ea | ||
|
|
69b56e5f79 | ||
|
|
80a5d1db3d | ||
|
|
40093d3884 | ||
|
|
80430ae546 | ||
|
|
b85170f6de | ||
|
|
6d5e3c7c77 | ||
|
|
b8554dcdd4 | ||
|
|
d0a8c4e5b6 | ||
|
|
701462b7e5 | ||
|
|
045d814a8a | ||
|
|
b1ea5b3e7b | ||
|
|
f4671e17c1 | ||
|
|
3fa187937b | ||
|
|
4ec2c49dbc | ||
|
|
8b210e65d4 | ||
|
|
f1156969c0 | ||
|
|
b3d63dba77 | ||
|
|
20af1a97f6 | ||
|
|
247aaada6f | ||
|
|
95c4a3c8d3 | ||
|
|
969a94c261 | ||
|
|
df275195ab | ||
|
|
14faf9d7ac | ||
|
|
c944660ba8 | ||
|
|
3f1cb8d093 | ||
|
|
352a1f636c | ||
|
|
3b087d4912 | ||
|
|
74cf4b5bfc | ||
|
|
292928844c | ||
|
|
fd1a15d66f | ||
|
|
52263fa26b | ||
|
|
bacf91bf65 | ||
|
|
7906a39f9c | ||
|
|
972fbc2312 | ||
|
|
a92bb97253 | ||
|
|
209e1821ea | ||
|
|
ae7812475e | ||
|
|
c526b1a06c | ||
|
|
daebd54bda | ||
|
|
47ca6c46eb | ||
|
|
a5c3d88a8e | ||
|
|
a48e8cf111 | ||
|
|
dcf067d890 | ||
|
|
b4aba5e8f3 | ||
|
|
9686562d85 | ||
|
|
c847c68f49 | ||
|
|
4dac4d9609 | ||
|
|
2897c024ce | ||
|
|
2869859748 | ||
|
|
acbe68472e | ||
|
|
89af761924 | ||
|
|
ae34979845 | ||
|
|
702b93aa25 | ||
|
|
f7ac3955e1 | ||
|
|
c5c2d7e142 | ||
|
|
a18bc569aa | ||
|
|
d8f2bdf3c6 | ||
|
|
1885de9848 | ||
|
|
f31d338de7 | ||
|
|
6ee30e3bdb | ||
|
|
b81425534e | ||
|
|
ea1ad666f7 | ||
|
|
88a80b624b | ||
|
|
22bc313e76 | ||
|
|
060ed4cce1 | ||
|
|
a5b4596cd7 | ||
|
|
486866d6f0 | ||
|
|
181f9fd1b8 | ||
|
|
e96687636d | ||
|
|
e8cef6aea0 | ||
|
|
7ab7950ffc | ||
|
|
3451d9d010 | ||
|
|
f35027b4fd | ||
|
|
5a923f6605 | ||
|
|
0f2b942358 | ||
|
|
67f5137a63 | ||
|
|
d13e3c329a | ||
|
|
6926e5b326 | ||
|
|
7b90890cba | ||
|
|
359fdc09f0 | ||
|
|
8614ca6ed1 | ||
|
|
6c1be047c3 | ||
|
|
c2984b884f | ||
|
|
ca8bab9dda | ||
|
|
e689af81e6 | ||
|
|
f2e5eaaabd | ||
|
|
c686552b2a | ||
|
|
94458cb01d | ||
|
|
6b1f0fb41a | ||
|
|
95d63aa30e | ||
|
|
1ad7acd1a3 | ||
|
|
938f7dc0a6 | ||
|
|
6cb0f0a000 | ||
|
|
792f2bb283 | ||
|
|
77e04afcec | ||
|
|
4a1fd5e336 | ||
|
|
93d1065bcc | ||
|
|
25dda0156d | ||
|
|
77bea290f1 | ||
|
|
b36247f993 | ||
|
|
293245e89c | ||
|
|
51111037f8 | ||
|
|
6d779139cd | ||
|
|
273c5d55eb | ||
|
|
2aa07e24c7 | ||
|
|
aea254b1e3 | ||
|
|
96c679c9b4 | ||
|
|
6086fac366 | ||
|
|
50facdfb8a | ||
|
|
b836ab1f7f | ||
|
|
9e87b07624 | ||
|
|
a5f0a11124 | ||
|
|
484f091375 | ||
|
|
3fdb3f9e22 | ||
|
|
c68b1ad548 | ||
|
|
d13be9e69e | ||
|
|
d59308a9b6 | ||
|
|
b1cc259996 | ||
|
|
4c6276f1cd | ||
|
|
1c1cdab498 | ||
|
|
6897a92982 | ||
|
|
fc7cfa168f | ||
|
|
464ab13391 | ||
|
|
7fa825e949 | ||
|
|
c019aebfbc | ||
|
|
9cf8b5a538 | ||
|
|
e45d86f048 | ||
|
|
84341c7505 | ||
|
|
1baf154332 | ||
|
|
c190a832b3 | ||
|
|
613196299c | ||
|
|
c77fddce5d | ||
|
|
ba5538a12e | ||
|
|
688b119176 | ||
|
|
8bc6952c47 | ||
|
|
e934791af3 | ||
|
|
c0ab78d4ff | ||
|
|
38bf33f873 | ||
|
|
ad7b4f5bf9 | ||
|
|
9b66df95e2 | ||
|
|
a4be207ff6 | ||
|
|
df471fbf55 | ||
|
|
8a530b309e | ||
|
|
08e8b1e00d | ||
|
|
c05e737f69 | ||
|
|
fe7a125a48 | ||
|
|
714bb25193 | ||
|
|
09cb96dab6 | ||
|
|
184c9d352e | ||
|
|
a69aa9fd3c | ||
|
|
a6c04366bc | ||
|
|
d2c57a03c3 | ||
|
|
fbb6a871ad | ||
|
|
5bc2b64eed | ||
|
|
31aa435bb7 | ||
|
|
cd680b497e | ||
|
|
a6fbbe852f | ||
|
|
bd4398bff5 | ||
|
|
6d921b6ea0 | ||
|
|
450768f50b | ||
|
|
fe741245fe | ||
|
|
4389e58c29 | ||
|
|
0fc758e481 | ||
|
|
d5fc9e6527 | ||
|
|
c43b7d7818 | ||
|
|
ed3ef17b00 | ||
|
|
8111cbb53c | ||
|
|
bb09a64ed6 | ||
|
|
898cd02628 | ||
|
|
17812bb7d4 | ||
|
|
25c9cbdf6e | ||
|
|
a0bf4a30b9 | ||
|
|
148b210e15 | ||
|
|
30c03547fa | ||
|
|
c23a05f132 | ||
|
|
656f34b0d1 | ||
|
|
77cfdc5094 | ||
|
|
042fd1611d | ||
|
|
6333b5c0d0 | ||
|
|
1abde37668 | ||
|
|
44d49911a9 | ||
|
|
ed881352d0 | ||
|
|
6204d24fef | ||
|
|
5322607a96 | ||
|
|
aea7340012 | ||
|
|
40e069c117 | ||
|
|
4f5785f307 | ||
|
|
5c6f98a696 | ||
|
|
d7613e2e76 | ||
|
|
8c27a470c6 | ||
|
|
d4d25c5d81 | ||
|
|
5fcb00ed3a | ||
|
|
6cf6e1cf60 | ||
|
|
1609d719ab | ||
|
|
0ab658eecd | ||
|
|
4b43213169 | ||
|
|
5bb54071f9 | ||
|
|
af9ac2ff4d | ||
|
|
213d720a33 | ||
|
|
2ed9af044e | ||
|
|
dc8164b1d8 | ||
|
|
6f848e87ea | ||
|
|
4cef2421bd | ||
|
|
d9de1869da | ||
|
|
37a2bc6ebf | ||
|
|
07d2d348dc | ||
|
|
265afeefca | ||
|
|
96104ecbf5 | ||
|
|
ee08617823 | ||
|
|
60cbdb8f4f | ||
|
|
03556e9432 | ||
|
|
e55e96950b | ||
|
|
7515e9e6cc | ||
|
|
2d25e03545 | ||
|
|
98615296ca | ||
|
|
6494b47f05 | ||
|
|
972d70011d | ||
|
|
32e6484105 | ||
|
|
f290c3a25c | ||
|
|
fd12b63428 | ||
|
|
d23d99ccb8 | ||
|
|
2ca41bd6cd | ||
|
|
0da2fa8dcd | ||
|
|
9a1341ed0d | ||
|
|
a05a619670 | ||
|
|
d425ee9563 | ||
|
|
b3c42487b5 | ||
|
|
d30e37174b | ||
|
|
6d3280828f | ||
|
|
2ed0a00ef0 | ||
|
|
a0203b82b1 | ||
|
|
8bc079d756 | ||
|
|
2948916fc4 | ||
|
|
dddf29ebc2 | ||
|
|
b23654f10d | ||
|
|
d0b5e395f3 | ||
|
|
eed6ff4b5a | ||
|
|
3f705d2434 | ||
|
|
7aadfacf10 | ||
|
|
33e81f46d5 | ||
|
|
0f6dd838c0 | ||
|
|
4f35fa4c1a | ||
|
|
345a0752aa | ||
|
|
9bc69fedb0 | ||
|
|
af6513bb2a | ||
|
|
d1a5803e74 | ||
|
|
ca6337f31a | ||
|
|
bc39b930b0 | ||
|
|
79aa52f4a2 | ||
|
|
68d9b26721 | ||
|
|
c4442a9eef | ||
|
|
7abd718eda | ||
|
|
9be7d9b0f9 | ||
|
|
85f9330df2 | ||
|
|
161863abe9 | ||
|
|
b8b794e9ca | ||
|
|
cb844cdaca | ||
|
|
bc4b3dac15 | ||
|
|
76e5b93a45 | ||
|
|
7cd6898585 | ||
|
|
2e9ca44e22 | ||
|
|
4c4984f182 | ||
|
|
ad38878a8b | ||
|
|
fc41a01686 | ||
|
|
765a144478 | ||
|
|
c8ec4882c6 | ||
|
|
f35893a330 | ||
|
|
e6112c4290 | ||
|
|
eb89723851 | ||
|
|
9b8da8655f | ||
|
|
92366eb6f9 | ||
|
|
9f2aeec5d1 | ||
|
|
ab6e72b359 | ||
|
|
c87916d793 | ||
|
|
357368c78c | ||
|
|
302f0abe9d | ||
|
|
b9dbf36e34 | ||
|
|
d4bbdd7207 | ||
|
|
792f3bb601 | ||
|
|
b82e02125b | ||
|
|
f4b42a63a9 | ||
|
|
dbd39f3a5b | ||
|
|
0bae768129 | ||
|
|
96a4370bc3 | ||
|
|
103a83d6ea | ||
|
|
d1dc4d6acd | ||
|
|
353580a558 | ||
|
|
2da2e00d6f | ||
|
|
a6a9ffe39a | ||
|
|
078a9767e3 | ||
|
|
48cae79ca0 | ||
|
|
f24f940e2e | ||
|
|
db0f0888cc | ||
|
|
5bccd3fdae | ||
|
|
42a1b6d5c4 | ||
|
|
3d7a80671a | ||
|
|
650c0105b7 | ||
|
|
3269a37da6 | ||
|
|
f879b2e9b4 | ||
|
|
9315b2a7ca | ||
|
|
940fe0857d | ||
|
|
41daac1092 | ||
|
|
5934747ae0 | ||
|
|
7648ec01aa | ||
|
|
56e60c2964 | ||
|
|
27014976fa | ||
|
|
e5b0d70057 | ||
|
|
12a93524bb | ||
|
|
5a56ca9c8b | ||
|
|
4e060b9bbd | ||
|
|
3b929f100c | ||
|
|
4559e93222 | ||
|
|
d3ae8702a4 | ||
|
|
34f6d4d8db | ||
|
|
ce3e4c4d91 | ||
|
|
69cec80e2d | ||
|
|
26d31d53c4 | ||
|
|
2ffab71fc2 | ||
|
|
8b77d82ca9 | ||
|
|
4caf11a1af | ||
|
|
1f033138cd | ||
|
|
6fbaafca4c | ||
|
|
146abf31de | ||
|
|
178f977814 | ||
|
|
c4afd303f7 | ||
|
|
89d0a35643 | ||
|
|
784865bf4d | ||
|
|
91d66ffb53 | ||
|
|
693096d497 | ||
|
|
be3801174b | ||
|
|
554e2f240a | ||
|
|
324c0a556d | ||
|
|
be85673853 | ||
|
|
875d98bca5 | ||
|
|
82bc3f0916 | ||
|
|
db513d6770 | ||
|
|
196bea5553 | ||
|
|
292266ed40 | ||
|
|
8cfd8b0cc6 | ||
|
|
9ced871cb5 | ||
|
|
9cae65593b | ||
|
|
1b64465a67 | ||
|
|
ce8517413d | ||
|
|
cc1e75637d | ||
|
|
a9b20ea99b | ||
|
|
af6cf4ba34 | ||
|
|
cf51d8372e | ||
|
|
53937e3cd0 | ||
|
|
9b6642a038 | ||
|
|
37c3fc05c7 | ||
|
|
dbf3e5947c | ||
|
|
267a408cdf | ||
|
|
996db45b8b | ||
|
|
9ac039d5f5 | ||
|
|
ec464f577e | ||
|
|
3054f8ead1 | ||
|
|
579c75edab | ||
|
|
120dad2619 | ||
|
|
0b69d51315 | ||
|
|
bda8d65d95 | ||
|
|
05edba121a | ||
|
|
268518b827 | ||
|
|
8c883798b5 | ||
|
|
82c4d22b71 | ||
|
|
d34be78f9f | ||
|
|
fe164465c2 | ||
|
|
5cbfabb82f | ||
|
|
bf76ea0315 | ||
|
|
c8a3a63d49 | ||
|
|
da841a720b | ||
|
|
5d71df9a7d | ||
|
|
6fed7f3683 | ||
|
|
07836fb3a0 | ||
|
|
cc4b3125a9 | ||
|
|
96855cd5a2 | ||
|
|
eda2ae82f8 | ||
|
|
85f8e3db2f | ||
|
|
caccf77b10 | ||
|
|
1329c12383 | ||
|
|
c1b0ad7a93 | ||
|
|
893dd895e9 | ||
|
|
60323ad2e9 | ||
|
|
95cd7e50e7 | ||
|
|
da15ef9a17 | ||
|
|
de9201d30d | ||
|
|
685ddc4eba | ||
|
|
1778c4e75c | ||
|
|
2296ab35cd | ||
|
|
4a6132d0c4 | ||
|
|
f80cf204ab | ||
|
|
a203e94ce8 | ||
|
|
39dbafc042 | ||
|
|
eeeaaa8e08 | ||
|
|
ef8f8582d0 | ||
|
|
0920ce9e80 | ||
|
|
bb649ae062 | ||
|
|
7a0821fc10 | ||
|
|
cb33d75eaa | ||
|
|
25e6aa0590 | ||
|
|
8b761fa766 | ||
|
|
88ed4999ba | ||
|
|
a8fd55fa4b | ||
|
|
10a644578b | ||
|
|
2c504d45bc | ||
|
|
5c4e749522 | ||
|
|
5cee198eb5 | ||
|
|
06c0e7fcef | ||
|
|
17e71862ac | ||
|
|
5e8ca44e86 | ||
|
|
f85427e8cc | ||
|
|
a57aabec11 | ||
|
|
bc5a853b3c | ||
|
|
40301f8d6b | ||
|
|
f5b703e65e | ||
|
|
a2b2540b1b | ||
|
|
15cac106e8 | ||
|
|
b032f35bae | ||
|
|
05b35a13ba | ||
|
|
66e42ea71a | ||
|
|
a1e8eccb95 | ||
|
|
c781df84f5 | ||
|
|
4cabe99f19 | ||
|
|
ef4a9f83ba | ||
|
|
bd67a69c13 | ||
|
|
0330483fc5 | ||
|
|
8ef26dfbf6 | ||
|
|
21e32ce611 | ||
|
|
efe90062c9 | ||
|
|
33a7743691 | ||
|
|
d3c705ab91 | ||
|
|
f438395033 | ||
|
|
421ad89e45 | ||
|
|
f9a0664810 | ||
|
|
0489bf4945 | ||
|
|
4e4576ec97 | ||
|
|
adebadfbc8 | ||
|
|
afe750bb38 | ||
|
|
4f9189b8c6 | ||
|
|
ac29a13664 | ||
|
|
5534f2b30f | ||
|
|
6cdc8aa6da | ||
|
|
01a92dd2dd | ||
|
|
b11bc0e2b9 | ||
|
|
02c6b751dd | ||
|
|
b840032589 | ||
|
|
8f7543bd47 | ||
|
|
117ab13cac | ||
|
|
221fcde595 | ||
|
|
8911b22129 | ||
|
|
9ab66d1e47 | ||
|
|
e89c91369a | ||
|
|
7207d46fbe | ||
|
|
9c5fa67d60 | ||
|
|
7e8847ff97 | ||
|
|
03124ab1ef | ||
|
|
a524d05be1 | ||
|
|
e9854a8a0e | ||
|
|
88da6433b6 | ||
|
|
e25a53352b | ||
|
|
683a0c3bf3 | ||
|
|
b661125ebf | ||
|
|
68ebd15045 | ||
|
|
1e84944e64 | ||
|
|
b9ab4849d6 | ||
|
|
710d1f1275 | ||
|
|
5a3a7d238c | ||
|
|
d9afd88155 | ||
|
|
e353808db3 | ||
|
|
6277b71d20 | ||
|
|
18d4e2ec46 | ||
|
|
85683fd9f0 | ||
|
|
ebd0c527ea | ||
|
|
224c24a2fd | ||
|
|
8ea01ea0d4 | ||
|
|
e9863b0675 | ||
|
|
25cd7f07f8 | ||
|
|
b4a4edc58e | ||
|
|
53fefc8564 | ||
|
|
cccf6974d7 | ||
|
|
5099be5d19 | ||
|
|
66b217dddb | ||
|
|
81196865b9 | ||
|
|
0c669115c9 | ||
|
|
e7bb178aa0 | ||
|
|
631030d398 | ||
|
|
5b02eb8bc2 | ||
|
|
78449538bb | ||
|
|
83ac1683e0 | ||
|
|
4ab7d66963 | ||
|
|
37e26eca29 | ||
|
|
f740bf2632 | ||
|
|
66f454db3d | ||
|
|
c512507298 | ||
|
|
ed1f586643 | ||
|
|
00f922254a | ||
|
|
2e78d28ec6 | ||
|
|
ba3a4325bb | ||
|
|
ec8b982671 | ||
|
|
ae9f0b46c7 | ||
|
|
70912a0237 | ||
|
|
00a5b44f63 | ||
|
|
3d2a10f295 | ||
|
|
3f8a46a984 | ||
|
|
2ce4285d7a | ||
|
|
f09026be73 | ||
|
|
92c22de458 | ||
|
|
345fb9e7bf | ||
|
|
94555d9fa5 | ||
|
|
e0a7aeab6b | ||
|
|
d76b060d2a | ||
|
|
c9ee83cc46 | ||
|
|
eb1609d270 | ||
|
|
b2cd94475c | ||
|
|
15f21f853b | ||
|
|
848153a05f | ||
|
|
99aab49ae3 | ||
|
|
5543a4f795 | ||
|
|
de4ad1d4b7 | ||
|
|
4959263cfe | ||
|
|
e6d67bdbb6 | ||
|
|
f455965bea | ||
|
|
42ed7b598d | ||
|
|
4963d29389 | ||
|
|
57584f5efa | ||
|
|
79fda741cd | ||
|
|
e60df09495 | ||
|
|
96040e1cb5 | ||
|
|
e930b9b8ed | ||
|
|
69384f57f1 | ||
|
|
7bed77fec3 | ||
|
|
10296817c9 | ||
|
|
c121c6d616 | ||
|
|
730a905cfb | ||
|
|
804e6c3177 | ||
|
|
ccf4344a2d | ||
|
|
90ce1a292d | ||
|
|
80ca466e13 | ||
|
|
12a842837b | ||
|
|
04e576623f | ||
|
|
070fb96dc4 | ||
|
|
4cdacec76a | ||
|
|
d5337f4f44 | ||
|
|
35dcc6370c | ||
|
|
be43898e5a | ||
|
|
28c8e30784 | ||
|
|
902d753628 | ||
|
|
00045a755b | ||
|
|
7ac72c91bd | ||
|
|
a09ed72ec0 | ||
|
|
83d14fae1d | ||
|
|
5b4edc3a28 | ||
|
|
9665f40bc7 | ||
|
|
7b4de2882c | ||
|
|
bf0542beb4 | ||
|
|
5b478b2134 | ||
|
|
608ab040b8 | ||
|
|
39c2a58307 | ||
|
|
2400fc08ea | ||
|
|
9939577f01 | ||
|
|
4f99dfd2d6 | ||
|
|
04e3f3f6f5 | ||
|
|
8157f836a3 | ||
|
|
1f1a6ff898 | ||
|
|
05268a42d4 | ||
|
|
9b3961238c | ||
|
|
fd5894d680 | ||
|
|
e25bf37349 | ||
|
|
8479ef58ee | ||
|
|
f74b6c667c | ||
|
|
c053d6332b | ||
|
|
acaca2f327 | ||
|
|
a5d3dfed09 | ||
|
|
596de63ab5 | ||
|
|
019be0aeff | ||
|
|
c5a07b8c1a | ||
|
|
7247e325a4 | ||
|
|
14cdbef06e | ||
|
|
9a3f623393 | ||
|
|
3cee49d012 | ||
|
|
a98846bc57 | ||
|
|
8ba7ebd80b | ||
|
|
1cf5ddd038 | ||
|
|
284a9acae6 | ||
|
|
adba38898a |
@@ -79,8 +79,6 @@ if (Tools::isSubmit('getAvailableFields') AND Tools::isSubmit('entity'))
|
||||
$jsonArray = array();
|
||||
$import = new AdminImportController();
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$fields = $import->getAvailableFields(true);
|
||||
foreach ($fields AS $field)
|
||||
$jsonArray[] = '{"field":"'.addslashes($field).'"}';
|
||||
|
||||
@@ -251,14 +251,14 @@ function checkingTab($tab)
|
||||
{
|
||||
if (isset(AdminTab::$tabParenting[$tab]))
|
||||
Tools::redirectAdmin('?tab='.AdminTab::$tabParenting[$tab].'&token='.Tools::getAdminTokenLite(AdminTab::$tabParenting[$tab]));
|
||||
echo sprintf(Tools::displayError('Tab %s cannot be found.'),$tab);
|
||||
echo sprintf(Tools::displayError('Page %s cannot be found.'),$tab);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Class file is included in Dispatcher::dispatch() function
|
||||
if (!class_exists($tab, false) OR !$row['id_tab'])
|
||||
{
|
||||
echo sprintf(Tools::displayError('Tab file %s cannot be found.'),$tab);
|
||||
echo sprintf(Tools::displayError('The class %s cannot be found.'),$tab);
|
||||
return false;
|
||||
}
|
||||
$adminObj = new $tab;
|
||||
|
||||
@@ -344,7 +344,7 @@ echo '
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
echo '<div class="multishop_toolbar">
|
||||
<span class="text_multishop">'.translate('Multishop configuration for').'</span>'.
|
||||
<span class="text_multishop">'.translate('Multistore configuration for').'</span>'.
|
||||
Helper::renderShopList();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ try
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
|
||||
}
|
||||
}
|
||||
else if ($context->employee->hasAuthOnShop($split[1]))
|
||||
elseif ($context->employee->hasAuthOnShop($split[1]))
|
||||
{
|
||||
$shop_id = $split[1];
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
|
||||
|
||||
@@ -245,5 +245,5 @@ form#product, form#access_form{ background-color:#ebedf4; border:1px solid #cc
|
||||
#moduleContainer .moduleFavDesc { font-family:Georgia; font-style:italic; color:#666;}
|
||||
|
||||
/*FOOTER*/
|
||||
#footer {height:40px; font-size:12px;clear:both;font-size:0.9em;color:#666666}
|
||||
#footer {height:40px;padding-top:5px;font-size:12px;clear:both;font-size:0.9em;color:#666666}
|
||||
#footer .footer_link, #footer .footer_link:hover {color:#D41958;}
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
<table class="table float" cellspacing="0" style="margin-right:50px" id="table_{$profile.id_profile}">
|
||||
<tr>
|
||||
<th class="center">
|
||||
{l s='Tabs'}
|
||||
{l s='Menus'}
|
||||
</th>
|
||||
<th class="center">
|
||||
<input type="checkbox" name="1" id="viewall"
|
||||
@@ -254,7 +254,7 @@
|
||||
</tr>
|
||||
{if !count($tabs)}
|
||||
<tr>
|
||||
<td colspan="6">{l s='No tab'}</td>
|
||||
<td colspan="6">{l s='No menu'}</td>
|
||||
</tr>
|
||||
{else}
|
||||
{foreach $tabs AS $tab}
|
||||
|
||||
@@ -37,11 +37,9 @@
|
||||
if (!isNaN(element_price) && element_price > 0)
|
||||
{
|
||||
if (element_has_tax)
|
||||
other_element_price = parseFloat(element_price / ((product_tax / 100) + 1));
|
||||
other_element_price = parseFloat(element_price / ((product_tax / 100) + 1)).toFixed(6);
|
||||
else
|
||||
other_element_price = ps_round(parseFloat(element_price * ((product_tax / 100) + 1)), 2);
|
||||
|
||||
other_element_price = other_element_price.toFixed(2);
|
||||
other_element_price = ps_round(parseFloat(element_price * ((product_tax / 100) + 1)), 2).toFixed(2);
|
||||
}
|
||||
|
||||
$('#related_to_'+element.attr('name')).val(other_element_price);
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<div class="warn width2" style="float: left;">
|
||||
<p>{l s='How to restore a database Backup in 10 easy steps:'}</p>
|
||||
<ol style="font-size: 11px; font-weight: normal; line-height: 20px;">
|
||||
<li>{l s='Set "Enable Shop" to "No" in the Preferences > Maintenance tab.'}</li>
|
||||
<li>{l s='Set "Enable Shop" to "No" in the "Maintenance" page under the "Preferences" menu.'}</li>
|
||||
<li>{l s='Download the Backup from the list below or from your FTP server (in the folder "admin/backups").'}</li>
|
||||
<li>{l s='Check the Backup integrity: look for errors, incomplete file, etc. Be sure to verify all your data.'}</li>
|
||||
<li>{l s='Ask your hosting provider for "phpMyAdmin" access to your database'}</li>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="warn width2" style="float: left;">
|
||||
<p>{l s='How to restore a database Backup in 10 easy steps:'}</p>
|
||||
<ol style="font-size: 11px; font-weight: normal; line-height: 20px;">
|
||||
<li>{l s='Set "Enable Shop" to "No" in the Preferences > Maintenance tab.'}</li>
|
||||
<li>{l s='Set "Enable Shop" to "No" in the "Maintenance" page under the "Preferences" menu.'}</li>
|
||||
<li>{l s='Download the Backup from the list below or from your FTP server (in the folder "admin/backups").'}</li>
|
||||
<li>{l s='Check the Backup integrity: look for errors, incomplete file, etc. Be sure to verify all your data.'}</li>
|
||||
<li>{l s='Ask your hosting provider for "phpMyAdmin" access to your database'}</li>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<input type="text" id="customerFilter" name="customerFilter" value="{$customerFilter|escape:'htmlall':'UTF-8'}" style="width:400px" />
|
||||
<p class="preference_description">{l s='Optional, the cart rule will be available for everyone if you leave this field blank.'}</p>
|
||||
</div>
|
||||
<label>{l s='Validity'}</label>
|
||||
<label>{l s='Valid'}</label>
|
||||
<div class="margin-form">
|
||||
<strong>{l s='from'}</strong>
|
||||
<input type="text" class="datepicker" name="date_from"
|
||||
@@ -196,7 +196,7 @@
|
||||
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>
|
||||
</tr>
|
||||
|
||||
@@ -54,6 +54,6 @@
|
||||
name: '{$language.name|escape:'quotes'}'
|
||||
};
|
||||
{/foreach}
|
||||
displayFlags(languages, {$defaultLanguage});
|
||||
displayFlags(languages, {$id_lang_default});
|
||||
</script>
|
||||
<script type="text/javascript" src="themes/default/template/controllers/cart_rules/form.js"></script>
|
||||
@@ -5,8 +5,8 @@
|
||||
<div class="margin-form">
|
||||
<div class="translatable">
|
||||
{foreach from=$languages item=language}
|
||||
<div class="lang_{$language.id_lang|intval}" style="display:{if $language.id_lang == $defaultLanguage}block{else}none{/if};float:left">
|
||||
<input type="text" id="name_{$language.id_lang|intval}" name="name_{$language.id_lang|intval}" value="{$currentTab->getFieldValue($currentObject, 'name', $language.id_lang|intval)}" style="width:400px" />
|
||||
<div class="lang_{$language.id_lang|intval}" style="display:{if $language.id_lang == $id_lang_default}block{else}none{/if};float:left">
|
||||
<input type="text" id="name_{$language.id_lang|intval}" name="name_{$language.id_lang|intval}" value="{$currentTab->getFieldValue($currentObject, 'name', $language.id_lang|intval)|escape:html:'UTF-8'}" style="width:400px" />
|
||||
<sup>*</sup>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<h2><img src="../img/admin/vcard.png" />{l s='Customer information'}</h2>
|
||||
<span style="font-size: 14px;">
|
||||
{if $customer->id}
|
||||
<a href="{$link->getAdminLink('AdminCustomers')}&id_customer={$customer->id}&viewcustomer">{$customer->firstname} {$customer->lastname}</a></span>
|
||||
<a href="{$link->getAdminLink('AdminCustomers')|escape:'htmlall':'UTF-8'}&id_customer={$customer->id}&viewcustomer">{$customer->firstname} {$customer->lastname}</a></span>
|
||||
{l s='#'}{$customer->id}<br />
|
||||
<a style="text-decoration: underline; color:#268CCD;" href="mailto:{$customer->email}">{$customer->email}</a> <br /><br />
|
||||
{l s='Account registration date:'} {dateFormat date=$customer->date_add}<br />
|
||||
@@ -51,12 +51,12 @@
|
||||
<h2><img src="../img/admin/cart.gif" /> {l s='Order information'}</h2>
|
||||
<span>
|
||||
{if $order->id}
|
||||
<a href="{$link->getAdminLink('AdminOrders')}&id_order={$order->id}&vieworder"> {l s='Order #%d' sprintf=$order->id|string_format:"%06d"}</a></span>
|
||||
<a href="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&id_order={$order->id}&vieworder"> {l s='Order #%d' sprintf=$order->id|string_format:"%06d"}</a></span>
|
||||
<br /><br />
|
||||
{l s='Made on:'} {dateFormat date=$order->date_add}<br /><br /><br /><br />
|
||||
{else}
|
||||
{l s='No order created from this cart'}</span>
|
||||
<p><a class="button" href="{$link->getAdminLink('AdminOrders')}&id_cart={$cart->id}&addorder">{l s='Create an order with from cart'}</a></p>
|
||||
{if $customer->id}<p><a class="button" href="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&id_cart={$cart->id}&addorder">{l s='Create an order with from cart'}</a></p>{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<br style="clear:both;" />
|
||||
@@ -77,12 +77,12 @@
|
||||
</tr>
|
||||
<tbody>
|
||||
{foreach from=$products item='product'}
|
||||
{if isset($customized_datas[$product.id_product][$product.id_product_attribute])}
|
||||
{if isset($customized_datas[$product.id_product][$product.id_product_attribute][$product.id_address_delivery])}
|
||||
<tr>
|
||||
<td align="center">{$product.image}</td>
|
||||
<td><a href="{$link->getAdminLink('AdminProducts')}&id_product={$product.id_product}&updateproduct">
|
||||
<td><a href="{$link->getAdminLink('AdminProducts')|escape:'htmlall':'UTF-8'}&id_product={$product.id_product}&updateproduct">
|
||||
<span class="productName">{$product.name}</span>{if isset($product.attributes)}<br />{$product.attributes}{/if}<br />
|
||||
{if $product.reference}$this->l('Ref:') {$product.reference}{/if}
|
||||
{if $product.reference}{l s='Ref:'} {$product.reference}{/if}
|
||||
{if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if}
|
||||
</a>
|
||||
</td>
|
||||
@@ -91,7 +91,7 @@
|
||||
<td align="center" class="productQuantity">{$product.qty_in_stock}</td>
|
||||
<td align="right">{displayWtPriceWithCurrency price=$product.total_customization_wt currency=$currency}</td>
|
||||
</tr>
|
||||
{foreach from=$customized_datas[$product.id_product][$product.id_product_attribute] item='customization'}
|
||||
{foreach from=$customized_datas[$product.id_product][$product.id_product_attribute][$product.id_address_delivery] item='customization'}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{foreach from=$customization.datas key='type' item='datas'}
|
||||
@@ -99,7 +99,7 @@
|
||||
<ul style="margin: 0; padding: 0; list-style-type: none;">
|
||||
{foreach from=$datas key='index' item='data'}
|
||||
<li style="display: inline; margin: 2px;">
|
||||
<a href="displayImage.php?img={$data.value}&name={$order->id}-file{$smarty.foreach.count.index}" target="_blank">
|
||||
<a href="displayImage.php?img={$data.value}&name={$order->id}-file{$index}" target="_blank">
|
||||
<img src="{$pic_dir}{$data.value}_small" alt="" /></a>
|
||||
</li>
|
||||
{/foreach}
|
||||
@@ -107,7 +107,7 @@
|
||||
{elseif $type == constant('Product::CUSTOMIZE_TEXTFIELD')}
|
||||
<ul style="margin-bottom: 4px; padding: 0; list-style-type: none;">
|
||||
{foreach from=$datas key='index' item='data'}
|
||||
<li>{if $data.name}{$data.name}{else}{l s='Text #'}{$smarty.foreach.count.index}{/if}{l s=':'}<b>{$data.value}</b></li>
|
||||
<li>{if $data.name}{$data.name}{else}{l s='Text #'}{$index}{/if}{l s=':'}<b>{$data.value}</b></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
@@ -125,7 +125,7 @@
|
||||
<tr>
|
||||
<td align="center">{$product.image}</td>
|
||||
<td>
|
||||
<a href="{$link->getAdminLink('AdminProducts')}&id_product={$product.id_product}&updateproduct">
|
||||
<a href="{$link->getAdminLink('AdminProducts')|escape:'htmlall':'UTF-8'}&id_product={$product.id_product}&updateproduct">
|
||||
<span class="productName">{$product.name}</span>{if isset($product.attributes)}<br />{$product.attributes}{/if}<br />
|
||||
{if $product.reference}{l s='Ref:'} {$product.reference}{/if}
|
||||
{if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if}
|
||||
@@ -175,7 +175,7 @@
|
||||
</tr>
|
||||
{foreach from=$discounts item='discount'}
|
||||
<tr>
|
||||
<td><a href="{$link->getAdminLink('AdminDiscounts')}&id_discount={$discount.id_discount}&updatediscount">{$discount.name}</a></td>
|
||||
<td><a href="{$link->getAdminLink('AdminDiscounts')|escape:'htmlall':'UTF-8'}&id_discount={$discount.id_discount}&updatediscount">{$discount.name}</a></td>
|
||||
<td align="center">- {displayWtPriceWithCurrency price=$discount.value_real currency=$currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<select name="id_employee_forward" style="vertical-align: middle;">
|
||||
<option value="-1">{l s='-- Choose --'}</option>
|
||||
{foreach $employees as $employee}
|
||||
<option value="{$employee.id_employee}"> {$employee.firstname|substr:0:1}. {$employee.lastname}</option>
|
||||
<option value="{$employee.id_employee}"> {Tools::substr($employee.firstname, 0, 1)}. {$employee.lastname}</option>
|
||||
{/foreach}
|
||||
<option value="0">{l s='Someone else'}</option>
|
||||
</select>
|
||||
@@ -147,6 +147,7 @@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var timer;
|
||||
$(document).ready(function(){
|
||||
$('select[name=id_employee_forward]').change(function(){
|
||||
if ($(this).val() >= 0)
|
||||
@@ -164,7 +165,27 @@
|
||||
$(this).val('');
|
||||
}
|
||||
});
|
||||
timer = setInterval("markAsRead()", 3000);
|
||||
});
|
||||
|
||||
|
||||
function markAsRead()
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax-tab.php',
|
||||
async: true,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
controller: 'AdminCustomerThreads',
|
||||
action: 'markAsRead',
|
||||
token : '{$token}',
|
||||
id_thread: {$id_customer_thread}
|
||||
}
|
||||
});
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<script type="text/javascript">
|
||||
function saveCustomerNote()
|
||||
{
|
||||
$('#note_feedback').html('<img src="../img/loader.gif" />').show();
|
||||
$('#note_feedback').html('<img src="../img/loader.gif" alt="" />').show();
|
||||
var noteContent = $('#noteContent').val();
|
||||
|
||||
$.ajax({
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
<p>{l s='If you don\'t know how to do this, please contact your hosting provider!'}</p><br />
|
||||
{/if}
|
||||
|
||||
{* Screencast deprecated, but I keep the code in case it is updated later
|
||||
{if $employee->bo_show_screencast}
|
||||
<div id="adminpresentation" style="display:block">
|
||||
<h2>{l s='Video'}</h2>
|
||||
@@ -97,7 +96,6 @@ $(document).ready(function() {
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
*}
|
||||
|
||||
<h2>{l s='Quick links'}</h2>
|
||||
<ul class="F_list clearfix">
|
||||
@@ -123,6 +121,7 @@ $(document).ready(function() {
|
||||
<div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
|
||||
|
||||
{hook h="displayAdminHomeInfos"}
|
||||
{hook h="displayBackOfficeHome"} {*old name of the hook*}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var truncateAuthorized = {$truncateAuthorized|intval};
|
||||
|
||||
$(document).ready(function(){
|
||||
activeClueTip();
|
||||
$("a#upload_file_import_link").fancybox({
|
||||
@@ -46,9 +48,18 @@
|
||||
$('#preview_import').submit(function(e) {
|
||||
if ($('#truncate').get(0).checked)
|
||||
{
|
||||
if (!confirm('{l s='Are you sure you want to delete' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '{l s='?' js=1}'))
|
||||
console.log(truncateAuthorized);
|
||||
if (truncateAuthorized)
|
||||
{
|
||||
e.preventDefault();
|
||||
if (!confirm('{l s='Are you sure you want to delete' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '{l s='?' js=1}'))
|
||||
{
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jAlert('{l s='You do not have permission to delete here. When the multi-store is enable, only a SuperAdmin can delete all items before import.'}');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -122,7 +133,7 @@
|
||||
<fieldset style="float: left; margin: 0pt 20px 0pt 0pt; width: 70%;">
|
||||
<legend><img src="../img/admin/import.gif" />{l s='Import'}</legend>
|
||||
|
||||
<label class="clear">{if count($files_to_import) > 1}{l s='Your CSV file (%d files):' sprintf=files_to_import}{else}{l s='Your CSV file (%d file):' sprintf=files_to_import}{/if}</label>
|
||||
<label class="clear">{if count($files_to_import) > 1}{l s='Your CSV file (%d files):' sprintf=count($files_to_import)}{else}{l s='Your CSV file (%d file):' sprintf=count($files_to_import)}{/if}</label>
|
||||
<div class="margin-form">
|
||||
{if count($files_to_import)}
|
||||
<select name="csv">
|
||||
@@ -173,10 +184,14 @@
|
||||
<div class="margin-form">
|
||||
<input name="truncate" id="truncate" type="checkbox"/>
|
||||
</div>
|
||||
<label for="match_ref" class="clear" style="display: none">{l s='Use product reference as key?'}</label>
|
||||
<label for="match_ref" class="clear" style="display: none">{l s='Use product reference as key?'}</label>
|
||||
<div class="margin-form">
|
||||
<input name="match_ref" id="match_ref" type="checkbox" style="margin-top: 6px; display:none"/>
|
||||
</div>
|
||||
<label for="forceIDs" class="clear">{l s='Force all ids during import?'} </label>
|
||||
<div class="margin-form">
|
||||
<input name="forceIDs" id="forceIDs" type="checkbox"/> {l s='If you don\'t use this option, all IDs will be auto-incremented.'}
|
||||
</div>
|
||||
<div class="space margin-form">
|
||||
<input type="submit" name="submitImportFile" value="{l s='Next step'}" class="button" {if empty($files_to_import)}disabled{/if}/>
|
||||
{if empty($files_to_import)}<span style="color:red;">{l s='You must upload a file for go to the next step.'}</span>{/if}
|
||||
@@ -255,6 +270,11 @@
|
||||
else
|
||||
$(".import_products_categories").hide();
|
||||
|
||||
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
|
||||
$("label[for=forceIDs],#forceIDs").show();
|
||||
else
|
||||
$("label[for=forceIDs],#forceIDs").hide();
|
||||
|
||||
$("#entitie").html($("#entity > option:selected").text().toLowerCase());
|
||||
$.ajax({
|
||||
url: 'ajax.php',
|
||||
|
||||
@@ -67,6 +67,9 @@
|
||||
{if $fields_value.truncate}
|
||||
<input type="hidden" name="truncate" value="1" />
|
||||
{/if}
|
||||
{if $fields_value.forceIDs}
|
||||
<input type="hidden" name="forceIDs" value="1" />
|
||||
{/if}
|
||||
{if $fields_value.match_ref}
|
||||
<input type="hidden" name="match_ref" value="1" />
|
||||
{/if}
|
||||
|
||||
@@ -77,23 +77,24 @@
|
||||
<br />
|
||||
<fieldset>
|
||||
<legend><img src="../img/t/AdminInformation.gif" alt="" /> {l s='Information about your configuration'}</legend>
|
||||
<h3>{l s='Server information'}</h3>
|
||||
<p>
|
||||
<b>{l s='Prestashop version'}:</b> {$version.ps|escape:'htmlall':'UTF-8'}
|
||||
</p>
|
||||
|
||||
<h3>{l s='Server information'}</h3>
|
||||
{if count($uname)}
|
||||
<p>
|
||||
<b>{l s='Server information'}:</b> {$uname|escape:'htmlall':'UTF-8'}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<p>
|
||||
<b>{l s='Server software version'}:</b> {$version.server|escape:'htmlall':'UTF-8'}
|
||||
</p>
|
||||
<p>
|
||||
<b>{l s='PHP version'}:</b> {$version.php|escape:'htmlall':'UTF-8'}
|
||||
</p>
|
||||
<p>
|
||||
<b>{l s='Memory limit'}:</b> {$version.memory_limit|escape:'htmlall':'UTF-8'}
|
||||
</p>
|
||||
<p>
|
||||
<b>{l s='Max execution time'}:</b> {$version.max_execution_time|escape:'htmlall':'UTF-8'}
|
||||
</p>
|
||||
{if $apache_instaweb}
|
||||
<p style="color:red;font-weight:700">{l s='PageSpeed module for Apache installed (mod_instaweb)'}</p>
|
||||
{/if}
|
||||
@@ -112,6 +113,9 @@
|
||||
|
||||
<hr />
|
||||
<h3>{l s='Store information'}</h3>
|
||||
<p>
|
||||
<b>{l s='Prestashop version'}:</b> {$shop.ps|escape:'htmlall':'UTF-8'}
|
||||
</p>
|
||||
<p>
|
||||
<b>{l s='Shop URL'}:</b> {$shop.url|escape:'htmlall':'UTF-8'}
|
||||
</p>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<input type="submit" name="submitLogin" value="{l s='Log in'}" class="button fl margin-right-5" />
|
||||
|
||||
<p class="fl no-margin hide ajax-loader">
|
||||
<img src="../img/loader.gif">
|
||||
<img src="../img/loader.gif" alt="" />
|
||||
</p>
|
||||
|
||||
<p class="fr no-margin">
|
||||
@@ -89,7 +89,7 @@
|
||||
<input type="submit" name="submit" value="{l s='Send'}" class="button fl margin-right-5" />
|
||||
|
||||
<p class="fl no-margin hide ajax-loader">
|
||||
<img src="../img/loader.gif">
|
||||
<img src="../img/loader.gif" alt="" />
|
||||
</p>
|
||||
|
||||
<p class="fr no-margin">
|
||||
|
||||
@@ -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}/>
|
||||
<label class="t" for="{$key}_off"> {l s='No'}</label>
|
||||
{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 URLs you must activate this mod.'}</span>
|
||||
<span class="warning_mod_rewrite">{l s='URL rewriting (mod_rewrite) is not active on your server or it is not possible to check your server configuration. If you want to use Friendly URLs you must activate this mod.'}</span>
|
||||
<div class="clear"></div>
|
||||
{/if}
|
||||
{else}
|
||||
|
||||
@@ -38,21 +38,21 @@
|
||||
<tr height="32" {if $km % 2 eq 0} class="alt_row"{/if}>
|
||||
<td><img src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}" width="16" height="16" /></td>
|
||||
<td><span class="moduleName">{$module->displayName}</span></td>
|
||||
<td><span class="moduleFavDesc">{$module->description|truncate:80:'…'}</span></td>
|
||||
<td><span class="moduleFavDesc">{$module->description|truncate:80:'...'}</span></td>
|
||||
<td>{if isset($module->id) && $module->id gt 0}<span class="setup">{l s='Installed'}</span>{else}<span class="setup non-install">{l s='Not Installed'}</span>{/if}</td>
|
||||
<td>{$module->categoryName}</td>
|
||||
<td>
|
||||
<select name="i_{$module->name}" class="moduleFavorite" style="width:50px">
|
||||
<option value="" selected="selected">---</option>
|
||||
<option value="1" {if isset($module->preferences.interest) && $module->preferences.interest eq '1'}selected="selected"{/if}>Yes</option>
|
||||
<option value="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>No</option>
|
||||
<option value="1" {if isset($module->preferences.interest) && $module->preferences.interest eq '1'}selected="selected"{/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>{l s='No'}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select name="f_{$module->name}" class="moduleFavorite" style="width:50px">
|
||||
<option value="" selected="selected">---</option>
|
||||
<option value="1" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '1'}selected="selected"{/if}>Yes</option>
|
||||
<option value="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>No</option>
|
||||
<option value="1" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '1'}selected="selected"{/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>{l s='No'}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td id="r_{$module->name}"> </td>
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
},
|
||||
beforeSend: function(xhr)
|
||||
{
|
||||
$('#moduleContainer').html('<img src="../img/loader.gif" border="0">');
|
||||
$('#moduleContainer').html('<img src="../img/loader.gif" alt="" border="0" />');
|
||||
},
|
||||
success : function(data)
|
||||
{
|
||||
@@ -195,7 +195,7 @@
|
||||
},
|
||||
beforeSend: function(xhr)
|
||||
{
|
||||
$('#addons_loading').html('<img src="../img/loader.gif" border="0">');
|
||||
$('#addons_loading').html('<img src="../img/loader.gif" alt="" border="0" />');
|
||||
},
|
||||
success : function(data)
|
||||
{
|
||||
@@ -236,7 +236,7 @@
|
||||
},
|
||||
beforeSend: function(xhr)
|
||||
{
|
||||
$('#addons_loading').html('<img src="../img/loader.gif" border="0">');
|
||||
$('#addons_loading').html('<img src="../img/loader.gif" alt="" border="0" />');
|
||||
},
|
||||
success : function(data)
|
||||
{
|
||||
|
||||
@@ -60,12 +60,12 @@
|
||||
<td class="document_number">
|
||||
{if get_class($document) eq 'OrderInvoice'}
|
||||
{if isset($document->is_delivery)}
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateDeliverySlipPDF&id_order_invoice={$document->id}">
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateDeliverySlipPDF&id_order_invoice={$document->id}">
|
||||
{else}
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateInvoicePDF&id_order_invoice={$document->id}">
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order_invoice={$document->id}">
|
||||
{/if}
|
||||
{elseif get_class($document) eq 'OrderSlip'}
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateOrderSlipPDF&id_order_slip={$document->id}">
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateOrderSlipPDF&id_order_slip={$document->id}">
|
||||
{/if}
|
||||
{if get_class($document) eq 'OrderInvoice'}
|
||||
{if isset($document->is_delivery)}
|
||||
@@ -92,6 +92,8 @@
|
||||
</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{elseif get_class($document) eq 'OrderSlip'}
|
||||
{displayPrice price=$document->amount currency=$currency->id}
|
||||
{/if}
|
||||
</td>
|
||||
<td class="right document_action">
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
{* Generate HTML code for printing Invoice Icon with link *}
|
||||
<span style="width:20px; margin-right:5px;">
|
||||
{if ($order_state->invoice || $order->invoice_number)}
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateInvoicePDF&id_order={$order->id}"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order={$order->id}"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
{else}
|
||||
-
|
||||
{/if}
|
||||
@@ -36,7 +36,7 @@
|
||||
{* Generate HTML code for printing Delivery Icon with link *}
|
||||
<span style="width:20px;">
|
||||
{if ($order_state->delivery || $order->delivery_number)}
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateDeliverySlipPDF&id_order={$order->id}"><img src="../img/admin/delivery.gif" alt="delivery" /></a>
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateDeliverySlipPDF&id_order={$order->id}"><img src="../img/admin/delivery.gif" alt="delivery" /></a>
|
||||
{else}
|
||||
-
|
||||
{/if}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
</td>
|
||||
<td class="partial_refund_fields current-edit" style="text-align:left;display:none">
|
||||
<div style="width:40%;margin-top:5px;float:left">{l s='Quantity:'}</div> <div style="width:60%;margin-top:2px;float:left"><input onchange="checkPartialRefundProductQuantity(this)" type="text" size="3" name="partialRefundProductQuantity[{{$product['id_order_detail']}}]" value="0" /> 0/{$productQuantity-$product['product_quantity_refunded']}</div>
|
||||
<div style="width:40%;margin-top:5px;float:left">{l s='Amount:'}</div> <div style="width:60%;margin-top:2px;float:left"><input onchange="checkPartialRefundProductAmount(this)" type="text" size="3" name="partialRefundProduct[{$product['id_order_detail']}]" /> €</div> {if !empty($product['amount_refund']) && $product['amount_refund'] > 0}({l s='%s refund' sprintf=$product['amount_refund']}){/if}
|
||||
<div style="width:40%;margin-top:5px;float:left">{l s='Amount:'}</div> <div style="width:60%;margin-top:2px;float:left">{$currency->prefix}<input onchange="checkPartialRefundProductAmount(this)" type="text" size="3" name="partialRefundProduct[{$product['id_order_detail']}]" /> {$currency->suffix}</div> {if !empty($product['amount_refund']) && $product['amount_refund'] > 0}({l s='%s refund' sprintf=$product['amount_refund']}){/if}
|
||||
<input type="hidden" value="{$product['quantity_refundable']}" class="partialRefundProductQuantity" />
|
||||
<input type="hidden" value="{$product['amount_refundable']}" class="partialRefundProductAmount" />
|
||||
</td>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<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>
|
||||
{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')|escape:'htmlall':'UTF-8'}&vieworder&id_order={$order->id|escape:'htmlall':'UTF-8'}">
|
||||
<span class="shipping_number_edit" style="display:none;">
|
||||
<input type="hidden" name="id_order_carrier" value="{$line.id_order_carrier|htmlentities}" />
|
||||
<input type="text" name="tracking_number" value="{$line.tracking_number|htmlentities}" />
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<script type="text/javascript">
|
||||
var id_cart = '';
|
||||
var id_cart = {$cart->id|intval};
|
||||
var id_customer = '';
|
||||
var changed_shipping_price = false;
|
||||
var shipping_price_selected_carrier = '';
|
||||
@@ -132,8 +132,8 @@
|
||||
add_cart_rule(data.id_cart_rule);
|
||||
});
|
||||
{if $cart->id}
|
||||
setupCustomer('{$cart->id_customer}');
|
||||
useCart('{$cart->id}');
|
||||
setupCustomer({$cart->id_customer|intval});
|
||||
useCart('{$cart->id|intval}');
|
||||
{/if}
|
||||
|
||||
$('.delete_product').live('click', function(e) {
|
||||
@@ -474,7 +474,8 @@
|
||||
token: "{getAdminToken tab='AdminCarts'}",
|
||||
tab: "AdminCarts",
|
||||
action: "searchCarts",
|
||||
id_customer: id_customer
|
||||
id_customer: id_customer,
|
||||
id_cart: id_cart
|
||||
},
|
||||
success : function(res)
|
||||
{
|
||||
@@ -552,7 +553,10 @@
|
||||
|
||||
if(res.found)
|
||||
{
|
||||
$('#products_err').hide();
|
||||
if (!customization_errors)
|
||||
$('#products_err').hide();
|
||||
else
|
||||
customization_errors = false;
|
||||
$('#products_found').show();
|
||||
products_found += '<label>{l s='Product:'}</label><select id="id_product" onclick="display_product_attributes();display_product_customizations();">';
|
||||
attributes_html += '<label>{l s='Combination:'}</label>';
|
||||
@@ -950,14 +954,14 @@
|
||||
<div class="margin-form">
|
||||
<input type="text" id="customer" value="" />
|
||||
<p>{l s='Search a customer by tapping the first letters of his name'}</p>
|
||||
<a class="fancybox button" href="{$link->getAdminLink('AdminCustomers')}&addcustomer&liteDisplaying=1&submitFormAjax=1#">
|
||||
<a class="fancybox button" href="{$link->getAdminLink('AdminCustomers')|escape:'htmlall':'UTF-8'}&addcustomer&liteDisplaying=1&submitFormAjax=1#">
|
||||
<img src="../img/admin/add.gif" title="new"/><span>{l s='Add new customer'}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="customers">
|
||||
</div>
|
||||
</fieldset><br />
|
||||
<form action="{$link->getAdminLink('AdminOrders')}&submitAdd{$table}=1" method="post" autocomplete="off">
|
||||
<form action="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&submitAdd{$table}=1" method="post" autocomplete="off">
|
||||
<fieldset id="products_part" style="display:none;"><legend><img src="../img/t/AdminCatalog.gif" />{l s='Cart'}</legend>
|
||||
<div>
|
||||
<label>{l s='Search a product:'} </label>
|
||||
@@ -1095,11 +1099,11 @@
|
||||
</fieldset>
|
||||
<br />
|
||||
<fieldset id="vouchers_part" style="display:none;">
|
||||
<legend><img src="../img/t/AdminDiscounts.gif" />{l s='Vouchers'}</legend>
|
||||
<legend><img src="../img/t/AdminCartRules.gif" />{l s='Vouchers'}</legend>
|
||||
<p>
|
||||
<label>{l s='Search a voucher:'} </label>
|
||||
<input type="text" id="voucher" value="" />
|
||||
<a class="fancybox button" href="{$link->getAdminLink('AdminCartRules')}&addcart_rule&liteDisplaying=1&submitFormAjax=1#"><img src="../img/admin/add.gif" title="new"/>{l s='Add new voucher'}</a>
|
||||
<a class="fancybox button" href="{$link->getAdminLink('AdminCartRules')|escape:'htmlall':'UTF-8'}&addcart_rule&liteDisplaying=1&submitFormAjax=1#"><img src="../img/admin/add.gif" title="new"/>{l s='Add new voucher'}</a>
|
||||
</p>
|
||||
<div class="margin-form">
|
||||
<table cellspacing="0" cellpadding="0" class="table" id="voucher_list">
|
||||
@@ -1135,36 +1139,35 @@
|
||||
<div id="address_invoice_detail">
|
||||
</div>
|
||||
</div>
|
||||
<a class="fancybox button" id="new_address" href="{$link->getAdminLink('AdminAddresses')}&addaddress&id_customer=42&liteDisplaying=1&submitFormAjax=1#"><img src="../img/admin/add.gif" title="new"/>{l s='Add new address'}</a>
|
||||
<a class="fancybox button" id="new_address" href="{$link->getAdminLink('AdminAddresses')|escape:'htmlall':'UTF-8'}&addaddress&id_customer=42&liteDisplaying=1&submitFormAjax=1#"><img src="../img/admin/add.gif" title="new"/>{l s='Add new address'}</a>
|
||||
</fieldset>
|
||||
<br />
|
||||
<fieldset id="carriers_part" style="display:none;">
|
||||
<legend><img src="../img/t/AdminCarriers.gif" />{l s='Shipping'}</legend>
|
||||
<div id="carriers_err" style="display:none;" class="warn"></div>
|
||||
<div id="carrier_form">
|
||||
<div>
|
||||
<p>
|
||||
<label>{l s='Delivery option:'} </label>
|
||||
<select name="delivery_option" id="delivery_option">
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="shipping_price">{l s='Shipping price:'}</label> <span id="shipping_price" name="shipping_price"></span> <span class="currency_sign"></span>
|
||||
</p>
|
||||
<p>
|
||||
<label for="free_shipping">{l s='Free shipping:'}</label>
|
||||
<input type="checkbox" id="free_shipping" name="free_shipping" value="1" />
|
||||
</p>
|
||||
</div>
|
||||
<div id="float:left;">
|
||||
{if $recyclable_pack}
|
||||
<p><input type="checkbox" name="carrier_recycled_package" value="1" id="carrier_recycled_package" /> <label for="carrier_recycled_package">{l s='Recycled package'}</label></p>
|
||||
{/if}
|
||||
{if $gift_wrapping}
|
||||
<p><input type="checkbox" name="order_gift" id="order_gift" value="1" /> <label for="order_gift">{l s='Gift'}</label></p>
|
||||
<p><label for="gift_message">{l s='Gift message:'}</label><textarea id="gift_message" cols="40" rows="4"></textarea></p>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="carrier_form">
|
||||
<div>
|
||||
<p>
|
||||
<label>{l s='Delivery option:'} </label>
|
||||
<select name="delivery_option" id="delivery_option">
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="shipping_price">{l s='Shipping price:'}</label> <span id="shipping_price" name="shipping_price"></span> <span class="currency_sign"></span>
|
||||
</p>
|
||||
<p>
|
||||
<label for="free_shipping">{l s='Free shipping:'}</label>
|
||||
<input type="checkbox" id="free_shipping" name="free_shipping" value="1" />
|
||||
</p>
|
||||
</div>
|
||||
<div id="float:left;">
|
||||
{if $recyclable_pack}
|
||||
<p><input type="checkbox" name="carrier_recycled_package" value="1" id="carrier_recycled_package" /> <label for="carrier_recycled_package">{l s='Recycled package'}</label></p>
|
||||
{/if}
|
||||
{if $gift_wrapping}
|
||||
<p><input type="checkbox" name="order_gift" id="order_gift" value="1" /> <label for="order_gift">{l s='Gift'}</label></p>
|
||||
<p><label for="gift_message">{l s='Gift message:'}</label><textarea id="gift_message" cols="40" rows="4"></textarea></p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@@ -33,20 +33,19 @@
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
{if $customization_errors|count}
|
||||
customization_errors = true;
|
||||
var id_selected_product = parent.$('#id_product option:selected').val();
|
||||
if (parent.searchProducts())
|
||||
{
|
||||
parent.$('#products_err', window.parent.document).html('{$customization_errors}');
|
||||
parent.$('#id_product option[value="'+id_selected_product+'"]').attr('selected', true);
|
||||
parent.$('#id_product').change();
|
||||
}
|
||||
|
||||
{if $customization_errors}
|
||||
parent.customization_errors = true;
|
||||
{else}
|
||||
parent.customization_errors = false;
|
||||
parent.$('#products_err', window.parent.document).hide();
|
||||
customization_errors = false;
|
||||
{/if}
|
||||
var id_selected_product = parent.$('#id_product option:selected').val();
|
||||
if (parent.searchProducts())
|
||||
{
|
||||
parent.$('#products_err', window.parent.document).html('{$customization_errors}');
|
||||
parent.$('#id_product option[value="'+id_selected_product+'"]').attr('selected', true);
|
||||
parent.$('#id_product').change();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<div class="bloc-command">
|
||||
<div class="button-command">
|
||||
{if (count($invoices_collection))}
|
||||
<a class="button" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateInvoicePDF&id_order={$order->id}" target="_blank">
|
||||
<a class="button" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order={$order->id}" target="_blank">
|
||||
<img src="../img/admin/charged_ok.gif" alt="{l s='View invoice'}" /> {l s='View invoice'}
|
||||
</a>
|
||||
{else}
|
||||
@@ -72,7 +72,7 @@
|
||||
{/if}
|
||||
|
|
||||
{if (($currentState && $currentState->delivery) || $order->delivery_number)}
|
||||
<a class="button" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateDeliverySlipPDF&id_order={$order->id}" target="_blank">
|
||||
<a class="button" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateDeliverySlipPDF&id_order={$order->id}" target="_blank">
|
||||
<img src="../img/admin/delivery.gif" alt="{l s='View delivery slip'}" /> {l s='View delivery slip'}
|
||||
</a>
|
||||
{else}
|
||||
@@ -90,6 +90,10 @@
|
||||
<dt>{l s='Messages:'}</dt>
|
||||
<dd>{sizeof($messages)}</dd>
|
||||
|</dl>
|
||||
<dl>
|
||||
<dt><a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'htmlall':'UTF-8'}">{l s='New Customer Messages:'}</a></dt>
|
||||
<dd><a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'htmlall':'UTF-8'}">{sizeof($customer_thread_message)}</a></dd>
|
||||
|</dl>
|
||||
<dl>
|
||||
<dt>{l s='Products:'}</dt>
|
||||
<dd id="product_number">{sizeof($products)}</dd>
|
||||
@@ -105,7 +109,7 @@
|
||||
<!-- Left column -->
|
||||
<div style="width: 49%; float:left;">
|
||||
<!-- Change status form -->
|
||||
<form action="{$currentIndex}&viewOrder&token={$smarty.get.token}" method="post">
|
||||
<form action="{$currentIndex}&vieworder&token={$smarty.get.token}" method="post">
|
||||
<select id="id_order_state" name="id_order_state">
|
||||
{foreach from=$states item=state}
|
||||
{if $state['id_order_state'] != $currentState->id}
|
||||
@@ -180,8 +184,8 @@
|
||||
{foreach from=$sources item=source}
|
||||
<li>
|
||||
{dateFormat date=$source['date_add'] full=true}<br />
|
||||
<b>{l s='From:'}</b> <a href="{$source['http_referer']}">{parse_url($source['http_referer'], $smarty.const.PHP_URL_HOST)|regex_replace:'/^www./':''}</a><br />
|
||||
<b>{l s='To:'}</b> {$source['request_uri']}<br />
|
||||
<b>{l s='From:'}</b>{if $source['http_referer'] != ''}<a href="{$source['http_referer']}">{parse_url($source['http_referer'], $smarty.const.PHP_URL_HOST)|regex_replace:'/^www./':''}</a>{else}-{/if}<br />
|
||||
<b>{l s='To:'}</b> <a href="http://{$source['request_uri']}">{$source['request_uri']|truncate:100:'...'}</a><br />
|
||||
{if $source['keywords']}<b>{l s='Keywords:'}</b> {$source['keywords']}<br />{/if}<br />
|
||||
</li>
|
||||
{/foreach}
|
||||
@@ -198,8 +202,8 @@
|
||||
<div style="width: 49%; float:right;">
|
||||
<div class="button-command-prev-next">
|
||||
<b>{l s='Orders'}</b> :
|
||||
{if $previousOrder}<a class="button" href="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$previousOrder}">{l s='< Prev'}</a>{/if}
|
||||
{if $nextOrder}<a class="button" href="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$nextOrder}">{l s='Next >'}</a>{/if}
|
||||
{if $previousOrder}<a class="button" href="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&vieworder&id_order={$previousOrder}">{l s='< Prev'}</a>{/if}
|
||||
{if $nextOrder}<a class="button" href="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&vieworder&id_order={$nextOrder}">{l s='Next >'}</a>{/if}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
@@ -260,7 +264,7 @@
|
||||
<legend><img src="../img/admin/money.gif" /> {l s='Payment'}</legend>
|
||||
|
||||
{if (!$order->valid && sizeof($currencies) > 1)}
|
||||
<form method="post" action="{$currentIndex}&viewOrder&id_order={$order->id}&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>
|
||||
<label>{l s='Don\'t forget to update your conversion rate before make this change.'}</label>
|
||||
<select name="new_currency">
|
||||
@@ -380,7 +384,7 @@
|
||||
<tr class="current-edit">
|
||||
<td><input type="text" name="payment_date" class="datepicker" size="17" value="{date('Y-m-d H:i:s')}" /></td>
|
||||
<td>
|
||||
<select name="payment_method">
|
||||
<select name="payment_method" class="payment_method">
|
||||
{foreach from=$payment_methods item=payment_method}
|
||||
<option value="{$payment_method}">{$payment_method}</option>
|
||||
{/foreach}
|
||||
@@ -389,18 +393,18 @@
|
||||
<td>
|
||||
<input type="text" name="payment_transaction_id" value="" />
|
||||
</td>
|
||||
<td {if count($not_paid_invoices_collection) <= 0}colspan="2"{/if}>
|
||||
<td>
|
||||
<input type="text" name="payment_amount" size="5" value="" />
|
||||
<select name="payment_currency">
|
||||
<select name="payment_currency" class="payment_currency">
|
||||
{foreach from=$currencies item=current_currency}
|
||||
<option value="{$current_currency['id_currency']}"{if $current_currency['id_currency'] == $currency->id} selected="selected"{/if}>{$current_currency['sign']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
{if count($not_paid_invoices_collection) > 0}
|
||||
{if count($invoices_collection) > 0}
|
||||
<td>
|
||||
<select name="payment_invoice" id="payment_invoice">
|
||||
{foreach from=$not_paid_invoices_collection item=invoice}
|
||||
{foreach from=$invoices_collection item=invoice}
|
||||
<option value="{$invoice->id}" selected="selected">{$invoice->getInvoiceNumberFormatted($current_id_lang)}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
@@ -473,7 +477,7 @@
|
||||
<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>{elseif isset($line.tracking_number)}{$line.tracking_number}{/if}</span>
|
||||
{if $line.can_edit}
|
||||
<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}">
|
||||
<form style="display: inline;" method="post" action="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&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;">
|
||||
<input type="text" name="tracking_number" value="{$line.tracking_number|htmlentities}" />
|
||||
<input type="submit" class="button" name="submitShippingNumber" value="{l s='Update'}" />
|
||||
@@ -510,7 +514,7 @@
|
||||
<legend><img src="../img/admin/delivery.gif" alt="{l s='Shipping address'}" />{l s='Shipping address'}</legend>
|
||||
|
||||
{if $can_edit}
|
||||
<form method="post" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id}">
|
||||
<form method="post" action="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&vieworder&id_order={$order->id}">
|
||||
<div style="margin-bottom:5px;">
|
||||
<p>
|
||||
<select name="id_address">
|
||||
@@ -540,7 +544,7 @@
|
||||
<legend><img src="../img/admin/invoice.gif" alt="{l s='Invoice address'}" />{l s='Invoice address'}</legend>
|
||||
|
||||
{if $can_edit}
|
||||
<form method="post" action="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id}">
|
||||
<form method="post" action="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&vieworder&id_order={$order->id}">
|
||||
<div style="margin-bottom:5px;">
|
||||
<p>
|
||||
<select name="id_address">
|
||||
@@ -658,7 +662,7 @@
|
||||
<tr id="total_shipping">
|
||||
<td><b>{l s='Shipping'}</b></td>
|
||||
<td class="amount" align="right">{displayPrice price=$order->total_shipping_tax_incl currency=$currency->id}</td>
|
||||
<td class="partial_refund_fields current-edit" style="display:none;"><input type="text" size="3" name="partialRefundShippingCost" /> €</td>
|
||||
<td class="partial_refund_fields current-edit" style="display:none;">{$currency->prefix}<input type="text" size="3" name="partialRefundShippingCost" value="0" />{$currency->suffix}</td>
|
||||
</tr>
|
||||
<tr style="font-size: 20px" id="total_order">
|
||||
<td style="font-size: 20px">{l s='Total'}</td>
|
||||
@@ -715,7 +719,7 @@
|
||||
<div style="clear:both; height:15px;"> </div>
|
||||
<div style="float: right; width: 160px; display: none;" class="standard_refund_fields">
|
||||
{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" name="reinjectQuantities" class="button" /> <label for="reinjectQuantities" style="float:none; font-weight:normal;">{l s='Re-stock products'}</label><br />
|
||||
{/if}
|
||||
{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 />
|
||||
@@ -729,10 +733,9 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div style="float: right; width: 160px; display:none;" class="partial_refund_fields">
|
||||
<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;" />
|
||||
</div>
|
||||
<input type="checkbox" name="reinjectQuantities" class="button" /> <label for="reinjectQuantities" style="float:none; font-weight:normal;">{l s='Re-stock products'}</label><br />
|
||||
<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;" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -745,7 +748,7 @@
|
||||
<div id="message_m" style="display: {if Tools::getValue('message')}none{else}block{/if}; overflow: auto; width: 400px;">
|
||||
<a href="#" onclick="$('#message').slideToggle();$('#message_m').slideToggle();return false"><b>{l s='Click here'}</b> {l s='to add a comment or send a message to the customer'}</a>
|
||||
</div>
|
||||
<a href="{$link->getAdminLink('AdminCustomerThreads')}"><b>{l s='Click here'}</b> {l s='to see all messages'}</a><br>
|
||||
<a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'htmlall':'UTF-8'}"><b>{l s='Click here'}</b> {l s='to see all messages'}</a><br>
|
||||
<div id="message" style="display: {if Tools::getValue('message')}block{else}none{/if}">
|
||||
<select name="order_message" id="order_message" onchange="orderOverwriteMessage(this, '{l s='Do you want to overwrite your existing message?'}')">
|
||||
<option value="0" selected="selected">-- {l s='Choose a standard message'} --</option>
|
||||
|
||||
@@ -26,5 +26,5 @@
|
||||
|
||||
{* Generate HTML code for printing Invoice Icon with link *}
|
||||
<span style="width:20px; margin-right:5px;">
|
||||
<a href="{$link->getAdminLink('AdminPdf')}&submitAction=generateInvoicePDF&id_order_invoice={$id_invoice}"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
<a href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order_invoice={$id_invoice}"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
</span>
|
||||
@@ -51,7 +51,7 @@
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="col-right">
|
||||
<a class="button bt-icon confirm_leave" href="{$link->getAdminLink('AdminCategories')}&addcategory">
|
||||
<a class="button bt-icon confirm_leave" href="{$link->getAdminLink('AdminCategories')|escape:'htmlall':'UTF-8'}&addcategory">
|
||||
<img src="../img/admin/add.gif" alt="{l s='Create new category'}" title="{l s='Create new category'}" />
|
||||
<span>{l s='Create new category'}</span>
|
||||
</a>
|
||||
@@ -110,7 +110,7 @@
|
||||
{/if}
|
||||
<option disabled="disabled">----------</option>
|
||||
</select>
|
||||
<a class="button bt-icon confirm_leave" style="margin-bottom:0" href="{$link->getAdminLink('AdminManufacturers')}&addmanufacturer">
|
||||
<a class="button bt-icon confirm_leave" style="margin-bottom:0" href="{$link->getAdminLink('AdminManufacturers')|escape:'htmlall':'UTF-8'}&addmanufacturer">
|
||||
<img src="../img/admin/add.gif" alt="{l s='Create new manufacturer'}" title="{l s='Create new manufacturer'}" />
|
||||
<span>{l s='Create new manufacturer'}</span>
|
||||
</a>
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
<li style="float: left; width: {$imageWidth}px;">
|
||||
<input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" />
|
||||
<label for="id_image_attr_{$image.id_image}" style="float: none;">
|
||||
<img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" />
|
||||
<img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small_default.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" />
|
||||
</label>
|
||||
</li>
|
||||
{/foreach}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
{else}
|
||||
<input type="hidden" name="feature_{$available_feature.id_feature}_value" value="0" />
|
||||
<span>{l s='N/A'} -
|
||||
<a href="{$link->getAdminLink('AdminFeatures')}&addfeature_value&id_feature={$available_feature.id_feature}"
|
||||
<a href="{$link->getAdminLink('AdminFeatures')|escape:'htmlall':'UTF-8'}&addfeature_value&id_feature={$available_feature.id_feature}"
|
||||
class="confirm_leave button"><img src="../img/admin/add.gif" alt="values_first" title="{l s='Add pre-defined values first'}" /> {l s='Add pre-defined values first'}</a>
|
||||
</span>
|
||||
{/if}
|
||||
@@ -94,7 +94,7 @@
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
<div>
|
||||
<a href="{$link->getAdminLink('AdminFeatures')}&addfeature" class="confirm_leave button">
|
||||
<a href="{$link->getAdminLink('AdminFeatures')|escape:'htmlall':'UTF-8'}&addfeature" class="confirm_leave button">
|
||||
<img src="../img/admin/add.gif" alt="new_features" title="{l s='Add a new feature'}" /> {l s='Add a new feature'}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<script type="text/javascript">
|
||||
var token = '{$token}';
|
||||
var id_product = {if isset($product->id)}{$product->id}{else}0{/if};
|
||||
var defaultLanguage = {$defaultLanguage};
|
||||
var id_lang_default = {$id_lang_default};
|
||||
var product_type_pack = {Product::PTYPE_PACK};
|
||||
var product_type_virtual = {Product::PTYPE_VIRTUAL};
|
||||
var product_type_simple = {Product::PTYPE_SIMPLE};
|
||||
@@ -237,7 +237,7 @@
|
||||
|
||||
<form id="product_form" action="{$form_action}" method="post" enctype="multipart/form-data" name="product" style="display:none;">
|
||||
<input type="hidden" name="id_product" value="{$id_product}" />
|
||||
<input type="hidden" id="is_virtual" name="is_virtual" value="{$product->is_virtual}" />
|
||||
<input type="hidden" id="is_virtual" name="is_virtual" value="{$product->is_virtual|escape:html:'UTF-8'}" />
|
||||
<div class="tab-pane" id="tabPane1">
|
||||
{if !$product->active && $product->isAssociatedToShop()}
|
||||
<div class="warn draft" >
|
||||
|
||||
@@ -78,8 +78,8 @@
|
||||
<table id="lineType" style="display:none;">
|
||||
<tr id="image_id">
|
||||
<td style="padding: 4px;">
|
||||
<a href="{$smarty.const._THEME_PROD_DIR_}image_path.jpg" target="_blank">
|
||||
<img src="{$smarty.const._THEME_PROD_DIR_}en-default-small.jpg" alt="image_id" title="image_id" />
|
||||
<a href="{$smarty.const._THEME_PROD_DIR_}image_path.jpg" class="fancybox">
|
||||
<img src="{$smarty.const._THEME_PROD_DIR_}en-default-small_default.jpg" alt="image_id" title="image_id" />
|
||||
</a>
|
||||
</td>
|
||||
<td id="td_image_id" class="pointer dragHandle center positionImage">
|
||||
@@ -109,6 +109,7 @@
|
||||
var come_from = '{$table}';
|
||||
var success_add = '{l s='image has been successfully added'}';
|
||||
var id_tmp = 0;
|
||||
var current_shop_id = {$current_shop_id|intval};
|
||||
{literal}
|
||||
//Ready Function
|
||||
$(document).ready(function(){
|
||||
@@ -253,6 +254,11 @@
|
||||
$(this).attr("src", $(this).attr("src").replace("enabled", "forbbiden"));
|
||||
});
|
||||
$(this).attr("src", $(this).attr("src").replace("forbbiden", "enabled"));
|
||||
|
||||
if (current_shop_id != 0)
|
||||
$('#'+current_shop_id+id).attr('check', true);
|
||||
else
|
||||
$(this).parent().parent().parent().children('td input').attr('check', true);
|
||||
doAdminAjax({
|
||||
"action":"UpdateCover",
|
||||
"id_image":id,
|
||||
@@ -322,6 +328,7 @@
|
||||
}
|
||||
$("#imageList").append(line);
|
||||
}
|
||||
$('.fancybox').fancybox();
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
<tr>
|
||||
<td class="col-left"><label>{$bullet_common_field} {l s='UPC:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="55" maxlength="12" type="text" name="upc" value="{$product->upc}" style="width: 130px; margin-right: 5px;" /> <span class="small">{l s='(US, Canada)'}</span>
|
||||
<input size="55" maxlength="12" type="text" name="upc" value="{$product->upc|escape:html:'UTF-8'}" style="width: 130px; margin-right: 5px;" /> <span class="small">{l s='(US, Canada)'}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var Customer = new Object();
|
||||
var product_url = '{$link->getAdminLink('AdminProducts', true)}';
|
||||
$(document).ready(function () {
|
||||
var Customer = {
|
||||
Customer = {
|
||||
"hiddenField": jQuery('#id_customer'),
|
||||
"field": jQuery('#customer'),
|
||||
"container": jQuery('#customers'),
|
||||
@@ -166,12 +166,12 @@ $(document).ready(function () {
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<a class="button" href="{$link->getAdminLink('AdminTaxRulesGroup')}&addtax_rules_group&id_product={$product->id}" class="confirm_leave">
|
||||
<a class="button" href="{$link->getAdminLink('AdminTaxRulesGroup')|escape:'htmlall':'UTF-8'}&addtax_rules_group&id_product={$product->id}" class="confirm_leave">
|
||||
<img src="../img/admin/add.gif" alt="{l s='Create'}" title="{l s='Create'}" /> {l s='Create'}
|
||||
</a>
|
||||
</span>
|
||||
{if $tax_exclude_taxe_option}
|
||||
<span style="margin-left:10px; color:red;">{l s='Taxes are currently disabled'}</span> (<b><a href="{$link->getAdminLink('AdminTaxes')}">{l s='Tax options'}</a></b>)
|
||||
<span style="margin-left:10px; color:red;">{l s='Taxes are currently disabled'}</span> (<b><a href="{$link->getAdminLink('AdminTaxes')|escape:'htmlall':'UTF-8'}">{l s='Tax options'}</a></b>)
|
||||
<input type="hidden" value="{$product->getIdTaxRulesGroup()}" name="id_tax_rules_group" />
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
@@ -72,12 +72,21 @@
|
||||
<label>{l s='Carriers:'}</label>
|
||||
</td>
|
||||
<td class="padding-bottom:5px;">
|
||||
<select name="carriers[]" multiple="multiple" size="4" style="height:100px;width:200px;">
|
||||
<select name="carriers[]" id="carriers_restriction" multiple="multiple" size="4" style="height:100px;width:200px;">
|
||||
{foreach $carrier_list as $carrier}
|
||||
<option value="{$carrier.id_reference}" {if isset($carrier.selected) && $carrier.selected}selected="selected"{/if}>{$carrier.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<br>
|
||||
<button class="button" onclick="unselectAllCarriers(); return false;">{l s='Unselect all'}</button>
|
||||
<p class="preference_description">{l s='If no carrier selected, all carriers could be used to ship this product.'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
function unselectAllCarriers()
|
||||
{
|
||||
$('#carriers_restriction option').each(function () { $(this).removeAttr('selected')});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@@ -36,7 +36,7 @@
|
||||
<p>{l s='When using the advanced stock management (see Preferences/Products), the values you fill here (prices, references) will be used in the supply orders.'}</p>
|
||||
</div>
|
||||
<p>{l s='Please choose the suppliers associated with this product, and the default one.'}</p>
|
||||
<a class="button bt-icon confirm_leave" href="{$link->getAdminLink('AdminSuppliers')}&addsupplier">
|
||||
<a class="button bt-icon confirm_leave" href="{$link->getAdminLink('AdminSuppliers')|escape:'htmlall':'UTF-8'}&addsupplier">
|
||||
<img src="../img/admin/add.gif" alt="{l s='Create new supplier'}" title="{l s='Create new supplier'}" /><span>{l s='Create new supplier'}</span>
|
||||
</a>
|
||||
<table cellpadding="5" style="width:100%">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<p>{l s='Please choose the warehouses associated with this product, and the default one.'}</p>
|
||||
|
||||
<a class="button bt-icon confirm_leave" href="{$link->getAdminLink('AdminWarehouses')}&addwarehouse">
|
||||
<a class="button bt-icon confirm_leave" href="{$link->getAdminLink('AdminWarehouses')|escape:'htmlall':'UTF-8'}&addwarehouse">
|
||||
<img src="../img/admin/add.gif" alt="{l s='Create new warehouse'}" title="{l s='Create new warehouse'}" /><span>{l s='Create new warehouse'}</span>
|
||||
</a>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
{if isset($tr.$key)}
|
||||
<a href="{$tr.$key}" onmouseover="$(this).css('text-decoration', 'underline')" onmouseout="$(this).css('text-decoration', 'none')" target="_blank">{$tr.$key}</a>
|
||||
{else}
|
||||
<a href="{$link->getAdminLink('AdminShopUrl')}&id_shop={$tr.$identifier}&addshop_url" class="multishop_warning">{l s='Click here to set an URL for this shop'}</a>
|
||||
<a href="{$link->getAdminLink('AdminShopUrl')|escape:'htmlall':'UTF-8'}&id_shop={$tr.$identifier}&addshop_url" class="multishop_warning">{l s='Click here to set an URL for this shop'}</a>
|
||||
{/if}
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
|
||||
@@ -146,17 +146,27 @@ function toggle_condition_group(id_condition_group)
|
||||
}
|
||||
function add_condition(id_condition_group, type, value)
|
||||
{
|
||||
var id_condition = id_condition_group+'_'+type+'_'+value;
|
||||
if (typeof conditions[id_condition] != 'undefined')
|
||||
return false;
|
||||
var condition = new Array();
|
||||
condition.type = type;
|
||||
condition.value = value;
|
||||
condition.id_condition_group = id_condition_group;
|
||||
conditions.push(condition);
|
||||
conditions[id_condition] = condition;
|
||||
return id_condition;
|
||||
}
|
||||
function delete_condition(condition)
|
||||
{
|
||||
delete conditions[condition];
|
||||
$('#'+condition).remove();
|
||||
return false;
|
||||
}
|
||||
function new_condition_group()
|
||||
{
|
||||
last_condition_group++;
|
||||
var html = '<div class="condition_group" id="condition_group_'+last_condition_group+'"><h3>{l s='Condition group'} '+last_condition_group+'</h3>';
|
||||
html += '<table cellspacing="0" cellpadding="0" class="table width3"><thead><tr><th width="196px" height="39">{l s='Type'}</th><th width="300px">{l s='Value'}</th></tr></thead><tbody></tbody></table>';
|
||||
html += '<table cellspacing="0" cellpadding="0" class="table width3"><thead><tr><th width="196px" height="39">{l s='Type'}</th><th width="300px">{l s='Value'}</th><th></th></tr></thead><tbody></tbody></table>';
|
||||
html += '</div><div class="condition_separator">{l s='OR'}</div><div class="separation"></div>';
|
||||
$('#condition_group_list').append(html);
|
||||
toggle_condition_group(last_condition_group);
|
||||
@@ -170,9 +180,8 @@ $(document).ready(function() {
|
||||
});
|
||||
$('#specific_price_rule_form').live('submit', function(e) {
|
||||
var html = '';
|
||||
$.each(conditions, function() {
|
||||
html += '<input type="hidden" name="condition_group_'+this.id_condition_group+'[]" value="'+this.type+'_'+this.value+'" />';
|
||||
});
|
||||
for (i in conditions)
|
||||
html += '<input type="hidden" name="condition_group_'+conditions[i].id_condition_group+'[]" value="'+conditions[i].type+'_'+conditions[i].value+'" />';
|
||||
$('#conditions').append(html);
|
||||
});
|
||||
$('#id_feature').change(function() {
|
||||
@@ -184,32 +193,42 @@ $(document).ready(function() {
|
||||
$('#id_attribute_'+$(this).val()).show();
|
||||
});
|
||||
$('#add_condition_category').click(function() {
|
||||
add_condition(current_id_condition_group, 'category', $('#id_category option:selected').val());
|
||||
var html = '<tr><td>{l s='Category'}</td><td>'+$('#id_category option:selected').html()+'</td></tr>';
|
||||
var id_condition = add_condition(current_id_condition_group, 'category', $('#id_category option:selected').val());
|
||||
if (!id_condition)
|
||||
return false;
|
||||
var html = '<tr id="'+id_condition+'"><td>{l s='Category'}</td><td>'+$('#id_category option:selected').html()+'</td><td><a href="#" onclick="delete_condition(\''+id_condition+'\');"><img src="../img/admin/delete.gif" /></a></td></tr>';
|
||||
$('#condition_group_'+current_id_condition_group+' table tbody').append(html);
|
||||
return false;
|
||||
});
|
||||
$('#add_condition_manufacturer').click(function() {
|
||||
add_condition(current_id_condition_group, 'manufacturer', $('#id_manufacturer option:selected').val());
|
||||
var html = '<tr><td>{l s='Manufacturer'}</td><td>'+$('#id_manufacturer option:selected').html()+'</td></tr>';
|
||||
var id_condition = add_condition(current_id_condition_group, 'manufacturer', $('#id_manufacturer option:selected').val());
|
||||
if (!id_condition)
|
||||
return false;
|
||||
var html = '<tr id="'+id_condition+'"><td>{l s='Manufacturer'}</td><td>'+$('#id_manufacturer option:selected').html()+'</td><td><a href="#" onclick="delete_condition(\''+id_condition+'\');"><img src="../img/admin/delete.gif" /></a></td></tr>';
|
||||
$('#condition_group_'+current_id_condition_group+' table tbody').append(html);
|
||||
return false;
|
||||
});
|
||||
$('#add_condition_supplier').click(function() {
|
||||
add_condition(current_id_condition_group, 'supplier', $('#id_supplier option:selected').val());
|
||||
var html = '<tr><td>{l s='Supplier'}</td><td>'+$('#id_supplier option:selected').html()+'</td></tr>';
|
||||
var id_condition = add_condition(current_id_condition_group, 'supplier', $('#id_supplier option:selected').val());
|
||||
if (!id_condition)
|
||||
return false;
|
||||
var html = '<tr id="'+id_condition+'"><td>{l s='Supplier'}</td><td>'+$('#id_supplier option:selected').html()+'</td><td><a href="#" onclick="delete_condition(\''+id_condition+'\');"><img src="../img/admin/delete.gif" /></a></td></tr>';
|
||||
$('#condition_group_'+current_id_condition_group+' table tbody').append(html);
|
||||
return false;
|
||||
});
|
||||
$('#add_condition_attribute').click(function() {
|
||||
add_condition(current_id_condition_group, 'attribute', $('#id_attribute_'+$('#id_attribute_group option:selected').val()+' option:selected').val());
|
||||
var html = '<tr><td>{l s='Attribute'}</td><td>'+$('#id_attribute_group option:selected').html()+': '+$('#id_attribute_'+$('#id_attribute_group option:selected').val()+' option:selected').html()+'</td></tr>';
|
||||
var id_condition = add_condition(current_id_condition_group, 'attribute', $('#id_attribute_'+$('#id_attribute_group option:selected').val()+' option:selected').val());
|
||||
if (!id_condition)
|
||||
return false;
|
||||
var html = '<tr id="'+id_condition+'"><td>{l s='Attribute'}</td><td>'+$('#id_attribute_group option:selected').html()+': '+$('#id_attribute_'+$('#id_attribute_group option:selected').val()+' option:selected').html()+'</td><td><a href="#" onclick="delete_condition(\''+id_condition+'\');"><img src="../img/admin/delete.gif" /></a></td></tr>';
|
||||
$('#condition_group_'+current_id_condition_group+' table tbody').append(html);
|
||||
return false;
|
||||
});
|
||||
$('#add_condition_feature').click(function() {
|
||||
add_condition(current_id_condition_group, 'feature', $('#id_feature_'+$('#id_feature option:selected').val()+' option:selected').val());
|
||||
var html = '<tr><td>{l s='Feature'}</td><td>'+$('#id_feature option:selected').html()+': '+$('#id_feature_'+$('#id_feature option:selected').val()+' option:selected').html()+'</td></tr>';
|
||||
var id_condition = add_condition(current_id_condition_group, 'feature', $('#id_feature_'+$('#id_feature option:selected').val()+' option:selected').val());
|
||||
if (!id_condition)
|
||||
return false;
|
||||
var html = '<tr id="'+id_condition+'"><td>{l s='Feature'}</td><td>'+$('#id_feature option:selected').html()+': '+$('#id_feature_'+$('#id_feature option:selected').val()+' option:selected').html()+'</td><td><a href="#" onclick="delete_condition(\''+id_condition+'\');"><img src="../img/admin/delete.gif" /></a></td></tr>';
|
||||
$('#condition_group_'+current_id_condition_group+' table tbody').append(html);
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
{if $key == 'rightCols'}
|
||||
{foreach $field as $input}
|
||||
{if $input.type == 'file'}
|
||||
<label style="text-align: left; width: inherit;">{$input.label} </label>
|
||||
<div class="margin-form" style="padding: 0; display: inline;">
|
||||
<label style="text-align: left; width: inherit;width:250px;text-align:right">{$input.label} </label>
|
||||
<div class="margin-form">
|
||||
<input type="file" name="{$input.name}" />
|
||||
<p class="clear">{$input.desc}</p>
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
@@ -71,7 +71,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin-top: 15px; border: 1px solid #BBB;">
|
||||
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin: 15px 0 20px 260px; border: 1px solid #BBB;">
|
||||
<tr>
|
||||
<th colspan="2">{l s='Hours:'}</th>
|
||||
</tr>
|
||||
|
||||
@@ -68,7 +68,7 @@ $(document).ready(function() {
|
||||
<img src="../img/admin/pdf.gif" alt="{l s='Supply Order State'}">
|
||||
{l s='Print the supply order form'}
|
||||
</legend>
|
||||
<a href="{$link->getAdminLink('AdminPdf')}&submitAction=generateSupplyOrderFormPDF&id_supply_order={$supply_order->id}" target="_blank" title="Export as PDF">{l s='Click here to download the supply order form'}.</a>
|
||||
<a href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateSupplyOrderFormPDF&id_supply_order={$supply_order->id}" target="_blank" title="Export as PDF">{l s='Click here to download the supply order form'}.</a>
|
||||
</fieldset>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<td>
|
||||
<select multiple id="select_right" name="products[]">
|
||||
{foreach from=$field.products item='product'}
|
||||
<option value="{$product.id_product}">{$product.name}</option>
|
||||
<option selected="selected" 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>
|
||||
@@ -78,7 +78,7 @@
|
||||
});
|
||||
$('#tag_form').submit(function()
|
||||
{
|
||||
$('#select_left option').each(function(i){
|
||||
$('#select_right option').each(function(i){
|
||||
$(this).attr("selected", "selected");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,7 +68,8 @@
|
||||
</select>
|
||||
<select name="theme" style="float:left; margin-right:10px;">
|
||||
{foreach $themes as $theme}
|
||||
<option value="{$theme->directory}">{$theme->name} </option>
|
||||
|
||||
<option value="{$theme->directory}" {if $id_theme_current == $theme->id}selected=selected{/if}>{$theme->name} </option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{foreach $languages as $language}
|
||||
@@ -89,7 +90,7 @@
|
||||
<div id="submitAddLangContent" style="float:left;">
|
||||
<p>{l s='You can add or update a language directly from prestashop.com here'}</p>
|
||||
<div class="warn">
|
||||
{l s='If you choose to update an existing language pack, all your previous customization in the theme named prestashop will be lost. This includes Front Office expressions and default e-mail templates.'}
|
||||
{l s='If you choose to update an existing language pack, all your previous customization in the theme named "Default" will be lost. This includes Front Office expressions and default e-mail templates.'}
|
||||
</div>
|
||||
{if $packs_to_update || $packs_to_install}
|
||||
<div style="font-weight:bold; float:left;">{l s='Language you want to add or update:'}
|
||||
@@ -152,7 +153,7 @@
|
||||
|
||||
<select name="theme" style="margin-top:10px;">
|
||||
{foreach $themes as $theme}
|
||||
<option value="{$theme->directory}">{$theme->name}</option>
|
||||
<option value="{$theme->directory}" {if $id_theme_current == $theme->id}selected=selected{/if}>{$theme->name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<input type="submit" class="button" name="submitExport" value="{l s='Export'}" />
|
||||
@@ -176,7 +177,7 @@
|
||||
|
||||
<select name="fromTheme">
|
||||
{foreach $themes as $theme}
|
||||
<option value="{$theme->directory}">{$theme->name}</option>
|
||||
<option value="{$theme->directory}" {if $id_theme_current == $theme->id}selected=selected{/if}>{$theme->name}</option>
|
||||
{/foreach}
|
||||
</select> <span style="font-style: bold; color: red;">*</span>
|
||||
</p>
|
||||
@@ -190,7 +191,7 @@
|
||||
|
||||
<select name="toTheme">
|
||||
{foreach $themes as $theme}
|
||||
<option value="{$theme->directory}">{$theme->name}</option>
|
||||
<option value="{$theme->directory}" {if $id_theme_current == $theme->id}selected=selected{/if}>{$theme->name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</p>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
{block name="override_tpl"}
|
||||
|
||||
{if $post_limit_exceeded}
|
||||
{if !empty($limit_warning)}
|
||||
<div class="warn">
|
||||
{if $limit_warning['error_type'] == 'suhosin'}
|
||||
{l s='Warning, your hosting provider is using the suhosin patch for PHP, which limits the maximum number of fields to post in a form:'}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
{block name="override_tpl"}
|
||||
|
||||
{if $post_limit_exceeded}
|
||||
{if !empty($limit_warning)}
|
||||
<div class="warn">
|
||||
{if $limit_warning['error_type'] == 'suhosin'}
|
||||
{l s='Warning, your hosting provider is using the suhosin patch for PHP, which limits the maximum number of fields to post in a form:'}
|
||||
@@ -37,7 +37,7 @@
|
||||
<b>{$limit_warning['request.max_vars']}</b> {l s='for suhosin.request.max_vars.'}<br/>
|
||||
{l s='Please ask your hosting provider to increase the suhosin post and request a limit of'}
|
||||
{else}
|
||||
{l s='Warning, your PHP configuration limits the maximum number of fields to post in a form:'}<br/>
|
||||
{l s='Warning, your PHP configuration limits the maximum number of fields to post in a form:'}
|
||||
<b>{$limit_warning['max_input_vars']}</b> {l s='for max_input_vars.'}<br/>
|
||||
{l s='Please ask your hosting provider to increase the this limit to'}
|
||||
{/if}
|
||||
@@ -128,6 +128,7 @@
|
||||
</fieldset><br />
|
||||
{/if}
|
||||
{/foreach}
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
{$tinyMCE}
|
||||
|
||||
{if $post_limit_exceeded}
|
||||
{if !empty($limit_warning)}
|
||||
<div class="warn">
|
||||
{if $limit_warning['error_type'] == 'suhosin'}
|
||||
{l s='Warning, your hosting provider is using the suhosin patch for PHP, which limits the maximum number of fields to post in a form:'}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
{block name="override_tpl"}
|
||||
|
||||
{if $post_limit_exceeded}
|
||||
{if !empty($limit_warning)}
|
||||
<div class="warn">
|
||||
{if $limit_warning['error_type'] == 'suhosin'}
|
||||
{l s='Warning, your hosting provider is using the suhosin patch for PHP, which limits the maximum number of fields to post in a form:'}
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div style="clear:both;height:0;line-height:0"> </div>
|
||||
</div>
|
||||
<div style="clear:both;height:0;line-height:0"> </div>
|
||||
</div>
|
||||
{if $display_footer}
|
||||
{hook h="displayBackOfficeFooter"}
|
||||
|
||||
@@ -80,20 +80,21 @@
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
<link rel="shortcut icon" href="{$img_dir}favicon.ico" />
|
||||
{if $display_header}
|
||||
{hook h="displayBackOfficeHeader"}
|
||||
<link rel="icon" type="image/vnd.microsoft.icon" href="{$img_dir}favicon.ico" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{$img_dir}favicon.ico" />
|
||||
{if isset($displayBackOfficeHeader)}
|
||||
{$displayBackOfficeHeader}
|
||||
{/if}
|
||||
<!--[if IE]>
|
||||
<link type="text/css" rel="stylesheet" href="{$base_url}css/admin-ie.css" />
|
||||
<![endif]-->
|
||||
{if isset($brightness)}
|
||||
<style type="text/css">
|
||||
div#header_infos, div#header_infos a#header_shopname, div#header_infos a#header_logout, div#header_infos a#header_foaccess {
|
||||
color:{$brightness}
|
||||
}
|
||||
div#header_infos, div#header_infos a#header_shopname, div#header_infos a#header_logout, div#header_infos a#header_foaccess {ldelim}color:{$brightness}{rdelim}
|
||||
</style>
|
||||
{/if}
|
||||
</head>
|
||||
<body style="{if $bo_color}background:{$bo_color};{/if}{if $bo_width > 0}text-align:center;{/if}">
|
||||
<body style="{if isset($bo_color) && $bo_color}background:{$bo_color};{/if}{if isset($bo_width) && $bo_width > 0}text-align:center;{/if}">
|
||||
{if $display_header}
|
||||
<div id="ajax_running"><img src="../img/admin/ajax-loader-yellow.gif" alt="" /> {l s='Loading...'}</div>
|
||||
|
||||
@@ -102,60 +103,61 @@
|
||||
{* begin HEADER *}
|
||||
<div id="header">
|
||||
<div id="header_infos">
|
||||
<a id="header_shopname" href="{$link->getAdminLink('AdminHome')}"><span>{$shop_name}</span></a><div id="notifs_icon_wrapper">
|
||||
{if {$show_new_orders} == 1}
|
||||
<div id="orders_notif" class="notifs">
|
||||
<span id="orders_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="orders_notif_value">0</span>
|
||||
</span>
|
||||
<div id="orders_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last orders'}</h3>
|
||||
<p class="no_notifs">{l s='No new orders has been placed on your shop'}</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminOrders&token={getAdminToken tab='AdminOrders'}">{l s='Show all orders'}</a></p>
|
||||
<a id="header_shopname" href="{$link->getAdminLink('AdminHome')|escape:'htmlall':'UTF-8'}"><span>{$shop_name}</span></a>
|
||||
<div id="notifs_icon_wrapper">
|
||||
{if {$show_new_orders} == 1}
|
||||
<div id="orders_notif" class="notifs">
|
||||
<span id="orders_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="orders_notif_value">0</span>
|
||||
</span>
|
||||
<div id="orders_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last orders'}</h3>
|
||||
<p class="no_notifs">{l s='No new orders has been placed on your shop'}</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminOrders&token={getAdminToken tab='AdminOrders'}">{l s='Show all orders'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if ($show_new_customers == 1)}
|
||||
<div id="customers_notif" class="notifs notifs_alternate">
|
||||
<span id="customers_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customers_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customers_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last customers'}</h3>
|
||||
<p class="no_notifs">{l s='No new customers registered on your shop'}</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminCustomers&token={getAdminToken tab='AdminCustomers'}">{l s='Show all customers'}</a></p>
|
||||
{/if}
|
||||
{if ($show_new_customers == 1)}
|
||||
<div id="customers_notif" class="notifs notifs_alternate">
|
||||
<span id="customers_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customers_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customers_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last customers'}</h3>
|
||||
<p class="no_notifs">{l s='No new customers registered on your shop'}</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminCustomers&token={getAdminToken tab='AdminCustomers'}">{l s='Show all customers'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if {$show_new_messages} == 1}
|
||||
<div id="customer_messages_notif" class="notifs">
|
||||
<span id="customer_messages_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customer_messages_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customer_messages_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last messages'}</h3>
|
||||
<p class="no_notifs">{l s='No new messages posted on your shop'}</p>
|
||||
<ul id="list_customer_messages_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminCustomerThreads&token={getAdminToken tab='AdminCustomerThreads'}">{l s='Show all messages'}</a></p>
|
||||
{/if}
|
||||
{if {$show_new_messages} == 1}
|
||||
<div id="customer_messages_notif" class="notifs">
|
||||
<span id="customer_messages_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customer_messages_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customer_messages_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last messages'}</h3>
|
||||
<p class="no_notifs">{l s='No new messages posted on your shop'}</p>
|
||||
<ul id="list_customer_messages_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminCustomerThreads&token={getAdminToken tab='AdminCustomerThreads'}">{l s='Show all messages'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<span id="employee_links">
|
||||
{/if}
|
||||
</div>
|
||||
<div id="employee_links">
|
||||
<span class="employee_name">{$first_name} {$last_name}</span>
|
||||
<span class="separator"></span>
|
||||
<a class="employee" href="index.php?controller=AdminEmployees&id_employee={$employee->id}&updateemployee&token={getAdminToken tab='AdminEmployees'}" alt="" /> {l s='My preferences'}</a>
|
||||
<span class="separator"></span><a href="index.php?logout" id="header_logout">
|
||||
<span>{l s='logout'}</span>
|
||||
</a>
|
||||
{if {$base_url}}
|
||||
<span class="separator"></span> <a href="{$base_url}" id="header_foaccess" target="_blank" title="{l s='View my shop'}"><span>{l s='View my shop'}</span></a>
|
||||
{/if}
|
||||
</span>
|
||||
<span class="separator"> </span>
|
||||
<a class="employee" href="index.php?controller=AdminEmployees&id_employee={$employee->id}&updateemployee&token={getAdminToken tab='AdminEmployees'}" alt="">{l s='My preferences'}</a>
|
||||
<span class="separator"> </span>
|
||||
<a href="index.php?logout" id="header_logout">{l s='logout'}</a>
|
||||
{if {$base_url}}
|
||||
<span class="separator"> </span>
|
||||
<a href="{$base_url}" id="header_foaccess" target="_blank" title="{l s='View my shop'}">{l s='View my shop'}</a>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token={getAdminToken tab='AdminSearch'}">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token={getAdminToken tab='AdminSearch'}">
|
||||
<input type="text" name="bo_query" id="bo_query" value="{$bo_query}" />
|
||||
<select name="bo_search_type" id="bo_search_type" class="chosen no-search">
|
||||
<option value="0">{l s='everywhere'}</option>
|
||||
@@ -178,42 +180,52 @@
|
||||
function quickSelect(elt)
|
||||
{
|
||||
var eltVal = $(elt).val();
|
||||
if (eltVal == "0") return false;
|
||||
else if (eltVal.substr(eltVal.length - 6) == '_blank') window.open(eltVal.substr(0, eltVal.length - 6), '_blank');
|
||||
else location.href = eltVal;
|
||||
if (eltVal == "0")
|
||||
return false;
|
||||
else if (eltVal.substr(eltVal.length - 6) == '_blank')
|
||||
window.open(eltVal.substr(0, eltVal.length - 6), '_blank');
|
||||
else
|
||||
location.href = eltVal;
|
||||
}
|
||||
</script>
|
||||
<select onchange="quickSelect(this);" id="quick_select" class="chosen no-search">
|
||||
<option value="0">{l s='Quick Access'}</option>
|
||||
{foreach $quick_access as $quick}
|
||||
<option value="{$quick.link}{if $quick.new_window}_blank{/if}">» {$quick.name}</option>
|
||||
<option value="{$quick.link|escape:'htmlall':'UTF-8'}{if $quick.new_window}_blank{/if}">» {$quick.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($displayBackOfficeTop)}
|
||||
{$displayBackOfficeTop}
|
||||
{/if}
|
||||
</div>{* end header_infos*}
|
||||
|
||||
{hook h="displayBackOfficeTop"}
|
||||
</div>
|
||||
<ul id="menu">
|
||||
{if !$tab}
|
||||
<div class="mainsubtablist" style="display:none">
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<span class="title">
|
||||
<img src="{$t.img}" alt="" />{if $t.name eq ''}{$t.class_name}{else}{$t.name}{/if}
|
||||
</span>
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
<li><a href="{$t2.href}">{if $t2.name eq ''}{$t2.class_name}{else}{$t2.name}{/if}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{if $t.active}
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<span class="title">
|
||||
<img src="{$t.img}" alt="" />{if $t.name eq ''}{$t.class_name}{else}{$t.name}{/if}
|
||||
</span>
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
{if $t2.active}
|
||||
<li><a href="{$t2.href|escape:'htmlall':'UTF-8'}">{if $t2.name eq ''}{$t2.class_name}{else}{$t2.name|escape:'htmlall':'UTF-8'}{/if}</a></li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div> {* end header *}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>{* end header*}
|
||||
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
{if $display_header && $install_dir_exists}
|
||||
@@ -224,7 +236,7 @@
|
||||
|
||||
{if $display_header && $is_multishop && $shop_list && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)}
|
||||
<div class="multishop_toolbar">
|
||||
<span class="text_multishop">{l s='Multishop configuration for'}</span>
|
||||
<span class="text_multishop">{l s='Multistore configuration for'}</span>
|
||||
{$shop_list}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
{$input.required = false}
|
||||
{$input.desc = null}
|
||||
{else}
|
||||
<select name="{$input.name}" class=""
|
||||
<select name="{$input.name}" class="{if isset($input.class)}{$input.class}{/if}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
{if isset($input.multiple)}multiple="multiple" {/if}
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
@@ -213,12 +213,12 @@
|
||||
<div class="translatable">
|
||||
{foreach $languages as $language}
|
||||
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}" {if isset($input.autoload_rte) && $input.autoload_rte}class="rte autoload_rte"{/if} >{$fields_value[$input.name][$language.id_lang]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}" {if isset($input.autoload_rte) && $input.autoload_rte}class="rte autoload_rte {if isset($input.class)}{$input.class}{/if}"{/if} >{$fields_value[$input.name][$language.id_lang]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{else}
|
||||
<textarea name="{$input.name}" cols="{$input.cols}" rows="{$input.rows}" {if isset($input.autoload_rte) && $input.autoload_rte}class="rte autoload_rte"{/if}>{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
<textarea name="{$input.name}" id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" cols="{$input.cols}" rows="{$input.rows}" {if isset($input.autoload_rte) && $input.autoload_rte}class="rte autoload_rte {if isset($input.class)}{$input.class}{/if}"{/if}>{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
{/if}
|
||||
{elseif $input.type == 'checkbox'}
|
||||
{foreach $input.values.query as $value}
|
||||
@@ -226,6 +226,7 @@
|
||||
<input type="checkbox"
|
||||
name="{$id_checkbox}"
|
||||
id="{$id_checkbox}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}"
|
||||
{if isset($value.val)}value="{$value.val|escape:'htmlall':'UTF-8'}"{/if}
|
||||
{if isset($fields_value[$id_checkbox]) && $fields_value[$id_checkbox]}checked="checked"{/if} />
|
||||
<label for="{$id_checkbox}" class="t"><strong>{$value[$input.values.name]}</strong></label><br />
|
||||
@@ -248,11 +249,12 @@
|
||||
<input type="password"
|
||||
name="{$input.name}"
|
||||
size="{$input.size}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}"
|
||||
value=""
|
||||
{if isset($input.autocomplete) && !$input.autocomplete}autocomplete="off"{/if} />
|
||||
{elseif $input.type == 'birthday'}
|
||||
{foreach $input.options as $key => $select}
|
||||
<select name="{$key}" class="">
|
||||
<select name="{$key}" class="{if isset($input.class)}{$input.class}{/if}">
|
||||
<option value="">-</option>
|
||||
{if $key == 'months'}
|
||||
{*
|
||||
@@ -299,6 +301,7 @@
|
||||
{if isset($input.class)}class="{$input.class}"
|
||||
{else}class="color mColorPickerInput"{/if}
|
||||
name="{$input.name}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}"
|
||||
value="{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}" />
|
||||
{elseif $input.type == 'date'}
|
||||
<input type="text"
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
{block name="td_content"}
|
||||
{if isset($params.prefix)}{$params.prefix}{/if}
|
||||
{if isset($params.color) && isset($tr[$params.color])}
|
||||
<span class="color_field" style="background-color: {$tr.color}">
|
||||
<span class="color_field" style="background-color:{$tr.color};color:{if Tools::getBrightness($tr.color) < 128}white{else}#383838{/if}">
|
||||
{/if}
|
||||
|
||||
{if isset($params.active)}
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$table}').value=1"/>
|
||||
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$table}').value={$page - 1}"/>
|
||||
{/if}
|
||||
{l s='Page'}<b>{$page}</b> / {$total_pages}
|
||||
{l s='Page'} <b>{$page}</b> / {$total_pages}
|
||||
{if $page < $total_pages}
|
||||
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$table}').value={$page + 1}"/>
|
||||
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$table}').value={$total_pages}"/>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
</ul>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
//<![CDATA[
|
||||
var submited = false
|
||||
$(function() {
|
||||
//get reference on save link
|
||||
@@ -108,6 +109,7 @@
|
||||
{/block}
|
||||
}
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
{/block}
|
||||
<div class="pageTitle">
|
||||
@@ -118,7 +120,7 @@
|
||||
{* Use strip_tags because if the string already has been through htmlentities using escape will break it *}
|
||||
<span class="breadcrumb item-{$key} ">{$item|strip_tags}
|
||||
{if !$smarty.foreach.title.last}
|
||||
<img alt=">" style="margin-right:5px" src="../img/admin/separator_breadcrum.png">
|
||||
<img alt=">" style="margin-right:5px" src="../img/admin/separator_breadcrumb.png" />
|
||||
{/if}
|
||||
</span>
|
||||
{/foreach}
|
||||
|
||||
@@ -175,6 +175,17 @@ class AddressCore extends ObjectModel
|
||||
Customer::resetAddressCache($this->id_customer);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($null_values = false)
|
||||
{
|
||||
// Empty related caches
|
||||
if (isset(self::$_idCountries[$this->id]))
|
||||
unset(self::$_idCountries[$this->id]);
|
||||
if (isset(self::$_idZones[$this->id]))
|
||||
unset(self::$_idZones[$this->id]);
|
||||
|
||||
return parent::update($null_values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ObjectModel::delete()
|
||||
|
||||
@@ -45,7 +45,7 @@ class AddressFormatCore extends ObjectModel
|
||||
'table' => 'address_format',
|
||||
'primary' => 'id_country',
|
||||
'fields' => array(
|
||||
'format' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'format' => array('type' => self::TYPE_HTML, 'validate' => 'isGenericName', 'required' => true),
|
||||
'id_country' => array('type' => self::TYPE_INT),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -459,12 +459,12 @@ abstract class AdminTabCore
|
||||
foreach ($rules['required'] as $field)
|
||||
if (($value = Tools::getValue($field)) == false && (string)$value != '0')
|
||||
if (!Tools::getValue($this->identifier) || ($field != 'passwd' && $field != 'no-picture'))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is required');
|
||||
$this->_errors[] = sprintf(Tools::displayError('The field %s is required.'), call_user_func(array($className, 'displayFieldName'), $field, $className));
|
||||
|
||||
/* Checking for multilingual required fields */
|
||||
foreach ($rules['requiredLang'] as $fieldLang)
|
||||
if (($empty = Tools::getValue($fieldLang.'_'.$defaultLanguage->id)) === false || $empty !== '0' && empty($empty))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).'</b> '.$this->l('is required at least in').' '.$defaultLanguage->name;
|
||||
$this->_errors[] = sprintf(Tools::displayError('The field %1$s is required at least in %2$s.'), call_user_func(array($className, 'displayFieldName'), $fieldLang, $className), $defaultLanguage->name);
|
||||
|
||||
/* Checking for maximum fields sizes */
|
||||
foreach ($rules['size'] as $field => $maxLength)
|
||||
@@ -474,11 +474,9 @@ abstract class AdminTabCore
|
||||
/* Checking for maximum multilingual fields size */
|
||||
foreach ($rules['sizeLang'] as $fieldLang => $maxLength)
|
||||
foreach ($languages as $language)
|
||||
{
|
||||
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[] = $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 */
|
||||
$this->_childValidation();
|
||||
|
||||
@@ -486,15 +484,15 @@ abstract class AdminTabCore
|
||||
foreach ($rules['validate'] AS $field => $function)
|
||||
if (($value = Tools::getValue($field)) !== false AND !empty($value) AND ($field != 'passwd'))
|
||||
if (!Validate::$function($value))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid');
|
||||
$this->_errors[] = sprintf(Tools::displayError('The field %1$s (%2$s) is invalid.'), call_user_func(array($className, 'displayFieldName'), $field, $className));
|
||||
|
||||
/* Checking for passwd_old validity */
|
||||
if (($value = Tools::getValue('passwd')) != false)
|
||||
{
|
||||
if ($className == 'Employee' && !Validate::isPasswdAdmin($value))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), 'passwd', $className).'</b> '.$this->l('is invalid');
|
||||
$this->_errors[] = sprintf(Tools::displayError('The field %1$s (%2$s) is invalid.'), call_user_func(array($className, 'displayFieldName'), 'passwd', $className));
|
||||
elseif ($className == 'Customer' && !Validate::isPasswd($value))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), 'passwd', $className).'</b> '.$this->l('is invalid');
|
||||
$this->_errors[] = sprintf(Tools::displayError('The field %1$s (%2$s) is invalid.'), call_user_func(array($className, 'displayFieldName'), 'passwd', $className));
|
||||
}
|
||||
|
||||
/* Checking for multilingual fields validity */
|
||||
@@ -502,7 +500,7 @@ abstract class AdminTabCore
|
||||
foreach ($languages as $language)
|
||||
if (($value = Tools::getValue($fieldLang.'_'.$language['id_lang'])) !== false && !empty($value))
|
||||
if (!Validate::$function($value))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is invalid');
|
||||
$this->_errors[] = sprintf(Tools::displayError('The field %1$s (%2$s) is invalid.'), call_user_func(array($className, 'displayFieldName'), $fieldLang, $className), $language['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ class AttributeCore extends ObjectModel
|
||||
|
||||
// Lang fields
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -75,13 +75,15 @@ class AttributeCore extends ObjectModel
|
||||
{
|
||||
if (!$this->hasMultishopEntries())
|
||||
{
|
||||
$combinations = new Collection('Combination');
|
||||
$combinations->where($this->def['primary'], '=', $this->id);
|
||||
foreach ($combinations as $combination)
|
||||
$result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id);
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$combination = new Combination($row['id_product_attribute']);
|
||||
$combination->delete();
|
||||
}
|
||||
|
||||
// Delete associated restrictions on cart rules
|
||||
CartRule::cleanProductRuleIntegrity('attributes', $this->id);
|
||||
// Delete associated restrictions on cart rules
|
||||
CartRule::cleanProductRuleIntegrity('attributes', $this->id);
|
||||
|
||||
/* Reinitializing position */
|
||||
$this->cleanPositions((int)$this->id_attribute_group);
|
||||
|
||||
@@ -45,7 +45,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'is_color_group' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'group_type' => array('type' => self::TYPE_STRING),
|
||||
'group_type' => array('type' => self::TYPE_STRING, 'required' => true),
|
||||
'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
|
||||
// Lang fields
|
||||
@@ -139,6 +139,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
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;
|
||||
$this->cleanPositions();
|
||||
}
|
||||
$return = parent::delete();
|
||||
if ($return)
|
||||
|
||||
@@ -93,32 +93,24 @@ class Autoload
|
||||
// If requested class does not exist, load associated core class
|
||||
if (isset($this->index[$classname]) && !$this->index[$classname])
|
||||
{
|
||||
require_once($this->root_dir.$this->index[$classname.'Core']);
|
||||
if (file_exists($this->root_dir.'override/'.$this->index[$classname.'Core']))
|
||||
{
|
||||
$this->generateIndex();
|
||||
require_once($this->root_dir.$this->index[$classname]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Since the classname does not exists (we only have a classCore class), we have to emulate the declaration of this class
|
||||
$class_infos = new ReflectionClass($classname.'Core');
|
||||
eval(($class_infos->isAbstract() ? 'abstract ' : '').'class '.$classname.' extends '.$classname.'Core {}');
|
||||
}
|
||||
require($this->root_dir.$this->index[$classname.'Core']);
|
||||
|
||||
// Since the classname does not exists (we only have a classCore class), we have to emulate the declaration of this class
|
||||
$class_infos = new ReflectionClass($classname.'Core');
|
||||
eval(($class_infos->isAbstract() ? 'abstract ' : '').'class '.$classname.' extends '.$classname.'Core {}');
|
||||
}
|
||||
else
|
||||
{
|
||||
// request a non Core Class load the associated Core class if exists
|
||||
if (isset($this->index[$classname.'Core']))
|
||||
require_once($this->root_dir.$this->index[$classname.'Core']);
|
||||
|
||||
if (isset($this->index[$classname]))
|
||||
require_once($this->root_dir.$this->index[$classname]);
|
||||
}
|
||||
}
|
||||
// Call directly ProductCore, ShopCore class
|
||||
else
|
||||
require_once($this->root_dir.$this->index[$classname]);
|
||||
require($this->root_dir.$this->index[$classname]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,7 +177,7 @@ class Autoload
|
||||
$classes = array_merge($classes, $this->getClassesFromDir($path.$file.'/'));
|
||||
else if (substr($file, -4) == '.php')
|
||||
{
|
||||
$content = file_get_contents($this->root_dir.$path.$file);
|
||||
$content = file_get_contents($this->root_dir.$path.$file);
|
||||
$pattern = '#\W((abstract\s+)?class|interface)\s+(?P<classname>'.basename($file, '.php').'(Core)?)'
|
||||
.'(\s+extends\s+[a-z][a-z0-9_]*)?(\s+implements\s+[a-z][a-z0-9_]*(\s*,\s*[a-z][a-z0-9_]*)*)?\s*\{#i';
|
||||
if (preg_match($pattern, $content, $m))
|
||||
|
||||
@@ -202,6 +202,7 @@ class CarrierCore extends ObjectModel
|
||||
{
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
$this->cleanPositions();
|
||||
return (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_rule_carrier WHERE id_carrier = '.(int)$this->id) &&
|
||||
$this->deleteTaxRulesGroup(Shop::getShops(true, null, true)));
|
||||
|
||||
@@ -594,7 +595,7 @@ class CarrierCore extends ObjectModel
|
||||
|
||||
public static function checkCarrierZone($id_carrier, $id_zone)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT c.`id_carrier`
|
||||
FROM `'._DB_PREFIX_.'carrier` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'carrier_zone` cz ON (cz.`id_carrier` = c.`id_carrier`)
|
||||
@@ -847,6 +848,8 @@ class CarrierCore extends ObjectModel
|
||||
(SELECT '.(int)$this->id.', `id_tax_rules_group`, `id_shop`
|
||||
FROM `'._DB_PREFIX_.'carrier_tax_rules_group_shop`
|
||||
WHERE `id_carrier`='.(int)$old_id.')');
|
||||
// Update warehouse_carriers
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'warehouse_carrier SET id_carrier='.(int)$this->id.' WHERE id_carrier='.(int)$old_id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1154,18 +1157,22 @@ class CarrierCore extends ObjectModel
|
||||
$query->select('id_carrier');
|
||||
$query->from('product_carrier', 'pc');
|
||||
$query->innerJoin('carrier', 'c', 'c.id_reference = pc.id_carrier_reference AND c.deleted = 0');
|
||||
$query->where('id_product = '.(int)$product->id);
|
||||
$query->where('id_shop = '.(int)$id_shop);
|
||||
$query->where('pc.id_product = '.(int)$product->id);
|
||||
$query->where('pc.id_shop = '.(int)$id_shop);
|
||||
|
||||
$carriers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
|
||||
|
||||
if (!empty($carriers))
|
||||
{
|
||||
//the product is linked with carriers
|
||||
$carrier_list = array();
|
||||
foreach ($carriers as $carrier)
|
||||
foreach ($carriers as $carrier) //check if the linked carriers are available in current zone
|
||||
if (Carrier::checkCarrierZone($carrier['id_carrier'], $id_zone))
|
||||
$carrier_list[] = $carrier['id_carrier'];
|
||||
if (!empty($carrier_list))
|
||||
return $carrier_list;
|
||||
else
|
||||
return array();//no linked carrier are available for this zone
|
||||
}
|
||||
|
||||
$carrier_list = array();
|
||||
|
||||
127
classes/Cart.php
127
classes/Cart.php
@@ -172,7 +172,9 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
if (!$this->id_lang)
|
||||
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
if (!$this->id_shop)
|
||||
$this->id_shop = Context::getContext()->shop->id;
|
||||
|
||||
$return = parent::add($autodate);
|
||||
Hook::exec('actionCartSave');
|
||||
|
||||
@@ -203,12 +205,12 @@ class CartCore extends ObjectModel
|
||||
public function updateAddressId($id_address, $id_address_new)
|
||||
{
|
||||
$to_update = false;
|
||||
if ($this->id_address_invoice == $id_address)
|
||||
if (!isset($this->id_address_invoice) || $this->id_address_invoice == $id_address)
|
||||
{
|
||||
$to_update = true;
|
||||
$this->context->cart->id_address_invoice = $id_address_new;
|
||||
}
|
||||
if ($this->id_address_delivery == $id_address)
|
||||
if (!isset($this->id_address_delivery) || $this->id_address_delivery == $id_address)
|
||||
{
|
||||
$to_update = true;
|
||||
$this->id_address_delivery = $id_address_new;
|
||||
@@ -221,6 +223,12 @@ class CartCore extends ObjectModel
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
AND `id_address_delivery` = '.(int)$id_address;
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'UPDATE `'._DB_PREFIX_.'customization`
|
||||
SET `id_address_delivery` = '.(int)$id_address_new.'
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
AND `id_address_delivery` = '.(int)$id_address;
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
@@ -409,6 +417,12 @@ class CartCore extends ObjectModel
|
||||
return $this->_products;
|
||||
}
|
||||
|
||||
$shop_group = Shop::getGroupFromShop(Shop::getContextShopID(), false);
|
||||
if ($shop_group['share_order'])
|
||||
$id_shop = 'cp.id_shop';
|
||||
else
|
||||
$id_shop = (int)Shop::getContextShopID();
|
||||
|
||||
if (!$id_country)
|
||||
$id_country = Context::getContext()->country->id;
|
||||
|
||||
@@ -429,10 +443,10 @@ class CartCore extends ObjectModel
|
||||
|
||||
// Build JOIN
|
||||
$sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
|
||||
$sql->join(Shop::addSqlAssociation('product', 'p'));
|
||||
$sql->innerJoin('product_shop', 'product_shop', 'product_shop.id_shop='.$id_shop);
|
||||
$sql->leftJoin('product_lang', 'pl', '
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('pl')
|
||||
AND pl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('pl', $id_shop)
|
||||
);
|
||||
|
||||
$sql->leftJoin('tax_rule', 'tr', '
|
||||
@@ -449,7 +463,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
$sql->leftJoin('category_lang', 'cl', '
|
||||
product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('cl')
|
||||
AND cl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('cl', $id_shop)
|
||||
);
|
||||
|
||||
// @todo test if everything is ok, then refactorise call of this method
|
||||
@@ -490,7 +504,7 @@ class CartCore extends ObjectModel
|
||||
');
|
||||
|
||||
$sql->leftJoin('product_attribute', 'pa', 'pa.`id_product_attribute` = cp.`id_product_attribute`');
|
||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false));
|
||||
$sql->leftJoin('product_attribute_shop', 'product_attribute_shop', 'product_attribute_shop.id_shop='.$id_shop);
|
||||
$sql->leftJoin('product_attribute_image', 'pai', 'pai.`id_product_attribute` = pa.`id_product_attribute`');
|
||||
$sql->leftJoin('image_lang', 'il', 'il.id_image = pai.id_image AND il.id_lang = '.(int)$this->id_lang);
|
||||
}
|
||||
@@ -517,6 +531,7 @@ class CartCore extends ObjectModel
|
||||
if (empty($result))
|
||||
return array();
|
||||
|
||||
$cart_shop_context = Context::getContext()->cloneContext();
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (isset($row['ecotax_attr']) && $row['ecotax_attr'] > 0)
|
||||
@@ -536,6 +551,9 @@ class CartCore extends ObjectModel
|
||||
if (!Address::addressExists($address_id))
|
||||
$address_id = null;
|
||||
|
||||
if ($cart_shop_context->shop->id != $row['id_shop'])
|
||||
$cart_shop_context->shop = new Shop((int)$row['id_shop']);
|
||||
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
{
|
||||
$row['price'] = Product::getPriceStatic(
|
||||
@@ -551,7 +569,10 @@ class CartCore extends ObjectModel
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$specific_price_output
|
||||
$specific_price_output,
|
||||
true,
|
||||
true,
|
||||
$cart_shop_context
|
||||
); // Here taxes are computed only once the quantity has been applied to the product price
|
||||
|
||||
$row['price_wt'] = Product::getPriceStatic(
|
||||
@@ -566,7 +587,11 @@ class CartCore extends ObjectModel
|
||||
false,
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null)
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$null,
|
||||
true,
|
||||
true,
|
||||
$cart_shop_context
|
||||
);
|
||||
|
||||
$tax_rate = Tax::getProductTaxRate((int)$row['id_product'], (int)$address_id);
|
||||
@@ -580,7 +605,7 @@ class CartCore extends ObjectModel
|
||||
(int)$row['id_product'],
|
||||
false,
|
||||
(int)$row['id_product_attribute'],
|
||||
6,
|
||||
2,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
@@ -589,7 +614,10 @@ class CartCore extends ObjectModel
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$specific_price_output
|
||||
$specific_price_output,
|
||||
true,
|
||||
true,
|
||||
$cart_shop_context
|
||||
);
|
||||
|
||||
$row['price_wt'] = Product::getPriceStatic(
|
||||
@@ -604,9 +632,13 @@ class CartCore extends ObjectModel
|
||||
false,
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null)
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$null,
|
||||
true,
|
||||
true,
|
||||
$cart_shop_context
|
||||
);
|
||||
|
||||
|
||||
// In case when you use QuantityDiscount, getPriceStatic() can be return more of 2 decimals
|
||||
$row['price_wt'] = Tools::ps_round($row['price_wt'], 2);
|
||||
$row['total_wt'] = $row['price_wt'] * (int)$row['cart_quantity'];
|
||||
@@ -616,10 +648,11 @@ class CartCore extends ObjectModel
|
||||
if (!isset($row['pai_id_image']) || $row['pai_id_image'] == 0)
|
||||
{
|
||||
$row2 = Db::getInstance()->getRow('
|
||||
SELECT i.`id_image`, il.`legend`
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.')
|
||||
WHERE i.`id_product` = '.(int)$row['id_product'].' AND i.`cover` = 1'
|
||||
SELECT image_shop.`id_image` id_image, il.`legend`
|
||||
FROM `'._DB_PREFIX_.'image` i'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.')
|
||||
WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1'
|
||||
);
|
||||
|
||||
if (!$row2)
|
||||
@@ -778,8 +811,9 @@ class CartCore extends ObjectModel
|
||||
$sql .= '
|
||||
WHERE cp.`id_product` = '.(int)$id_product.'
|
||||
AND cp.`id_product_attribute` = '.(int)$id_product_attribute.'
|
||||
AND cp.`id_cart` = '.(int)$this->id.'
|
||||
AND cp.`id_address_delivery` = '.(int)$id_address_delivery;
|
||||
AND cp.`id_cart` = '.(int)$this->id;
|
||||
if (Configuration::get('PS_ALLOW_MULTISHIPPING') && $this->isMultiAddressDelivery())
|
||||
$sql .= ' AND cp.`id_address_delivery` = '.(int)$id_address_delivery;
|
||||
|
||||
if ($id_customization)
|
||||
$sql .= ' AND c.`id_customization` = '.(int)$id_customization;
|
||||
@@ -883,7 +917,7 @@ class CartCore extends ObjectModel
|
||||
SET `quantity` = `quantity` '.$qty.', `date_add` = NOW()
|
||||
WHERE `id_product` = '.(int)$id_product.
|
||||
(!empty($id_product_attribute) ? ' AND `id_product_attribute` = '.(int)$id_product_attribute : '').'
|
||||
AND `id_cart` = '.(int)$this->id.' AND `id_address_delivery` = '.(int)$id_address_delivery.'
|
||||
AND `id_cart` = '.(int)$this->id.(Configuration::get('PS_ALLOW_MULTISHIPPING') && $this->isMultiAddressDelivery() ? ' AND `id_address_delivery` = '.(int)$id_address_delivery : '').'
|
||||
LIMIT 1'
|
||||
);
|
||||
}
|
||||
@@ -1228,14 +1262,14 @@ class CartCore extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getTotalCart($id_cart, $use_tax_display = false)
|
||||
public static function getTotalCart($id_cart, $use_tax_display = false, $type = CART::BOTH)
|
||||
{
|
||||
$cart = new Cart($id_cart);
|
||||
if (!Validate::isLoadedObject($cart))
|
||||
die(Tools::displayError());
|
||||
|
||||
$with_taxes = $use_tax_display ? $cart->_taxCalculationMethod != PS_TAX_EXC : true;
|
||||
return Tools::displayPrice($cart->getOrderTotal($with_taxes), Currency::getCurrencyInstance((int)$cart->id_currency), false);
|
||||
return Tools::displayPrice($cart->getOrderTotal($with_taxes, $type), Currency::getCurrencyInstance((int)$cart->id_currency), false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1334,6 +1368,9 @@ class CartCore extends ObjectModel
|
||||
|
||||
foreach ($products as $product) // products refer to the cart details
|
||||
{
|
||||
if ($virtual_context->shop->id != $product['id_shop'])
|
||||
$virtual_context->shop = new Shop((int)$product['id_shop']);
|
||||
|
||||
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_invoice')
|
||||
$address_id = (int)$this->id_address_invoice;
|
||||
else
|
||||
@@ -1356,7 +1393,11 @@ class CartCore extends ObjectModel
|
||||
false,
|
||||
(int)$this->id_customer ? (int)$this->id_customer : null,
|
||||
(int)$this->id,
|
||||
$address_id
|
||||
$address_id,
|
||||
$null,
|
||||
true,
|
||||
true,
|
||||
$virtual_context
|
||||
);
|
||||
|
||||
$total_ecotax = $product['ecotax'] * (int)$product['cart_quantity'];
|
||||
@@ -1364,7 +1405,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
if ($with_taxes)
|
||||
{
|
||||
$product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id);
|
||||
$product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id, $virtual_context);
|
||||
$product_eco_tax_rate = Tax::getProductEcotaxRate((int)$address_id);
|
||||
|
||||
$total_price = ($total_price - $total_ecotax) * (1 + $product_tax_rate / 100);
|
||||
@@ -1386,14 +1427,18 @@ class CartCore extends ObjectModel
|
||||
false,
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null)
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$null,
|
||||
true,
|
||||
true,
|
||||
$virtual_context
|
||||
);
|
||||
|
||||
$total_price = Tools::ps_round($price, 2) * (int)$product['cart_quantity'];
|
||||
|
||||
if (!$with_taxes)
|
||||
{
|
||||
$product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id);
|
||||
$product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id, $virtual_context);
|
||||
$total_price = Tools::ps_round($total_price / (1 + ($product_tax_rate / 100)), 2);
|
||||
}
|
||||
}
|
||||
@@ -2300,7 +2345,7 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
|
||||
$cache[(int)$dontAutoSeletectOptions] = $delivery_option;
|
||||
|
||||
|
||||
return $delivery_option;
|
||||
}
|
||||
|
||||
@@ -2842,9 +2887,8 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
$sql = 'SELECT c.`id_cart`
|
||||
FROM '._DB_PREFIX_.'cart c
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON (c.`id_cart` = o.`id_cart`)
|
||||
WHERE c.`id_customer` = '.(int)$id_customer.'
|
||||
AND o.`id_cart` IS NULL
|
||||
WHERE c.`id_cart` NOT IN (SELECT o.`id_cart` FROM '._DB_PREFIX_.'orders o)
|
||||
AND c.`id_customer` = '.(int)$id_customer.'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'c').'
|
||||
ORDER BY c.`date_upd` DESC';
|
||||
|
||||
@@ -2931,6 +2975,12 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
return $this->_addCustomization($id_product, 0, $index, $type, $file, 0);
|
||||
}
|
||||
|
||||
public function deletePictureToProduct($id_product, $index)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return $this->deleteCustomizationToProduct($id_product, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a customer's customization
|
||||
@@ -2991,14 +3041,14 @@ class CartCore extends ObjectModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getCustomerCarts($id_customer)
|
||||
public static function getCustomerCarts($id_customer, $with_order = true)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'cart c
|
||||
WHERE c.`id_customer` = '.(int)$id_customer.'
|
||||
ORDER BY c.`date_add` DESC');
|
||||
return $result;
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'cart c
|
||||
WHERE c.`id_customer` = '.(int)$id_customer.'
|
||||
'.(!$with_order ? 'AND id_cart NOT IN (SELECT id_cart FROM '._DB_PREFIX_.'orders o WHERE o.`id_customer` = '.(int)$id_customer.')' : '').'
|
||||
ORDER BY c.`date_add` DESC');
|
||||
}
|
||||
|
||||
public static function replaceZeroByShopName($echo, $tr)
|
||||
@@ -3332,7 +3382,8 @@ class CartCore extends ObjectModel
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
AND `id_shop` = '.(int)$this->id_shop.'
|
||||
)
|
||||
WHERE `id_cart` = '.(int)$this->id.' AND `id_shop` = '.(int)$this->id_shop;
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
'.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : '');
|
||||
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ class CategoryCore extends ObjectModel
|
||||
/** @var integer Parent category ID */
|
||||
public $id_parent;
|
||||
|
||||
/** @var integer default Category id */
|
||||
public $id_category_default;
|
||||
|
||||
/** @var integer Parents number */
|
||||
public $level_depth;
|
||||
|
||||
@@ -77,6 +80,9 @@ class CategoryCore extends ObjectModel
|
||||
/** @var boolean is Category Root */
|
||||
public $is_root_category;
|
||||
|
||||
/** @var integer */
|
||||
public $id_shop_default;
|
||||
|
||||
public $groupBox;
|
||||
|
||||
protected static $_links = array();
|
||||
@@ -95,6 +101,7 @@ class CategoryCore extends ObjectModel
|
||||
'level_depth' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
|
||||
'id_parent' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'id_shop_default' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'is_root_category' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'position' => array('type' => self::TYPE_INT),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
@@ -298,6 +305,12 @@ class CategoryCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteLite()
|
||||
{
|
||||
// Directly call the parent of delete, in order to avoid recursion
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if ((int)$this->id === 0 || (int)$this->id === 1)
|
||||
@@ -309,7 +322,7 @@ class CategoryCore extends ObjectModel
|
||||
$all_cat[] = $this;
|
||||
foreach ($all_cat as $cat)
|
||||
{
|
||||
parent::delete();
|
||||
$cat->deleteLite();
|
||||
if (!$this->hasMultishopEntries())
|
||||
{
|
||||
$cat->deleteImage();
|
||||
@@ -365,7 +378,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
$parent_category = new Category($this->id_parent);
|
||||
if (!Validate::isLoadedObject($parent_category))
|
||||
die('parent category does not exist');
|
||||
throw new PrestaShopException('Parent category does not exist');
|
||||
return $parent_category->level_depth + 1;
|
||||
}
|
||||
|
||||
@@ -451,11 +464,12 @@ class CategoryCore extends ObjectModel
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
'.Shop::addSqlAssociation('category', 'c').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE 1 '.$sql_filter.' '.($id_lang ? 'AND `id_lang` = '.(int)$id_lang : '').'
|
||||
'.($active ? 'AND `active` = 1' : '').'
|
||||
'.(!$id_lang ? 'GROUP BY c.id_category' : '').'
|
||||
'.($sql_sort != '' ? $sql_sort : 'ORDER BY c.`level_depth` ASC, c.`position` ASC').'
|
||||
'.($sql_sort != '' ? $sql_sort : 'ORDER BY c.`level_depth` ASC, category_shop.`position` ASC').'
|
||||
'.($sql_limit != '' ? $sql_limit : '')
|
||||
);
|
||||
|
||||
@@ -562,14 +576,14 @@ class CategoryCore extends ObjectModel
|
||||
$order_way = 'ASC';
|
||||
if ($order_by == 'id_product' || $order_by == 'date_add' || $order_by == 'date_upd')
|
||||
$order_by_prefix = 'p';
|
||||
else if ($order_by == 'name')
|
||||
elseif ($order_by == 'name')
|
||||
$order_by_prefix = 'pl';
|
||||
else if ($order_by == 'manufacturer')
|
||||
elseif ($order_by == 'manufacturer')
|
||||
{
|
||||
$order_by_prefix = 'm';
|
||||
$order_by = 'name';
|
||||
}
|
||||
else if ($order_by == 'position')
|
||||
elseif ($order_by == 'position')
|
||||
$order_by_prefix = 'cp';
|
||||
|
||||
if ($order_by == 'price')
|
||||
@@ -594,8 +608,8 @@ class CategoryCore extends ObjectModel
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
$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.`available_now`,
|
||||
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`,
|
||||
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image`,
|
||||
il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default,
|
||||
DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(),
|
||||
INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).'
|
||||
@@ -604,11 +618,11 @@ class CategoryCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON p.`id_product` = cp.`id_product`
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
|
||||
ON (p.`id_product` = pa.`id_product`)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false).'
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
'.Product::sqlStock('p', 'pa', false, $context->shop).'
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1').'
|
||||
'.Product::sqlStock('p', 'product_attribute_shop', false, $context->shop).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON (product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')
|
||||
@@ -616,10 +630,10 @@ class CategoryCore extends ObjectModel
|
||||
ON (p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i
|
||||
ON (i.`id_product` = p.`id_product`
|
||||
AND i.`cover` = 1)
|
||||
ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
|
||||
ON (i.`id_image` = il.`id_image`
|
||||
ON (image_shop.`id_image` = il.`id_image`
|
||||
AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr
|
||||
ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
@@ -633,14 +647,14 @@ class CategoryCore extends ObjectModel
|
||||
AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
|
||||
ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
WHERE product_shop.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND (product_attribute_shop.default_on = 1 OR product_attribute_shop.default_on IS NULL)
|
||||
WHERE product_shop.`id_shop` = '.(int)$context->shop->id.'
|
||||
AND (pa.id_product_attribute IS NULL OR product_attribute_shop.id_shop='.(int)$context->shop->id.')
|
||||
AND (i.id_image IS NULL OR image_shop.id_shop='.(int)$context->shop->id.')
|
||||
AND cp.`id_category` = '.(int)$this->id
|
||||
.($active ? ' AND product_shop.`active` = 1' : '')
|
||||
.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '')
|
||||
.($id_supplier ? ' AND p.id_supplier = '.(int)$id_supplier : '');
|
||||
|
||||
$sql .= ' GROUP BY p.`id_product`';
|
||||
if ($random === true)
|
||||
{
|
||||
$sql .= ' ORDER BY RAND()';
|
||||
@@ -763,15 +777,15 @@ class CategoryCore extends ObjectModel
|
||||
AND c3.`id_category` IN ('.implode(',', array_map('intval', $selected_cat)).')
|
||||
)' : '0').' AS nbSelectedSubCat
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl');
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')';
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` '.Shop::addSqlRestrictionOnLang('cl', $id_shop).')';
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')';
|
||||
$sql .= ' WHERE `id_lang` = '.(int)$id_lang;
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
|
||||
$sql .= ' AND cs.`id_shop` = '.(int)$shop->id;
|
||||
$sql .= ' AND c.`id_parent` = '.(int)$id_parent;
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
|
||||
if (!Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
|
||||
$sql .= ' ORDER BY cs.`position` ASC';
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
@@ -929,7 +943,9 @@ class CategoryCore extends ObjectModel
|
||||
*/
|
||||
public function getParentsCategories($id_lang = null)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context = Context::getContext()->cloneContext();
|
||||
$context->shop = clone($context->shop);
|
||||
|
||||
if (is_null($id_lang))
|
||||
$id_lang = $context->language->id;
|
||||
|
||||
@@ -1177,12 +1193,12 @@ class CategoryCore extends ObjectModel
|
||||
*/
|
||||
public static function getLastPosition($id_category_parent, $id_shop)
|
||||
{
|
||||
return (Db::getInstance()->getValue('
|
||||
SELECT MAX(cs.`position`)+1
|
||||
return (int)(Db::getInstance()->getValue('
|
||||
SELECT MAX(cs.`position`)
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs
|
||||
ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')
|
||||
WHERE c.`id_parent` = '.(int)$id_category_parent));
|
||||
WHERE c.`id_parent` = '.(int)$id_category_parent) + 1);
|
||||
}
|
||||
|
||||
public static function getUrlRewriteInformations($id_category)
|
||||
@@ -1229,6 +1245,17 @@ class CategoryCore extends ObjectModel
|
||||
return false;
|
||||
return ($this->nleft >= $interval['nleft'] && $this->nright <= $interval['nright']);
|
||||
}
|
||||
|
||||
public static function inShopStatic($id_category, Shop $shop = null)
|
||||
{
|
||||
if (!$shop || !is_object($shop))
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
if (!$interval = Category::getInterval($shop->getCategory()))
|
||||
return false;
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT nleft, nright FROM `'._DB_PREFIX_.'category` WHERE id_category = '.(int)$id_category);
|
||||
return ($row['nleft'] >= $interval['nleft'] && $row['nright'] <= $interval['nright']);
|
||||
}
|
||||
|
||||
public function getChildrenWs()
|
||||
{
|
||||
|
||||
@@ -166,7 +166,7 @@ class Curve
|
||||
{
|
||||
$this->type = '';
|
||||
if ($type == 'bars')
|
||||
$this->type = 'bars:{show:true}';
|
||||
$this->type = 'bars:{show:true,lineWidth:10}';
|
||||
if ($type == 'steps')
|
||||
$this->type = 'lines:{show:true,steps:true}';
|
||||
}
|
||||
|
||||
@@ -108,6 +108,20 @@ class CombinationCore extends ObjectModel
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
if (!parent::add($autodate, $null_values))
|
||||
return false;
|
||||
|
||||
$product = new Product((int)$this->id_product);
|
||||
if ($product->getType() == Product::PTYPE_VIRTUAL)
|
||||
StockAvailable::setProductOutOfStock((int)$this->id_product, 1, null, (int)$this->id);
|
||||
else
|
||||
StockAvailable::setProductOutOfStock((int)$this->id_product, StockAvailable::outOfStock((int)$this->id_product), null, $this->id);
|
||||
|
||||
SpecificPriceRule::applyAllRules(array((int)$this->id_product));
|
||||
}
|
||||
|
||||
public function deleteAssociations()
|
||||
{
|
||||
@@ -185,7 +199,10 @@ class CombinationCore extends ObjectModel
|
||||
|
||||
public function setWsImages($values)
|
||||
{
|
||||
return $this->setImages($values);
|
||||
$ids_images = array();
|
||||
foreach ($values as $value)
|
||||
$ids_images[] = (int)$value['id'];
|
||||
return $this->setImages($ids_images);
|
||||
}
|
||||
|
||||
public function getAttributesName($id_lang)
|
||||
|
||||
@@ -159,27 +159,36 @@ class ConfigurationTestCore
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function test_dir($relative_dir, $recursive = false)
|
||||
public static function test_dir($relative_dir, $recursive = false, &$full_report = null)
|
||||
{
|
||||
$dir = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.ltrim($relative_dir, '/');
|
||||
$dir = rtrim(_PS_ROOT_DIR_, '\\/').DIRECTORY_SEPARATOR.trim($relative_dir, '\\/');
|
||||
if (!file_exists($dir) || !$dh = opendir($dir))
|
||||
{
|
||||
$full_report = sprintf('Directory %s does not exists or is not writable', $dir); // sprintf for future translation
|
||||
return false;
|
||||
$dummy = rtrim($dir, '/').'/'.uniqid();
|
||||
if (@file_put_contents($dummy, 'test'))
|
||||
}
|
||||
$dummy = rtrim($dir, '\\/').DIRECTORY_SEPARATOR.uniqid();
|
||||
if (false && @file_put_contents($dummy, 'test'))
|
||||
{
|
||||
@unlink($dummy);
|
||||
if (!$recursive)
|
||||
{
|
||||
closedir($dh);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!is_writable($dir))
|
||||
return false;
|
||||
if ($recursive)
|
||||
elseif (!is_writable($dir))
|
||||
{
|
||||
$full_report = sprintf('Directory %s is not writable', $dir); // sprintf for future translation
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($recursive)
|
||||
while (($file = readdir($dh)) !== false)
|
||||
if (is_dir($dir.DIRECTORY_SEPARATOR.$file) && $file != '.' && $file != '..' && $file != '.svn')
|
||||
if (!ConfigurationTest::test_dir($relative_dir.DIRECTORY_SEPARATOR.$file, true))
|
||||
if (!ConfigurationTest::test_dir($relative_dir.DIRECTORY_SEPARATOR.$file, $recursive, $full_report))
|
||||
return false;
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -95,6 +95,61 @@ class ContextCore
|
||||
*/
|
||||
public $smarty;
|
||||
|
||||
/**
|
||||
* @ var Mobile Detect
|
||||
*/
|
||||
public $mobile_detect;
|
||||
|
||||
/**
|
||||
* @var boolean|string mobile device of the customer
|
||||
*/
|
||||
protected $mobile_device;
|
||||
|
||||
public function getMobileDevice()
|
||||
{
|
||||
if (is_null($this->mobile_device))
|
||||
{
|
||||
$this->mobile_device = false;
|
||||
if ($this->checkMobileContext())
|
||||
{
|
||||
require_once(_PS_TOOL_DIR_.'mobile_Detect/Mobile_Detect.php');
|
||||
$this->mobile_detect = new Mobile_Detect();
|
||||
switch ((int)Configuration::get('PS_ALLOW_MOBILE_DEVICE'))
|
||||
{
|
||||
case 1: // Only for mobile device
|
||||
if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet())
|
||||
$this->mobile_device = true;
|
||||
break;
|
||||
case 2: // Only for touchpads
|
||||
if ($this->mobile_detect->isTablet() && $this->mobile_detect->isMobile())
|
||||
$this->mobile_device = true;
|
||||
break;
|
||||
case 3: // For touchpad or mobile devices
|
||||
if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet())
|
||||
$this->mobile_device = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->mobile_device;
|
||||
}
|
||||
|
||||
protected function checkMobileContext()
|
||||
{
|
||||
// Check mobile context
|
||||
if (Tools::isSubmit('no_mobile_theme'))
|
||||
Context::getContext()->cookie->no_mobile = true;
|
||||
else if (Tools::isSubmit('mobile_theme_ok'))
|
||||
Context::getContext()->cookie->no_mobile = false;
|
||||
|
||||
return isset($_SERVER['HTTP_USER_AGENT'])
|
||||
&& isset(Context::getContext()->cookie)
|
||||
&& (bool)Configuration::get('PS_ALLOW_MOBILE_DEVICE')
|
||||
&& @filemtime(_PS_THEME_MOBILE_DIR_)
|
||||
&& !Context::getContext()->cookie->no_mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a singleton context
|
||||
*
|
||||
|
||||
@@ -82,7 +82,10 @@ class CookieCore
|
||||
protected function getDomain($shared_urls = null)
|
||||
{
|
||||
$r = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
|
||||
preg_match ($r, Tools::getHttpHost(false, false), $out);
|
||||
|
||||
if (!preg_match ($r, Tools::getHttpHost(false, false), $out) || !isset($out[4]))
|
||||
return false;
|
||||
|
||||
if (preg_match('/^(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]|[1-9]).)'.
|
||||
'{1}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]).)'.
|
||||
'{2}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]){1}))$/', $out[4]))
|
||||
@@ -156,7 +159,6 @@ class CookieCore
|
||||
if (!$this->_modified && (!isset($this->_content[$key]) || (isset($this->_content[$key]) && $this->_content[$key] != $value)))
|
||||
$this->_modified = true;
|
||||
$this->_content[$key] = $value;
|
||||
$this->write();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +171,6 @@ class CookieCore
|
||||
if (isset($this->_content[$key]))
|
||||
$this->_modified = true;
|
||||
unset($this->_content[$key]);
|
||||
$this->write();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,7 +218,6 @@ class CookieCore
|
||||
$this->_setcookie();
|
||||
unset($_COOKIE[$this->_name]);
|
||||
$this->_modified = true;
|
||||
$this->write();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,7 +241,6 @@ class CookieCore
|
||||
unset($this->_content['id_address_invoice']);
|
||||
unset($this->_content['id_address_delivery']);
|
||||
$this->_modified = true;
|
||||
$this->write();
|
||||
}
|
||||
|
||||
public function makeNewLog()
|
||||
@@ -317,11 +316,19 @@ class CookieCore
|
||||
return setcookie($this->_name, $content, $time, $this->_path, $this->_domain, 0, true);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->write();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save cookie with setcookie()
|
||||
*/
|
||||
public function write()
|
||||
{
|
||||
if (!$this->_modified || headers_sent())
|
||||
return;
|
||||
|
||||
$cookie = '';
|
||||
|
||||
/* Serialize cookie content */
|
||||
@@ -331,7 +338,7 @@ class CookieCore
|
||||
|
||||
/* Add checksum to cookie */
|
||||
$cookie .= 'checksum|'.crc32($this->_iv.$cookie);
|
||||
|
||||
$this->_modified = false;
|
||||
/* Cookies are encrypted for evident security reasons */
|
||||
return $this->_setcookie($cookie);
|
||||
}
|
||||
|
||||
@@ -110,51 +110,42 @@ class CountryCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Return available countries
|
||||
* @brief Return available countries
|
||||
*
|
||||
* @param integer $id_lang Language ID
|
||||
* @param boolean $active return only active coutries
|
||||
* @return array Countries and corresponding zones
|
||||
* @param boolean $contain_states return only country with states
|
||||
* @param boolean $list_states Include the states list with the returned list
|
||||
*
|
||||
* @return Array Countries and corresponding zones
|
||||
*/
|
||||
public static function getCountries($id_lang, $active = false, $contain_states = null)
|
||||
public static function getCountries($id_lang, $active = false, $contain_states = false, $list_states = true)
|
||||
{
|
||||
if (!Validate::isBool($active))
|
||||
die(Tools::displayError());
|
||||
|
||||
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT s.*
|
||||
FROM `'._DB_PREFIX_.'state` s
|
||||
ORDER BY s.`name` ASC');
|
||||
|
||||
$sql = 'SELECT cl.*,c.*, cl.`name` AS country, z.`name` AS zone
|
||||
FROM `'._DB_PREFIX_.'country` c
|
||||
'.Shop::addSqlAssociation('country', 'c').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'zone` z ON z.`id_zone` = c.`id_zone`
|
||||
WHERE 1'
|
||||
.($active ? ' AND c.active = 1' : '')
|
||||
.(!is_null($contain_states) ? ' AND c.`contains_states` = '.(int)$contain_states : '').'
|
||||
ORDER BY cl.name ASC';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$countries = array();
|
||||
foreach ($result as &$country)
|
||||
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT cl.*,c.*, cl.`name` country, z.`name` zone
|
||||
FROM `'._DB_PREFIX_.'country` c '.Shop::addSqlAssociation('country', 'c').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = c.`id_zone`)
|
||||
WHERE 1'.($active ? ' AND c.active = 1' : '').($contain_states ? ' AND c.`contains_states` = '.(int)$contain_states : '').'
|
||||
ORDER BY cl.name ASC') as $country)
|
||||
$countries[$country['id_country']] = $country;
|
||||
foreach ($states as &$state)
|
||||
if (isset($countries[$state['id_country']])) /* Does not keep the state if its country has been disabled and not selected */
|
||||
$countries[$state['id_country']]['states'][] = $state;
|
||||
|
||||
if ($list_states)
|
||||
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'state` ORDER BY `name` ASC') as $state)
|
||||
if (isset($countries[$state['id_country']])) /* Does not keep the state if its country has been disabled and not selected */
|
||||
$countries[$state['id_country']]['states'][] = $state;
|
||||
|
||||
return $countries;
|
||||
}
|
||||
|
||||
public static function getCountriesByIdShop($id_shop, $id_lang)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM `'._DB_PREFIX_.'country` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_shop` cs ON (cs.`id_country`= c.`id_country`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE `id_shop` = '.(int)$id_shop;
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'country` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_shop` cs ON (cs.`id_country`= c.`id_country`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE `id_shop` = '.(int)$id_shop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,4 +344,30 @@ class CountryCore extends ObjectModel
|
||||
|
||||
return (bool)preg_match($zip_regexp, $zip_code);
|
||||
}
|
||||
|
||||
public static function addModuleRestrictions(array $shops = array(), array $countries = array(), array $modules = array())
|
||||
{
|
||||
if (!count($shops))
|
||||
$shops = Shop::getShops(true, null, true);
|
||||
|
||||
if (!count($countries))
|
||||
$countries = Country::getCountries((int)Context::getContext()->cookie->id_lang);
|
||||
|
||||
if (!count($modules))
|
||||
$modules = Module::getPaymentModules();
|
||||
|
||||
$sql = false;
|
||||
foreach ($shops as $id_shop)
|
||||
foreach ($countries as $country)
|
||||
foreach ($modules as $module)
|
||||
$sql .= '('.(int)$module['id_module'].', '.(int)$id_shop.', '.(int)$country['id_country'].'),';
|
||||
|
||||
if ($sql)
|
||||
{
|
||||
$sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.'module_country` (`id_module`, `id_shop`, `id_country`) VALUES '.rtrim($sql, ',');
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,6 @@ class CurrencyCore extends ObjectModel
|
||||
// price sign before or after the price number
|
||||
$this->prefix = $this->format % 2 != 0 ? $this->sign.' ' : '';
|
||||
$this->suffix = $this->format % 2 == 0 ? ' '.$this->sign : '';
|
||||
|
||||
}
|
||||
/**
|
||||
* Overriding check if currency with the same iso code already exists.
|
||||
@@ -181,12 +180,15 @@ class CurrencyCore extends ObjectModel
|
||||
'left' => $this->sign.' ',
|
||||
'right' => ' '.$this->sign
|
||||
);
|
||||
|
||||
$formats = array(
|
||||
1 => array('left' => &$formated_strings['left'], 'right' => ''),
|
||||
2 => array('left' => '', 'right' => &$formated_strings['right']),
|
||||
3 => array('left' => &$formated_strings['left'], 'right' => ''),
|
||||
4 => array('left' => '', 'right' => &$formated_strings['right']),
|
||||
5 => array('left' => '', 'right' => &$formated_strings['right'])
|
||||
);
|
||||
|
||||
return ($formats[$this->format][$side]);
|
||||
}
|
||||
|
||||
|
||||
@@ -224,19 +224,57 @@ class CustomerCore extends ObjectModel
|
||||
$this->newsletter_date_add = date('Y-m-d H:i:s');
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
$this->updateGroup($this->groupBox);
|
||||
|
||||
if ($this->deleted)
|
||||
{
|
||||
$addresses = $this->getAddresses((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
foreach ($addresses as $address)
|
||||
{
|
||||
$obj = new Address((int)$address['id_address']);
|
||||
$obj->delete();
|
||||
}
|
||||
}
|
||||
|
||||
return parent::update(true);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$addresses = $this->getAddresses((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
foreach ($addresses as $address)
|
||||
if (!count(Order::getCustomerOrders((int)$this->id)))
|
||||
{
|
||||
$obj = new Address((int)$address['id_address']);
|
||||
$obj->delete();
|
||||
$addresses = $this->getAddresses((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
foreach ($addresses as $address)
|
||||
{
|
||||
$obj = new Address((int)$address['id_address']);
|
||||
$obj->delete();
|
||||
}
|
||||
}
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)$this->id);
|
||||
Discount::deleteByIdCustomer((int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'message WHERE id_customer='.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'specific_price WHERE id_customer='.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'compare WHERE id_customer='.(int)$this->id);
|
||||
|
||||
$carts = Db::getInstance()->executes('SELECT id_cart
|
||||
FROM '._DB_PREFIX_.'cart
|
||||
WHERE id_customer='.(int)$this->id);
|
||||
if ($carts)
|
||||
foreach ($carts as $cart)
|
||||
{
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart WHERE id_cart='.(int)$cart['id_cart']);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_product WHERE id_cart='.(int)$cart['id_cart']);
|
||||
}
|
||||
|
||||
$cts = Db::getInstance()->executes('SELECT id_customer_thread
|
||||
FROM '._DB_PREFIX_.'customer_thread
|
||||
WHERE id_customer='.(int)$this->id);
|
||||
if ($cts)
|
||||
foreach ($cts as $ct)
|
||||
{
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'customer_thread WHERE id_customer_thread='.(int)$ct['id_customer_thread']);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'customer_message WHERE id_customer_thread='.(int)$ct['id_customer_thread']);
|
||||
}
|
||||
|
||||
CartRule::deleteByIdCustomer((int)$this->id);
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
@@ -737,9 +775,9 @@ class CustomerCore extends ObjectModel
|
||||
$this->logged = 0;
|
||||
}
|
||||
|
||||
public function getLastCart()
|
||||
public function getLastCart($with_order = true)
|
||||
{
|
||||
$carts = Cart::getCustomerCarts((int)$this->id);
|
||||
$carts = Cart::getCustomerCarts((int)$this->id, $with_order);
|
||||
if (!count($carts))
|
||||
return false;
|
||||
$cart = array_shift($carts);
|
||||
|
||||
@@ -36,6 +36,7 @@ class CustomerMessageCore extends ObjectModel
|
||||
public $user_agent;
|
||||
public $private;
|
||||
public $date_add;
|
||||
public $read;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
@@ -52,6 +53,7 @@ class CustomerMessageCore extends ObjectModel
|
||||
'user_agent' => array('type' => self::TYPE_STRING),
|
||||
'private' => array('type' => self::TYPE_INT),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'read' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool')
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -72,15 +72,17 @@ class CustomerThreadCore extends ObjectModel
|
||||
return (parent::delete());
|
||||
}
|
||||
|
||||
public static function getCustomerMessages($id_customer)
|
||||
public static function getCustomerMessages($id_customer, $read = null)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
$sql = 'SELECT *
|
||||
FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm
|
||||
ON ct.id_customer_thread = cm.id_customer_thread
|
||||
WHERE id_customer = '.(int)$id_customer
|
||||
);
|
||||
WHERE id_customer = '.(int)$id_customer;
|
||||
if (!is_null($read))
|
||||
$sql .= ' AND cm.`read` = '.(int)$read;
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public static function getIdCustomerThreadByEmailAndIdOrder($email, $id_order)
|
||||
|
||||
@@ -208,7 +208,7 @@ class DispatcherCore
|
||||
$this->default_controller = 'adminhome';
|
||||
$this->use_routes = false;
|
||||
}
|
||||
else if (Tools::getValue('fc') == 'module')
|
||||
elseif (Tools::getValue('fc') == 'module')
|
||||
{
|
||||
$this->front_controller = self::FC_MODULE;
|
||||
$this->controller_not_found = 'pagenotfound';
|
||||
@@ -250,7 +250,7 @@ class DispatcherCore
|
||||
{
|
||||
// Dispatch front office controller
|
||||
case self::FC_FRONT :
|
||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_, _PS_OVERRIDE_DIR_.'controllers/front/');
|
||||
$controllers = Dispatcher::getControllers(array(_PS_FRONT_CONTROLLER_DIR_, _PS_OVERRIDE_DIR_.'controllers/front/'));
|
||||
|
||||
$controllers['index'] = 'IndexController';
|
||||
if (isset($controllers['auth']))
|
||||
@@ -287,6 +287,7 @@ class DispatcherCore
|
||||
case self::FC_ADMIN :
|
||||
$tab = Tab::getInstanceFromClassName($this->controller);
|
||||
$retrocompatibility_admin_tab = null;
|
||||
|
||||
if ($tab->module)
|
||||
{
|
||||
if (file_exists(_PS_MODULE_DIR_.$tab->module.'/'.$tab->class_name.'.php'))
|
||||
@@ -636,7 +637,7 @@ class DispatcherCore
|
||||
return $this->controller;
|
||||
|
||||
$controller = Tools::getValue('controller');
|
||||
|
||||
|
||||
if (isset($controller) && is_string($controller) && preg_match('/^([0-9a-z_-]+)\?(.*)=(.*)$/Ui', $controller, $m))
|
||||
{
|
||||
$controller = $m[1];
|
||||
@@ -648,7 +649,7 @@ class DispatcherCore
|
||||
|
||||
if (!Validate::isControllerName($controller))
|
||||
$controller = false;
|
||||
|
||||
|
||||
// Use routes ? (for url rewriting)
|
||||
if ($this->use_routes && !$controller)
|
||||
{
|
||||
@@ -734,9 +735,9 @@ class DispatcherCore
|
||||
{
|
||||
if ($controller_filename[0] != '.')
|
||||
{
|
||||
if (is_dir($dir.$controller_filename))
|
||||
if (!strpos($controller_filename, '.php') && is_dir($dir.$controller_filename))
|
||||
$controllers += Dispatcher::getControllersInDirectory($dir.$controller_filename.DIRECTORY_SEPARATOR);
|
||||
else if ($controller_filename != 'index.php')
|
||||
elseif ($controller_filename != 'index.php')
|
||||
{
|
||||
$key = str_replace(array('controller.php', '.php'), '', strtolower($controller_filename));
|
||||
$controllers[$key] = basename($controller_filename, '.php');
|
||||
|
||||
@@ -79,16 +79,14 @@ class FeatureCore extends ObjectModel
|
||||
* @return array Multiple arrays with feature's data
|
||||
* @static
|
||||
*/
|
||||
public static function getFeatures($id_lang)
|
||||
public static function getFeatures($id_lang, $with_shop = true)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature` f
|
||||
'.Shop::addSqlAssociation('feature', 'f').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl
|
||||
ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.')
|
||||
ORDER BY f.`position` ASC
|
||||
');
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature` f
|
||||
'.($with_shop ? Shop::addSqlAssociation('feature', 'f') : '').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.')
|
||||
ORDER BY f.`position` ASC');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -251,26 +251,22 @@ class GroupCore extends ObjectModel
|
||||
* @param $modules
|
||||
* @param array $shops
|
||||
* @return bool
|
||||
* @internal param \id_group $integer
|
||||
* @internal param \modules $array
|
||||
* @internal param \authorized $integer
|
||||
*/
|
||||
public static function addModulesRestrictions($id_group, $modules, $shops = array(1))
|
||||
{
|
||||
if (!is_array($modules) && !empty($modules))
|
||||
if (!is_array($modules) || !count($modules) || !is_array($shops) || !count($shops))
|
||||
return false;
|
||||
else
|
||||
{
|
||||
//delete all record for this group
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_group` WHERE `id_group` = '.(int)$id_group);
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'module_group` (`id_module`, `id_shop`, `id_group`) VALUES ';
|
||||
foreach ($modules as $mod)
|
||||
foreach ($shops as $s)
|
||||
$sql .= '("'.(int)$mod.'", "'.(int)$s.'", "'.(int)$id_group.'"),';
|
||||
// removing last comma to avoid SQL error
|
||||
$sql = substr($sql, 0, strlen($sql) - 1);
|
||||
return (bool)Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
// Delete all record for this group
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_group` WHERE `id_group` = '.(int)$id_group);
|
||||
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'module_group` (`id_module`, `id_shop`, `id_group`) VALUES ';
|
||||
foreach ($modules as $module)
|
||||
foreach ($shops as $shop)
|
||||
$sql .= '("'.(int)$module.'", "'.(int)$shop.'", "'.(int)$id_group.'"),';
|
||||
$sql = rtrim($sql, ',');
|
||||
|
||||
return (bool)Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,14 +277,15 @@ class GroupCore extends ObjectModel
|
||||
*/
|
||||
public static function addRestrictionsForModule($id_module, $shops = array(1))
|
||||
{
|
||||
$groups = Group::getGroups(Context::getContext()->language->id);
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'module_group` (`id_module`, `id_shop`, `id_group`) VALUES ';
|
||||
foreach ($groups as $g)
|
||||
foreach ($shops as $s)
|
||||
$sql .= '("'.(int)$id_module.'", "'.(int)$s.'", "'.(int)$g['id_group'].'"),';
|
||||
// removing last comma to avoid SQL error
|
||||
$sql = substr($sql, 0, strlen($sql) - 1);
|
||||
Db::getInstance()->execute($sql);
|
||||
if (!is_array($shops) || !count($shops))
|
||||
return false;
|
||||
|
||||
$res = true;
|
||||
foreach ($shops as $shop)
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_group` (`id_module`, `id_shop`, `id_group`)
|
||||
(SELECT '.(int)$id_module.', '.(int)$shop.', id_group FROM `'._DB_PREFIX_.'group`)');
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -102,14 +102,16 @@ class GuestCore extends ObjectModel
|
||||
protected function getBrowser($userAgent)
|
||||
{
|
||||
$browserArray = array(
|
||||
'Google Chrome' => 'Chrome/',
|
||||
'Chrome' => 'Chrome/',
|
||||
'Safari' => 'Safari',
|
||||
'Firefox 3.x' => 'Firefox/3',
|
||||
'Firefox 2.x' => 'Firefox/2',
|
||||
'Safari iPad' => 'iPad',
|
||||
'Firefox' => 'Firefox/',
|
||||
'Opera' => 'Opera',
|
||||
'IE 8.x' => 'MSIE 8',
|
||||
'IE 7.x' => 'MSIE 7',
|
||||
'IE 6.x' => 'MSIE 6'
|
||||
'IE 10' => 'MSIE 10',
|
||||
'IE 9' => 'MSIE 9',
|
||||
'IE 8' => 'MSIE 8',
|
||||
'IE 7' => 'MSIE 7',
|
||||
'IE 6' => 'MSIE 6'
|
||||
);
|
||||
foreach ($browserArray as $k => $value)
|
||||
if (strstr($userAgent, $value))
|
||||
@@ -127,9 +129,12 @@ class GuestCore extends ObjectModel
|
||||
protected function getOs($userAgent)
|
||||
{
|
||||
$osArray = array(
|
||||
'Windows Vista' => 'Windows NT 6',
|
||||
'Windows 8' => 'Windows NT 6.2',
|
||||
'Windows 7' => 'Windows NT 6.1',
|
||||
'Windows Vista' => 'Windows NT 6.0',
|
||||
'Windows XP' => 'Windows NT 5',
|
||||
'MacOsX' => 'Mac OS X',
|
||||
'Android' => 'Android',
|
||||
'Linux' => 'X11'
|
||||
);
|
||||
foreach ($osArray as $k => $value)
|
||||
|
||||
@@ -64,7 +64,7 @@ class HookCore extends ObjectModel
|
||||
'table' => 'hook',
|
||||
'primary' => 'id_hook',
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isHookName', 'required' => true, 'size' => 32),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isHookName', 'required' => true, 'size' => 64),
|
||||
'title' => array('type' => self::TYPE_STRING),
|
||||
'description' => array('type' => self::TYPE_HTML),
|
||||
'position' => array('type' => self::TYPE_BOOL),
|
||||
@@ -112,7 +112,7 @@ class HookCore extends ObjectModel
|
||||
public static function getIdByName($hook_name)
|
||||
{
|
||||
if (!Validate::isHookName($hook_name))
|
||||
throw new PrestaShopException('Invalid hook name');
|
||||
return false;
|
||||
|
||||
$cache_id = 'hook_idbyname_'.$hook_name;
|
||||
if (!Cache::isStored($cache_id))
|
||||
@@ -180,14 +180,12 @@ class HookCore extends ObjectModel
|
||||
$cache_id = 'hook_module_list';
|
||||
if (!Cache::isStored($cache_id))
|
||||
{
|
||||
$sql = 'SELECT h.id_hook, h.name as h_name, title, description, h.position, live_edit, hm.position as hm_position, m.id_module, m.name, active
|
||||
FROM `'._DB_PREFIX_.'hook` h
|
||||
INNER JOIN `'._DB_PREFIX_.'hook_module` hm ON (h.id_hook = hm.id_hook)
|
||||
INNER JOIN `'._DB_PREFIX_.'module` as m ON (m.id_module = hm.id_module)
|
||||
WHERE hm.id_shop IN('.implode(', ', Shop::getContextListShopID()).')
|
||||
GROUP BY hm.id_hook, hm.id_module
|
||||
ORDER BY hm.position';
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT h.id_hook, h.name as h_name, title, description, h.position, live_edit, hm.position as hm_position, m.id_module, m.name, active
|
||||
FROM `'._DB_PREFIX_.'hook` h
|
||||
INNER JOIN `'._DB_PREFIX_.'hook_module` hm ON (h.id_hook = hm.id_hook AND hm.id_shop = '.(int)Context::getContext()->shop->id.')
|
||||
INNER JOIN `'._DB_PREFIX_.'module` as m ON (m.id_module = hm.id_module)
|
||||
ORDER BY hm.position');
|
||||
$list = array();
|
||||
foreach ($results as $result)
|
||||
{
|
||||
@@ -244,29 +242,54 @@ class HookCore extends ObjectModel
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$cache_id = 'hook_module_exec_list'.((isset($context->customer)) ? '_'.$context->customer->id : '');
|
||||
if (!Cache::isStored($cache_id))
|
||||
if (!Cache::isStored($cache_id) || $hook_name == 'displayPayment')
|
||||
{
|
||||
// Get shops and groups list
|
||||
$shop_list = Shop::getContextListShopID();
|
||||
if (isset($context->customer) && $context->customer->isLogged())
|
||||
$groups = $context->customer->getGroups();
|
||||
|
||||
$frontend = true;
|
||||
$groups = array();
|
||||
if (isset($context->employee))
|
||||
{
|
||||
$shop_list = array((int)$context->shop->id);
|
||||
$frontend = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get shops and groups list
|
||||
$shop_list = Shop::getContextListShopID();
|
||||
if (isset($context->customer) && $context->customer->isLogged())
|
||||
$groups = $context->customer->getGroups();
|
||||
elseif (isset($context->customer) && $context->customer->isLogged(true))
|
||||
$groups = array((int)Configuration::get('PS_GUEST_GROUP'));
|
||||
else
|
||||
$groups = array((int)Configuration::get('PS_UNIDENTIFIED_GROUP'));
|
||||
}
|
||||
|
||||
// SQL Request
|
||||
$sql = new DbQuery();
|
||||
$sql->select('h.`name` as hook, m.`id_module`, h.`id_hook`, m.`name` as module, h.`live_edit`');
|
||||
$sql->from('module', 'm');
|
||||
$sql->innerJoin('hook_module', 'hm', 'hm.`id_module` = m.`id_module`');
|
||||
$sql->innerJoin('hook', 'h', 'hm.`id_hook` = h.`id_hook`');
|
||||
$sql->where('(SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE ms.id_module = m.id_module AND ms.id_shop IN('.implode(', ', $shop_list).')) = '.count($shop_list));
|
||||
$sql->where('hm.id_shop IN('.implode(', ', $shop_list).')');
|
||||
$sql->where('(SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE ms.id_module = m.id_module AND ms.id_shop IN ('.implode(', ', $shop_list).')) = '.count($shop_list));
|
||||
if ($hook_name != 'displayPayment')
|
||||
$sql->where('h.name != "displayPayment"');
|
||||
// For payment modules, we check that they are available in the contextual country
|
||||
elseif ($frontend)
|
||||
{
|
||||
if (Validate::isLoadedObject($context->country))
|
||||
$sql->where('(h.name = "displayPayment" AND (SELECT id_country FROM '._DB_PREFIX_.'module_country mc WHERE mc.id_module = m.id_module AND id_country = '.(int)$context->country->id.' LIMIT 1) = '.(int)$context->country->id.')');
|
||||
if (Validate::isLoadedObject($context->currency))
|
||||
$sql->where('(h.name = "displayPayment" AND (SELECT id_currency FROM '._DB_PREFIX_.'module_currency mcr WHERE mcr.id_module = m.id_module AND id_currency = '.(int)$context->currency->id.' LIMIT 1) = '.(int)$context->currency->id.')');
|
||||
}
|
||||
if (Validate::isLoadedObject($context->shop))
|
||||
$sql->where('hm.id_shop = '.(int)$context->shop->id);
|
||||
|
||||
if (isset($context->customer) && $context->customer->isLogged())
|
||||
if ($frontend)
|
||||
{
|
||||
$sql->leftJoin('module_group', 'mg', 'mg.`id_module` = m.`id_module`');
|
||||
$sql->where('mg.`id_group` IN('.implode(', ', $groups).')');
|
||||
$sql->where('mg.`id_group` IN ('.implode(', ', $groups).')');
|
||||
$sql->groupBy('hm.id_hook, hm.id_module');
|
||||
}
|
||||
|
||||
$sql->groupBy('hm.id_hook, hm.id_module');
|
||||
$sql->orderBy('hm.`position`');
|
||||
|
||||
// Store results per hook name
|
||||
@@ -297,11 +320,12 @@ class HookCore extends ObjectModel
|
||||
'live_edit' => $row['live_edit'],
|
||||
);
|
||||
}
|
||||
|
||||
Cache::store($cache_id, $list);
|
||||
|
||||
// @todo remove this in 1.6, we keep it in 1.5 for retrocompatibility
|
||||
self::$_hook_modules_cache_exec = $list;
|
||||
if ($hook_name != 'displayPayment')
|
||||
{
|
||||
Cache::store($cache_id, $list);
|
||||
// @todo remove this in 1.6, we keep it in 1.5 for retrocompatibility
|
||||
self::$_hook_modules_cache_exec = $list;
|
||||
}
|
||||
}
|
||||
else
|
||||
$list = Cache::retrieve($cache_id);
|
||||
|
||||
@@ -66,7 +66,7 @@ class ImageCore extends ObjectModel
|
||||
'fields' => array(
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'shop' => true),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -89,9 +89,13 @@ class ImageCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!parent::delete() ||
|
||||
!$this->deleteProductAttributeImage() ||
|
||||
!$this->deleteImage())
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
|
||||
if ($this->hasMultishopEntries())
|
||||
return true;
|
||||
|
||||
if (!$this->deleteProductAttributeImage() || !$this->deleteImage())
|
||||
return false;
|
||||
|
||||
// update positions
|
||||
@@ -185,12 +189,17 @@ class ImageCore extends ObjectModel
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.'product_'.$id_product.'.jpg'))
|
||||
unlink(_PS_TMP_IMG_DIR_.'product_'.$id_product.'.jpg');
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 0
|
||||
WHERE `id_product` = '.(int)$id_product
|
||||
);
|
||||
) &&
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image` i, `'._DB_PREFIX_.'image_shop` image_shop
|
||||
SET image_shop.`cover` = 0
|
||||
WHERE image_shop.id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID())).') AND image_shop.id_image = i.id_image AND i.`id_product` = '.(int)$id_product
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,10 +211,10 @@ class ImageCore extends ObjectModel
|
||||
public static function getCover($id_product)
|
||||
{
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT * FROM `'._DB_PREFIX_.'image`
|
||||
SELECT * FROM `'._DB_PREFIX_.'image` i'.
|
||||
Shop::addSqlAssociation('image', 'i').'
|
||||
WHERE `id_product` = '.(int)$id_product.'
|
||||
AND `cover`= 1
|
||||
');
|
||||
AND image_shop.`cover`= 1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -589,9 +598,9 @@ class ImageCore extends ObjectModel
|
||||
// image exists in DB and with the correct product?
|
||||
if (Validate::isLoadedObject($image) && $image->id_product == (int)rtrim($matches[1], '-'))
|
||||
{
|
||||
// create the new folder if it does not exist
|
||||
if (!$image->createImgFolder())
|
||||
return false;
|
||||
// create the new folder if it does not exist
|
||||
if (!$image->createImgFolder())
|
||||
return false;
|
||||
|
||||
// if there's already a file at the new image path, move it to a dump folder
|
||||
// most likely the preexisting image is a demo image not linked to a product and it's ok to replace it
|
||||
|
||||
@@ -75,7 +75,11 @@ class ImageManagerCore
|
||||
ImageManager::resize($image, _PS_TMP_IMG_DIR_.$cache_image, $ratio_x, $size, $image_type);
|
||||
}
|
||||
}
|
||||
return '<img src="'._PS_TMP_IMG_.$cache_image.(!$disable_cache ? '?time='.time() : '').'" alt="" class="imgm" />';
|
||||
// Relative link will always work, whatever the base uri set in the admin
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
return '<img src="../img/tmp/'.$cache_image.(!$disable_cache ? '?time='.time() : '').'" alt="" class="imgm" />';
|
||||
else
|
||||
return '<img src="'._PS_TMP_IMG_.$cache_image.(!$disable_cache ? '?time='.time() : '').'" alt="" class="imgm" />';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,7 +241,7 @@ class ImageManagerCore
|
||||
// Filter on file extension
|
||||
$authorized_extensions = array('gif', 'jpg', 'jpeg', 'jpe', 'png');
|
||||
$name_explode = explode('.', $filename);
|
||||
if (count($name_explode))
|
||||
if (count($name_explode) >= 2)
|
||||
{
|
||||
$current_extension = strtolower($name_explode[count($name_explode) - 1]);
|
||||
if (!in_array($current_extension, $authorized_extensions))
|
||||
|
||||
@@ -104,12 +104,12 @@ class LanguageCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate traslations files
|
||||
* Generate translations files
|
||||
*
|
||||
*/
|
||||
protected function _generateFiles($newIso = null)
|
||||
{
|
||||
$iso_code = $newIso?$newIso:$this->iso_code;
|
||||
$iso_code = $newIso ? $newIso : $this->iso_code;
|
||||
|
||||
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
|
||||
mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
|
||||
@@ -130,7 +130,6 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
@chmod($path_file, 0777);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -261,7 +260,7 @@ class LanguageCore extends ObjectModel
|
||||
$mPath_to = _PS_MAIL_DIR_.(string)$iso_to.'/';
|
||||
}
|
||||
|
||||
$lFiles = array('admin.php', 'errors.php', 'fields.php', 'pdf.php', 'tabs.php');
|
||||
$lFiles = array('admin.php', 'errors.php', 'fields.php', 'pdf.php', 'tabs.php', 'index.php');
|
||||
|
||||
// Added natives mails files
|
||||
$mFiles = array(
|
||||
@@ -296,7 +295,7 @@ class LanguageCore extends ObjectModel
|
||||
'test.html', 'test.txt',
|
||||
'voucher.html', 'voucher.txt',
|
||||
'voucher_new.html', 'voucher_new.txt',
|
||||
'order_changed.html', 'order_changed.txt'
|
||||
'order_changed.html', 'order_changed.txt', 'index.php'
|
||||
);
|
||||
|
||||
$number = -1;
|
||||
@@ -473,7 +472,7 @@ class LanguageCore extends ObjectModel
|
||||
// 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 (isset($row['Tables_in_'._DB_NAME_]) && !empty($row['Tables_in_'._DB_NAME_]) && 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;
|
||||
|
||||
@@ -516,7 +515,14 @@ class LanguageCore extends ObjectModel
|
||||
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');
|
||||
$files_copy = array(
|
||||
'/en.jpg',
|
||||
'/en-default-thickbox_default.jpg',
|
||||
'/en-default-home_default.jpg',
|
||||
'/en-default-large_default.jpg',
|
||||
'/en-default-medium_default.jpg',
|
||||
'/en-default-small_default.jpg'
|
||||
);
|
||||
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
||||
foreach ($tos as $to)
|
||||
foreach ($files_copy as $file)
|
||||
@@ -719,14 +725,18 @@ class LanguageCore extends ObjectModel
|
||||
else
|
||||
Language::_copyNoneFlag($insert_id);
|
||||
|
||||
$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');
|
||||
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
||||
foreach ($tos as $to)
|
||||
$files_copy = array(
|
||||
'/en.jpg',
|
||||
'/en-default-thickbox_default.jpg',
|
||||
'/en-default-home_default.jpg',
|
||||
'/en-default-large_default.jpg',
|
||||
'/en-default-medium_default.jpg',
|
||||
'/en-default-small_default.jpg',
|
||||
'/en-default-scene_default.jpg'
|
||||
);
|
||||
foreach (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to)
|
||||
foreach ($files_copy as $file)
|
||||
{
|
||||
$name = str_replace('/en', '/'.$iso_code, $file);
|
||||
copy(dirname(__FILE__).'/../img/l'.$file, $to.$name);
|
||||
}
|
||||
@copy(dirname(__FILE__).'/../img/l'.$file, $to.str_replace('/en', '/'.$iso_code, $file));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -109,7 +109,6 @@ class LinkCore
|
||||
$params['id'] = $product->id;
|
||||
$params['rewrite'] = (!$alias) ? $product->getFieldByLang('link_rewrite') : $alias;
|
||||
$params['ean13'] = (!$ean13) ? $product->ean13 : $ean13;
|
||||
$params['category'] = (!$category) ? $product->category : $category;
|
||||
$params['meta_keywords'] = Tools::str2url($product->getFieldByLang('meta_keywords'));
|
||||
$params['meta_title'] = Tools::str2url($product->getFieldByLang('meta_title'));
|
||||
|
||||
@@ -124,9 +123,13 @@ class LinkCore
|
||||
|
||||
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'tags'))
|
||||
$params['tags'] = Tools::str2url($product->getTags($id_lang));
|
||||
|
||||
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'reference'))
|
||||
$params['reference'] = Tools::str2url($product->reference);
|
||||
|
||||
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'categories'))
|
||||
{
|
||||
$params['category'] = (!$category) ? $product->category : $category;
|
||||
$cats = array();
|
||||
foreach ($product->getParentCategories() as $cat)
|
||||
$cats[] = $cat['link_rewrite'];
|
||||
@@ -318,7 +321,7 @@ class LinkCore
|
||||
|
||||
// If the module has its own route ... just use it !
|
||||
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang))
|
||||
return $this->getPageLink('module-'.$module.'-'.$controller, $params);
|
||||
return $this->getPageLink('module-'.$module.'-'.$controller, $ssl, $id_lang, $params);
|
||||
else
|
||||
return $url.Dispatcher::getInstance()->createUrl('module', $id_lang, $params, $this->allow);
|
||||
}
|
||||
@@ -352,9 +355,9 @@ class LinkCore
|
||||
$theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : '');
|
||||
if ((Configuration::get('PS_LEGACY_IMAGES')
|
||||
&& (file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg')))
|
||||
|| strpos($ids, 'default') !== false)
|
||||
|| ($not_default = strpos($ids, 'default') !== false))
|
||||
{
|
||||
if ($this->allow == 1)
|
||||
if ($this->allow == 1 && !$not_default)
|
||||
$uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg';
|
||||
else
|
||||
$uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg';
|
||||
@@ -405,7 +408,7 @@ class LinkCore
|
||||
$request = urlencode($request);
|
||||
parse_str($request, $request);
|
||||
}
|
||||
unset($request['controller']);
|
||||
unset($request['controller'], $request['module']);
|
||||
|
||||
$uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request);
|
||||
$url = ($ssl && $this->ssl_enable) ? Tools::getShopDomainSsl(true) : Tools::getShopDomain(true);
|
||||
@@ -441,7 +444,20 @@ class LinkCore
|
||||
$controller = Dispatcher::getInstance()->getController();
|
||||
if (!empty(Context::getContext()->controller->php_self))
|
||||
$controller = Context::getContext()->controller->php_self;
|
||||
|
||||
|
||||
if ($controller == 'product' && isset($params['id_product']))
|
||||
return $this->getProductLink((int)$params['id_product'], null, null, null, (int)$id_lang);
|
||||
elseif ($controller == 'category' && isset($params['id_category']))
|
||||
return $this->getCategoryLink((int)$params['id_category'], null, (int)$id_lang);
|
||||
elseif ($controller == 'supplier' && isset($params['id_supplier']))
|
||||
return $this->getSupplierLink((int)$params['id_supplier'], null, (int)$id_lang);
|
||||
elseif ($controller == 'manufacturer' && isset($params['id_manufacturer']))
|
||||
return $this->getManufacturerLink((int)$params['id_manufacturer'], null, (int)$id_lang);
|
||||
elseif ($controller == 'cms' && isset($params['id_cms']))
|
||||
return $this->getCMSLink((int)$params['id_cms'], null, false, (int)$id_lang);
|
||||
elseif ($controller == 'cms' && isset($params['id_cms_category']))
|
||||
return $this->getCMSCategoryLink((int)$params['id_cms_category'], null, (int)$id_lang);
|
||||
|
||||
return $this->getPageLink($controller, false, $id_lang, $params);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,15 +53,14 @@ class LocalizationPackCore
|
||||
$res &= $this->installConfiguration($xml);
|
||||
$res &= $this->installModules($xml);
|
||||
$res &= $this->updateDefaultGroupDisplayMethod($xml);
|
||||
|
||||
if (!defined('_PS_MODE_DEV_') || !_PS_MODE_DEV_)
|
||||
$res &= $this->_installLanguages($xml, $install_mode);
|
||||
$res &= $this->_installLanguages($xml, $install_mode);
|
||||
|
||||
if ($res && isset($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)
|
||||
Configuration::updateValue('PS_LANG_DEFAULT', $id_lang);
|
||||
}
|
||||
|
||||
if ($install_mode && $res && isset($this->iso_currency))
|
||||
@@ -157,9 +156,9 @@ class LocalizationPackCore
|
||||
$tax->rate = (float)$attributes['rate'];
|
||||
$tax->active = 1;
|
||||
|
||||
if (!$tax->validateFields())
|
||||
if (($error = $tax->validateFields(false, true)) !== true || ($error = $tax->validateFieldsLang(false, true)) !== true)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Invalid tax properties.');
|
||||
$this->_errors[] = Tools::displayError('Invalid tax properties.').' '.$error;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -300,44 +299,46 @@ class LocalizationPackCore
|
||||
$native_iso_code = array();
|
||||
foreach ($native_lang as $lang)
|
||||
$native_iso_code[] = $lang['iso_code'];
|
||||
if ((in_array((string)$attributes['iso_code'], $native_iso_code) && !$install_mode)
|
||||
|| !in_array((string)$attributes['iso_code'], $native_iso_code))
|
||||
// if we are not in an installation context or if the pack is not available in the local directory
|
||||
if (!$install_mode || !in_array((string)$attributes['iso_code'], $native_iso_code))
|
||||
{
|
||||
$errno = 0;
|
||||
$errstr = '';
|
||||
if (@fsockopen('api.prestashop.com', 80, $errno, $errstr, 10))
|
||||
if (!@fsockopen('api.prestashop.com', 80, $errno, $errstr, 5))
|
||||
$this->_errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||
elseif (!($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code']))))
|
||||
$this->_errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
||||
elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
|
||||
{
|
||||
if ($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://api.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code'])))
|
||||
$file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
|
||||
if (file_put_contents($file, $content))
|
||||
{
|
||||
if ($content = Tools::file_get_contents('http://api.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
|
||||
$gz = new Archive_Tar($file, true);
|
||||
$files_list = $gz->listContent();
|
||||
|
||||
if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
||||
{
|
||||
$file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
|
||||
if (file_put_contents($file, $content))
|
||||
{
|
||||
$gz = new Archive_Tar($file, true);
|
||||
|
||||
if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$attributes['iso_code'];
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Language::checkAndAddLanguage((string)$attributes['iso_code']))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$attributes['iso_code'];
|
||||
return false;
|
||||
}
|
||||
|
||||
@unlink($file);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||
$this->_errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$attributes['iso_code'];
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AdminTranslationsController::checkAndAddMailsFiles($attributes['iso_code'], $files_list);
|
||||
AdminTranslationsController::addNewTabs($attributes['iso_code'], $files_list);
|
||||
}
|
||||
|
||||
if (!Language::checkAndAddLanguage((string)$attributes['iso_code']))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$attributes['iso_code'];
|
||||
return false;
|
||||
}
|
||||
|
||||
@unlink($file);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
||||
$this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||
}
|
||||
}
|
||||
|
||||
// change the default language if there is only one language in the localization pack
|
||||
|
||||
@@ -325,11 +325,11 @@ class MailCore
|
||||
|
||||
if (!is_array($_LANGMAIL))
|
||||
return (str_replace('"', '"', $string));
|
||||
if (array_key_exists($key, $_LANGMAIL))
|
||||
if (array_key_exists($key, $_LANGMAIL) && !empty($_LANGMAIL[$key]))
|
||||
$str = $_LANGMAIL[$key];
|
||||
else
|
||||
$str = $string;
|
||||
|
||||
return str_replace('"', '"', addslashes($str));
|
||||
return str_replace('"', '"', stripslashes($str));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,8 +103,6 @@ class ManufacturerCore extends ObjectModel
|
||||
{
|
||||
parent::__construct($id, $id_lang);
|
||||
|
||||
/* Get the manufacturer's id_address */
|
||||
$this->id_address = $this->getManufacturerAddress();
|
||||
$this->link_rewrite = $this->getLink();
|
||||
$this->image_dir = _PS_MANU_IMG_DIR_;
|
||||
}
|
||||
@@ -149,16 +147,7 @@ class ManufacturerCore extends ObjectModel
|
||||
if (!(int)$this->id)
|
||||
return false;
|
||||
|
||||
$result = Db::GetInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT `id_address`
|
||||
FROM '._DB_PREFIX_.'address
|
||||
WHERE `id_manufacturer` = '.(int)$this->id
|
||||
);
|
||||
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
return $result['id_address'];
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_address` FROM '._DB_PREFIX_.'address WHERE `id_manufacturer` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,7 +323,7 @@ class ManufacturerCore extends ObjectModel
|
||||
$alias = 'p.';
|
||||
$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.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`,
|
||||
pl.`meta_title`, pl.`name`, image_shop.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`,
|
||||
DATEDIFF(
|
||||
product_shop.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -351,7 +340,8 @@ class ManufacturerCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i
|
||||
ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
|
||||
ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr
|
||||
@@ -378,6 +368,7 @@ class ManufacturerCore extends ObjectModel
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY '.$alias.pSQL($order_by).' '.pSQL($order_way).'
|
||||
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
||||
|
||||
|
||||
@@ -218,10 +218,15 @@ class MediaCore
|
||||
$file_uri = $js_uri;
|
||||
// check if js files exists
|
||||
|
||||
if (!preg_match('/^http(s?):\/\//i', $file_uri) && !file_exists($file_uri))
|
||||
if (!preg_match('/^http(s?):\/\//i', $file_uri) && !@filemtime($file_uri))
|
||||
return false;
|
||||
|
||||
// adding file to the big array...;
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
{
|
||||
$js_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $js_uri);
|
||||
$js_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$js_uri;
|
||||
}
|
||||
|
||||
return $js_uri;
|
||||
}
|
||||
|
||||
@@ -240,12 +245,15 @@ class MediaCore
|
||||
$url_data = parse_url($css_uri);
|
||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
||||
// check if css files exists
|
||||
if (!file_exists($file_uri))
|
||||
if (!@filemtime($file_uri))
|
||||
return false;
|
||||
|
||||
// adding file to the big array...
|
||||
if (is_array($css_uri))
|
||||
return $css_uri;
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
{
|
||||
$css_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $css_uri);
|
||||
$css_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$css_uri;
|
||||
}
|
||||
|
||||
return array($css_uri => $css_media_type);
|
||||
}
|
||||
|
||||
@@ -269,13 +277,14 @@ class MediaCore
|
||||
$folder = _PS_JS_DIR_.'jquery/'; //set default folder
|
||||
//check if file exist
|
||||
$file = $folder.'jquery-'.$version.($minifier ? '.min.js' : '.js');
|
||||
|
||||
// remove PS_BASE_URI on _PS_ROOT_DIR_ for the following
|
||||
$url_data = parse_url($file);
|
||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
||||
// check if js files exists, if not try to load query from ajax.googleapis.com
|
||||
|
||||
$return = array();
|
||||
if (file_exists($file_uri))
|
||||
if (@filemtime($file_uri))
|
||||
$return[] = Media::getJSPath($file);
|
||||
else
|
||||
$return[] = Media::getJSPath(Tools::getCurrentUrlProtocolPrefix().'ajax.googleapis.com/ajax/libs/jquery/'.$version.'/jquery'.($minifier ? '.min.js' : '.js'));
|
||||
@@ -314,7 +323,7 @@ class MediaCore
|
||||
$ui_path['css'] = array_merge($ui_path['css'], $comp_css);
|
||||
}
|
||||
|
||||
if (file_exists($file_uri))
|
||||
if (@filemtime($file_uri))
|
||||
{
|
||||
if (!empty($ui_tmp))
|
||||
{
|
||||
@@ -351,9 +360,9 @@ class MediaCore
|
||||
$file = 'jquery.'.$name.'.js';
|
||||
$url_data = parse_url($folder);
|
||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
||||
if (file_exists($file_uri.$file))
|
||||
if (@filemtime($file_uri.$file))
|
||||
$plugin_path['js'] = Media::getJSPath($folder.$file);
|
||||
else if (file_exists($file_uri.$name.'/'.$file))
|
||||
elseif (@filemtime($file_uri.$name.'/'.$file))
|
||||
$plugin_path['js'] = Media::getJSPath($folder.$name.'/'.$file);
|
||||
else
|
||||
return false;
|
||||
@@ -373,9 +382,9 @@ class MediaCore
|
||||
$file = 'jquery.'.$name.'.css';
|
||||
$url_data = parse_url($folder);
|
||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
||||
if (file_exists($file_uri.$file))
|
||||
if (@filemtime($file_uri.$file))
|
||||
return Media::getCSSPath($folder.$file);
|
||||
else if (file_exists($file_uri.$name.'/'.$file))
|
||||
elseif (@filemtime($file_uri.$name.'/'.$file))
|
||||
return Media::getCSSPath($folder.$name.'/'.$file);
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -127,7 +127,7 @@ class MetaCore extends ObjectModel
|
||||
$sql = 'SELECT *
|
||||
FROM '._DB_PREFIX_.'meta m
|
||||
LEFT JOIN '._DB_PREFIX_.'meta_lang ml on (m.id_meta = ml.id_meta)
|
||||
WHERE m.page = \''.pSQL($page).'\'
|
||||
WHERE (m.page = \''.pSQL($page).'\' OR m.page=\''.str_replace('-', '', strtolower($page)).'\')
|
||||
AND ml.id_lang = '.(int)$id_lang
|
||||
.Shop::addSqlRestrictionOnLang('ml');
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -184,21 +184,19 @@ class MetaCore extends ObjectModel
|
||||
public static function getMetaTags($id_lang, $page_name, $title = '')
|
||||
{
|
||||
global $maintenance;
|
||||
|
||||
$page_name = str_replace('-', '', strtolower($page_name));
|
||||
if (!(isset($maintenance) && (!in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))))
|
||||
{
|
||||
if ($id_product = Tools::getValue('id_product'))
|
||||
if ($page_name == 'product' && ($id_product = Tools::getValue('id_product')))
|
||||
return Meta::getProductMetas($id_product, $id_lang, $page_name);
|
||||
else if ($id_category = Tools::getValue('id_category'))
|
||||
elseif ($page_name == 'category' && ($id_category = Tools::getValue('id_category')))
|
||||
return Meta::getCategoryMetas($id_category, $id_lang, $page_name, $title);
|
||||
else if ($id_manufacturer = Tools::getValue('id_manufacturer'))
|
||||
elseif ($page_name == 'manufacturer' && ($id_manufacturer = Tools::getValue('id_manufacturer')))
|
||||
return Meta::getManufacturerMetas($id_manufacturer, $id_lang, $page_name);
|
||||
else if ($id_supplier = Tools::getValue('id_supplier'))
|
||||
elseif ($page_name == 'supplier' && ($id_supplier = Tools::getValue('id_supplier')))
|
||||
return Meta::getSupplierMetas($id_supplier, $id_lang, $page_name);
|
||||
else if ($id_cms = Tools::getValue('id_cms'))
|
||||
elseif ($page_name == 'cms' && ($id_cms = Tools::getValue('id_cms')))
|
||||
return Meta::getCmsMetas($id_cms, $id_lang, $page_name);
|
||||
else if ($id_cms_category = Tools::getValue('id_cms_category'))
|
||||
elseif ($page_name == 'cms' && ($id_cms_category = Tools::getValue('id_cms_category')))
|
||||
return Meta::getCmsCategoryMetas($id_cms_category, $id_lang, $page_name);
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ abstract class ObjectModelCore
|
||||
$fields = array_merge($fields, $this->getFieldsShop());
|
||||
|
||||
// Ensure that we get something to insert
|
||||
if (!$fields)
|
||||
if (!$fields && isset($this->id) && Validate::isUnsignedId($this->id))
|
||||
$fields[$this->def['primary']] = $this->id;
|
||||
return $fields;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ abstract class ObjectModelCore
|
||||
public function getFieldsShop()
|
||||
{
|
||||
$fields = $this->formatFields(self::FORMAT_SHOP);
|
||||
if (!$fields)
|
||||
if (!$fields && isset($this->id) && Validate::isUnsignedId($this->id))
|
||||
$fields[$this->def['primary']] = $this->id;
|
||||
return $fields;
|
||||
}
|
||||
@@ -449,7 +449,19 @@ abstract class ObjectModelCore
|
||||
if ($autodate && property_exists($this, 'date_upd'))
|
||||
$this->date_upd = date('Y-m-d H:i:s');
|
||||
|
||||
|
||||
if (Shop::isTableAssociated($this->def['table']))
|
||||
{
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list) > 0)
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
}
|
||||
|
||||
// Database insertion
|
||||
if (isset($this->id) && !Tools::getValue('forceIDs'))
|
||||
unset($this->id);
|
||||
if (Shop::checkIdShopDefault($this->def['table']))
|
||||
$this->id_shop_default = min($id_shop_list);
|
||||
if (!$result = ObjectModel::$db->insert($this->def['table'], $this->getFields(), $null_values))
|
||||
return false;
|
||||
|
||||
@@ -459,10 +471,6 @@ abstract class ObjectModelCore
|
||||
// Database insertion for multishop fields related to the object
|
||||
if (Shop::isTableAssociated($this->def['table']))
|
||||
{
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list) > 0)
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
|
||||
$fields = $this->getFieldsShop();
|
||||
$fields[$this->def['primary']] = (int)$this->id;
|
||||
|
||||
@@ -532,7 +540,13 @@ abstract class ObjectModelCore
|
||||
// Automatically fill dates
|
||||
if (array_key_exists('date_upd', $this))
|
||||
$this->date_upd = date('Y-m-d H:i:s');
|
||||
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list) > 0)
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
|
||||
if (Shop::checkIdShopDefault($this->def['table']) && !$this->id_shop_default)
|
||||
$this->id_shop_default = min($id_shop_list);
|
||||
// Database update
|
||||
if (!$result = ObjectModel::$db->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id, 0, $null_values))
|
||||
return false;
|
||||
@@ -553,9 +567,6 @@ abstract class ObjectModelCore
|
||||
else
|
||||
$all_fields = $fields;
|
||||
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list) > 0)
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
|
||||
foreach ($id_shop_list as $id_shop)
|
||||
{
|
||||
@@ -612,7 +623,7 @@ abstract class ObjectModelCore
|
||||
if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '.pSQL(_DB_PREFIX_.$this->def['table']).'_lang WHERE '.$where))
|
||||
$result &= ObjectModel::$db->update($this->def['table'].'_lang', $field, $where);
|
||||
else
|
||||
$result &= ObjectModel::$db->insert($this->def['table'].'_lang', $field, 'INSERT');
|
||||
$result &= ObjectModel::$db->insert($this->def['table'].'_lang', $field, $null_values);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -859,8 +870,8 @@ abstract class ObjectModelCore
|
||||
$size = array('min' => 0, 'max' => $data['size']);
|
||||
|
||||
$length = Tools::strlen($value);
|
||||
if ($length < $size['min'] || $length > $size)
|
||||
return 'Property '.get_class($this).'->'.$field.' has bad length ('.$length.') and must be between '.$size['min'].' and '.$size['max'];
|
||||
if ($length < $size['min'] || $length > $size['max'])
|
||||
return 'Property '.get_class($this).'->'.$field.' length ('.$length.') must be between '.$size['min'].' and '.$size['max'];
|
||||
}
|
||||
|
||||
// Check field validator
|
||||
@@ -900,8 +911,13 @@ abstract class ObjectModelCore
|
||||
public function validateController($htmlentities = true)
|
||||
{
|
||||
$errors = array();
|
||||
$required_fields_database = (isset(self::$fieldsRequiredDatabase[get_class($this)])) ? self::$fieldsRequiredDatabase[get_class($this)] : array();
|
||||
foreach ($this->def['fields'] as $field => $data)
|
||||
{
|
||||
// Check if field is required by user
|
||||
if (in_array($field, $required_fields_database))
|
||||
$data['required'] = true;
|
||||
|
||||
// Checking for required fields
|
||||
if (isset($data['required']) && $data['required'] && ($value = Tools::getValue($field, $this->{$field})) == false && (string)$value != '0')
|
||||
if (!$this->id || $field != 'passwd')
|
||||
@@ -1015,18 +1031,29 @@ abstract class ObjectModelCore
|
||||
public function getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)
|
||||
{
|
||||
$assoc = Shop::getAssoTable($this->def['table']);
|
||||
$class_name = WebserviceRequest::$ws_current_classname;
|
||||
$vars = get_class_vars($class_name);
|
||||
if ($assoc !== false)
|
||||
{
|
||||
$multi_shop_join = ' LEFT JOIN `'._DB_PREFIX_.bqSQL($this->def['table']).'_'.bqSQL($assoc['type']).'`
|
||||
AS multi_shop_'.bqSQL($this->def['table']).'
|
||||
ON (main.'.bqSQL($this->def['primary']).' = multi_shop_'.bqSQL($this->def['table']).'.'.bqSQL($this->def['primary']).')';
|
||||
$class_name = WebserviceRequest::$ws_current_classname;
|
||||
$vars = get_class_vars($class_name);
|
||||
foreach ($vars['shopIDs'] as $id_shop)
|
||||
$or[] = ' multi_shop_'.bqSQL($this->def['table']).'.id_shop = '.(int)$id_shop.' ';
|
||||
$multi_shop_filter = ' AND ('.implode('OR', $or).') ';
|
||||
$sql_filter = $multi_shop_filter.' '.$sql_filter;
|
||||
$sql_join = $multi_shop_join.' '.$sql_join;
|
||||
if ($assoc['type'] !== 'fk_shop')
|
||||
{
|
||||
$multi_shop_join = ' LEFT JOIN `'._DB_PREFIX_.bqSQL($this->def['table']).'_'.bqSQL($assoc['type']).'`
|
||||
AS `multi_shop_'.bqSQL($this->def['table']).'`
|
||||
ON (main.`'.bqSQL($this->def['primary']).'` = `multi_shop_'.bqSQL($this->def['table']).'`.`'.bqSQL($this->def['primary']).'`)';
|
||||
$sql_filter = 'AND `multi_shop_'.bqSQL($this->def['table']).'`.id_shop = '.Context::getContext()->shop->id.' '.$sql_filter;
|
||||
$sql_join = $multi_shop_join.' '.$sql_join;
|
||||
}
|
||||
else
|
||||
{
|
||||
$vars = get_class_vars($class_name);
|
||||
foreach ($vars['shopIDs'] as $id_shop)
|
||||
$or[] = ' main.id_shop = '.(int)$id_shop.' ';
|
||||
|
||||
$prepend = '';
|
||||
if (count($or))
|
||||
$prepend = 'AND ('.implode('OR', $or).')';
|
||||
$sql_filter = $prepend.' '.$sql_filter;
|
||||
}
|
||||
}
|
||||
$query = '
|
||||
SELECT DISTINCT main.`'.bqSQL($this->def['primary']).'` FROM `'._DB_PREFIX_.bqSQL($this->def['table']).'` AS main
|
||||
@@ -1034,10 +1061,31 @@ abstract class ObjectModelCore
|
||||
WHERE 1 '.$sql_filter.'
|
||||
'.($sql_sort != '' ? $sql_sort : '').'
|
||||
'.($sql_limit != '' ? $sql_limit : '');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
}
|
||||
|
||||
public function validateFieldsRequiredDatabase($htmlentities = true)
|
||||
{
|
||||
$errors = array();
|
||||
$required_fields = (isset(self::$fieldsRequiredDatabase[get_class($this)])) ? self::$fieldsRequiredDatabase[get_class($this)] : array();
|
||||
|
||||
foreach ($this->def['fields'] as $field => $data)
|
||||
{
|
||||
if (!in_array($field, $required_fields))
|
||||
continue;
|
||||
|
||||
if (!method_exists('Validate', $data['validate']))
|
||||
throw new PrestaShopException('Validation function not found. '.$data['validate']);
|
||||
|
||||
$value = Tools::getValue($field);
|
||||
|
||||
if (empty($value))
|
||||
$errors[] = sprintf(Tools::displayError('The field %s is required.'), self::displayFieldName($field, get_class($this), $htmlentities));
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
public function getFieldsRequiredDatabase($all = false)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
@@ -1165,9 +1213,8 @@ abstract class ObjectModelCore
|
||||
public function hasMultishopEntries()
|
||||
{
|
||||
if (!Shop::isTableAssociated($this->def['table']) || !Shop::isFeatureActive())
|
||||
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) > 1);
|
||||
return false;
|
||||
return (bool)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
public function isMultishop()
|
||||
@@ -1275,8 +1322,11 @@ abstract class ObjectModelCore
|
||||
* @param bool $has_active_column true if the table has an active column
|
||||
* @return bool
|
||||
*/
|
||||
public static function isCurrentlyUsed($table, $has_active_column = false)
|
||||
public static function isCurrentlyUsed($table = null, $has_active_column = false)
|
||||
{
|
||||
if ($table === null)
|
||||
$table = self::$definition['table'];
|
||||
|
||||
$query = new DbQuery();
|
||||
$query->select('`id_'.pSQL($table).'`');
|
||||
$query->from($table);
|
||||
|
||||
@@ -126,13 +126,14 @@ class PackCore extends Product
|
||||
if (!Pack::isFeatureActive())
|
||||
return array();
|
||||
|
||||
$sql = 'SELECT p.*, product_shop.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity, product_shop.`id_category_default`
|
||||
$sql = 'SELECT p.*, product_shop.*, pl.*, image_shop.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity, product_shop.`id_category_default`, a.id_product_pack
|
||||
FROM `'._DB_PREFIX_.'pack` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON p.id_product = pl.id_product
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
@@ -144,6 +145,7 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE product_shop.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
AND a.`id_product_pack` = '.(int)$id_product;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!$full)
|
||||
@@ -170,11 +172,12 @@ class PackCore extends Product
|
||||
return array();
|
||||
|
||||
$sql = '
|
||||
SELECT p.*, product_shop.*, pl.*, i.`id_image`, il.`legend`, t.`rate`
|
||||
SELECT p.*, product_shop.*, pl.*, image_shop.`id_image`, il.`legend`, t.`rate`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
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.'
|
||||
@@ -183,7 +186,8 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE pl.`id_lang` = '.(int)$id_lang.'
|
||||
'.Shop::addSqlRestrictionOnLang('pl').'
|
||||
AND p.`id_product` IN ('.$packs.')';
|
||||
AND p.`id_product` IN ('.$packs.')
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))';
|
||||
if ($limit)
|
||||
$sql .= ' LIMIT '.(int)$limit;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
@@ -111,21 +111,13 @@ abstract class PaymentModuleCore extends Module
|
||||
*/
|
||||
public function addCheckboxCountryRestrictionsForModule(array $shops = array())
|
||||
{
|
||||
if (!$shops)
|
||||
$shops = Shop::getShops(true, null, true);
|
||||
|
||||
foreach ($shops as $s)
|
||||
{
|
||||
if (!Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_country` (`id_module`, `id_shop`, `id_country`)
|
||||
SELECT '.(int)$this->id.', "'.(int)$s.'", `id_country` FROM `'._DB_PREFIX_.'country` WHERE active = 1'))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
$countries = Country::getCountries((int)Context::getContext()->language->id, true); //get only active country
|
||||
$country_ids = array();
|
||||
foreach ($countries as $country)
|
||||
$country_ids[] = $country['id_country'];
|
||||
return Country::addModuleRestrictions($shops, $countries, array(array('id_module' => (int)$this->id)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validate an order in database
|
||||
* Function called from a payment module
|
||||
@@ -491,9 +483,9 @@ abstract class PaymentModuleCore extends Module
|
||||
$old_message = Message::getMessageByCartId((int)$this->context->cart->id);
|
||||
if ($old_message)
|
||||
{
|
||||
$message = new Message((int)$old_message['id_message']);
|
||||
$message->id_order = (int)$order->id;
|
||||
$message->update();
|
||||
$update_message = new Message((int)$old_message['id_message']);
|
||||
$update_message->id_order = (int)$order->id;
|
||||
$update_message->update();
|
||||
|
||||
// Add this message in the customer thread
|
||||
$customer_thread = new CustomerThread();
|
||||
@@ -510,7 +502,7 @@ abstract class PaymentModuleCore extends Module
|
||||
$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->message = htmlentities($update_message->message, ENT_COMPAT, 'UTF-8');
|
||||
$customer_message->private = 0;
|
||||
|
||||
if (!$customer_message->add())
|
||||
|
||||
@@ -51,6 +51,9 @@ class ProductCore extends ObjectModel
|
||||
/** @var integer default Category id */
|
||||
public $id_category_default;
|
||||
|
||||
/** @var integer default Shop id */
|
||||
public $id_shop_default;
|
||||
|
||||
/** @var string Manufacturer name */
|
||||
public $manufacturer_name;
|
||||
|
||||
@@ -237,6 +240,7 @@ class ProductCore extends ObjectModel
|
||||
'multilang_shop' => true,
|
||||
'fields' => array(
|
||||
// Classic fields
|
||||
'id_shop_default' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 32),
|
||||
@@ -297,6 +301,7 @@ class ProductCore extends ObjectModel
|
||||
'default_category' => array('type' => self::HAS_ONE, 'field' => 'id_category_default', 'object' => 'Category'),
|
||||
'tax_rules_group' => array('type' => self::HAS_ONE),
|
||||
'categories' => array('type' => self::HAS_MANY, 'field' => 'id_category', 'object' => 'Category', 'association' => 'category_product'),
|
||||
'stock_availables' => array('type' => self::HAS_MANY, 'field' => 'id_stock_available', 'object' => 'StockAvailable', 'association' => 'stock_availables'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -346,6 +351,10 @@ class ProductCore extends ObjectModel
|
||||
'getter' => 'getWsManufacturerName',
|
||||
'setter' => false
|
||||
),
|
||||
'quantity' => array(
|
||||
'getter' => false,
|
||||
'setter' => false
|
||||
),
|
||||
),
|
||||
'associations' => array(
|
||||
'categories' => array(
|
||||
@@ -384,6 +393,13 @@ class ProductCore extends ObjectModel
|
||||
'fields' => array(
|
||||
'id' => array('required' => true),
|
||||
)),
|
||||
'stock_availables' => array('resource' => 'stock_available',
|
||||
'fields' => array(
|
||||
'id' => array('required' => true),
|
||||
'id_product_attribute' => array('required' => true),
|
||||
),
|
||||
'setter' => false
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -445,6 +461,11 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!parent::add($autodate, $null_values))
|
||||
return false;
|
||||
|
||||
if ($this->getType() == Product::PTYPE_VIRTUAL)
|
||||
StockAvailable::setProductOutOfStock((int)$this->id, 1);
|
||||
else
|
||||
StockAvailable::setProductOutOfStock((int)$this->id, 2);
|
||||
|
||||
Hook::exec('actionProductSave', array('id_product' => $this->id));
|
||||
return true;
|
||||
@@ -466,10 +487,8 @@ class ProductCore extends ObjectModel
|
||||
die(Tools::displayError());
|
||||
self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int)$customer->id_default_group);
|
||||
}
|
||||
else if (Validate::isLoadedObject(Context::getContext()->customer))
|
||||
self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Context::getContext()->customer->id_default_group);
|
||||
else
|
||||
self::$_taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
|
||||
self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
|
||||
}
|
||||
|
||||
public static function getTaxCalculationMethod($id_customer = null)
|
||||
@@ -641,22 +660,21 @@ class ProductCore extends ObjectModel
|
||||
if ($real_quantity > $physical_quantity)
|
||||
return false;
|
||||
}
|
||||
$result = parent::delete();
|
||||
|
||||
// Removes the product from StockAvailable, for the current shop
|
||||
StockAvailable::removeProductFromStockAvailable($this->id);
|
||||
|
||||
$result = parent::delete();
|
||||
|
||||
$result &= ($this->deleteProductAttributes() && $this->deleteImages() && $this->deleteSceneProducts());
|
||||
// If there are still entries in product_shop, don't remove completly the product
|
||||
if ($this->hasMultishopEntries())
|
||||
return true;
|
||||
|
||||
|
||||
Product::cleanPositions($this->id);
|
||||
|
||||
Hook::exec('actionProductDelete', array('product' => $this));
|
||||
if (!$result ||
|
||||
!GroupReduction::deleteProductReduction($this->id) ||
|
||||
!$this->deleteCategories(true) ||
|
||||
!$this->deleteImages() ||
|
||||
!$this->deleteProductAttributes() ||
|
||||
!$this->deleteProductFeatures() ||
|
||||
!$this->deleteTags() ||
|
||||
!$this->deleteCartProducts() ||
|
||||
@@ -666,7 +684,6 @@ class ProductCore extends ObjectModel
|
||||
!SpecificPrice::deleteByProductId((int)$this->id) ||
|
||||
!$this->deletePack() ||
|
||||
!$this->deleteProductSale() ||
|
||||
!$this->deleteSceneProducts() ||
|
||||
!$this->deleteSearchIndexes() ||
|
||||
!$this->deleteAccessories() ||
|
||||
!$this->deleteFromAccessories() ||
|
||||
@@ -681,12 +698,18 @@ class ProductCore extends ObjectModel
|
||||
public function deleteSelection($products)
|
||||
{
|
||||
$return = 1;
|
||||
if (is_array($products) && count($products))
|
||||
if (is_array($products) && ($count = count($products)))
|
||||
{
|
||||
// Deleting products can be quite long on a cheap server. Let's say 1.5 seconds by product (I've seen it!).
|
||||
if (intval(ini_get('max_execution_time')) < round($count * 1.5))
|
||||
ini_set('max_execution_time', round($count * 1.5));
|
||||
|
||||
foreach ($products as $id_product)
|
||||
{
|
||||
$product = new Product((int)$id_product);
|
||||
$return &= $product->delete();
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -765,9 +788,9 @@ class ProductCore extends ObjectModel
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT c.`id_category`
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
LEFT JOIN `'._DB_PREFIX_.'category` c
|
||||
ON (c.`id_category` = cp.`id_category`)
|
||||
WHERE cp.`id_category` NOT IN('.implode(',', array_map('intval', $categories)).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`)
|
||||
'.Shop::addSqlAssociation('category', 'c', true).'
|
||||
WHERE cp.`id_category` NOT IN ('.implode(',', array_map('intval', $categories)).')
|
||||
AND cp.id_product = '.$this->id
|
||||
);
|
||||
|
||||
@@ -980,7 +1003,7 @@ class ProductCore extends ObjectModel
|
||||
return count($result) > 0;
|
||||
}
|
||||
|
||||
public function productAttributeExists($attributes_list, $current_product_attribute = false, Context $context = null)
|
||||
public function productAttributeExists($attributes_list, $current_product_attribute = false, Context $context = null, $all_shops = false, $return_id = false)
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
return false;
|
||||
@@ -991,18 +1014,17 @@ class ProductCore extends ObjectModel
|
||||
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`)
|
||||
WHERE pas.id_shop ='.(int)$context->shop->id.' AND pa.`id_product` = '.(int)$this->id
|
||||
WHERE 1 '.(!$all_shops ? ' AND pas.id_shop ='.(int)$context->shop->id : '').' AND pa.`id_product` = '.(int)$this->id.
|
||||
($all_shops ? ' GROUP BY pac.id_attribute, pac.id_product_attribute ' : '')
|
||||
);
|
||||
|
||||
/* If something's wrong */
|
||||
if (!$result || empty($result))
|
||||
return false;
|
||||
|
||||
/* Product attributes simulation */
|
||||
$product_attributes = array();
|
||||
foreach ($result as $product_attribute)
|
||||
$product_attributes[$product_attribute['id_product_attribute']][] = $product_attribute['id_attribute'];
|
||||
|
||||
/* Checking product's attribute existence */
|
||||
foreach ($product_attributes as $key => $product_attribute)
|
||||
if (count($product_attribute) == count($attributes_list))
|
||||
@@ -1012,7 +1034,11 @@ class ProductCore extends ObjectModel
|
||||
if (!in_array($product_attribute[$i], $attributes_list) || $key == $current_product_attribute)
|
||||
$diff = true;
|
||||
if (!$diff)
|
||||
{
|
||||
if ($return_id)
|
||||
return $key;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1048,7 +1074,46 @@ class ProductCore extends ObjectModel
|
||||
$this->addSupplierReference($id_supplier, $id_product_attribute);
|
||||
return $id_product_attribute;
|
||||
}
|
||||
|
||||
public function generateMultipleCombinations($combinations, $attributes)
|
||||
{
|
||||
$attributes_list = array();
|
||||
$res = true;
|
||||
$default_on = 1;
|
||||
foreach ($combinations as $key => $combination)
|
||||
{
|
||||
$id_combination = (int)$this->productAttributeExists($attributes[$key], false, null, true, true);
|
||||
$obj = new Combination($id_combination);
|
||||
|
||||
if ($id_combination)
|
||||
{
|
||||
$obj->minimal_quantity = 1;
|
||||
$obj->available_date = '0000-00-00';
|
||||
}
|
||||
|
||||
foreach ($combination as $field => $value)
|
||||
$obj->$field = $value;
|
||||
|
||||
$obj->default_on = $default_on;
|
||||
$default_on = 0;
|
||||
|
||||
$obj->save();
|
||||
|
||||
if (!$id_combination)
|
||||
{
|
||||
$attribute_list = array();
|
||||
foreach ($attributes[$key] as $id_attribute)
|
||||
$attribute_list[] = array(
|
||||
'id_product_attribute' => (int)$obj->id,
|
||||
'id_attribute' => (int)$id_attribute
|
||||
);
|
||||
$res &= Db::getInstance()->insert('product_attribute_combination', $attribute_list);
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $quantity DEPRECATED
|
||||
* @param string $supplier_reference DEPRECATED
|
||||
@@ -1068,16 +1133,12 @@ class ProductCore extends ObjectModel
|
||||
if (!$id_product_attribute || !$result)
|
||||
return false;
|
||||
|
||||
if ($this->getType() == Product::PTYPE_VIRTUAL)
|
||||
StockAvailable::setProductOutOfStock((int)$this->id, 1, null, $id_product_attribute);
|
||||
else
|
||||
StockAvailable::setProductOutOfStock((int)$this->id, StockAvailable::outOfStock($this->id), null, $id_product_attribute);
|
||||
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||
return $id_product_attribute;
|
||||
}
|
||||
|
||||
public function addProductAttributeMultiple($attributes, $set_default = true)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$return = array();
|
||||
$default_value = 1;
|
||||
foreach ($attributes as &$attribute)
|
||||
@@ -1339,8 +1400,6 @@ class ProductCore extends ObjectModel
|
||||
WHERE `id_product` = '.(int)$this->id.'
|
||||
), \'0\')
|
||||
WHERE `id_product` = '.(int)$this->id);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Delete product attributes
|
||||
@@ -1503,6 +1562,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function addAttributeCombinationMultiple($id_attributes, $combinations)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$attributes_list = array();
|
||||
foreach ($id_attributes as $nb => $id_product_attribute)
|
||||
if (isset($combinations[$nb]))
|
||||
@@ -1515,6 +1575,7 @@ class ProductCore extends ObjectModel
|
||||
return Db::getInstance()->insert('product_attribute_combination', $attributes_list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a product attributes combination
|
||||
*
|
||||
@@ -1583,23 +1644,36 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
return array();
|
||||
$add_shop = '';
|
||||
|
||||
$sql = 'SELECT pa.*, product_attribute_shop.*, GROUP_CONCAT(agl.`name`, \''.pSQL($attribute_value_separator).'\',
|
||||
al.`name` ORDER BY agl.`id_attribute_group` SEPARATOR \''.pSQL($attribute_separator).'\') as attribute_designation
|
||||
$combinations = Db::getInstance()->executeS('SELECT pa.*, product_attribute_shop.*
|
||||
FROM `'._DB_PREFIX_.'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`
|
||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||
GROUP BY pa.`id_product_attribute`');
|
||||
|
||||
if (!$combinations)
|
||||
return false;
|
||||
|
||||
$product_attributes = array();
|
||||
foreach ($combinations as $combination)
|
||||
$product_attributes[] = (int)$combination['id_product_attribute'];
|
||||
|
||||
$lang = Db::getInstance()->executeS('SELECT pac.id_product_attribute, GROUP_CONCAT(agl.`name`, \''.pSQL($attribute_value_separator).'\',al.`name` ORDER BY agl.`id_attribute_group` SEPARATOR \''.pSQL($attribute_separator).'\') as attribute_designation
|
||||
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
|
||||
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.')
|
||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||
GROUP BY pa.`id_product_attribute`';
|
||||
|
||||
$res = Db::getInstance()->executeS($sql);
|
||||
|
||||
WHERE pac.id_product_attribute IN ('.implode(',', $product_attributes).')
|
||||
GROUP BY pac.id_product_attribute');
|
||||
|
||||
foreach ($lang as $k => $row)
|
||||
$combinations[$k]['attribute_designation'] = $row['attribute_designation'];
|
||||
|
||||
|
||||
//Get quantity of each variations
|
||||
foreach ($res as $key => $row)
|
||||
foreach ($combinations as $key => $row)
|
||||
{
|
||||
$cache_key = $row['id_product'].'_'.$row['id_product_attribute'].'_quantity';
|
||||
|
||||
@@ -1609,10 +1683,10 @@ class ProductCore extends ObjectModel
|
||||
StockAvailable::getQuantityAvailableByProduct($row['id_product'], $row['id_product_attribute'])
|
||||
);
|
||||
|
||||
$res[$key]['quantity'] = Cache::retrieve($cache_key);
|
||||
$combinations[$key]['quantity'] = Cache::retrieve($cache_key);
|
||||
}
|
||||
|
||||
return $res;
|
||||
return $combinations;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1820,7 +1894,7 @@ class ProductCore extends ObjectModel
|
||||
$sql = new DbQuery();
|
||||
$sql->select(
|
||||
'p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
|
||||
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||
DATEDIFF(
|
||||
product_shop.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -1837,7 +1911,8 @@ class ProductCore extends ObjectModel
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl')
|
||||
);
|
||||
$sql->leftJoin('image', 'i', 'i.`id_product` = p.`id_product` AND i.`cover` = 1');
|
||||
$sql->leftJoin('image', 'i', 'i.`id_product` = p.`id_product`');
|
||||
$sql->join(Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1'));
|
||||
$sql->leftJoin('image_lang', 'il', 'i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang);
|
||||
$sql->leftJoin('tax_rule', 'tr', '
|
||||
product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
@@ -1846,9 +1921,9 @@ class ProductCore extends ObjectModel
|
||||
);
|
||||
$sql->leftJoin('tax', 't', 't.`id_tax` = tr.`id_tax`');
|
||||
$sql->leftJoin('manufacturer', 'm', 'm.`id_manufacturer` = p.`id_manufacturer`');
|
||||
$sql->join(Product::sqlStock('p', 0));
|
||||
|
||||
$sql->where('product_shop.`active` = 1');
|
||||
$sql->where('(image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1)');
|
||||
if ($front)
|
||||
$sql->where('product_shop.`visibility` IN ("both", "catalog")');
|
||||
$sql->where('
|
||||
@@ -1875,9 +1950,10 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$sql->select('pa.id_product_attribute');
|
||||
$sql->leftOuterJoin('product_attribute', 'pa', 'p.`id_product` = pa.`id_product`');
|
||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false));
|
||||
$sql->where('(product_attribute_shop.default_on = 1 OR product_attribute_shop.default_on IS NULL)');
|
||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on = 1'));
|
||||
$sql->where('(pa.id_product_attribute IS NULL OR product_attribute_shop.id_shop='.(int)$context->shop->id.')');
|
||||
}
|
||||
$sql->join(Product::sqlStock('p', Combination::isFeatureActive() ? 'product_attribute_shop' : 0));
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
@@ -1938,18 +2014,18 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$ids_product = ' AND (';
|
||||
foreach ($product_reductions as $product_reduction)
|
||||
$ids_product .= '( p.`id_product` = '.(int)$product_reduction['id_product'].($product_reduction['id_product_attribute'] ? ' AND pa.`id_product_attribute`='.(int)$product_reduction['id_product_attribute'] :'').') OR';
|
||||
$ids_product .= '( product_shop.`id_product` = '.(int)$product_reduction['id_product'].($product_reduction['id_product_attribute'] ? ' AND product_attribute_shop.`id_product_attribute`='.(int)$product_reduction['id_product_attribute'] :'').') OR';
|
||||
$ids_product = rtrim($ids_product, 'OR').')';
|
||||
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
// Please keep 2 distinct queries because RAND() is an awful way to achieve this result
|
||||
$sql = 'SELECT p.id_product, pa.id_product_attribute
|
||||
$sql = 'SELECT product_shop.id_product, product_attribute_shop.id_product_attribute
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.id_product = pa.id_product)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (product_shop.id_product = pa.id_product)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on = 1').'
|
||||
WHERE product_shop.`active` = 1
|
||||
'.(($ids_product) ? $ids_product : '').'
|
||||
AND p.`id_product` IN (
|
||||
@@ -1958,8 +2034,9 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((pa.`default_on` = 1 AND pa.`id_product_attribute` != 0) OR (pa.`id_product_attribute` IS NULL))
|
||||
GROUP BY p.id_product
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND (pa.id_product_attribute IS NULL OR product_attribute_shop.default_on = 1)
|
||||
GROUP BY product_shop.id_product
|
||||
ORDER BY RAND()';
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -1969,14 +2046,15 @@ class ProductCore extends ObjectModel
|
||||
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.`out_of_stock` out_of_stock, pl.`description`, pl.`description_short`,
|
||||
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
|
||||
p.`ean13`, p.`upc`, i.`id_image`, il.`legend`, t.`rate`
|
||||
p.`ean13`, p.`upc`, image_shop.`id_image`, il.`legend`, t.`rate`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
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.'
|
||||
@@ -1984,8 +2062,12 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.id_product = '.(int)$id_product.'
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '');
|
||||
AND (i.id_image IS NULL OR image_shop.id_shop='.(int)$context->shop->id.')';
|
||||
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (!$row)
|
||||
return false;
|
||||
|
||||
if ($result['id_product_attribute'])
|
||||
$row['id_product_attribute'] = $result['id_product_attribute'];
|
||||
return Product::getProductProperties($id_lang, $row);
|
||||
@@ -2060,9 +2142,9 @@ class ProductCore extends ObjectModel
|
||||
$order_by = explode('.', $order_by);
|
||||
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||
}
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, product_attribute_shop.id_product_attribute,
|
||||
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`,
|
||||
pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||
pl.`name`, image_shop.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -2072,12 +2154,15 @@ class ProductCore extends ObjectModel
|
||||
) > 0 AS new
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product = p.id_product)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on=1').'
|
||||
'.Product::sqlStock('p', 0, false, $context->shop).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
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.'
|
||||
@@ -2086,6 +2171,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||
WHERE product_shop.`active` = 1
|
||||
AND product_shop.`show_price` = 1
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
'.((!$beginning && !$ending) ? ' AND p.`id_product` IN ('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')' : '').'
|
||||
AND p.`id_product` IN (
|
||||
@@ -2094,6 +2180,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND (pa.id_product_attribute IS NULL OR product_attribute_shop.default_on = 1)
|
||||
ORDER BY '.(isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').pSQL($order_by).' '.pSQL($order_way).'
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
|
||||
@@ -2138,8 +2225,9 @@ class ProductCore extends ObjectModel
|
||||
$ret = array();
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT cp.`id_category`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category_product` cp
|
||||
LEFT JOIN `'._DB_PREFIX_.'category` c ON (c.id_category = cp.id_category)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cp.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
||||
'.Shop::addSqlAssociation('category', 'cp').'
|
||||
'.Shop::addSqlAssociation('category', 'c').'
|
||||
WHERE cp.`id_product` = '.(int)$id_product.'
|
||||
AND cl.`id_lang` = '.(int)$id_lang
|
||||
);
|
||||
@@ -2189,14 +2277,13 @@ class ProductCore extends ObjectModel
|
||||
'id_shop' => (int)$this->id_shop
|
||||
);
|
||||
}
|
||||
|
||||
Db::getInstance()->execute(
|
||||
'DELETE FROM `'._DB_PREFIX_.'product_carrier`
|
||||
WHERE id_product = '.(int)$this->id.'
|
||||
AND id_shop = '.(int)$this->id_shop
|
||||
);
|
||||
|
||||
Db::getInstance()->insert('product_carrier', $data);
|
||||
if (count($data))
|
||||
Db::getInstance()->insert('product_carrier', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2210,7 +2297,7 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$sql = 'SELECT i.`cover`, i.`id_image`, il.`legend`, i.`position`
|
||||
$sql = 'SELECT image_shop.`cover`, i.`id_image`, il.`legend`, i.`position`
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
'.Shop::addSqlAssociation('image', 'i').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
@@ -2229,11 +2316,11 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$sql = 'SELECT i.`id_image`
|
||||
$sql = 'SELECT image_shop.`id_image`
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
'.Shop::addSqlAssociation('image', 'i').'
|
||||
WHERE i.`id_product` = '.(int)$id_product.'
|
||||
AND i.`cover` = 1';
|
||||
AND image_shop.`cover` = 1';
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
@@ -2342,8 +2429,7 @@ class ProductCore extends ObjectModel
|
||||
&& Configuration::get('VATNUMBER_MANAGEMENT'))
|
||||
$usetax = false;
|
||||
|
||||
$id_customer = 0;
|
||||
if (Validate::isLoadedObject($context->customer))
|
||||
if (is_null($id_customer) && Validate::isLoadedObject($context->customer))
|
||||
$id_customer = $context->customer->id;
|
||||
|
||||
return Product::priceCalculation(
|
||||
@@ -2395,17 +2481,24 @@ class ProductCore extends ObjectModel
|
||||
$id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0)
|
||||
{
|
||||
static $address = null;
|
||||
static $context = null;
|
||||
|
||||
if ($address === null)
|
||||
$address = new Address();
|
||||
|
||||
if ($context == null)
|
||||
$context = Context::getContext()->cloneContext();
|
||||
|
||||
if ($id_shop !== null && $context->shop->id != (int)$id_shop)
|
||||
$context->shop = new Shop((int)$id_shop);
|
||||
|
||||
if (!$use_customer_price)
|
||||
$id_customer = 0;
|
||||
|
||||
$cache_id = $id_product.'-'.$id_shop.'-'.$id_currency.'-'.$id_country.'-'.$id_state.'-'.$zipcode.'-'.$id_group.
|
||||
'-'.$quantity.'-'.(int)$id_product_attribute.'-'.($use_tax?'1':'0').'-'.$decimals.'-'.($only_reduc?'1':'0').
|
||||
'-'.($use_reduc?'1':'0').'-'.$with_ecotax.'-'.$id_customer;
|
||||
|
||||
|
||||
// reference parameter is filled before any returns
|
||||
$specific_price = SpecificPrice::getSpecificPrice(
|
||||
(int)$id_product,
|
||||
@@ -2428,41 +2521,34 @@ class ProductCore extends ObjectModel
|
||||
if (!isset(self::$_pricesLevel2[$cache_id_2]))
|
||||
{
|
||||
$sql = new DbQuery();
|
||||
$sql->select('product_shop.`price`, product_shop.`ecotax`, NULL id_product_attribute');
|
||||
$sql->select('product_shop.`price`, product_shop.`ecotax`');
|
||||
$sql->from('product', 'p');
|
||||
$sql->join(Shop::addSqlAssociation('product', 'p'));
|
||||
$sql->innerJoin('product_shop', 'product_shop', '(product_shop.id_product=p.id_product AND product_shop.id_shop='.(int)$id_shop.')');
|
||||
$sql->where('p.`id_product` = '.(int)$id_product);
|
||||
$default_on = false;
|
||||
if (Combination::isFeatureActive())
|
||||
{
|
||||
$default_on = true;
|
||||
$sql->select('pa.id_product_attribute, product_attribute_shop.`price` AS attribute_price, (SELECT product_attribute_shop.price
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
WHERE pa.id_product = '.(int)$id_product.'
|
||||
AND product_attribute_shop.default_on = 1
|
||||
GROUP BY pa.id_product_attribute
|
||||
LIMIT 1) as default_on');
|
||||
$sql->leftJoin('product_attribute', 'pa', 'pa.`id_product` = '.(int)$id_product);
|
||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false));
|
||||
$sql->select('product_attribute_shop.id_product_attribute, product_attribute_shop.`price` AS attribute_price, product_attribute_shop.default_on');
|
||||
$sql->leftJoin('product_attribute', 'pa', 'pa.`id_product` = p.`id_product`');
|
||||
$sql->leftJoin('product_attribute_shop', 'product_attribute_shop', '(product_attribute_shop.id_product_attribute=pa.id_product_attribute AND product_attribute_shop.id_shop='.(int)$id_shop.')');
|
||||
}
|
||||
else
|
||||
$sql->select('0 as id_product_attribute');
|
||||
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
if ($res)
|
||||
foreach ($res as $row)
|
||||
{
|
||||
foreach ($res as $row)
|
||||
self::$_pricesLevel2[$cache_id_2][(int)$row['id_product_attribute']] = array(
|
||||
'price' => $row['price'],
|
||||
'ecotax' => $row['ecotax'],
|
||||
'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']);
|
||||
$array_tmp = array(
|
||||
'price' => $row['price'],
|
||||
'ecotax' => $row['ecotax'],
|
||||
'attribute_price' => (isset($row['attribute_price']) ? $row['attribute_price'] : null)
|
||||
);
|
||||
self::$_pricesLevel2[$cache_id_2][(int)$row['id_product_attribute']] = $array_tmp;
|
||||
|
||||
if (isset($row['default_on']) && $row['default_on'] == 1)
|
||||
self::$_pricesLevel2[$cache_id_2][0] = $array_tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset(self::$_pricesLevel2[$cache_id_2][(int)$id_product_attribute]))
|
||||
return;
|
||||
|
||||
@@ -2472,7 +2558,6 @@ class ProductCore extends ObjectModel
|
||||
$price = (float)$result['price'];
|
||||
else
|
||||
$price = (float)$specific_price['price'];
|
||||
|
||||
// convert only if the specific price is in the default currency (id_currency = 0)
|
||||
if (!$specific_price || !($specific_price['price'] >= 0 && $specific_price['id_currency']))
|
||||
$price = Tools::convertPrice($price, $id_currency);
|
||||
@@ -2490,7 +2575,7 @@ class ProductCore extends ObjectModel
|
||||
$address->id_state = $id_state;
|
||||
$address->postcode = $zipcode;
|
||||
|
||||
$tax_manager = TaxManagerFactory::getManager($address, Product::getIdTaxRulesGroupByIdProduct((int)$id_product));
|
||||
$tax_manager = TaxManagerFactory::getManager($address, Product::getIdTaxRulesGroupByIdProduct((int)$id_product, $context));
|
||||
$product_tax_calculator = $tax_manager->getTaxCalculator();
|
||||
|
||||
// Add Tax
|
||||
@@ -2626,6 +2711,22 @@ class ProductCore extends ObjectModel
|
||||
return (isset($row['id_product_attribute']) && $row['id_product_attribute']) ? (int)$row['id_product_attribute'] : 0;
|
||||
}
|
||||
|
||||
public function getDefaultIdProductAttribute()
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
return 0;
|
||||
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT pa.`id_product_attribute`
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||
AND product_attribute_shop.default_on = 1'
|
||||
);
|
||||
|
||||
return (isset($row['id_product_attribute']) && $row['id_product_attribute']) ? (int)$row['id_product_attribute'] : 0;
|
||||
}
|
||||
|
||||
public function getPriceWithoutReduct($notax = false, $id_product_attribute = false)
|
||||
{
|
||||
return Product::getPriceStatic((int)$this->id, !$notax, $id_product_attribute, 6, null, false, false);
|
||||
@@ -2712,10 +2813,10 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
$sql .= ' AND stock.id_product_attribute = 0';
|
||||
else if (is_numeric($product_attribute))
|
||||
elseif (is_numeric($product_attribute))
|
||||
$sql .= ' AND stock.id_product_attribute = '.$product_attribute;
|
||||
else if (is_string($product_attribute))
|
||||
$sql .= ' AND stock.id_product_attribute = IFNULL('.pSQL($product_attribute).'.id_product_attribute, 0)';
|
||||
elseif (is_string($product_attribute))
|
||||
$sql .= ' AND stock.id_product_attribute = IFNULL(`'.bqSQL($product_attribute).'`.id_product_attribute, 0)';
|
||||
}
|
||||
|
||||
$sql .= StockAvailable::addSqlShopRestriction(null, $id_shop, 'stock').' )';
|
||||
@@ -2929,7 +3030,8 @@ class ProductCore extends ObjectModel
|
||||
product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
@@ -2937,11 +3039,13 @@ class ProductCore extends ObjectModel
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE `id_product_1` = '.(int)$this->id.
|
||||
WHERE `id_product_1` = '.(int)$this->id.'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))'.
|
||||
($active ? ' AND product_shop.`active` = 1' : '');
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
|
||||
foreach ($result as &$row)
|
||||
$row['id_product_attribute'] = Product::getDefaultAttribute((int)$row['id_product']);
|
||||
return $this->getProductsProperties($id_lang, $result);
|
||||
}
|
||||
|
||||
@@ -3461,6 +3565,8 @@ class ProductCore extends ObjectModel
|
||||
$usetax = Tax::excludeTaxeOption();
|
||||
|
||||
$cache_key = $row['id_product'].'-'.$row['id_product_attribute'].'-'.$id_lang.'-'.(int)$usetax;
|
||||
if (isset($row['id_product_pack']))
|
||||
$cache_key .= '-pack'.$row['id_product_pack'];
|
||||
if (isset(self::$producPropertiesCache[$cache_key]))
|
||||
return self::$producPropertiesCache[$cache_key];
|
||||
|
||||
@@ -3964,18 +4070,19 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!((int)$id_product > 0) || !is_array($categories) || empty($categories))
|
||||
return false;
|
||||
$sql = 'SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_product`='.(int)$id_product.' AND `id_category` IN(';
|
||||
$sql = 'SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)$id_product.' AND `id_category` IN (';
|
||||
foreach ($categories as $category)
|
||||
$sql .= (int)$category['id_category'].',';
|
||||
$sql = rtrim($sql, ',').')';
|
||||
|
||||
if (isset(self::$_incat[md5($sql)]))
|
||||
return self::$_incat[md5($sql)];
|
||||
|
||||
if (!Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
self::$_incat[md5($sql)] = (Db::getInstance(_PS_USE_SQL_SLAVE_)->NumRows() > 0 ? true : false);
|
||||
return self::$_incat[md5($sql)];
|
||||
$hash = md5($sql);
|
||||
if (!isset(self::$_incat[$hash]))
|
||||
{
|
||||
if (!Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql))
|
||||
return false;
|
||||
self::$_incat[$hash] = (Db::getInstance(_PS_USE_SQL_SLAVE_)->NumRows() > 0 ? true : false);
|
||||
}
|
||||
return self::$_incat[$hash];
|
||||
}
|
||||
|
||||
public function getNoPackPrice()
|
||||
@@ -4092,14 +4199,13 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$key = 'product_id_tax_rules_group_'.(int)$id_product.'_'.(int)$context->shop->id;
|
||||
if (!Cache::isStored($key))
|
||||
Cache::store($key,
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_tax_rules_group`
|
||||
FROM `'._DB_PREFIX_.'product_shop`
|
||||
WHERE `id_product` = '.(int)$id_product.' AND id_shop='.(int)Context::getContext()->shop->id));
|
||||
WHERE `id_product` = '.(int)$id_product.' AND id_shop='.(int)$context->shop->id));
|
||||
|
||||
return Cache::retrieve($key);
|
||||
}
|
||||
@@ -4187,7 +4293,8 @@ class ProductCore extends ObjectModel
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
|
||||
'SELECT cp.`id_category` AS id
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
'.Shop::addSqlAssociation('category', 'cp').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category` c ON (c.id_category = cp.id_category)
|
||||
'.Shop::addSqlAssociation('category', 'c').'
|
||||
WHERE cp.`id_product` = '.(int)$this->id
|
||||
);
|
||||
return $result;
|
||||
@@ -4263,7 +4370,7 @@ class ProductCore extends ObjectModel
|
||||
$ids_orig[] = $id['id'];
|
||||
|
||||
$all_ids = array();
|
||||
$all = Db::getInstance()->executeS('SELECT pa.`id_product_attribute` as id FROM `'._DB_PREFIX_.'product_attribute` '.Shop::addSqlAssociation('product_attribute', 'pa'));
|
||||
$all = Db::getInstance()->executeS('SELECT pa.`id_product_attribute` as id FROM `'._DB_PREFIX_.'product_attribute` pa '.Shop::addSqlAssociation('product_attribute', 'pa'));
|
||||
if (is_array($all))
|
||||
foreach ($all as $id)
|
||||
$all_ids[] = $id['id'];
|
||||
@@ -4346,12 +4453,12 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function setCoverWs($id_image)
|
||||
{
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 0 WHERE `id_product` = '.(int)$this->id.'
|
||||
');
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 1 WHERE `id_product` = '.(int)$this->id.' AND `id_image` = '.(int)$id_image
|
||||
);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image_shop` image_shop, `'._DB_PREFIX_.'image` i
|
||||
SET image_shop.`cover` = 0
|
||||
WHERE i.`id_product` = '.(int)$this->id.' AND i.id_image = image_shop.id_image
|
||||
AND image_shop.id_shop='.(int)Context::getContext()->shop->id);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image_shop`
|
||||
SET `cover` = 1 WHERE `id_image` = '.(int)$id_image);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -4371,6 +4478,13 @@ class ProductCore extends ObjectModel
|
||||
ORDER BY i.`position`');
|
||||
}
|
||||
|
||||
public function getWsStockAvailables()
|
||||
{
|
||||
return Db::getInstance()->executeS('SELECT `id_stock_available` id, `id_product_attribute`
|
||||
FROM `'._DB_PREFIX_.'stock_available`
|
||||
WHERE `id_product`='.($this->id).StockAvailable::addSqlShopRestriction());
|
||||
}
|
||||
|
||||
public function getWsTags()
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
@@ -4429,11 +4543,12 @@ class ProductCore extends ObjectModel
|
||||
* @param int $id_product the id of the product
|
||||
* @return array product attribute id list
|
||||
*/
|
||||
public static function getProductAttributesIds($id_product)
|
||||
public static function getProductAttributesIds($id_product, $shop_only = false)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT pa.id_product_attribute
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa'.
|
||||
($shop_only ? Shop::addSqlAssociation('product_attribute', 'pa') : '').'
|
||||
WHERE pa.`id_product` = '.(int)$id_product);
|
||||
}
|
||||
|
||||
@@ -4717,7 +4832,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function addWs($autodate = true, $null_values = false)
|
||||
{
|
||||
$success = parent::add($autodate, $null_values);
|
||||
$success = $this->add($autodate, $null_values);
|
||||
if ($success && Configuration::get('PS_SEARCH_INDEXATION'))
|
||||
Search::indexation(false, $this->id);
|
||||
return $success;
|
||||
@@ -4907,11 +5022,10 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function hasAttributesInOtherShops()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT pa.id_product_attribute
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` pas
|
||||
ON (pa.`id_product_attribute` = pas.`id_product_attribute`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` pas ON (pa.`id_product_attribute` = pas.`id_product_attribute`)
|
||||
WHERE pa.`id_product` = '.(int)$this->id
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,9 @@ class ProductSaleCore
|
||||
{
|
||||
if ($page_number < 0) $page_number = 0;
|
||||
if ($nb_products < 1) $nb_products = 10;
|
||||
if (empty($order_by) || $order_by == 'position') $order_by = 'sales';
|
||||
|
||||
$final_order_by = $order_by;
|
||||
if (empty($order_by) || $order_by == 'position' || $order_by = 'price') $order_by = 'sales';
|
||||
if (empty($order_way)) $order_way = 'DESC';
|
||||
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
@@ -77,7 +79,7 @@ class ProductSaleCore
|
||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
|
||||
pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
|
||||
m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
|
||||
i.`id_image`, il.`legend`,
|
||||
image_shop.`id_image`, il.`legend`,
|
||||
ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
|
||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
|
||||
INTERVAL '.$interval.' DAY)) > 0 AS new
|
||||
@@ -87,7 +89,8 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`)
|
||||
@@ -102,12 +105,13 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
if ($order_by == 'price')
|
||||
if ($final_order_by == 'price')
|
||||
Tools::orderbyPrice($result, $order_way);
|
||||
if (!$result)
|
||||
return false;
|
||||
@@ -132,7 +136,7 @@ class ProductSaleCore
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, i.`id_image`, il.`legend`,
|
||||
$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, image_shop.`id_image`, il.`legend`,
|
||||
ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category
|
||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
|
||||
@@ -140,7 +144,8 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON cl.`id_category` = product_shop.`id_category_default`
|
||||
@@ -152,6 +157,7 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY sales DESC
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
|
||||
@@ -110,17 +110,25 @@ class ProfileCore extends ObjectModel
|
||||
return (isset($accesses[$id_tab]) ? $accesses[$id_tab] : false);
|
||||
}
|
||||
|
||||
public static function getProfileAccesses($id_profile)
|
||||
public static function getProfileAccesses($id_profile, $type = 'id_tab')
|
||||
{
|
||||
if (!in_array($type, array('id_tab', 'class_name')))
|
||||
return false;
|
||||
|
||||
if (!isset(self::$_cache_accesses[$id_profile]))
|
||||
self::$_cache_accesses[$id_profile] = array();
|
||||
|
||||
if (!isset(self::$_cache_accesses[$id_profile][$type]))
|
||||
{
|
||||
self::$_cache_accesses[$id_profile][$type] = array();
|
||||
// Super admin profile has full auth
|
||||
if ($id_profile == _PS_ADMIN_PROFILE_)
|
||||
{
|
||||
foreach (Tab::getTabs(Context::getContext()->language->id) as $tab)
|
||||
self::$_cache_accesses[$id_profile][$tab['id_tab']] = array(
|
||||
self::$_cache_accesses[$id_profile][$type][$tab[$type]] = array(
|
||||
'id_profile' => _PS_ADMIN_PROFILE_,
|
||||
'id_tab' => $tab['id_tab'],
|
||||
'class_name' => $tab['class_name'],
|
||||
'view' => '1',
|
||||
'add' => '1',
|
||||
'edit' => '1',
|
||||
@@ -131,19 +139,16 @@ class ProfileCore extends ObjectModel
|
||||
{
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'access`
|
||||
FROM `'._DB_PREFIX_.'access` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'tab` t ON t.id_tab = a.id_tab
|
||||
WHERE `id_profile` = '.(int)$id_profile);
|
||||
|
||||
self::$_cache_accesses[$id_profile] = array();
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (!isset(self::$_cache_accesses[$id_profile][$row['id_tab']]))
|
||||
self::$_cache_accesses[$id_profile][$row['id_tab']] = array();
|
||||
self::$_cache_accesses[$id_profile][$row['id_tab']] = $row;
|
||||
}
|
||||
self::$_cache_accesses[$id_profile][$type][$row[$type]] = $row;
|
||||
}
|
||||
}
|
||||
return self::$_cache_accesses[$id_profile];
|
||||
|
||||
return self::$_cache_accesses[$id_profile][$type];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ class ReferrerCore extends ObjectModel
|
||||
* @param int $id_product
|
||||
* @param int $employee
|
||||
*/
|
||||
public function getStatsSales($id_product, $employe)
|
||||
public function getStatsSales($id_product, $employee)
|
||||
{
|
||||
$join = $where = '';
|
||||
if ($id_product)
|
||||
|
||||
@@ -284,7 +284,7 @@ class SearchCore
|
||||
$alias = 'product_shop.';
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||
pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
|
||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.',
|
||||
tax.`rate`, image_shop.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.',
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -303,10 +303,12 @@ class SearchCore
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` tax ON (tax.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.`id_product` '.$product_pool.'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
'.($order_by ? 'ORDER BY '.$alias.$order_by : '').($order_way ? ' '.$order_way : '').'
|
||||
LIMIT '.(int)(($page_number - 1) * $page_size).','.(int)$page_size;
|
||||
$result = $db->executeS($sql);
|
||||
@@ -323,9 +325,11 @@ class SearchCore
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` tax ON (tax.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE p.`id_product` '.$product_pool;
|
||||
WHERE p.`id_product` '.$product_pool.'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))';
|
||||
$total = $db->getValue($sql);
|
||||
|
||||
if (!$result)
|
||||
@@ -632,7 +636,7 @@ class SearchCore
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description_short`, pl.`link_rewrite`, pl.`name`,
|
||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
||||
tax.`rate`, image_shop.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -646,7 +650,8 @@ class SearchCore
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
'.Shop::addSqlAssociation('product', 'p', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
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->country->id.'
|
||||
@@ -665,6 +670,7 @@ class SearchCore
|
||||
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
||||
WHERE id_customer = '.(int)$id_customer.')').'
|
||||
AND t.`name` LIKE \'%'.pSQL($tag).'%\'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY position DESC'.($orderBy ? ', '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
|
||||
LIMIT '.(int)(($pageNumber - 1) * $pageSize).','.(int)$pageSize;
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
|
||||
@@ -253,7 +253,7 @@ class SupplierCore extends ObjectModel
|
||||
pl.`meta_keywords`,
|
||||
pl.`meta_title`,
|
||||
pl.`name`,
|
||||
i.`id_image`,
|
||||
image_shop.`id_image`,
|
||||
il.`legend`,
|
||||
s.`name` AS supplier_name,
|
||||
tl.`name` AS tax_name,
|
||||
@@ -267,8 +267,8 @@ class SupplierCore extends ObjectModel
|
||||
AND ps.id_product_attribute = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`
|
||||
AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`
|
||||
AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
@@ -291,6 +291,7 @@ class SupplierCore extends ObjectModel
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY '.$alias.pSQL($order_by).' '.pSQL($order_way).'
|
||||
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
||||
|
||||
|
||||
@@ -117,27 +117,20 @@ class TabCore extends ObjectModel
|
||||
$context = Context::getContext();
|
||||
if (!$context->employee || !$context->employee->id_profile)
|
||||
return false;
|
||||
|
||||
/* Profile selection */
|
||||
$profiles = Db::getInstance()->executeS('
|
||||
SELECT `id_profile`
|
||||
FROM '._DB_PREFIX_.'profile
|
||||
WHERE `id_profile` != 1
|
||||
');
|
||||
$profiles = Db::getInstance()->executeS('SELECT `id_profile` FROM '._DB_PREFIX_.'profile WHERE `id_profile` != 1');
|
||||
if (!$profiles || empty($profiles))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
/* Query definition */
|
||||
// note : insert ignore should be avoided
|
||||
$query = 'INSERT IGNORE INTO `'._DB_PREFIX_.'access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ';
|
||||
// default admin
|
||||
$query = 'REPLACE INTO `'._DB_PREFIX_.'access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ';
|
||||
$query .= '(1, '.(int)$id_tab.', 1, 1, 1, 1),';
|
||||
|
||||
foreach ($profiles as $profile)
|
||||
{
|
||||
// no cast needed for profile[id_profile], which cames from db
|
||||
// And we disable all profile but current one
|
||||
$rights = $profile['id_profile'] == $context->employee->id_profile ? 1 : 0;
|
||||
$query .= '('.$profile['id_profile'].', '.(int)$id_tab.', '.$rights.', '.$rights.', '.$rights.', '.$rights.'),';
|
||||
$query .= '('.(int)$profile['id_profile'].', '.(int)$id_tab.', '.(int)$rights.', '.(int)$rights.', '.(int)$rights.', '.(int)$rights.'),';
|
||||
}
|
||||
$query = trim($query, ', ');
|
||||
return Db::getInstance()->execute($query);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user