Compare commits
601 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c51fe5b22d | |||
| 92ffb1eab1 | |||
| f4610c06e0 | |||
| 2969a7f74c | |||
| 1ed26e2d4e | |||
| 302260539b | |||
| d125ca0a36 | |||
| e3db5570d0 | |||
| 7a7da1097d | |||
| df0a24d63c | |||
| d6ffb45eb1 | |||
| b6bba0c787 | |||
| b2b0c4f00b | |||
| 2aee99c0b0 | |||
| 121fcdc39f | |||
| fe6494bf35 | |||
| a4b7fc942f | |||
| fef8d2beac | |||
| 6dacc07e62 | |||
| f28131fe9b | |||
| a92ced814a | |||
| 3d8591c588 | |||
| 09ad15730b | |||
| 6c9b71ee58 | |||
| 0af24ab034 | |||
| f100027e5d | |||
| 62d946ea68 | |||
| 31f421153d | |||
| c75cda2429 | |||
| e7c860a3dd | |||
| 8580dd0b39 | |||
| 9e837d1ecc | |||
| 0662cd3b12 | |||
| 6c4a69ea0b | |||
| b92c9869a4 | |||
| 992cc6b437 | |||
| 7f32e8d187 | |||
| cafe2ed9d2 | |||
| 8b2215eec5 | |||
| 0f288583ca | |||
| 6e0c3e1aa2 | |||
| 3585bf33c8 | |||
| f2e39488b6 | |||
| e190c8df9f | |||
| d1956572a5 | |||
| ca1bc3daa8 | |||
| d87c816038 | |||
| 3b75dd6785 | |||
| 89d86793b0 | |||
| 33b5971a7a | |||
| 711f5b0bdf | |||
| 4668d8ffa2 | |||
| e9a3c98af9 | |||
| da48cea96e | |||
| a40356d21c | |||
| 3a0081912d | |||
| a027dbd061 | |||
| 3d1d178bba | |||
| fe7035aae9 | |||
| 96be4068f5 | |||
| 250a9f17a2 | |||
| bf6a0e0077 | |||
| c4e549db13 | |||
| a876b13c1c | |||
| c466320887 | |||
| a6e8af99f9 | |||
| 6bbcbb536f | |||
| 294384d9ea | |||
| 953f0641e8 | |||
| a5dc1ce6f6 | |||
| 172986a461 | |||
| 23df6cb875 | |||
| 9e64ecc887 | |||
| 9ad046677c | |||
| 4fcbde878d | |||
| e706b531bc | |||
| 97a25eb9c6 | |||
| ecb4ccfdda | |||
| 2b55944874 | |||
| 4a66bdcdf9 | |||
| f899380e3b | |||
| 9c04f1dace | |||
| 1cce312aaa | |||
| f39c2c40cf | |||
| 7d764c5ce8 | |||
| b6f13648db | |||
| 22173355a5 | |||
| 06b6facc2d | |||
| e0e5f80767 | |||
| 67d0ac95b5 | |||
| 813ef8bc7e | |||
| a4178a9fd2 | |||
| 6d8cc454e1 | |||
| 66435cbf4a | |||
| 84d8ccfa2b | |||
| 2be5233584 | |||
| 33c2669692 | |||
| 6b30cc5084 | |||
| 4e472fae50 | |||
| 126c21d39a | |||
| 50bd3d613d | |||
| 98148cfe03 | |||
| 4fc4ee721e | |||
| d3ad12e536 | |||
| 8c1240cb2c | |||
| 7a7a2fb8c3 | |||
| 47bf9a397a | |||
| f3e36b896b | |||
| 1abb064958 | |||
| 9109708944 | |||
| e21eef3a87 | |||
| 3ded9549cf | |||
| 37170c74b3 | |||
| 017d19330a | |||
| 78c1dce528 | |||
| 48d9c37590 | |||
| 7486844222 | |||
| 95a2b2a8a8 | |||
| 757fe64217 | |||
| ae8c8218fd | |||
| 54b3ac5a32 | |||
| 7f9183b1d4 | |||
| e900474b8e | |||
| 69cb20d5e8 | |||
| 6f840eceba | |||
| 0f4781053b | |||
| 10d6e97aca | |||
| 3448027861 | |||
| 89ac0bc439 | |||
| c9b53685c5 | |||
| 1cc92fc9c2 | |||
| 17323a04b6 | |||
| 1d6593612f | |||
| 41af17e06b | |||
| aefab21a62 | |||
| d9a24d61ac | |||
| 6195d0c319 | |||
| b3a425c73a | |||
| ccb3179c1a | |||
| b4547568a5 | |||
| d37f545058 | |||
| 5c4de83e91 | |||
| 3b075e049b | |||
| 84dc75f57e | |||
| 92382e347c | |||
| dedc59f1db | |||
| c6222c51c8 | |||
| a1555c3fc8 | |||
| 31697fde3c | |||
| 5206496f64 | |||
| cf82157d47 | |||
| 7dbb6088a4 | |||
| 50bbf1a547 | |||
| 32a7a28567 | |||
| a578cfb2e2 | |||
| 39468476ab | |||
| 214b844ef7 | |||
| 5c3b8015e5 | |||
| 7aa348eb93 | |||
| e2a1f5101c | |||
| 7d05da1618 | |||
| 429c9442a3 | |||
| 2dc91758c3 | |||
| 9b878a33a8 | |||
| 7eb3b22829 | |||
| e2ac223f4e | |||
| 5b7580d487 | |||
| 1cebd5920e | |||
| 4f639329e9 | |||
| 91ae972655 | |||
| f8ca06d927 | |||
| eb6600e840 | |||
| 14cd72121a | |||
| 42cdc988ac | |||
| 8c6aaa3c7d | |||
| 63f4743134 | |||
| e0b59082f9 | |||
| 0361d5db8d | |||
| ea6ea955bb | |||
| 803b6ce8ec | |||
| 0c511dead5 | |||
| 6b47f5713e | |||
| 5eb4c93b8c | |||
| e7286c44f2 | |||
| 4e1d6de9b0 | |||
| 75a9629b8a | |||
| 27f14b9a31 | |||
| 70d48d0af1 | |||
| f6dc81d0f1 | |||
| 2e311410b2 | |||
| 0452979ce7 | |||
| 3aec242600 | |||
| 93aae26269 | |||
| f293562ea4 | |||
| 66f46eee03 | |||
| 672da852c5 | |||
| 965b8a1bf3 | |||
| 47c5f400ee | |||
| 322654cacf | |||
| 3151064daf | |||
| e6e8efc19a | |||
| 6ee6317fee | |||
| 2d5bd901f4 | |||
| b9b4265517 | |||
| 15dd1cf96f | |||
| 1c58c1ea6b | |||
| 852faeab7a | |||
| 8504574ae1 | |||
| e68c124218 | |||
| 08efa4e313 | |||
| e0739ea1e0 | |||
| 0e3d53321a | |||
| d7c1cd90bf | |||
| c0afb55d11 | |||
| 3b9c125198 | |||
| 08373c0541 | |||
| 73dd524de8 | |||
| 10472ef83c | |||
| 6da1228359 | |||
| d0ef8cca8f | |||
| 97ec6341e8 | |||
| 5363e75238 | |||
| a3d9643833 | |||
| 4f06b74a29 | |||
| 61295e4e21 | |||
| d9bc07d030 | |||
| 3eb4d65fc9 | |||
| 452f41df8d | |||
| db4b69d10c | |||
| 5095b45e47 | |||
| 30591b7c28 | |||
| f9b1f0ab5e | |||
| cc36eb2d27 | |||
| 53c1e56c51 | |||
| 8590b0e699 | |||
| 876be3b452 | |||
| e5276ff531 | |||
| 90091d4f2c | |||
| 3870388e1c | |||
| ea1bdbc849 | |||
| f0297824d7 | |||
| c91a86740f | |||
| a37033e478 | |||
| 9fa6c86a94 | |||
| f4f3084c35 | |||
| a4d131eac9 | |||
| e2dac03baa | |||
| dfdbe39ee3 | |||
| 31c94caebc | |||
| 4a3e0c5075 | |||
| c42d71b8f5 | |||
| 669c3791b5 | |||
| 3e750490fe | |||
| 01be908e51 | |||
| 9f12ff15be | |||
| 53805f2b93 | |||
| 614e56283a | |||
| 85a471a690 | |||
| 86d3a8afe1 | |||
| f94f0f14a4 | |||
| 31d762b88a | |||
| 9713f93075 | |||
| c5afbc75bd | |||
| 332d68c7ec | |||
| f30a088848 | |||
| 3c090535a9 | |||
| c4681c1fb1 | |||
| 021790a3e2 | |||
| 4968a792b4 | |||
| a383d55421 | |||
| 00f3045690 | |||
| 5362f4d426 | |||
| 9880d152d4 | |||
| 990a889b1c | |||
| e6d0a3e5a4 | |||
| 242556e176 | |||
| c502c9766f | |||
| 54f7c65165 | |||
| dcad699ede | |||
| e1d0347757 | |||
| b975a9375c | |||
| 9c756a7fcb | |||
| 6b03af9ef9 | |||
| ec556bb307 | |||
| e6f8dba2e6 | |||
| 25ba388d69 | |||
| e5337f5e76 | |||
| 683513a9d2 | |||
| 19a6c4373e | |||
| 2874f14983 | |||
| 4c49048e39 | |||
| e5f53afd5f | |||
| 9377775eca | |||
| 768a8b36d5 | |||
| 1b0c5be93d | |||
| 663f592306 | |||
| ec11b7e064 | |||
| 7e1c0d5a24 | |||
| 53241af228 | |||
| a7d619b208 | |||
| 6b080e1f02 | |||
| 0f81518ba2 | |||
| 6e5fb47642 | |||
| 824a6b90f3 | |||
| 284711b22f | |||
| 2f6e0e3fae | |||
| d59f3383cf | |||
| 4d68595447 | |||
| 07bdcd4129 | |||
| e9d066c981 | |||
| 56a1449c69 | |||
| 63c19ce1a9 | |||
| 3ca2c8da95 | |||
| 00c1860d22 | |||
| 9348768ceb | |||
| 7b0349ca33 | |||
| efa81a7107 | |||
| da353c884d | |||
| df56d7af42 | |||
| 5d38743b72 | |||
| 75a663b6e3 | |||
| f4892686c1 | |||
| b55a84e961 | |||
| 6daf8ebbfa | |||
| 5d8e187faa | |||
| 0891c986d6 | |||
| 8fedbe189c | |||
| cd7d604b75 | |||
| 5caae97813 | |||
| 572a2e45aa | |||
| 98f60d039b | |||
| 656717fb4c | |||
| e08c8b2d25 | |||
| 97f1db480a | |||
| c3772fb355 | |||
| da12fbdd5e | |||
| 94bdde4630 | |||
| abf5ad195c | |||
| b2ccf88296 | |||
| f7eb6b3a16 | |||
| 6059b4301a | |||
| 36d9e0eed5 | |||
| c6d2e1252e | |||
| fe209e0c55 | |||
| f535d60a29 | |||
| 36ca7f294a | |||
| 477457a44f | |||
| 6177589cd3 | |||
| 4853772198 | |||
| 62303e58df | |||
| 82939730dd | |||
| 397e42637a | |||
| 6dc0edec3a | |||
| d019500d81 | |||
| 00afa8ae47 | |||
| a013be8380 | |||
| a436456fa4 | |||
| 5f1e08e7e2 | |||
| 4c633b8b46 | |||
| 9cd73b411d | |||
| 805e80e54c | |||
| d0087267df | |||
| f7fefe789d | |||
| 37e3b9e9e4 | |||
| b72f2a7176 | |||
| 39c8a8fc2d | |||
| 24146181c6 | |||
| e6abe1c5a0 | |||
| eec8aaa4f8 | |||
| 08b8277a7a | |||
| 51083e17af | |||
| 40c64b54e2 | |||
| 4a8f6c3116 | |||
| ffdc7b51b7 | |||
| 1196c5d736 | |||
| 01cbffad9b | |||
| c736c28ab5 | |||
| 6d1c8c54af | |||
| be83f1364d | |||
| fb397d3163 | |||
| f24391be5a | |||
| 5dee3ca245 | |||
| 75303e82e0 | |||
| ddc16a2f65 | |||
| c72fd867fe | |||
| 63d9005a10 | |||
| 0a2d8175a7 | |||
| 7a429cd3ea | |||
| 330aed3f7a | |||
| efc44392b6 | |||
| ffd712312d | |||
| 6a4680b4f0 | |||
| 5c367cd6e7 | |||
| 41a5eb8411 | |||
| 9b7f32cbac | |||
| 901c08cac8 | |||
| 4bb0e16509 | |||
| 39c882cdb4 | |||
| 30a914b148 | |||
| 598469e41e | |||
| 17618efb8b | |||
| 6aad506c80 | |||
| 99b162d16b | |||
| de200e1c5e | |||
| 2620242176 | |||
| 6fd7f0114e | |||
| 1a5b9de372 | |||
| 5a685537a4 | |||
| a964162a01 | |||
| 536bdb550b | |||
| 1673a080a0 | |||
| 2435edc98c | |||
| 1033c61ced | |||
| 1b26cfffd9 | |||
| 4c5c38fe61 | |||
| 0a4264c947 | |||
| 0ccbe8cb15 | |||
| ad428dfb2b | |||
| b7a03bdffa | |||
| 08dadb7fd3 | |||
| a23772dfb7 | |||
| bc071f2b04 | |||
| 9f2423c2c5 | |||
| 235bfada7e | |||
| 1e1aff517f | |||
| fad94047ff | |||
| b1a0e715a6 | |||
| 8412192822 | |||
| c4bb5a99e4 | |||
| 9e9eb37978 | |||
| d48df48a03 | |||
| 7bcd8ee83c | |||
| 03dc07de2f | |||
| 8ff8ea416d | |||
| 5c1e8e2d79 | |||
| 94133bf734 | |||
| 813c32df2f | |||
| fb4a9cdb36 | |||
| 73515f6401 | |||
| e06b01699b | |||
| 2082e2ad19 | |||
| a21d3fd22e | |||
| 29cb603804 | |||
| b67827772b | |||
| 47827a1a1b | |||
| 4de8013b5e | |||
| bbea6c4a9b | |||
| f476b34139 | |||
| 9d261b8f1f | |||
| 907d81c32e | |||
| 6ad274e39d | |||
| eea79052e0 | |||
| ba95c9a63a | |||
| 099baaef70 | |||
| 3fcf166a9d | |||
| dd9aa9fdb5 | |||
| 5faaef9f21 | |||
| eb69498d2c | |||
| df418a80db | |||
| 4d3fc8c314 | |||
| 600b027efd | |||
| cf35d3762b | |||
| 65c6d86e6e | |||
| 3287e1664c | |||
| 65becc8550 | |||
| 50d5a71ca6 | |||
| 20e2f07939 | |||
| ad2702e609 | |||
| 3fcb65ca0f | |||
| e80e2ac5e3 | |||
| 750f374036 | |||
| 57d8d9c232 | |||
| eeb469dda5 | |||
| 43c544465e | |||
| f71d4a63cf | |||
| 258d381083 | |||
| 496db1d13e | |||
| c5f635f967 | |||
| cf1798d2a1 | |||
| 8a0745e8de | |||
| 155fd516ba | |||
| bad151a66f | |||
| 218ce59de6 | |||
| c5097b19cc | |||
| add997dbba | |||
| 8cd3fd0cfe | |||
| c180a20cf9 | |||
| 274c90468f | |||
| d40d841cf3 | |||
| 24ac8582bf | |||
| 6cff684af1 | |||
| ec39b9e701 | |||
| 3d591be8c6 | |||
| cecaee8e68 | |||
| b22c2b28ec | |||
| 0bd04d9f3e | |||
| 1a1666c399 | |||
| 533b28ce32 | |||
| f459af7090 | |||
| 7d0e0a7f38 | |||
| 26036cf7b2 | |||
| b9808c5b5e | |||
| c6d3545b8b | |||
| f8acc2a15e | |||
| 62ab457908 | |||
| c11c55e83c | |||
| 1984cb6272 | |||
| 5123d2505e | |||
| f9fdcb1103 | |||
| 6e386868a6 | |||
| e8685b1430 | |||
| b1b636a911 | |||
| 86fba93f63 | |||
| a2d005701e | |||
| b9b03d8259 | |||
| 4a6d1e8ff6 | |||
| 9c523cf7eb | |||
| da02895432 | |||
| 6cfde246a2 | |||
| 3aff1341f6 | |||
| 284f758cb4 | |||
| 0cd6c5b200 | |||
| a06dfafb9a | |||
| e2e5fbe33a | |||
| 7cc59b2f49 | |||
| 7a06dca942 | |||
| a1be985067 | |||
| 7ff8e44386 | |||
| 06cdeb45a5 | |||
| de41faff80 | |||
| bae9df61dc | |||
| 136586830d | |||
| 30c9156a41 | |||
| 52806c0056 | |||
| 1359f46bae | |||
| 4c47c980f8 | |||
| 627e3d8a77 | |||
| 6befd831c9 | |||
| 3664f4c394 | |||
| 7b92675778 | |||
| 54189a5d97 | |||
| f119b8e64f | |||
| 7b41098a5d | |||
| 8be3344e41 | |||
| bc7d16ede6 | |||
| 501cbea5aa | |||
| 67a0c96ea2 | |||
| 41d29b5445 | |||
| 92840f85fe | |||
| eb0d2d47e4 | |||
| 971b45e630 | |||
| 431aa78b6f | |||
| 8733b968f5 | |||
| 2820314586 | |||
| 1183b14ea9 | |||
| 328c6a5439 | |||
| 2549924cef | |||
| f41bf1dcca | |||
| 617c1e01d2 | |||
| a5be1f147f | |||
| 1571dd60c8 | |||
| 13be8db639 | |||
| cac7b267e6 | |||
| eed7ceb37a | |||
| 0fc1c9184c | |||
| 9ccd9b7cad | |||
| e923455f6d | |||
| 50cba2b12b | |||
| 95680e0158 | |||
| d2f41d7467 | |||
| 589052325b | |||
| 16fec55c6f | |||
| cbdea59753 | |||
| 5832ab3eb5 | |||
| 567321dd3d | |||
| 169c3fbc6b | |||
| 5b3dda1cfb | |||
| 1c80b5fdfe | |||
| 4709f4a3c0 | |||
| a9b44884f1 | |||
| c31c2ca0e9 | |||
| 1bfa43fa8b | |||
| 0f4562eb44 | |||
| 4abff03244 | |||
| d6ab0696e6 | |||
| ff69638595 | |||
| 05946f2932 | |||
| 0550ad5135 | |||
| f89e42a5c5 | |||
| 601bfa628b | |||
| 73f40a6cc6 | |||
| a1786b97b3 | |||
| 5df213f5ae | |||
| d916e65a14 | |||
| 6ccf3e839d | |||
| e43f0619ca | |||
| 82621c08ec | |||
| d99a5a740e | |||
| 843989489d | |||
| e6a819e5dd | |||
| ac21fa9808 |
+160
-79
@@ -1,80 +1,161 @@
|
||||
- (d)oekia
|
||||
- Alexander Otchenashev
|
||||
- Benjamin PONGY
|
||||
- Burhan
|
||||
- Caleydon Media
|
||||
- Damien Metzger
|
||||
- DamienMetzger
|
||||
- Damon Skelhorn
|
||||
- Daniel
|
||||
- David Gasperoni
|
||||
- DrySs
|
||||
- DrÿSs'
|
||||
- François Gaillard
|
||||
- Gabriel Schwardy
|
||||
- Gregory Roussac
|
||||
- Ha!*!*y
|
||||
- Jonathan Danse
|
||||
- Krystian Podemski
|
||||
- Marco Cervellin
|
||||
- Michel Courtade
|
||||
- Milow
|
||||
- Patanock
|
||||
- Pierre
|
||||
- PrestaEdit
|
||||
- Raphaël Malié
|
||||
- Rémi Gaillard
|
||||
- Samy Rabih
|
||||
- Sarah Lorenzini
|
||||
- Shagshag
|
||||
- Vincent Augagneur
|
||||
- Xavier POITAU
|
||||
- aFolletete
|
||||
- aKorczak
|
||||
- aNiassy
|
||||
- adonis karavokyros
|
||||
- anat
|
||||
- bLeveque
|
||||
- bMancone
|
||||
- bumbu
|
||||
- cmouleyre
|
||||
- dMetzger
|
||||
- dSevere
|
||||
- djfm
|
||||
- fBrignoli
|
||||
- fSerny
|
||||
- fram
|
||||
- gBrunier
|
||||
- gCharmes
|
||||
- gPoulain
|
||||
- gRoussac
|
||||
- hAitmansour
|
||||
- ivancasasempere
|
||||
- jBreux
|
||||
- jObregon
|
||||
- jessylenne
|
||||
- jmCollin
|
||||
- kpodemski
|
||||
- lBrieu
|
||||
- lCherifi
|
||||
- lLefevre
|
||||
- mBertholino
|
||||
- mDeflotte
|
||||
- mMarinetti
|
||||
- marcinsz101
|
||||
- montes
|
||||
- nPellicari
|
||||
- nezenmoins
|
||||
- oleacorner
|
||||
- rGaillard
|
||||
- rMalie
|
||||
- rMontagne
|
||||
- root
|
||||
- sLorenzini
|
||||
- sThiebaut
|
||||
- tDidierjean
|
||||
- vAugagneur
|
||||
- vChabot
|
||||
- vKham
|
||||
- vSchoener
|
||||
- adonis karavokyros
|
||||
- aFolletete
|
||||
- Agence CINS
|
||||
- aKorczak
|
||||
- Alexander Otchenashev
|
||||
- anat
|
||||
- Andrew
|
||||
- aNiassy
|
||||
- antoniofr
|
||||
- AntonLejon
|
||||
- Arnaud Lemercier
|
||||
- Axome
|
||||
- Benjamin PONGY
|
||||
- BigZ
|
||||
- bLeveque
|
||||
- bMancone
|
||||
- bumbu
|
||||
- Burhan
|
||||
- Caleydon Media
|
||||
- cam.lafit
|
||||
- Captain FLAM
|
||||
- Captain-FLAM
|
||||
- ccauw
|
||||
- Cédric Mouleyre
|
||||
- ChristopheBoucaut
|
||||
- CINS
|
||||
- cippest
|
||||
- cmouleyre
|
||||
- Corentin Delcourt
|
||||
- Cosmin Hutanu
|
||||
- Damien Metzger
|
||||
- DamienMetzger
|
||||
- Damon Skelhorn
|
||||
- Daniel
|
||||
- David Gasperoni
|
||||
- Davy Rolink
|
||||
- djfm
|
||||
- dlage
|
||||
- dMetzger
|
||||
- (d)oekia
|
||||
- Dragan Skrbic
|
||||
- dreammeup
|
||||
- DrySs
|
||||
- DrÿSs
|
||||
- DrÿSs'
|
||||
- dSevere
|
||||
- Edouard Gaulué
|
||||
- emily-d
|
||||
- Fabio Chelly
|
||||
- fBrignoli
|
||||
- fram
|
||||
- Francois Gaillard
|
||||
- François Gaillard
|
||||
- Fran?s Gaillard
|
||||
- fSerny
|
||||
- Gabriel Schwardy
|
||||
- gBrunier
|
||||
- gCharmes
|
||||
- gPoulain
|
||||
- gr4devel
|
||||
- Grégoire Bélorgey
|
||||
- Gregory Roussac
|
||||
- gRoussac
|
||||
- Guillaume DELOINCE
|
||||
- ha99y
|
||||
- hAitmansour
|
||||
- Ha!*!*y
|
||||
- indesign47
|
||||
- inem0o
|
||||
- ivancasasempere
|
||||
- jBreux
|
||||
- jeckyl
|
||||
- jeromenadaud
|
||||
- Jerome Nadaud
|
||||
- Jérôme Nadaud
|
||||
- jessylenne
|
||||
- jmCollin
|
||||
- jObregon
|
||||
- Jonathan Danse
|
||||
- joseantgv
|
||||
- Julien
|
||||
- Kevin Granger
|
||||
- kpodemski
|
||||
- Krystian Podemski
|
||||
- lBrieu
|
||||
- lCherifi
|
||||
- ldecoker
|
||||
- lLefevre
|
||||
- LOIC ROSSET ltd
|
||||
- makk1ntosh
|
||||
- marcinsz101
|
||||
- Marco Cervellin
|
||||
- matiasiglesias
|
||||
- Mats Rynge
|
||||
- MatthieuB
|
||||
- Maxence
|
||||
- mBertholino
|
||||
- mDeflotte
|
||||
- Michel Courtade
|
||||
- Milow
|
||||
- minic studio
|
||||
- misthero
|
||||
- mMarinetti
|
||||
- montes
|
||||
- nezenmoins
|
||||
- Nicolas Sorosac
|
||||
- Nils-Helge Garli Hegvik
|
||||
- nPellicari
|
||||
- nturato
|
||||
- oleacorner
|
||||
- Otto Nascarella
|
||||
- Patanock
|
||||
- PhpMadman
|
||||
- Pierre
|
||||
- Piotr Kaczor
|
||||
- Piotr Mocko
|
||||
- PrestaEdit
|
||||
- prestarocket
|
||||
- Prestaspirit
|
||||
- pxls
|
||||
- Raphaël Malié
|
||||
- raulgundin
|
||||
- Rémi Gaillard
|
||||
- rGaillard
|
||||
- Rimas Kudelis
|
||||
- rMalie
|
||||
- rMontagne
|
||||
- romainberger
|
||||
- root
|
||||
- runningz
|
||||
- sagaradonis
|
||||
- Samy Rabih
|
||||
- Sarah Lorenzini
|
||||
- Seb
|
||||
- Sébastien
|
||||
- Sébastien Bocahu
|
||||
- Seynaeve
|
||||
- Shagshag
|
||||
- sjousse
|
||||
- sLorenzini
|
||||
- smartdatasoft
|
||||
- soufyan
|
||||
- soware
|
||||
- Staging
|
||||
- sThiebaut
|
||||
- Sylvain WITMEYER
|
||||
- tDidierjean
|
||||
- unknown
|
||||
- vAugagneur
|
||||
- vChabot
|
||||
- Vincent Augagneur
|
||||
- Vincent Schoener
|
||||
- Vincent Terenti
|
||||
- vinvin27
|
||||
- vKham
|
||||
- vSchoener
|
||||
- Xavier
|
||||
- Xavier POITAU
|
||||
- Yoozio
|
||||
- zimmi1
|
||||
|
||||
|
||||
@@ -2,47 +2,48 @@ README
|
||||
======
|
||||

