Compare commits

...

453 Commits

Author SHA1 Message Date
Damien Metzger c51fe5b22d // Changelog 1.5.6.0 2013-10-07 18:07:25 +02:00
Gregory Roussac 92ffb1eab1 Merge pull request #812 from djfm/release
[*] TR : updated Russian installer
2013-10-07 03:25:42 -07:00
Francois Gaillard f4610c06e0 [-] BO : Bug fix - Modules confirmation messages 2013-10-07 12:21:16 +02:00
djfm 2969a7f74c // updated Russian installer 2013-10-07 10:14:43 +00:00
Rémi Gaillard 1ed26e2d4e // default perms profiles 2013-10-07 12:13:59 +02:00
gRoussac 302260539b // Report from https://github.com/Lupul/PrestaShop/commit/ebf09792e95598c30d8ac2617c4eabdd571be475 2013-10-07 12:08:39 +02:00
gRoussac d125ca0a36 [-] FO : isVirtualCart was forced to false 2013-10-07 12:06:28 +02:00
gRoussac e3db5570d0 [-] BO : Retro compat, PS_ADMIN_DIR not defined //bad commit sorry 2013-10-07 11:24:42 +02:00
gRoussac 7a7da1097d [-] BO : Employee's default_tab may not exists, switching to AdminOrders 2013-10-07 10:53:03 +02:00
gRoussac df0a24d63c [-] BO : Retro compat, PS_ADMIN_DIR not defined 2013-10-07 10:47:41 +02:00
Damien Metzger d6ffb45eb1 Merge pull request #809 from djfm/kill_miss
[*] LO : Removed 'Miss' from the default genders because too country specific
2013-10-07 00:57:13 -07:00
djfm b6bba0c787 [*] LO : Removed 'Miss' from the default genders because too country specific 2013-10-07 07:53:19 +00:00
Rémi Gaillard b2b0c4f00b // remove debug 2013-10-04 18:45:18 +02:00
Rémi Gaillard 2aee99c0b0 [-] FO: Fix display of quantity discounts on product pages if the customer is allowable for multiple discount for the same quantity #PSCFV-10580 2013-10-04 18:37:30 +02:00
Jerome Nadaud 121fcdc39f // Fix list start 2013-10-04 16:56:35 +02:00
Vincent Augagneur fe6494bf35 //fixed bug PSCFV-10567 2013-10-04 16:33:50 +02:00
gRoussac a4b7fc942f [-] CORE : #PSCFV-10389 Avoid eventual empty Specific Price Rule 2013-10-04 14:11:42 +02:00
Rémi Gaillard fef8d2beac // Fix group reduction per category 2013-10-04 14:00:42 +02:00
Rémi Gaillard 6dacc07e62 // sometimes, translations files could not exist 2013-10-04 13:19:34 +02:00
Gregory Roussac f28131fe9b Merge pull request #795 from indesign47/patch-3
[-] BO : AdminImport add combinations available fields
2013-10-04 02:40:29 -07:00
indesign47 a92ced814a [-] BO : AdminImport add combinations available fields 2013-10-04 10:26:38 +02:00
Jerome Nadaud 3d8591c588 [-] MO : Blocklayered - Fix empty fancy box after template edit 2013-10-04 10:14:07 +02:00
Gregory Roussac 09ad15730b Merge pull request #794 from indesign47/release
[-] BO : AdminImport add adresses required fields
2013-10-04 01:02:46 -07:00
indesign47 6c9b71ee58 [-] BO : AdminImport add adresses required fields 2013-10-04 04:35:00 +02:00
indesign47 0af24ab034 [-] BO : AdminImport add adresses required fields 2013-10-04 04:31:51 +02:00
Rémi Gaillard f100027e5d [-] FO: packages should be splitted with advanced stock management when carrier is not associated to multiple warehouse 2013-10-03 19:21:49 +02:00
gRoussac 62d946ea68 [-] CORE : Fix bug #PSCFV-10179 Duplicate specific price records when updating a product 2013-10-03 18:41:06 +02:00
gRoussac 31f421153d [-] BO : Fix bug #PSCFV-9323 supplier_reference can be unset 2013-10-03 18:20:45 +02:00
gRoussac c75cda2429 [*] BO : AdminImport, retrieve separators and lang selected 2013-10-03 17:35:20 +02:00
Damien Metzger e7c860a3dd Merge pull request #792 from djfm/release
// remove backup files
2013-10-03 08:09:41 -07:00
djfm 8580dd0b39 // remove backup files 2013-10-03 15:02:16 +00:00
Damien Metzger 9e837d1ecc // No more translation packs in the ZIP (except for FR and EN), only remotes! 2013-10-03 16:35:54 +02:00
Rémi Gaillard 0662cd3b12 // don't need to clear smarty cache while installation 2013-10-03 16:29:31 +02:00
Damien Metzger 6c4a69ea0b Merge pull request #790 from djfm/release
// added tab translations to Bengali installer
2013-10-03 07:26:29 -07:00
djfm b92c9869a4 // added tab translations to Bengali installer 2013-10-03 14:20:08 +00:00
gRoussac 992cc6b437 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-10-03 16:10:37 +02:00
gRoussac 7f32e8d187 [-] BO : Fix bug #PSCFV-10064, could not import feature in multilang, thanks @E.Bigfoot 2013-10-03 16:09:43 +02:00
gRoussac cafe2ed9d2 [-] BO : Fix bug #PSCFV-10064, could not import deature in multilang, thanks @E.Bigfoot 2013-10-03 16:08:53 +02:00
gRoussac 8b2215eec5 // remove warning 2013-10-03 15:02:48 +02:00
gRoussac 0f288583ca [-] BO : Remove dead code in AdminImport 2013-10-03 14:57:03 +02:00
Damien Metzger 6e0c3e1aa2 // addFeatureValueImport partial fix 2013-10-03 12:24:35 +02:00
Jerome Nadaud 3585bf33c8 // Fix supply order change state save button 2013-10-03 11:49:16 +02:00
Rémi Gaillard f2e39488b6 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-10-03 10:33:58 +02:00
Rémi Gaillard e190c8df9f // small fix on import 2013-10-03 10:33:43 +02:00
Vincent Augagneur d1956572a5 //small fix on carrier wizard 2013-10-03 10:29:40 +02:00
Gregory Roussac ca1bc3daa8 Merge pull request #786 from kpodemski/patch-6
[-] CORE : Increasing the length of link_rewrite & name in Category.php
2013-10-03 01:24:22 -07:00
Krystian Podemski d87c816038 [*] CORE : Increasing the length of link_rewrite & name in Category.php
In database this fields have varchar(128) so let's give the user full size of fields
2013-10-03 10:20:45 +02:00
Gregory Roussac 3b75dd6785 Merge pull request #785 from djfm/pstw
[*] TR : Traditional Chines Installer
2013-10-03 00:54:48 -07:00
Jerome Nadaud 89d86793b0 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-10-03 09:12:01 +02:00
Jerome Nadaud 33b5971a7a [-] BO : FixBug #PSCFV-10558 - Invalid HTML markup. 2013-10-03 09:11:26 +02:00
djfm 711f5b0bdf [+] LO : Completed Traditional Chinese Installer 2013-10-03 06:57:53 +00:00
djfm 4668d8ffa2 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into pstw 2013-10-03 06:56:08 +00:00
gRoussac e9a3c98af9 [-] BO : Fix bug #PSCFV-8389 duplicates is SpecificPrice table 2013-10-02 18:57:45 +02:00
gRoussac da48cea96e [-] BO : AdminImport, tables are not truncated 2013-10-02 17:54:48 +02:00
Gregory Roussac a40356d21c Merge pull request #784 from djfm/release
// updated native translation packs
2013-10-02 08:50:29 -07:00
djfm 3a0081912d // updated native translation packs 2013-10-02 15:37:57 +00:00
gRoussac a027dbd061 [*] BO : Add category id in AdminSpecificPriceRule 2013-10-02 17:00:20 +02:00
Gregory Roussac 3d1d178bba Merge pull request #783 from ellisium/upper
[-] CORE : CART::BOTH should be Cart::Both
2013-10-02 16:35:37 +02:00
gRoussac fe7035aae9 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-10-02 15:48:44 +02:00
gRoussac 96be4068f5 // norms 2013-10-02 15:48:29 +02:00
Damien Metzger 250a9f17a2 [-] BO : managed decimal format in BO orders 2013-10-02 15:47:21 +02:00
gRoussac bf6a0e0077 [-] BO : Fix bug #PSCFV-5060 could not import supplier_combinations in combinations import 2013-10-02 15:46:11 +02:00
gRoussac c4e549db13 [-] BO : Fix #PSCFV-6482 could not import tags in deiffrent languages 2013-10-02 14:20:27 +02:00
Damien Metzger a876b13c1c [-] BO : fixed currency format on order creation 2013-10-02 12:10:54 +02:00
gRoussac c466320887 [-] Bo : Fix again #PSCFV-10474 again, not deleting start page after import 2013-10-01 19:11:51 +02:00
gRoussac a6e8af99f9 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-10-01 18:13:02 +02:00
gRoussac 6bbcbb536f [-] CORE : Cart rules not ordered by priority for PaymentModule 2013-10-01 18:12:15 +02:00
gRoussac 294384d9ea [-] CORE : Partial fix bug #PSCFV-10534 bad total_products_wt calculated without other cart rules 2013-10-01 18:11:54 +02:00
Gregory Roussac 953f0641e8 Merge pull request #778 from djfm/release
[*] TR : Installer Translations
2013-10-01 09:09:32 -07:00
gRoussac a5dc1ce6f6 [-] Bo : Fix again #PSCFV-10474 coul not export more than 300 products 2013-10-01 18:02:12 +02:00
djfm 172986a461 // changed help text 2013-10-01 15:06:33 +00:00
djfm 23df6cb875 // updated German installer translations 2013-10-01 14:52:04 +00:00
djfm 9e64ecc887 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-10-01 09:58:40 +00:00
Rémi Gaillard 9ad046677c [*] BO: Allow to breakdown the taxes when they are computed 2013-10-01 11:55:56 +02:00
Rémi Gaillard 4fcbde878d [-] BO: Fix total without tax in breakdown taxes when taxes are combined #PSCFV-10394 on the invoices 2013-10-01 11:18:11 +02:00
djfm e706b531bc // updated br, es, fr, ru installer translations 2013-10-01 08:41:03 +00:00
Gregory Roussac 97a25eb9c6 Merge pull request #774 from kpodemski/patch-4
[-] BO: translation mismatch
2013-10-01 01:15:24 -07:00
Rémi Gaillard ecb4ccfdda // Fix product visibility on Product::getAccessories and ProductSale::getBestSales #PSCFV-9760 2013-10-01 09:56:26 +02:00
Krystian Podemski 2b55944874 [-] BO: translation mismatch
Here is a form to edit the values ​​in the group, we do not need here "attribute type".
2013-10-01 08:38:04 +02:00
gRoussac 4a66bdcdf9 // report of https://github.com/PrestaShop/PrestaShop/commit/9b627bf9a28ffc2ce2a0b55bb88af0dd59544c55 2013-09-30 19:18:08 +02:00
gRoussac f899380e3b [-) BO : #PSCFV-10474 coul not export more than 300 products 2013-09-30 19:04:04 +02:00
Damien Metzger 9c04f1dace Merge pull request #748 from djfm/release
// fix PSCFV-8260, currency format containing spaces and RTL languages
2013-09-30 09:21:43 -07:00
djfm 1cce312aaa // orthograph 2013-09-30 16:15:53 +00:00
djfm f39c2c40cf Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-09-30 16:13:15 +00:00
gRoussac 7d764c5ce8 [-] BO : AdminImport, not matching by ref for updating 2013-09-30 11:50:51 +02:00
Rémi Gaillard b6f13648db [-] WS: Fix order by on id field on multishop entities 2013-09-30 10:29:54 +02:00
Rémi Gaillard 22173355a5 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-09-30 09:59:51 +02:00
Rémi Gaillard 06b6facc2d [-] BO: Fix #PSCFV-10488 filter by employee on logs tab 2013-09-30 09:59:33 +02:00
Jerome Nadaud e0e5f80767 [-] BO : FixBig #PSCFV-10442 - Members Cutomer Group list 2013-09-30 09:59:25 +02:00
djfm 67d0ac95b5 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-09-30 07:09:17 +00:00
gRoussac 813ef8bc7e [-] BO : Could not import empty linkrewrite for products and not matching refs 2013-09-27 19:22:10 +02:00
Gregory Roussac a4178a9fd2 Merge pull request #761 from nuzelac/patch-1
[-] BO : fix multilingual field validity in AdminProductsController
2013-09-27 19:07:56 +02:00
Fabio Chelly 6d8cc454e1 [-] MO productcomments: prevents guests to add comments when guest comment is disabled in backoffice
(cherry picked from commit 345d4cd)
2013-09-27 11:30:42 +02:00
djfm 66435cbf4a // grammar 2013-09-27 08:35:48 +00:00
Damien Metzger 84d8ccfa2b // Fixed language code consistency 2013-09-27 10:25:37 +02:00
djfm 2be5233584 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-09-27 08:03:47 +00:00
Gregory Roussac 33c2669692 Merge pull request #749 from enumag/patch-1
[-] FO : Fixed products without images
2013-09-27 10:00:48 +02:00
Gregory Roussac 6b30cc5084 Merge pull request #750 from djfm/psindonesia
[+] TR : Psindonesia
2013-09-27 00:57:20 -07:00
djfm 4e472fae50 // updated Indonesian installer 2013-09-27 07:16:23 +00:00
gRoussac 126c21d39a [*] BO : AdminImport, remove csv files 2013-09-26 18:34:18 +02:00
djfm 50bd3d613d // fix PSCFV-8260, currency format containing spaces and RTL languages 2013-09-26 16:29:40 +00:00
gRoussac 98148cfe03 // Adminimport revert sort order in select 2013-09-26 18:02:28 +02:00
gRoussac 4fc4ee721e [*] BO : Adminimport, check csv download path 2013-09-26 17:50:26 +02:00
gRoussac d3ad12e536 [*] BO : Add csv file download in AdminImport 2013-09-26 17:40:33 +02:00
gRoussac 8c1240cb2c [-] BO : Sort import files in select 2013-09-26 15:13:34 +02:00
Fabio Chelly 7a7a2fb8c3 [-] MO productcomments and loyalty: loyalty doesn't disconnect current user anymore 2013-09-26 14:19:08 +02:00
Gregory Roussac 47bf9a397a Merge pull request #745 from djfm/localization_packs
[*] TR : Localization packs
2013-09-26 14:17:13 +02:00
Gregory Roussac f3e36b896b Merge pull request #746 from Mainmich/patch-1
[-] MO : Blocklayered Fix pagination incompatibility
2013-09-26 14:16:51 +02:00
Gregory Roussac 1abb064958 Merge pull request #747 from djfm/psbengali
[+] TR : Added Bengali Installer
2013-09-26 05:14:28 -07:00
smartdatasoft 9109708944 // small improvements to Bengali installer 2013-09-26 11:44:28 +00:00
smartdatasoft e21eef3a87 // updated Bengali installer 2013-09-26 11:44:12 +00:00
smartdatasoft 3ded9549cf // Bengali installer translations 2013-09-26 11:43:58 +00:00
smartdatasoft 37170c74b3 [+] LO : Added Bengali installer 2013-09-26 11:39:58 +00:00
gRoussac 017d19330a // avoid SQL error 2013-09-26 11:10:44 +02:00
djfm 78c1dce528 [+] LO: Added Traditional Chinese installer 2013-09-26 08:23:16 +00:00
gRoussac 48d9c37590 [-] BO : Remove duplicate sql insert in setProductOutOfStock in monoshop 2013-09-25 18:41:52 +02:00
gRoussac 7486844222 [-] BO : Fix #PSCFV-10501 Remove fatal error 2013-09-25 18:02:06 +02:00
Damien Metzger 95a2b2a8a8 [*] BO : improved automatic language creation 2013-09-25 17:07:18 +02:00
Jerome Nadaud 757fe64217 [-] MO : FixBug #10460 - UTF8 bug on accented URL 2013-09-25 16:09:55 +02:00
Damien Metzger ae8c8218fd // Fixed ISO code of japanese todōfuken 2013-09-25 15:30:16 +02:00
djfm 54b3ac5a32 [+] TR : Added Indonesian installer 2013-09-25 09:41:59 +00:00
Gregory Roussac 7f9183b1d4 Merge pull request #743 from dlage/modules_update
[*] BO : Show modules update button even if module is not installed but not notices
2013-09-24 20:40:56 +02:00
gRoussac e900474b8e // remove notice 2013-09-24 19:01:08 +02:00
gRoussac 69cb20d5e8 [-] PDF : Report of https://github.com/enumag/PrestaShop/commit/9c939cceadebd58ad390fb4f108816e3c17c0275 2013-09-24 18:55:55 +02:00
gRoussac 6f840eceba [-] BO : Fix bug #PSCFV-9675 could not import non existent parent category 2013-09-24 18:00:01 +02:00
gRoussac 0f4781053b [-] BO : Bad entity pre selected in AdminImport 2013-09-24 17:08:33 +02:00
gRoussac 10d6e97aca [-] BO : Fix bug #PSCFV-10483, could not import other language product link_rewrite 2013-09-24 16:42:22 +02:00
gRoussac 3448027861 // report of pull request 737 2013-09-24 16:41:15 +02:00
gRoussac 89ac0bc439 [-] FO : Fix #PSCFV-10480 again, css fix 2013-09-24 16:34:18 +02:00
gRoussac c9b53685c5 // parse error 2013-09-24 15:44:56 +02:00
gRoussac 1cc92fc9c2 [-] CORE : Could not add too long tags 2013-09-24 15:40:18 +02:00
gRoussac 17323a04b6 [-] CORE : Missing tag max size 2013-09-24 15:10:14 +02:00
gRoussac 1d6593612f [-] FO : Fix #PSCFV-10480 again css fix 2013-09-24 12:21:10 +02:00
Rémi Gaillard 41af17e06b [-] BO: Fix data validation when iframe is allowed on some entities like CMS 2013-09-24 10:28:04 +02:00
Gregory Roussac aefab21a62 Merge pull request #735 from djfm/release
[*] LO : Use single quote as thousands separator for CHF currency
2013-09-23 09:54:01 -07:00
djfm d9a24d61ac // change comment 2013-09-23 16:37:13 +00:00
djfm 6195d0c319 [*] LO : Use single quote as thousands separator for CHF currency 2013-09-23 16:32:40 +00:00
gRoussac b3a425c73a [-] MO : Blockcart, wrong tbody 2013-09-23 18:20:35 +02:00
gRoussac ccb3179c1a [-] CORE : Partial fix for #PSCFV-10482 getCacheId is different in back office 2013-09-23 18:07:46 +02:00
Gregory Roussac b4547568a5 Merge pull request #734 from djfm/release
// no quotes around 1 in js=1 please
2013-09-23 08:38:57 -07:00
gRoussac d37f545058 [-] MO : Fix buig #PSCFV-10480 Blockcart too long cart_block_product_name 2013-09-23 17:26:36 +02:00
djfm 5c4de83e91 // no quotes around 1 in js=1 please 2013-09-23 15:20:26 +00:00
gRoussac 3b075e049b // bad commit 2013-09-23 16:33:44 +02:00
gRoussac 84dc75f57e [-] CORE : Fix bug #PSCFV-10471 Cart item count problem, unique_id grouping error for id_product and id_product_attribute 2013-09-23 16:32:38 +02:00
gRoussac 92382e347c [-] FO : Fix bug #PSCFV-10478 could not see auto added cart rule voucher on product page 2013-09-23 16:08:44 +02:00
gRoussac dedc59f1db [-] IN : FIX #PSCFV-10246 errors in stricts sql-mode, thanks @enumag 2013-09-23 15:17:15 +02:00
Rémi Gaillard c6222c51c8 // commit 6b47f5713e is missing 2013-09-23 11:36:15 +02:00
Fabio Chelly a1555c3fc8 Merge remote-tracking branch 'origin/development' into development 2013-09-23 11:24:26 +02:00
Fabio Chelly 31697fde3c [-] MO productcomments: confirmation message takes moderation mode into account 2013-09-23 11:24:14 +02:00
Jerome Nadaud 5206496f64 [-] BO : Fix Bug For new Fancy Box events 2013-09-23 11:22:51 +02:00
Jerome Nadaud cf82157d47 // oops 2013-09-23 10:48:56 +02:00
Jerome Nadaud 7dbb6088a4 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-23 10:42:30 +02:00
Rémi Gaillard 50bbf1a547 // small fix 2013-09-23 10:46:41 +02:00
Jerome Nadaud 32a7a28567 [-] MO : FixBug #PNM-1683 - Treeview problem 2013-09-23 10:42:10 +02:00
Rémi Gaillard a578cfb2e2 [-] FO: Fix #PSCFV-10461 2013-09-23 10:20:22 +02:00
gRoussac 39468476ab [-] CORE : #PSCFV-10461 customer group in getPriceStatic, pull request https://github.com/kpodemski/kp-PrestaShop/commit/361ebc72e09d00463bb7a7b7af670e3235ab6a5a 2013-09-23 09:50:12 +02:00
Damien Metzger 214b844ef7 // Removed useless tiny mce src 2013-09-20 18:52:42 +02:00
Damien Metzger 5c3b8015e5 [-] BO : fixed the redirection to a 404 page when loging in in the updater 2013-09-20 18:21:10 +02:00
Rémi Gaillard 7aa348eb93 // bad char 2013-09-20 15:48:22 +02:00
gRoussac e2a1f5101c [-] BO : Bad input radio names 2013-09-20 15:27:31 +02:00
gRoussac 7d05da1618 [-] IN : Lower by two flush limit in migrate_orders 2013-09-20 15:12:57 +02:00
gRoussac 429c9442a3 [*] CORE : bad else if in getTemplatePath 2013-09-20 15:10:14 +02:00
Rémi Gaillard 2dc91758c3 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-20 14:12:56 +02:00
Rémi Gaillard 9b878a33a8 // fix canonical and ssl page without ssl 2013-09-20 14:12:41 +02:00
Damien Metzger 7eb3b22829 [-] Installer : added the missing default tab in the employee 2013-09-20 14:06:38 +02:00
Rémi Gaillard e2ac223f4e Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-20 11:34:54 +02:00
Rémi Gaillard 5b7580d487 [-] MO: Fix time of smarty cache invalidation 2013-09-20 11:33:30 +02:00
Damien Metzger 1cebd5920e [*] Installer : added file check in order to check if everyhting has been successfuly uploaded 2013-09-20 11:09:22 +02:00
Fabio Chelly 4f639329e9 Merge remote-tracking branch 'origin/development' into development 2013-09-20 10:47:17 +02:00
Fabio Chelly 91ae972655 [-] MO mailalert : products alerts can be registered for multiple guests
#PNM-1669
2013-09-20 10:46:56 +02:00
Damien Metzger f8ca06d927 // Better cache depth management for smarty 2013-09-20 10:26:58 +02:00
Damien Metzger eb6600e840 // Blockcustomerprivacy should not be installed by default 2013-09-20 10:26:58 +02:00
Gregory Roussac 14cd72121a Merge pull request #732 from Ha99y/20130919_X-Robots
[*] CORE : Send noindex header to avoid ghost carts by bots
2013-09-20 00:52:49 -07:00
ha99y 42cdc988ac Send noindex header to avoid ghost carts by bots 2013-09-19 22:15:00 -07:00
Francois Gaillard 8c6aaa3c7d Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-19 17:31:42 +02:00
Francois Gaillard 63f4743134 [-] MO : PNM-1715 - Bug fix accented chars & ajax-cart 2013-09-19 17:31:35 +02:00
gRoussac e0b59082f9 [-] BO : Issue with domready on adminImport 2013-09-19 17:19:51 +02:00
gRoussac 0361d5db8d [-] BO : do not reaffect import_type for categories 2013-09-19 16:59:04 +02:00
gRoussac ea6ea955bb // licence 2013-09-19 16:39:21 +02:00
gRoussac 803b6ce8ec Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
Conflicts:
	controllers/admin/AdminImportController.php