|
||||
|
||||
PREPARATION
|
||||
ABOUT
|
||||
--------
|
||||
|
||||
To install PrestaShop, you need a remote web server or on your computer (MAMP), with access to a database like MySQL.
|
||||
You'll need access to phpMyAdmin to create a database and to indicate the information in the database in the installer.
|
||||
PrestaShop is a free and open-source e-commerce web application, committed to providing the best shopping cart experience for both merchants and consumers.
|
||||
|
||||
|
||||
SERVER CONFIGURATION
|
||||
--------
|
||||
|
||||
To install PrestaShop, you need a web server running PHP5 and any flavor of MySQL5 (MySQL, MariaDB, Percona Server...).
|
||||
You will also need a database administration tool, such as phpMyAdmin, in order to create a database for PrestaShop.
|
||||
We recommend the Apache or Nginx web servers.
|
||||
|
||||
If your host does not offer PHP5 by default, here are a few [explanations][2] about PHP5 or the .htaccess file for certain hosting services (1&1, Free, Lycos, OVH, Infomaniak, Amen, GoDaddy, etc).
|
||||
|
||||
If you want your online store ready to go, visit [http://www.prestabox.com][1]: it lets you create your online store in less than 10 minutes without any technical knowledge.
|
||||
|
||||
If you do not host and unable to create your store, we offer a turnkey store, which lets you create your online store in less than 10 minutes without any technical knowledge.
|
||||
We invite you to visit: [http://www.prestabox.com][1]
|
||||
|
||||
INSTALLATION
|
||||
--------
|
||||
|
||||
Simply go to your PrestaShop web directory and use installer :-)
|
||||
With your web browser, go to the root of your PrestaShop directory, and the installer will start. Follow the instructions until PrestaShop is installed.
|
||||
|
||||
If you have any PHP error, perhaps you don't have PHP5 or you need to activate it on your web host.
|
||||
Please go to our forum to find pre-installation settings (PHP 5, htaccess) for certain hosting services (1&1, Free, Lycos, OVH, Infomaniak, Amen, GoDaddy, etc).
|
||||
If you have any PHP error, perhaps you don't have PHP5 or you need to activate it on your web host. See the page linked above.
|
||||
If you don't find any solution to start the installer, please post on [the PrestaShop forums][3].
|
||||
|
||||
English webhost [specifics settings][2]
|
||||
|
||||
|
||||
If you don't find any solution to launch installer, please post on [our forum][3]
|
||||
|
||||
|
||||
There are always solutions for your issues ;-)
|
||||
|
||||
DOCUMENTATION
|
||||
--------
|
||||
|
||||
For any extra documentation (how-to), please read our [Online documentation][4]
|
||||
The official PrestaShop documentation is available online [on its own website][4].
|
||||
|
||||
|
||||
FORUMS
|
||||
--------
|
||||
|
||||
You can also discuss, help and contribute with PrestaShop community on [our forums][5]
|
||||
You can discuss, help and contribute with PrestaShop community on [the PrestaShop forums][5].
|
||||
|
||||
|
||||
Thanks for downloading and using PrestaShop e-commerce Open-source solution!
|
||||
Thank you for downloading and using PrestaShop e-commerce Open-source solution!
|
||||
|
||||
[1]: http://www.prestabox.com
|
||||
[2]: http://www.prestashop.com/forums/topic/2946-pre-installation-settings-php-5-htaccess-for-certain-hosting-services/
|
||||
[3]: http://www.prestashop.com/forums/forum/7-installing-prestashop/
|
||||
[4]: http://doc.prestashop.com
|
||||
[5]: http://www.prestashop.com/forums/
|
||||
[5]: http://www.prestashop.com/forums/
|
||||
|
||||
+1
-92
@@ -26,45 +26,12 @@
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
|
||||
/* Getting cookie or logout */
|
||||
require_once(_PS_ADMIN_DIR_.'/init.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Tools::isSubmit('changeParentUrl'))
|
||||
echo '<script type="text/javascript">parent.parent.document.location.href = "'.addslashes(urldecode(Tools::getValue('changeParentUrl'))).'";</script>';
|
||||
if (Tools::isSubmit('installBoughtModule'))
|
||||
{
|
||||
$file = false;
|
||||
while ($file === false OR file_exists(_PS_MODULE_DIR_.$file))
|
||||
$file = uniqid();
|
||||
$file = _PS_MODULE_DIR_.$file.'.zip';
|
||||
$sourceFile = 'http://addons.prestashop.com/iframe/getboughtfile.php?id_order_detail='.Tools::getValue('id_order_detail').'&token='.Tools::getValue('token');
|
||||
if (!copy($sourceFile, $file))
|
||||
{
|
||||
if (!($content = file_get_contents($sourceFile)))
|
||||
die(displayJavascriptAlert('Access denied: Please download your module directly from PrestaShop Addons website'));
|
||||
elseif (!file_put_contents($file, $content))
|
||||
die(displayJavascriptAlert('Local error: your module directory is not writable'));
|
||||
}
|
||||
$first6 = fread($fd = fopen($file, 'r'), 6);
|
||||
if (!strncmp($first6, 'Error:', 6))
|
||||
{
|
||||
$displayJavascriptAlert = displayJavascriptAlert(fread($fd, 1024));
|
||||
fclose($fd);
|
||||
unlink($file);
|
||||
die($displayJavascriptAlert);
|
||||
}
|
||||
fclose($fd);
|
||||
if (!Tools::ZipExtract($file, _PS_MODULE_DIR_))
|
||||
{
|
||||
unlink($file);
|
||||
die(displayJavascriptAlert('Cannot unzip file'));
|
||||
}
|
||||
unlink($file);
|
||||
die(displayJavascriptAlert('Module copied to disk'));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajaxReferrers'))
|
||||
{
|
||||
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
|
||||
@@ -101,39 +68,6 @@ if (Tools::isSubmit('ajaxProductPackItems'))
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajaxStates') AND Tools::isSubmit('id_country'))
|
||||
{
|
||||
$states = Db::getInstance()->executeS('
|
||||
SELECT s.id_state, s.name
|
||||
FROM '._DB_PREFIX_.'state s
|
||||
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
|
||||
WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1
|
||||
ORDER BY s.`name` ASC');
|
||||
|
||||
if (is_array($states) AND !empty($states))
|
||||
{
|
||||
$list = '';
|
||||
if (Tools::getValue('no_empty') != true)
|
||||
{
|
||||
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
|
||||
$list = '<option value="0">'.Tools::htmlentitiesUTF8($empty_value).'</option>'."\n";
|
||||
}
|
||||
|
||||
foreach ($states AS $state)
|
||||
$list .= '<option value="'.(int)($state['id_state']).'"'.((isset($_GET['id_state']) AND $_GET['id_state'] == $state['id_state']) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'."\n";
|
||||
}
|
||||
else
|
||||
$list = 'false';
|
||||
|
||||
die($list);
|
||||
}
|
||||
|
||||
if (Tools::getValue('form_language_id'))
|
||||
{
|
||||
if (!($context->cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
|
||||
die ('Error while updating cookie.');
|
||||
die ('Form language updated.');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitTrackClickOnHelp'))
|
||||
{
|
||||
@@ -144,15 +78,6 @@ if (Tools::isSubmit('submitTrackClickOnHelp'))
|
||||
HelpAccess::trackClick($label, $version);
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('toggleScreencast'))
|
||||
{
|
||||
if (Validate::isLoadedObject($context->employee))
|
||||
{
|
||||
$context->employee->bo_show_screencast = !$context->employee->bo_show_screencast;
|
||||
$context->employee->update();
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent'))
|
||||
{
|
||||
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
|
||||
@@ -200,17 +125,6 @@ if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('
|
||||
die(Tools::jsonEncode($output));
|
||||
}
|
||||
|
||||
/* Update attribute */
|
||||
if (Tools::isSubmit('ajaxUpdateTaxRule'))
|
||||
{
|
||||
$id_tax_rule = Tools::getValue('id_tax_rule');
|
||||
$tax_rules = new TaxRule((int)$id_tax_rule);
|
||||
$output = array();
|
||||
foreach ($tax_rules as $key => $result)
|
||||
$output[$key] = $result;
|
||||
die(Tools::jsonEncode($output));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getZones'))
|
||||
{
|
||||
$zones = Zone::getZones();
|
||||
@@ -223,8 +137,3 @@ if (Tools::isSubmit('getZones'))
|
||||
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
||||
die(Tools::jsonEncode($html));
|
||||
}
|
||||
|
||||
function displayJavascriptAlert($s)
|
||||
{
|
||||
echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
$timer_start = microtime(true);
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
|
||||
if (!defined('PS_ADMIN_DIR'))
|
||||
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_);
|
||||
|
||||
require(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
require(_PS_ADMIN_DIR_.'/functions.php');
|
||||
|
||||
|
||||
+6
-3
@@ -49,9 +49,12 @@ try
|
||||
AdminTab::$currentIndex = $currentIndex;
|
||||
|
||||
$iso = $context->language->iso_code;
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php'))
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
|
||||
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php'))
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
|
||||
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'))
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||
|
||||
/* Server Params */
|
||||
$protocol_link = (Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
|
||||
|
||||
@@ -30,6 +30,7 @@ select[disabled="disabled"], input[disabled="disabled"],textarea[disabled="disab
|
||||
|
||||
/*BUTTON*/
|
||||
.button{
|
||||
cursor: pointer;
|
||||
background: #e3e3e3 url('../img/bg-button-degrade.png') repeat-x scroll left top;
|
||||
background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent;
|
||||
background: -webkit-gradient(linear, center top ,center bottom, from(#F9F9F9), to(#E3E3E3)) repeat scroll 0 0 transparent;
|
||||
@@ -673,4 +674,4 @@ ul.listForm li {padding-bottom:3px;}
|
||||
|
||||
/************** SCENE *****************/
|
||||
|
||||
#large_scene_image{clear:both;border:1px solid transparent;}
|
||||
#large_scene_image{clear:both;border:1px solid transparent;}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{if $input.name == 'zones'}
|
||||
<div class="ranges_not_follow warn" style="display:none">
|
||||
<label>{l s="Ranges are not correctly ordered:"}</label>
|
||||
<a href="#" class="button" style="text-decoration:none">{l s="Reordering"}</a>
|
||||
<a href="#" onclick="checkRangeContinuity(true); return false;" class="button" style="text-decoration:none">{l s="Reordering"}</a>
|
||||
</div>
|
||||
{include file='controllers/carrier_wizard/helpers/form/form_ranges.tpl'}
|
||||
<!--
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
</tr>
|
||||
<tr class="fees_all">
|
||||
<td class="border_top border_bottom border_bold"><span class="fees_all" {if $ranges|count == 0}style="display:none" {/if}>All</span></td>
|
||||
<td></td>
|
||||
<td><input type="checkbox" onclick="checkAllZones(this);" ></td>
|
||||
{foreach from=$ranges key=r item=range}
|
||||
<td class="center border_top border_bottom {if $range.id_range != 0} validated {/if}" >
|
||||
<input type="text" {if isset($form_id) && !$form_id} disabled="disabled"{/if} {if $range.id_range == 0} style="display:none"{/if} /><span class="currency_sign" {if $range.id_range == 0} style="display:none" {/if}> {$currency_sign}</span>
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
var PS_WEIGHT_UNIT = '{$PS_WEIGHT_UNIT}';
|
||||
var invalid_range = '{l s='This range is not valid' js=1}';
|
||||
var range_is_overlapping = '{l s='Ranges are overlapping' js=1}';
|
||||
var multistore_enable = '{$multistore_enable}';
|
||||
</script>
|
||||
<div id="carrier_wizard" class="swMain">
|
||||
<ul class="nbr_steps_{$wizard_steps.steps|count}">
|
||||
|
||||
@@ -25,14 +25,12 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var summary_translation_undefined = '{l s='[undefined]' js=1}';
|
||||
|
||||
var summary_translation_meta_informations = '{l s='This carrier is @s1 and the displayed delivery time is: @s2.' js=1}';
|
||||
var summary_translation_meta_informations = '{l s='This carrier is @s1 and the delivery announced is: @s2.' js=1}';
|
||||
var summary_translation_free = '<strong>{l s='free' js=1}</strong>';
|
||||
var summary_translation_paid = '<strong>{l s='paid' js=1}</strong>';
|
||||
|
||||
var summary_translation_range = '{l s='This carrier can deliver orders from @s1 to @s2. If the order is out of range, the behavior is to @s3.' js=1}';
|
||||
|
||||
var summary_translation_shipping_cost = '{l s='The shipping cost is calculated @s1 and the tax rule @s2 is applied.' js=1}';
|
||||
var summary_translation_paid = '<strong>{l s='not free' js=1}</strong>';
|
||||
var summary_translation_range = '<span class="is_free">{l s='This carrier can deliver orders from @s1 to @s2.' js=1}</span>';
|
||||
var summary_translation_range_limit = '{l s='If the order is out of range, the behavior is to @s3.' js=1}';
|
||||
var summary_translation_shipping_cost = '{l s='The shipping cost is calculated @s1 and the tax rule @s2 will be applied.' js=1}';
|
||||
var summary_translation_price = '<strong>{l s='according to the price' js=1}</strong>';
|
||||
var summary_translation_weight = '<strong>{l s='according to the weight' js=1}</strong>';
|
||||
</script>
|
||||
@@ -47,18 +45,18 @@
|
||||
<div id="summary_range"></div>
|
||||
<div class="clear"> </div>
|
||||
<div>
|
||||
{l s='It will be displayed only for the following zones:'}
|
||||
{l s='This carrier will be proposed for those delivery zones:'}
|
||||
<ul id="summary_zones"></ul>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<div>
|
||||
{l s='It will be displayed only for the following groups:'}
|
||||
{l s='And it will be proposed for those client groups:'}
|
||||
<ul id="summary_groups"></ul>
|
||||
</div>
|
||||
{if $is_multishop}
|
||||
<div class="clear"> </div>
|
||||
<div>
|
||||
{l s='It will be displayed only for the following shops:'}
|
||||
{l s='Finally, this carrier will be proposed in those shops:'}
|
||||
<ul id="summary_shops"></ul>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
{if $shared_category}
|
||||
<p class="warn">{l s='If you delete this picture, it will be deleted in all of your shared shops!'}</p>
|
||||
{/if}
|
||||
<br>
|
||||
<br />
|
||||
<a href="{$current}&{$identifier}={$form_id}&token={$token}&{if $shared_category}forcedeleteImage=1{else}deleteImage=1{/if}">
|
||||
<img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'}
|
||||
</a>
|
||||
@@ -71,4 +71,4 @@
|
||||
<span>{$input.customer}</span><br />
|
||||
</p>
|
||||
{/if}
|
||||
{/block}
|
||||
{/block}
|
||||
@@ -48,11 +48,11 @@
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#group_discount_category").fancybox({
|
||||
onStart: function () {
|
||||
beforeLoad: function () {
|
||||
$('#group_discount_category_fancybox').show();
|
||||
initFancyBox();
|
||||
},
|
||||
onClosed: function () {
|
||||
beforeClose: function () {
|
||||
$('#group_discount_category_fancybox').hide();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
</ul>
|
||||
</fieldset>
|
||||
<h2>{l s='Members of this customer group'}</h2>
|
||||
<p>{l s='Limited to the first 100 customers.'} {l s='Please use filters to narrow your search.'}</p>
|
||||
{$customerList}
|
||||
|
||||
{/block}
|
||||
{/block}
|
||||
|
||||
@@ -110,14 +110,14 @@ $(document).ready(function() {
|
||||
</ul>
|
||||
|
||||
<div id="partner_preactivation">
|
||||
<p class="center"><img src="../img/loader.gif" alt="" /></p>
|
||||
<p class="center"><img src="../img/loader.gif" alt="" /> {l s='Loading...'}</p>
|
||||
</div>
|
||||
|
||||
<div class="separation"></div>
|
||||
|
||||
|
||||
{$tips_optimization}
|
||||
<div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
|
||||
<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*}
|
||||
@@ -212,7 +212,7 @@ $(document).ready(function() {
|
||||
{
|
||||
// don't show/hide screencast if it's deactivated
|
||||
{if $employee->bo_show_screencast}
|
||||
$('#adminpresentation').fadeOut('slow');
|
||||
$('#adminpresentation').fadeOut('slow');
|
||||
{/if}
|
||||
$('#partner_preactivation').fadeOut('slow');
|
||||
$('#discover_prestashop').fadeOut('slow');
|
||||
@@ -223,7 +223,7 @@ $(document).ready(function() {
|
||||
$.fancybox(
|
||||
this.href,
|
||||
{
|
||||
'width' : 660,
|
||||
'width' : 920,
|
||||
'height' : 384,
|
||||
'transitionIn' : 'none',
|
||||
'transitionOut' : 'none',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
**
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
@@ -10,72 +10,25 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
**
|
||||
* DISCLAIMER
|
||||
*
|
||||
**
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
**
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
|
||||
<div class="leadin">{block name="leadin"}{/block}</div>
|
||||
|
||||
{if $module_confirmation}
|
||||
<div class="module_confirmation conf confirm">
|
||||
{l s='Your .CSV file has been sucessfully imported into your shop.'}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var truncateAuthorized = {$truncateAuthorized|intval};
|
||||
|
||||
$(document).ready(function(){
|
||||
activeClueTip();
|
||||
$("a#upload_file_import_link").fancybox({
|
||||
'titleShow' : false,
|
||||
'transitionIn' : 'elastic',
|
||||
'transitionOut' : 'elastic'
|
||||
});
|
||||
|
||||
$('#preview_import').submit(function(e) {
|
||||
if ($('#truncate').get(0).checked)
|
||||
{
|
||||
console.log(truncateAuthorized);
|
||||
if (truncateAuthorized)
|
||||
{
|
||||
if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '?'))
|
||||
{
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.' js=1}');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function activeClueTip()
|
||||
{
|
||||
$('.info_import').cluetip({
|
||||
splitTitle: '|',
|
||||
showTitle: false
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
{**
|
||||
* Upload fancybox
|
||||
*}
|
||||
<div style="display: none">
|
||||
<div id="upload_file_import" style="padding-left: 10px; background-color: #EBEDF4; border: 1px solid #CCCED7">
|
||||
<div class="clear"> </div>
|
||||
@@ -97,28 +50,16 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clear"> </div>
|
||||
|
||||
{**
|
||||
* Import fieldset
|
||||
*}
|
||||
<form id="preview_import"
|
||||
action="{$current}&token={$token}"
|
||||
method="post"
|
||||
style="display:inline"
|
||||
enctype="multipart/form-data"
|
||||
class="clear">
|
||||
|
||||
<form id="preview_import" action="{$current}&token={$token}" method="post" style="display:inline" enctype="multipart/form-data" class="clear">
|
||||
<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=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">
|
||||
{foreach $files_to_import AS $filename}
|
||||
<option value="{$filename}">{$filename}</option>
|
||||
<option value="{$filename}"{if $csv_selected == $filename} selected="selected"{/if}>{$filename|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{/if}
|
||||
@@ -126,33 +67,43 @@
|
||||
<a href="#upload_file_import" id="upload_file_import_link" class="button"><img src="../img/admin/add.gif" alt="Uplaod" title="Upload" />{l s='Upload'}</a>
|
||||
</div>
|
||||
<div style="width:50%; margin: 0 auto;">
|
||||
<a href="#" onclick="$('#sample_files_import').slideToggle(); return false;">{l s='Click to view our sample import csv files.'}</a>
|
||||
<ul id="sample_files_import" style="display:none">
|
||||
<li><a href="../docs/csv_import/categories_import.csv">{l s='Sample Categories file'}</a></li>
|
||||
<li><a href="../docs/csv_import/products_import.csv">{l s='Sample Products file'}</a></li>
|
||||
<li><a href="../docs/csv_import/combinations_import.csv">{l s='Sample Combinations file'}</a></li>
|
||||
<li><a href="../docs/csv_import/customers_import.csv">{l s='Sample Customers file'}</a></li>
|
||||
<li><a href="../docs/csv_import/addresses_import.csv">{l s='Sample Addresses file'}</a></li>
|
||||
<li><a href="../docs/csv_import/manufacturers_import.csv">{l s='Sample Manufacturers file'}</a></li>
|
||||
<li><a href="../docs/csv_import/suppliers_import.csv">{l s='Sample Suppliers file'}</a></li>
|
||||
{if $PS_ADVANCED_STOCK_MANAGEMENT}
|
||||
<li><a href="../docs/csv_import/supply_orders_import.csv">{l s='Supply Orders sample file'}</a></li>
|
||||
<li><a href="../docs/csv_import/supply_orders_details_import.csv">{l s='Supply Orders Details sample file'}</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
<div style="width:50%; display: inline-block; float :left;">
|
||||
<a href="#" onclick="$('#sample_files_import').slideToggle(); return false;">{l s='Click to view our sample import csv files.'}</a>
|
||||
<ul id="sample_files_import" style="display:none;">
|
||||
<li><a class="_blank" href="../docs/csv_import/categories_import.csv">{l s='Sample Categories file'}</a></li>
|
||||
<li><a class="_blank" href="../docs/csv_import/products_import.csv">{l s='Sample Products file'}</a></li>
|
||||
<li><a class="_blank" href="../docs/csv_import/combinations_import.csv">{l s='Sample Combinations file'}</a></li>
|
||||
<li><a class="_blank" href="../docs/csv_import/customers_import.csv">{l s='Sample Customers file'}</a></li>
|
||||
<li><a class="_blank" href="../docs/csv_import/addresses_import.csv">{l s='Sample Addresses file'}</a></li>
|
||||
<li><a class="_blank" href="../docs/csv_import/manufacturers_import.csv">{l s='Sample Manufacturers file'}</a></li>
|
||||
<li><a class="_blank" href="../docs/csv_import/suppliers_import.csv">{l s='Sample Suppliers file'}</a></li>
|
||||
{if $PS_ADVANCED_STOCK_MANAGEMENT}
|
||||
<li><a class="_blank" href="../docs/csv_import/supply_orders_import.csv">{l s='Supply Orders sample file'}</a></li>
|
||||
<li><a class="_blank" href="../docs/csv_import/supply_orders_details_import.csv">{l s='Supply Orders Details sample file'}</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
<div style="width:50%; float:left;">
|
||||
<a href="#" onclick="$('#csv_files_import').slideToggle(); return false;">{l s='Click to view your csv files.'}</a>
|
||||
<ul id="csv_files_import" style="display:none;">
|
||||
{foreach $files_to_import AS $filename}
|
||||
<li><a href="{$current}&token={$token}&csvfilename={$filename|@base64_encode}">{$filename}</a>
|
||||
<a href="{$current}&token={$token}&csvfilename={$filename|@base64_encode}&delete=1"><img src="../img/admin/delete.gif" /></a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
<label class="clear">{l s='What kind of entity would you like to import?'} </label>
|
||||
<div class="margin-form">
|
||||
<select name="entity" id="entity">
|
||||
{foreach $entities AS $entity => $i}
|
||||
<option value="{$i}" {if $entity == $i}selected="selected"{/if}>
|
||||
<option value="{$i}"{if $entity_selected == $i} selected="selected"{/if}>
|
||||
{$entity}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label class="clear">{l s='Language of the file'}</label>
|
||||
<div class="margin-form">
|
||||
<select name="iso_lang">
|
||||
@@ -168,26 +119,30 @@
|
||||
</div>
|
||||
<label class="clear">{l s='Field separator'} </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="2" value=";" name="separator"/>
|
||||
<input type="text" size="2" value="{if isset($separator_selected)}{$separator_selected|escape:'htmlall':'UTF-8'}{else};{/if}" name="separator"/>
|
||||
{l s='e.g. '}"1<span class="bold" style="color: red">;</span>Ipod<span class="bold" style="color: red">;</span>129.90<span class="bold" style="color: red">;</span>5"
|
||||
</div>
|
||||
<label class="clear">{l s='Multiple value separator'} </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="2" value="," name="multiple_value_separator"/>
|
||||
<input type="text" size="2" value="{if isset($multiple_value_separator_selected)}{$multiple_value_separator_selected|escape:'htmlall':'UTF-8'}{else},{/if}" name="multiple_value_separator"/>
|
||||
{l s='e.g. '}"Ipod;red.jpg<span class="bold" style="color: red">,</span>blue.jpg<span class="bold" style="color: red">,</span>green.jpg;129.90"
|
||||
</div>
|
||||
<label for="truncate" class="clear">{l s='Delete all'} <span id="entitie">{l s='categories'}</span> {l s='before import?'} </label>
|
||||
<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="regenerate" class="clear">{l s='No thumbnails regeneration'}</label>
|
||||
<div class="margin-form">
|
||||
<input name="match_ref" id="match_ref" type="checkbox" style="margin-top: 6px; display:none"/>
|
||||
<input name="regenerate" id="regenerate" type="checkbox" />
|
||||
</div>
|
||||
<label for="forceIDs" class="clear">{l s='Force all ID\'s during import?'} </label>
|
||||
<div class="margin-form">
|
||||
<input name="forceIDs" id="forceIDs" type="checkbox"/> {l s='If you don\'t use this option, all ID\'s will be auto-incremented.'}
|
||||
</div>
|
||||
<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>
|
||||
<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 in order to proceed to the next step'}</span>{/if}
|
||||
@@ -210,13 +165,10 @@
|
||||
{/if}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<fieldset style="display:block;">
|
||||
|
||||
<legend>
|
||||
<img src="../img/admin/import.gif" />{l s='Available fields'}
|
||||
</legend>
|
||||
|
||||
<div id="availableFields">
|
||||
{$available_fields}
|
||||
</div>
|
||||
@@ -224,74 +176,88 @@
|
||||
<div class="clear">
|
||||
<br /><br />{l s='* Required field'}
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<div class="clear"> </div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("select#entity").change( function() {
|
||||
|
||||
if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8)
|
||||
{
|
||||
$("label[for=truncate],#truncate").hide();
|
||||
}
|
||||
else
|
||||
$("label[for=truncate],#truncate").show();
|
||||
|
||||
|
||||
if ($("#entity > option:selected").val() == 8)
|
||||
{
|
||||
$(".import_supply_orders_details").show();
|
||||
$('input[name=multiple_value_separator]').val('|');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(".import_supply_orders_details").hide();
|
||||
$('input[name=multiple_value_separator]').val(',');
|
||||
}
|
||||
|
||||
|
||||
if ($("#entity > option:selected").val() == 1)
|
||||
{
|
||||
$("label[for=match_ref],#match_ref").show();
|
||||
}
|
||||
else
|
||||
$("label[for=match_ref],#match_ref").hide();
|
||||
|
||||
if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0)
|
||||
{
|
||||
$(".import_products_categories").show();
|
||||
}
|
||||
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',
|
||||
data: {
|
||||
getAvailableFields:1,
|
||||
entity: $("#entity").val()
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(j) {
|
||||
var fields = "";
|
||||
$("#availableFields").empty();
|
||||
|
||||
for (var i = 0; i < j.length; i++)
|
||||
fields += j[i].field;
|
||||
|
||||
$("#availableFields").html(fields);
|
||||
activeClueTip();
|
||||
},
|
||||
error: function(j) {
|
||||
}
|
||||
$(document).ready(function(){
|
||||
var truncateAuthorized = {$truncateAuthorized|intval};
|
||||
activeClueTip();
|
||||
$("a#upload_file_import_link").fancybox({
|
||||
'titleShow' : false,
|
||||
'transitionIn' : 'elastic',
|
||||
'transitionOut' : 'elastic'
|
||||
});
|
||||
|
||||
$('#preview_import').submit(function(e){
|
||||
if ($('#truncate').get(0).checked)
|
||||
if (truncateAuthorized)
|
||||
{
|
||||
if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '?'))
|
||||
e.preventDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.' js=1}');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("select#entity").change(function(){
|
||||
if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8)
|
||||
$("label[for=truncate],#truncate").hide();
|
||||
else
|
||||
$("label[for=truncate],#truncate").show();
|
||||
|
||||
if ($("#entity > option:selected").val() == 8)
|
||||
{
|
||||
$(".import_supply_orders_details").show();
|
||||
$('input[name=multiple_value_separator]').val('|');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(".import_supply_orders_details").hide();
|
||||
$('input[name=multiple_value_separator]').val('{if isset($multiple_value_separator_selected)}{$multiple_value_separator_selected}{else},{/if}');
|
||||
}
|
||||
if ($("#entity > option:selected").val() == 1)
|
||||
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").show();
|
||||
else
|
||||
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").hide();
|
||||
if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0)
|
||||
$(".import_products_categories, label[for=regenerate], #regenerate").show();
|
||||
else
|
||||
$(".import_products_categories, label[for=regenerate], #regenerate").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',
|
||||
data: {
|
||||
getAvailableFields:1,
|
||||
entity: $("#entity").val()
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(j){
|
||||
var fields = "";
|
||||
$("#availableFields").empty();
|
||||
|
||||
for (var i = 0; i < j.length; i++)
|
||||
fields += j[i].field;
|
||||
|
||||
$("#availableFields").html(fields);
|
||||
activeClueTip();
|
||||
},
|
||||
error: function(j){}
|
||||
});
|
||||
});
|
||||
$("select#entity").trigger('change');
|
||||
function activeClueTip()
|
||||
{
|
||||
$('.info_import').cluetip({
|
||||
splitTitle: '|',
|
||||
showTitle: false
|
||||
});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
@@ -22,20 +22,52 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helpers/view/view.tpl"}
|
||||
|
||||
{block name="override_tpl"}
|
||||
<script type="text/javascript">
|
||||
var errorEmpty = "{l s='Please name your matching configuration to save.'}"
|
||||
var errorEmpty = '{l s='Please name your matching configuration to save.' js=1}';
|
||||
var token = '{$token}';
|
||||
var current = 0;
|
||||
function showTable(nb)
|
||||
{
|
||||
$('#btn_left').disabled = null;
|
||||
$('#btn_right').disabled = null;
|
||||
if (nb <= 0)
|
||||
{
|
||||
nb = 0;
|
||||
$('#btn_left').disabled = 'true';
|
||||
}
|
||||
if (nb >= {$nb_table} - 1)
|
||||
{
|
||||
nb = {$nb_table} - 1;
|
||||
$('#btn_right').disabled = 'true';
|
||||
}
|
||||
$('#table' + current).hide();
|
||||
current = nb;
|
||||
$('#table' + current).show();
|
||||
}
|
||||
$(document).ready(function(){
|
||||
var btn_save_import = $('span[class~="process-icon-save-import"]').parent();
|
||||
var btn_submit_import = $('#import');
|
||||
if (btn_save_import.length > 0 && btn_submit_import.length > 0)
|
||||
{
|
||||
btn_submit_import.hide();
|
||||
btn_save_import.find('span').removeClass('process-icon-save-import');
|
||||
btn_save_import.find('span').addClass('process-icon-save');
|
||||
btn_save_import.click(function(){
|
||||
btn_submit_import.before('<input type="hidden" name="' + btn_submit_import.attr("name") + '" value="1" />');
|
||||
$('#import_form').submit();
|
||||
});
|
||||
}
|
||||
showTable(current);
|
||||
});
|
||||
</script>
|
||||
<div id="container-customer">
|
||||
<h2>{l s='View your data'}</h2>
|
||||
<div>
|
||||
<b>{l s='Save and load your configuration for importing files'} : </b><br><br>
|
||||
<input type="text" name="newImportMatchs" id="newImportMatchs">
|
||||
<a id="saveImportMatchs" class="button" href="#">{l s='Save'}</a><br><br>
|
||||
<b>{l s='Save and load your configuration for importing files'} : </b><br/><br/>
|
||||
<input type="text" name="newImportMatchs" id="newImportMatchs" />
|
||||
<a id="saveImportMatchs" class="button" href="#">{l s='Save'}</a><br /><br />
|
||||
<div id="selectDivImportMatchs" {if !$import_matchs}style="display:none"{/if}>
|
||||
<select id="valueImportMatchs">
|
||||
{foreach $import_matchs as $match}
|
||||
@@ -46,21 +78,18 @@
|
||||
<a class="button" id="deleteImportMatchs" href="#">{l s='Delete'}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>{l s='Please set the value type of each column'}</h3>
|
||||
|
||||
<div id="error_duplicate_type" class="warning warn" style="display:none;">
|
||||
<h3>{l s='Columns cannot have the same value type'}</h3>
|
||||
</div>
|
||||
|
||||
<div id="required_column" class="warning warn" style="display:none;">
|
||||
<h3>{l s='Column'} <span id="missing_column"> </span> {l s='must be set'}</h3>
|
||||
</div>
|
||||
|
||||
<form action="{$current}&token={$token}" method="post" id="import_form" name="import_form">
|
||||
{l s='Skip'} <input type="text" size="2" name="skip" value="1" /> {l s='lines'}
|
||||
<input type="hidden" name="csv" value="{$fields_value.csv}" />
|
||||
<input type="hidden" name="convert" value="{$fields_value.convert}" />
|
||||
<input type="hidden" name="regenerate" value="{$fields_value.regenerate}" />
|
||||
<input type="hidden" name="entity" value="{$fields_value.entity}" />
|
||||
<input type="hidden" name="iso_lang" value="{$fields_value.iso_lang}" />
|
||||
{if $fields_value.truncate}
|
||||
@@ -72,49 +101,8 @@
|
||||
{if $fields_value.match_ref}
|
||||
<input type="hidden" name="match_ref" value="1" />
|
||||
{/if}
|
||||
<input type="hidden" name="separator" value="{$fields_value.separator}">
|
||||
<input type="hidden" name="multiple_value_separator" value="{$fields_value.multiple_value_separator}">
|
||||
<script type="text/javascript">
|
||||
var current = 0;
|
||||
|
||||
function showTable(nb)
|
||||
{
|
||||
getE('btn_left').disabled = null;
|
||||
getE('btn_right').disabled = null;
|
||||
if (nb <= 0)
|
||||
{
|
||||
nb = 0;
|
||||
getE('btn_left').disabled = 'true';
|
||||
}
|
||||
if (nb >= {$nb_table} - 1)
|
||||
{
|
||||
nb = {$nb_table} - 1;
|
||||
getE('btn_right').disabled = 'true';
|
||||
}
|
||||
toggle(getE('table'+current), false);
|
||||
current = nb;
|
||||
toggle(getE('table'+current), true);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var btn_save_import = $('span[class~="process-icon-save-import"]').parent();
|
||||
var btn_submit_import = $('#import');
|
||||
|
||||
if (btn_save_import.length > 0 && btn_submit_import.length > 0)
|
||||
{
|
||||
btn_submit_import.hide();
|
||||
btn_save_import.find('span').removeClass('process-icon-save-import');
|
||||
btn_save_import.find('span').addClass('process-icon-save');
|
||||
btn_save_import.click(function() {
|
||||
btn_submit_import.before('<input type="hidden" name="'+btn_submit_import.attr("name")+'" value="1" />');
|
||||
|
||||
$('#import_form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<input type="hidden" name="separator" value="{$fields_value.separator}" />
|
||||
<input type="hidden" name="multiple_value_separator" value="{$fields_value.multiple_value_separator}" />
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
@@ -123,7 +111,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="center">
|
||||
<input id="btn_left" value="{l s='<<'}" type="button" class="button" onclick="showTable(current - 1)" />
|
||||
<input id="btn_left" value="{l s='<<'}" type="button" class="button" onclick="showTable(current - 1);" />
|
||||
</td>
|
||||
<td align="left">
|
||||
{section name=nb_i start=0 loop=$nb_table step=1}
|
||||
@@ -132,12 +120,10 @@
|
||||
{/section}
|
||||
</td>
|
||||
<td valign="top" align="center">
|
||||
<input id="btn_right" value="{l s='>>'}" type="button" class="button" onclick="showTable(current + 1)" />
|
||||
<input id="btn_right" value="{l s='>>'}" type="button" class="button" onclick="showTable(current + 1);" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">showTable(current);</script>
|
||||
</form>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
*}
|
||||
|
||||
<div class="width4">
|
||||
{$localization_form}
|
||||
{if isset($localization_form)}{$localization_form}{/if}
|
||||
</div>
|
||||
<br />
|
||||
<div class="width4">
|
||||
{$localization_options}
|
||||
{if isset($localization_options)}{$localization_options}{/if}
|
||||
</div>
|
||||
@@ -77,7 +77,7 @@
|
||||
</dl>
|
||||
</div>
|
||||
<p class="desc">{if isset($module->description) && $module->description ne ''}{l s='Description'} : {$module->description}{else} {/if}</p>
|
||||
{if isset($module->message) && (!isset($module->type) || ($module->type != 'addonsMustHave' || $module->type !== 'addonsNative'))}<div class="conf">{$module->message}</div>{/if}
|
||||
{if isset($module->message) && (empty($module->name) === false) && (!isset($module->type) || ($module->type != 'addonsMustHave' || $module->type !== 'addonsNative'))}<div class="conf">{$module->message}</div>{/if}
|
||||
<div class="row-actions-module">
|
||||
{if !isset($module->not_on_disk)}
|
||||
{$module->optionsHtml}
|
||||
@@ -101,7 +101,7 @@
|
||||
<a href="{$module->addons_buy_url}" target="_blank" class="button updated"><span><img src="../img/admin/cart_addons.png"> {if isset($module->id_currency) && isset($module->price)}{displayPrice price=$module->price currency=$module->id_currency}{/if}</span></a>
|
||||
</li>
|
||||
{else}
|
||||
{if $module->id && isset($module->version_addons) && $module->version_addons}
|
||||
{if isset($module->version_addons) && $module->version_addons}
|
||||
<li><a href="{$module->options.update_url}" class="button updated"><span>{l s='Update it!'}</span></a></li>
|
||||
{/if}
|
||||
<li>
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
{/if}
|
||||
</td>
|
||||
<td align="center" class="productQuantity">{$product['customizationQuantityTotal']}</td>
|
||||
{if $display_warehouse}<td style="" align="center"> </td>{/if}
|
||||
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['customizationQuantityRefunded']}</td>{/if}
|
||||
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}<td align="center" class="productQuantity">{$product['customizationQuantityReturned']}</td>{/if}
|
||||
{if $stock_management}<td align="center" class=""> - </td>{/if}
|
||||
@@ -103,6 +104,7 @@
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
{if $display_warehouse}<td style="" align="center"> </td>{/if}
|
||||
{if ($order->hasBeenPaid())}<td align="center">{$customization['quantity_refunded']}</td>{/if}
|
||||
{if ($order->hasBeenDelivered())}<td align="center">{$customization['quantity_returned']}</td>{/if}
|
||||
<td align="center">
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
</td>
|
||||
<td style="display:none;" align="center" class="productQuantity"><input type="text" name="add_product[product_quantity]" id="add_product_product_quantity" value="1" size="3" disabled="disabled" /></td>
|
||||
{if ($order->hasBeenPaid())}<td style="display:none;" align="center" class="productQuantity"> </td>{/if}
|
||||
{if $display_warehouse}<td style="" align="center"> </td>{/if}
|
||||
{if ($order->hasBeenDelivered())}<td style="display:none;" align="center" class="productQuantity"> </td>{/if}
|
||||
<td style="display:none;" align="center" class="productQuantity" id="add_product_product_stock">0</td>
|
||||
<td style="display:none;" align="center" id="add_product_product_total">{displayPrice price=0 currency=$currency->id}</td>
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
{if $display_warehouse}<td>{$product.warehouse_name|escape:'htmlall':'UTF-8'}</td>{/if}
|
||||
{if ($order->hasBeenPaid())}
|
||||
<td align="center" class="productQuantity">
|
||||
{$product['product_quantity_refunded']}
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
var defaults_order_state = new Array();
|
||||
var customization_errors = false;
|
||||
var pic_dir = '{$pic_dir}';
|
||||
var currency_format = 5;
|
||||
var currency_sign = '';
|
||||
var currency_blank = false;
|
||||
var priceDisplayPrecision = 2;
|
||||
|
||||
{foreach from=$defaults_order_state key='module' item='id_order_state'}
|
||||
defaults_order_state['{$module}'] = '{$id_order_state}';
|
||||
{/foreach}
|
||||
@@ -117,7 +122,7 @@
|
||||
$('#vouchers_err').hide();
|
||||
var mytab = new Array();
|
||||
for (var i = 0; i < data.vouchers.length; i++)
|
||||
mytab[mytab.length] = { data: data.vouchers[i], value: data.vouchers[i].name+' - '+data.vouchers[i].description };
|
||||
mytab[mytab.length] = { data: data.vouchers[i], value: data.vouchers[i].name + (data.vouchers[i].code.length > 0 ? ' - ' + data.vouchers[i].code : '')};
|
||||
return mytab;
|
||||
},
|
||||
extraParams: {
|
||||
@@ -505,7 +510,6 @@
|
||||
}
|
||||
displaySummary(res);
|
||||
resetBind();
|
||||
updateCurrencySign();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -652,11 +656,12 @@
|
||||
var id_product = Number(this.id_product);
|
||||
var id_product_attribute = Number(this.id_product_attribute);
|
||||
cart_quantity[Number(this.id_product)+'_'+Number(this.id_product_attribute)+'_'+Number(this.id_customization)] = this.cart_quantity;
|
||||
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" size="7" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="'+this.price+'" /> <span class="currency_sign"></span></td><td>';
|
||||
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" size="7" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="' + formatCurrency(parseFloat(this.price.replace(',', '.')), currency_format, currency_sign, currency_blank) + '" /></td><td>';
|
||||
cart_content += (!this.id_customization ? '<div style="float:left;"><a href="#" class="increaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><img src="../img/admin/up.gif" /></a><br /><a href="#" class="decreaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'"><img src="../img/admin/down.gif" /></a></div>' : '');
|
||||
cart_content += (!this.id_customization ? '<div style="float:left;"><input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" class="cart_quantity" size="2" value="'+this.cart_quantity+'" />' : '');
|
||||
cart_content += (!this.id_customization ? '<a href="#" class="delete_product" rel="delete_'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><img src="../img/admin/delete.gif" /></a></div>' : '');
|
||||
cart_content += '</td><td>'+this.total+' <span class="currency_sign"></span></td></tr>';
|
||||
cart_content += '</td><td>' + formatCurrency(parseFloat(this.total.replace(',', '.')), currency_format, currency_sign, currency_blank) + '</td></tr>';
|
||||
|
||||
if (this.id_customization && this.id_customization != 0)
|
||||
{
|
||||
$.each(this.customized_datas[this.id_product][this.id_product_attribute][id_address_delivery], function() {
|
||||
@@ -694,17 +699,15 @@
|
||||
function updateCartVouchers(vouchers)
|
||||
{
|
||||
var vouchers_html = '';
|
||||
if (vouchers.length > 0)
|
||||
{
|
||||
$.each(vouchers, function() {
|
||||
if (typeof(vouchers) == 'object')
|
||||
$.each(vouchers, function(){
|
||||
vouchers_html += '<tr><td>'+this.name+'</td><td>'+this.description+'</td><td>'+this.value_real+'</td><td><a href="#" class="delete_discount" rel="'+this.id_discount+'"><img src="../img/admin/delete.gif" /></a></td></tr>';
|
||||
});
|
||||
$('#voucher_list').show();
|
||||
}
|
||||
else
|
||||
$('#voucher_list tbody').html($.trim(vouchers_html));
|
||||
if ($('#voucher_list tbody').html().length == 0)
|
||||
$('#voucher_list').hide();
|
||||
|
||||
$('#voucher_list tbody').html(vouchers_html);
|
||||
else
|
||||
$('#voucher_list').show();
|
||||
}
|
||||
|
||||
function updateCartPaymentList(payment_list)
|
||||
@@ -714,6 +717,11 @@
|
||||
|
||||
function displaySummary(jsonSummary)
|
||||
{
|
||||
currency_format = jsonSummary.currency.format;
|
||||
currency_sign = jsonSummary.currency.sign;
|
||||
currency_blank = jsonSummary.currency.blank;
|
||||
priceDisplayPrecision = jsonSummary.currency.decimals ? 2 : 0;
|
||||
|
||||
updateCartProducts(jsonSummary.summary.products, jsonSummary.summary.gift_products, jsonSummary.cart.id_address_delivery);
|
||||
updateCartVouchers(jsonSummary.summary.discounts);
|
||||
updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice);
|
||||
@@ -739,20 +747,19 @@
|
||||
$('#free_shipping').removeAttr('checked');
|
||||
|
||||
$('#gift_message').html(jsonSummary.cart.gift_message);
|
||||
if(!changed_shipping_price)
|
||||
$('#shipping_price').html('<b>'+jsonSummary.summary.total_shipping+'</b>');
|
||||
if (!changed_shipping_price)
|
||||
$('#shipping_price').html('<b>' + formatCurrency(parseFloat(jsonSummary.summary.total_shipping), currency_format, currency_sign, currency_blank) + '</b>');
|
||||
shipping_price_selected_carrier = jsonSummary.summary.total_shipping;
|
||||
|
||||
$('#total_vouchers').html(jsonSummary.summary.total_discounts_tax_exc);
|
||||
$('#total_shipping').html(jsonSummary.summary.total_shipping_tax_exc);
|
||||
$('#total_taxes').html(jsonSummary.summary.total_tax);
|
||||
$('#total_without_taxes').html(jsonSummary.summary.total_price_without_tax);
|
||||
$('#total_with_taxes').html(jsonSummary.summary.total_price);
|
||||
$('#total_products').html(jsonSummary.summary.total_products);
|
||||
|
||||
$('#total_vouchers').html(formatCurrency(parseFloat(jsonSummary.summary.total_discounts_tax_exc.replace(',', '.')), currency_format, currency_sign, currency_blank));
|
||||
$('#total_shipping').html(formatCurrency(parseFloat(jsonSummary.summary.total_shipping_tax_exc.replace(',', '.')), currency_format, currency_sign, currency_blank));
|
||||
$('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax.replace(',', '.')), currency_format, currency_sign, currency_blank));
|
||||
$('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price_without_tax.replace(',', '.')), currency_format, currency_sign, currency_blank));
|
||||
$('#total_with_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price.replace(',', '.')), currency_format, currency_sign, currency_blank));
|
||||
$('#total_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_products.replace(',', '.')), currency_format, currency_sign, currency_blank));
|
||||
id_currency = jsonSummary.cart.id_currency;
|
||||
$('#id_currency option').removeAttr('selected');
|
||||
$('#id_currency option[value="'+id_currency+'"]').attr('selected', true);
|
||||
updateCurrencySign();
|
||||
id_lang = jsonSummary.cart.id_lang;
|
||||
$('#id_lang option').removeAttr('selected');
|
||||
$('#id_lang option[value="'+id_lang+'"]').attr('selected', true);
|
||||
@@ -780,21 +787,21 @@
|
||||
qty: qty,
|
||||
id_customer: id_customer,
|
||||
id_cart: id_cart,
|
||||
},
|
||||
},
|
||||
success : function(res)
|
||||
{
|
||||
displaySummary(res);
|
||||
var errors = '';
|
||||
if(res.errors.length)
|
||||
{
|
||||
$.each(res.errors, function() {
|
||||
errors += this+'<br />';
|
||||
});
|
||||
$('#products_err').show();
|
||||
}
|
||||
else
|
||||
$('#products_err').hide();
|
||||
$('#products_err').html(errors);
|
||||
displaySummary(res);
|
||||
var errors = '';
|
||||
if (res.errors.length)
|
||||
{
|
||||
$.each(res.errors, function() {
|
||||
errors += this + '<br />';
|
||||
});
|
||||
$('#products_err').show();
|
||||
}
|
||||
else
|
||||
$('#products_err').hide();
|
||||
$('#products_err').html(errors);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -890,11 +897,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
function updateCurrencySign()
|
||||
{
|
||||
$('.currency_sign').html(currencies[id_currency]);
|
||||
}
|
||||
|
||||
function sendMailToCustomer()
|
||||
{
|
||||
$.ajax({
|
||||
@@ -986,7 +988,7 @@
|
||||
<label>{l s='Search customers'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="customer" value="" />
|
||||
<p>{l s='Search a customer by tapping the first letters of his/her name'}</p>
|
||||
<p>{l s='Search a customer by typing the first letters of his/her name'}</p>
|
||||
<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>
|
||||
@@ -1001,7 +1003,7 @@
|
||||
<div class="margin-form">
|
||||
<input type="hidden" value="" id="id_cart" name="id_cart" />
|
||||
<input type="text" id="product" value="" />
|
||||
<p>{l s='Search a product by tapping the first letters of his/her name.'}</p>
|
||||
<p>{l s='Search a product by typing the first letters of his/her name.'}</p>
|
||||
</div>
|
||||
<div id="products_found">
|
||||
<div id="product_list">
|
||||
@@ -1186,7 +1188,7 @@
|
||||
</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>
|
||||
<label for="shipping_price">{l s='Shipping price'}</label> <span id="shipping_price" name="shipping_price"></span>
|
||||
</p>
|
||||
<p>
|
||||
<label for="free_shipping">{l s='Free shipping'}</label>
|
||||
@@ -1210,12 +1212,12 @@
|
||||
<div id="send_email_feedback"></div>
|
||||
<div id="cart_summary" style="clear:both;float:left;">
|
||||
<ul>
|
||||
<li><span class="total_cart">{l s='Total products'}</span><span id="total_products"></span><span class="currency_sign"></span></li>
|
||||
<li><span class="total_cart">{l s='Total vouchers'}</span><span id="total_vouchers"></span><span class="currency_sign"></span></li>
|
||||
<li><span class="total_cart">{l s='Total shipping'}</span><span id="total_shipping"></span><span class="currency_sign"></span></li>
|
||||
<li><span class="total_cart">{l s='Total taxes'}</span><span id="total_taxes"></span><span class="currency_sign"></span></li>
|
||||
<li><span class="total_cart">{l s='Total without taxes'}</span><span id="total_without_taxes"></span><span class="currency_sign"></span></li>
|
||||
<li><span class="total_cart">{l s='Total with taxes'}</span><span id="total_with_taxes"></span><span class="currency_sign"></span></li>
|
||||
<li><span class="total_cart">{l s='Total products'}</span><span id="total_products"></span></li>
|
||||
<li><span class="total_cart">{l s='Total vouchers'}</span><span id="total_vouchers"></span></li>
|
||||
<li><span class="total_cart">{l s='Total shipping'}</span><span id="total_shipping"></span></li>
|
||||
<li><span class="total_cart">{l s='Total taxes'}</span><span id="total_taxes"></span></li>
|
||||
<li><span class="total_cart">{l s='Total without taxes'}</span><span id="total_without_taxes"></span></li>
|
||||
<li><span class="total_cart">{l s='Total with taxes'}</span><span id="total_with_taxes"></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="order_message_right">
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
<br />
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/tab-customers.gif" /> {l s='Customer information'}</legend>
|
||||
<span style="font-weight: bold; font-size: 14px;"><a href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={getAdminToken tab='AdminCustomers'}"> {$customer->firstname} {$customer->lastname}</a></span> ({l s='#'}{$customer->id})<br />
|
||||
<span style="font-weight: bold; font-size: 14px;"><a href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={getAdminToken tab='AdminCustomers'}"> {$gender->name|escape:'htmlall':'UTF-8'} {$customer->firstname} {$customer->lastname}</a></span> ({l s='#'}{$customer->id})<br />
|
||||
(<a href="mailto:{$customer->email}">{$customer->email}</a>)<br /><br />
|
||||
{if ($customer->isGuest())}
|
||||
{l s='This order has been placed by a guest.'}
|
||||
@@ -592,6 +592,7 @@
|
||||
<th>{l s='Product'}</th>
|
||||
<th style="width: 15%; text-align: center">{l s='Unit Price'} <sup>*</sup></th>
|
||||
<th style="width: 4%; text-align: center">{l s='Qty'}</th>
|
||||
{if $display_warehouse}<th style="text-align: center">{l s='Warehouse'}</th>{/if}
|
||||
{if ($order->hasBeenPaid())}<th style="width: 3%; text-align: center">{l s='Refunded'}</th>{/if}
|
||||
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}<th style="width: 3%; text-align: center">{l s='Returned'}</th>{/if}
|
||||
{if $stock_management}<th style="width: 10%; text-align: center">{l s='Available quantity'}</th>{/if}
|
||||
|
||||
@@ -31,6 +31,14 @@
|
||||
{if isset($modules_list)}
|
||||
{$modules_list}
|
||||
{/if}
|
||||
<div class="space info">
|
||||
{l s='This is where you decide what payment modules are available for different variations like your customers\' currency, group, and country.'}
|
||||
<br />
|
||||
{l s='A check mark indicates you want the payment module available.'}
|
||||
{l s='If it is not checked then this means that the Payment module is disabled.'}
|
||||
<br />
|
||||
{l s='Please make sure to click Save for each section.'}
|
||||
</div>
|
||||
{if $display_restrictions}
|
||||
<br /><h2 class="space">{l s='Payment module restrictions'}</h2>
|
||||
{foreach $lists as $list}
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
</div>
|
||||
{/if}
|
||||
{$smarty.block.parent}
|
||||
{if $input.type == 'radio' && $input.name == 'smarty_cache'}
|
||||
<a href="{$current}&token={$token}&empty_smarty_cache=1" class="clear button" href="">{l s='Clear Smarty cache & Autoload cache'}</a>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="description"}
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
</tr>
|
||||
<tr class="redirect_product_options" style="display:none">
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="redirect_type" type="radio" onclick=""}
|
||||
<label class="text">{l s='Redirect:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
@@ -184,7 +184,7 @@
|
||||
</tr>
|
||||
<tr class="redirect_product_options redirect_product_options_product_choise" style="display:none">
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="id_product_redirected" type="radio" onclick=""}
|
||||
<label class="text">{l s='Related product:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
|
||||
@@ -178,7 +178,7 @@ $(document).ready(function () {
|
||||
</tr>
|
||||
<tr {if !$ps_use_ecotax} style="display:none;"{/if}>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="ecot" type="default"}
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="ecotax" type="default"}
|
||||
<label>{l s='Eco-tax (tax incl.):'}</label>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<p>{l s='Click "Save and Stay" after changing selected suppliers to display the associated product references.'}</p>
|
||||
<div id="suppliers_accordion" style="margin-top:10px; display:block;">
|
||||
{foreach from=$associated_suppliers item=supplier}
|
||||
<h3 style="margin-bottom:0;"><a href="#">{$supplier->name}</a></h3>
|
||||
<h3 style="margin-bottom:0;"><a href="#">{if isset($supplier->name)}{$supplier->name}{/if}</a></h3>
|
||||
<div style="display:block;">
|
||||
|
||||
<table cellpadding="10" cellspacing="0" class="table">
|
||||
|
||||
+9
-2
@@ -41,7 +41,7 @@
|
||||
<div class="margin-form">
|
||||
<select id="id_category" name="id_category">
|
||||
{foreach from=$categories item='category'}
|
||||
<option value="{$category.id_category}">{$category.name}</option>
|
||||
<option value="{$category.id_category|intval}">({$category.id_category|intval}) {$category.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<a class="button bt-icon" href="#" id="add_condition_category">
|
||||
@@ -161,6 +161,13 @@ function add_condition(id_condition_group, type, value)
|
||||
function delete_condition(condition)
|
||||
{
|
||||
delete conditions[condition];
|
||||
|
||||
to_delete = $('#'+condition).prev();
|
||||
if ($(to_delete).children().hasClass('btn_delete_condition'))
|
||||
$(to_delete).remove();
|
||||
else
|
||||
$('#'+condition).next().remove();
|
||||
|
||||
$('#'+condition).remove();
|
||||
return false;
|
||||
}
|
||||
@@ -178,7 +185,7 @@ function new_condition_group()
|
||||
function appendConditionToGroup(html)
|
||||
{
|
||||
if ($('#condition_group_'+current_id_condition_group+' table tbody tr').length > 0)
|
||||
$('#condition_group_'+current_id_condition_group+' table tbody').append('<tr><td align="center" colspan="3"><b>{l s='AND' js=1}</b></td></tr>');
|
||||
$('#condition_group_'+current_id_condition_group+' table tbody').append('<tr><td align="center" class="btn_delete_condition" colspan="3"><b>{l s='AND' js=1}</b></td></tr>');
|
||||
$('#condition_group_'+current_id_condition_group+' table tbody').append(html);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
function ajaxStoreStates(id_state_selected)
|
||||
{
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
url: "index.php",
|
||||
cache: false,
|
||||
data: "ajaxStates=1&id_country="+$('#PS_SHOP_COUNTRY_ID').val() + "&id_state=" + $('#PS_SHOP_STATE_ID').val(),
|
||||
data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+$('#PS_SHOP_COUNTRY_ID').val() + "&id_state=" + $('#PS_SHOP_STATE_ID').val(),
|
||||
success: function(html)
|
||||
{
|
||||
if (html == 'false')
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ $(document).ready(function() {
|
||||
</div>
|
||||
|
||||
<div class="margin-form">
|
||||
<input type="submit" id="_form_submit_btn" value="{l s='Save'}" name="submitChangestate" class="button" style="display: none;">
|
||||
<input type="submit" id="{$table}_form_submit_btn" value="{l s='Save'}" name="submitChangestate" class="button" style="display: none;">
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
$("#states-label").hide();
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
url: "index.php",
|
||||
cache: false,
|
||||
data: "ajaxStates=1&id_country="+id_country+"&id_state="+id_state+"&empty_value={l s='All'}",
|
||||
data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+id_country+"&id_state="+id_state+"&empty_value={l s='All'}",
|
||||
success: function(html){
|
||||
if (html == "false")
|
||||
{
|
||||
@@ -88,10 +88,10 @@
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php',
|
||||
url: 'index.php',
|
||||
async: true,
|
||||
dataType: 'json',
|
||||
data: 'ajaxStates=1&ajaxUpdateTaxRule=1&id_tax_rule='+id_tax_rule,
|
||||
data: 'ajax=1&tab=AdminTaxRulesGroup&token={getAdminToken tab='AdminTaxRulesGroup'}&ajaxStates=1&action=updateTaxRule&id_tax_rule='+id_tax_rule,
|
||||
success: function(data){
|
||||
$('#tax_rule_form').show();
|
||||
$('#id_tax_rule').val(data.id);
|
||||
|
||||
+9
-9
@@ -33,22 +33,22 @@
|
||||
{/if}
|
||||
|
||||
<form method="post" action="{$currentIndex}&{$identifier}&token={$token}&id_tax_rules_group={$id_tax_rules_group}&updatetax_rules_group#{$table}" class="form">
|
||||
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
|
||||
<input type="hidden" id="submitFilter{$list_id}" name="submitFilter{$list_id}" value="0"/>
|
||||
<table class="table_grid">
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;">
|
||||
<span style="float: left;">
|
||||
{if $page > 1}
|
||||
<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}"/>
|
||||
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$list_id}').value=1"/>
|
||||
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$list_id}').value={$page - 1}"/>
|
||||
{/if}
|
||||
{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}"/>
|
||||
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$list_id}').value={$page + 1};"/>
|
||||
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$list_id}').value={$total_pages}"/>
|
||||
{/if}
|
||||
| {l s='Display'}
|
||||
<select name="pagination" onchange="submit()">
|
||||
<select name="{$list_id}_pagination" onchange="submit()">
|
||||
{* Choose number of results per page *}
|
||||
{foreach $pagination AS $value}
|
||||
<option value="{$value|intval}"{if $selected_pagination == $value} selected="selected" {elseif $selected_pagination == NULL && $value == $pagination[1]} selected="selected2"{/if}>{$value|intval}</option>
|
||||
@@ -57,7 +57,7 @@
|
||||
/ {$list_total} {l s='result(s)'}
|
||||
</span>
|
||||
<span style="float: right;">
|
||||
<input type="submit" name="submitReset{$table}" value="{l s='Reset'}" class="button" />
|
||||
<input type="submit" name="submitReset{$list_id}" value="{l s='Reset'}" class="button" />
|
||||
</span>
|
||||
<span class="clear"></span>
|
||||
</td>
|
||||
@@ -66,7 +66,7 @@
|
||||
<td>
|
||||
<table
|
||||
{if $table_id} id={$table_id}{/if}
|
||||
class="table {if $table_dnd}tableDnD{/if} {$table}"
|
||||
class="table {if $table_dnd}tableDnD{/if} {$list_id}"
|
||||
cellpadding="0" cellspacing="0"
|
||||
style="width: 100%; margin-bottom:10px;"
|
||||
>
|
||||
@@ -84,7 +84,7 @@
|
||||
<tr class="nodrag nodrop">
|
||||
<th class="center">
|
||||
{if $has_bulk_actions}
|
||||
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$table}Box[]', this.checked)" />
|
||||
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$list_id}Box[]', this.checked)" />
|
||||
{/if}
|
||||
</th>
|
||||
{foreach $fields_display AS $key => $params}
|
||||
|
||||
@@ -35,11 +35,12 @@
|
||||
</div>
|
||||
<div class="footerRight">
|
||||
{if $iso_is_fr}
|
||||
<span>Questions / Renseignements / Formations :</span> <strong>+33 (0)1.40.18.30.04</strong> de 09h à 18h
|
||||
<span>Questions / Renseignements / Formations :</span> <strong>+33 (0)1.40.18.30.04</strong>
|
||||
{/if}
|
||||
| <a href="http://www.prestashop.com/en/contact_us/" target="_blank" class="footer_link">{l s='Contact'}</a>
|
||||
| <a href="http://forge.prestashop.com" target="_blank" class="footer_link">{l s='Bug Tracker'}</a>
|
||||
| <a href="http://www.prestashop.com/forums/" target="_blank" class="footer_link">{l s='Forum'}</a>
|
||||
| <a href="http://www.prestashop.com/en/contact-us?utm_source=backoffice_footer" target="_blank" class="footer_link">{l s='Contact'}</a>
|
||||
| <a href="http://forge.prestashop.com/?utm_source=backoffice_footer" target="_blank" class="footer_link">{l s='Bug Tracker'}</a>
|
||||
| <a href="http://www.prestashop.com/forums/?utm_source=backoffice_footer" target="_blank" class="footer_link">{l s='Forum'}</a>
|
||||
| <a href="http://addons.prestashop.com/?utm_source=backoffice_footer" target="_blank" class="footer_link">{l s='Addons'}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
|
||||
{block name="defaultForm"}
|
||||
<form id="{if isset($fields.form.form.id_form)}{$fields.form.form.id_form|escape:'htmlall':'UTF-8'}{else}{$table}_form{/if}" class="defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}>
|
||||
<form id="{if isset($fields.form.form.id_form)}{$fields.form.form.id_form|escape:'htmlall':'UTF-8'}{else}{if $table == null}configuration_form{else}{$table}_form{/if}{/if}" class="defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}>
|
||||
{if $form_id}
|
||||
<input type="hidden" name="{$identifier}" id="{$identifier}" value="{$form_id}" />
|
||||
{/if}
|
||||
@@ -192,7 +192,7 @@
|
||||
{/if}
|
||||
{elseif $input.type == 'radio'}
|
||||
{foreach $input.values as $value}
|
||||
<input type="radio" name="{$input.name}"id="{$value.id}" value="{$value.value|escape:'htmlall':'UTF-8'}"
|
||||
<input type="radio" name="{$input.name}" id="{$value.id}" value="{$value.value|escape:'htmlall':'UTF-8'}"
|
||||
{if $fields_value[$input.name] == $value.value}checked="checked"{/if}
|
||||
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
|
||||
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}">
|
||||
@@ -432,7 +432,8 @@
|
||||
};
|
||||
{/foreach}
|
||||
// we need allowEmployeeFormLang var in ajax request
|
||||
allowEmployeeFormLang = {$allowEmployeeFormLang};
|
||||
allowEmployeeFormLang = {$allowEmployeeFormLang|intval};
|
||||
employee_token = '{getAdminToken tab='AdminEmployees'}';
|
||||
displayFlags(languages, id_language, allowEmployeeFormLang);
|
||||
|
||||
$(document).ready(function() {
|
||||
@@ -454,6 +455,7 @@
|
||||
});
|
||||
|
||||
});
|
||||
state_token = '{getAdminToken tab='AdminStates'}';
|
||||
{block name="script"}{/block}
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
{block name="defaultOptions"}
|
||||
<form action="{$current}&token={$token}"
|
||||
id="{$table}_form"
|
||||
id="{if $table == null}configuration_form{else}{$table}_form{/if}"
|
||||
{if isset($categoryData['name'])} name={$categoryData['name']}{/if}
|
||||
{if isset($categoryData['id'])} id={$categoryData['id']} {/if}
|
||||
method="post"
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{if $k == 'modules-list'}
|
||||
<div id="modules_list_container" style="display:none">
|
||||
<div style="float:right;margin:5px">
|
||||
<a href="#" onclick="$('#modules_list_container').slideUp();return false;"><img alt="X" src="../img/admin/close.png"></a>
|
||||
<a href="#" onclick="$('#modules_list_container').slideUp();return false;"><img alt="X" src="../img/admin/close.png" /></a>
|
||||
</div>
|
||||
<div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0" /></div>
|
||||
<div id="modules_list_container_tab" style="display:none;"></div>
|
||||
|
||||
@@ -1303,7 +1303,7 @@ abstract class AdminTabCore
|
||||
}
|
||||
|
||||
$asso = Shop::getAssoTable($this->table);
|
||||
if ($asso !== false && $assos['type'] == 'shop')
|
||||
if ($asso !== false && $asso['type'] == 'shop')
|
||||
{
|
||||
$filterKey = $asso['type'];
|
||||
$idenfierShop = Shop::getContextListShopID();
|
||||
|
||||
@@ -142,12 +142,15 @@ class AttributeGroupCore extends ObjectModel
|
||||
if (!AttributeGroup::cleanDeadCombinations())
|
||||
return false;
|
||||
/* Also delete related attributes */
|
||||
if (Db::getInstance()->execute('
|
||||
if (count($to_remove))
|
||||
if (!Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'attribute_lang`
|
||||
WHERE `id_attribute`
|
||||
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;
|
||||
WHERE `id_attribute` IN ('.implode(',', $to_remove).')') ||
|
||||
!Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'attribute_shop`
|
||||
WHERE `id_attribute` IN ('.implode(',', $to_remove).')') ||
|
||||
!Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id))
|
||||
return false;
|
||||
$this->cleanPositions();
|
||||
}
|
||||
$return = parent::delete();
|
||||
|
||||
+9
-13
@@ -54,6 +54,8 @@ class Autoload
|
||||
$this->root_dir = dirname(dirname(__FILE__)).'/';
|
||||
if (file_exists($this->root_dir.Autoload::INDEX_FILE))
|
||||
$this->index = include($this->root_dir.Autoload::INDEX_FILE);
|
||||
else
|
||||
$this->generateIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,9 +82,8 @@ class Autoload
|
||||
if (strpos(strtolower($classname), 'smarty_') === 0)
|
||||
return;
|
||||
|
||||
// regenerate the class index if the requested class is not found in the index or if the requested file doesn't exists
|
||||
if (!isset($this->index[$classname])
|
||||
|| ($this->index[$classname] && !is_file($this->root_dir.$this->index[$classname]))
|
||||
// regenerate the class index if the requested file doesn't exists
|
||||
if ((isset($this->index[$classname]) && $this->index[$classname] && !is_file($this->root_dir.$this->index[$classname]))
|
||||
|| (isset($this->index[$classname.'Core']) && $this->index[$classname.'Core'] && !is_file($this->root_dir.$this->index[$classname.'Core'])))
|
||||
$this->generateIndex();
|
||||
|
||||
@@ -138,18 +139,14 @@ class Autoload
|
||||
{
|
||||
$filename_tmp = tempnam(dirname($filename), basename($filename.'.'));
|
||||
if($filename_tmp !== FALSE and file_put_contents($filename_tmp, $content, LOCK_EX) !== FALSE)
|
||||
{
|
||||
rename($filename_tmp, $filename);
|
||||
@chmod($filename, 0664);
|
||||
{
|
||||
@rename($filename_tmp, $filename);
|
||||
@chmod($filename, 0666);
|
||||
}
|
||||
else
|
||||
{
|
||||
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated),
|
||||
// no need to die.
|
||||
else
|
||||
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die.
|
||||
error_log('Cannot write temporary file '.$filename_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
$this->index = $classes;
|
||||
}
|
||||
|
||||
@@ -192,4 +189,3 @@ class Autoload
|
||||
return isset($this->index[$classname]) ? $this->index[$classname] : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -775,11 +775,11 @@ class CarrierCore extends ObjectModel
|
||||
if ($delete)
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'delivery`
|
||||
WHERE id_shop = '.(int)$values['id_shop'].'
|
||||
AND id_shop_group='.(int)$values['id_shop_group'].'
|
||||
WHERE '.(is_null($values['id_shop']) ? 'ISNULL(`id_shop`) ' : 'id_shop = '.(int)$values['id_shop']).'
|
||||
AND '.(is_null($values['id_shop_group']) ? 'ISNULL(`id_shop`) ' : 'id_shop_group='.(int)$values['id_shop_group']).'
|
||||
AND id_carrier='.(int)$values['id_carrier'].
|
||||
($values['id_range_price'] !== null ? ' AND id_range_price='.(int)$values['id_range_price'] : '').
|
||||
($values['id_range_weight'] !== null ? ' AND id_range_weight='.(int)$values['id_range_weight'] : '').'
|
||||
($values['id_range_price'] !== null ? ' AND id_range_price='.(int)$values['id_range_price'] : ' AND (ISNULL(`id_range_price`) OR `id_range_price` = 0)').
|
||||
($values['id_range_weight'] !== null ? ' AND id_range_weight='.(int)$values['id_range_weight'] : ' AND (ISNULL(`id_range_weight`) OR `id_range_weight` = 0)').'
|
||||
AND id_zone='.(int)$values['id_zone']
|
||||
);
|
||||
|
||||
@@ -1291,7 +1291,7 @@ class CarrierCore extends ObjectModel
|
||||
{
|
||||
if ($delete)
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$this->id);
|
||||
if (!count($groups))
|
||||
if (!is_array($groups) || !count($groups))
|
||||
return true;
|
||||
$sql = 'INSERT INTO '._DB_PREFIX_.'carrier_group (id_carrier, id_group) VALUES ';
|
||||
foreach ($groups as $id_group)
|
||||
|
||||
+28
-14
@@ -340,6 +340,7 @@ class CartCore extends ObjectModel
|
||||
'.($filter == CartRule::FILTER_ACTION_SHIPPING ? 'AND free_shipping = 1' : '').'
|
||||
'.($filter == CartRule::FILTER_ACTION_GIFT ? 'AND gift_product != 0' : '').'
|
||||
'.($filter == CartRule::FILTER_ACTION_REDUCTION ? 'AND (reduction_percent != 0 OR reduction_amount != 0)' : '')
|
||||
.' ORDER by cr.priority ASC'
|
||||
);
|
||||
Cache::store($cache_key, $result);
|
||||
}
|
||||
@@ -429,7 +430,7 @@ class CartCore extends ObjectModel
|
||||
product_shop.`available_for_order`, product_shop.`price`, product_shop.`active`, product_shop.`unity`, product_shop.`unit_price_ratio`,
|
||||
stock.`quantity` AS quantity_available, p.`width`, p.`height`, p.`depth`, stock.`out_of_stock`, p.`weight`,
|
||||
p.`date_add`, p.`date_upd`, IFNULL(stock.quantity, 0) as quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category,
|
||||
CONCAT(cp.`id_product`, IFNULL(cp.`id_product_attribute`, 0), IFNULL(cp.`id_address_delivery`, 0)) AS unique_id, cp.id_address_delivery,
|
||||
CONCAT(LPAD(cp.`id_product`, 10, 0), LPAD(IFNULL(cp.`id_product_attribute`, 0), 10, 0), IFNULL(cp.`id_address_delivery`, 0)) AS unique_id, cp.id_address_delivery,
|
||||
product_shop.`wholesale_price`, product_shop.advanced_stock_management, ps.product_supplier_reference supplier_reference');
|
||||
|
||||
// Build FROM
|
||||
@@ -762,10 +763,11 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
// You can't add a cart rule that does not exist
|
||||
$cartRule = new CartRule($id_cart_rule, Context::getContext()->language->id);
|
||||
|
||||
if (!Validate::isLoadedObject($cartRule))
|
||||
return false;
|
||||
|
||||
if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$this->id))
|
||||
if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart_rule = '.(int)$id_cart_rule.' AND id_cart = '.(int)$this->id))
|
||||
return false;
|
||||
|
||||
// Add the cart rule to the cart
|
||||
@@ -1259,7 +1261,7 @@ class CartCore extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getTotalCart($id_cart, $use_tax_display = false, $type = CART::BOTH)
|
||||
public static function getTotalCart($id_cart, $use_tax_display = false, $type = Cart::BOTH)
|
||||
{
|
||||
$cart = new Cart($id_cart);
|
||||
if (!Validate::isLoadedObject($cart))
|
||||
@@ -1675,6 +1677,7 @@ class CartCore extends ObjectModel
|
||||
$warehouse_count_by_address[$product['id_address_delivery']][$warehouse['id_warehouse']]++;
|
||||
}
|
||||
}
|
||||
unset($product);
|
||||
|
||||
arsort($warehouse_count_by_address);
|
||||
|
||||
@@ -1692,9 +1695,12 @@ class CartCore extends ObjectModel
|
||||
$id_warehouse = 0;
|
||||
foreach ($warehouse_count_by_address[$product['id_address_delivery']] as $id_war => $val)
|
||||
{
|
||||
$product['carrier_list'] = array_merge($product['carrier_list'], Carrier::getAvailableCarrierList(new Product($product['id_product']), $id_war, $product['id_address_delivery'], null, $this));
|
||||
if (in_array((int)$id_war, $product['warehouse_list']) && $id_warehouse == 0)
|
||||
$id_warehouse = (int)$id_war;
|
||||
if (in_array((int)$id_war, $product['warehouse_list']))
|
||||
{
|
||||
$product['carrier_list'] = array_merge($product['carrier_list'], Carrier::getAvailableCarrierList(new Product($product['id_product']), $id_war, $product['id_address_delivery'], null, $this));
|
||||
if (!$id_warehouse)
|
||||
$id_warehouse = (int)$id_war;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($grouped_by_warehouse[$product['id_address_delivery']]['in_stock'][$id_warehouse]))
|
||||
@@ -1713,6 +1719,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
$grouped_by_warehouse[$product['id_address_delivery']][$key][$id_warehouse][] = $product;
|
||||
}
|
||||
unset($product);
|
||||
|
||||
// Step 3 : grouped product from grouped_by_warehouse by available carriers
|
||||
$grouped_by_carriers = array();
|
||||
@@ -1731,7 +1738,6 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
if (!isset($grouped_by_carriers[$id_address_delivery][$key][$id_warehouse]))
|
||||
$grouped_by_carriers[$id_address_delivery][$key][$id_warehouse] = array();
|
||||
|
||||
foreach ($product_list as $product)
|
||||
{
|
||||
$package_carriers_key = implode(',', $product['carrier_list']);
|
||||
@@ -1796,7 +1802,6 @@ class CartCore extends ObjectModel
|
||||
);
|
||||
$package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'] =
|
||||
array_intersect($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'], $data['carrier_list']);
|
||||
|
||||
$package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['product_list'] =
|
||||
array_merge($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['product_list'], $data['product_list']);
|
||||
|
||||
@@ -3415,6 +3420,7 @@ class CartCore extends ObjectModel
|
||||
*/
|
||||
public function setNoMultishipping()
|
||||
{
|
||||
$emptyCache = $result = false;
|
||||
if (Configuration::get('PS_ALLOW_MULTISHIPPING'))
|
||||
{
|
||||
// Upgrading quantities
|
||||
@@ -3433,7 +3439,9 @@ class CartCore extends ObjectModel
|
||||
AND `id_shop` = '.(int)$this->id_shop.'
|
||||
AND id_product = '.$product['id_product'].'
|
||||
AND id_product_attribute = '.$product['id_product_attribute'];
|
||||
Db::getInstance()->execute($sql);
|
||||
$result = Db::getInstance()->execute($sql);
|
||||
if ($result)
|
||||
$emptyCache = true;
|
||||
}
|
||||
|
||||
// Merging multiple lines
|
||||
@@ -3451,15 +3459,18 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
|
||||
// Update delivery address for each product line
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'cart_product`
|
||||
$sql = 'UPDATE `'._DB_PREFIX_.'cart_product`
|
||||
SET `id_address_delivery` = (
|
||||
SELECT `id_address_delivery` FROM `'._DB_PREFIX_.'cart`
|
||||
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 : ''));
|
||||
|
||||
'.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : '');
|
||||
|
||||
$result = Db::getInstance()->execute($sql);
|
||||
if ($result)
|
||||
$emptyCache = true;
|
||||
|
||||
if (Customization::isFeatureActive())
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'customization`
|
||||
@@ -3468,6 +3479,9 @@ class CartCore extends ObjectModel
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
)
|
||||
WHERE `id_cart` = '.(int)$this->id);
|
||||
|
||||
if ($emptyCache)
|
||||
$this->_products = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3656,4 +3670,4 @@ class CartCore extends ObjectModel
|
||||
return $addresses_instance_without_carriers;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -464,7 +464,7 @@ class CartRuleCore extends ObjectModel
|
||||
// Check if the products chosen by the customer are usable with the cart rule
|
||||
if ($this->product_restriction)
|
||||
{
|
||||
$r = $this->checkProductRestrictions($context, false, $display_error);
|
||||
$r = $this->checkProductRestrictions($context, false, $display_error, $alreadyInCart);
|
||||
if ($r !== false && $display_error)
|
||||
return $r;
|
||||
elseif (!$r && !$display_error)
|
||||
@@ -523,6 +523,7 @@ class CartRuleCore extends ObjectModel
|
||||
return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart');
|
||||
if ($otherCartRule['gift_product'])
|
||||
--$nb_products;
|
||||
|
||||
if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id)
|
||||
{
|
||||
$combinable = Db::getInstance()->getValue('
|
||||
@@ -550,7 +551,7 @@ class CartRuleCore extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function checkProductRestrictions(Context $context, $return_products = false, $display_error = true)
|
||||
protected function checkProductRestrictions(Context $context, $return_products = false, $display_error = true, $alreadyInCart = false)
|
||||
{
|
||||
$selectedProducts = array();
|
||||
|
||||
@@ -585,6 +586,8 @@ class CartRuleCore extends ObjectModel
|
||||
if (in_array($cartAttribute['id_attribute'], $productRule['values']))
|
||||
{
|
||||
$countMatchingProducts += $cartAttribute['quantity'];
|
||||
if ($alreadyInCart && $this->gift_product == $cartProduct['id_product']&& $this->gift_product_attribute == $cartProduct['id_product_attribute'])
|
||||
--$countMatchingProducts;
|
||||
$matchingProductsList[] = $cartAttribute['id_product'].'-'.$cartAttribute['id_product_attribute'];
|
||||
}
|
||||
if ($countMatchingProducts < $productRuleGroup['quantity'])
|
||||
@@ -603,6 +606,8 @@ class CartRuleCore extends ObjectModel
|
||||
if (in_array($cartProduct['id_product'], $productRule['values']))
|
||||
{
|
||||
$countMatchingProducts += $cartProduct['quantity'];
|
||||
if ($alreadyInCart && $this->gift_product == $cartProduct['id_product'])
|
||||
--$countMatchingProducts;
|
||||
$matchingProductsList[] = $cartProduct['id_product'].'-0';
|
||||
}
|
||||
if ($countMatchingProducts < $productRuleGroup['quantity'])
|
||||
@@ -1185,7 +1190,7 @@ class CartRuleCore extends ObjectModel
|
||||
SELECT cr.*, crl.*
|
||||
FROM '._DB_PREFIX_.'cart_rule cr
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_lang crl ON (cr.id_cart_rule = crl.id_cart_rule AND crl.id_lang = '.(int)$id_lang.')
|
||||
WHERE code LIKE \'%'.pSQL($name).'%\'
|
||||
WHERE code LIKE \'%'.pSQL($name).'%\' OR name LIKE \'%'.pSQL($name).'%\'
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ class CategoryCore extends ObjectModel
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
|
||||
// Lang fields
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64),
|
||||
'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 64),
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
|
||||
'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 128),
|
||||
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
|
||||
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
|
||||
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
|
||||
|
||||
@@ -135,6 +135,7 @@ class CombinationCore extends ObjectModel
|
||||
{
|
||||
$result = Db::getInstance()->delete('product_attribute_combination', '`id_product_attribute` = '.(int)$this->id);
|
||||
$result &= Db::getInstance()->delete('cart_product', '`id_product_attribute` = '.(int)$this->id);
|
||||
$result &= Db::getInstance()->delete('product_attribute_image', '`id_product_attribute` = '.(int)$this->id);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,8 @@ class ConfigurationTestCore
|
||||
'theme_cache_dir' => 'themes/'._THEME_NAME_.'/cache/',
|
||||
'translations_dir' => 'translations',
|
||||
'customizable_products_dir' => 'upload',
|
||||
'virtual_products_dir' => 'download'
|
||||
'virtual_products_dir' => 'download',
|
||||
'files' => false
|
||||
);
|
||||
}
|
||||
|
||||
@@ -318,4 +319,21 @@ class ConfigurationTestCore
|
||||
{
|
||||
return extension_loaded('Dom');
|
||||
}
|
||||
|
||||
public static function test_files()
|
||||
{
|
||||
$files = array(
|
||||
'/cache/smarty/compile/index.php',
|
||||
'/classes/log/index.php',
|
||||
'/classes/cache/index.php',
|
||||
'/config/index.php',
|
||||
'/tools/tar/Archive_Tar.php',
|
||||
'/tools/pear/PEAR.php',
|
||||
'/index.php'
|
||||
);
|
||||
foreach ($files as $file)
|
||||
if (!file_exists(rtrim(_PS_ROOT_DIR_, DIRECTORY_SEPARATOR).str_replace('/', DIRECTORY_SEPARATOR, $file)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class ConnectionCore extends ObjectModel
|
||||
'id_connections' => (int)$cookie->id_connections,
|
||||
'id_page' => (int)$id_page,
|
||||
'time_start' => $time_start
|
||||
));
|
||||
), false, true, Db::INSERT_IGNORE);
|
||||
|
||||
// This array is serialized and used by the ajax request to identify the page
|
||||
return array(
|
||||
@@ -114,7 +114,7 @@ class ConnectionCore extends ObjectModel
|
||||
// This is a bot and we have to retrieve its connection ID
|
||||
$sql = 'SELECT `id_connections` FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE ip_address = '.ip2long(Tools::getRemoteAddr()).'
|
||||
AND DATE_ADD(`date_add`, INTERVAL 30 MINUTE) > \''.pSQL(date('Y-m-d H:i:00')).'\'
|
||||
AND `date_add` > \''.pSQL(date('Y-m-d H:i:00', time() - 1800)).'\'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
ORDER BY `date_add` DESC';
|
||||
if ($id_connections = Db::getInstance()->getValue($sql))
|
||||
@@ -128,7 +128,7 @@ class ConnectionCore extends ObjectModel
|
||||
$sql = 'SELECT `id_guest`
|
||||
FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE `id_guest` = '.(int)$cookie->id_guest.'
|
||||
AND DATE_ADD(`date_add`, INTERVAL 30 MINUTE) > \''.pSQL(date('Y-m-d H:i:00')).'\'
|
||||
AND `date_add` > \''.pSQL(date('Y-m-d H:i:00', time() - 1800)).'\'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
ORDER BY `date_add` DESC';
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
|
||||
+23
-3
@@ -81,6 +81,7 @@ class CurrencyCore extends ObjectModel
|
||||
|
||||
/** @var array Currency cache */
|
||||
static protected $currencies = array();
|
||||
protected static $countActiveCurrencies = array();
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'currencies',
|
||||
@@ -187,8 +188,9 @@ class CurrencyCore extends ObjectModel
|
||||
4 => array('left' => '', 'right' => &$formated_strings['right']),
|
||||
5 => array('left' => '', 'right' => &$formated_strings['right'])
|
||||
);
|
||||
|
||||
return ($formats[$this->format][$side]);
|
||||
if (isset($formats[$this->format][$side]))
|
||||
return ($formats[$this->format][$side]);
|
||||
return $this->sign;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,5 +416,23 @@ class CurrencyCore extends ObjectModel
|
||||
self::$currencies[(int)($id)] = new Currency($id);
|
||||
return self::$currencies[(int)($id)];
|
||||
}
|
||||
}
|
||||
|
||||
public static function countActiveCurrencies($id_shop = null)
|
||||
{
|
||||
if ($id_shop === null)
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
|
||||
if (!isset(self::$countActiveCurrencies[$id_shop]))
|
||||
self::$countActiveCurrencies[$id_shop] = Db::getInstance()->getValue('
|
||||
SELECT COUNT(DISTINCT c.id_currency) FROM `'._DB_PREFIX_.'currency` c
|
||||
LEFT JOIN '._DB_PREFIX_.'currency_shop cs ON (cs.id_currency = c.id_currency AND cs.id_shop = '.(int)$id_shop.')
|
||||
WHERE c.`active` = 1
|
||||
');
|
||||
return self::$countActiveCurrencies[$id_shop];
|
||||
}
|
||||
|
||||
public static function isMultiCurrencyActivated($id_shop = null)
|
||||
{
|
||||
return (Currency::countActiveCurrencies($id_shop) > 1);
|
||||
}
|
||||
}
|
||||
@@ -369,7 +369,7 @@ class DispatcherCore
|
||||
|
||||
// If there are several languages, get language from uri
|
||||
if ($this->use_routes && Language::isMultiLanguageActivated())
|
||||
if (preg_match('#^/([a-z]{2})/#', $this->request_uri, $m))
|
||||
if (preg_match('#^/([a-z]{2})/?#', $this->request_uri, $m))
|
||||
{
|
||||
$_GET['isolang'] = $m[1];
|
||||
$this->request_uri = substr($this->request_uri, 3);
|
||||
@@ -549,6 +549,9 @@ class DispatcherCore
|
||||
if ($id_shop === null)
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
|
||||
if (!isset($this->routes[$id_shop]))
|
||||
$this->loadRoutes($id_shop);
|
||||
|
||||
if (!isset($this->routes[$id_shop]) || !isset($this->routes[$id_shop][$id_lang]) || !isset($this->routes[$id_shop][$id_lang][$route_id]))
|
||||
return false;
|
||||
|
||||
@@ -591,14 +594,14 @@ class DispatcherCore
|
||||
if ($id_shop === null)
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
|
||||
if ($this->use_routes && !isset($this->routes[$id_shop]))
|
||||
if (!isset($this->routes[$id_shop]))
|
||||
$this->loadRoutes($id_shop);
|
||||
|
||||
|
||||
if (!isset($this->routes[$id_shop][$id_lang][$route_id]))
|
||||
{
|
||||
$query = http_build_query($params, '', '&');
|
||||
$index_link = $this->use_routes ? '' : 'index.php';
|
||||
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : 'index.php?controller='.$route_id.(($query) ? '&'.$query : '').$anchor;
|
||||
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((trim($route_id) == '') ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor;
|
||||
}
|
||||
$route = $this->routes[$id_shop][$id_lang][$route_id];
|
||||
// Check required fields
|
||||
|
||||
@@ -248,8 +248,8 @@ class EmployeeCore extends ObjectModel
|
||||
{
|
||||
/* Employee is valid only if it can be load and if cookie password is the same as database one */
|
||||
Cache::store('isLoggedBack'.$this->id, (
|
||||
$this->id && Validate::isUnsignedId($this->id) && Employee::checkPassword($this->id, $this->passwd)
|
||||
&& (!isset($this->remote_addr) || $this->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
|
||||
$this->id && Validate::isUnsignedId($this->id) && Employee::checkPassword($this->id, Context::getContext()->cookie->passwd)
|
||||
&& (!isset(Context::getContext()->cookie->remote_addr) || Context::getContext()->cookie->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
|
||||
));
|
||||
}
|
||||
return Cache::retrieve('isLoggedBack'.$this->id);
|
||||
@@ -261,7 +261,10 @@ class EmployeeCore extends ObjectModel
|
||||
public function logout()
|
||||
{
|
||||
if (isset(Context::getContext()->cookie))
|
||||
{
|
||||
Context::getContext()->cookie->logout();
|
||||
Context::getContext()->cookie->write();
|
||||
}
|
||||
$this->id = null;
|
||||
}
|
||||
|
||||
|
||||
+34
-24
@@ -128,34 +128,44 @@ class FeatureValueCore extends ObjectModel
|
||||
return $tab['value'];
|
||||
}
|
||||
|
||||
public static function addFeatureValueImport($id_feature, $name)
|
||||
public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null)
|
||||
{
|
||||
$rq = Db::getInstance()->executeS('
|
||||
SELECT fv.`id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl
|
||||
ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
||||
WHERE `value` = \''.pSQL($name).'\'
|
||||
AND fv.`id_feature` = '.(int)$id_feature.'
|
||||
GROUP BY fv.`id_feature_value` LIMIT 1
|
||||
');
|
||||
|
||||
if (!isset($rq[0]['id_feature_value']) || !$id_feature_value = (int)$rq[0]['id_feature_value'])
|
||||
if (!is_null($id_product) && $id_product)
|
||||
{
|
||||
// Feature doesn't exist, create it
|
||||
$feature_value = new FeatureValue();
|
||||
$id_feature_value = Db::getInstance()->getValue('
|
||||
SELECT `id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_product
|
||||
WHERE `id_feature` = '.(int)$id_feature.'
|
||||
AND `id_product` = '.(int)$id_product);
|
||||
|
||||
$languages = Language::getLanguages();
|
||||
foreach ($languages as $language)
|
||||
$feature_value->value[$language['id_lang']] = strval($name);
|
||||
|
||||
$feature_value->id_feature = (int)$id_feature;
|
||||
$feature_value->custom = 1;
|
||||
$feature_value->add();
|
||||
|
||||
return (int)$feature_value->id;
|
||||
if ($id_feature_value && !is_null($id_lang) && $id_lang)
|
||||
Db::getInstance()->execute('
|
||||
UPDATE '._DB_PREFIX_.'feature_value_lang
|
||||
SET `value` = \''.pSQL($value).'\'
|
||||
WHERE `id_feature_value` = '.(int)$id_feature_value.'
|
||||
AND `id_lang` = '.(int)$id_lang);
|
||||
}
|
||||
return (int)$id_feature_value;
|
||||
else
|
||||
$id_feature_value = Db::getInstance()->getValue('
|
||||
SELECT fv.`id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
||||
WHERE `value` = \''.pSQL($value).'\'
|
||||
AND fv.`id_feature` = '.(int)$id_feature.'
|
||||
GROUP BY fv.`id_feature_value`');
|
||||
|
||||
if ($id_feature_value)
|
||||
return (int)$id_feature_value;
|
||||
|
||||
// Feature doesn't exist, create it
|
||||
$feature_value = new FeatureValue();
|
||||
$feature_value->id_feature = (int)$id_feature;
|
||||
$feature_value->custom = 0;
|
||||
foreach (Language::getLanguages() as $language)
|
||||
$feature_value->value[$language['id_lang']] = $value;
|
||||
$feature_value->add();
|
||||
|
||||
return (int)$feature_value->id;
|
||||
}
|
||||
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
|
||||
@@ -137,6 +137,7 @@ class GroupReductionCore extends ObjectModel
|
||||
SELECT `reduction`
|
||||
FROM `'._DB_PREFIX_.'product_group_reduction_cache`
|
||||
WHERE `id_product` = '.(int)$id_product.' AND `id_group` = '.(int)$id_group);
|
||||
// Should return string (decimal in database) and not a float
|
||||
return self::$reduction_cache[$id_product.'-'.$id_group];
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -110,6 +110,7 @@ class HookCore extends ObjectModel
|
||||
*/
|
||||
public static function getIdByName($hook_name)
|
||||
{
|
||||
$hook_name = strtolower($hook_name);
|
||||
if (!Validate::isHookName($hook_name))
|
||||
return false;
|
||||
|
||||
@@ -126,9 +127,7 @@ class HookCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'hook_alias` ha
|
||||
INNER JOIN `'._DB_PREFIX_.'hook` h ON ha.name = h.name');
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$hook_ids[$row['name']] = $row['id_hook'];
|
||||
}
|
||||
$hook_ids[strtolower($row['name'])] = $row['id_hook'];
|
||||
Cache::store($cache_id, $hook_ids);
|
||||
}
|
||||
else
|
||||
|
||||
+14
-8
@@ -120,16 +120,22 @@ class ImageCore extends ObjectModel
|
||||
*
|
||||
* @param integer $id_lang Language ID
|
||||
* @param integer $id_product Product ID
|
||||
* @param integer $id_product_attribute Product Attribute ID
|
||||
* @return array Images
|
||||
*/
|
||||
public static function getImages($id_lang, $id_product)
|
||||
public static function getImages($id_lang, $id_product, $id_product_attribute = NULL)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)
|
||||
WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang.'
|
||||
ORDER BY i.`position` ASC');
|
||||
$attribute_filter = ($id_product_attribute ? ' AND ai.`id_product_attribute` = '.(int)$id_product_attribute : '');
|
||||
$sql = 'SELECT *
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)';
|
||||
|
||||
if ($id_product_attribute)
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` ai ON (i.`id_image` = ai.`id_image`)';
|
||||
|
||||
$sql .= ' WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang . $attribute_filter.'
|
||||
ORDER BY i.`position` ASC';
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -644,7 +650,7 @@ class ImageCore extends ObjectModel
|
||||
*/
|
||||
public static function testFileSystem()
|
||||
{
|
||||
$safe_mode = ini_get('safe_mode');
|
||||
$safe_mode = Tools::getSafeModeStatus();
|
||||
if ($safe_mode)
|
||||
return false;
|
||||
$folder1 = _PS_PROD_IMG_DIR_.'testfilesystem/';
|
||||
|
||||
+46
-27
@@ -70,7 +70,7 @@ class LanguageCore extends ObjectModel
|
||||
/** @var array Languages cache */
|
||||
protected static $_checkedLangs;
|
||||
protected static $_LANGUAGES;
|
||||
protected static $countActiveLanguages;
|
||||
protected static $countActiveLanguages = array();
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectNodeName' => 'language',
|
||||
@@ -111,18 +111,22 @@ class LanguageCore extends ObjectModel
|
||||
$iso_code = $newIso ? $newIso : $this->iso_code;
|
||||
|
||||
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
|
||||
mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
|
||||
{
|
||||
if (@mkdir(_PS_TRANSLATIONS_DIR_.$iso_code))
|
||||
@chmod(_PS_TRANSLATIONS_DIR_.$iso_code, 0777);
|
||||
}
|
||||
|
||||
foreach ($this->translationsFilesAndVars as $file => $var)
|
||||
{
|
||||
$path_file = _PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php';
|
||||
if (!file_exists($path_file))
|
||||
if ($file != 'tabs')
|
||||
file_put_contents($path_file, '<?php
|
||||
@file_put_contents($path_file, '<?php
|
||||
global $'.$var.';
|
||||
$'.$var.' = array();
|
||||
?>');
|
||||
else
|
||||
file_put_contents($path_file, '<?php
|
||||
@file_put_contents($path_file, '<?php
|
||||
$'.$var.' = array();
|
||||
return $'.$var.';
|
||||
?>');
|
||||
@@ -460,7 +464,8 @@ class LanguageCore extends ObjectModel
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
rmdir($dir);
|
||||
if (is_writable($dir))
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
@@ -519,7 +524,7 @@ class LanguageCore extends ObjectModel
|
||||
'-default-'.ImageType::getFormatedName('medium').'.jpg',
|
||||
'-default-'.ImageType::getFormatedName('small').'.jpg'
|
||||
);
|
||||
$image_directories = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
||||
$images_directories = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
||||
foreach ($images_directories as $image_directory)
|
||||
foreach ($images as $image)
|
||||
{
|
||||
@@ -683,26 +688,28 @@ class LanguageCore extends ObjectModel
|
||||
if (Language::getIdByIso($iso_code))
|
||||
return true;
|
||||
|
||||
// Initialize the language
|
||||
$lang = new Language();
|
||||
$lang->iso_code = $iso_code;
|
||||
$lang->language_code = $iso_code;
|
||||
$lang->active = true;
|
||||
|
||||
// If the language pack has not been provided, retrieve it from prestashop.com
|
||||
if (!$lang_pack)
|
||||
$lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$iso_code));
|
||||
|
||||
// If a language pack has been found or provided, prefill the language object with the value
|
||||
if ($lang_pack)
|
||||
{
|
||||
if (isset($lang_pack->name)
|
||||
&& isset($lang_pack->version)
|
||||
&& isset($lang_pack->iso_code))
|
||||
$lang->name = $lang_pack->name;
|
||||
}
|
||||
elseif ($params_lang !== null && is_array($params_lang))
|
||||
foreach (get_object_vars($lang_pack) as $key => $value)
|
||||
if ($key != 'iso_code' && isset(Language::$definition['fields'][$key]))
|
||||
$lang->$key = $value;
|
||||
|
||||
// Use the values given in parameters to override the data retrieved automatically
|
||||
if ($params_lang !== null && is_array($params_lang))
|
||||
foreach ($params_lang as $key => $value)
|
||||
$lang->$key = $value;
|
||||
else
|
||||
return false;
|
||||
|
||||
if ($key != 'iso_code' && isset(Language::$definition['fields'][$key]))
|
||||
$lang->$key = $value;
|
||||
|
||||
if (!$lang->add(true, false, $only_add))
|
||||
return false;
|
||||
|
||||
@@ -720,7 +727,7 @@ class LanguageCore extends ObjectModel
|
||||
}
|
||||
else
|
||||
Language::_copyNoneFlag((int)$lang->id);
|
||||
|
||||
|
||||
$files_copy = array(
|
||||
'/en.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('thickbox').'.jpg',
|
||||
@@ -730,7 +737,7 @@ class LanguageCore extends ObjectModel
|
||||
'/en-default-'.ImageType::getFormatedName('small').'.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('scene').'.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)
|
||||
@copy(dirname(__FILE__).'/../img/l'.$file, $to.str_replace('/en', '/'.$iso_code, $file));
|
||||
@@ -756,15 +763,18 @@ class LanguageCore extends ObjectModel
|
||||
return (isset(self::$_cache_language_installation[$iso_code]) ? self::$_cache_language_installation[$iso_code] : false);
|
||||
}
|
||||
|
||||
public static function countActiveLanguages()
|
||||
public static function countActiveLanguages($id_shop = null)
|
||||
{
|
||||
if (!self::$countActiveLanguages)
|
||||
self::$countActiveLanguages = Db::getInstance()->getValue('
|
||||
if ($id_shop === null)
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
|
||||
if (!isset(self::$countActiveLanguages[$id_shop]))
|
||||
self::$countActiveLanguages[$id_shop] = Db::getInstance()->getValue('
|
||||
SELECT COUNT(DISTINCT l.id_lang) FROM `'._DB_PREFIX_.'lang` l
|
||||
'.Shop::addSqlAssociation('lang', 'l').'
|
||||
JOIN '._DB_PREFIX_.'lang_shop lang_shop ON (lang_shop.id_lang = l.id_lang AND lang_shop.id_shop = '.(int)$id_shop.')
|
||||
WHERE l.`active` = 1
|
||||
');
|
||||
return self::$countActiveLanguages;
|
||||
return self::$countActiveLanguages[$id_shop];
|
||||
}
|
||||
|
||||
public static function downloadAndInstallLanguagePack($iso, $version = null, $params = null)
|
||||
@@ -780,13 +790,22 @@ class LanguageCore extends ObjectModel
|
||||
$lang_pack_ok = false;
|
||||
$errors = array();
|
||||
$file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
|
||||
|
||||
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.Tools::strtolower($iso)))
|
||||
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
|
||||
$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.'/'.Tools::strtolower($lang_pack->iso_code.'.gzip')))
|
||||
if (!@file_put_contents($file, $content))
|
||||
$errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||
{
|
||||
if (is_writable(dirname($file)))
|
||||
{
|
||||
@unlink($file);
|
||||
@file_put_contents($file, $content);
|
||||
}
|
||||
elseif (!is_writable($file))
|
||||
$errors[] = Tools::displayError('Server does not have permissions for writing.').' ('.$file.')';
|
||||
}
|
||||
if (file_exists($file))
|
||||
{
|
||||
$gz = new Archive_Tar($file, true);
|
||||
@@ -819,8 +838,8 @@ class LanguageCore extends ObjectModel
|
||||
* @since 1.5.0
|
||||
* @return bool
|
||||
*/
|
||||
public static function isMultiLanguageActivated()
|
||||
public static function isMultiLanguageActivated($id_shop = null)
|
||||
{
|
||||
return (Language::countActiveLanguages() > 1);
|
||||
return (Language::countActiveLanguages($id_shop) > 1);
|
||||
}
|
||||
}
|
||||
+53
-61
@@ -91,19 +91,15 @@ class LinkCore
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
|
||||
$shop = new Shop($id_shop);
|
||||
else
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||
|
||||
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
|
||||
|
||||
if (!is_object($product))
|
||||
{
|
||||
if (is_array($product) && isset($product['id_product']))
|
||||
$product = new Product($product['id_product'], false, $id_lang);
|
||||
$product = new Product($product['id_product'], false, $id_lang, $id_shop);
|
||||
elseif ((int)$product)
|
||||
$product = new Product((int)$product, false, $id_lang);
|
||||
$product = new Product((int)$product, false, $id_lang, $id_shop);
|
||||
else
|
||||
throw new PrestaShopException('Invalid product vars');
|
||||
}
|
||||
@@ -163,11 +159,7 @@ class LinkCore
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if ($id_shop === null)
|
||||
$shop = Context::getContext()->shop;
|
||||
else
|
||||
$shop = new Shop($id_shop);
|
||||
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
|
||||
|
||||
if (!is_object($category))
|
||||
$category = new Category($category, $id_lang);
|
||||
@@ -206,11 +198,7 @@ class LinkCore
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if ($id_shop === null)
|
||||
$shop = Context::getContext()->shop;
|
||||
else
|
||||
$shop = new Shop($id_shop);
|
||||
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
|
||||
|
||||
$dispatcher = Dispatcher::getInstance();
|
||||
if (!is_object($cms_category))
|
||||
@@ -239,19 +227,12 @@ class LinkCore
|
||||
* @param int $id_lang
|
||||
* @return string
|
||||
*/
|
||||
public function getCMSLink($cms, $alias = null, $ssl = false, $id_lang = null, $id_shop = null)
|
||||
public function getCMSLink($cms, $alias = null, $ssl = null, $id_lang = null, $id_shop = null)
|
||||
{
|
||||
$base = (($ssl && $this->ssl_enable) ? 'https://' : 'http://');
|
||||
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if ($id_shop === null)
|
||||
$shop = Context::getContext()->shop;
|
||||
else
|
||||
$shop = new Shop($id_shop);
|
||||
$url = $base.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||
|
||||
$url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop);
|
||||
|
||||
$dispatcher = Dispatcher::getInstance();
|
||||
if (!is_object($cms))
|
||||
@@ -290,11 +271,8 @@ class LinkCore
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if ($id_shop === null)
|
||||
$shop = Context::getContext()->shop;
|
||||
else
|
||||
$shop = new Shop($id_shop);
|
||||
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||
|
||||
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
|
||||
|
||||
$dispatcher = Dispatcher::getInstance();
|
||||
if (!is_object($supplier))
|
||||
@@ -327,11 +305,7 @@ class LinkCore
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if ($id_shop === null)
|
||||
$shop = Context::getContext()->shop;
|
||||
else
|
||||
$shop = new Shop($id_shop);
|
||||
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
|
||||
|
||||
$dispatcher = Dispatcher::getInstance();
|
||||
if (!is_object($manufacturer))
|
||||
@@ -360,28 +334,23 @@ class LinkCore
|
||||
* @param int $id_lang
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = false, $id_lang = null, $id_shop = null)
|
||||
public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = null, $id_lang = null, $id_shop = null)
|
||||
{
|
||||
$base = (($ssl && $this->ssl_enable) ? 'https://' : 'http://');
|
||||
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if ($id_shop === null)
|
||||
$shop = Context::getContext()->shop;
|
||||
else
|
||||
$shop = new Shop($id_shop);
|
||||
$url = $base.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||
|
||||
// Set available keywords
|
||||
$params['module'] = $module;
|
||||
$params['controller'] = $controller ? $controller : 'default';
|
||||
$url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop);
|
||||
|
||||
// If the module has its own route ... just use it !
|
||||
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang, $id_shop))
|
||||
return $this->getPageLink('module-'.$module.'-'.$controller, $ssl, $id_lang, $params);
|
||||
else
|
||||
{
|
||||
// Set available keywords
|
||||
$params['module'] = $module;
|
||||
$params['controller'] = $controller ? $controller : 'default';
|
||||
return $url.Dispatcher::getInstance()->createUrl('module', $id_lang, $params, $this->allow, '', $id_shop);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -452,10 +421,9 @@ class LinkCore
|
||||
*
|
||||
* @return string Page link
|
||||
*/
|
||||
public function getPageLink($controller, $ssl = false, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null)
|
||||
public function getPageLink($controller, $ssl = null, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null)
|
||||
{
|
||||
$controller = Tools::strReplaceFirst('.php', '', $controller);
|
||||
|
||||
if (!$id_lang)
|
||||
$id_lang = (int)Context::getContext()->language->id;
|
||||
|
||||
@@ -468,16 +436,9 @@ class LinkCore
|
||||
parse_str($request, $request);
|
||||
}
|
||||
|
||||
if ($id_shop === null)
|
||||
$shop = Context::getContext()->shop;
|
||||
else
|
||||
$shop = new Shop($id_shop);
|
||||
|
||||
$uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request, false, '', $id_shop);
|
||||
$url = ($ssl && $this->ssl_enable) ? 'https://' : 'http://';
|
||||
$url .= $shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang).ltrim($uri_path, '/');
|
||||
|
||||
return $url;
|
||||
return $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/');
|
||||
}
|
||||
|
||||
public function getCatImageLink($name, $id_category, $type = null)
|
||||
@@ -509,6 +470,7 @@ class LinkCore
|
||||
unset($params['id_lang']);
|
||||
|
||||
$controller = Dispatcher::getInstance()->getController();
|
||||
|
||||
if (!empty(Context::getContext()->controller->php_self))
|
||||
$controller = Context::getContext()->controller->php_self;
|
||||
|
||||
@@ -524,6 +486,15 @@ class LinkCore
|
||||
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);
|
||||
elseif (isset($params['fc']) && $params['fc'] == 'module')
|
||||
{
|
||||
$module = Validate::isModuleName(Tools::getValue('module')) ? Tools::getValue('module') : '';
|
||||
if (!empty($module))
|
||||
{
|
||||
unset($params['fc'], $params['module']);
|
||||
return $this->getModuleLink($module, $controller, $params, false, (int)$id_lang);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->getPageLink($controller, false, $id_lang, $params);
|
||||
}
|
||||
@@ -618,12 +589,12 @@ class LinkCore
|
||||
return $url.(!strstr($url, '?') ? '?' : '&').'orderby='.urlencode($orderby).'&orderway='.urlencode($orderway);
|
||||
}
|
||||
|
||||
protected function getLangLink($id_lang = null, Context $context = null)
|
||||
protected function getLangLink($id_lang = null, Context $context = null, $id_shop = null)
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!$this->allow || !Language::isMultiLanguageActivated())
|
||||
if ((!$this->allow && in_array($id_shop, array($context->shop->id, null))) || !Language::isMultiLanguageActivated($id_shop) || !(int)Configuration::get('PS_REWRITING_SETTINGS', null, null, $id_shop))
|
||||
return '';
|
||||
|
||||
if (!$id_lang)
|
||||
@@ -631,5 +602,26 @@ class LinkCore
|
||||
|
||||
return Language::getIsoById($id_lang).'/';
|
||||
}
|
||||
|
||||
protected function getBaseLink($id_shop = null, $ssl = null)
|
||||
{
|
||||
static $force_ssl = null;
|
||||
|
||||
if ($ssl === null)
|
||||
{
|
||||
if ($force_ssl === null)
|
||||
$force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'));
|
||||
$ssl = $force_ssl;
|
||||
}
|
||||
|
||||
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
|
||||
$shop = new Shop($id_shop);
|
||||
else
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
$base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
|
||||
|
||||
return $base.$shop->getBaseURI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,11 @@ class LoggerCore extends ObjectModel
|
||||
|
||||
return $this->hash;
|
||||
}
|
||||
|
||||
public static function eraseAllLogs()
|
||||
{
|
||||
return Db::getInstance()->execute('TRUNCATE TABLE '._DB_PREFIX_.'log');
|
||||
}
|
||||
|
||||
/**
|
||||
* check if this log message already exists in database.
|
||||
|
||||
+74
-6
@@ -50,10 +50,11 @@ class MailCore
|
||||
* @param bool $modeSMTP
|
||||
* @param string $template_path
|
||||
* @param bool $die
|
||||
* @param string $bcc Bcc recipient
|
||||
*/
|
||||
public static function Send($id_lang, $template, $subject, $template_vars, $to,
|
||||
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
|
||||
$template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
|
||||
$template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null)
|
||||
{
|
||||
$configuration = Configuration::getMultiple(array(
|
||||
'PS_SHOP_EMAIL',
|
||||
@@ -127,9 +128,9 @@ class MailCore
|
||||
}
|
||||
|
||||
/* Construct multiple recipients list if needed */
|
||||
$to_list = new Swift_RecipientList();
|
||||
if (is_array($to) && isset($to))
|
||||
{
|
||||
$to_list = new Swift_RecipientList();
|
||||
foreach ($to as $key => $addr)
|
||||
{
|
||||
$to_name = null;
|
||||
@@ -150,20 +151,23 @@ class MailCore
|
||||
if (function_exists('mb_encode_mimeheader'))
|
||||
$to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8'));
|
||||
else
|
||||
$to_list->addTo($addr, '=?UTF-8?B?'.base64_encode($to_name).'?=');
|
||||
$to_list->addTo($addr, self::mimeEncode($to_name));
|
||||
}
|
||||
$to_plugin = $to[0];
|
||||
$to = $to_list;
|
||||
} else {
|
||||
/* Simple recipient, one address */
|
||||
$to_plugin = $to;
|
||||
if ($to_name == null)
|
||||
$to_name = $to;
|
||||
if (function_exists('mb_encode_mimeheader'))
|
||||
$to = new Swift_Address($to, mb_encode_mimeheader($to_name, 'utf-8'));
|
||||
$to_list->addTo($to, mb_encode_mimeheader($to_name, 'utf-8'));
|
||||
else
|
||||
$to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($to_name).'?=');
|
||||
$to_list->addTo($to, self::mimeEncode($to_name));
|
||||
}
|
||||
if(isset($bcc)) {
|
||||
$to_list->addBcc($bcc);
|
||||
}
|
||||
$to = $to_list;
|
||||
try {
|
||||
/* Connect with the appropriate configuration */
|
||||
if ($configuration['PS_MAIL_METHOD'] == 2)
|
||||
@@ -381,4 +385,68 @@ class MailCore
|
||||
return vsprintf("<%s.%d.%s@%s>", $midparams);
|
||||
}
|
||||
|
||||
public static function isMultibyte($data)
|
||||
{
|
||||
$length = strlen($data);
|
||||
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
{
|
||||
$result = ord(($data[$i]));
|
||||
|
||||
if ($result > 128)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function mimeEncode($string, $charset = 'UTF-8', $newline = "\r\n")
|
||||
{
|
||||
if (!self::isMultibyte($string) && strlen($string) < 75)
|
||||
{
|
||||
return $string;
|
||||
}
|
||||
|
||||
$charset = strtoupper($charset);
|
||||
$start = '=?' . $charset . '?B?';
|
||||
$end = '?=';
|
||||
$sep = $end . $newline . ' ' . $start;
|
||||
$length = 75 - strlen($start) - strlen($end);
|
||||
$length = $length - ($length % 4);
|
||||
|
||||
if ($charset === 'UTF-8')
|
||||
{
|
||||
$parts = array();
|
||||
$maxchars = floor(($length * 3) / 4);
|
||||
$stringLength = strlen($string);
|
||||
|
||||
while ($stringLength > $maxchars)
|
||||
{
|
||||
$i = (int)$maxchars;
|
||||
$result = ord($string[$i]);
|
||||
|
||||
while ($result >= 128 && $result <= 191)
|
||||
{
|
||||
$i--;
|
||||
$result = ord($string[$i]);
|
||||
}
|
||||
|
||||
$parts[] = base64_encode(substr($string, 0, $i));
|
||||
$string = substr($string, $i);
|
||||
$stringLength = strlen($string);
|
||||
}
|
||||
|
||||
$parts[] = base64_encode($string);
|
||||
$string = implode($sep, $parts);
|
||||
}
|
||||
else
|
||||
{
|
||||
$string = chunk_split(base64_encode($string), $length, $sep);
|
||||
$string = preg_replace('/' . preg_quote($sep) . '$/', '', $string);
|
||||
}
|
||||
|
||||
return $start . $string . $end;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
// Lang fields
|
||||
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
|
||||
'short_description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 254),
|
||||
'short_description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
|
||||
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
|
||||
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
|
||||
'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
|
||||
|
||||
+7
-3
@@ -39,7 +39,7 @@ class MediaCore
|
||||
'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
|
||||
'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
|
||||
'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
|
||||
'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
|
||||
'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position','ui.button'), 'theme' => true),
|
||||
'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
|
||||
'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
|
||||
'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true),
|
||||
@@ -111,7 +111,8 @@ class MediaCore
|
||||
// In this case, we don't compress the content
|
||||
if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR)
|
||||
{
|
||||
error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML');
|
||||
if (_PS_MODE_DEV_)
|
||||
error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML');
|
||||
return $html_content_copy;
|
||||
}
|
||||
return $html_content;
|
||||
@@ -200,7 +201,7 @@ class MediaCore
|
||||
if (!preg_match('/^http(s?):\/\//i', $file_uri) && !@filemtime($file_uri))
|
||||
return false;
|
||||
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
if (Context::getContext()->controller->controller_type == 'admin' && !array_key_exists('host', $url_data))
|
||||
{
|
||||
$js_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $js_uri);
|
||||
$js_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$js_uri;
|
||||
@@ -271,6 +272,9 @@ class MediaCore
|
||||
if ($add_no_conflict)
|
||||
$return[] = Media::getJSPath(_PS_JS_DIR_.'jquery/jquery.noConflict.php?version='.$version);
|
||||
|
||||
//added query migrate for compatibility with new version of jquery will be removed in ps 1.6
|
||||
$return[] = Media::getJSPath(_PS_JS_DIR_.'jquery/jquery-migrate-1.2.1.js');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -68,8 +68,11 @@ class MetaCore extends ObjectModel
|
||||
{
|
||||
if ($file != 'index.php' && !in_array(strtolower(str_replace('Controller.php', '', $file)), $exlude_pages))
|
||||
{
|
||||
$reflection = new ReflectionClass(str_replace('.php', '', $file));
|
||||
$properties = $reflection->getDefaultProperties();
|
||||
$class_name = str_replace('.php', '', $file);
|
||||
if (class_exists($class_name))
|
||||
$reflection = new ReflectionClass(str_replace('.php', '', $file));
|
||||
if (isset($reflection) && $reflection)
|
||||
$properties = $reflection->getDefaultProperties();
|
||||
if (isset($properties['php_self']))
|
||||
$selected_pages[$properties['php_self']] = $properties['php_self'];
|
||||
else if (preg_match('/^[a-z0-9_.-]*\.php$/i', $file))
|
||||
|
||||
@@ -399,6 +399,8 @@ abstract class PaymentModuleCore extends Module
|
||||
} // end foreach ($products)
|
||||
|
||||
$cart_rules_list = '';
|
||||
$total_reduction_value_ti = 0;
|
||||
$total_reduction_value_tex = 0;
|
||||
foreach ($cart_rules as $cart_rule)
|
||||
{
|
||||
$package = array('id_carrier' => $order->id_carrier, 'id_address' => $order->id_address_delivery, 'products' => $order->product_list);
|
||||
@@ -419,7 +421,8 @@ abstract class PaymentModuleCore extends Module
|
||||
** THEN
|
||||
** The voucher is cloned with a new value corresponding to the remainder
|
||||
*/
|
||||
if (count($order_list) == 1 && $values['tax_incl'] > $order->total_products_wt && $cart_rule['obj']->partial_use == 1 && $cart_rule['obj']->reduction_amount > 0)
|
||||
|
||||
if (count($order_list) == 1 && $values['tax_incl'] > ($order->total_products_wt - $total_reduction_value_ti) && $cart_rule['obj']->partial_use == 1 && $cart_rule['obj']->reduction_amount > 0)
|
||||
{
|
||||
// Create a new voucher from the original
|
||||
$voucher = new CartRule($cart_rule['obj']->id); // We need to instantiate the CartRule without lang parameter to allow saving it
|
||||
@@ -432,9 +435,9 @@ abstract class PaymentModuleCore extends Module
|
||||
|
||||
// Set the new voucher value
|
||||
if ($voucher->reduction_tax)
|
||||
$voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_incl : 0);
|
||||
$voucher->reduction_amount = $values['tax_incl'] - ($order->total_products_wt - $total_reduction_value_ti) - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_incl : 0);
|
||||
else
|
||||
$voucher->reduction_amount = $values['tax_excl'] - $order->total_products - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_excl : 0);
|
||||
$voucher->reduction_amount = $values['tax_excl'] - ($order->total_products - $total_reduction_value_tex) - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_excl : 0);
|
||||
|
||||
$voucher->id_customer = $order->id_customer;
|
||||
$voucher->quantity = 1;
|
||||
@@ -466,7 +469,10 @@ abstract class PaymentModuleCore extends Module
|
||||
|
||||
$values['tax_incl'] -= $values['tax_incl'] - $order->total_products_wt;
|
||||
$values['tax_excl'] -= $values['tax_excl'] - $order->total_products;
|
||||
|
||||
}
|
||||
$total_reduction_value_ti += $values['tax_incl'];
|
||||
$total_reduction_value_tex += $values['tax_excl'];
|
||||
|
||||
$order->addCartRule($cart_rule['obj']->id, $cart_rule['obj']->name, $values, 0, $cart_rule['obj']->free_shipping);
|
||||
|
||||
|
||||
+20
-19
@@ -347,7 +347,7 @@ class ProductCore extends ObjectModel
|
||||
),
|
||||
'id_tax_rules_group' => array(
|
||||
'xlink_resource' => array(
|
||||
'resourceName' => 'tax_rules_group'
|
||||
'resourceName' => 'tax_rule_groups'
|
||||
)
|
||||
),
|
||||
'position_in_category' => array(
|
||||
@@ -1354,7 +1354,7 @@ class ProductCore extends ObjectModel
|
||||
$supplier_reference = '';
|
||||
|
||||
//Try to set the default supplier reference
|
||||
if (($id_supplier > 0) && ($id_product > 0))
|
||||
if (($id_supplier > 0) && ($this->id > 0))
|
||||
{
|
||||
$id_product_supplier = (int)ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $id_supplier);
|
||||
|
||||
@@ -1368,8 +1368,8 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
$product_supplier->product_supplier_reference = pSQL($supplier_reference);
|
||||
$product_supplier->product_supplier_price_te = (float)$price;
|
||||
$product_supplier->id_currency = (int)$id_currency;
|
||||
$product_supplier->product_supplier_price_te = !is_null($price) ? (float)$price : (float)$product_supplier->product_supplier_price_te;
|
||||
$product_supplier->id_currency = !is_null($id_currency) ? (int)$id_currency : (int)$product_supplier->id_currency;
|
||||
$product_supplier->save();
|
||||
}
|
||||
}
|
||||
@@ -2468,8 +2468,9 @@ class ProductCore extends ObjectModel
|
||||
|
||||
if (!Validate::isBool($usetax) || !Validate::isUnsignedId($id_product))
|
||||
die(Tools::displayError());
|
||||
|
||||
// Initializations
|
||||
$id_group = (isset($context->customer) ? $context->customer->id_default_group : (int)Configuration::get('PS_CUSTOMER_GROUP'));
|
||||
$id_group = (int)Group::getCurrent()->id;
|
||||
|
||||
// If there is cart in context or if the specified id_cart is different from the context cart id
|
||||
if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart && $cur_cart->id != $id_cart))
|
||||
@@ -2508,7 +2509,7 @@ class ProductCore extends ObjectModel
|
||||
$id_state = 0;
|
||||
$zipcode = 0;
|
||||
|
||||
if (!$id_address)
|
||||
if (!$id_address && Validate::isLoadedObject($cur_cart))
|
||||
$id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
|
||||
|
||||
if ($id_address)
|
||||
@@ -2719,8 +2720,7 @@ class ProductCore extends ObjectModel
|
||||
if ($use_group_reduction)
|
||||
{
|
||||
$reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group);
|
||||
|
||||
if (!empty($reduction_from_category) && (float)$reduction_from_category == 0)
|
||||
if ($reduction_from_category !== false)
|
||||
$price -= $price * (float)$reduction_from_category;
|
||||
else // apply group reduction if there is no group reduction for this category
|
||||
$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
|
||||
@@ -2914,7 +2914,7 @@ class ProductCore extends ObjectModel
|
||||
* @param Shop $shop
|
||||
* @return string
|
||||
*/
|
||||
public static function sqlStock($product_alias, $product_attribute = 0, $inner_join = false, Shop $shop = null)
|
||||
public static function sqlStock($product_alias, $product_attribute = null, $inner_join = false, Shop $shop = null)
|
||||
{
|
||||
$id_shop = ($shop !== null ? (int)$shop->id : null);
|
||||
$sql = (($inner_join) ? ' INNER ' : ' LEFT ').'
|
||||
@@ -3055,18 +3055,18 @@ class ProductCore extends ObjectModel
|
||||
if (!Combination::isFeatureActive())
|
||||
return array();
|
||||
$sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name,
|
||||
a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`,
|
||||
IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, pa.`weight`,
|
||||
a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, product_attribute_shop.`id_product_attribute`,
|
||||
IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, product_attribute_shop.`weight`,
|
||||
product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`,
|
||||
pa.`minimal_quantity`, pa.`available_date`, ag.`group_type`
|
||||
product_attribute_shop.`minimal_quantity`, product_attribute_shop.`available_date`, ag.`group_type`
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
'.Product::sqlStock('pa', 'pa').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
||||
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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
||||
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`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`)
|
||||
'.Shop::addSqlAssociation('attribute', 'a').'
|
||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||
AND al.`id_lang` = '.(int)$id_lang.'
|
||||
@@ -3159,8 +3159,9 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE `id_product_1` = '.(int)$this->id.
|
||||
($active ? ' AND product_shop.`active` = 1' : '').'
|
||||
($active ? ' AND product_shop.`active` = 1 AND product_shop.`visibility` != \'none\'' : '').'
|
||||
GROUP BY product_shop.id_product';
|
||||
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
foreach ($result as &$row)
|
||||
@@ -4493,7 +4494,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
|
||||
/**
|
||||
* Webservice getter : get virtual field default combination
|
||||
*
|
||||
|
||||
@@ -66,7 +66,10 @@ class ProductSaleCore
|
||||
if ($page_number < 0) $page_number = 0;
|
||||
if ($nb_products < 1) $nb_products = 10;
|
||||
$final_order_by = $order_by;
|
||||
$order_table = '';
|
||||
if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales';
|
||||
if ($order_by == 'date_add' || $order_by == 'date_upd')
|
||||
$order_table = 'product_shop';
|
||||
if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC';
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
@@ -100,7 +103,7 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p').'
|
||||
WHERE product_shop.`active` = 1
|
||||
AND p.`visibility` != \'none\'
|
||||
AND product_shop.`visibility` != \'none\'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -108,7 +111,7 @@ class ProductSaleCore
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
GROUP BY product_shop.id_product
|
||||
ORDER BY '.$prefix.'`'.pSQL($order_by).'` '.pSQL($order_way).'
|
||||
ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
@@ -153,7 +156,7 @@ class ProductSaleCore
|
||||
ON cl.`id_category` = product_shop.`id_category_default`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE product_shop.`active` = 1
|
||||
AND p.`visibility` != \'none\'
|
||||
AND product_shop.`visibility` != \'none\'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
|
||||
+31
-8
@@ -93,8 +93,12 @@ define('PREG_CLASS_CJK', '\x{3041}-\x{30ff}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}\x{
|
||||
|
||||
class SearchCore
|
||||
{
|
||||
public static function sanitize($string, $id_lang, $indexation = false)
|
||||
public static function sanitize($string, $id_lang, $indexation = false, $iso_code = false)
|
||||
{
|
||||
$string = trim($string);
|
||||
if (empty($string))
|
||||
return '';
|
||||
|
||||
$string = Tools::strtolower(strip_tags($string));
|
||||
$string = html_entity_decode($string, ENT_NOQUOTES, 'utf-8');
|
||||
|
||||
@@ -136,7 +140,24 @@ class SearchCore
|
||||
$string = implode(' ', $processed_words);
|
||||
}
|
||||
|
||||
if ($indexation)
|
||||
// If the language is constituted with symbol and there is no "words", then split every chars
|
||||
if (in_array($iso_code, array('zh', 'tw', 'ja')) && function_exists('mb_strlen'))
|
||||
{
|
||||
// Cut symbols from letters
|
||||
$symbols = '';
|
||||
$letters = '';
|
||||
foreach (explode(' ', $string) as $mb_word)
|
||||
if (strlen(Tools::replaceAccentedChars($mb_word)) == mb_strlen(Tools::replaceAccentedChars($mb_word)))
|
||||
$letters .= $mb_word.' ';
|
||||
else
|
||||
$symbols .= $mb_word.' ';
|
||||
|
||||
if (preg_match_all('/./u', $symbols, $matches))
|
||||
$symbols = implode(' ', $matches[0]);
|
||||
|
||||
$string = $letters.$symbols;
|
||||
}
|
||||
elseif ($indexation)
|
||||
{
|
||||
$minWordLen = (int)Configuration::get('PS_SEARCH_MINWORDLEN');
|
||||
if ($minWordLen > 1)
|
||||
@@ -175,7 +196,7 @@ class SearchCore
|
||||
|
||||
$intersect_array = array();
|
||||
$score_array = array();
|
||||
$words = explode(' ', Search::sanitize($expr, $id_lang));
|
||||
$words = explode(' ', Search::sanitize($expr, $id_lang, false, $context->language->iso_code));
|
||||
|
||||
foreach ($words as $key => $word)
|
||||
if (!empty($word) && strlen($word) >= (int)Configuration::get('PS_SEARCH_MINWORDLEN'))
|
||||
@@ -383,7 +404,7 @@ class SearchCore
|
||||
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc,
|
||||
pl.description_short, pl.description, cl.name cname, m.name mname
|
||||
pl.description_short, pl.description, cl.name cname, m.name mname, l.iso_code
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl
|
||||
ON p.id_product = pl.id_product
|
||||
@@ -392,6 +413,8 @@ class SearchCore
|
||||
ON (cl.id_category = product_shop.id_category_default AND pl.id_lang = cl.id_lang AND cl.id_shop = product_shop.id_shop)
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m
|
||||
ON m.id_manufacturer = p.id_manufacturer
|
||||
LEFT JOIN '._DB_PREFIX_.'lang l
|
||||
ON l.id_lang = pl.id_lang
|
||||
WHERE product_shop.indexed = 0
|
||||
AND product_shop.visibility IN ("both", "search")
|
||||
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
|
||||
@@ -452,7 +475,6 @@ class SearchCore
|
||||
// Those are kind of global variables required to save the processed data in the database every X occurrences, in order to avoid overloading MySQL
|
||||
$count_words = 0;
|
||||
$query_array3 = array();
|
||||
$products_array = array();
|
||||
|
||||
// Every indexed words are cached into a PHP array
|
||||
$word_ids = $db->executeS('
|
||||
@@ -472,6 +494,7 @@ class SearchCore
|
||||
// Products are processed 50 by 50 in order to avoid overloading MySQL
|
||||
while (($products = Search::getProductsToIndex($total_languages, $id_product, 50)) && (count($products) > 0))
|
||||
{
|
||||
$products_array = array();
|
||||
// Now each non-indexed product is processed one by one, langage by langage
|
||||
foreach ($products as $product)
|
||||
{
|
||||
@@ -482,9 +505,9 @@ class SearchCore
|
||||
// Data must be cleaned of html, bad characters, spaces and anything, then if the resulting words are long enough, they're added to the array
|
||||
$product_array = array();
|
||||
foreach ($product as $key => $value)
|
||||
if (strncmp($key, 'id_', 3))
|
||||
if (strncmp($key, 'id_', 3) && isset($weight_array[$key]))
|
||||
{
|
||||
$words = explode(' ', Search::sanitize($value, (int)$product['id_lang'], true));
|
||||
$words = explode(' ', Search::sanitize($value, (int)$product['id_lang'], true, $product['iso_code']));
|
||||
foreach ($words as $word)
|
||||
if (!empty($word))
|
||||
{
|
||||
@@ -676,4 +699,4 @@ class SearchCore
|
||||
|
||||
return Product::getProductsProperties((int)$id_lang, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,8 @@ class SpecificPriceCore extends ObjectModel
|
||||
|
||||
$priority = SpecificPrice::getPriority($id_product);
|
||||
foreach (array_reverse($priority) as $k => $field)
|
||||
$select .= ' IF (`'.bqSQL($field).'` = '.(int)$$field.', '.pow(2, $k + 1).', 0) + ';
|
||||
if (!empty($field))
|
||||
$select .= ' IF (`'.bqSQL($field).'` = '.(int)$$field.', '.pow(2, $k + 1).', 0) + ';
|
||||
|
||||
return rtrim($select, ' +').') AS `score`';
|
||||
}
|
||||
@@ -228,7 +229,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
||||
)
|
||||
AND id_cart IN (0, '.(int)$id_cart.')'.
|
||||
(($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) ? ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')' : 'AND `from_quantity` <= '.(int)$real_quantity).'
|
||||
(($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) ? ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')' : 'AND `from_quantity` <= '.max(1, (int)$real_quantity)).'
|
||||
ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC');
|
||||
}
|
||||
return self::$_specificPriceCache[$key];
|
||||
@@ -301,7 +302,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
if (!isset($last_quantity[(int)$specific_price['id_product_attribute']]))
|
||||
$last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
|
||||
elseif ($last_quantity[(int)$specific_price['id_product_attribute']] == $specific_price['from_quantity'])
|
||||
break;
|
||||
continue;
|
||||
|
||||
$last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
|
||||
if ($specific_price['from_quantity'] > 1)
|
||||
|
||||
@@ -183,7 +183,7 @@ class SpecificPriceRuleCore extends ObjectModel
|
||||
|
||||
if ($conditions_group)
|
||||
{
|
||||
$where .= ' AND (';
|
||||
$where .= ' AND ((';
|
||||
foreach ($conditions_group as $id_condition_group => $condition_group)
|
||||
{
|
||||
$fields = array(
|
||||
@@ -235,7 +235,7 @@ class SpecificPriceRuleCore extends ObjectModel
|
||||
|
||||
$where = rtrim($where, ' AND ').') OR (';
|
||||
}
|
||||
$where = rtrim($where, 'OR (');
|
||||
$where = rtrim($where, 'OR (').')';
|
||||
}
|
||||
if ($products && count($products))
|
||||
$where .= ' AND p.id_product IN ('.implode(', ', array_map('intval', $products)).')';
|
||||
@@ -267,7 +267,7 @@ class SpecificPriceRuleCore extends ObjectModel
|
||||
public static function applyRuleToProduct($id_rule, $id_product, $id_product_attribute = null)
|
||||
{
|
||||
$rule = new SpecificPriceRule((int)$id_rule);
|
||||
if (!Validate::isLoadedObject($rule))
|
||||
if (!Validate::isLoadedObject($rule) || !$id_product)
|
||||
return false;
|
||||
|
||||
$specific_price = new SpecificPrice();
|
||||
|
||||
@@ -72,7 +72,7 @@ class SupplierCore extends ObjectModel
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
|
||||
// Lang fields
|
||||
'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
|
||||
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
|
||||
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
|
||||
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
|
||||
'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
|
||||
|
||||
+17
-15
@@ -40,7 +40,7 @@ class TagCore extends ObjectModel
|
||||
'primary' => 'id_tag',
|
||||
'fields' => array(
|
||||
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -100,22 +100,24 @@ class TagCore extends ObjectModel
|
||||
$tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
|
||||
|
||||
$list = array();
|
||||
foreach ($tag_list as $tag)
|
||||
{
|
||||
if (!Validate::isGenericName($tag))
|
||||
return false;
|
||||
$tag_obj = new Tag(null, trim($tag), (int)$id_lang);
|
||||
|
||||
/* Tag does not exist in database */
|
||||
if (!Validate::isLoadedObject($tag_obj))
|
||||
if (is_array($tag_list))
|
||||
foreach ($tag_list as $tag)
|
||||
{
|
||||
$tag_obj->name = trim($tag);
|
||||
$tag_obj->id_lang = (int)$id_lang;
|
||||
$tag_obj->add();
|
||||
if (!Validate::isGenericName($tag))
|
||||
return false;
|
||||
$tag = trim(substr($tag, 0, self::$definition['fields']['name']['size']));
|
||||
$tag_obj = new Tag(null, $tag, (int)$id_lang);
|
||||
|
||||
/* Tag does not exist in database */
|
||||
if (!Validate::isLoadedObject($tag_obj))
|
||||
{
|
||||
$tag_obj->name = $tag;
|
||||
$tag_obj->id_lang = (int)$id_lang;
|
||||
$tag_obj->add();
|
||||
}
|
||||
if (!in_array($tag_obj->id, $list))
|
||||
$list[] = $tag_obj->id;
|
||||
}
|
||||
if (!in_array($tag_obj->id, $list))
|
||||
$list[] = $tag_obj->id;
|
||||
}
|
||||
$data = '';
|
||||
foreach ($list as $tag)
|
||||
$data .= '('.(int)$tag.','.(int)$id_product.'),';
|
||||
|
||||
+86
-89
@@ -494,6 +494,20 @@ class ToolsCore
|
||||
if (($is_negative = ($price < 0)))
|
||||
$price *= -1;
|
||||
$price = Tools::ps_round($price, $c_decimals);
|
||||
|
||||
/*
|
||||
* If the language is RTL and the selected currency format contains spaces as thousands separator
|
||||
* then the number will be printed in reverse since the space is interpreted as separating words.
|
||||
* To avoid this we replace the currency format containing a space with the one containing a comma (,) as thousand
|
||||
* separator when the language is RTL.
|
||||
*
|
||||
* TODO: This is not ideal, a currency format should probably be tied to a language, not to a currency.
|
||||
*/
|
||||
if(($c_format == 2) && ($context->language->is_rtl == 1))
|
||||
{
|
||||
$c_format = 4;
|
||||
}
|
||||
|
||||
switch ($c_format)
|
||||
{
|
||||
/* X 0,000.00 */
|
||||
@@ -512,9 +526,9 @@ class ToolsCore
|
||||
case 4:
|
||||
$ret = number_format($price, $c_decimals, '.', ',').$blank.$c_char;
|
||||
break;
|
||||
/* 0 000.00 X Added for the switzerland currency */
|
||||
/* 0'000.00 X Added for the switzerland currency */
|
||||
case 5:
|
||||
$ret = number_format($price, $c_decimals, '.', ' ').$blank.$c_char;
|
||||
$ret = number_format($price, $c_decimals, '.', "'").$blank.$c_char;
|
||||
break;
|
||||
}
|
||||
if ($is_negative)
|
||||
@@ -704,6 +718,18 @@ class ToolsCore
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear smarty cache folders
|
||||
*/
|
||||
public static function clearSmartyCache()
|
||||
{
|
||||
foreach (array(_PS_CACHE_DIR_.'smarty/cache', _PS_CACHE_DIR_.'smarty/compile') as $dir)
|
||||
if (file_exists($dir))
|
||||
foreach (scandir($dir) as $file)
|
||||
if ($file[0] != '.' && $file != 'index.php')
|
||||
self::deleteDirectory($dir.DIRECTORY_SEPARATOR.$file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an error according to an error code
|
||||
@@ -1248,6 +1274,13 @@ class ToolsCore
|
||||
return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1);
|
||||
}
|
||||
|
||||
public static function ucwords($str)
|
||||
{
|
||||
if (function_exists('mb_convert_case'))
|
||||
return mb_convert_case($str, MB_CASE_TITLE);
|
||||
return ucwords(strtolower($str));
|
||||
}
|
||||
|
||||
public static function orderbyPrice(&$array, $order_way)
|
||||
{
|
||||
foreach ($array as &$row)
|
||||
@@ -1389,26 +1422,9 @@ class ToolsCore
|
||||
|
||||
public static function copy($source, $destination, $stream_context = null)
|
||||
{
|
||||
if ($stream_context == null && preg_match('/^https?:\/\//', $source))
|
||||
$stream_context = @stream_context_create(array('http' => array('timeout' => 10)));
|
||||
|
||||
if (in_array(@ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $source))
|
||||
return @copy($source, $destination, $stream_context);
|
||||
elseif (function_exists('curl_init'))
|
||||
{
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_URL, $source);
|
||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
$opts = stream_context_get_options($stream_context);
|
||||
$content = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
return file_put_contents($destination, $content);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
if (is_null($stream_context) && !preg_match('/^https?:\/\//', $source))
|
||||
return @copy($source, $destination);
|
||||
return @file_put_contents($destination, Tools::file_get_contents($source, false, $stream_context));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1584,7 +1600,8 @@ class ToolsCore
|
||||
|
||||
if (self::$_cache_nb_media_servers && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
|
||||
return constant('_MEDIA_SERVER_'.$id_media_server.'_');
|
||||
return Tools::getShopDomain();
|
||||
|
||||
return Tools::usingSecureMode() ? Tools::getShopDomainSSL() : Tools::getShopDomain();
|
||||
}
|
||||
|
||||
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null)
|
||||
@@ -1664,6 +1681,9 @@ class ToolsCore
|
||||
// RewriteEngine
|
||||
fwrite($write_fd, "<IfModule mod_rewrite.c>\n");
|
||||
|
||||
// Ensure HTTP_MOD_REWRITE variable is set in environment
|
||||
fwrite($write_fd, "SetEnv HTTP_MOD_REWRITE On\n");
|
||||
|
||||
// Disable multiviews ?
|
||||
if ($disable_multiviews)
|
||||
fwrite($write_fd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
|
||||
@@ -2466,89 +2486,66 @@ exit;
|
||||
return preg_replace('/\\\[px]\{[a-z]\}{1,2}|(\/[a-z]*)u([a-z]*)$/i', "$1$2", $pattern);
|
||||
}
|
||||
|
||||
protected static $is_addons_up = true;
|
||||
public static function addonsRequest($request, $params = array())
|
||||
{
|
||||
$addons_url = 'api.addons.prestashop.com';
|
||||
$postData = '';
|
||||
$postDataArray = array(
|
||||
if (!self::$is_addons_up)
|
||||
return false;
|
||||
|
||||
$postData = http_build_query(array(
|
||||
'version' => isset($params['version']) ? $params['version'] : _PS_VERSION_,
|
||||
'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code),
|
||||
'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
|
||||
'shop_url' => urlencode(isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain()),
|
||||
'mail' => urlencode(isset($params['email']) ? $params['email'] : Configuration::get('email'))
|
||||
);
|
||||
foreach ($postDataArray as $postDataKey => $postDataValue)
|
||||
$postData .= '&'.$postDataKey.'='.$postDataValue;
|
||||
$postData = ltrim($postData, '&');
|
||||
'shop_url' => isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain(),
|
||||
'mail' => isset($params['email']) ? $params['email'] : Configuration::get('email')
|
||||
));
|
||||
|
||||
// Config for each request
|
||||
if ($request == 'native')
|
||||
$protocols = array('https');
|
||||
switch ($request)
|
||||
{
|
||||
// Define protocol accepted and post data values for this request
|
||||
$protocolsList = array('https://' => 443, 'http://' => 80);
|
||||
$postData .= '&method=listing&action=native';
|
||||
}
|
||||
if ($request == 'must-have')
|
||||
{
|
||||
// Define protocol accepted and post data values for this request
|
||||
$protocolsList = array('https://' => 443, 'http://' => 80);
|
||||
$postData .= '&method=listing&action=must-have';
|
||||
}
|
||||
if ($request == 'customer')
|
||||
{
|
||||
// Define protocol accepted and post data values for this request
|
||||
$protocolsList = array('https://' => 443);
|
||||
$postData .= '&method=listing&action=customer&username='.urlencode(trim(Context::getContext()->cookie->username_addons)).'&password='.urlencode(trim(Context::getContext()->cookie->password_addons));
|
||||
}
|
||||
if ($request == 'check_customer')
|
||||
{
|
||||
// Define protocol accepted and post data values for this request
|
||||
$protocolsList = array('https://' => 443);
|
||||
$postData .= '&method=check_customer&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
|
||||
}
|
||||
if ($request == 'module')
|
||||
{
|
||||
// Define protocol accepted and post data values for this request
|
||||
if (isset($params['username_addons']) && isset($params['password_addons']))
|
||||
{
|
||||
$protocolsList = array('https://' => 443);
|
||||
$postData .= '&method=module&id_module='.urlencode($params['id_module']).'&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$protocolsList = array('https://' => 443, 'http://' => 80);
|
||||
case 'native':
|
||||
$protocols[] = 'http';
|
||||
$postData .= '&method=listing&action=native';
|
||||
break;
|
||||
case 'must-have':
|
||||
$protocols[] = 'http';
|
||||
$postData .= '&method=listing&action=must-have';
|
||||
break;
|
||||
case 'customer':
|
||||
$postData .= '&method=listing&action=customer&username='.urlencode(trim(Context::getContext()->cookie->username_addons)).'&password='.urlencode(trim(Context::getContext()->cookie->password_addons));
|
||||
break;
|
||||
case 'check_customer':
|
||||
$postData .= '&method=check_customer&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
|
||||
break;
|
||||
case 'module':
|
||||
$postData .= '&method=module&id_module='.urlencode($params['id_module']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($request == 'install-modules')
|
||||
{
|
||||
// Define protocol accepted and post data values for this request
|
||||
$protocolsList = array('https://' => 443, 'http://' => 80);
|
||||
$postData .= '&method=listing&action=install-modules';
|
||||
|
||||
if (isset($params['username_addons']) && isset($params['password_addons']))
|
||||
$postData .= '&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
|
||||
else
|
||||
$protocols[] = 'http';
|
||||
|
||||
break;
|
||||
case 'install-modules':
|
||||
$protocols[] = 'http';
|
||||
$postData .= '&method=listing&action=install-modules';
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make the request
|
||||
$opts = array(
|
||||
'http'=>array(
|
||||
$context = stream_context_create(array(
|
||||
'http' => array(
|
||||
'method'=> 'POST',
|
||||
'content' => $postData,
|
||||
'header' => 'Content-type: application/x-www-form-urlencoded',
|
||||
'timeout' => 5,
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($opts);
|
||||
foreach ($protocolsList as $protocol => $port)
|
||||
{
|
||||
$content = Tools::file_get_contents($protocol.$addons_url, false, $context);
|
||||
|
||||
// If content returned, we cache it
|
||||
if ($content)
|
||||
));
|
||||
foreach ($protocols as $protocol)
|
||||
if ($content = Tools::file_get_contents($protocol.'://api.addons.prestashop.com', false, $context))
|
||||
return $content;
|
||||
}
|
||||
|
||||
// No content, return false
|
||||
self::$is_addons_up = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -399,10 +399,10 @@ class ValidateCore
|
||||
$events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange';
|
||||
$events .= '|onselectstart|onstart|onstop';
|
||||
|
||||
if (preg_match('/<[ \t\n]*script/ims', $html) || preg_match('/('.$events.')[ \t\n]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
|
||||
if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
|
||||
return false;
|
||||
|
||||
if (!$allow_iframe && preg_match('/<[ \t\n]*(i?frame|form|input|embed|object)/ims', $html))
|
||||
if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
Vendored
+5
-2
@@ -34,9 +34,12 @@ class CacheApcCore extends Cache
|
||||
public function __construct()
|
||||
{
|
||||
$this->keys = array();
|
||||
$cache_info = apc_cache_info('user');
|
||||
$cache_info = apc_cache_info((extension_loaded('apcu') === true )? '' : 'user' );
|
||||
foreach ($cache_info['cache_list'] as $entry)
|
||||
$this->keys[$entry['info']] = $entry['ttl'];
|
||||
if ( extension_loaded('apcu') === true )
|
||||
$this->keys[$entry['key']] = $entry['ttl'];
|
||||
else
|
||||
$this->keys[$entry['info']] = $entry['ttl'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+16
-7
@@ -44,11 +44,19 @@ class CacheMemcacheCore extends Cache
|
||||
{
|
||||
$this->connect();
|
||||
|
||||
// Get keys (this code comes from Doctrine 2 project)
|
||||
$this->keys = array();
|
||||
$servers = self::getMemcachedServers();
|
||||
|
||||
if(is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats'))
|
||||
if(is_array($servers) && count($servers) > 0)
|
||||
{
|
||||
$this->keys = @$this->memcache->get(_COOKIE_IV_);
|
||||
if (!is_array($this->keys))
|
||||
$this->keys = array();
|
||||
}
|
||||
|
||||
/*
|
||||
// Get keys (this code comes from Doctrine 2 project)
|
||||
if(is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats'))
|
||||
$all_slabs = $this->memcache->getStats('slabs');
|
||||
|
||||
if(isset($all_slabs) && is_array($all_slabs))
|
||||
@@ -56,11 +64,11 @@ class CacheMemcacheCore extends Cache
|
||||
{
|
||||
if (is_array($slabs))
|
||||
{
|
||||
foreach (array_keys($slabs) as $slab_id)
|
||||
foreach (array_keys($slabs) as $i => $slab_id) // $slab_id is not an int but a string, using the key instead ?
|
||||
{
|
||||
if(is_int($slab_id))
|
||||
{
|
||||
$dump = $this->memcache->getStats('cachedump', (int)$slab_id);
|
||||
if(is_int($i))
|
||||
{
|
||||
$dump = $this->memcache->getStats('cachedump', (int)$i);
|
||||
if ($dump)
|
||||
{
|
||||
foreach ($dump as $entries)
|
||||
@@ -73,7 +81,7 @@ class CacheMemcacheCore extends Cache
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
@@ -145,6 +153,7 @@ class CacheMemcacheCore extends Cache
|
||||
*/
|
||||
protected function _writeKeys()
|
||||
{
|
||||
$this->memcache->set(_COOKIE_IV_, $this->keys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@ class AdminControllerCore extends Controller
|
||||
public $template = 'content.tpl';
|
||||
|
||||
/** @var string Associated table name */
|
||||
public $table;
|
||||
public $table = 'configuration';
|
||||
|
||||
public $list_id;
|
||||
|
||||
@@ -395,13 +395,13 @@ class AdminControllerCore extends Controller
|
||||
if (isset($t['type']) && $t['type'] == 'bool')
|
||||
$filter .= ((bool)$val) ? $this->l('yes') : $this->l('no');
|
||||
elseif(is_string($val))
|
||||
$filter .= $val;
|
||||
$filter .= htmlspecialchars($val, ENT_QUOTES, 'UTF-8');
|
||||
elseif(is_array($val))
|
||||
{
|
||||
$tmp = '';
|
||||
foreach($val as $v)
|
||||
if(is_string($v) && !empty($v))
|
||||
$tmp .= ' - '.$v;
|
||||
$tmp .= ' - '.htmlspecialchars($v, ENT_QUOTES, 'UTF-8');
|
||||
if(Tools::strlen($tmp))
|
||||
{
|
||||
$tmp = ltrim($tmp, ' - ');
|
||||
@@ -654,7 +654,7 @@ class AdminControllerCore extends Controller
|
||||
'export_content' => $content
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$this->layout = 'layout-export.tpl';
|
||||
}
|
||||
|
||||
@@ -726,6 +726,8 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function processAdd()
|
||||
{
|
||||
if (!isset($this->className) || empty($this->className))
|
||||
return false;
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
if (count($this->errors) <= 0)
|
||||
@@ -1142,6 +1144,8 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
protected function loadObject($opt = false)
|
||||
{
|
||||
if (!isset($this->className) || empty($this->className))
|
||||
return true;
|
||||
$id = (int)Tools::getValue($this->identifier);
|
||||
if ($id && Validate::isUnsignedId($id))
|
||||
{
|
||||
@@ -1192,6 +1196,9 @@ class AdminControllerCore extends Controller
|
||||
|
||||
protected function filterToField($key, $filter)
|
||||
{
|
||||
if (!isset($this->fields_list))
|
||||
return false;
|
||||
|
||||
foreach ($this->fields_list as $field)
|
||||
if (array_key_exists('filter_key', $field) && $field['filter_key'] == $key)
|
||||
return $field;
|
||||
@@ -1532,11 +1539,23 @@ class AdminControllerCore extends Controller
|
||||
|
||||
protected function addToolBarModulesListButton()
|
||||
{
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400))
|
||||
file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'));
|
||||
|
||||
$country_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST);
|
||||
if (!empty($country_module_list) && $country_module_list_xml = simplexml_load_string($country_module_list))
|
||||
{
|
||||
$country_module_list_array = array();
|
||||
foreach ($country_module_list_xml->module as $k => $m)
|
||||
$country_module_list_array[] = (string)$m->name;
|
||||
$this->tab_modules_list['slider_list'] = array_intersect($this->tab_modules_list['slider_list'], $country_module_list_array);
|
||||
}
|
||||
|
||||
if (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list']))
|
||||
$this->toolbar_btn['modules-list'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Modules List')
|
||||
);
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Modules List')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1813,7 +1832,11 @@ class AdminControllerCore extends Controller
|
||||
$this->context->employee->logout();
|
||||
|
||||
if ($this->controller_name != 'AdminLogin' && (!isset($this->context->employee) || !$this->context->employee->isLoggedBack()))
|
||||
{
|
||||
if (isset($this->context->employee))
|
||||
$this->context->employee->logout();
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminLogin').((!isset($_GET['logout']) && $this->controller_name != 'AdminNotFound') ? '&redirect='.$this->controller_name : ''));
|
||||
}
|
||||
|
||||
// Set current index
|
||||
$current_index = 'index.php'.(($controller = Tools::getValue('controller')) ? '?controller='.$controller : '');
|
||||
@@ -2089,6 +2112,7 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
@@ -2136,16 +2160,27 @@ class AdminControllerCore extends Controller
|
||||
|| !Validate::isUnsignedId($id_lang))
|
||||
throw new PrestaShopException('get list params is not valid');
|
||||
|
||||
if (isset($this->fields_list[$order_by]) && isset($this->fields_list[$order_by]['filter_key']))
|
||||
$order_by = $this->fields_list[$order_by]['filter_key'];
|
||||
if (!isset($this->fields_list[$order_by]['order_key']) && isset($this->fields_list[$order_by]['filter_key']))
|
||||
$this->fields_list[$order_by]['order_key'] = $this->fields_list[$order_by]['filter_key'];
|
||||
|
||||
if (isset($this->fields_list[$order_by]) && isset($this->fields_list[$order_by]['order_key']))
|
||||
$order_by = $this->fields_list[$order_by]['order_key'];
|
||||
|
||||
/* Determine offset from current page */
|
||||
|
||||
|
||||
if ((isset($_POST['submitFilter'.$this->list_id]) ||
|
||||
isset($_POST['submitFilter'.$this->list_id.'_x']) ||
|
||||
isset($_POST['submitFilter'.$this->list_id.'_y'])) &&
|
||||
!empty($_POST['submitFilter'.$this->list_id]) &&
|
||||
is_numeric($_POST['submitFilter'.$this->list_id]))
|
||||
$start = ((int)$_POST['submitFilter'.$this->list_id] - 1) * $limit;
|
||||
elseif (empty($start) && isset($this->context->cookie->{$this->list_id.'_start'}) && Tools::isSubmit('export'.$this->table))
|
||||
$start = $this->context->cookie->{$this->list_id.'_start'};
|
||||
else
|
||||
$start = 0;
|
||||
|
||||
$this->context->cookie->{$this->list_id.'_start'} = $start;
|
||||
|
||||
/* Cache */
|
||||
$this->_lang = (int)$id_lang;
|
||||
@@ -2215,8 +2250,6 @@ class AdminControllerCore extends Controller
|
||||
$having_clause .= $this->_having.' ';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->_listsql = '
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '');
|
||||
@@ -2383,7 +2416,7 @@ class AdminControllerCore extends Controller
|
||||
public function getFieldValue($obj, $key, $id_lang = null)
|
||||
{
|
||||
if ($id_lang)
|
||||
$default_value = ($obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false;
|
||||
$default_value = (isset($obj->id) && $obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false;
|
||||
else
|
||||
$default_value = isset($obj->{$key}) ? $obj->{$key} : false;
|
||||
|
||||
@@ -2490,12 +2523,18 @@ class AdminControllerCore extends Controller
|
||||
foreach ($rules['validateLang'] as $field_lang => $function)
|
||||
foreach ($languages as $language)
|
||||
if (($value = Tools::getValue($field_lang.'_'.$language['id_lang'])) !== false && !empty($value))
|
||||
if (!Validate::$function($value))
|
||||
{
|
||||
if (Tools::strtolower($function) == 'iscleanhtml' && Configuration::get('PS_ALLOW_HTML_IFRAME'))
|
||||
$res = Validate::$function($value, true);
|
||||
else
|
||||
$res = Validate::$function($value);
|
||||
if (!$res)
|
||||
$this->errors[$field_lang.'_'.$language['id_lang']] = sprintf(
|
||||
Tools::displayError('The %1$s field (%2$s) is invalid.'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
||||
$language['name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2922,21 +2961,17 @@ class AdminControllerCore extends Controller
|
||||
|
||||
public function isFresh($file, $timeout = 604800000)
|
||||
{
|
||||
if (file_exists(_PS_ROOT_DIR_.$file))
|
||||
{
|
||||
if (filesize(_PS_ROOT_DIR_.$file) < 1)
|
||||
return false;
|
||||
if (file_exists(_PS_ROOT_DIR_.$file) && filesize(_PS_ROOT_DIR_.$file) > 0)
|
||||
return ((time() - filemtime(_PS_ROOT_DIR_.$file)) < $timeout);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static $is_prestashop_up = true;
|
||||
public function refresh($file_to_refresh, $external_file)
|
||||
{
|
||||
$content = Tools::file_get_contents($external_file);
|
||||
if ($content)
|
||||
if (self::$is_prestashop_up && $content = Tools::file_get_contents($external_file))
|
||||
return (bool)file_put_contents(_PS_ROOT_DIR_.$file_to_refresh, $content);
|
||||
self::$is_prestashop_up = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Executable → Regular
+16
-11
@@ -65,6 +65,9 @@ class FrontControllerCore extends Controller
|
||||
|
||||
parent::__construct();
|
||||
|
||||
if (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'))
|
||||
$this->ssl = true;
|
||||
|
||||
if (isset($useSSL))
|
||||
$this->ssl = $useSSL;
|
||||
else
|
||||
@@ -116,16 +119,16 @@ class FrontControllerCore extends Controller
|
||||
|
||||
// If we call a SSL controller without SSL or a non SSL controller with SSL, we redirect with the right protocol
|
||||
if (Configuration::get('PS_SSL_ENABLED') && ($_SERVER['REQUEST_METHOD'] != 'POST') && $this->ssl != Tools::usingSecureMode())
|
||||
{
|
||||
{
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Cache-Control: no-cache');
|
||||
if ($this->ssl)
|
||||
if ($this->ssl)
|
||||
header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
|
||||
else
|
||||
else
|
||||
header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if ($this->ajax)
|
||||
{
|
||||
$this->display_header = false;
|
||||
@@ -144,8 +147,6 @@ class FrontControllerCore extends Controller
|
||||
// Init cookie language
|
||||
// @TODO This method must be moved into switchLanguage
|
||||
Tools::setCookieLanguage($this->context->cookie);
|
||||
|
||||
$currency = Tools::setCurrency($this->context->cookie);
|
||||
|
||||
$protocol_link = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https://' : 'http://';
|
||||
$useSSL = ((isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED')) || Tools::usingSecureMode()) ? true : false;
|
||||
@@ -167,6 +168,8 @@ class FrontControllerCore extends Controller
|
||||
if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault))
|
||||
$this->context->country = $newDefault;
|
||||
|
||||
$currency = Tools::setCurrency($this->context->cookie);
|
||||
|
||||
if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id)))
|
||||
{
|
||||
$this->context->customer->logout();
|
||||
@@ -333,7 +336,8 @@ class FrontControllerCore extends Controller
|
||||
'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
|
||||
'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE') || !(bool)Group::getCurrent()->show_prices,
|
||||
'b2b_enable' => (bool)Configuration::get('PS_B2B_ENABLE'),
|
||||
'request' => $link->getPaginationLink(false, false, false, true)
|
||||
'request' => $link->getPaginationLink(false, false, false, true),
|
||||
'PS_STOCK_MANAGEMENT' => Configuration::get('PS_STOCK_MANAGEMENT')
|
||||
));
|
||||
|
||||
// Add the tpl files directory for mobile
|
||||
@@ -511,7 +515,7 @@ class FrontControllerCore extends Controller
|
||||
if (Configuration::get('PS_CSS_THEME_CACHE'))
|
||||
$this->css_files = Media::cccCSS($this->css_files);
|
||||
//JS compressor management
|
||||
if (Configuration::get('PS_JS_THEME_CACHE'))
|
||||
if (Configuration::get('PS_JS_THEME_CACHE') && !$this->context->getMobileDevice())
|
||||
$this->js_files = Media::cccJs($this->js_files);
|
||||
}
|
||||
|
||||
@@ -593,10 +597,10 @@ class FrontControllerCore extends Controller
|
||||
|
||||
protected function canonicalRedirection($canonical_url = '')
|
||||
{
|
||||
if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET')
|
||||
if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit'))
|
||||
return;
|
||||
|
||||
$match_url = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
$match_url = (Configuration::get('PS_SSL_ENABLED') && ($this->ssl || Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
$match_url = rawurldecode($match_url);
|
||||
if (!preg_match('/^'.Tools::pRegexp(rawurldecode($canonical_url), '/').'([&?].*)?$/', $match_url))
|
||||
{
|
||||
@@ -666,6 +670,7 @@ class FrontControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->context->cookie->iso_code_country) && $this->context->cookie->iso_code_country && !Validate::isLanguageIsoCode($this->context->cookie->iso_code_country))
|
||||
$this->context->cookie->iso_code_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
if (isset($this->context->cookie->iso_code_country) && ($id_country = Country::getByIso(strtoupper($this->context->cookie->iso_code_country))))
|
||||
@@ -1137,4 +1142,4 @@ class FrontControllerCore extends Controller
|
||||
'logo_url' => $logo
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class ModuleFrontControllerCore extends FrontController
|
||||
elseif (Tools::file_exists_cache($this->getTemplatePath().$template))
|
||||
$this->template = $this->getTemplatePath().$template;
|
||||
else
|
||||
throw new PrestaShopException("Template '$template'' not found");
|
||||
throw new PrestaShopException("Template '$template' not found");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
class HelperCore
|
||||
{
|
||||
public $currentIndex;
|
||||
public $table;
|
||||
public $table = 'configuration';
|
||||
public $identifier;
|
||||
public $token;
|
||||
public $toolbar_btn;
|
||||
|
||||
@@ -35,10 +35,8 @@ class HelperFormCore extends Helper
|
||||
/** @var array of forms fields */
|
||||
protected $fields_form = array();
|
||||
|
||||
/** @var array values of form fields */
|
||||
/** @var array values of form fields */
|
||||
public $fields_value = array();
|
||||
|
||||
public $table;
|
||||
public $name_controller = '';
|
||||
|
||||
/** @var string if not null, a title will be added on that list */
|
||||
|
||||
@@ -136,6 +136,9 @@ class HelperListCore extends Helper
|
||||
$this->_list = $list;
|
||||
$this->fields_list = $fields_display;
|
||||
|
||||
$this->orderBy = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderBy);
|
||||
$this->orderWay = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderWay);
|
||||
|
||||
// Display list header (filtering, pagination and column names)
|
||||
$tpl_vars['header'] = $this->displayListHeader();
|
||||
|
||||
@@ -259,7 +262,7 @@ class HelperListCore extends Helper
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)$tr['id_image'] : '').'.'.$this->imageType;
|
||||
else
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.Image::getImgFolderStatic($tr['id_image']).(int)$tr['id_image'].'.'.$this->imageType;
|
||||
$this->_list[$index][$key] = ImageManager::thumbnail($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);
|
||||
$this->_list[$index][$key] = ImageManager::thumbnail($path_to_image, $this->table.'_mini_'.$item_id.'_'.$this->context->shop->id.'.'.$this->imageType, 45, $this->imageType);
|
||||
}
|
||||
elseif (isset($params['icon']) && isset($tr[$key]) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default'])))
|
||||
{
|
||||
@@ -456,7 +459,7 @@ class HelperListCore extends Helper
|
||||
);
|
||||
|
||||
if ($this->specificConfirmDelete !== false)
|
||||
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : addcslashes(Tools::htmlentitiesDecodeUTF8(self::$cache_lang['DeleteItem'].$name), '\'');
|
||||
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\''));
|
||||
|
||||
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
|
||||
|
||||
@@ -522,9 +525,6 @@ class HelperListCore extends Helper
|
||||
isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null
|
||||
);
|
||||
|
||||
// Cleaning links
|
||||
if (Tools::getValue($this->table.'Orderby') && Tools::getValue($this->table.'Orderway'))
|
||||
$this->currentIndex = preg_replace('/&'.$this->table.'Orderby=([a-z _]*)&'.$this->table.'Orderway=([a-z]*)/i', '', $this->currentIndex);
|
||||
|
||||
if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1))
|
||||
$table_id = substr($this->identifier, 3, strlen($this->identifier));
|
||||
|
||||
+117
-73
@@ -118,6 +118,9 @@ abstract class ModuleCore
|
||||
|
||||
/** @var Smarty_Data */
|
||||
protected $smarty;
|
||||
|
||||
/** @var currentSmartySubTemplate */
|
||||
protected $current_subtemplate = null;
|
||||
|
||||
|
||||
const CACHE_FILE_MODULES_LIST = '/config/xml/modules_list.xml';
|
||||
@@ -292,15 +295,17 @@ abstract class ModuleCore
|
||||
else
|
||||
{
|
||||
if (!$upgrade_detail['number_upgraded'])
|
||||
$this->_errors[] = $this->l('None upgrades have been applied');
|
||||
$this->_errors[] = $this->l('No upgrade has been applied');
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $this->l('Upgraded from: ').$upgrade_detail['upgraded_from'].$this->l(' to ').
|
||||
$upgrade_detail['upgraded_to'];
|
||||
$this->_errors[] = sprintf($this->l('Upgraded from: %S to %s'), $upgrade_detail['upgraded_from'], $upgrade_detail['upgraded_to']);
|
||||
$this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left');
|
||||
}
|
||||
|
||||
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off');
|
||||
if (isset($upgrade_detail['duplicate']) && $upgrade_detail['duplicate'])
|
||||
$this->_errors[] = sprintf(Tools::displayError('Module %s cannot be upgraded this time: please refresh this page to update it.'), $this->name);
|
||||
else
|
||||
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,19 +353,21 @@ abstract class ModuleCore
|
||||
$upgrade = &self::$modules_cache[$this->name]['upgrade'];
|
||||
foreach ($upgrade['upgrade_file_left'] as $num => $file_detail)
|
||||
{
|
||||
// Default variable required in the included upgrade file need to be set by default there:
|
||||
// upgrade_version, success_upgrade
|
||||
$upgrade_result = false;
|
||||
if (function_exists($file_detail['upgrade_function']))
|
||||
{
|
||||
$upgrade['success'] = false;
|
||||
$upgrade['duplicate'] = true;
|
||||
break;
|
||||
}
|
||||
include($file_detail['file']);
|
||||
|
||||
// Call the upgrade function if defined
|
||||
$upgrade['success'] = false;
|
||||
if (function_exists($file_detail['upgrade_function']))
|
||||
$upgrade_result = $file_detail['upgrade_function']($this);
|
||||
|
||||
$upgrade['success'] = $upgrade_result;
|
||||
$upgrade['success'] = $file_detail['upgrade_function']($this);
|
||||
|
||||
// Set detail when an upgrade succeed or failed
|
||||
if ($upgrade_result)
|
||||
if ($upgrade['success'])
|
||||
{
|
||||
$upgrade['number_upgraded'] += 1;
|
||||
$upgrade['upgraded_to'] = $file_detail['version'];
|
||||
@@ -378,6 +385,7 @@ abstract class ModuleCore
|
||||
}
|
||||
|
||||
$upgrade['number_upgrade_left'] = count($upgrade['upgrade_file_left']);
|
||||
|
||||
// Update module version in DB with the last succeed upgrade
|
||||
if ($upgrade['upgraded_to'])
|
||||
Module::upgradeModuleVersion($this->name, $upgrade['upgraded_to']);
|
||||
@@ -396,9 +404,9 @@ abstract class ModuleCore
|
||||
public static function upgradeModuleVersion($name, $version)
|
||||
{
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'module` m
|
||||
SET m.version = \''.bqSQL($version).'\'
|
||||
WHERE m.name = \''.bqSQL($name).'\'');
|
||||
UPDATE `'._DB_PREFIX_.'module` m
|
||||
SET m.version = \''.bqSQL($version).'\'
|
||||
WHERE m.name = \''.bqSQL($name).'\'');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1622,15 +1630,18 @@ abstract class ModuleCore
|
||||
|
||||
protected function getCacheId($name = null)
|
||||
{
|
||||
$cache_array = array(
|
||||
$name !== null ? $name : $this->name,
|
||||
(int)Tools::usingSecureMode(),
|
||||
(int)$this->context->shop->id,
|
||||
(int)Group::getCurrent()->id,
|
||||
(int)$this->context->language->id,
|
||||
(int)$this->context->currency->id,
|
||||
(int)$this->context->country->id
|
||||
);
|
||||
$cache_array = array();
|
||||
$cache_array[] = $name !== null ? $name : $this->name;
|
||||
if (Configuration::get('PS_SSL_ENABLED'))
|
||||
$cache_array[] = (int)Tools::usingSecureMode();
|
||||
if (Shop::isFeatureActive())
|
||||
$cache_array[] = (int)$this->context->shop->id;
|
||||
$cache_array[] = (int)Group::getCurrent()->id;
|
||||
if (Language::isMultiLanguageActivated())
|
||||
$cache_array[] = (int)$this->context->language->id;
|
||||
if (Currency::isMultiCurrencyActivated())
|
||||
$cache_array[] = (int)$this->context->currency->id;
|
||||
$cache_array[] = (int)$this->context->country->id;
|
||||
return implode('|', $cache_array);
|
||||
}
|
||||
|
||||
@@ -1648,20 +1659,35 @@ abstract class ModuleCore
|
||||
if ($cacheId !== null)
|
||||
Tools::enableCache();
|
||||
|
||||
$smarty_subtemplate = $this->context->smarty->createTemplate(
|
||||
$this->getTemplatePath($template),
|
||||
$cacheId,
|
||||
$compileId,
|
||||
$this->smarty
|
||||
);
|
||||
$result = $smarty_subtemplate->fetch();
|
||||
$result = $this->getCurrentSubTemplate($template, $cacheId, $compileId)->fetch();
|
||||
|
||||
if ($cacheId !== null)
|
||||
Tools::restoreCacheSettings();
|
||||
|
||||
$this->resetCurrentSubTemplate($template, $cacheId, $compileId);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null)
|
||||
{
|
||||
if (!isset($this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id]))
|
||||
{
|
||||
$this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id] = $this->context->smarty->createTemplate(
|
||||
$this->getTemplatePath($template),
|
||||
$cache_id,
|
||||
$compile_id,
|
||||
$this->smarty
|
||||
);
|
||||
}
|
||||
return $this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id];
|
||||
}
|
||||
|
||||
protected function resetCurrentSubTemplate($template, $cache_id, $compile_id)
|
||||
{
|
||||
$this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get realpath of a template of current module (check if template is overriden too)
|
||||
@@ -1678,10 +1704,12 @@ abstract class ModuleCore
|
||||
|
||||
if ($overloaded)
|
||||
return $overloaded;
|
||||
else if (file_exists(_PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template))
|
||||
elseif (file_exists(_PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template))
|
||||
return _PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template;
|
||||
else
|
||||
elseif (file_exists(_PS_MODULE_DIR_.$this->name.'/'.$template))
|
||||
return _PS_MODULE_DIR_.$this->name.'/'.$template;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function _getApplicableTemplateDir($template)
|
||||
@@ -1691,10 +1719,8 @@ abstract class ModuleCore
|
||||
|
||||
public function isCached($template, $cacheId = null, $compileId = null)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
Tools::enableCache();
|
||||
$is_cached = $context->smarty->isCached($this->getTemplatePath($template), $cacheId, $compileId);
|
||||
$is_cached = $this->getCurrentSubTemplate($this->getTemplatePath($template), $cacheId, $compileId)->isCached($this->getTemplatePath($template), $cacheId, $compileId);
|
||||
Tools::restoreCacheSettings();
|
||||
|
||||
return $is_cached;
|
||||
@@ -1703,6 +1729,8 @@ abstract class ModuleCore
|
||||
protected function _clearCache($template, $cache_id = null, $compile_id = null)
|
||||
{
|
||||
Tools::enableCache();
|
||||
if ($cache_id === null)
|
||||
$cache_id = $this->name;
|
||||
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath($template), $cache_id, $compile_id);
|
||||
Tools::restoreCacheSettings();
|
||||
}
|
||||
@@ -1721,7 +1749,15 @@ abstract class ModuleCore
|
||||
<need_instance>'.(int)$this->need_instance.'</need_instance>'.(isset($this->limited_countries) ? "\n\t".'<limited_countries>'.(count($this->limited_countries) == 1 ? $this->limited_countries[0] : '').'</limited_countries>' : '').'
|
||||
</module>';
|
||||
if (is_writable(_PS_MODULE_DIR_.$this->name.'/'))
|
||||
file_put_contents(_PS_MODULE_DIR_.$this->name.'/config.xml', $xml);
|
||||
{
|
||||
$file = _PS_MODULE_DIR_.$this->name.'/config.xml';
|
||||
if (!@file_put_contents($file, $xml))
|
||||
if (!is_writable($file))
|
||||
{
|
||||
@unlink($file);
|
||||
@file_put_contents($file, $xml);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1946,7 +1982,43 @@ abstract class ModuleCore
|
||||
$path = Autoload::getInstance()->getClassPath($classname.'Core');
|
||||
|
||||
// Check if there is already an override file, if not, we just need to copy the file
|
||||
if (!($classpath = Autoload::getInstance()->getClassPath($classname)))
|
||||
if (Autoload::getInstance()->getClassPath($classname))
|
||||
{
|
||||
// Check if override file is writable
|
||||
$override_path = _PS_ROOT_DIR_.'/'.Autoload::getInstance()->getClassPath($classname);
|
||||
if ((!file_exists($override_path) && !is_writable(dirname($override_path))) || (file_exists($override_path) && !is_writable($override_path)))
|
||||
throw new Exception(sprintf(Tools::displayError('file (%s) not writable'), $override_path));
|
||||
|
||||
// Get a uniq id for the class, because you can override a class (or remove the override) twice in the same session and we need to avoid redeclaration
|
||||
do $uniq = uniqid();
|
||||
while (class_exists($classname.'OverrideOriginal_remove', false));
|
||||
|
||||
// Make a reflection of the override class and the module override class
|
||||
$override_file = file($override_path);
|
||||
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal'.$uniq), implode('', $override_file)));
|
||||
$override_class = new ReflectionClass($classname.'OverrideOriginal'.$uniq);
|
||||
|
||||
$module_file = file($this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path);
|
||||
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override'.$uniq), implode('', $module_file)));
|
||||
$module_class = new ReflectionClass($classname.'Override'.$uniq);
|
||||
|
||||
// Check if none of the methods already exists in the override class
|
||||
foreach ($module_class->getMethods() as $method)
|
||||
if ($override_class->hasMethod($method->getName()))
|
||||
throw new Exception(sprintf(Tools::displayError('The method %1$s in the class %2$s is already overriden.'), $method->getName(), $classname));
|
||||
|
||||
// Check if none of the properties already exists in the override class
|
||||
foreach ($module_class->getProperties() as $property)
|
||||
if ($override_class->hasProperty($property->getName()))
|
||||
throw new Exception(sprintf(Tools::displayError('The property %1$s in the class %2$s is already defined.'), $property->getName(), $classname));
|
||||
|
||||
// Insert the methods from module override in override
|
||||
$copy_from = array_slice($module_file, $module_class->getStartLine() + 1, $module_class->getEndLine() - $module_class->getStartLine() - 2);
|
||||
array_splice($override_file, $override_class->getEndLine() - 1, 0, $copy_from);
|
||||
$code = implode('', $override_file);
|
||||
file_put_contents($override_path, $code);
|
||||
}
|
||||
else
|
||||
{
|
||||
$override_src = $this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path;
|
||||
$override_dest = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'override'.DIRECTORY_SEPARATOR.$path;
|
||||
@@ -1955,39 +2027,7 @@ abstract class ModuleCore
|
||||
copy($override_src, $override_dest);
|
||||
// Re-generate the class index
|
||||
Autoload::getInstance()->generateIndex();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if override file is writable
|
||||
$override_path = _PS_ROOT_DIR_.'/'.Autoload::getInstance()->getClassPath($classname);
|
||||
if ((!file_exists($override_path) && !is_writable(dirname($override_path))) || (file_exists($override_path) && !is_writable($override_path)))
|
||||
throw new Exception(sprintf(Tools::displayError('file (%s) not writable'), $override_path));
|
||||
|
||||
// Make a reflection of the override class and the module override class
|
||||
$override_file = file($override_path);
|
||||
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal'), implode('', $override_file)));
|
||||
$override_class = new ReflectionClass($classname.'OverrideOriginal');
|
||||
|
||||
$module_file = file($this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path);
|
||||
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override'), implode('', $module_file)));
|
||||
$module_class = new ReflectionClass($classname.'Override');
|
||||
|
||||
// Check if none of the methods already exists in the override class
|
||||
foreach ($module_class->getMethods() as $method)
|
||||
if ($override_class->hasMethod($method->getName()))
|
||||
throw new Exception(sprintf(Tools::displayError('The method %1$s in the class %2$s is already overriden.'), $method->getName(), $classname));
|
||||
|
||||
// Check if none of the properties already exists in the override class
|
||||
foreach ($module_class->getProperties() as $property)
|
||||
if ($override_class->hasProperty($property->getName()))
|
||||
throw new Exception(sprintf(Tools::displayError('The property %1$s in the class %2$s is already defined.'), $property->getName(), $classname));
|
||||
|
||||
// Insert the methods from module override in override
|
||||
$copy_from = array_slice($module_file, $module_class->getStartLine() + 1, $module_class->getEndLine() - $module_class->getStartLine() - 2);
|
||||
array_splice($override_file, $override_class->getEndLine() - 1, 0, $copy_from);
|
||||
$code = implode('', $override_file);
|
||||
file_put_contents($override_path, $code);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2009,14 +2049,18 @@ abstract class ModuleCore
|
||||
if (!is_writable($override_path))
|
||||
return false;
|
||||
|
||||
// Get a uniq id for the class, because you can override a class (or remove the override) twice in the same session and we need to avoid redeclaration
|
||||
do $uniq = uniqid();
|
||||
while (class_exists($classname.'OverrideOriginal_remove', false));
|
||||
|
||||
// Make a reflection of the override class and the module override class
|
||||
$override_file = file($override_path);
|
||||
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal_remove'), implode('', $override_file)));
|
||||
$override_class = new ReflectionClass($classname.'OverrideOriginal_remove');
|
||||
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal_remove'.$uniq), implode('', $override_file)));
|
||||
$override_class = new ReflectionClass($classname.'OverrideOriginal_remove'.$uniq);
|
||||
|
||||
$module_file = file($this->getLocalPath().'override/'.$path);
|
||||
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override_remove'), implode('', $module_file)));
|
||||
$module_class = new ReflectionClass($classname.'Override_remove');
|
||||
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override_remove'.$uniq), implode('', $module_file)));
|
||||
$module_class = new ReflectionClass($classname.'Override_remove'.$uniq);
|
||||
|
||||
// Remove methods from override file
|
||||
$override_file = file($override_path);
|
||||
|
||||
@@ -712,11 +712,10 @@ class OrderCore extends ObjectModel
|
||||
}
|
||||
|
||||
public function getCartRules()
|
||||
{
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_cart_rule` ocr
|
||||
LEFT JOIN `'._DB_PREFIX_.'cart_rule` cr ON cr.`id_cart_rule` = ocr.`id_cart_rule`
|
||||
WHERE ocr.`id_order` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@ class OrderCartRuleCore extends ObjectModel
|
||||
|
||||
/** @var float value (tax excl.) of voucher */
|
||||
public $value_tax_excl;
|
||||
|
||||
/** @var boolean value : voucher gives free shipping or not */
|
||||
public $free_shipping;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
@@ -59,7 +62,8 @@ class OrderCartRuleCore extends ObjectModel
|
||||
'id_order_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true),
|
||||
'value' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
|
||||
'value_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true)
|
||||
'value_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
|
||||
'free_shipping' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool')
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -125,8 +125,8 @@ class OrderHistoryCore extends ObjectModel
|
||||
.'&id_order='.(int)$order->id
|
||||
.'&secure_key='.$order->secure_key;
|
||||
$assign[$key]['link'] = $dl_link;
|
||||
if (isset($virtual_product['date_expiration']) && $virtual_product['date_expiration'] != '0000-00-00 00:00:00')
|
||||
$assign[$key]['deadline'] = Tools::displayDate($virtual_product['date_expiration ']);
|
||||
if (isset($virtual_product['download_deadline']) && $virtual_product['download_deadline'] != '0000-00-00 00:00:00')
|
||||
$assign[$key]['deadline'] = Tools::displayDate($virtual_product['download_deadline']);
|
||||
if ($product_download->nb_downloadable != 0)
|
||||
$assign[$key]['downloadable'] = (int)$product_download->nb_downloadable;
|
||||
}
|
||||
@@ -485,4 +485,4 @@ class OrderHistoryCore extends ObjectModel
|
||||
else
|
||||
return $this->add();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
WHERE od.`id_order` = '.(int)$this->id_order.'
|
||||
AND od.`id_order_invoice` = '.(int)$this->id.'
|
||||
AND od.`tax_computation_method` = '.(int)TaxCalculator::ONE_AFTER_ANOTHER_METHOD
|
||||
);
|
||||
) || Configuration::get('PS_INVOICE_TAXES_BREAKDOWN');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,7 +301,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
{
|
||||
// sum by order details in order to retrieve real taxes rate
|
||||
$taxes_infos = Db::getInstance()->executeS('
|
||||
SELECT odt.`id_order_detail`, t.`rate` AS `name`, SUM(od.`total_price_tax_excl`) AS total_price_tax_excl, SUM(t.`rate`) AS rate, SUM(`total_amount`) AS `total_amount`, od.`ecotax`, od.`ecotax_tax_rate`, od.`product_quantity`
|
||||
SELECT odt.`id_order_detail`, t.`rate` AS `name`, od.`total_price_tax_excl` AS total_price_tax_excl, SUM(t.`rate`) AS rate, SUM(`total_amount`) AS `total_amount`, od.`ecotax`, od.`ecotax_tax_rate`, od.`product_quantity`
|
||||
FROM `'._DB_PREFIX_.'order_detail_tax` odt
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = odt.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = odt.`id_order_detail`)
|
||||
|
||||
@@ -49,7 +49,7 @@ class OrderPaymentCore extends ObjectModel
|
||||
'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true),
|
||||
'payment_method' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
||||
'conversion_rate' => array('type' => self::TYPE_INT, 'validate' => 'isFloat'),
|
||||
'conversion_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'transaction_id' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
|
||||
'card_number' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
|
||||
'card_brand' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
|
||||
|
||||
@@ -129,19 +129,6 @@ class OrderSlipCore extends ObjectModel
|
||||
{
|
||||
$products[$key] = $product;
|
||||
$products[$key]['product_quantity'] = $slip_quantity[$product['id_order_detail']];
|
||||
if (count($cart_rules))
|
||||
{
|
||||
$order->setProductPrices($product);
|
||||
$realProductPrice = $products[$key]['product_price'];
|
||||
// Todo : must be updated to use the cart rules
|
||||
foreach ($cart_rules as $cart_rule)
|
||||
{
|
||||
if ($cart_rule['reduction_percent'])
|
||||
$products[$key]['product_price'] -= $realProductPrice * ($cart_rule['reduction_percent'] / 100);
|
||||
elseif ($cart_rule['reduction_amount'])
|
||||
$products[$key]['product_price'] -= (($cart_rule['reduction_amount'] * ($product['product_price_wt'] / $order->total_products_wt)) / (1.00 + ($product['tax_rate'] / 100)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $order->getProducts($products);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class HTMLTemplateDeliverySlipCore extends HTMLTemplate
|
||||
*/
|
||||
public function getFilename()
|
||||
{
|
||||
return Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id, null, $this->order->id_shop).sprintf('%06d', $this->order->invoice_number).'.pdf';
|
||||
return Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id, null, $this->order->id_shop).sprintf('%06d', $this->order->delivery_number).'.pdf';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class HTMLTemplateOrderReturnCore extends HTMLTemplate
|
||||
|
||||
// header informations
|
||||
$this->date = Tools::displayDate($this->order->invoice_date);
|
||||
$this->title = HTMLTemplateOrderReturn::l('Order Return ').sprintf('%06d', $this->order_return->id);
|
||||
$this->title = sprintf(HTMLTemplateOrderReturn::l('Order Return %s'), sprintf('%06d', $this->order_return->id));
|
||||
|
||||
// footer informations
|
||||
$this->shop = new Shop((int)$this->order->id_shop);
|
||||
|
||||
@@ -45,7 +45,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
|
||||
$this->smarty = $smarty;
|
||||
|
||||
// header informations
|
||||
$this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang);
|
||||
$this->date = Tools::displayDate($this->order_slip->date_add);
|
||||
$this->title = HTMLTemplateOrderSlip::l('Slip #').Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id).sprintf('%06d', (int)$this->order_slip->id);
|
||||
|
||||
// footer informations
|
||||
|
||||
@@ -45,7 +45,7 @@ class HTMLTemplateSupplyOrderFormCore extends HTMLTemplate
|
||||
$this->address_supplier = new Address(Address::getAddressIdBySupplierId((int)$supply_order->id_supplier));
|
||||
|
||||
// header informations
|
||||
$this->date = Tools::displayDate($supply_order->date_add, (int)$this->supply_order->id_lang);
|
||||
$this->date = Tools::displayDate($supply_order->date_add);
|
||||
$this->title = HTMLTemplateSupplyOrderForm::l('Supply order form');
|
||||
}
|
||||
|
||||
|
||||
@@ -363,10 +363,12 @@ class ShopCore extends ObjectModel
|
||||
// Define some $_SERVER variables like HTTP_HOST if PHP is launched with php-cli
|
||||
if (Tools::isPHPCLI())
|
||||
{
|
||||
if(!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
|
||||
if (!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
|
||||
$_SERVER['HTTP_HOST'] = $shop->domain;
|
||||
if(!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME']))
|
||||
if (!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME']))
|
||||
$_SERVER['SERVER_NAME'] = $shop->domain;
|
||||
if (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR']))
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -305,11 +305,7 @@ class StockAvailableCore extends ObjectModel
|
||||
if (!Validate::isUnsignedId($id_product))
|
||||
return false;
|
||||
|
||||
if ($id_shop === null)
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
|
||||
$existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop);
|
||||
|
||||
$existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, $id_shop);
|
||||
if ($existing_id > 0)
|
||||
{
|
||||
Db::getInstance()->update(
|
||||
|
||||
@@ -53,22 +53,15 @@ class TaxRulesGroupCore extends ObjectModel
|
||||
|
||||
protected static $_taxes = array();
|
||||
|
||||
public static function getTaxRulesGroups($only_active = true, $multiShop = false)
|
||||
public static function getTaxRulesGroups($only_active = true)
|
||||
{
|
||||
if ((bool)$multiShop) {
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT DISTINCT g.id_tax_rules_group, g.name, g.active
|
||||
FROM `'._DB_PREFIX_.'tax_rules_group` g'
|
||||
.Shop::addSqlAssociation('tax_rules_group', 'g')
|
||||
.($only_active ? ' WHERE g.`active` = 1' : '').'
|
||||
ORDER BY name ASC');
|
||||
} else {
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'tax_rules_group` g'
|
||||
.($only_active ? ' WHERE g.`active` = 1' : '').'
|
||||
ORDER BY name ASC');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,7 +80,7 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
|
||||
if (!empty($this->address->postcode))
|
||||
$postcode = $this->address->postcode;
|
||||
|
||||
if (!isset(self::$cache_tax_calculator[$postcode.'-'.$this->type]))
|
||||
if (!isset(self::$cache_tax_calculator[(int)$this->address->id_country.'-'.$postcode.'-'.$this->type]))
|
||||
{
|
||||
$rows = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
|
||||
@@ -1187,7 +1187,7 @@ class WebserviceRequestCore
|
||||
else
|
||||
{
|
||||
$object = new $this->resourceConfiguration['retrieveData']['className']();
|
||||
if ($object->isMultiShopField($this->resourceConfiguration['fields'][$fieldName]['sqlId']))
|
||||
if ($object->isMultiShopField($this->resourceConfiguration['fields'][$fieldName]['sqlId']) || $fieldName == 'id')
|
||||
$table_alias = 'multi_shop_'.$this->resourceConfiguration['retrieveData']['table'];
|
||||
else
|
||||
$table_alias = '';
|
||||
@@ -1260,32 +1260,39 @@ class WebserviceRequestCore
|
||||
if (!isset($this->urlFragments['display']))
|
||||
$this->fieldsToDisplay = 'full';
|
||||
|
||||
// Check if Object is accessible for this/those id_shop
|
||||
$assoc = Shop::getAssoTable($this->resourceConfiguration['retrieveData']['table']);
|
||||
if ($assoc !== false)
|
||||
{
|
||||
$sql = 'SELECT 1
|
||||
FROM `'.bqSQL(_DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table']);
|
||||
if ($assoc['type'] != 'fk_shop')
|
||||
$sql .= '_'.$assoc['type'];
|
||||
$sql .= '`';
|
||||
|
||||
foreach (self::$shopIDs as $id_shop)
|
||||
$OR[] = ' id_shop = '.(int)$id_shop.' ';
|
||||
|
||||
$check = ' WHERE ('.implode('OR', $OR).') AND `'.bqSQL($this->resourceConfiguration['fields']['id']['sqlId']).'` = '.(int)$this->urlSegment[1];
|
||||
if (!Db::getInstance()->getValue($sql.$check))
|
||||
$this->setError(403, 'Bad id_shop : You are not allowed to access this '.$this->resourceConfiguration['retrieveData']['className'].' ('.(int)$this->urlSegment[1].')', 131);
|
||||
}
|
||||
|
||||
//get entity details
|
||||
$object = new $this->resourceConfiguration['retrieveData']['className']((int)$this->urlSegment[1]);
|
||||
if ($object->id)
|
||||
{
|
||||
$objects[] = $object;
|
||||
// Check if Object is accessible for this/those id_shop
|
||||
$assoc = Shop::getAssoTable($this->resourceConfiguration['retrieveData']['table']);
|
||||
if ($assoc !== false)
|
||||
{
|
||||
$check_shop_group = false;
|
||||
|
||||
$sql = 'SELECT 1
|
||||
FROM `'.bqSQL(_DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table']);
|
||||
if ($assoc['type'] != 'fk_shop')
|
||||
$sql .= '_'.$assoc['type'];
|
||||
else
|
||||
{
|
||||
$def = ObjectModel::getDefinition($this->resourceConfiguration['retrieveData']['className']);
|
||||
if (isset($def['fields']) && isset($def['fields']['id_shop_group']))
|
||||
$check_shop_group = true;
|
||||
}
|
||||
$sql .= '`';
|
||||
|
||||
foreach (self::$shopIDs as $id_shop)
|
||||
$OR[] = ' (id_shop = '.(int)$id_shop.($check_shop_group ? ' OR (id_shop = 0 AND id_shop_group='.(int)Shop::getGroupFromShop((int)$id_shop).')' : '').') ';
|
||||
|
||||
$check = ' WHERE ('.implode('OR', $OR).') AND `'.bqSQL($this->resourceConfiguration['fields']['id']['sqlId']).'` = '.(int)$this->urlSegment[1];
|
||||
if (!Db::getInstance()->getValue($sql.$check))
|
||||
$this->setError(404, 'This '.$this->resourceConfiguration['retrieveData']['className'].' ('.(int)$this->urlSegment[1].') does not exists on this shop', 131);
|
||||
}
|
||||
return $objects;
|
||||
}
|
||||
elseif (!count($this->errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$this->objOutput->setStatus(404);
|
||||
$this->_outputEnabled = false;
|
||||
|
||||
@@ -62,8 +62,10 @@ function smartyTranslate($params, &$smarty)
|
||||
else
|
||||
$msg = $params['s'];
|
||||
|
||||
if ($msg != $params['s'])
|
||||
$msg = $params['js'] ? addslashes($msg) : stripslashes($msg);
|
||||
if ($msg != $params['s'] && !$params['js'])
|
||||
$msg = stripslashes($msg);
|
||||
elseif ($params['js'])
|
||||
$msg = addslashes($msg);
|
||||
|
||||
if ($params['sprintf'] !== null)
|
||||
$msg = Translate::checkAndReplaceArgs($msg, $params['sprintf']);
|
||||
|
||||
@@ -77,7 +77,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
parent::initToolbar();
|
||||
if (!$this->display)
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=addresses',
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Attribute type:'),
|
||||
'label' => $this->l('Attribute group:'),
|
||||
'name' => 'id_attribute_group',
|
||||
'required' => true,
|
||||
'options' => array(
|
||||
@@ -272,7 +272,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
'id' => 'id_attribute_group',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => $this->l('Choose the type of the attribute')
|
||||
'desc' => $this->l('Choose the group of the attribute')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
class AdminCarrierWizardControllerCore extends AdminController
|
||||
{
|
||||
protected $wizard_access;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->display = 'view';
|
||||
@@ -38,13 +38,16 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$this->deleted = true;
|
||||
$this->step_number = 0;
|
||||
|
||||
$this->multishop_context = Shop::CONTEXT_ALL;
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->fieldImageSettings = array(
|
||||
'name' => 'logo',
|
||||
'dir' => 's'
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
|
||||
|
||||
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, Tab::getIdFromClassName('AdminCarriers'));
|
||||
}
|
||||
|
||||
@@ -68,7 +71,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
'title' => $this->l('Shipping locations and costs'),
|
||||
),
|
||||
array(
|
||||
'title' => $this->l('Size, weight, and group access'),
|
||||
'title' => $this->l('Size, weight, and group access'),
|
||||
),
|
||||
array(
|
||||
'title' => $this->l('Summary'),
|
||||
@@ -81,7 +84,6 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$multistore_step = array(
|
||||
array(
|
||||
'title' => $this->l('MultiStore'),
|
||||
'desc' => $this->l('MultiStore'),
|
||||
)
|
||||
);
|
||||
array_splice($this->wizard_steps['steps'], 1, 0, $multistore_step);
|
||||
@@ -96,7 +98,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$carrier = $this->loadObject();
|
||||
elseif ($this->tabAccess['add'])
|
||||
$carrier = new Carrier();
|
||||
|
||||
|
||||
if ((!$this->tabAccess['edit'] && Tools::getValue('id_carrier')) || (!$this->tabAccess['add'] && !Tools::getValue('id_carrier')))
|
||||
{
|
||||
$this->errors[] = Tools::displayError('You do not have permission to use this wizard.');
|
||||
@@ -110,6 +112,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
'wizard_steps' => $this->wizard_steps,
|
||||
'validate_url' => $this->context->link->getAdminLink('AdminCarrierWizard'),
|
||||
'carrierlist_url' => $this->context->link->getAdminLink('AdminCarriers').'&conf='.((int)Validate::isLoadedObject($carrier) ? 4 : 3),
|
||||
'multistore_enable' => Shop::isFeatureActive(),
|
||||
'wizard_contents' => array(
|
||||
'contents' => array(
|
||||
0 => $this->renderStepOne($carrier),
|
||||
@@ -119,14 +122,14 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
)),
|
||||
'labels' => array('next' => $this->l('Next'), 'previous' => $this->l('Previous'), 'finish' => $this->l('Finish'))
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
array_splice($this->tpl_view_vars['wizard_contents']['contents'], 1, 0, array(0 => $this->renderStepTwo($carrier)));
|
||||
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'carrier_logo' => (Validate::isLoadedObject($carrier) && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg') ? _THEME_SHIP_DIR_.$carrier->id.'.jpg' : false)
|
||||
));
|
||||
'carrier_logo' => (Validate::isLoadedObject($carrier) && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg') ? _THEME_SHIP_DIR_.$carrier->id.'.jpg' : false)
|
||||
));
|
||||
$this->content .= $this->createTemplate('logo.tpl')->fetch();
|
||||
$this->addjQueryPlugin(array('ajaxfileupload'));
|
||||
|
||||
@@ -136,7 +139,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
public function initToolbarTitle()
|
||||
{
|
||||
$bread_extended = array_unique($this->breadcrumbs);
|
||||
|
||||
|
||||
if (Tools::getValue('id_carrier'))
|
||||
$bread_extended[1] = $this->l('Edit');
|
||||
else
|
||||
@@ -144,13 +147,13 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
|
||||
$this->toolbar_title = $bread_extended;
|
||||
}
|
||||
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
$this->toolbar_btn['back']['href'] = $this->context->link->getAdminLink('AdminCarriers');
|
||||
}
|
||||
|
||||
|
||||
public function renderStepOne($carrier)
|
||||
{
|
||||
$this->fields_form = array(
|
||||
@@ -201,7 +204,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
),
|
||||
)),
|
||||
);
|
||||
|
||||
|
||||
$tpl_vars = array('max_image_size' => (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE') / 1024 / 1024);
|
||||
$fields_value = $this->getStepOneFieldsValues($carrier);
|
||||
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
|
||||
@@ -305,10 +308,6 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'zone',
|
||||
'name' => 'zones'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Out-of-range behavior:'),
|
||||
@@ -329,18 +328,23 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
),
|
||||
'desc' => $this->l('Out-of-range behavior occurs when no defined range matches the customer\'s cart (e.g. when the weight of the cart is greater than the highest weight limit defined by the weight ranges)')
|
||||
)
|
||||
,
|
||||
array(
|
||||
'type' => 'zone',
|
||||
'name' => 'zones'
|
||||
),
|
||||
|
||||
));
|
||||
|
||||
),
|
||||
|
||||
));
|
||||
|
||||
$tpl_vars = array();
|
||||
$tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT');
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$tpl_vars['currency_sign'] = $currency->sign;
|
||||
|
||||
|
||||
$fields_value = $this->getStepThreeFieldsValues($carrier);
|
||||
|
||||
$this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
|
||||
$this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
|
||||
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
|
||||
}
|
||||
|
||||
@@ -352,34 +356,31 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maximum package height ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
|
||||
'label' => sprintf($this->l('Maximum package height (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
|
||||
'name' => 'max_height',
|
||||
'required' => false,
|
||||
'size' => 10,
|
||||
'desc' => $this->l('Maximum height managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
|
||||
.')
|
||||
'desc' => $this->l('Maximum height managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maximum package width ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
|
||||
'label' => sprintf($this->l('Maximum package width (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
|
||||
'name' => 'max_width',
|
||||
'required' => false,
|
||||
'size' => 10,
|
||||
'desc' => $this->l('Maximum width managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
|
||||
.')
|
||||
'desc' => $this->l('Maximum width managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maximum package depth ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
|
||||
'label' => sprintf($this->l('Maximum package depth (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
|
||||
'name' => 'max_depth',
|
||||
'required' => false,
|
||||
'size' => 10,
|
||||
'desc' => $this->l('Maximum depth managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
|
||||
.')
|
||||
'desc' => $this->l('Maximum depth managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maximum package weight ('.Configuration::get('PS_WEIGHT_UNIT').'):'),
|
||||
'label' => sprintf($this->l('Maximum package weight (%s):'), Configuration::get('PS_WEIGHT_UNIT')),
|
||||
'name' => 'max_weight',
|
||||
'required' => false,
|
||||
'size' => 10,
|
||||
@@ -394,7 +395,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$fields_value = $this->getStepFourFieldsValues($carrier);
|
||||
|
||||
// Added values of object Group
|
||||
@@ -404,14 +405,14 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
foreach ($carrier_groups as $carrier_group)
|
||||
$carrier_groups_ids[] = $carrier_group['id_group'];
|
||||
|
||||
$groups = Group::getGroups($this->context->language->id);
|
||||
$groups = Group::getGroups($this->context->language->id);
|
||||
|
||||
foreach ($groups as $group)
|
||||
$fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids) || empty($carrier_groups_ids) && !$carrier->id));
|
||||
|
||||
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value);
|
||||
}
|
||||
|
||||
|
||||
public function renderStepFive($carrier)
|
||||
{
|
||||
$this->fields_form = array(
|
||||
@@ -441,20 +442,20 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$template = $this->createTemplate('controllers/carrier_wizard/summary.tpl');
|
||||
|
||||
|
||||
$fields_value = $this->getStepFiveFieldsValues($carrier);
|
||||
|
||||
|
||||
$active_form = $this->renderGenericForm(array('form' => $this->fields_form), $fields_value);
|
||||
|
||||
|
||||
$active_form = str_replace(array('<fieldset id="fieldset_form">', '</fieldset>'), '', $active_form);
|
||||
|
||||
|
||||
$template->assign('active_form', $active_form);
|
||||
|
||||
|
||||
return $template->fetch('controllers/carrier_wizard/summary.tpl');
|
||||
}
|
||||
|
||||
|
||||
protected function getTplRangesVarsAndValues($carrier, &$tpl_vars, &$fields_value)
|
||||
{
|
||||
$tpl_vars['zones'] = Zone::getZones(false);
|
||||
@@ -464,13 +465,13 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
foreach ($carrier_zones as $carrier_zone)
|
||||
$carrier_zones_ids[] = $carrier_zone['id_zone'];
|
||||
|
||||
$range_table = $carrier->getRangeTable();
|
||||
$range_table = $carrier->getRangeTable();
|
||||
$shipping_method = $carrier->getShippingMethod();
|
||||
|
||||
|
||||
$zones = Zone::getZones(false);
|
||||
foreach ($zones as $zone)
|
||||
$fields_value['zones'][$zone['id_zone']] = Tools::getValue('zone_'.$zone['id_zone'], (in_array($zone['id_zone'], $carrier_zones_ids)));
|
||||
|
||||
|
||||
if ($shipping_method == Carrier::SHIPPING_METHOD_FREE)
|
||||
{
|
||||
$range_obj = $carrier->getRangeObject($carrier->shipping_method);
|
||||
@@ -511,10 +512,10 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$helper->id = (int)Tools::getValue('id_carrier');
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->tpl_vars = array_merge(array(
|
||||
'fields_value' => $fields_value,
|
||||
'languages' => $this->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
), $tpl_vars);
|
||||
'fields_value' => $fields_value,
|
||||
'languages' => $this->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
), $tpl_vars);
|
||||
$helper->override_folder = 'carrier_wizard/';
|
||||
|
||||
return $helper->generateForm($fields_form);
|
||||
@@ -540,9 +541,9 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
public function getStepThreeFieldsValues($carrier)
|
||||
{
|
||||
$id_tax_rules_group = (is_object($this->object) && !$this->object->id) ? Carrier::getIdTaxRulesGroupMostUsed() : $this->getFieldValue($carrier, 'id_tax_rules_group');
|
||||
|
||||
|
||||
$shipping_handling = (is_object($this->object) && !$this->object->id) ? 0 : $this->getFieldValue($carrier, 'shipping_handling');
|
||||
|
||||
|
||||
return array(
|
||||
'is_free' => $this->getFieldValue($carrier, 'is_free'),
|
||||
'id_tax_rules_group' => (int)$id_tax_rules_group,
|
||||
@@ -561,15 +562,15 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
'max_width' => $this->getFieldValue($carrier, 'max_width'),
|
||||
'max_depth' => $this->getFieldValue($carrier, 'max_depth'),
|
||||
'max_weight' => $this->getFieldValue($carrier, 'max_weight'),
|
||||
'group' => $this->getFieldValue($carrier, 'group'),
|
||||
'group' => $this->getFieldValue($carrier, 'group'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function getStepFiveFieldsValues($carrier)
|
||||
{
|
||||
return array('active' => $this->getFieldValue($carrier, 'active'));
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessChangeRanges()
|
||||
{
|
||||
if ((Validate::isLoadedObject($this->object) && !$this->tabAccess['edit']) || !$this->tabAccess['add'])
|
||||
@@ -589,17 +590,17 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$template = $this->createTemplate('controllers/carrier_wizard/helpers/form/form_ranges.tpl');
|
||||
$template->assign($tpl_vars);
|
||||
$template->assign('change_ranges', 1);
|
||||
|
||||
|
||||
$template->assign('fields_value', $fields_value);
|
||||
$template->assign('input', array('type' => 'zone', 'name' => 'zones' ));
|
||||
|
||||
$template->assign('input', array('type' => 'zone', 'name' => 'zones' ));
|
||||
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$template->assign('currency_sign', $currency->sign);
|
||||
$template->assign('PS_WEIGHT_UNIT', Configuration::get('PS_WEIGHT_UNIT'));
|
||||
|
||||
|
||||
die($template->fetch());
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessValidateStep()
|
||||
{
|
||||
$step_number = (int)Tools::getValue('step_number');
|
||||
@@ -628,7 +629,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
}
|
||||
die(Tools::jsonEncode($return));
|
||||
}
|
||||
|
||||
|
||||
public function processRanges($id_carrier)
|
||||
{
|
||||
if (!$this->tabAccess['edit'] || !$this->tabAccess['add'])
|
||||
@@ -640,13 +641,13 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$carrier = new Carrier((int)$id_carrier);
|
||||
if (!Validate::isLoadedObject($carrier))
|
||||
return false;
|
||||
|
||||
|
||||
$range_inf = Tools::getValue('range_inf');
|
||||
$range_sup = Tools::getValue('range_sup');
|
||||
$range_type = Tools::getValue('shipping_method');
|
||||
|
||||
$fees = Tools::getValue('fees');
|
||||
|
||||
|
||||
$carrier->deleteDeliveryPrice($carrier->getRangeTable());
|
||||
if ($range_type != Carrier::SHIPPING_METHOD_FREE)
|
||||
{
|
||||
@@ -662,10 +663,10 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
$range = new RangeWeight((int)$key);
|
||||
$add_range = false;
|
||||
$add_range = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($range_type == Carrier::SHIPPING_METHOD_PRICE)
|
||||
{
|
||||
if (!RangePrice::rangeExist((int)$carrier->id, (float)$delimiter1, (float)$range_sup[$key]))
|
||||
@@ -683,7 +684,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$range->delimiter2 = (float)$range_sup[$key];
|
||||
$range->save();
|
||||
}
|
||||
|
||||
|
||||
if (!Validate::isLoadedObject($range))
|
||||
return false;
|
||||
$price_list = array();
|
||||
@@ -705,19 +706,20 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessUploadLogo()
|
||||
{
|
||||
if (!$this->tabAccess['edit'])
|
||||
die('<return result="error" message="'.Tools::displayError('You do not have permission to use this wizard.').'" />');
|
||||
|
||||
$allowedExtensions = array('jpeg', 'gif', 'png', 'jpg');
|
||||
|
||||
|
||||
$logo = (isset($_FILES['carrier_logo_input']) ? $_FILES['carrier_logo_input'] : false);
|
||||
if ($logo && !empty($logo['tmp_name']) && $logo['tmp_name'] != 'none'
|
||||
&& (!isset($logo['error']) || !$logo['error'])
|
||||
&& preg_match('/\.(jpe?g|gif|png)$/', $logo['name'])
|
||||
&& is_uploaded_file($logo['tmp_name']))
|
||||
&& is_uploaded_file($logo['tmp_name'])
|
||||
&& ImageManager::isRealImage($logo['tmp_name'], $logo['type']))
|
||||
{
|
||||
$file = $logo['tmp_name'];
|
||||
do $tmp_name = uniqid().'.jpg';
|
||||
@@ -730,18 +732,18 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
else
|
||||
die('<return result="error" message="Cannot upload file" />');
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessFinishStep()
|
||||
{
|
||||
$return = array('has_error' => false);
|
||||
|
||||
|
||||
if (!$this->tabAccess['edit'])
|
||||
$return = array(
|
||||
'has_error' => true,
|
||||
$return['errors'][] = Tools::displayError('You do not have permission to use this wizard.')
|
||||
);
|
||||
else
|
||||
{
|
||||
{
|
||||
if ($id_carrier = Tools::getValue('id_carrier'))
|
||||
{
|
||||
$current_carrier = new Carrier((int)$id_carrier);
|
||||
@@ -763,9 +765,9 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$this->changeGroups((int)$new_carrier->id);
|
||||
// Call of hooks
|
||||
Hook::exec('actionCarrierUpdate', array(
|
||||
'id_carrier' => (int)$current_carrier->id,
|
||||
'carrier' => $new_carrier
|
||||
));
|
||||
'id_carrier' => (int)$current_carrier->id,
|
||||
'carrier' => $new_carrier
|
||||
));
|
||||
$this->postImage($new_carrier->id);
|
||||
$this->changeZones($new_carrier->id);
|
||||
$new_carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'));
|
||||
@@ -782,14 +784,14 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$return['errors'][] = $this->l('An error occurred while saving this carrier.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($carrier->is_free)
|
||||
{
|
||||
//if carrier is free delete shipping cost
|
||||
$carrier->deleteDeliveryPrice('range_weight');
|
||||
$carrier->deleteDeliveryPrice('range_price');
|
||||
}
|
||||
|
||||
|
||||
if (Validate::isLoadedObject($carrier))
|
||||
{
|
||||
if (!$this->changeGroups((int)$carrier->id))
|
||||
@@ -803,7 +805,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('An error occurred while saving carrier zones.');
|
||||
}
|
||||
|
||||
|
||||
if (!$carrier->is_free)
|
||||
if (!$this->processRanges((int)$carrier->id))
|
||||
{
|
||||
@@ -842,7 +844,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
}
|
||||
die(Tools::jsonEncode($return));
|
||||
}
|
||||
|
||||
|
||||
protected function changeGroups($id_carrier, $delete = true)
|
||||
{
|
||||
$carrier = new Carrier((int)$id_carrier);
|
||||
@@ -865,34 +867,31 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
if (!isset($_POST['zone_'.$zone['id_zone']]) || !$_POST['zone_'.$zone['id_zone']])
|
||||
$return &= $carrier->deleteZone((int)$zone['id_zone']);
|
||||
}
|
||||
else
|
||||
if (isset($_POST['zone_'.$zone['id_zone']]) && $_POST['zone_'.$zone['id_zone']])
|
||||
$return &= $carrier->addZone((int)$zone['id_zone']);
|
||||
else
|
||||
if (isset($_POST['zone_'.$zone['id_zone']]) && $_POST['zone_'.$zone['id_zone']])
|
||||
$return &= $carrier->addZone((int)$zone['id_zone']);
|
||||
|
||||
return $return;
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
public static function getValidationRules()
|
||||
{
|
||||
$step_number = Tools::getValue('step_number');
|
||||
|
||||
|
||||
if ($step_number == 4 && !Shop::isFeatureActive() || $step_number == 5 && Shop::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
$step_fields = array(
|
||||
1 => array('name', 'delay', 'grade', 'url'),
|
||||
2 => array('is_free', 'id_tax_rules_group', 'shipping_handling', 'shipping_method', 'range_behavior'),
|
||||
3 => array('range_behavior', 'max_height', 'max_width', 'max_depth', 'max_weight'),
|
||||
4 => array(),
|
||||
);
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$multistore_field = array(array('shop'));
|
||||
$tmp = $step_fields;
|
||||
$step_fields = array(1 => $tmp[1]) + $multistore_field;
|
||||
array_shift($tmp);
|
||||
foreach ($tmp as $row)
|
||||
$step_field[] = $row;
|
||||
array_splice($step_fields, 1, 0, $multistore_field);
|
||||
}
|
||||
|
||||
$rules = Carrier::getValidationRules('Carrier');
|
||||
@@ -904,18 +903,18 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
{
|
||||
if(!in_array($field, $step_fields[$step_number]))
|
||||
unset($rules[$key_r][$key_f]);
|
||||
}
|
||||
}
|
||||
else if(!in_array($key_f, $step_fields[$step_number]))
|
||||
unset($rules[$key_r][$key_f]);
|
||||
unset($rules[$key_r][$key_f]);
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
||||
public static function displayFieldName($field)
|
||||
{
|
||||
return $field;
|
||||
}
|
||||
|
||||
|
||||
public function duplicateLogo($new_id, $old_id)
|
||||
{
|
||||
$old_logo = _PS_SHIP_IMG_DIR_.'/'.(int)$old_id.'.jpg';
|
||||
|
||||
@@ -101,54 +101,6 @@ class AdminCarriersControllerCore extends AdminController
|
||||
)
|
||||
);
|
||||
|
||||
$carrier_default_sort = array(
|
||||
array('value' => Carrier::SORT_BY_PRICE, 'name' => $this->l('Price')),
|
||||
array('value' => Carrier::SORT_BY_POSITION, 'name' => $this->l('Position'))
|
||||
);
|
||||
|
||||
$carrier_default_order = array(
|
||||
array('value' => Carrier::SORT_BY_ASC, 'name' => $this->l('Ascending')),
|
||||
array('value' => Carrier::SORT_BY_DESC, 'name' => $this->l('Descending'))
|
||||
);
|
||||
|
||||
$this->fields_options = array(
|
||||
'general' => array(
|
||||
'title' => $this->l('Carrier options'),
|
||||
'fields' => array(
|
||||
'PS_CARRIER_DEFAULT' => array(
|
||||
'title' => $this->l('Default carrier:'),
|
||||
'desc' => $this->l('Your shop\'s default carrier'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'identifier' => 'id_carrier',
|
||||
'list' => array_merge(
|
||||
array(
|
||||
-1 => array('id_carrier' => -1, 'name' => $this->l('Best price')),
|
||||
-2 => array('id_carrier' => -2, 'name' => $this->l('Best grade'))
|
||||
),
|
||||
Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true, false, false, null, Carrier::ALL_CARRIERS))
|
||||
),
|
||||
'PS_CARRIER_DEFAULT_SORT' => array(
|
||||
'title' => $this->l('Sort by:'),
|
||||
'desc' => $this->l('This will only be visible in the Front Office'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'identifier' => 'value',
|
||||
'list' => $carrier_default_sort
|
||||
),
|
||||
'PS_CARRIER_DEFAULT_ORDER' => array(
|
||||
'title' => $this->l('Order by:'),
|
||||
'desc' => $this->l('This will only be visible in the Front Office'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'identifier' => 'value',
|
||||
'list' => $carrier_default_order
|
||||
),
|
||||
),
|
||||
'submit' => array()
|
||||
)
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
@@ -518,7 +470,8 @@ class AdminCarriersControllerCore extends AdminController
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
else if ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
|
||||
/*
|
||||
else if ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
@@ -530,17 +483,20 @@ class AdminCarriersControllerCore extends AdminController
|
||||
else
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
}
|
||||
*/
|
||||
else if (isset($_GET['isFree'.$this->table]))
|
||||
{
|
||||
$this->processIsFree();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
|
||||
/*
|
||||
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
|
||||
|| (isset($_GET['delete'.$this->table]) && Tools::getValue('id_carrier') == Configuration::get('PS_CARRIER_DEFAULT')))
|
||||
$this->errors[] = $this->l('Please set another carrier as default before deleting this one.');
|
||||
else
|
||||
{
|
||||
*/
|
||||
// if deletion : removes the carrier from the warehouse/carrier association
|
||||
if (Tools::isSubmit('delete'.$this->table))
|
||||
{
|
||||
@@ -562,7 +518,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
}
|
||||
parent::postProcess();
|
||||
Carrier::cleanPositions();
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user