2013-09-19 16:38:01 +02:00
gRoussac 0c511dead5 [*] FIX #PSCFV-8106 do not regenerate thumbnails if not 2013-09-19 16:28:19 +02:00
Rémi Gaillard 6b47f5713e // another fix for multishop fields in context all on product page 2013-09-19 09:48:46 +02:00
Rémi Gaillard 5eb4c93b8c [-] BO: Bad id for multishop checkbox on admin products - weird bug with active flag #PSCFV-9935 2013-09-18 19:35:56 +02:00
Rémi Gaillard e7286c44f2 // typo 2013-09-18 18:08:22 +02:00
gRoussac 4e1d6de9b0 [-] FO : Fix bug #PSCFV-10328 Set country currency if defined when geolocated 2013-09-18 17:57:00 +02:00
gRoussac 75a9629b8a Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-18 17:23:23 +02:00
gRoussac 27f14b9a31 [-] BO : Fix proces and save buttons for Modules and AdminControllers 2013-09-18 17:23:08 +02:00
Rémi Gaillard 70d48d0af1 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-18 17:19:18 +02:00
Rémi Gaillard f6dc81d0f1 // small fix for SSL 2013-09-18 17:19:03 +02:00
gRoussac 2e311410b2 [*] BO : Set import entity in cookie (#PSCFV-8214) 2013-09-18 17:02:00 +02:00
Rémi Gaillard 0452979ce7 [*] FO: Allow to enable SSL on all the pages 2013-09-18 16:30:34 +02:00
gRoussac 3aec242600 [-] MO : Editorial could not delete image 2013-09-18 16:16:36 +02:00
gRoussac 93aae26269 [-] Bo : Modules 'save' button not active 2013-09-18 15:41:30 +02:00
gRoussac f293562ea4 [-] BO : Fix bug #PSCFV-8214 import entity pre selected 2013-09-18 15:03:16 +02:00
Rémi Gaillard 66f46eee03 // Avoid exception if amount is null on addind an orderpayment 2013-09-18 14:29:01 +02:00
Vincent Augagneur 672da852c5 [-] BO - fixed bug #PSCFV-10178 2013-09-18 11:40:58 +02:00
Vincent Augagneur 965b8a1bf3 [-] BO - fixed bug #PSCFV-10286 - End range in summary of shipping wizard not correct when range number is a float 2013-09-18 11:18:26 +02:00
Rémi Gaillard 47c5f400ee // Add gender on order view 2013-09-17 16:30:47 +02:00
Vincent Augagneur 322654cacf //small fix with mode catalog and cart button 2013-09-17 14:54:38 +02:00
Vincent Augagneur 3151064daf //small fix on helper form && option 2013-09-17 12:18:37 +02:00
Rémi Gaillard e6e8efc19a [-] FO: Fix Product::getAttributesGroups() minimal_quantity/weight/available_date should be multishop 2013-09-17 11:58:12 +02:00
Rémi Gaillard 6ee6317fee // orderby position 2013-09-17 11:07:29 +02:00
gRoussac 2d5bd901f4 [*] CORE : Refactoring Tools::copy() as copy with context > PHP 5.3 2013-09-16 18:51:06 +02:00
gRoussac b9b4265517 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-16 17:18:56 +02:00
gRoussac 15dd1cf96f [-] BO : Fix bugPSCFV-10249 images copy when unix path 2013-09-16 17:16:11 +02:00
Gregory Roussac 1c58c1ea6b Merge pull request #726 from cinscaen/patch-1
[-] BO : Move product images in POST method in admin.js
2013-09-16 07:01:45 -07:00
CINS 852faeab7a Update admin.js
Lorsqu'un produit possède trop d'images, il est impossible de réordonner celle-ci car la valeur JSON fourni en URL (GET) est beaucoup trop longue. Il faut envoyer les données JSON en POST pour solutionner le problème de longueur.
---------
When a product has many pictures, we can't reorder them. The JSON value is too long in URL (GET). We need to send data with POST to avoid problem.
2013-09-16 15:57:44 +02:00
gRoussac 8504574ae1 [-] IN : Could not remove some tabs 2013-09-16 15:02:12 +02:00
Damien Metzger e68c124218 [-] FO : replace ucfirst by ucwords for the customer firstname #PSCFV-10396 2013-09-16 11:42:11 +02:00
gRoussac 08efa4e313 [-] IN : Fix bug #PSCFV-10382 add_module_to_hook retunrning false when hook not exists 2013-09-16 11:12:55 +02:00
Vincent Augagneur e0739ea1e0 Merge pull request #720 from makk1ntosh/development
//Added ui.button as dependency of ui.dialog
2013-09-16 01:35:25 -07:00
Damien Metzger 0e3d53321a [-] BO : limited the number of customers displayed in the group view to 100 in order to avoid memory usage error 2013-09-16 09:56:22 +02:00
Jerome Nadaud d7c1cd90bf Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-16 09:25:57 +02:00
Jerome Nadaud c0afb55d11 [-] BO : FixBug #PSCFV-9900 Double quote escape problem in delete button link 2013-09-16 09:25:10 +02:00
Gregory Roussac 3b9c125198 Merge pull request #723 from codeurWeb/patch-2
[+] MO : Blocknewproducts add hookHome
2013-09-14 08:58:14 -07:00
Julien 08373c0541 [+] Modules : add hookHome 2013-09-14 14:57:00 +02:00
gRoussac 73dd524de8 [-] BO : Could not order in AdminStatuses by ID or template 2013-09-14 00:05:45 +02:00
gRoussac 10472ef83c Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-13 17:57:06 +02:00
gRoussac 6da1228359 [-] BO : Fix bug #PSCFV-8407 can not customize feature column name if needed 2013-09-13 17:56:45 +02:00
makk1ntosh d0ef8cca8f Added ui.button as dependency of ui.dialog
While developing my own module, i've upgraded installation to latest version of PS and impacted a bug:

$('#something').dialog({...}); caused an error: t().button is not a function.



In my php code i had this:
$this->context->controller->addJqueryUI('ui.dialog');

i found that it doesn't load ui.button dependency.

Added 'ui.button' to classes/Media.php at the end of ui.dialog dependencies and all worked fine.
2013-09-13 08:02:47 -07:00
Jerome Nadaud 97ec6341e8 [-] BO ; Fix bug #PSCFV-10393 manufacturer filter 2013-09-13 15:39:30 +02:00
Rémi Gaillard 5363e75238 // small fix 2013-09-13 12:13:12 +02:00
Gregory Roussac a3d9643833 Merge pull request #719 from zimmi1/patch-4
Update Connection.php correction from 717
2013-09-13 02:59:06 -07:00
zimmi1 4f06b74a29 Update Connection.php correction from 717
I'm very very sorry, I produced an error with the last commit on this file: there was an error in parenthesis position on line 117. Line 117 should be as line 131.
(But how did I manage to make this wrong ???)
2013-09-13 11:56:50 +02:00
Gregory Roussac 61295e4e21 Merge pull request #717 from zimmi1/patch-2
[*] CORE : Speeding up sql queries in Connection
2013-09-13 02:09:25 -07:00
gRoussac d9bc07d030 [-] BO : quote badly decoded in customerThreads 2013-09-13 10:45:07 +02:00
Jerome Nadaud 3eb4d65fc9 [-] BO : Fix Bug #PSCFV-10331 check all from list 2013-09-13 10:26:08 +02:00
zimmi1 452f41df8d Speeding up sql queries
Searching for "DATE_ADD(date_add, INTERVAL 30 MINUTE) > now" needs for every line to add 30 minutes to the date. but it is the same operation as comparing "date_add > (now - 30 minutes).
It is faster because there is no DATE_ADD calculation.

The problem:
By profiling speed of my shop, this query appeared after about 3 months always as the absolute slowest query of the shop, needing about 15 to 30 ms to perform, because I have now nearly 700 connections to my shop (and it then browses the 700 lines)

A solution:
Removing DATE_ADD MySql function and using date() and time() functions of php for calculating only once the 30 min. difference.

Using this solution takes it down again to 0.8 to 1.3 ms.

I guess it is the same in case of bots (could be even worse as they can make thousands of connections).
2013-09-13 10:05:30 +02:00
gRoussac db4b69d10c [-] BO : Customer message twice encoded 2013-09-12 18:03:30 +02:00
gRoussac 5095b45e47 [-] BO : Fix bug, orders states not ordered by order state name 2013-09-12 15:09:21 +02:00
Rémi Gaillard 30591b7c28 // Typo 2013-09-12 15:04:47 +02:00
Rémi Gaillard f9b1f0ab5e [*] Core: don't re-generate the class_index.php file if a class is not known to avoid misuse of class_exists() 2013-09-12 15:03:23 +02:00
Francois Gaillard cc36eb2d27 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-12 14:32:22 +02:00
Francois Gaillard 53c1e56c51 [-] BO : Bug fix - Encoding & tips of the day 2013-09-12 14:32:02 +02:00
Gregory Roussac 8590b0e699 Merge pull request #716 from romainberger/typos
[*] FO : removed extra slash and point
2013-09-12 05:30:36 -07:00
romainberger 876be3b452 [*] FO : removed extra slash and point 2013-09-12 14:07:45 +02:00
gRoussac e5276ff531 [-] FO : 301 Redirect /iso_lang to /iso_lang/ url 2013-09-12 11:16:12 +02:00
gRoussac 90091d4f2c [-] BO : Do not copy link_rewrite from title if cms already has one 2013-09-12 10:50:04 +02:00
gRoussac 3870388e1c Merge branch 'mailalerts_real_multishop' of https://github.com/axome/PrestaShop into axome-mailalerts_real_multishop
Conflicts:
	modules/mailalerts/mailalerts.php
2013-09-12 10:09:25 +02:00
Rémi Gaillard ea1bdbc849 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-12 10:01:39 +02:00
Gregory Roussac f0297824d7 Merge pull request #709 from AgenceNetDesign/development
[-] MO : carriercompare fixed bug, override template's files in theme. Ticket #PNM-1691
2013-09-12 00:56:36 -07:00
Gregory Roussac c91a86740f Merge pull request #715 from Prestaspirit/patch-6
[-] MO : Blocklayered Fixed a bug when displaying textures
2013-09-12 00:55:28 -07:00
Prestaspirit a37033e478 [-] MO : Fixed a bug when displaying textures
Corrections links texture image in the blocklayered
2013-09-12 07:01:55 +02:00
Rémi Gaillard 9fa6c86a94 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-11 20:05:13 +02:00
Rémi Gaillard f4f3084c35 [-] Core: Set a remote addr with php-cli #PSCFV-10372 2013-09-11 16:40:33 +02:00
Rémi Gaillard a4d131eac9 [-] WS: Fix entities retrieve for some cases 2013-09-11 16:32:11 +02:00
gRoussac e2dac03baa Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-11 16:30:52 +02:00
gRoussac dfdbe39ee3 [-] BO : Small changes when creating vouchers in back office orders 2013-09-11 16:28:11 +02:00
Rémi Gaillard 31c94caebc [-] BO: Fix out of stock creation with multishop and stock sharing 2013-09-11 16:22:13 +02:00
Damien Metzger 4a3e0c5075 // Updated README.md 2013-09-11 16:11:28 +02:00
Rémi Gaillard c42d71b8f5 // oups 2013-09-11 16:06:23 +02:00
Rémi Gaillard 669c3791b5 [-] BO: Fix preview url with multishop 2013-09-11 15:55:25 +02:00
Rémi Gaillard 3e750490fe // chmod class_index 666 instead of 664 2013-09-11 15:16:15 +02:00
gRoussac 01be908e51 [-] CORE : Could not add several cart rules 2013-09-11 14:50:42 +02:00
gRoussac 9f12ff15be [-] BO : Fix possible Uncaught exception 'ReflectionException' when viewing AdminMeta 2013-09-11 10:30:40 +02:00
Gregory Roussac 53805f2b93 Merge pull request #712 from Prestaworks/patch-13
[-] MO : Customization data is not included in new order email.
2013-09-11 00:58:30 -07:00
Daniel 614e56283a Update mailalerts.php
Fixes issue where customization data is not included in new order email.
2013-09-11 10:49:34 +08:00
gRoussac 85a471a690 //bad commit , sorry for that 2013-09-10 18:51:20 +02:00
gRoussac 86d3a8afe1 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-10 18:49:05 +02:00
gRoussac f94f0f14a4 [-] FO : Fix bug #PSCFV-8917 taxes calculation when changing delivery address 2013-09-10 18:48:28 +02:00
Gregory Roussac 31d762b88a Merge pull request #710 from nilsga/development
[*] CORE : Add Bcc support in Mail class
2013-09-10 09:24:04 -07:00
Nils-Helge Garli Hegvik 9713f93075 Add Bcc support in Mail class 2013-09-10 17:11:34 +02:00
unknown c5afbc75bd [-] MO : carriercompare fixed bug, override template's files in theme. Ticket #PNM-1691 2013-09-10 12:01:38 +02:00
gRoussac 332d68c7ec [-] MO : Statsdata, exception on duplicate entry 2013-09-10 11:08:57 +02:00
Nicolas Sorosac f30a088848 [*] MO : MailAlerts : Add SQL update script for v2.5 2013-09-10 11:01:11 +02:00
Rémi Gaillard 3c090535a9 // small fix for image SSL links 2013-09-10 10:39:03 +02:00
Nicolas Sorosac c4681c1fb1 [*] MO : MailAlerts : multishop/multilang full compatibility
Customers will receive alerts based on the real context of the moment they subscribed to the alert (sho, theme & language)

SQL update table : `ps_mailalert_customer_oos`
=========================================

ALTER TABLE `ps_mailalert_customer_oos`
ADD `id_lang` INT( 10 ) UNSIGNED NOT NULL ,
DROP PRIMARY KEY ,
ADD PRIMARY KEY ( `id_customer` , `customer_email` , `id_product` , `id_product_attribute` , `id_shop` ) ;
2013-09-10 10:24:40 +02:00
Rémi Gaillard 021790a3e2 [-] FO: Fix SSL links on domain_ssl instead domain 2013-09-10 10:15:52 +02:00
gRoussac 4968a792b4 [-] IN : Remove notice when upgrading from 2013-09-10 01:12:52 +02:00
Gregory Roussac a383d55421 Merge pull request #707 from sjousse/development
[-] MO: ShopImporter fix imported prices
2013-09-09 08:31:15 -07:00
sjousse 00f3045690 fix imported prices 2013-09-09 17:24:27 +02:00
Gregory Roussac 5362f4d426 Merge pull request #699 from sjousse/patch-1
[*] MO : ShopImporter Optimize image copy in ShopImport module
2013-09-09 08:11:51 -07:00
Gregory Roussac 9880d152d4 Merge pull request #706 from sjousse/development
[*] MO : Add some fields to Orders in Import module
2013-09-09 08:10:12 -07:00
sjousse 990a889b1c Add some fields to Orders in Import module 2013-09-09 17:08:17 +02:00
gRoussac e6d0a3e5a4 // revert form https://github.com/PrestaShop/PrestaShop/commit/2874f1498352228c84df969c42e9d8f699a8afc5 2013-09-09 15:11:55 +02:00
Rémi Gaillard 242556e176 [-] MO: Fix unifunc smarty errors if module is displayed on multiplehook without cache 2013-09-09 15:12:26 +02:00
Jerome Nadaud c502c9766f [-] BO : FixBug PSCFV-10331 - Tax rules Pagination 2013-09-09 15:04:14 +02:00
gRoussac 54f7c65165 [-] BO : Display the old image system migration tool if product images are in _PS_PROD_IMG_DIR_ 2013-09-09 12:20:38 +02:00
Damien Metzger dcad699ede [-] FO : fixed chinese search with multiple symbols #PSCFV-10322 2013-09-09 11:19:11 +02:00
Francois Gaillard e1d0347757 [-] Classes : Bug fix - FrontController, mobile & JS minifier fixed 2013-09-09 10:17:15 +02:00
gRoussac b975a9375c [-] IN : remove warnings while upgrading 2013-09-09 00:10:03 +02:00
gRoussac 9c756a7fcb [-] IN : Do not duplicate images types when coming from 1.4, update it 2013-09-08 23:22:36 +02:00
gRoussac 6b03af9ef9 [-] BO : ini_get('safe_mode') can return false 2013-09-08 22:26:21 +02:00
gRoussac ec556bb307 // remove Warning on array_map() 2013-09-08 20:01:55 +02:00
gRoussac e6f8dba2e6 // remove Notice: Undefined index 2013-09-08 19:55:03 +02:00
gRoussac 25ba388d69 [-] IN : fix bad pathes 2013-09-08 18:29:06 +02:00
gRoussac e5337f5e76 [-] IN : Do not test module names if they are not directories 2013-09-08 18:25:54 +02:00
gRoussac 683513a9d2 [-] IN : Remove fails on upgrade coming to loop when upgrading again 2013-09-08 17:29:00 +02:00
gRoussac 19a6c4373e [-] IN : Remove warnings when safe_mode open_basedir missconfigured 2013-09-08 17:25:59 +02:00
gRoussac 2874f14983 [-] CORE : Fix bug #PSCFV-10040 Notice: Undefined index: unifunc && Fatal error: Function name must be a string on some PHP version with empty cache folder and smarty cache enabled 2013-09-06 23:55:58 +02:00
gRoussac 4c49048e39 [-] FO : Partial fix of adding gift on cart rule on the same entity in the cart rule 2013-09-06 18:35:56 +02:00
Fabio Chelly e5f53afd5f Merge remote-tracking branch 'origin/development' into development 2013-09-06 17:54:34 +02:00
Fabio Chelly 9377775eca [-] MO productcomments :
- Module was broken and works now
- A message is displayed to indicate when a comment has been added.
- Error li are correctly indented

#PNM-753
#PNM-1601
#PNM-1660
#PNM-1609
#PNM-1491
#PNM-1311
#PNM-1233
#PNM-1232
#PNM-937
#PNM-775
2013-09-06 17:54:12 +02:00
Francois Gaillard 768a8b36d5 [-] BO : AdminModulesController - Bug fix, $params was not set 2013-09-06 15:41:24 +02:00
Fabio Chelly 1b0c5be93d Merge remote-tracking branch 'origin/development' into development 2013-09-06 11:47:11 +02:00
Fabio Chelly 663f592306 [-] MO sendtoafriend : a message is displayed whether the e-mail has been sent or not
#PNM-627
#PNM-1610
#PNM-1616
2013-09-06 11:40:41 +02:00
Damien Metzger ec11b7e064 // Better control of the requests when our website is down 2013-09-06 10:18:48 +02:00
Fabio Chelly 7e1c0d5a24 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-06 09:24:43 +02:00
gRoussac 53241af228 // remove strict standard warning 2013-09-05 19:00:25 +02:00
gRoussac a7d619b208 [-] MO : fix bug #PSCFV-9906 again, bad url parsing 2013-09-05 18:39:07 +02:00
sjousse 6b080e1f02 Optimize image copy in ShopImport module
2 things :
- copy images to new folder structure instead of legacy one since it's a PS 1.5 branch
- don't create all sizes of images at migration, there's an Admin controller for that (Admin > Settings > Images). That's speed up the import and remove duplicate code (less code to support).

+ some cleaning of unused variables
2013-09-05 18:24:02 +02:00
Rémi Gaillard 0f81518ba2 // Add a buton to erase all log 2013-09-05 15:58:36 +02:00
gRoussac 6e5fb47642 [-] INSTALLER : Fix bug #PSCFV-8289 bad orders vouchers total after update 2013-09-05 15:31:13 +02:00
gRoussac 824a6b90f3 [-] FO : Fix bug #PSCFV-10118 quantity not updated when cart rules give the same product as gift 2013-09-05 11:07:41 +02:00
Gregory Roussac 284711b22f Merge pull request #697 from sjousse/patch-1
MO : Shopimporter change the way to get the home category (get it from Configuration )
2013-09-05 01:16:29 -07:00
sjousse 2f6e0e3fae Changed the way to get the home category (get it from Configuration table now) 2013-09-05 10:14:31 +02:00
Gregory Roussac d59f3383cf Merge pull request #694 from sjousse/patch-1
[*] MO : ShopImporter module is now aware of multi-shop for categories
2013-09-04 09:28:23 -07:00
sjousse 4d68595447 ShopImporter module is now aware of multi-shop
Imported categories was affected to Root category instead of a Shop's Home category.
I took the first shop home category is by default.
Maybe adding an option to choose the shop where the datas should be imported.
2013-09-04 18:26:24 +02:00
Gregory Roussac 07bdcd4129 Merge pull request #693 from sjousse/development
[-] MO : Add date_add field to categories to prevent failure of updateCat() method
2013-09-04 07:46:44 -07:00
sjousse e9d066c981 fix value of date_add 2013-09-04 16:40:12 +02:00
sjousse 56a1449c69 add date_add to categories 2013-09-04 16:32:00 +02:00
gRoussac 63c19ce1a9 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-04 15:39:25 +02:00
gRoussac 3ca2c8da95 [-] BO : Fix #PSCFV-9906 could not register search engines keywords 2013-09-04 15:39:02 +02:00
Rémi Gaillard 00c1860d22 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-04 15:08:41 +02:00
Rémi Gaillard 9348768ceb [-] MO: Fix blocklayered sort by quantity #PSCFV-10300 2013-09-04 15:05:55 +02:00
gRoussac 7b0349ca33 // bad commit sorry for that 2013-09-04 11:14:45 +02:00
gRoussac efa81a7107 [-] INSTALLER: Wrong SQL query for PS_LEGACY_IMAGES to 0 2013-09-04 11:14:00 +02:00
gRoussac da353c884d [-] INSTALLER: short_description for PREFIX_manufacturer_lang is now type TEXT 2013-09-04 10:45:48 +02:00
gRoussac df56d7af42 [-] CORE: Fix for field length and type regarding https://github.com/PrestaShop/PrestaShop/pull/678 2013-09-04 10:38:14 +02:00
Gregory Roussac 5d38743b72 Merge pull request #690 from Ha99y/20130903_addToolBarModulesListButton
[-] BO : Remove warning in AdminController.php
2013-09-04 00:40:41 -07:00
Jerome Nadaud 75a663b6e3 [-] BO : Fix pull request #665 2013-09-04 09:40:12 +02:00
ha99y f4892686c1 Warning in AdminController.php
If debugging is on (_PS_MODE_DEV_ set to TRUE)
On a fresh install there is a warning on line 1542 in
/classes/controller/AdminController.php in function
addToolBarModulesListButton().
Because of the warning xml files are not populated with data.

Warning: simplexml_load_file()
1: parser error : Document is empty
2013-09-03 17:30:05 -07:00
gRoussac b55a84e961 [-] INSTALLER : Fix infinite loop when order message has additional ampersand 2013-09-03 18:36:30 +02:00
gRoussac 6daf8ebbfa [-] BO : Fix error returned when first import of a localisation pack 2013-09-03 18:20:58 +02:00
gRoussac 5d8e187faa Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-03 17:43:51 +02:00
gRoussac 0891c986d6 // fix from comment https://github.com/PrestaShop/PrestaShop/commit/c6d2e1252e1757478339009ec7b48320b1ccd92ahttps://github.com/PrestaShop/PrestaShop/commit/c6d2e1252e1757478339009ec7b48320b1ccd92a#commitcomment-4002919 2013-09-03 17:43:33 +02:00
Gregory Roussac 8fedbe189c Merge pull request #682 from MyBB-Services/dev/sa/ordercartrulecleanup
[*] Project : Orders should rely only on ps_order_cart_rule
2013-09-03 06:41:06 -07:00
soufyan cd7d604b75 [*] Project : Orders should rely only on ps_order_cart_rule 2013-09-03 15:10:06 +02:00
Gregory Roussac 5caae97813 Merge pull request #680 from djfm/development
// fixed unstranslatable string in AdminSupplyOrdersController
2013-09-03 06:00:50 -07:00
djfm 572a2e45aa // fixed unstranslatable string in AdminSupplyOrdersController 2013-09-03 12:51:21 +00:00
gRoussac 98f60d039b // fix warning 2013-09-03 12:29:17 +02:00
Gregory Roussac 656717fb4c Merge pull request #679 from kluevandrew/patch-3
[*] BO : Cursor "pointer" for .button class
2013-09-03 00:51:38 -07:00
Gregory Roussac e08c8b2d25 Merge pull request #674 from PrestaEdit/patch-50
[*] BO: sort modules name in Stats
2013-09-03 00:49:11 -07:00
Andrew 97f1db480a BO: Cursor "pointer" for .button
Cursor "pointer" for each button in back office
2013-09-03 11:35:50 +04:00
Jerome Nadaud c3772fb355 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-02 19:11:17 +02:00
Jerome Nadaud da12fbdd5e [-] BO : FixBug #PSCFV-10213 check product/attribute id - Thanks F. Cespedes 2013-09-02 19:09:47 +02:00
gRoussac 94bdde4630 [-] CORE : Remove PHP Warning: file_put_contents on modules config.xml 2013-09-02 18:19:21 +02:00
Gregory Roussac abf5ad195c Merge pull request #676 from dlage/patch-1
[*] MO : blocknewproducts avoid $newProducts not defined
2013-09-02 08:58:32 -07:00
Gregory Roussac b2ccf88296 Merge pull request #663 from sjousse/patch-1
[-] MO : Shopimporter file_exists does not exists in Validate Class
2013-09-02 08:21:42 -07:00
Gregory Roussac f7eb6b3a16 Merge pull request #665 from Ha99y/Get-Combination-Images
[*] CLASSES : Add $id_product_attribute param to Image::getImages
2013-09-02 08:11:48 -07:00
Rémi Gaillard 6059b4301a // states list 2013-09-02 17:10:20 +02:00
gRoussac 36d9e0eed5 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-02 16:28:56 +02:00
gRoussac c6d2e1252e [-] INSTALLER : Fix fatal error in upgrade, could not load configuration class 2013-09-02 16:28:38 +02:00
Gregory Roussac fe209e0c55 Merge pull request #678 from gr4devel/patch-5
[*] BO : add TinyMCE editor for supplier descrpition in AdminSuppliers
2013-09-02 06:03:20 -07:00
gr4devel f535d60a29 [-] fix typo in adding TinyMCE editor for supplier descrpition in AdminSuppliersController 2013-09-02 14:24:18 +02:00
gr4devel 36ca7f294a [+] BO : add TinyMCE editor for supplier descrpition in AdminManufacturerSupplier 2013-09-02 14:15:33 +02:00
gRoussac 477457a44f Merge branch 'patch-1' of https://github.com/gr4devel/PrestaShop into gr4devel-patch-1 2013-09-02 12:03:01 +02:00
gr4devel 6177589cd3 [+] MO : add link to all manufacturer page and the feature to show All Suppliers 2013-09-02 11:57:16 +02:00
gRoussac 4853772198 [-] INSTALLER : no update value in fix_download_product_feature_active 2013-09-02 11:33:53 +02:00
gRoussac 62303e58df [-] INSTALLER : Fix fatal error when upgrading 2013-09-02 11:24:46 +02:00
Gregory Roussac 82939730dd Merge pull request #667 from Ha99y/Small-Autoload-Fix
[-] CORE : Remove warning on rename on index.php
2013-09-02 02:11:51 -07:00
gRoussac 397e42637a // norms 2013-09-02 10:49:50 +02:00
Gregory Roussac 6dc0edec3a Merge pull request #668 from lrosset/development
[-] CORE : Add APCu support
2013-09-02 01:46:25 -07:00
Gregory Roussac d019500d81 Merge pull request #670 from gr4devel/patch-2
[+] FO : add getManufacturer() to ManufacturerControllerCore
2013-09-02 01:31:14 -07:00
Gregory Roussac 00afa8ae47 Merge pull request #671 from gr4devel/patch-3
[+] BO : enable TinyMCE editor for short and long descrpition in AdminManufacturers
2013-09-02 01:09:10 -07:00
gRoussac a013be8380 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
Conflicts:
	modules/blockcart/ajax-cart.js
2013-09-02 10:00:24 +02:00
Gregory Roussac a436456fa4 Merge pull request #673 from sagaradonis/development
[*] FO : Deprecated .size() to .length
2013-09-02 00:31:05 -07:00
dlage 5f1e08e7e2 Fix variable context
Avoid attribution to the variable $newProducts inside the if. It caused the code to potentially misbehave throwing errors of:
"variable $newProducts not defined".
2013-09-01 22:47:41 +01:00
PrestaEdit 4c633b8b46 [*] BO: sort modules name in Stats 2013-09-01 16:55:22 +02:00
sagaradonis 9cd73b411d Update ajax-cart.js
.size() replaced by .length as .size() is outdated
2013-08-31 19:05:14 +05:30
gr4devel 805e80e54c [+] BO : add TinyMCE editor for short and long descrpition in AdminManufacturerController 2013-08-30 21:24:21 +02:00
Francois Gaillard d0087267df // Fixed tips of the day & encoding 2013-08-30 14:22:24 +02:00
Rémi Gaillard f7fefe789d // typo fix 2013-08-30 11:21:00 +02:00
Rémi Gaillard 37e3b9e9e4 [-] WS: 404 error should be returned if a multishop entity does not exists #PSCFV-10229 2013-08-30 11:13:30 +02:00
gr4devel b72f2a7176 [+] FO : add getManufacturer() to ManufacturerControllerCore
Add getManufacturer() to ManufacturerControllerCore to access the protected manufacturer instance of the controller.
2013-08-29 21:48:32 +02:00
gr4devel 39c8a8fc2d [+] MO : add the option to show all Manufacturer
Add the option to show all Manufacturer in blocktopmenu module.
2013-08-29 21:32:10 +02:00
LOIC ROSSET ltd 24146181c6 Add APCu support 2013-08-29 20:13:58 +01:00
Francois Gaillard e6abe1c5a0 // Release branch merged 2013-08-29 18:46:34 +02:00
Rémi Gaillard eec8aaa4f8 // php noti 2013-08-29 18:15:51 +02:00
Rémi Gaillard 08b8277a7a ///// 2013-08-29 17:21:27 +02:00
Rémi Gaillard 51083e17af // 2013-08-29 17:18:05 +02:00
Jerome Nadaud 40c64b54e2 [+] MO : Mailalerts - Add Total tax paid to order confirmation 2013-08-29 17:13:48 +02:00
Francois Gaillard 4a8f6c3116 // Modules categories sort 2013-08-29 17:00:34 +02:00
Rémi Gaillard 1196c5d736 // php 5.2 2013-08-29 16:39:45 +02:00
Rémi Gaillard 01cbffad9b //miss on last commit 2013-08-29 16:11:24 +02:00
Rémi Gaillard c736c28ab5 // small ajax.php clean 2013-08-29 11:47:11 +02:00
Rémi Gaillard 6d1c8c54af Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-08-29 10:49:53 +02:00
djfm be83f1364d // updated Czech localization pack 2013-08-29 10:49:39 +02:00
Damien Metzger f24391be5a // Fixed hook::getidbyname case 2013-08-29 09:39:48 +02:00
ha99y 75303e82e0 Suppress Error at rename
If debugging  is one (_PS_MODE_DEV_ set to TRUE)
there is a warning on line 142 in /classes/Autoload.php at function
rename()
2013-08-28 18:56:49 -07:00
Rémi Gaillard ddc16a2f65 [-] BO: Fix fatal error on customer edition when email is not valid 2013-08-28 17:46:05 +02:00
Vincent Augagneur 0a2d8175a7 //small fix 2013-08-28 10:03:50 +02:00
ha99y ffd712312d Add new argument to function getImages
1st: The function will return the product attribute id's with the list.
2nd: If product attribute id is passed to the function it will return
only the image id of the given attribute.
2013-08-28 00:27:52 -07:00
Vincent Augagneur 4bb0e16509 [-] FO : fixed bug when is virtual cart on OPC carriers is no longer displayed 2013-08-27 16:43:14 +02:00
Vincent Augagneur 39c882cdb4 //small fix 2013-08-27 16:21:13 +02:00
Rémi Gaillard 598469e41e // typo debug 2013-08-27 15:38:29 +02:00
Jerome Nadaud 6aad506c80 [-] FO : FixBug when route id is empty 2013-08-27 12:01:40 +02:00
Vincent Augagneur 99b162d16b [-] CORE : fixed bug #PSCFV-10175 - No virtuel download email send after accepted payment 2013-08-27 10:09:35 +02:00
Jerome Nadaud de200e1c5e Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-08-27 09:50:35 +02:00
Rémi Gaillard 2620242176 // Fix cms_block creation loop on shop addition 2013-08-27 09:52:14 +02:00
Rémi Gaillard 6fd7f0114e // small fix 2013-08-27 09:52:05 +02:00
Rémi Gaillard 1a5b9de372 // small fix 2013-08-27 09:51:56 +02:00
Jerome Nadaud 5a685537a4 // Small Fix 2013-08-27 09:49:59 +02:00
sjousse 536bdb550b fix file validation to use PHP native method 2013-08-26 18:23:39 +02:00
Vincent Augagneur 1673a080a0 //small fix #PSCFV-10194 2013-08-26 17:34:13 +02:00
Vincent Augagneur 0a4264c947 [-] BO : fixed bug when try to add jquery from ajax.googleapis.com in BO 2013-08-26 16:31:50 +02:00
Damien Metzger 0ccbe8cb15 Merge pull request #661 from matiasiglesias/development
[-] LO: Argeninian localization
2013-08-26 02:19:34 -07:00
Vincent Augagneur ad428dfb2b //MERGE branche release 2013-08-26 10:59:36 +02:00
Damien Metzger bc071f2b04 // Fixed code typo 2013-08-26 09:48:26 +02:00
Jerome Nadaud 9f2423c2c5 [-] BO : FixBug Url rewrite preview when user have a different language from shop 2013-08-26 08:52:22 +02:00
matiasiglesias 235bfada7e [-] LO: Argeninian localization 2013-08-24 18:04:55 -03:00
Vincent Augagneur b1a0e715a6 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-08-23 10:34:38 +02:00
Vincent Augagneur 8412192822 [-] BO : fixed bug with multistore context on carrier wizard 2013-08-23 10:34:30 +02:00
Jerome Nadaud c4bb5a99e4 [+] BO : Improve mod rewrite check 2013-08-23 10:26:36 +02:00
Vincent Augagneur d48df48a03 //small fux on live edit URL 2013-08-23 09:44:47 +02:00
Vincent Augagneur 7bcd8ee83c //Added missing file 2013-08-23 09:42:37 +02:00
Jerome Nadaud bbea6c4a9b [-] BO : FixBug #PSCFV-10152 - Multibyte string double encoded when send email by SMTP relay 2013-08-22 12:17:51 +02:00
Damien Metzger eb69498d2c // Missing icon 2013-08-21 15:34:32 +02:00
Damien Metzger df418a80db [*] FO : added indexation of attributes references #PSCFV-7294 2013-08-21 15:31:10 +02:00
Damien Metzger cf35d3762b [-] MO : fixed the possibility to override/remove an override twice in the same session without redeclaration #PSCFV-10168 2013-08-21 14:32:18 +02:00
Jerome Nadaud f610b0d844 [+] MO : Bankwire, cashondelivery, cheque disable confirm button on click 2013-08-19 16:37:48 +02:00
Damien Metzger 415ca83b62 // Code cleaning 2013-08-19 15:23:43 +02:00
Damien Metzger 1a81191c09 // Code cleaning 2013-08-19 15:14:05 +02:00
Jerome Nadaud a7f6e91ac0 [-] BO : FixBug #PSCFV-9329 Alias problem in order by 2013-08-19 10:35:43 +02:00
Jerome Nadaud dc4978ff57 [-] BO : FixBug valuation and real quantity sort 2013-08-19 10:28:02 +02:00
Jerome Nadaud 1138e8d01a [-] BO : FixBug Friendly URL change 2013-08-19 10:17:42 +02:00
Jerome Nadaud 13c5450ca1 [-] BO : FixBug sort bug on values count column 2013-08-19 09:50:01 +02:00
Damien Metzger 7f3652bea0 [-] BO : Added comprehensive error display when prestashop cannot write the .htaccess file 2013-08-14 11:16:50 +02:00
Krystian Podemski dab86dffe1 * [MO] : blocknewsletter improvements 2013-08-13 16:45:40 +02:00
Gregory Roussac 1e10dab8f8 Merge pull request #646 from kpodemski/patch-2
[*] CORE : Get instance of current category in category controller
2013-08-13 05:54:40 -07:00
Krystian Podemski 8051b0021e [*] CORE : Get instance of current category in category controller
Get instance of category in for eg. module hook using:

$category = $this->context->controller->getCategory()

instead of

new Category(1,1);
2013-08-13 14:52:59 +02:00
gRoussac 5d0f1499ac // without hedgehogs is better 2013-08-12 16:50:14 +02:00
gRoussac 30d9ebe68f [-] FO : Fix bug #PSCFV-9624 try 302 redirect from old 1.4 images format to new _default before 404.gif 2013-08-12 16:44:25 +02:00
gRoussac 7ec55106ce [*] CORE : Get instance of current product in product controller merge https://github.com/PrestaShop/PrestaShop/pull/644 thanks @kpodemski 2013-08-12 16:23:54 +02:00
Gregory Roussac b7232aabd7 Merge pull request #643 from Shagshag/patch-2
[*] BO :ProductDownload::getNewFilename() avoid recursion
2013-08-12 00:29:33 -07:00
Shagshag ce20d55e77 ProductDownload::getNewFilename() little optimisation
Avoid recursion
2013-08-12 04:28:58 +02:00
Jerome Nadaud a38fe5ddd3 // W3C validation error 2013-08-09 14:10:38 +02:00
Jerome Nadaud c35d846f60 [-] BO : FixBug root category listed after list reset 2013-08-09 12:16:05 +02:00
Jerome Nadaud 75f0b38ff1 // Syntax error 2013-08-09 11:38:59 +02:00
Jerome Nadaud cbc7b9567a [-] FO : Do not redirect on 301 when POST request 2013-08-09 10:20:42 +02:00
Jerome Nadaud 64698d1590 [-] FO : FixBug generated_date error 2013-08-09 09:10:53 +02:00
Jérôme Nadaud 84ded9f3db [-] FO : FixBug #PSCFV-10058 Invalid id country after allow to select no country 2013-08-08 23:30:31 +02:00
Jérôme Nadaud f5e28b9212 [-] FO : FixBug CGV does not pop-up in Fancy Box 2013-08-08 21:28:55 +02:00
Jerome Nadaud 390b49122e [-] FO : FixBug #PSCFV-10026 SSL error on ajax action 2013-08-08 15:58:52 +02:00
Jerome Nadaud be9398c6c5 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-08-08 13:06:41 +02:00
Jerome Nadaud d5cdcab859 [-] MO : sendtofriend FixBug Form error 2013-08-08 13:06:18 +02:00
Gregory Roussac 49b6fda40f Merge pull request #639 from PrestaEdit/patch-49
[-] BO: correct link in Block Discover.
2013-08-08 03:09:29 -07:00
PrestaEdit 0023950c72 [-] BO: correct link in Block Discover. 2013-08-08 11:44:24 +02:00
Jerome Nadaud 7d4feac247 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-08-08 11:17:07 +02:00
Jerome Nadaud 8e72d122e6 [-] MO : blockcategories FixBug html tags in categories link title 2013-08-08 11:16:45 +02:00
Gregory Roussac bb45c93d4f Merge pull request #563 from Prestaworks/patch-12
[-] MO : Fix bug #PNM-1241 with 1.4 translations, url indexing not working for all languages.
2013-08-08 02:00:57 -07:00
Jerome Nadaud 55fc51f20b [-] MO : CarrierCompare FixBug #PSCFV-9975 Ajax SSL error 2013-08-08 10:41:22 +02:00
Jerome Nadaud 1c6eb93951 [-] BO : Check if function mb_encode_mimeheader exist in case some user uninstall it 2013-08-07 17:08:01 +02:00
Jerome Nadaud 44f7356d44 [-] BO : FixBug message charset problem in mail 2013-08-07 16:40:40 +02:00
Gregory Roussac de3b121b11 Merge pull request #507 from jeckyl/patch-3
[*] BO : Fix size for modules logo AdminModulesPositions
2013-08-07 07:04:13 -07:00
Jerome Nadaud 239c5adb5a [-] BO : FixBug smarty email variable override by blockcontact 2013-08-07 15:09:14 +02:00
Gregory Roussac 942a946147 Merge pull request #497 from romainberger/development
[*] MO: Referral program: display currency in account page next to the voucher value
2013-08-07 05:59:29 -07:00
Jerome Nadaud 5f1506ffc2 [-] BO : FixBug #PSCFV-10037 for to choose a state when state is enabled for country 2013-08-07 14:09:40 +02:00
Jerome Nadaud cd1ed74d8e [-] BO : FixBug #PSCFV-10038 escaped quote in address fields 2013-08-07 11:53:12 +02:00
Jerome Nadaud a32ff1e930 [-] BO : FixBug Missing tpl dir in default layout 2013-08-07 11:17:42 +02:00
Daniel 876c49b690 PNM-1241 Issue with backbutton
This will solve the issue with url indexing not working for all languages.
2013-07-12 18:24:18 +08:00
jeckyl 783b02b34f Update admin.css
force size for module logo to keep a good design structure
2013-06-18 14:56:55 +02:00
romainberger c94dbb36ce [*] MO: Referral program: display currency in account page next to the voucher value 2013-06-14 11:04:20 +02:00
429 changed files with 10208 additions and 18908 deletions
+28 -7
View File
@@ -16,13 +16,14 @@
- bMancone
- bumbu
- Burhan
- Cédric Mouleyre
- Caleydon Media
- cam.lafit
- Captain FLAM
- Captain-FLAM
- ccauw
- Cédric Mouleyre
- ChristopheBoucaut
- CINS
- cippest
- cmouleyre
- Corentin Delcourt
@@ -34,42 +35,50 @@
- David Gasperoni
- Davy Rolink
- djfm
- dlage
- dMetzger
- (d)oekia
- Dragan Skrbic
- DrÿSs'
- 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
- Jérôme Nadaud
- jBreux
- jeckyl
- jeromenadaud
- Jerome Nadaud
- Jérôme Nadaud
- jessylenne
- jmCollin
- jObregon
- Jonathan Danse
- joseantgv
- Julien
- Kevin Granger
- kpodemski
- Krystian Podemski
@@ -77,8 +86,11 @@
- lCherifi
- ldecoker
- lLefevre
- LOIC ROSSET ltd
- makk1ntosh
- marcinsz101
- Marco Cervellin
- matiasiglesias
- Mats Rynge
- MatthieuB
- Maxence
@@ -101,32 +113,39 @@
- PhpMadman
- Pierre
- Piotr Kaczor
- Piotr Moćko
- Piotr Mocko
- PrestaEdit
- prestarocket
- Prestaspirit
- pxls
- Rémi Gaillard
- Raphaël Malié
- raulgundin
- Rémi Gaillard
- rGaillard
- Rimas Kudelis
- rMalie
- rMontagne
- romainberger
- root
- runningz
- Sébastien
- Sébastien Bocahu
- 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
@@ -138,3 +157,5 @@
- Xavier
- Xavier POITAU
- Yoozio
- zimmi1
+21 -20
View File
@@ -2,47 +2,48 @@ README
======
![PrestaShop](http://www.prestashop.com/images/banners/general/prestashop_728x90.png "PrestaShop")
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
View File
@@ -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>';
}
+3
View File
@@ -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
View File
@@ -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://';
+2 -1
View File
@@ -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;}
@@ -66,7 +66,8 @@
{
if (msg)
{
var infos = msg.infos.split('_');
var infos = msg.infos.replace("\\'", "'").split('_');
$('input[name=firstname]').val(infos[0]);
$('input[name=lastname]').val(infos[1]);
$('input[name=company]').val(infos[2]);
@@ -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');
@@ -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">&nbsp;</div>
@@ -97,28 +50,16 @@
</form>
</div>
</div>
<div class="clear">&nbsp;</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>&nbsp;&nbsp;
<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">&nbsp;</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">&nbsp;</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">&nbsp;</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}&nbsp;{/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">&nbsp;&nbsp;{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>
@@ -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+'" />&nbsp;<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+'&nbsp;<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>&nbsp;<span class="currency_sign"></span>&nbsp;
<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.'}
@@ -41,7 +41,7 @@
{/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'}</a>
<a href="{$current}&token={$token}&empty_smarty_cache=1" class="clear button" href="">{l s='Clear Smarty cache & Autoload cache'}</a>
{/if}
{/block}
@@ -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;">
@@ -29,7 +29,7 @@
<input size="30" type="text" id="{$input_name}_{$language.id_lang}"
name="{$input_name}_{$language.id_lang}"
value="{$input_value[$language.id_lang]|htmlentitiesUTF8|default:''}"
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"/>
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();" onblur="updateLinkRewrite();"/>
</div>
{/foreach}
</div>
@@ -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">
@@ -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">
@@ -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')
@@ -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);
@@ -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"/>&nbsp;
<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"/>&nbsp;
<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};"/>&nbsp;
<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};"/>&nbsp;
<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}
@@ -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>
+1 -1
View File
@@ -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();
+9 -13
View File
@@ -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;
}
}
+4 -4
View File
@@ -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']
);
+28 -14
View File
@@ -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;
}
}
}
}
+8 -3
View File
@@ -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).'%\'
');
}
}
+2 -2
View File
@@ -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),
+19 -1
View File
@@ -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;
}
}
+3 -3
View File
@@ -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
View File
@@ -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);
}
}
+5 -5
View File
@@ -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,7 +549,7 @@ 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]) || !isset($this->routes[$id_shop][$id_lang]) || !isset($this->routes[$id_shop][$id_lang][$route_id]))
@@ -594,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
+34 -24
View File
@@ -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)
+1
View File
@@ -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];
}
+14 -8
View File
@@ -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/';
+59 -49
View File
@@ -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.';
?>');
@@ -192,7 +196,7 @@ class LanguageCore extends ObjectModel
public function add($autodate = true, $nullValues = false, $only_add = false)
{
if (!parent::add($autodate))
if (!parent::add($autodate, $nullValues))
return false;
if ($only_add)
@@ -202,10 +206,9 @@ class LanguageCore extends ObjectModel
$this->_generateFiles();
// @todo Since a lot of modules are not in right format with their primary keys name, just get true ...
$resUpdateSQL = $this->loadUpdateSQL();
$resUpdateSQL = true;
Tools::generateHtaccess();
return $resUpdateSQL;
$this->loadUpdateSQL();
return Tools::generateHtaccess();
}
public function toggleStatus()
@@ -461,7 +464,8 @@ class LanguageCore extends ObjectModel
}
closedir($handle);
}
rmdir($dir);
if (is_writable($dir))
rmdir($dir);
}
public function delete()
@@ -488,7 +492,8 @@ class LanguageCore extends ObjectModel
// Files deletion
foreach (Language::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
if (file_exists($key))
unlink($key);
unlink($key);
$modList = scandir(_PS_MODULE_DIR_);
foreach ($modList as $mod)
{
@@ -510,37 +515,32 @@ class LanguageCore extends ObjectModel
Language::recurseDeleteDir(_PS_MAIL_DIR_.$this->iso_code);
if (file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code))
Language::recurseDeleteDir(_PS_TRANSLATIONS_DIR_.$this->iso_code);
}
if (!parent::delete())
return false;
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
// delete images
$files_copy = array(
'/en.jpg',
'/en-default-'.ImageType::getFormatedName('thickbox').'.jpg',
'/en-default-'.ImageType::getFormatedName('home').'.jpg',
'/en-default-'.ImageType::getFormatedName('large').'.jpg',
'/en-default-'.ImageType::getFormatedName('medium').'.jpg',
'/en-default-'.ImageType::getFormatedName('small').'.jpg'
$images = array(
'.jpg',
'-default-'.ImageType::getFormatedName('thickbox').'.jpg',
'-default-'.ImageType::getFormatedName('home').'.jpg',
'-default-'.ImageType::getFormatedName('large').'.jpg',
'-default-'.ImageType::getFormatedName('medium').'.jpg',
'-default-'.ImageType::getFormatedName('small').'.jpg'
);
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
foreach ($tos as $to)
foreach ($files_copy as $file)
$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)
{
$name = str_replace('/en', ''.$this->iso_code, $file);
if (file_exists($to.$name))
unlink($to.$name);
if (file_exists($image_directory.$this->iso_code.$image))
unlink($image_directory.$this->iso_code.$image);
if (file_exists(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg'))
unlink(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg');
}
}
if (!parent::delete())
return false;
return Tools::generateHtaccess();
}
public function deleteSelection($selection)
{
if (!is_array($selection))
@@ -549,11 +549,10 @@ class LanguageCore extends ObjectModel
$result = true;
foreach ($selection as $id)
{
$this->id = (int)($id);
$result = $result && $this->delete();
$language = new Language($id);
$result = $result && $language->delete();
}
Tools::generateHtaccess();
return $result;
}
@@ -689,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;
@@ -726,7 +727,7 @@ class LanguageCore extends ObjectModel
}
else
Language::_copyNoneFlag((int)$lang->id);
$files_copy = array(
'/en.jpg',
'/en-default-'.ImageType::getFormatedName('thickbox').'.jpg',
@@ -736,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));
@@ -789,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);
+34 -53
View File
@@ -91,12 +91,8 @@ 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, null, $id_shop);
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($product))
{
@@ -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, null, $id_shop);
$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, null, $id_shop);
$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, null, $id_shop);
$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, null, $id_shop);
$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, null, $id_shop);
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
if (!is_object($manufacturer))
@@ -360,18 +334,12 @@ 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, null, $id_shop);
$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))
@@ -453,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;
@@ -469,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, null, $id_shop).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)
@@ -642,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();
}
}
+5
View File
@@ -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.
+82 -5
View File
@@ -50,9 +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)
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
$template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null)
{
$configuration = Configuration::getMultiple(array(
'PS_SHOP_EMAIL',
@@ -126,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;
@@ -146,17 +148,26 @@ class MailCore
if ($to_name == null)
$to_name = $addr;
/* Encode accentuated chars */
$to_list->addTo($addr, '=?UTF-8?B?'.base64_encode($to_name).'?=');
if (function_exists('mb_encode_mimeheader'))
$to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8'));
else
$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;
$to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($to_name).'?=');
if (function_exists('mb_encode_mimeheader'))
$to_list->addTo($to, mb_encode_mimeheader($to_name, 'utf-8'));
else
$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)
@@ -230,6 +241,8 @@ class MailCore
/* Create mail and attach differents parts */
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject);
$message->setCharset('utf-8');
/* Set Message-ID - getmypid() is blocked on some hosting */
$message->setId(Mail::generateId());
@@ -372,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;
}
}
+1 -1
View File
@@ -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'),
+4 -4
View File
@@ -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),
@@ -201,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,10 +271,10 @@ 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
View File
@@ -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))
+9 -3
View 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);
+17 -16
View File
@@ -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)
+5 -5
View File
@@ -299,10 +299,10 @@ class ProductDownloadCore extends ObjectModel
*/
public static function getNewFilename()
{
$ret = sha1(microtime());
if (file_exists(_PS_DOWNLOAD_DIR_.$ret))
$ret = ProductDownload::getNewFilename();
return $ret;
do {
$filename = sha1(microtime());
} while (file_exists(_PS_DOWNLOAD_DIR_.$filename));
return $filename;
}
/**
@@ -314,4 +314,4 @@ class ProductDownloadCore extends ObjectModel
{
return Configuration::get('PS_VIRTUAL_PROD_FEATURE_ACTIVE');
}
}
}
+2 -2
View File
@@ -103,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
@@ -156,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
+24 -27
View File
@@ -140,36 +140,33 @@ 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'))
{
// 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]);
// 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;
}
else
$string = $letters.$symbols;
}
elseif ($indexation)
{
$minWordLen = (int)Configuration::get('PS_SEARCH_MINWORDLEN');
if ($minWordLen > 1)
{
$minWordLen = (int)Configuration::get('PS_SEARCH_MINWORDLEN');
if ($minWordLen > 1)
{
$minWordLen -= 1;
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}(?=\s)/Su', ' ', $string);
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}(?=\s)/Su', '', $string);
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}$/Su', '', $string);
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}$/Su', '', $string);
}
$minWordLen -= 1;
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}(?=\s)/Su', ' ', $string);
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}(?=\s)/Su', '', $string);
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}$/Su', '', $string);
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}$/Su', '', $string);
}
}
+4 -3
View File
@@ -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)
+3 -3
View File
@@ -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();
+1 -1
View File
@@ -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
View File
@@ -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.'),';
+74 -89
View File
@@ -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)
@@ -1260,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)
@@ -1401,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));
}
/**
@@ -1596,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)
@@ -1676,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");
@@ -2478,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;
}
+1 -1
View File
@@ -592,7 +592,7 @@ class ValidateCore
*/
public static function isOrderBy($order)
{
return preg_match('/^[a-zA-Z0-9._-]+$/', $order);
return preg_match('/^[a-zA-Z0-9.!_-]+$/', $order);
}
/**
+5 -2
View File
@@ -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'];
}
/**
+1 -1
View File
@@ -49,7 +49,7 @@ class CacheMemcacheCore extends Cache
if(is_array($servers) && count($servers) > 0)
{
$this->keys = $this->memcache->get(_COOKIE_IV_);
$this->keys = @$this->memcache->get(_COOKIE_IV_);
if (!is_array($this->keys))
$this->keys = array();
}
+48 -31
View File
@@ -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;
@@ -387,7 +387,7 @@ class AdminControllerCore extends Controller
$filter = '';
foreach ($this->fields_list AS $field => $t)
{
if ($val = htmlspecialchars(Tools::getValue($this->table.'Filter_'.$field), ENT_QUOTES, 'UTF-8'))
if ($val = Tools::getValue($this->table.'Filter_'.$field))
{
if(!is_array($val) && !empty($val))
$filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : ';
@@ -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))
{
@@ -1535,21 +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_xml = simplexml_load_file(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST);
$country_module_list = array();
$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[] = (string)$m->name;
$this->tab_modules_list['slider_list'] = array_intersect($this->tab_modules_list['slider_list'], $country_module_list);
$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')
);
}
/**
@@ -2106,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;
@@ -2153,28 +2160,38 @@ 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;
$this->_orderBy = $order_by;
if (preg_match('/[.!]/', $order_by))
{
$order_by_split = preg_split('/[.!]/', $order_by);
$order_by = pSQL($order_by_split[0]).'.`'.pSQL($order_by_split[1]).'`';
$this->_orderBy = (isset($order_by_split) && isset($order_by_split[1])) ? $order_by_split[1] : $order_by;
}
else
$this->_orderBy = $order_by;
$this->_orderWay = Tools::strtoupper($order_way);
/* SQL table : orders, but class name is Order */
@@ -2233,8 +2250,6 @@ class AdminControllerCore extends Controller
$having_clause .= $this->_having.' ';
}
$this->_listsql = '
SELECT SQL_CALC_FOUND_ROWS
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '');
@@ -2401,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;
@@ -2508,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']
);
}
}
/**
@@ -2940,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;
}
+8 -4
View File
@@ -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
@@ -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();
@@ -512,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);
}
@@ -597,7 +600,7 @@ class FrontControllerCore extends Controller
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))
{
@@ -667,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))))
+1 -1
View File
@@ -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");
}
/**
+1 -1
View File
@@ -27,7 +27,7 @@
class HelperCore
{
public $currentIndex;
public $table;
public $table = 'configuration';
public $identifier;
public $token;
public $toolbar_btn;
+1 -3
View File
@@ -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 */
+4 -4
View File
@@ -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();
@@ -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));
+99 -60
View File
@@ -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';
@@ -299,7 +302,7 @@ abstract class ModuleCore
$this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left');
}
if ($upgrade_detail['duplicate'])
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');
@@ -1627,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);
}
@@ -1653,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)
@@ -1683,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)
@@ -1696,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;
@@ -1708,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();
}
@@ -1726,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);
}
}
}
/**
@@ -1951,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;
@@ -1960,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;
}
@@ -2014,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);
+1 -2
View File
@@ -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);
}
+5 -1
View File
@@ -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')
)
);
+2 -2
View File
@@ -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`)
+1 -1
View File
@@ -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),
-13
View File
@@ -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);
}
+1 -1
View File
@@ -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';
}
}
+4 -2
View File
@@ -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
+1 -5
View File
@@ -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(
+1 -1
View File
@@ -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 *
+27 -28
View File
@@ -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,40 +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)
{
$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(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;
@@ -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')
);
}
@@ -54,6 +54,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
'title' => $this->l('Values count'),
'width' => 120,
'align' => 'center',
'orderby' => false,
'search' => false
),
'position' => array(
@@ -263,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(
@@ -271,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'),
@@ -95,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.');
@@ -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);
}
@@ -356,8 +360,7 @@ class AdminCarrierWizardControllerCore extends AdminController
'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',
@@ -365,8 +368,7 @@ class AdminCarrierWizardControllerCore extends AdminController
'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',
@@ -374,8 +376,7 @@ class AdminCarrierWizardControllerCore extends AdminController
'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',
@@ -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,14 +706,14 @@ 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'])
@@ -731,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);
@@ -764,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'));
@@ -783,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))
@@ -804,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))
{
@@ -843,7 +844,7 @@ class AdminCarrierWizardControllerCore extends AdminController
}
die(Tools::jsonEncode($return));
}
protected function changeGroups($id_carrier, $delete = true)
{
$carrier = new Carrier((int)$id_carrier);
@@ -866,20 +867,20 @@ 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'),
@@ -902,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';
+15 -12
View File
@@ -684,18 +684,21 @@ class AdminCartsControllerCore extends AdminController
$free_shipping = true;
break;
}
return array('summary' => $this->getCartSummary(),
'delivery_option_list' => $this->getDeliveryOptionList(),
'cart' => $this->context->cart,
'addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang),
'id_cart' => $id_cart,
'order_message' => $message_content,
'link_order' => $this->context->link->getPageLink(
'order', false,
(int)$this->context->cart->id_lang,
'step=3&recover_cart='.$id_cart.'&token_cart='.md5(_COOKIE_KEY_.'recover_cart_'.$id_cart)),
'free_shipping' => (int)$free_shipping
);
return array(
'summary' => $this->getCartSummary(),
'delivery_option_list' => $this->getDeliveryOptionList(),
'cart' => $this->context->cart,
'currency' => new Currency($this->context->cart->id_currency),
'addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang),
'id_cart' => $id_cart,
'order_message' => $message_content,
'link_order' => $this->context->link->getPageLink(
'order', false,
(int)$this->context->cart->id_lang,
'step=3&recover_cart='.$id_cart.'&token_cart='.md5(_COOKIE_KEY_.'recover_cart_'.$id_cart)
),
'free_shipping' => (int)$free_shipping
);
}
public function initToolbar()
@@ -246,7 +246,7 @@ class AdminCategoriesControllerCore extends AdminController
'desc' => $this->l('Add New')
);
$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=categories',
'desc' => $this->l('Import')
);
}
+2 -2
View File
@@ -110,10 +110,10 @@ class AdminCmsControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Meta title:'),
'name' => 'meta_title',
'id' => 'name', // for copy2friendlyUrl compatibility
'id' => 'name', // for copyMeta2friendlyURL compatibility
'lang' => true,
'required' => true,
'class' => 'copy2friendlyUrl',
'class' => 'copyMeta2friendlyURL',
'hint' => $this->l('Invalid characters:').' <>;=#{}',
'size' => 50
),
@@ -151,7 +151,7 @@ class AdminCurrenciesControllerCore extends AdminController
array('key' => 2, 'name' => '0 000,00X ('.$this->l('as with Euros').')'),
array('key' => 3, 'name' => 'X0.000,00'),
array('key' => 4, 'name' => '0,000.00X'),
array('key' => 5, 'name' => '0 000.00X') // Added for the switzerland currency
array('key' => 5, 'name' => '0\'000.00X') // Added for the switzerland currency
),
'name' => 'name',
'id' => 'key'
@@ -380,7 +380,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$cm->id_employee = (int)$this->context->employee->id;
$cm->id_customer_thread = $ct->id;
$cm->message = Tools::htmlentitiesutf8(Tools::getValue('reply_message'));
$cm->message = Tools::getValue('reply_message');
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
if (isset($_FILES) && !empty($_FILES['joinFile']['name']) && $_FILES['joinFile']['error'] != 0)
$this->errors[] = Tools::displayError('An error occurred during the file upload process.');
@@ -597,11 +597,12 @@ class AdminCustomerThreadsControllerCore extends AdminController
}
$message['date_add'] = Tools::displayDate($message['date_add'], null, true);
$message['user_agent'] = strip_tags($message['user_agent']);
$message['message'] = preg_replace(
'/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui',
'<a href="\1">\1</a>\2',
html_entity_decode($message['message'],
ENT_NOQUOTES, 'UTF-8')
ENT_QUOTES, 'UTF-8')
);
$tpl->assign(array(
@@ -190,7 +190,7 @@ class AdminCustomersControllerCore extends AdminController
else if (!$this->display) //display import button only on listing
{
$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=customers',
'desc' => $this->l('Import')
);
}
@@ -774,7 +774,8 @@ class AdminCustomersControllerCore extends AdminController
if ($customer_email != $this->object->email)
{
$customer = new Customer();
$customer->getByEmail($customer_email);
if (Validate::isEmail($customer_email))
$customer->getByEmail($customer_email);
if ($customer->id)
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
}
@@ -472,7 +472,15 @@ class AdminEmployeesControllerCore extends AdminController
return $res;
}
protected function ajaxProcessFormLanguage()
{
$this->context->cookie->employee_form_lang = (int)Tools::getValue('form_language_id');
if (!$this->context->cookie->write())
die ('Error while updating cookie.');
die ('Form language updated.');
}
public function ajaxProcessGetTabByIdProfile()
{
$id_profile = Tools::getValue('id_profile');
+28 -18
View File
@@ -30,6 +30,7 @@ class AdminGroupsControllerCore extends AdminController
{
$this->table = 'group';
$this->className = 'Group';
$this->list_id = 'group';
$this->lang = true;
$this->addRowAction('edit');
$this->addRowAction('view');
@@ -153,6 +154,16 @@ class AdminGroupsControllerCore extends AdminController
if (Tools::isSubmit('changeShowPricesVal') && $this->id_object)
$this->action = 'change_show_prices_val';
if (Tools::getIsset('viewgroup'))
{
$this->list_id = 'customer_group';
if (isset($_POST['submitReset'.$this->list_id]))
$this->processResetFilters();
}
else
$this->list_id = 'group';
parent::initProcess();
}
@@ -181,30 +192,29 @@ class AdminGroupsControllerCore extends AdminController
$genders_icon[$gender->id] = '../genders/'.(int)$gender->id.'.jpg';
$genders[$gender->id] = $gender->name;
}
$customer_fields_display = (array(
'id_customer' => array('title' => $this->l('ID'), 'width' => 15, 'align' => 'center'),
$this->table = 'customer_group';
$this->lang = false;
$this->list_id = 'customer_group';
$this->actions = array();
$this->bulk_actions = false;
$this->no_link = true;
$this->fields_list = (array(
'id_customer' => array('title' => $this->l('ID'), 'width' => 15, 'align' => 'center', 'filter_key' => 'c!id_customer'),
'id_gender' => array('title' => $this->l('Titles'), 'align' => 'center', 'width' => 50,'icon' => $genders_icon, 'list' => $genders),
'firstname' => array('title' => $this->l('Name'), 'align' => 'center'),
'lastname' => array('title' => $this->l('Name'), 'align' => 'center'),
'email' => array('title' => $this->l('Email address'), 'width' => 150, 'align' => 'center'),
'firstname' => array('title' => $this->l('First name'), 'align' => 'center'),
'lastname' => array('title' => $this->l('Last name'), 'align' => 'center'),
'email' => array('title' => $this->l('Email address'), 'width' => 150, 'align' => 'center', 'filter_key' => 'c!email', 'orderby' => true),
'birthday' => array('title' => $this->l('Birth date'), 'width' => 150, 'align' => 'right', 'type' => 'date'),
'date_add' => array('title' => $this->l('Register date'), 'width' => 150, 'align' => 'right', 'type' => 'date'),
'orders' => array('title' => $this->l('Orders'), 'align' => 'center'),
'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool')
));
$customer_list = $group->getCustomers(false, 0, 0, true);
$helper = new HelperList();
$helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false);
$helper->token = Tools::getAdminTokenLite('AdminCustomers');
$helper->shopLinkType = '';
$helper->table = 'customer';
$helper->identifier = 'id_customer';
$helper->actions = array('edit', 'view');
$helper->show_toolbar = false;
return $helper->generateList($customer_list, $customer_fields_display);
$this->_select = 'c.*';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (a.`id_customer` = c.`id_customer`)';
$this->_where = 'AND a.`id_group` = '.(int)$group->id.' AND c.`deleted` != 1';
self::$currentIndex = self::$currentIndex.'&viewgroup';
$this->processFilter();
return parent::renderList();
}
public function renderForm()
+16 -9
View File
@@ -52,8 +52,17 @@ class AdminImagesControllerCore extends AdminController
'stores' => array('title' => $this->l('Stores'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false)
);
// No need to display the old image system if the install has been made later than 2013-03-26
$this->display_move = (!Configuration::get('PS_LEGACY_IMAGES') && defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
// No need to display the old image system migration tool except if product images are in _PS_PROD_IMG_DIR_
$this->display_move = false;
$dir = _PS_PROD_IMG_DIR_;
if (is_dir($dir))
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false && $this->display_move == false)
if (!is_dir($dir.DIRECTORY_SEPARATOR.$file) && $file[0] != '.' && is_numeric($file[0]))
$this->display_move = true;
closedir($dh);
}
$this->fields_options = array(
'images' => array(
@@ -534,18 +543,16 @@ class AdminImagesControllerCore extends AdminController
protected function _regenerateNoPictureImages($dir, $type, $languages)
{
$errors = false;
foreach ($type as $imageType)
{
foreach ($type as $image_type)
foreach ($languages as $language)
{
$file = $dir.$language['iso_code'].'.jpg';
if (!file_exists($file))
$file = _PS_PROD_IMG_DIR_.Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT'))).'.jpg';
if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg'))
if (!ImageManager::resize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg', (int)$imageType['width'], (int)$imageType['height']))
$file = _PS_PROD_IMG_DIR_.Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')).'.jpg';
if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($image_type['name']).'.jpg'))
if (!ImageManager::resize($file, $dir.$language['iso_code'].'-default-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height']))
$errors = true;
}
}
return $errors;
}
@@ -643,7 +650,7 @@ class AdminImagesControllerCore extends AdminController
public function initMoveImages()
{
$this->context->smarty->assign(array(
'safe_mode' => ini_get('safe_mode'),
'safe_mode' => Tools::getSafeModeStatus(),
'link_ppreferences' => 'index.php?tab=AdminPPreferences&token='.Tools::getAdminTokenLite('AdminPPreferences').'#PS_LEGACY_IMAGES_on',
));
}
+292 -167
View File
@@ -293,6 +293,7 @@ class AdminImportControllerCore extends AdminController
case $this->entities[$this->l('Addresses')]:
//Overwrite required_fields
$this->required_fields = array(
'alias',
'lastname',
'firstname',
'address1',
@@ -307,7 +308,7 @@ class AdminImportControllerCore extends AdminController
'id' => array('label' => $this->l('ID')),
'alias' => array('label' => $this->l('Alias *')),
'active' => array('label' => $this->l('Active (0/1)')),
'customer_email' => array('label' => $this->l('Customer email')),
'customer_email' => array('label' => $this->l('Customer email *')),
'id_customer' => array('label' => $this->l('Customer ID:')),
'manufacturer' => array('label' => $this->l('Manufacturer')),
'supplier' => array('label' => $this->l('Supplier')),
@@ -316,7 +317,7 @@ class AdminImportControllerCore extends AdminController
'firstname' => array('label' => $this->l('First Name *')),
'address1' => array('label' => $this->l('Address 1 *')),
'address2' => array('label' => $this->l('Address 2')),
'postcode' => array('label' => $this->l('Postal code / Zipcode*')),
'postcode' => array('label' => $this->l('Postal code / Zipcode *')),
'city' => array('label' => $this->l('City *')),
'country' => array('label' => $this->l('Country *')),
'state' => array('label' => $this->l('State')),
@@ -363,10 +364,13 @@ class AdminImportControllerCore extends AdminController
'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')),
);
break;
// @since 1.5.0
case $this->entities[$this->l('Supply Orders')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
{
}
// @since 1.5.0
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
switch ((int)Tools::getValue('entity'))
{
case $this->entities[$this->l('Supply Orders')]:
// required fields
$this->required_fields = array(
'id_supplier',
@@ -394,12 +398,8 @@ class AdminImportControllerCore extends AdminController
'discount_rate' => '0',
'is_template' => '0',
);
}
break;
// @since 1.5.0
case $this->entities[$this->l('Supply Order Details')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
{
break;
case $this->entities[$this->l('Supply Order Details')]:
// required fields
$this->required_fields = array(
'supply_order_reference',
@@ -423,10 +423,11 @@ class AdminImportControllerCore extends AdminController
'discount_rate' => '0',
'tax_rate' => '0',
);
}
}
break;
}
$this->separator = strval(trim(Tools::getValue('separator', ';')));
$this->separator = substr(strval(trim(Tools::getValue('separator', ';'))), 0, 1);
if (is_null(Tools::getValue('multiple_value_separator')) || trim(Tools::getValue('multiple_value_separator')) == '')
$this->multiple_value_separator = ',';
@@ -465,14 +466,42 @@ class AdminImportControllerCore extends AdminController
$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
$this->addJqueryPlugin(array('fancybox'));
$entity_selected = 0;
if (isset($this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))]))
{
$entity_selected = $this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))];
$this->context->cookie->entity_selected = (int)$entity_selected;
}
elseif (isset($this->context->cookie->entity_selected))
$entity_selected = (int)$this->context->cookie->entity_selected;
$csv_selected = '';
if (isset($this->context->cookie->csv_selected))
$csv_selected = base64_decode($this->context->cookie->csv_selected);
$id_lang_selected = '';
if (isset($this->context->cookie->iso_lang_selected) && $this->context->cookie->iso_lang_selected)
$id_lang_selected = (int)Language::getIdByIso(base64_decode($this->context->cookie->iso_lang_selected));
$separator_selected = '';
if (isset($this->context->cookie->separator_selected) && $this->context->cookie->separator_selected)
$separator_selected = base64_decode($this->context->cookie->separator_selected);
$multiple_value_separator_selected = '';
if (isset($this->context->cookie->multiple_value_separator_selected) && $this->context->cookie->multiple_value_separator_selected)
$multiple_value_separator_selected = base64_decode($this->context->cookie->multiple_value_separator_selected);
$this->tpl_form_vars = array(
'module_confirmation' => (Tools::getValue('import')) && (isset($this->warnings) && !count($this->warnings)),
'path_import' => _PS_ADMIN_DIR_.'/import/',
'entities' => $this->entities,
'entity' => Tools::getValue('entity'),
'entity_selected' => $entity_selected,
'csv_selected' => $csv_selected,
'separator_selected' => $separator_selected,
'multiple_value_separator_selected' => $multiple_value_separator_selected,
'files_to_import' => $files_to_import,
'languages' => Language::getLanguages(false),
'id_language' => $this->context->language->id,
'id_language' => ($id_lang_selected) ? $id_lang_selected : $this->context->language->id,
'available_fields' => $this->getAvailableFields(),
'truncateAuthorized' => (Shop::isFeatureActive() && $this->context->employee->isSuperAdmin()) || !Shop::isFeatureActive(),
'PS_ADVANCED_STOCK_MANAGEMENT' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'),
@@ -497,6 +526,12 @@ class AdminImportControllerCore extends AdminController
for ($i = 0; $i < $nb_table; $i++)
$data[$i] = $this->generateContentTable($i, $nb_column, $handle, $this->separator);
$this->context->cookie->entity_selected = (int)Tools::getValue('entity');
$this->context->cookie->iso_lang_selected = base64_encode(Tools::getValue('iso_lang'));
$this->context->cookie->separator_selected = base64_encode(Tools::getValue('separator'));
$this->context->cookie->multiple_value_separator_selected = base64_encode(Tools::getValue('multiple_value_separator'));
$this->context->cookie->csv_selected = base64_encode(Tools::getValue('csv'));
$this->tpl_view_vars = array(
'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'),
'fields_value' => array(
@@ -506,6 +541,7 @@ class AdminImportControllerCore extends AdminController
'iso_lang' => Tools::getValue('iso_lang'),
'truncate' => Tools::getValue('truncate'),
'forceIDs' => Tools::getValue('forceIDs'),
'regenerate' => Tools::getValue('regenerate'),
'match_ref' => Tools::getValue('match_ref'),
'separator' => $this->separator,
'multiple_value_separator' => $this->multiple_value_separator
@@ -554,17 +590,12 @@ class AdminImportControllerCore extends AdminController
for ($i = 0; $i < $nb_column; $i++)
if (MAX_COLUMNS * (int)$current_table <= $i && (int)$i < MAX_COLUMNS * ((int)$current_table + 1))
$html .= '<th style="width: '.(900 / MAX_COLUMNS).'px; vertical-align: top; padding: 4px">
<select onchange="askFeatureName(this, '.$i.');"
style="width: '.(900 / MAX_COLUMNS).'px;"
<select style="width: '.(900 / MAX_COLUMNS).'px;"
id="type_value['.$i.']"
name="type_value['.$i.']"
class="type_value">
'.$this->getTypeValuesOptions($i).'
</select>
<div id="features_'.$i.'" style="display: none;">
<input style="width: 90px" type="text" name="" id="feature_name_'.$i.'">
<input type="button" value="ok" onclick="replaceFeature($(\'#feature_name_'.$i.'\').attr(\'name\'), '.$i.');">
</div>
</th>';
$html .= '</tr>';
@@ -650,7 +681,8 @@ class AdminImportControllerCore extends AdminController
$fd = fopen($uniqid_path, 'r');
$tab = fgetcsv($fd, MAX_LINE_SIZE, $separator);
fclose($fd);
unlink($uniqid_path);
if (file_exists($uniqid_path))
@unlink($uniqid_path);
}
if (empty($tab) || (!is_array($tab)))
@@ -795,7 +827,7 @@ class AdminImportControllerCore extends AdminController
* @param string entity 'products' or 'categories'
* @return void
*/
protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products')
protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products', $regenerate = true)
{
$tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import');
$watermark_types = explode(',', Configuration::get('WATERMARK_TYPES'));
@@ -823,11 +855,14 @@ class AdminImportControllerCore extends AdminController
{
ImageManager::resize($tmpfile, $path.'.jpg');
$images_types = ImageType::getImagesTypes($entity);
foreach ($images_types as $image_type)
ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']);
if (in_array($image_type['id_image_type'], $watermark_types))
Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity));
if ($regenerate)
foreach ($images_types as $image_type)
{
ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']);
if (in_array($image_type['id_image_type'], $watermark_types))
Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity));
}
}
else
{
@@ -845,6 +880,9 @@ class AdminImportControllerCore extends AdminController
$this->receiveTab();
$handle = $this->openCsvFile();
$default_language_id = (int)Configuration::get('PS_LANG_DEFAULT');
$id_lang = Language::getIdByIso(Tools::getValue('iso_lang'));
if (!Validate::isUnsignedId($id_lang))
$id_lang = $default_language_id;
AdminImportController::setLocale();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++)
{
@@ -891,8 +929,8 @@ class AdminImportControllerCore extends AdminController
$category_to_create = new Category();
$category_to_create->name = AdminImportController::createMultiLangField($category->parent);
$category_to_create->active = 1;
$category_link_rewrite = Tools::link_rewrite($category_to_create->name[$default_language_id]);
$category_to_create->link_rewrite = $category_link_rewrite;
$category_link_rewrite = Tools::link_rewrite($category_to_create->name[$id_lang]);
$category_to_create->link_rewrite = AdminImportController::createMultiLangField($category_link_rewrite);
$category_to_create->id_parent = Configuration::get('PS_HOME_CATEGORY'); // Default parent is home for unknown category to create
if (($field_error = $category_to_create->validateFields(UNFRIENDLY_ERROR, true)) === true &&
($lang_field_error = $category_to_create->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && $category_to_create->add())
@@ -902,7 +940,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$category_to_create->name[$default_language_id],
(isset($category_to_create->id) ? $category_to_create->id : 'null')
(isset($category_to_create->id) && !empty($category_to_create->id))? $category_to_create->id : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -935,7 +973,7 @@ class AdminImportControllerCore extends AdminController
$this->warnings[] = sprintf(
Tools::displayError('Rewrite link for %1$s (ID: %2$s) was re-written as %3$s.'),
$bak,
(isset($info['id']) ? $info['id'] : 'null'),
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null',
$category->link_rewrite[$default_language_id]
);
$res = false;
@@ -976,15 +1014,15 @@ class AdminImportControllerCore extends AdminController
}
//copying images of categories
if (isset($category->image) && !empty($category->image))
if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories')))
if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories', !Tools::getValue('regenerate'))))
$this->warnings[] = $category->image.' '.Tools::displayError('cannot be copied.');
// If both failed, mysql error
if (!$res)
{
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
(isset($info['name']) ? Tools::safeOutput($info['name']) : 'No Name'),
(isset($info['id']) ? Tools::safeOutput($info['id']) : 'No ID')
(isset($info['name']) && !empty($info['name']))? Tools::safeOutput($info['name']) : 'No Name',
(isset($info['id']) && !empty($info['id']))? Tools::safeOutput($info['id']) : 'No ID'
);
$error_tmp = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').Db::getInstance()->getMsgError();
if ($error_tmp != '')
@@ -1028,6 +1066,9 @@ class AdminImportControllerCore extends AdminController
$this->receiveTab();
$handle = $this->openCsvFile();
$default_language_id = (int)Configuration::get('PS_LANG_DEFAULT');
$id_lang = Language::getIdByIso(Tools::getValue('iso_lang'));
if (!Validate::isUnsignedId($id_lang))
$id_lang = $default_language_id;
AdminImportController::setLocale();
$shop_ids = Shop::getCompleteListOfShopsID();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++)
@@ -1038,13 +1079,23 @@ class AdminImportControllerCore extends AdminController
if (Tools::getValue('forceIDs') && isset($info['id']) && (int)$info['id'])
$product = new Product((int)$info['id']);
else
elseif (Tools::getValue('match_ref') && array_key_exists('reference', $info))
{
if (array_key_exists('id', $info) && (int)$info['id'] && Product::existsInDatabase((int)$info['id'], 'product'))
$product = new Product((int)$info['id']);
else
$product = new Product();
$datas = Db::getInstance()->getRow('
SELECT p.`id_product`
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
WHERE p.`reference` = "'.pSQL($info['reference']).'"
');
if (isset($datas['id_product']) && $datas['id_product'])
$product = new Product((int)$datas['id_product']);
else
$product = new Product();
}
elseif (array_key_exists('id', $info) && (int)$info['id'] && Product::existsInDatabase((int)$info['id'], 'product'))
$product = new Product((int)$info['id']);
else
$product = new Product();
if (array_key_exists('id', $info) && (int)$info['id'] && Product::existsInDatabase((int)$info['id'], 'product'))
{
@@ -1109,7 +1160,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$manufacturer->name,
(isset($manufacturer->id) ? $manufacturer->id : 'null')
(isset($manufacturer->id) && !empty($manufacturer->id))? $manufacturer->id : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -1140,7 +1191,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$supplier->name,
(isset($supplier->id) ? $supplier->id : 'null')
(isset($supplier->id) && !empty($supplier->id))? $supplier->id : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -1186,7 +1237,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$category_to_create->name[$default_language_id],
(isset($category_to_create->id) ? $category_to_create->id : 'null')
(isset($category_to_create->id) && !empty($category_to_create->id))? $category_to_create->id : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -1218,7 +1269,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$category_to_create->name[$default_language_id],
(isset($category_to_create->id) ? $category_to_create->id : 'null')
(isset($category_to_create->id) && !empty($category_to_create->id))? $category_to_create->id : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -1229,14 +1280,14 @@ class AdminImportControllerCore extends AdminController
}
$product->id_category_default = isset($product->id_category[0]) ? (int)$product->id_category[0] : '';
$link_rewrite = (is_array($product->link_rewrite) && count($product->link_rewrite)) ? trim($product->link_rewrite[$default_language_id]) : '';
$link_rewrite = (is_array($product->link_rewrite) && isset($product->link_rewrite[$id_lang])) ? trim($product->link_rewrite[$id_lang]) : '';
$valid_link = Validate::isLinkRewrite($link_rewrite);
if ((isset($product->link_rewrite[$default_language_id]) && empty($product->link_rewrite[$default_language_id])) || !$valid_link)
if ((isset($product->link_rewrite[$id_lang]) && empty($product->link_rewrite[$id_lang])) || !$valid_link)
{
$link_rewrite = Tools::link_rewrite($product->name[$default_language_id]);
$link_rewrite = Tools::link_rewrite($product->name[$id_lang]);
if ($link_rewrite == '')
$link_rewrite = 'friendly-url-autogeneration-failed';
}
@@ -1244,18 +1295,20 @@ class AdminImportControllerCore extends AdminController
if (!$valid_link)
$this->warnings[] = sprintf(
Tools::displayError('Rewrite link for %1$s (ID: %2$s) was re-written as %3$s.'),
$product->name[$default_language_id],
(isset($info['id']) ? $info['id'] : 'null'),
$product->name[$id_lang],
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null',
$link_rewrite
);
$product->link_rewrite = AdminImportController::createMultiLangField($link_rewrite);
if (!Tools::getValue('match_ref') || !(is_array($product->link_rewrite) && count($product->link_rewrite) && !empty($product->link_rewrite[$id_lang])))
$product->link_rewrite = AdminImportController::createMultiLangField($link_rewrite);
// replace the value of separator by coma
if ($this->multiple_value_separator != ',')
foreach ($product->meta_keywords as &$meta_keyword)
if (!empty($meta_keyword))
$meta_keyword = str_replace($this->multiple_value_separator, ',', $meta_keyword);
if (is_array($product->meta_keywords))
foreach ($product->meta_keywords as &$meta_keyword)
if (!empty($meta_keyword))
$meta_keyword = str_replace($this->multiple_value_separator, ',', $meta_keyword);
// Convert comma into dot for all floating values
foreach (Product::$definition['fields'] as $key => $array)
@@ -1281,7 +1334,7 @@ class AdminImportControllerCore extends AdminController
SELECT product_shop.`date_add`, p.`id_product`
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
WHERE p.`reference` = "'.$product->reference.'"
WHERE p.`reference` = "'.pSQL($product->reference).'"
');
$product->id = (int)$datas['id_product'];
$product->date_add = pSQL($datas['date_add']);
@@ -1327,8 +1380,8 @@ class AdminImportControllerCore extends AdminController
{
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
(isset($info['name']) ? Tools::safeOutput($info['name']) : 'No Name'),
(isset($info['id']) ? Tools::safeOutput($info['id']) : 'No ID')
(isset($info['name']) && !empty($info['name']))? Tools::safeOutput($info['name']) : 'No Name',
(isset($info['id']) && !empty($info['id']))? Tools::safeOutput($info['id']) : 'No ID'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -1337,7 +1390,7 @@ class AdminImportControllerCore extends AdminController
else
{
// Product supplier
if (isset($product->id_supplier) && isset($product->supplier_reference))
if (isset($product->id_supplier) && property_exists($product, 'supplier_reference'))
{
$id_product_supplier = ProductSupplier::getIdByProductAndSupplier((int)$product->id, 0, (int)$product->id_supplier);
if ($id_product_supplier)
@@ -1354,31 +1407,67 @@ class AdminImportControllerCore extends AdminController
}
// SpecificPrice (only the basic reduction feature is supported by the import)
if ((isset($info['reduction_price']) && $info['reduction_price'] > 0) || (isset($info['reduction_percent']) && $info['reduction_percent'] > 0))
{
$specific_price = new SpecificPrice();
$specific_price->id_product = (int)$product->id;
// @todo multishop specific price import
$specific_price->id_shop = $this->context->shop->id;
$specific_price->id_currency = 0;
$specific_price->id_country = 0;
$specific_price->id_group = 0;
$specific_price->price = -1;
$specific_price->id_customer = 0;
$specific_price->from_quantity = 1;
$specific_price->reduction = (isset($info['reduction_price']) && $info['reduction_price']) ? $info['reduction_price'] : $info['reduction_percent'] / 100;
$specific_price->reduction_type = (isset($info['reduction_price']) && $info['reduction_price']) ? 'amount' : 'percentage';
$specific_price->from = (isset($info['reduction_from']) && Validate::isDate($info['reduction_from'])) ? $info['reduction_from'] : '0000-00-00 00:00:00';
$specific_price->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00';
if (!$specific_price->add())
$this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid'));
}
if (!Shop::isFeatureActive())
$info['shop'] = 1;
elseif (!isset($info['shop']) || empty($info['shop']))
$info['shop'] = implode($this->multiple_value_separator, Shop::getContextListShopID());
// Get shops for each attributes
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
$id_shop_list = array();
foreach ($info['shop'] as $shop)
if (!is_numeric($shop))
$id_shop_list[] = (int)Shop::getIdByName($shop);
else
$id_shop_list[] = $shop;
if ((isset($info['reduction_price']) && $info['reduction_price'] > 0) || (isset($info['reduction_percent']) && $info['reduction_percent'] > 0))
foreach($id_shop_list as $id_shop)
{
$specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0);
if (is_array($specific_price))
$specific_price = new SpecificPrice((int)$specific_price['id_specific_price']);
else
$specific_price = new SpecificPrice();
$specific_price->id_product = (int)$product->id;
$specific_price->id_specific_price_rule = 0;
$specific_price->id_shop = $id_shop;
$specific_price->id_currency = 0;
$specific_price->id_country = 0;
$specific_price->id_group = 0;
$specific_price->price = -1;
$specific_price->id_customer = 0;
$specific_price->from_quantity = 1;
$specific_price->reduction = (isset($info['reduction_price']) && $info['reduction_price']) ? $info['reduction_price'] : $info['reduction_percent'] / 100;
$specific_price->reduction_type = (isset($info['reduction_price']) && $info['reduction_price']) ? 'amount' : 'percentage';
$specific_price->from = (isset($info['reduction_from']) && Validate::isDate($info['reduction_from'])) ? $info['reduction_from'] : '0000-00-00 00:00:00';
$specific_price->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00';
if (!$specific_price->save())
$this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid'));
}
if (isset($product->tags) && !empty($product->tags))
{
if (isset($product->id) && $product->id)
{
$tags = Tag::getProductTags($product->id);
if (is_array($tags) && count($tags))
{
if (!empty($product->tags))
$product->tags = explode($this->multiple_value_separator, $product->tags);
if (is_array($product->tags) && count($product->tags))
{
foreach ($product->tags as $key => $tag)
$product->tags[$key] = trim($tag);
$tags[$id_lang] = $product->tags;
$product->tags = $tags;
}
}
}
// Delete tags for this id product, for no duplicating error
Tag::deleteTagsForProduct($product->id);
if (!is_array($product->tags))
{
$product->tags = AdminImportController::createMultiLangField($product->tags);
@@ -1438,7 +1527,7 @@ class AdminImportControllerCore extends AdminController
{
// associate image to selected shops
$image->associateTo($shops);
if (!AdminImportController::copyImg($product->id, $image->id, $url))
if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate')))
{
$image->delete();
$this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url);
@@ -1470,7 +1559,7 @@ class AdminImportControllerCore extends AdminController
if(!empty($feature_name) && !empty($feature_value))
{
$id_feature = Feature::addFeatureImport($feature_name, $position);
$id_feature_value = FeatureValue::addFeatureValueImport($id_feature, $feature_value);
$id_feature_value = FeatureValue::addFeatureValueImport($id_feature, $feature_value, $product->id, $id_lang);
Product::addFeatureProductImport($product->id, $id_feature, $id_feature_value);
}
}
@@ -1564,7 +1653,7 @@ class AdminImportControllerCore extends AdminController
if ($field_error === true && $lang_field_error === true && $image->add())
{
$image->associateTo($id_shop_list);
if (!AdminImportController::copyImg($product->id, $image->id, $url))
if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate')))
{
$this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url);
$image->delete();
@@ -1731,8 +1820,9 @@ class AdminImportControllerCore extends AdminController
null,
$id_shop_list
);
$id_product_attribute_update = true;
if (isset($info['supplier_reference']) && !empty($info['supplier_reference']))
$product->addSupplierReference($product->id_supplier, $id_product_attribute, $info['supplier_reference']);
}
}
}
@@ -1758,8 +1848,10 @@ class AdminImportControllerCore extends AdminController
(int)$info['minimal_quantity'],
$id_shop_list
);
if (isset($info['supplier_reference']) && !empty($info['supplier_reference']))
$product->addSupplierReference($product->id_supplier, $id_product_attribute, $info['supplier_reference']);
}
// fills our attributes array, in order to add the attributes to the product_attribute afterwards
if(isset($attributes[$group.'_'.$attribute]))
$attributes_to_add[] = (int)$attributes[$group.'_'.$attribute];
@@ -1934,7 +2026,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$info['email'],
(isset($info['id']) ? $info['id'] : 'null')
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -2031,7 +2123,7 @@ class AdminImportControllerCore extends AdminController
Tools::displayError('%1$s does not exist in database %2$s (ID: %3$s) cannot be saved'),
Db::getInstance()->getMsgError(),
$address->customer_email,
(isset($info['id']) ? $info['id'] : 'null')
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null'
);
}
else
@@ -2080,7 +2172,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$manufacturer->name,
(isset($manufacturer->id) ? $manufacturer->id : 'null')
(isset($manufacturer->id) && !empty($manufacturer->id))? $manufacturer->id : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -2101,7 +2193,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$supplier->name,
(isset($supplier->id) ? $supplier->id : 'null')
(isset($supplier->id) && !empty($supplier->id))? $supplier->id : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -2130,7 +2222,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$info['alias'],
(isset($info['id']) ? $info['id'] : 'null')
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null'
);
}
}
@@ -2147,7 +2239,7 @@ class AdminImportControllerCore extends AdminController
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$info['alias'],
(isset($info['id']) ? $info['id'] : 'null')
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -2217,8 +2309,8 @@ class AdminImportControllerCore extends AdminController
{
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
(isset($info['name']) ? Tools::safeOutput($info['name']) : 'No Name'),
(isset($info['id']) ? Tools::safeOutput($info['id']) : 'No ID')
(isset($info['name']) && !empty($info['name']))? Tools::safeOutput($info['name']) : 'No Name',
(isset($info['id']) && !empty($info['id']))? Tools::safeOutput($info['id']) : 'No ID'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
Db::getInstance()->getMsgError();
@@ -2264,8 +2356,8 @@ class AdminImportControllerCore extends AdminController
if (!$res)
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
(isset($info['name']) ? Tools::safeOutput($info['name']) : 'No Name'),
(isset($info['id']) ? Tools::safeOutput($info['id']) : 'No ID')
(isset($info['name']) && !empty($info['name']))? Tools::safeOutput($info['name']) : 'No Name',
(isset($info['id']) && !empty($info['id']))? Tools::safeOutput($info['id']) : 'No ID'
);
else
{
@@ -2435,17 +2527,12 @@ class AdminImportControllerCore extends AdminController
$discount_rate = (float)$info['discount_rate'];
$tax_rate = (float)$info['tax_rate'];
// checks if one product is there only once
if (isset($product['id_product']))
{
if ($product['id_product'] == $id_product_attribute)
$this->errors[] = sprintf($this->l('Product (%d/%D) cannot be added twice (at line %d).'), $id_product,
$id_product_attribute, $current_line + 1);
else
$product['id_product'] = $id_product_attribute;
}
// checks if one product/attribute is there only once
if (isset($products[$id_product][$id_product_attribute]))
$this->errors[] = sprintf($this->l('Product/Attribute (%d/%d) cannot be added twice (at line %d).'), $id_product,
$id_product_attribute, $current_line + 1);
else
$product['id_product'] = 0;
$products[$id_product][$id_product_attribute] = $quantity_expected;
// checks parameters
if (false === ($supplier_reference = ProductSupplier::getProductSupplierReference($id_product, $id_product_attribute, $supply_order->id_supplier)))
@@ -2528,13 +2615,9 @@ class AdminImportControllerCore extends AdminController
protected static function usortFiles($a, $b)
{
$a = strrev(substr(strrev($a), 0, 14));
$b = strrev(substr(strrev($b), 0, 14));
if ($a == $b)
return 0;
return ($a < $b) ? 1 : -1;
return ($b < $a) ? 1 : -1;
}
protected function openCsvFile()
@@ -2579,37 +2662,37 @@ class AdminImportControllerCore extends AdminController
unlink(_PS_CAT_IMG_DIR_.$d);
break;
case $this->entities[$this->l('Products')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_shop');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_lang');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'category_product');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_tag');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image_lang');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image_shop');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_carrier');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'cart_product');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'compare_product');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_shop`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_lang`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'category_product`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_tag`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image_lang`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image_shop`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_carrier`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'cart_product`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'compare_product`');
if (count(Db::getInstance()->executeS('SHOW TABLES LIKE \''._DB_PREFIX_.'favorite_product\' '))) //check if table exist
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'favorite_product');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attachment');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_country_tax');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_download');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_group_reduction_cache');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_sale');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_supplier');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'scene_products');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'warehouse_product_location');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'stock');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'stock_available');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'stock_mvt');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customization');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customization_field');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supply_order_detail');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_impact');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'favorite_product`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attachment`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_country_tax`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_download`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_group_reduction_cache`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_sale`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_supplier`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'scene_products`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'warehouse_product_location`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'stock`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'stock_available`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'stock_mvt`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customization`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customization_field`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supply_order_detail`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_impact`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_shop`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination`');
@@ -2620,7 +2703,7 @@ class AdminImportControllerCore extends AdminController
break;
case $this->entities[$this->l('Combinations')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_impact');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_impact`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_lang`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group_lang`');
@@ -2630,26 +2713,26 @@ class AdminImportControllerCore extends AdminController
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_shop`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_image`');
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'stock_available` WHERE id_product_attribute !=0');
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'stock_available` WHERE id_product_attribute != 0');
break;
case $this->entities[$this->l('Customers')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer`');
break;
case $this->entities[$this->l('Addresses')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'address');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'address`');
break;
case $this->entities[$this->l('Manufacturers')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer_lang');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer_shop');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer_lang`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer_shop`');
foreach (scandir(_PS_MANU_IMG_DIR_) as $d)
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
unlink(_PS_MANU_IMG_DIR_.$d);
break;
case $this->entities[$this->l('Suppliers')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier_lang');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier_shop');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier_lang`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier_shop`');
foreach (scandir(_PS_SUPP_IMG_DIR_) as $d)
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
unlink(_PS_SUPP_IMG_DIR_.$d);
@@ -2678,6 +2761,7 @@ class AdminImportControllerCore extends AdminController
if (Tools::isSubmit('submitFileUpload'))
{
$path = _PS_ADMIN_DIR_.'/import/'.date('Ymdhis').'-';
if (isset($_FILES['file']) && !empty($_FILES['file']['error']))
{
switch ($_FILES['file']['error'])
@@ -2703,13 +2787,18 @@ class AdminImportControllerCore extends AdminController
break;
}
}
else if (!file_exists($_FILES['file']['tmp_name']) ||
!@move_uploaded_file($_FILES['file']['tmp_name'], _PS_ADMIN_DIR_.'/import/'.date('Ymdhis').'-'.$_FILES['file']['name']))
elseif (!preg_match('/.*\.csv$/i', $_FILES['file']['name']))
$this->errors[] = Tools::displayError('The extension of your file should be .csv.');
elseif (!file_exists($_FILES['file']['tmp_name']) ||
!@move_uploaded_file($_FILES['file']['tmp_name'], $path.$_FILES['file']['name']))
$this->errors[] = $this->l('An error occurred while uploading / copying the file.');
else
{
@chmod($path.$_FILES['file']['name'], 0664);
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=18');
}
}
else if (Tools::getValue('import'))
elseif (Tools::getValue('import'))
{
// Check if the CSV file exist
if (Tools::getValue('csv'))
@@ -2725,7 +2814,6 @@ class AdminImportControllerCore extends AdminController
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Products')]:
$import_type = $this->l('Categories');
$this->productImport();
$this->clearSmartyCache();
break;
@@ -2747,19 +2835,22 @@ class AdminImportControllerCore extends AdminController
$this->supplierImport();
$this->clearSmartyCache();
break;
// @since 1.5.0
case $this->entities[$import_type = $this->l('Supply Orders')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersImport();
break;
// @since 1.5.0
case $this->entities[$import_type = $this->l('Supply Order Details')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersDetailsImport();
break;
default:
$this->errors[] = $this->l('Please select what you would like to import');
}
// @since 1.5.0
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
switch ((int)Tools::getValue('entity'))
{
case $this->entities[$import_type = $this->l('Supply Orders')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersImport();
break;
case $this->entities[$import_type = $this->l('Supply Order Details')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersDetailsImport();
break;
}
if ($import_type !== false)
{
$log_message = sprintf($this->l('%s import'), $import_type);
@@ -2771,7 +2862,41 @@ class AdminImportControllerCore extends AdminController
else
$this->errors[] = $this->l('You must upload a file in order to proceed to the next step');
}
elseif ($filename = Tools::getValue('csvfilename'))
{
$filename = base64_decode($filename);
$file = _PS_ADMIN_DIR_.'/import/'.basename($filename);
if (realpath(dirname($file)) != _PS_ADMIN_DIR_.'/import')
exit();
if (!empty($filename))
{
$bName = basename($filename);
if ($delete = Tools::getValue('delete') && file_exists($file))
@unlink($file);
elseif (file_exists($file))
{
$bName = explode('.', $bName);
$bName = strtolower($bName[count($bName) - 1]);
$mimeTypes = array('csv' => 'text/csv');
if (isset($mimeTypes[$bName]))
$mimeType = $mimeTypes[$bName];
else
$mimeType = 'application/octet-stream';
if (ob_get_level())
ob_end_clean();
header('Content-Transfer-Encoding: binary');
header('Content-Type: '.$mimeType);
header('Content-Length: '.filesize($file));
header('Content-Disposition: attachment; filename="'.$filename.'"');
$fp = fopen($file, 'rb');
while (is_resource($fp) && !feof($fp))
echo fgets($fp, 16384);
exit;
}
}
}
parent::postProcess();
}
@@ -2826,4 +2951,4 @@ class AdminImportControllerCore extends AdminController
die;
}
}
}
}
@@ -42,6 +42,12 @@ class AdminInvoicesControllerCore extends AdminController
'cast' => 'intval',
'type' => 'bool'
),
'PS_INVOICE_TAXES_BREAKDOWN' => array(
'title' => $this->l('Enable the breakdown of taxes on the invoice:'),
'desc' => $this->l('Show a breakdown of taxes by tax rate on the invoice when there are several taxes combined'),
'cast' => 'intval',
'type' => 'bool'
),
'PS_INVOICE_PREFIX' => array(
'title' => $this->l('Invoice prefix:'),
'desc' => $this->l('Prefix used for invoice name (e.g. IN00001)'),
@@ -28,9 +28,6 @@ class AdminLocalizationControllerCore extends AdminController
{
public function __construct()
{
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct();
$this->fields_options = array(
+11 -1
View File
@@ -35,7 +35,7 @@ class AdminLogsControllerCore extends AdminController
$this->fields_list = array(
'id_log' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'employee' => array('title' => $this->l('Employee'), 'align' => 'center', 'width' => 100),
'employee' => array('title' => $this->l('Employee'), 'align' => 'center', 'width' => 100, 'havingFilter' => true),
'severity' => array('title' => $this->l('Severity (1-4)'), 'align' => 'center', 'width' => 50),
'message' => array('title' => $this->l('Message')),
'object_type' => array('title' => $this->l('Object type'), 'width' => 75),
@@ -64,10 +64,20 @@ class AdminLogsControllerCore extends AdminController
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'employee e ON (a.id_employee = e.id_employee)';
parent::__construct();
}
public function processDelete()
{
return Logger::eraseAllLogs();
}
public function initToolbar()
{
parent::initToolbar();
$this->toolbar_btn['delete'] = array(
'short' => 'Erase',
'desc' => $this->l('Erase all'),
'js' => 'if (confirm(\''.$this->l('Are you sure?').'\')) document.location = \''.$this->context->link->getAdminLink('AdminLogs').'&amp;token='.$this->token.'&deletelog=1\';'
);
unset($this->toolbar_btn['new']);
}
@@ -140,7 +140,7 @@ class AdminManufacturersControllerCore extends AdminController
'lastname' => array(
'title' => $this->l('Last name'),
'width' => 100,
'filter_key' => 'a!name'
'filter_key' => 'a!lastname'
),
'postcode' => array(
'title' => $this->l('Zip Code/Postal Code'),
@@ -256,7 +256,7 @@ class AdminManufacturersControllerCore extends AdminController
'lang' => true,
'cols' => 60,
'rows' => 10,
'class' => 'rte',
'autoload_rte' => 'rte', //Enable TinyMCE editor for short description
'hint' => $this->l('Invalid characters:').' <>;=#{}'
),
array(
@@ -266,7 +266,7 @@ class AdminManufacturersControllerCore extends AdminController
'lang' => true,
'cols' => 60,
'rows' => 10,
'class' => 'rte',
'autoload_rte' => 'rte', //Enable TinyMCE editor for description
'hint' => $this->l('Invalid characters:').' <>;=#{}'
),
array(
@@ -570,7 +570,7 @@ class AdminManufacturersControllerCore extends AdminController
default:
parent::initToolbar();
$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=manufacturers',
'desc' => $this->l('Import')
);
}
@@ -730,4 +730,4 @@ class AdminManufacturersControllerCore extends AdminController
{
return true;
}
}
}
+13 -3
View File
@@ -98,6 +98,8 @@ class AdminModulesControllerCore extends AdminController
$this->list_modules_categories['others']['name'] = $this->l('Other Modules');
$this->list_modules_categories['mobile']['name'] = $this->l('Mobile');
uasort($this->list_modules_categories, array($this, 'checkCategoriesNames'));
// Set Id Employee, Iso Default Country and Filter Configuration
$this->id_employee = (int)$this->context->employee->id;
$this->iso_default_country = $this->context->country->iso_code;
@@ -129,6 +131,14 @@ class AdminModulesControllerCore extends AdminController
$this->logged_on_addons = true;
}
public function checkCategoriesNames($a, $b)
{
if ($a['name'] === $this->l('Other Modules'))
return true;
return (bool)($a['name'] > $b['name']);
}
public function setMedia()
{
parent::setMedia();
@@ -768,7 +778,7 @@ class AdminModulesControllerCore extends AdminController
}
if (isset($_GET['update']))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : ''));
}
public function postProcess()
@@ -1098,8 +1108,8 @@ class AdminModulesControllerCore extends AdminController
$modules[$km]->preferences = $modules_preferences[$modules[$km]->name];
}
unset($object);
if (isset($module->version_addons))
$upgrade_available[] = array('anchor' => ucfirst($module->name), 'name' => $module->displayName);;
if ($module->installed && isset($module->version_addons) && $module->version_addons)
$upgrade_available[] = array('anchor' => ucfirst($module->name), 'name' => $module->displayName);
}
// Don't display categories without modules
@@ -308,7 +308,6 @@ class AdminModulesPositionsControllerCore extends AdminController
$dir = str_replace($admin_dir, '', dirname($_SERVER['SCRIPT_NAME']));
if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1)
$lang = Language::getIsoById($this->context->employee->id_lang).'/';
$url = Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().$dir.$lang.Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params);
return $url;
}
+7 -3
View File
@@ -110,7 +110,8 @@ class AdminOrdersControllerCore extends AdminController
'type' => 'select',
'list' => $statuses_array,
'filter_key' => 'os!id_order_state',
'filter_type' => 'int'
'filter_type' => 'int',
'order_key' => 'osname'
),
'date_add' => array(
'title' => $this->l('Date'),
@@ -506,7 +507,7 @@ class AdminOrdersControllerCore extends AdminController
if (Tools::isSubmit('generateDiscountRefund') && !count($this->errors))
{
$cart_rule = new CartRule();
$cart_rule->description = sprintf($this->l('Credit card slip for order #%d'), $order->id);
$cart_rule->description = sprintf($this->l('Credit slip for order #%d'), $order->id);
$languages = Language::getLanguages(false);
foreach ($languages as $language)
// Define a temporary name
@@ -804,7 +805,7 @@ class AdminOrdersControllerCore extends AdminController
if (!Validate::isLoadedObject($order))
$this->errors[] = Tools::displayError('The order cannot be found');
elseif (!Validate::isNegativePrice($amount))
elseif (!Validate::isNegativePrice($amount) || !(float)$amount)
$this->errors[] = Tools::displayError('The amount is invalid.');
elseif (!Validate::isString(Tools::getValue('payment_method')))
$this->errors[] = Tools::displayError('The selected payment method is invalid.');
@@ -1341,11 +1342,14 @@ class AdminOrdersControllerCore extends AdminController
$product['warehouse_name'] = '--';
}
$gender = new Gender((int)$customer->id_gender, $this->context->language->id);
// Smarty assign
$this->tpl_view_vars = array(
'order' => $order,
'cart' => new Cart($order->id_cart),
'customer' => $customer,
'gender' => $gender,
'customer_addresses' => $customer->getAddresses($this->context->language->id),
'addresses' => array(
'delivery' => $addressDelivery,
@@ -213,6 +213,7 @@ class AdminPaymentControllerCore extends AdminController
if ($name_id == 'country'
&& isset($module->limited_countries)
&& !empty($module->limited_countries)
&& is_array($module->limited_countries)
&& !(in_array(strtoupper($item['iso_code']), array_map('strtoupper', $module->limited_countries))))
$list['items'][$key_item]['check_list'][$key_module] = null;
}

Some files were not shown because too many files have changed in this diff Show More