Compare commits

...

672 Commits

Author SHA1 Message Date
gRoussac 7f02c8ca58 [-] WS: Fix bug #PSCFV-10970 use configuration for uploaded images quality 2013-11-15 18:50:28 +01:00
gRoussac bfed3532bf [*] BO : AdminPerformances Hide warnings message when not necessary 2013-11-15 16:12:07 +01:00
gRoussac 2962141d51 [-] BO : Fix warning when no memcached servers 2013-11-15 15:39:00 +01:00
gRoussac 73bf2a7db1 [-] BO : Fix #PSCFV-11016 typo 2013-11-15 15:16:02 +01:00
gRoussac 9aa656c9d7 // typo 2013-11-15 15:10:12 +01:00
gRoussac 1140b5e8b5 [*] FO : Fix #PSCFV-8715 add product.attributes in carrier tpl 2013-11-15 15:06:30 +01:00
gRoussac 6a690b255b [-] BO : Model return html error messagae instead of json while image uploading 2013-11-15 12:20:10 +01:00
gRoussac 152960639f [-] BO : Product final price can not be hidden on loading tab, report of https://github.com/PrestaShop/PrestaShop/commit/6c6c3b240ee2249b7f99be1a112905cd0edbee46 2013-11-15 11:36:07 +01:00
Gregory Roussac 448a4c9994 Merge pull request #980 from djfm/development
// no line breaks in $this->l()
2013-11-15 02:23:39 -08:00
gRoussac 7526fe4766 // missing trailing semi-column 2013-11-15 11:16:48 +01:00
Jerome Nadaud 50eee795ed // Add truncate category description preserving html tags 2013-11-15 11:03:06 +01:00
gRoussac 97be96ede8 [-] MO : Missinag closing href 2013-11-15 10:54:50 +01:00
gRoussac 0b47ef1b3b [-] BO : test on xml string follow up https://github.com/PrestaShop/PrestaShop/pull/690#issuecomment-28542506 2013-11-15 10:51:46 +01:00
fram ba15d975bc // no line breaks in $this->l() 2013-11-15 10:44:01 +01:00
gRoussac 47d58ff930 [*] FO : set at least a class to body 2013-11-14 19:03:12 +01:00
gRoussac d06bf10bbb [-] FO : Fix bug #PSCFV-10911, doubles in cart rules highlight 2013-11-14 16:35:11 +01:00
gRoussac d0d234f555 // typo, sorry about this 2013-11-14 15:58:42 +01:00
gRoussac 19d975a0b4 // typo 2013-11-14 14:48:14 +01:00
gRoussac 6393746f04 [-] BO : 406 when mod_security follow up https://github.com/PrestaShop/PrestaShop/commit/034e6a7e7f391e3a8861248db45a4a376b19633c 2013-11-14 11:43:05 +01:00
gRoussac db99f188a2 [-] BO : AdminImport, execption when creating groups 2013-11-13 18:23:41 +01:00
Gregory Roussac fe8e349931 Merge pull request #975 from ldecoker/patch-10
[-] FO : _PS_THEME_MOBILE_OVERRIDE_DIR_ not defined
2013-11-13 09:14:49 -08:00
ldecoker 3f8b76f78c [-][FO] _PS_THEME_MOBILE_OVERRIDE_DIR_ not defined
When there is no mobile theme provided with the current theme, the variable _PS_THEME_MOBILE_OVERRIDE_DIR_ is not defined. We so get the following error in apache logs:

"PHP Notice:  Use of undefined constant _PS_THEME_MOBILE_OVERRIDE_DIR_ - assumed '_PS_THEME_MOBILE_OVERRIDE_DIR_' in FrontController.php"
2013-11-13 18:12:59 +01:00
gRoussac 947f9bb21c // small isset in productcomments 2013-11-13 16:39:33 +01:00
Rémi Gaillard 83400c691c Merge pull request #973 from djfm/development
//translations
2013-11-13 06:34:38 -08:00
Rémi Gaillard f4601d9680 // default form language 2013-11-13 15:37:58 +01:00
fram 28e1a94bb6 // instead instead of insted 2013-11-13 15:10:06 +01:00
fram ad6367f2bf // updated native translations 2013-11-13 15:06:47 +01:00
gRoussac 5a8c335d78 [-] FO : Bad value for back when controller name is sent 2013-11-13 12:30:39 +01:00
gRoussac 4479db88a0 [-) PDF : nowrap on several product prices 2013-11-13 11:52:10 +01:00
Francois Gaillard 339c954cb3 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-13 11:24:51 +01:00
Jerome Nadaud c4837e65ec [-] FO : FixBug #PSCFV-9291 - Ecotax increment display price in product combination 2013-11-13 11:24:25 +01:00
Jerome Nadaud 2117c89352 [-] FO : FixBug #PSCFV-9291 - Ecotax increment display price in product combination 2013-11-13 11:04:13 +01:00
Jerome Nadaud 9f10a851e5 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-13 10:58:01 +01:00
Gregory Roussac 66a9ee03fc Merge pull request #971 from studiokiwik/sk-ps15x-008
[-] FO : fix contact-form id_order input when customer is not logged
2013-11-13 01:42:00 -08:00
gRoussac c69688cc11 [-] BO : Fix bug #PSCFV-10990 bad version comparison for ps_versions_compliancy 2013-11-13 10:14:21 +01:00
Mikael Blotin 26d1ad0668 [-] FO : fix contact-form id_order input when customer is not logged 2013-11-13 10:12:31 +01:00
Jerome Nadaud 6a99b84452 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-13 10:02:28 +01:00
gRoussac 6ddf220aee [-] Fo : Call Gmaps on https if required 2013-11-12 21:16:09 +01:00
gRoussac 9328a3c473 // forgot to commit https://github.com/PrestaShop/PrestaShop/commit/036e2362c97ca00e9066076af1c45fc8f9946d56 2013-11-12 19:17:54 +01:00
gRoussac c8dfe1c174 [-] FO : Wordwrap on prices in history 2013-11-12 19:17:12 +01:00
Rémi Gaillard 75df12dd94 [-] Core: Group::getCurrent() return the default customer group of the shop if default customer group is not associated to shop 2013-11-12 18:49:52 +01:00
Gregory Roussac 6d7e2055ce Merge pull request #968 from ccauw/patch-12
[*] BO : add class on TD in standard List
2013-11-12 09:38:03 -08:00
gRoussac 4d327a537f [*] FO : addTextFieldToProduct without Line feed, follow up https://github.com/PrestaShop/PrestaShop/pull/962#issuecomment-28294571 2013-11-12 18:28:42 +01:00
ccauw 747926039a [*] BO : add class on TD in standard List
Back office :
Add a class on TD in list created by getList()
In fields_list array of AdminController, we can add a new parameter('class')

example :
		'name' => array(
			'title' => $this->l('Name'),
			'width' => 150,
			'class' => 'ma_classe',
			'filter_key' => 'b!name'
		),
This parameter can be used for javascript effect, ...

Thanks.
2013-11-12 18:01:27 +01:00
gRoussac 5e4382eb08 [-] BO : Fix bug #PSCFV-10982 reduction group truncated 2013-11-12 17:55:07 +01:00
gRoussac 036e2362c9 [+] CORE : Fixed cache_id 2013-11-12 17:09:38 +01:00
Fabio Chelly fc193d5c8b Merge remote-tracking branch 'origin/development' into development 2013-11-12 16:36:19 +01:00
Rémi Gaillard 75e6a03591 // small fix 2013-11-12 16:38:34 +01:00
Fabio Chelly dd05692400 [-] FO : Fixed errors when calculating most selled products from footer link 2013-11-12 16:36:07 +01:00
Rémi Gaillard b5eb7c5c28 // typo 2013-11-12 16:25:13 +01:00
gRoussac f0f3679cbd [*] FO : https on TOS in fancybox, follow up https://github.com/PrestaShop/PrestaShop/pull/956 2013-11-12 15:56:04 +01:00
Rémi Gaillard 175da3ecf6 Merge pull request #965 from djfm/IETF
[*] LO : Fix PSCFV-10876: use IETF code to set language of shop, not 'is...
2013-11-12 06:05:10 -08:00
fram 743c4f4607 [*] LO : Fix PSCFV-10876: use IETF code to set language of shop, not 'iso' code, allows to distinguish between chinese variants etc. 2013-11-12 14:59:36 +01:00
gRoussac 40abef8aac Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-12 12:32:37 +01:00
Rémi Gaillard 8be339463d // small fix 2013-11-12 12:36:51 +01:00
gRoussac f0f630fb50 [-] FO : #PSCFV-10978 firstname displayed instead of lastname in invoice address 2013-11-12 12:32:21 +01:00
gRoussac 3f42a381a4 [*] FO : Redirect to address.tpl when !Address::isCountryActiveById 2013-11-12 12:12:19 +01:00
Gregory Roussac 0e1898be09 Merge pull request #963 from djfm/sprintf
// do not use sprintf in installer when it is useless
2013-11-12 01:45:39 -08:00
gRoussac c1969028f2 [-] FO : Customized meesage with carriage return follow up #962 2013-11-12 10:41:19 +01:00
Gregory Roussac cd83ec93c7 Merge pull request #961 from joseantgv/patch-4
[-] MO : Whishlist, innerhtml in html jquery
2013-11-12 00:42:04 -08:00
fram ab730dc3da // do not use sprintf when it is useless 2013-11-12 09:21:05 +01:00
joseantgv 7523828a7a Update ajax-wishlist.js
innerHtml can not execute javascript from "data". If someone modify php files returned from jquery function and includes a script, it's not executed.
2013-11-11 16:58:52 +01:00
gRoussac e2d8a33a81 [*] FO : Cache on getDiscountsCustomer, follow up https://github.com/PrestaShop/PrestaShop/pull/960 2013-11-11 14:02:11 +01:00
gRoussac a7869a1f06 [*] CORE : Remove duplicate SQL queries 2013-11-11 13:41:23 +01:00
gRoussac de404706d9 [*] CORE : Profiling hide non doubles 2013-11-11 02:09:50 +01:00
gRoussac 3f9338e13d [*] CORE : Cache store for isAssociatedToShop::isAssociatedToShop 2013-11-11 01:59:10 +01:00
gRoussac 38da826671 [-] FO : getTaxCalculator bad cache key again // sorry about that 2013-11-11 01:37:20 +01:00
gRoussac fee461fdf1 [*] FO : Set cache for StockAvailable::getQuantityAvailableByProduct 2013-11-11 01:00:55 +01:00
gRoussac 8dd951c2df [*] MO : Remove calls to isRegisteredInHook in crossselling and productscategory 2013-11-11 00:36:17 +01:00
gRoussac 7e93b2cffd [-] FO : getTaxCalculator bad cache key 2013-11-11 00:13:35 +01:00
gRoussac 19da345531 [-] BO : Could not check all modules after ajax call 2013-11-10 21:51:14 +01:00
Fabio Chelly bd8eebdc33 Merge remote-tracking branch 'origin/development' into development 2013-11-08 18:12:23 +01:00
Fabio Chelly 4312d241f3 [-] MO :Fixed #PNM-1654 (Loyalty module) by using most expensive attribute instead of default one 2013-11-08 18:12:11 +01:00
gRoussac 7eb70486e0 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-08 15:54:28 +01:00
gRoussac ebc3dfee62 [-] BO : Fix css bug #PSCFV-10899, fixed fix-toolbar z-index 2013-11-08 15:54:13 +01:00
Gregory Roussac ee487fde59 Merge pull request #953 from Shagshag/patch-4
[*] BO: kb was not translatable
2013-11-08 06:37:26 -08:00
Shagshag c7f1fcb49a kb was not translatable 2013-11-08 15:33:49 +01:00
gRoussac 530b6dc501 // Productscomments remove warnings 2013-11-08 15:00:56 +01:00
gRoussac 5364be686e // More simple names for csv import files 2013-11-08 14:59:43 +01:00
Jérôme Nadaud aaaf8588c1 Merge pull request #931 from PhpMadman/patch-2
[-] MO : Mailalert was not using order reference
2013-11-08 04:01:39 -08:00
PhpMadman 6ee2852fa5 [-] MO : Mailalert was not using order reference 2013-11-08 12:48:49 +01:00
Jérôme Nadaud 02acd47c9e Merge pull request #950 from pelTek/patch-2
Added states to Greek localization pack
2013-11-08 02:46:55 -08:00
Chris 32e92762f5 Added states to Greek localization pack
Added states to Greek localization pack
2013-11-08 12:44:42 +02:00
Francois Gaillard 3b7387ffe8 [-] Classes : Hook - Installer & context shop id 2013-11-08 11:00:14 +01:00
gRoussac 472dc8c27d [-] MO : Blocklayered follow up https://github.com/PrestaShop/PrestaShop/commit/a6e67b078e067445eef358e907649e843a1dc26a#commitcomment-4538556 2013-11-07 17:59:04 +01:00
Fabio Chelly 92cf31e5c3 [-] MO : Fixed #PNM-1600 by modifying getPageLink() 2013-11-07 16:46:30 +01:00
Fabio Chelly fa7d44d67f Merge remote-tracking branch 'origin/development' into development 2013-11-07 16:39:26 +01:00
Fabio Chelly b9c4b5d2a7 [-] FO : Prevents warning in safePostVars when $_POST has been unset 2013-11-07 16:38:53 +01:00
Gregory Roussac fbd28f3e49 Merge pull request #942 from Jacky75/20131107_payment_and_groups
[-] FO : in multistore payment module restrictions by customer group was...
2013-11-07 06:39:57 -08:00
Daniele Giachino 8c8340db4e [-] FO : in multistore payment module restrictions by customer group was not applied to specific shop 2013-11-07 15:18:59 +01:00
gRoussac 7cc351e83d [-] BO : Fix bug #PSCFV-10932, ranges input disabled on load 2013-11-07 15:11:30 +01:00
gRoussac 91cde1ab3a [-] BO : getCMSPages to associated shop in cmscontroller 2013-11-07 12:09:58 +01:00
gRoussac e6f9f806bf [-] FO : Fix bug #PSCFV-10892, getCMSPages by id_shop thnaks @jd440 2013-11-07 12:03:35 +01:00
gRoussac fc4a660f76 [-] BO : Fix bug #PSCFV-10666 product_supllier currency set to 0 2013-11-07 11:24:32 +01:00
Jerome Nadaud f3147b4e57 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-07 09:47:47 +01:00
gRoussac 514c087962 [*] BO : New import csv files 2013-11-06 18:38:32 +01:00
gRoussac 00887942d3 // preg_last_error not available on every stacks 2013-11-06 18:32:39 +01:00
gRoussac afe6c9bc6f // missing dir sep on is_dir (open_basedir) 2013-11-06 18:23:01 +01:00
gRoussac fc6041fa33 [-] IN : bad path in create multistore 2013-11-06 18:06:19 +01:00
gRoussac 76b03856e2 // missing trailing dir sep 2013-11-06 17:33:18 +01:00
Rémi Gaillard ef5779f63f // d321b9a5bc 2013-11-06 17:11:31 +01:00
Jérôme Nadaud d0522417eb Merge pull request #937 from PhpMadman/DiscountPrice
[*] FO : Added possibility to display new price instead of quantity discount
2013-11-06 08:06:16 -08:00
Rémi Gaillard 50c95f568c Merge pull request #935 from jeckyl/patch-4
Update cart-summary.js
2013-11-06 07:01:02 -08:00
jeckyl d321b9a5bc Update cart-summary.js
Just add this space to separate this classes. It's to display or not carrier option when we select one or another carrier during order finalisation.
2013-11-06 14:42:00 +01:00
PhpMadman d95885caae [*] FO : Added posibilty to display new price instead of quantity discount 2013-11-06 14:41:42 +01:00
fchellypresta 71139df65f Merge pull request #796 from PhpMadman/patch-1
[*] BO: #PNM-1472 Changed label and transparency range check to 1
2013-11-06 03:06:47 -08:00
gRoussac 1fb8ef823d [-] BO : Fix bug #PSCFV-10937, bad escaping for var product_prices in prices.tpl 2013-11-06 11:50:52 +01:00
Jérôme Nadaud 29001b3392 Merge pull request #930 from PhpMadman/patch-3
[-] BO : Cart was not using order reference
2013-11-06 02:30:57 -08:00
PhpMadman eac7fbb694 [-] BO : Cart was not using order reference, corrected syntax 2013-11-06 11:06:46 +01:00
Jérôme Nadaud fa4b5e0b7d Merge pull request #927 from djfm/loc
[*] LO : Added states to Spanish localization pack
2013-11-06 00:31:46 -08:00
Jérôme Nadaud d30830f6fe Merge pull request #932 from prestalab/patch-1
// FIX: tags with UTF-8 chars
2013-11-05 23:49:43 -08:00
PrestaLab b2e5c6090d Fixed tags with UTF-8 chars
Fixed error Tag->Name is not valid if tag in non latin chars
2013-11-05 23:33:44 -08:00
PhpMadman 2556a7bb68 [-] MO : Mailalert was not using order reference 2013-11-05 20:46:10 +01:00
PhpMadman 7226f33f90 [-] BO : Cart was not using order reference 2013-11-05 20:42:57 +01:00
Jerome Nadaud 3f3dc0feb9 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-05 16:39:12 +01:00
Rémi Gaillard d4253b9849 // small fix 2013-11-05 15:33:21 +01:00
fram 2b8d069cf9 [*] LO : Added states to Spanish localization pack 2013-11-05 12:06:31 +01:00
Rémi Gaillard 9817ef6840 // small fix on profiling 2013-11-05 11:54:22 +01:00
gRoussac 581645ce6d [-) BO : Action is mandatory for a cart rule 2013-11-05 11:26:10 +01:00
gRoussac 87be153e42 [-] MO : Blockcategories last_visited_category must not be cached 2013-11-05 11:16:52 +01:00
Gregory Roussac f85c6b59c8 Merge pull request #921 from Jacky75/20131105-layered-feature-sorted
[*] MO : Blocklayered filter feature blocks sorted
2013-11-05 01:50:48 -08:00
Daniele Giachino 99e98a5164 In multistore, layered filters about categories are not loading the category name from the proper shop 2013-11-05 10:45:23 +01:00
Damien Metzger 4c1ad83b18 // "Fixed" strict standard 2013-11-05 10:22:39 +01:00
gRoussac 26a43260c5 [-] CORE : invalid method name in displayAjax method of Controller action 2013-11-05 10:18:53 +01:00
Gregory Roussac c69429c126 Merge pull request #922 from Jacky75/20131105-layered-categories-shop
[-] MO : Missing context shop for categories
2013-11-05 01:10:39 -08:00
Daniele Giachino 02c04a9884 In multistore, layered filters about categories are not loading the category name from the proper shop 2013-11-05 09:40:53 +01:00
Daniele Giachino cf65877f3f layered filters involving features are now natural sorted 2013-11-05 09:32:36 +01:00
Daniele Giachino f0abdca08f layered filters involving features are now natural sorted 2013-11-05 09:30:13 +01:00
gRoussac 0e54bf0f76 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-04 18:27:39 +01:00
Jerome Nadaud 12276f41fb // Update image when updated 2013-11-04 18:26:24 +01:00
gRoussac be13f82b30 [*] FO: Follow up https://github.com/PrestaShop/PrestaShop/commit/e86c56172dad2892d5c7e7dbb0908b0f4ffbaae0 2013-11-04 18:20:01 +01:00
Rémi Gaillard f5cc6862cb // don't die on autoload 2013-11-04 18:08:24 +01:00
Rémi Gaillard 0a65de5e5f Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-04 17:22:21 +01:00
Rémi Gaillard f4740088c1 // small fix 2013-11-04 17:22:08 +01:00
gRoussac c44b1d617c [-] BO : Could not change image position 2013-11-04 16:59:03 +01:00
gRoussac c452444620 [-] IN : Could not install when session_start() does not fail on ajax requests 2013-11-04 15:47:29 +01:00
gRoussac 3f817e8729 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-04 14:31:29 +01:00
gRoussac 66f314bbb2 // missing trailing bracket in modules/productcomments/config.xml 2013-11-04 14:31:15 +01:00
Rémi Gaillard bf8cd29868 // validator on message field 2013-11-04 14:21:42 +01:00
gRoussac b8b7fbaf71 [*] MO : New modules version since 1.5.6.0 2013-11-04 11:57:31 +01:00
gRoussac 9ea79f8cb5 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-11-04 11:48:25 +01:00
Rémi Gaillard b3c54a59dd // typo 2013-11-04 11:48:30 +01:00
Rémi Gaillard 06d73554be // preg instead strpos 2013-11-04 11:39:48 +01:00
gRoussac ad555f1d30 [-] IN : Follow up #PSCFV-10671 update messages in base and https://github.com/PrestaShop/PrestaShop/commit/b16e4b5a8ee6bdab13808f8ab473bda6c060c086 2013-11-04 11:10:40 +01:00
Gregory Roussac 4b6ee72072 Merge pull request #894 from codeurWeb/patch-6
[-] MO : Fix NetworkError 404 Not Found on admin in blocklayered.php
2013-11-04 02:02:10 -08:00
Rémi Gaillard e000f8c627 // something is missing in the last commit 2013-11-04 11:00:21 +01:00
Rémi Gaillard 6ef7f258ea // small fix 2013-11-04 10:34:58 +01:00
Jerome Nadaud 2be72f50d1 [-] FO : FixBug Categories description 2013-11-04 10:29:44 +01:00
Rémi Gaillard d49c4cf62e [-] BO: Fix from name when replying to customer threads 2013-11-04 09:38:12 +01:00
gRoussac c7323c2bfe [-] CORE : Fix bug #PSCFV-10901 warnings on htmlentities 2013-11-03 22:59:04 +01:00
gRoussac 2a3192d98c [-] IN : Refacto for update_customer_default_group bad logical 2013-11-03 14:55:25 +01:00
gRoussac b16e4b5a8e [-] IN : Lower memory usage in migrate_orders, fix update_order_messages loop 2013-11-03 01:49:16 +01:00
gRoussac 8f72282594 [-] IN : update_customer_default_group returning false 2013-11-02 21:51:13 +01:00
gRoussac a5bb4f0323 [-] IN: Fix [insert order detail 1] error while upgrading 2013-11-02 20:39:53 +01:00
gRoussac 062fb90c2e [-] IN : Fix Unknown column 'module_name' in 'ps_webservice_account' during upgrade 2013-10-31 19:24:41 +01:00
Jerome Nadaud 9193a29a44 [+] MO : Blockcart - Add error handler on ajax function 2013-10-31 19:02:43 +01:00
Jerome Nadaud 671062af07 // Add Disable overrides to debug mode 2013-10-31 18:41:56 +01:00
gRoussac 80c60be952 [-] BO : Do not enable rewrite url for index 2013-10-31 16:20:55 +01:00
Rémi Gaillard 1b019dffc5 // Fix lang detection on dispatcher 2013-10-31 15:28:19 +01:00
gRoussac f9dc0b0252 [-] MO : Could not translate in transit mail, revert from https://github.com/viger-creator/PrestaShop/commit/3213b5dffb266ddb0639b94f72babd892328ffa2 2013-10-31 14:20:21 +01:00
Rémi Gaillard 9611ea1f70 [-] BO: Fix empty group list on changing opt or newsletter on customers listing 2013-10-31 11:22:40 +01:00
Rémi Gaillard d17515a728 // don't format currency on input 2013-10-31 10:22:38 +01:00
gRoussac 036fa7cba6 [-] FO : Fix bug #PSCFV-10889 wrong color when oos product 2013-10-31 10:18:28 +01:00
Damien Metzger 9c57c71deb Merge pull request #913 from djfm/development
// Installer Translations
2013-10-31 01:48:56 -07:00
djfm 7812731095 // removed hard-coded space before ellipsis (...) in English installer steps 2013-10-31 08:29:05 +00:00
djfm a8a204edf3 // small correction in English installer text 2013-10-31 08:25:57 +00:00
djfm 11f60492be // removed unnecessary punctuation in English installer strings, both in source code and translations 2013-10-31 08:09:14 +00:00
gRoussac f919cc899d [-] IN : Set conversion rate to 1 if equal 0 in base 2013-10-30 20:06:47 +01:00
gRoussac fbdddba753 [-] IN : Set default conversion rate to 1 not 0 2013-10-30 19:03:36 +01:00
gRoussac cbfa8dfc30 // forgot to commit in https://github.com/PrestaShop/PrestaShop/commit/f78cde96d633f65ece5700d2bc9793f134bdb7e6 2013-10-30 19:02:24 +01:00
gRoussac 8547f663d1 [-] BO : AdminImport withdraw separator changed in js 2013-10-30 18:46:02 +01:00
gRoussac 372130f7d7 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-30 18:37:46 +01:00
gRoussac f78cde96d6 [-] BO : AdminImport wrong group by default 2013-10-30 18:37:26 +01:00
Jerome Nadaud 48f00b2367 [-] BO : FixBug #PSCFV-10882 - Add json encode and decode smarty modifier via tools class 2013-10-30 18:28:17 +01:00
djfm c958436a76 // Dutch installer translations 2013-10-30 17:26:22 +00:00
djfm a56fb7c639 // Polish installer translations 2013-10-30 17:06:52 +00:00
djfm 16efe89bed // improved installer translations: no colons in translations and filled some missing fields 2013-10-30 16:57:30 +00:00
gRoussac 56799f53c8 [-] Bo : AdminImport customer group default 2013-10-30 17:12:20 +01:00
Jerome Nadaud da43700361 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-30 16:48:26 +01:00
Jerome Nadaud d7b46e80af [+] BO : Add debug mode system 2013-10-30 16:48:16 +01:00
gRoussac b311a0c719 [-] BO : Fix bug #PSCFV-10872 AdminImport could not import supllier orders 2013-10-30 16:06:38 +01:00
Rémi Gaillard a0f4eab4c1 // typo 2013-10-30 15:40:40 +01:00
gRoussac 9ef10ee806 [-] IN : Handle RC PHP_VERSION 2013-10-30 15:03:07 +01:00
Rémi Gaillard f9b1545037 // missing file 2013-10-30 14:59:08 +01:00
Rémi Gaillard c56e8471c2 [-] BO: fix the checkbox of shop activation on modules configuration 2013-10-30 14:57:15 +01:00
gRoussac 8953c55b7f [-] BO : Adminimport default customers group 2013-10-30 12:30:22 +01:00
Jérôme Nadaud 653c38e01a Merge pull request #911 from madef/development
[-] BO : tagify call twice if field is not translatable
2013-10-30 00:55:53 -07:00
Madef 78af47e2d3 [-] BO : tagify call twice if field is not translatable 2013-10-29 23:18:34 +01:00
gRoussac 26b4fbf883 [*] BO : Manual merge of https://github.com/PrestaShop/PrestaShop/pull/891 1/2 2013-10-29 19:07:31 +01:00
gRoussac c98b5e0c78 [*] CORE : Manual merge of https://github.com/PrestaShop/PrestaShop/ thanks @kpodemski 2013-10-29 19:05:21 +01:00
Rémi Gaillard 6d5ca9969e // js error 2013-10-29 17:56:29 +01:00
Gregory Roussac 90bef56c84 Merge pull request #907 from djfm/development
// Frenglish
2013-10-29 08:24:45 -07:00
gRoussac 75cde08776 // update conf message in AdminImport 2013-10-29 16:16:55 +01:00
gRoussac c6319a754e [-] BO : Stats are empty when no conversion rate 2013-10-29 16:04:15 +01:00
djfm 9d18ef8186 // Frenglish 2013-10-29 14:44:51 +00:00
Gregory Roussac f58526c701 Merge pull request #905 from PhpMadman/RMARef
[-] BO : Order-follow displayed order id instead of order reference
2013-10-29 07:44:26 -07:00
Damien Metzger d5eedd5eaa Merge pull request #906 from djfm/development
// Small fix
2013-10-29 07:42:07 -07:00
gRoussac a43851469e [-] CORE : Currency conversion rate can not be 0 2013-10-29 15:39:17 +01:00
djfm 0288696c90 // English 2013-10-29 14:37:55 +00:00
Rémi Gaillard 64706075d5 // Fix default language on BO forms 2013-10-29 15:32:31 +01:00
PhpMadman 7c1623c7fa [-] BO : Order-follow displayed order id instead of order reference 2013-10-29 14:53:50 +01:00
Jérôme Nadaud ed2fbba996 Merge pull request #903 from PhpMadman/patch-2
[-] BO : hide stmp options when selecting never send emails
2013-10-29 05:31:02 -07:00
PhpMadman 87bb957431 fixed missing comma 2013-10-29 13:28:00 +01:00
PhpMadman 7b029457e4 [-] BO : hide stmp options when selecting never send emails 2013-10-29 12:41:24 +01:00
Jerome Nadaud b605f33359 [-] BO : FixBug #PSCFV-10866 - Tagify system not working 2013-10-29 12:07:30 +01:00
Jerome Nadaud 580e201c48 [-] BO : FixBug #PSCFV-9319 - display only valid order id 2013-10-29 11:38:48 +01:00
gRoussac d409614222 [-] FO : CustomerMessage ip_address to string 2013-10-29 11:18:53 +01:00
djfm e1c7541a38 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-29 10:01:00 +00:00
gRoussac 1bee84d26c [-] BO : Do not delete other default jpg when _deleteOldImages and type defined 2013-10-29 10:57:33 +01:00
gRoussac af61191a7e // rename field Action when out of stock 2013-10-29 10:55:46 +01:00
Rémi Gaillard 07222be5dd // demo mode on ajaxfilemanager 2013-10-29 10:53:00 +01:00
Jerome Nadaud 9f2580f3bd Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-29 10:31:12 +01:00
Jerome Nadaud d2e475dd3a // Removed line from merge 2013-10-29 10:30:59 +01:00
Rémi Gaillard 2b67d7072c // type of logger field 2013-10-29 10:18:29 +01:00
Gregory Roussac b885c63564 Merge pull request #900 from kpodemski/patch-10
[*] MO: productcomments optimization
2013-10-29 02:06:56 -07:00
Gregory Roussac d74291e5b5 Merge pull request #901 from kpodemski/patch-11
[*] MO: blocksharefb optimization
2013-10-29 02:06:25 -07:00
Jerome Nadaud 1d90218e0d // Update mailalert module version 2013-10-29 10:00:57 +01:00
Jerome Nadaud 9660cef0aa [-] MO : mailalert - Fix deprecated warning on displayDate 2013-10-29 09:58:42 +01:00
Jérôme Nadaud 4b1f198cc4 Merge pull request #899 from cedricfontaine/patch-3
Update stores.js
2013-10-29 01:43:03 -07:00
gRoussac 0aca1d4a67 [*] BO : AdminProducts find smallest images 2013-10-29 08:47:41 +01:00
Krystian Podemski 526f32b6a0 [*] MO: blocksharefb optimization 2013-10-28 23:24:32 +01:00
Krystian Podemski faa4a18a82 [*] MO: productcomments optimization 2013-10-28 23:21:35 +01:00
gRoussac 79cba4b655 [-] FO : Fix bug #PSCFV-10851, no shop restriction in vouchers display in cart 2013-10-28 19:00:00 +01:00
cedricfontaine 0ba8fbc39a Update stores.js
Phone number is already in the address field
2013-10-28 13:46:42 -04:00
Rémi Gaillard edf54eb2ca // re-generate class_index on the first step of install 2013-10-28 18:43:02 +01:00
gRoussac e86c56172d [*] FO: Can not establish purchase total when tax incl. 2013-10-28 17:42:23 +01:00
Jerome Nadaud 48b7a49b1a // Product image upload failed with bad content-type header 2013-10-28 14:58:19 +01:00
Gregory Roussac 12a257db7a Merge pull request #898 from Jacky75/blulab20131028-slider-virtualuri
[-] MO : homeslider stores slider about multistore with virtual uri
2013-10-28 06:53:41 -07:00
Sarah Lorenzini 63141a9c4d [-] FO: fixed bug #PSCFV-10654 - TinyMCE editor: List of products by manufacturer, products by supplier - Long description is not hidden. 2013-10-28 14:48:48 +01:00
Daniele Giachino c84689ec71 homeslider stores slider about multistore with virtual uri 2013-10-28 14:09:35 +01:00
gRoussac 4103339f53 [-] BO : AdminImport, fix bug from https://github.com/indesign47/PrestaShop/commit/84454bbc1c7a315e232245c5e43b300b8f153473#commitcomment-4418502 2013-10-28 11:21:25 +01:00
Gregory Roussac 9a879bc133 Merge pull request #897 from freedayko/development
[*] BO : improved unicode characters replacement in URLs
2013-10-28 03:09:16 -07:00
gRoussac e1d1479f22 [*] FO : Fix bug #PSCFV-10689 handle image legend 2013-10-27 23:31:36 +01:00
gRoussac 2dbaa5f73b [-] BO : Fix bug #10689, could not set image legend in back office 2013-10-27 22:49:25 +01:00
gRoussac 9a3cfece69 //missing line feed after disable_modsec 2013-10-27 16:05:55 +01:00
Aleksander Palyan ee06d3114d [*] BO : improved unicode characters replacement in URLs (Russian and Ukrainian characters added) 2013-10-27 15:05:49 +02:00
gRoussac c5c861b59e [-] MO : Blockwishlist no product image when id_product_attribute is defined, thanks @Broceliande 2013-10-27 13:28:34 +01:00
Julien 0bc1d21432 [-] MO : Fix NetworkError 404 Not Found on admin in blocklayered.php
These files not exists :
 - /js/jquery/jquery-ui-1.8.10.custom.min.js
 - /css/jquery-ui-1.8.10.custom.css
2013-10-26 15:08:07 +02:00
gRoussac 4c484afda1 [-] MO : Fix bug #PSCFV-10841, blockcart hides on product page when last product is removed from cart 2013-10-25 17:37:32 +02:00
gRoussac 025b62f995 // norms 2013-10-25 17:33:44 +02:00
Fabio Chelly 8f6a5bb3a1 Merge remote-tracking branch 'origin/development' into development 2013-10-25 17:01:51 +02:00
Fabio Chelly a7d0794c43 [-] BO : Fixed bug PSCFV-9910 using basic queries to prevent locking errors 2013-10-25 17:01:28 +02:00
Gregory Roussac 6359c1ca33 Merge pull request #893 from neemzy/development
[*] FO : Turned "true" and "false" strings to proper booleans in address.tpl
2013-10-25 07:42:59 -07:00
Tom Panier 9a26cf02a8 Turned "true" and "false" strings to proper booleans
It's cleaner this way, and matches how it is done on similar templates.
2013-10-25 16:36:39 +02:00
gRoussac eb8ea1cba5 [-] CORE : SetEnv in if statement 2013-10-25 15:29:15 +02:00
gRoussac 4e6585a1b8 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-25 15:21:55 +02:00
gRoussac a03efe152c [-] CORE : SetEnv not available on all config // @todo curl request on dummy .htacces 2013-10-25 15:21:40 +02:00
gRoussac 942d3c7151 [-] MO : Fixbug #PSCFV-10679 dateofdelivery PDF invoice array and array 2013-10-25 00:01:25 +02:00
gRoussac 1e094f4016 [-] FO: Fix bug #PSCFV-10623 blocknewproducts shows products when PS_NB_DAYS_NEW_PRODUCT == 0 2013-10-24 23:29:23 +02:00
gRoussac a9643c80c3 // bad commit sorry 2013-10-24 22:45:43 +02:00
gRoussac 438a3dda2b [-] BO : Fix bug #PSCFV-10718 AdminAttachments old file not deleted on update 2013-10-24 22:42:13 +02:00
gRoussac 4cd3e1b830 [-] FO: Fix bug #PSCFV-10230, Blockspecials still caching when files cache limit is 0 2013-10-24 21:59:32 +02:00
gRoussac 97ef888345 [-] FO: Fix bug #PSCFV-10625 Js error on carriers step if AjaxCart disabled 2013-10-24 21:28:22 +02:00
Gregory Roussac 4207bdff32 Merge pull request #890 from indesign47/patch-14
[-] BO : AdminImport change width height depth
2013-10-24 09:43:54 -07:00
Jerome Nadaud 6f57093f50 [-] BO : FixBug #PSCFV-10600 - Unmatched Boundary with mod_security 2013-10-24 18:36:36 +02:00
indesign47 8cb1806e49 // small fixes for Width Height Depth
change
0,1;0,2;0,3
to
1,2,3
2013-10-24 18:13:05 +02:00
gRoussac 759fe2f671 // norms 2013-10-24 18:09:21 +02:00
Gregory Roussac 0416aca547 Merge pull request #889 from PhpMadman/PSCFV-10728
[-] BO : fix #PSCFV-10728, prices incorrectly formatted when creating new order from BO
2013-10-24 09:06:43 -07:00
Rémi Gaillard cc3363011e // rewrited urls for feeder module 2013-10-24 17:54:44 +02:00
PhpMadman c516035e0e [-] BO : fix #PSCFV-10728, prices incorrectly formatted when creating new order from BO 2013-10-24 17:19:28 +02:00
gRoussac c5324a653b [-] IN: Fix bug #PSCFV-10644 no carrier available after upgrade from 1.4.x 2013-10-24 16:31:50 +02:00
Rémi Gaillard 3cd702da42 [-] WS: Fix stockavailables list when stock is shared between shops #PSCFV-10793 2013-10-24 16:30:02 +02:00
Gregory Roussac 65401efcb6 Merge pull request #887 from indesign47/patch-13
[*] BO : AdminImport add img manufacturers-suppliers
2013-10-24 07:22:57 -07:00
indesign47 84454bbc1c [*] BO : AdminImport add img manufacturers-suppliers 2013-10-24 16:16:29 +02:00
indesign47 f0ed5a303c [*] BO : AdminImport add img suppliers 2013-10-24 15:49:56 +02:00
indesign47 4803530eed [*] BO : AdminImport add img manufacturers 2013-10-24 15:47:31 +02:00
indesign47 ea8a5277f2 [*] BO : AdminImport add img manufacturers-suppliers 2013-10-24 15:44:11 +02:00
gRoussac 2ffc296279 FO : https://github.com/PrestaShop/PrestaShop/pull/878 2013-10-24 12:03:33 +02:00
Rémi Gaillard 971722a13f // note updated by ajax in admincustomers should be url encoded 2013-10-24 11:56:50 +02:00
gRoussac fc9b39968b // remove notice 2013-10-24 11:46:09 +02:00
gRoussac 81945cef71 [-] FO : Follow up https://github.com/PrestaShop/PrestaShop/pull/879 2013-10-24 10:00:19 +02:00
Gregory Roussac 1cc0134ec3 Merge pull request #879 from neemzy/development
[-] FO : OPC hide VAT fields fail if there are no company fields
2013-10-24 00:55:55 -07:00
Fabio Chelly b9de912dd3 [-] MO : Fixed bug PNM-1431 - referralprogram Lack the % sign 2013-10-24 09:53:16 +02:00
Tom Panier 6d3640e895 Conditions to hide VAT fields fail if there are no company fields
"Company" fields may or may not be rendered on this form, whereas "VAT" fields are always rendered and depend on the former ones to be shown (or hidden) with CSS.

This fixes an edge case where there are no "Company" fields rendered and "VAT" fields still wrongly appear, which was caused by the fact that `$('#field').val() != ''` is truthy when `$('#field').length` is zero (since `'' != undefined`).
2013-10-24 09:43:50 +02:00
gRoussac 56693da6e0 // remove warning Notice: Undefined variable: connections in AdminCustomersController.php on line 702 2013-10-23 19:02:13 +02:00
gRoussac 3e33a259ef [-] BO : FIx bug #PSCFV-10736 again, fixing query when product is not in base 2013-10-23 18:33:37 +02:00
gRoussac 8e506ddff2 [-] BO : FIx bug #PSCFV-10736, could not load a product given from getBoughtProducts 2013-10-23 18:16:45 +02:00
gRoussac 03ad842697 [-] BO : Fix bug #PSCFV-10790, Customer group names not exploded 2013-10-23 16:07:28 +02:00
Rémi Gaillard 554ab9414f [-] BO: product listing should call Product::getPriceStatic() with the product default shop in the context when it is not a shop context 2013-10-23 15:08:02 +02:00
Rémi Gaillard 747ec9a2c4 // notice on carrierwizard when step back 2013-10-23 14:50:30 +02:00
Gregory Roussac 2f5e15e2b1 Merge pull request #874 from PhpMadman/patch-5
[-] FO: Mobile theme removed width on message product select
2013-10-23 03:04:25 -07:00
PhpMadman 373604fc97 [-] FO: removed width on message product select
Limiting select could make the user think the select is not working if they click to much to the left on bigger screens
2013-10-23 11:52:35 +02:00
gRoussac 101b37b40a Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-23 11:45:26 +02:00
gRoussac ad4ecefcf9 [-] FO : Prevent fatal error on getUniqReference when order not loaded 2013-10-23 11:44:12 +02:00
Fabio Chelly 3e999ab591 [-] MO blockcart
#PNM-1685 - [CODE] incorrect spelled variable in ajax-cart.js
2013-10-23 10:56:48 +02:00
Fabio Chelly 010ad76e6f Merge remote-tracking branch 'origin/development' into development 2013-10-23 10:55:35 +02:00
Fabio Chelly 5fd3ad5adf [*] FO ProductSale: improves calculation of most selled products when there are a lot of products in shop 2013-10-23 10:55:23 +02:00
Rémi Gaillard 6cddb57ce3 [-] BO: Synchronize stock available after receipt supply order items #PSCFV-10724 2013-10-23 10:34:00 +02:00
gRoussac ae63336a37 [-] BO : Fix bug #PSCFV-10638, Admin Import by reference moves products to home category 2013-10-23 01:41:05 +02:00
gRoussac feca06417f // definition on addFeatureValueImport 2013-10-23 01:23:35 +02:00
gRoussac 5d28d38a22 [-] BO : Fix bug #PSCFV-7907 AdminImport, add custom field to features 2013-10-23 01:18:09 +02:00
Gregory Roussac 398548fecf Merge pull request #864 from samy-r/features-duplication-escaping
[-] CORE : pSQL for feature values
2013-10-22 10:20:44 -07:00
Gregory Roussac 83d4d0d258 Merge pull request #872 from ldecoker/patch-11
[-] PDF : {else if} instead of {elseif} (B2B invoice template)
2013-10-22 10:19:31 -07:00
Gregory Roussac c401e61b81 Merge pull request #871 from ldecoker/patch-10
[-] PDF  : {else if} instead of {elseif}
2013-10-22 10:18:57 -07:00
Gregory Roussac 5bb4d48ddd Merge pull request #870 from djfm/development
[*] LO : Fixed a few bugs with currency formats in Back-Office orders
2013-10-22 10:17:11 -07:00
Gregory Roussac e557db6429 Merge pull request #866 from studiokiwik/sk-ps15x-007
[-] MO : Loyalty if customer is logged do not recreate it
2013-10-22 10:15:55 -07:00
ldecoker ce4170574c [PDF] [-] {else if} instead of {elseif} (B2B invoice template) 2013-10-22 18:57:12 +02:00
ldecoker e6e2db8400 [PDF] [-] {else if} instead of {elseif} 2013-10-22 18:55:32 +02:00
Gregory Roussac 70d2e6e10b Merge pull request #868 from ldecoker/patch-8
[-] BO : Notices onBO translation page
2013-10-22 08:03:06 -07:00
ldecoker 7cbaada844 [BO][-] Notice messages when accessing the BO translation page
When accessing the translation part with "core translation" , you got 2 errors:
Notice: Use of undefined constant _PS_THEME_SELECTED_DIR_ - assumed '_PS_THEME_SELECTED_DIR_' in controllers\admin\AdminTranslationsController.php on line 1018

Notice: Use of undefined constant _PS_THEME_SELECTED_DIR_ - assumed '_PS_THEME_SELECTED_DIR_' in \controllers\admin\AdminTranslationsController.php on line 1026

It's because the variable $this->theme_selected is not set for that case.
2013-10-22 17:00:56 +02:00
Gregory Roussac bc7e8eb355 Merge pull request #867 from PhpMadman/patch-4
[-] FO: Removed missplaced </li> on mobile theme
2013-10-22 07:50:21 -07:00
Fabio Chelly bc38b542fe Merge remote-tracking branch 'origin/development' into development 2013-10-22 15:53:43 +02:00
Fabio Chelly 2989538ce1 [*] BO Module mailalerts: send e-mail to merchand when product is out of stock 2013-10-22 15:53:20 +02:00
PhpMadman e857fb5978 [*] FO: Removed missplaced </li> on mobile theme 2013-10-22 13:34:52 +02:00
gRoussac 1ae587475b [-] MO : Fix bug #PSCFV-10787, cms associated to all shops 2013-10-22 12:19:58 +02:00
gRoussac d20aea0563 [-] BO : Fix bug #PSCFV-10767, could not retrieve feature value when product IDs not forced 2013-10-22 11:27:45 +02:00
Gaelle ITZKOVITZ ce8d01ad4c [-] MO : if customer is logged we do not recreate it 2013-10-22 11:09:53 +02:00
gRoussac 2aa52356ad [-] BO : Fix bug #PSCFV-10607 one upload name 2013-10-22 09:39:59 +02:00
gRoussac c1ecf43be8 [-] MO : Fix bug #PSCFV-10775, could not upload .jpeg in TinyMCE 2013-10-21 17:39:20 +02:00
gRoussac 16ffbd8ee5 // norms 2013-10-21 16:46:22 +02:00
gRoussac 61884ec223 // norms 2013-10-21 16:31:56 +02:00
gRoussac a05c748e81 // addJqueryPlugin receives array in first argument 2013-10-21 15:05:03 +02:00
gRoussac a9e45fccf3 [-] MO : ScrollTo not loaded 2013-10-21 14:35:23 +02:00
gRoussac d25b41ef97 [-] BO : wrong csv files name 2013-10-21 14:34:59 +02:00
Samy Rabih 5d8c0a0fc2 duplicateFeatures doesn't protect feature values
The features values are not protected using pSQL during the features
duplication
2013-10-21 14:08:30 +02:00
gRoussac 15cd0b9fbc [-] BO : Report of https://github.com/PrestaShop/PrestaShop/commit/fd86a29c5c369ec5da0f91bbe97c584a00d02d0d 2013-10-21 12:21:49 +02:00
Gregory Roussac 3dea171047 Merge pull request #862 from PhpMadman/patch-3
[-] PDF : Removed unused code in FrontOffice PDF Invoice
2013-10-21 01:15:39 -07:00
PhpMadman 35df3f463c Removed unsed code
I looked through the code. And I can't see that that code is used. everything is handled in PDF class.
2013-10-21 10:10:28 +02:00
Rémi Gaillard 198e75245d [-] FO: Don't auto detect language if it not associated to the shop #PSCFV-10273 2013-10-21 09:41:00 +02:00
Gregory Roussac 8ef22c3548 Merge pull request #823 from kpodemski/patch-8
[*] IN: Add phone_mobile to address format
2013-10-20 16:40:16 -07:00
gRoussac 9b8a7edad8 // small refacto 2013-10-21 01:05:18 +02:00
gRoussac 332c8ff49f [-] CORE : Fix bug #PSCFV-10687 again, #PSCFV-10752 replaceAccentedChars() // sorry for that 2013-10-21 00:28:41 +02:00
gRoussac c9d20f35b3 // norms 2013-10-21 00:00:17 +02:00
gRoussac f2d70076bd [-] : Fix bug #PSCFV-4859, could not register invoice address or invoice country in OPC as guest, and phone not required in standard registration 2013-10-20 23:52:48 +02:00
Gregory Roussac c36625a136 Merge pull request #851 from PrestanceDesign/patch-1
[*] BO : Adding a title tag to display the module name on hover like PS ...
2013-10-18 09:42:57 -07:00
gRoussac 5daa79c1e1 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-18 18:36:51 +02:00
gRoussac 8ef1e043af [*] BO : chmod 664 to config.xml file 2013-10-18 18:36:30 +02:00
PrestanceDesign 6965bb29c1 [*] BO : Adding a title tag to display the module name on hover like PS 1.4 2013-10-18 18:20:15 +02:00
Fabio Chelly 72ccc90cc9 Merge remote-tracking branch 'origin/development' into development 2013-10-18 17:49:14 +02:00
Fabio Chelly 7133e74c17 [-] MO mailalerts: module mailalerts shows all messages regarding the order
PNM-1632 - MailAlert does not show Paypal error message if order has comments
2013-10-18 17:49:00 +02:00
gRoussac 2e2151a1bb [-] CORE : error_get_last > PHP 5.1 2013-10-18 15:29:12 +02:00
Rémi Gaillard 8a682081de // typo 2013-10-18 12:17:51 +02:00
Rémi Gaillard 6747d3bbac [-] BO: Default country should be overriden in the context in multishop 2013-10-18 10:23:06 +02:00
Rémi Gaillard b8273a13e6 // 2013-10-17 18:30:22 +02:00
gRoussac 3a38af9982 [-] FO : Could not redirect back to url in adress.php 2013-10-17 14:16:54 +02:00
gRoussac 6b1d69dd7d [-] FO : $back value twice escaped 2013-10-17 12:18:23 +02:00
Rémi Gaillard eb14e25e2a // small fix for some order by on listing 2013-10-17 11:33:05 +02:00
gRoussac f1ea9ba5b4 [-] BO : Fix bug #PSCFV-10709 rename root category with slashes in it 2013-10-17 10:53:20 +02:00
Rémi Gaillard e4faa2bb75 [-] Core: Out of stock status should be setted after the first order history 2013-10-17 10:28:14 +02:00
gRoussac 3ba5905042 [-] BO : Could not order by reserved words like 'key' 2013-10-16 16:25:40 +02:00
Rémi Gaillard 22fd1b84c4 Merge pull request #847 from MustangZhong/patch-1
[-] WS: Missing field on Cart::getWsCartRows()
2013-10-16 00:58:16 -07:00
MustangZhong ad27dbe8d1 Update Cart.php
The field "id_address_delivery" is missing in getWsCartRows.
Since id_address_delivery is required in the web service field definition.
2013-10-16 10:14:14 +08:00
Rémi Gaillard 6ee538c710 // fix on ps_cleaner 2013-10-15 19:53:59 +02:00
gRoussac 237b950eb6 [-] FO : #PSCFV-10640 again, bad assignement 2013-10-15 16:35:58 +02:00
gRoussac 7ae9832992 // small cast 2013-10-15 14:56:25 +02:00
gRoussac 81497be5ab [-] Fo : Fix bug #PSCFV-10640, redirect loop when country address is not among active countries in OPC 2013-10-15 14:53:44 +02:00
Rémi Gaillard 837ca34e7e [-] Core: Product::getPriceStatic called with 1 quantity return the specific price for 1 qty if called with id_cart = 0 2013-10-15 10:30:48 +02:00
gRoussac 9c861642a5 [-] BO : AdminImport, wrong default separators 2013-10-15 10:09:16 +02:00
Gregory Roussac dec9ef40a8 Merge pull request #841 from indesign47/patch-10
[+] BO : AdminImport add entity Alias
2013-10-15 01:03:33 -07:00
djfm b4e18954f9 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-15 07:22:03 +00:00
Francois Gaillard fd2dc4ff64 [-] Classes : Modules listing and case insensitive 2013-10-15 09:14:49 +02:00
indesign47 f25a418785 Update Alias.php 2013-10-14 19:20:38 +02:00
Rémi Gaillard 6f4b85430c // Fix listings and sort 2013-10-14 18:52:48 +02:00
Gregory Roussac 2a28e47650 Merge pull request #799 from Lupul/development
[-] BO : Fixed Bug what displayed Dashboard sales statistics in wrong currency
2013-10-14 08:37:28 -07:00
Gregory Roussac f3755e2d0a Merge pull request #843 from ldecoker/patch-10
[-] BO : AdminMeta - make sure module and controller name are in lowercase
2013-10-14 07:46:56 -07:00
Gregory Roussac bce6e8f09f Merge pull request #837 from axometeam/patch-21
[-] BO : bad query when filtering on status + sorting by quantity in the AdminProducts getList
2013-10-14 07:45:52 -07:00
gRoussac cc8ec4fd45 [-] CORE : Fix bug #PSCFV-10687 bad conversion for accentuated Y and W, thanks @mike15 2013-10-14 16:03:50 +02:00
gRoussac 80f6f4e223 [-] FO : Fix bug #PSCFV-10688, bad priceDisplay in order-carrier 2013-10-14 15:34:47 +02:00
gRoussac 50002ec714 [-] FO : Fix #PSCFV-10690 again, change just on directories 2013-10-14 14:23:26 +02:00
gRoussac c6e3e28894 [-] FO : Fix bug #PSCFV-10690 could not index a category beacause of robot.txt 2013-10-14 14:20:11 +02:00
gRoussac f8edca8ac8 [-] IN : Fix bug #PSCFV-10539 duplicate "address" url rewrite in meta.xml for Russian 2013-10-14 13:59:19 +02:00
gRoussac 2a54296b96 [-] BO : Fix bug #PSCFV-10692, AdminImport bad utf8 cars for subst 2013-10-14 12:11:47 +02:00
gRoussac 1adfa1584c Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-14 11:37:51 +02:00
gRoussac 1358c696cd [-] BO : Fix #PSCFV-10678 warning in chrome 2013-10-14 11:37:15 +02:00
djfm 5e407db21e [*] LO : Fixed a few bugs with currency formats in Back-Office orders 2013-10-14 09:30:45 +00:00
Jerome Nadaud 3282bd19e4 // Small fix 2013-10-14 10:59:20 +02:00
Rémi Gaillard 3bc02bbe10 // fields are already correctly formated when they are in a object coming from the database 2013-10-14 10:56:38 +02:00
gRoussac af9182dad5 [-] CORE , follow up https://github.com/kiropowered/PrestaShop/commit/b87e934a66a15d4f68e573f5afa9494505a60e28 and https://github.com/kiropowered/PrestaShop/commit/a10dcab6e74d138a2f3a3f558ec7d66b1e9d9e10 2013-10-14 10:51:17 +02:00
Gregory Roussac 3539eb3697 Merge pull request #842 from kiropowered/patch-1
[-] CORE : StockMvt Fix bug if product have attribute
2013-10-14 01:30:30 -07:00
ldecoker a377ecd571 Update Meta.php
Use strtolower from Tools class.
2013-10-14 09:53:50 +02:00
ldecoker 8d7e96176c SEO - make sure module and controller name are in lowercase
For module controller, make sure that the name of the controller and the module are saved in lowercase. Otherwise the route will not be found in getModuleLink.
2013-10-14 09:38:04 +02:00
gRoussac f9cfde9a05 [-] MO : Trackingfront, could not load employee stats date 2013-10-12 23:24:32 +02:00
gRoussac ee29f4365e [-] FO : Copuld not load datepicker in trackingfront stats.php 2013-10-12 17:54:26 +02:00
kiropowered a10dcab6e7 Update StockMvt.php
Fix bug if product have attribute
2013-10-12 14:28:27 +02:00
indesign47 0a441b9a4b Update Alias.php 2013-10-12 11:49:27 +02:00
indesign47 4f9191fe0c Update form.tpl 2013-10-12 11:45:07 +02:00
indesign47 2afbe8fd04 Create alias_import.csv 2013-10-12 11:39:29 +02:00
indesign47 85c6e799c3 [+] BO : AdminImport add entity Alias 2013-10-12 11:33:36 +02:00
Gregory Roussac 418155cf2b Merge pull request #838 from pelTek/patch-1
BO: added UPC and EAN search
2013-10-11 11:52:22 -07:00
Chris 3f6139be42 BO: added UPC and EAN search 2013-10-11 21:02:01 +03:00
Axome 9d5a9225e5 Correct some "bad query" in the admin products getList
Here the wrong Sql generated :

SELECT SQL_CALC_FOUND_ROWS a.`id_product`,b.name as name,`reference`,a.price as price,a.active as active , MAX(i.id_image) id_image,cl.name `name_category` , a.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, a.`active` FROM `ps_product` a LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 2 AND b.`id_shop` = 1) LEFT JOIN `ps_image` i ON (i.`id_product` = a.`id_product` AND i.cover=1)LEFT JOIN `ps_category_lang` cl ON (a.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = 1) LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0 AND sav.id_shop = 1 ) WHERE 1 AND a.`active` = 0 GROUP BY a.id_product ORDER BY quantity desc LIMIT 0,50 

'quantity' is ambigus (for the ORDER BY)
2013-10-11 18:17:55 +02:00
Gregory Roussac 0dbaa59985 Merge pull request #836 from mkdgs/patch-1
[*] MO : blocktopmenu adding clear cache of AddAfter hook for Cms, Supplier, Manufaturer and Product
2013-10-11 09:05:15 -07:00
Rémi Gaillard 06c62c1684 [-] WS: Fix #PSCFV-10672 order by ID for non multishop entities 2013-10-11 17:53:15 +02:00
Jerome Nadaud 0f9c81a683 [-] BO : FixBug #PSCFV-10671 - remove htmlentities on customer message 2013-10-11 17:29:44 +02:00
gRoussac a07733fcec [-] BO : Could not insert referrer id_connections_source can not be null 2013-10-11 16:52:53 +02:00
Mickael Desgranges 1786f8e907 Update blocktopmenu.php
Fix: block top menu is not updated when content is added in CMS

adding support of AddAfter hook for Cms, Supplier, Manufaturer and Product
2013-10-11 16:42:21 +02:00
Fabio Chelly 9fc9df6ba4 Merge remote-tracking branch 'origin/development' into development 2013-10-11 16:38:09 +02:00
Fabio Chelly 9e3b82e8ed [*] BO Module productcomments: JS variables are correctly escaped. Padding in error message has also been pushed to theme tpl 2013-10-11 16:37:26 +02:00
gRoussac 8cfe9a2065 [-] Bo : Could not update mailalert 2.5 with id_lang missing 2013-10-11 16:19:54 +02:00
gRoussac 45e9040606 [-] Bo : Could not update mailarler 2.5 with id_mlang 2013-10-11 15:51:02 +02:00
Jerome Nadaud 1a1f3de775 [-] BO: Fixbug #PSCFV-10671 - Double htmlentities. 2013-10-11 13:33:31 +02:00
Gregory Roussac 6c739ee2b3 Merge pull request #833 from djfm/development
[*] LO : set correct currency format for CHF
2013-10-11 01:58:10 -07:00
Fabio Chelly 5c66ed4791 Merge remote-tracking branch 'origin/development' into development 2013-10-11 10:51:50 +02:00
Fabio Chelly d1a7ff50d5 [*] BO Module watermark: minimum transparency level is 1 and not 0. 2013-10-11 10:51:28 +02:00
gRoussac 7b02da5fdf // bad commit sorry 2013-10-11 10:32:30 +02:00
gRoussac 36ca7bc508 [-] BO : AdminImport, fix Group searchByName 2013-10-11 10:23:17 +02:00
fchellypresta 075a911cee Merge pull request #830 from indesign47/patch-5
[-] MO : productcomments errors translated in multi-language
2013-10-11 00:40:32 -07:00
fchellypresta 6f878353a6 Merge pull request #831 from indesign47/patch-7
[-] MO : productcomments round average up not down
2013-10-11 00:29:37 -07:00
djfm bb96c8754f [*] LO : set correct currency format for CHF 2013-10-11 07:14:30 +00:00
gRoussac dc1632a8b0 [-] BO : Adminimport, id_specific key_price not defined 2013-10-10 22:04:42 +02:00
Gregory Roussac a87bbf84b4 Merge pull request #825 from indesign47/patch-4
[-] BO : AdminImport add available fields to Products
2013-10-10 10:22:43 -07:00
Damien Metzger 4505387046 // Try to fix regexp issues with some PHP configurations 2013-10-10 18:41:50 +02:00
gRoussac 286084c42d Merge branch 'master' of https://github.com/DarkHack/PrestaShop into contrib/master
Conflicts:
	controllers/admin/AdminImportController.php
2013-10-10 17:06:13 +02:00
Jerome Nadaud 789911184b [-] BO : FixBug - Remove second email in recipient 2013-10-10 15:04:32 +02:00
gRoussac 39a543188a [-] BO : Fix bug #PSCFV-10660, could not delete csv file on NT 2013-10-10 14:54:12 +02:00
Damien Metzger 9bae53a4d9 Merge pull request #828 from djfm/development
// fixed name of gender 2 in English
2013-10-10 03:08:40 -07:00
djfm 819dac6622 // fixed name of gender 2 in English 2013-10-10 09:36:05 +00:00
François Gaillard 8d1bca5542 Merge pull request #768 from enumag/patch-4
[-] Classes : Hook - Display payment method & custommer currency bug fix
2013-10-09 13:52:09 -07:00
Fabio Chelly 246340b78c [*] BO Module search: Enter key is now disabled in quick search field (field is correctly aligned) 2013-10-09 18:33:41 +02:00
Fabio Chelly 75ffa8c4f8 [*] BO Module search: Enter key is now disabled in quick search field 2013-10-09 18:30:09 +02:00
Jerome Nadaud f6bbb6e241 // Fix duplicate invoice delivery number 2013-10-09 17:43:43 +02:00
Jerome Nadaud 68d84892c7 // remove self:: 2013-10-09 16:40:09 +02:00
Jerome Nadaud 2feb5dd8d2 Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-10-09 16:31:09 +02:00
Jerome Nadaud d0a4636966 [-] BO : FixBug #PSCFV-9957 - Duplicate order invoice number 2013-10-09 16:29:15 +02:00
Vincent Augagneur d796d0012e [-] BO : fixed bug #PSCFV-10637 PS_CARRIER_DEFAULT is not updated after edit default carrier 2013-10-09 15:25:02 +02:00
Gregory Roussac df4ae671a2 Merge pull request #826 from gouz/patch-4
[-] BO : Export DeliverySlip, the dates range using delivery_date but date_add
2013-10-09 06:02:52 -07:00
gRoussac df97566018 [-] BO : AdminImport no default value for separators 2013-10-09 13:57:36 +02:00
gRoussac 338efcad7f [-] CORE : $smarty->compile_check is not set to false, thanks @prestamodule 2013-10-09 12:14:49 +02:00
Sylvain Gougouzian 7a6dea4964 [~] BO : Export DeliverySlip
The dates range wasn't using the correct sql fields.
2013-10-09 10:39:24 +02:00
gRoussac 008c6ce759 [-] FO : Fix bug #PSCFV-10497 cart_block hooked on column disappearing 2013-10-08 18:37:50 +02:00
gRoussac 85946bacbe // small cast 2013-10-08 18:35:56 +02:00
Gregory Roussac cd8af9ae67 Merge pull request #824 from Prestaworks/patch-14
[-] BO : Fixes issue where path is not printed when error with email template saves occur.
2013-10-08 05:57:21 -07:00
Daniel fa88a0bd93 Update AdminTranslationsController.php
Fixes issue where path is not printed when error with email template saves occur.
2013-10-08 20:54:52 +08:00
Rémi Gaillard 2899dfba5e // Fix AdminTranslationsController::addNewTabs() 2013-10-08 14:53:02 +02:00
Krystian Podemski ae7d33effe [*] CORE: Add phone_mobile to address format
I honestly do not know why you decided by default to show only the first field of the phone :)

Users often ask me why they don't see their mobile phone on orders in BO.
2013-10-08 11:11:24 +02:00
gRoussac e4a642128a [-] FO : Fix bug #PSCFV-10606 could not have correct taxCalculationMethod when vat number in customer address 2013-10-08 11:09:52 +02:00
Zollner Robert 30adb0932d [-] BO : pass correct typed parameter to setCurrency 2013-10-07 23:42:26 +03:00
Rémi Gaillard 7d0e9a5f06 // Fix double entities on AdminLog listing #PSCFV-10472 2013-10-07 19:37:58 +02:00
Gregory Roussac 4daaa206d2 Merge pull request #818 from cedricfontaine/patch-2
[-] MO : Price should apply tax as in configuration.
2013-10-07 09:55:35 -07:00
Gregory Roussac 644e38c05f Merge pull request #817 from cedricfontaine/patch-1
[-] MO :Loyalty voucher should be without taxes, otherwise points would be negative.
2013-10-07 09:54:22 -07:00
Francois Gaillard 77b2b4b6ca // Manual merge PS 1.5.6.0 2013-10-07 18:22:55 +02:00
cedricfontaine d63288affd Update loyalty.php
Price should apply tax as in configuration.
2013-10-07 12:14:13 -04:00
Damien Metzger c51fe5b22d // Changelog 1.5.6.0 2013-10-07 18:07:25 +02:00
cedricfontaine 717e195f57 Update LoyaltyModule.php
Voucher should be without taxes, otherwise points would be negative.
2013-10-07 12:07:03 -04:00
Gregory Roussac f78a093a1c Merge pull request #815 from PrestanceDesign/development
[*] TR : Italian translation of the country instead of English
2013-10-07 08:39:39 -07:00
PrestanceDesign f9f5a4b090 Italian translation of the country instead of English 2013-10-07 16:45:22 +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
Francois Gaillard 68cba08303 [-] BO : Bug fix - Modules confirmation messages 2013-10-07 12:18:44 +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 adb1779764 [-] FO : isVirtualCart was forced to false 2013-10-07 12:02:47 +02:00
Fabio Chelly a652590885 Merge remote-tracking branch 'origin/development' into development 2013-10-07 11:34:56 +02:00
Fabio Chelly 2515d81bdd [*] BO Module search: Quick search can now search modules by name and not only display name 2013-10-07 11:34:16 +02:00
Gregory Roussac bf65404413 Merge pull request #810 from studiokiwik/sk-ps15x-001
[-] MO : button tag on line 56 weren't closed
2013-10-07 02:29:19 -07:00
gRoussac e3db5570d0 [-] BO : Retro compat, PS_ADMIN_DIR not defined //bad commit sorry 2013-10-07 11:24:42 +02:00
Gregory Roussac 68131dc28b Merge pull request #811 from studiokiwik/sk-ps15x-002
[-] TR : typo fixed in polish installer translation (line 85)
2013-10-07 01:59:10 -07: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
Tomasz Slominski 4254ae6edc typo fixed in polish installer translation (line 85) 2013-10-07 10:05:43 +02:00
Vincent Augagneur 3f4f298ad4 [-] CORE fixed bug #PSCFV-10595 - small fix in function addJqueryPlugin() 2013-10-07 10:01:26 +02:00
Gregory Roussac 2a475d066f Merge pull request #803 from ldecoker/patch-8
[-] BO : Missing $php_self variable in OrderDetailController.php
2013-10-07 01:00:42 -07:00
Tomasz Slominski b941ac007b bugfix: button tag on line 56 weren't closed 2013-10-07 09:57:55 +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 3477cac1e0 Merge pull request #800 from Ha99y/20131004_retro-compat.js.php
__DIR__ is available since PHP 5.3
2013-10-07 00:35:02 -07:00
indesign47 d3d0897012 [-] MO : productcomments round average up not down
200 comments with 5 stars and only 1 with 4 stars give only 4 stars
Thanks to manit4c
2013-10-07 04:02:42 +02:00
indesign47 e0978a0b84 [-] MO : productcomments errors translated in multi-language 2013-10-07 03:18:56 +02:00
ldecoker 148348855e Update OrderDetailController.php
Missing $php_self variable
2013-10-06 16:31:54 +02:00
indesign47 b61e3e68b9 Update AdminImportController.php 2013-10-05 10:50:19 +02:00
ha99y 98aea24fc3 __DIR__ was never defined
The JS files would not lode, when in dev mode because __DIR__ was not
defined
2013-10-04 17:18:23 -07:00
Zollner Robert 1787923c4c [-] BO : Fixed Bug what displayed Dashboard sales statistics in wrong currency (changed NULL to lowercase) 2013-10-05 00:42:29 +03:00
Zollner Robert 481cb5c28a [-] BO : Fixed Bug what displayed Dashboard sales statistics in wrong currency 2013-10-04 23:30:24 +03: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
Fabio Chelly 48f20a4393 Merge remote-tracking branch 'origin/development' into development 2013-10-04 18:15:32 +02:00
Fabio Chelly 139a74e4cd [*] BO Module search: the PHP search has been replace by a quick search in JS to display results instantly 2013-10-04 18:15:12 +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
indesign47 805989da39 [-] BO : AdminImport add products available fields 2013-10-04 13:04:52 +02:00
Jerome Nadaud 093bf9e065 [-] MO : Blocklayered - Fix expand/collapse tree problem 2013-10-04 11:51:12 +02:00
indesign47 75cb92c329 Update AdminImportController.php 2013-10-04 11:44:52 +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 96646b5c7a [-] BO : AdminImport add products available fields 2013-10-04 10:56:41 +02:00
PhpMadman 18ab409eeb [*] BO: #PNM-1472 Changed label and transparency range check to 1
Changed label to 1-100 since, there is no need to set transparency to 0, since it will pretty much will be invisible already at 1
2013-10-04 10:38:03 +02: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
Jerome Nadaud 6a0c376a18 [-] MO : Blocklayered - Fix empty fancy box after template edit 2013-10-03 18:58:09 +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
Gregory Roussac cfd70bf660 Merge pull request #789 from PhpMadman/patch-2
[*] BO: wrong description on getIdOrderCarrier
2013-10-03 07:30:14 -07: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
PhpMadman e38d808a85 [*] BO: wrong description on getIdOrderCarrier 2013-10-03 15:51:27 +02:00
Gregory Roussac 86631202df Merge pull request #788 from PhpMadman/patch-1
[*] BO: missing align on order for product warehouse
2013-10-03 06:37:58 -07:00
Fabio Chelly d601844e82 Merge remote-tracking branch 'origin/development' into development 2013-10-03 15:32:27 +02:00
Fabio Chelly ea57b3fdd1 [-] MO watermark: original pictures are now protected through htaccess
#PNM-109
2013-10-03 15:32:10 +02:00
PhpMadman f979cbef57 [*] BO: missing align on order for product warehouse 2013-10-03 15:26:09 +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
Gregory Roussac 8762c310b9 Merge pull request #787 from tucoinfo/development
[*] FO : add variable $nofollow to mobile theme header.tpl
2013-10-03 05:02:01 -07:00
Damien Metzger 6e0c3e1aa2 // addFeatureValueImport partial fix 2013-10-03 12:24:35 +02:00
tucoinfo 8f09d49ffc [*] FO : add variable $nofollow to mobile theme header.tpl
Copied from normal theme which already manages the NoFollow variable
2013-10-03 12:19:10 +02:00
Jerome Nadaud 3585bf33c8 // Fix supply order change state save button 2013-10-03 11:49:16 +02:00
gRoussac 6610bd2067 [-] BO : Could noty save ImportMatchs 2013-10-03 11:15:03 +02:00
Jerome Nadaud 43a60f1b57 [-] BO : FixBug #PSCFV-9044 - Missing state in new order, and now you can edit customer addresses 2013-10-03 11:06:08 +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
Gregory Roussac 4bb4199f5a Merge pull request #783 from ellisium/upper
[-] CORE : CART::BOTH should be Cart::Both
2013-10-02 07:34:00 -07:00
Eric Le Lay 3e0c5e71f4 classname uppercase issue 2013-10-02 16:28:45 +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
Damien Metzger 6974a88b59 Merge pull request #782 from 202-ecommerce/development
[*] FO : Added new Maintenance Hook
2013-10-02 06:07:42 -07:00
Rémi Gaillard f4cadbdfd6 Merge pull request #770 from urecheatu007/development
[-] LO: updated localization pack for Romania / romanian - added states
2013-10-02 05:47:17 -07:00
thoma202 1ccc25f56c Merge branch 'development' of github.com:202-ecommerce/PrestaShop into development 2013-10-02 14:38:44 +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
thoma202 eb7655e318 [+] Added hook in maintenance page 2013-10-02 11:58:35 +02:00
Rémi Gaillard 99f325dc3c // validation of carrierwizard 2013-10-02 11:24:08 +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
gRoussac f4c2bacea3 [-] CORE : Cart rules not ordered by priority for PaymentModule 2013-10-01 16:17:23 +02:00
gRoussac 626ccf0985 [-] CORE : Partial fix bug #PSCFV-10534 bad total_products_wt calculated without other cart rules 2013-10-01 14:46:40 +02:00
Gregory Roussac a76a7273ea Merge pull request #776 from kpodemski/patch-5
[*] FO: We let style selected category in CSS on blockcategories
2013-10-01 03:04:54 -07:00
Krystian Podemski 9e4b6c020f [*] FO: We let style selected category in CSS on blockcategories
It's good to have this by default.
2013-10-01 12:02:19 +02: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
gRoussac f30bc80485 [-] BO : Remove duplicate sql insert in setProductOutOfStock in monoshop 2013-10-01 10:48:17 +02:00
djfm e706b531bc // updated br, es, fr, ru installer translations 2013-10-01 08:41:03 +00:00
Jerome Nadaud 340f6cebe4 [-] FO : FixBug #PSCFV-10542 - Category description view problem 2013-10-01 10:20:33 +02: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
Jerome Nadaud 452e07ab0b [-] BO : FixBug #PSCFV-10477 - Error message not shown on delete module without permissions 2013-09-30 19:26:49 +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
Jerome Nadaud 1b9472cc37 [-] BO : FixBug #PSCFV-10291 - Remove temporary image on install 2013-09-30 19:01:11 +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
Jerome Nadaud b7ff8d634a [-] BO : FixBug #PSCFV-10317 - Attributes value not shown on features sorted by position. 2013-09-30 17:23:12 +02:00
Jerome Nadaud f983e0eaf1 [-] BO : FixBug #PSCFV-10380 - Missing lang file existence verification. 2013-09-30 16:25:58 +02:00
Jerome Nadaud 6bb1fa6a4d // Missing '?' on regex 2013-09-30 14:59:27 +02:00
Jerome Nadaud 05eafdb14f Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development 2013-09-30 14:57:46 +02:00
Jerome Nadaud cfc41ec4ef [+] BO : Add remove module override on constant - PSCFV-10430 2013-09-30 14:57:30 +02:00
Gregory Roussac 6822373378 Merge pull request #772 from codeurWeb/patch-5
[*] FO : add GET pre-selection of id_contact in contact-form.tpl
2013-09-30 05:56:09 -07:00
Julien dd5cd33bb4 [-] BO : fix pre-selection of id_contact in contact-form.tpl 2013-09-30 14:38:06 +02:00
Cosmin Hutanu 7eddca6d15 update localization pack for romania - added states 2013-09-30 13:06:19 +03:00
gRoussac 7d764c5ce8 [-] BO : AdminImport, not matching by ref for updating 2013-09-30 11:50:51 +02:00
Cosmin Hutanu f9ad0d1b79 Merge pull request #3 from PrestaShop/development
update from prestashop/development
2013-09-30 02:47:52 -07:00
Jerome Nadaud e040c096d1 [-] BO : Remove customers group view list link 2013-09-30 10:34:54 +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
Gregory Roussac 3e85622972 Merge pull request #767 from enumag/patch-3
[-] BO : Fix #PSCFV-10520 id_attribute_group can not be null
2013-09-30 00:47:12 -07:00
djfm 67d0ac95b5 Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release 2013-09-30 07:09:17 +00:00
Jáchym Toušek 6e191fe054 [-] Classes : Hook - Display payment method & custommer currency bug fix 2013-09-29 16:24:33 +02:00
Jáchym Toušek 5ebc2e5e91 [-] BO : Fix #PSCFV-10520 2013-09-29 14:43:14 +02:00
gRoussac 813ef8bc7e [-] BO : Could not import empty linkrewrite for products and not matching refs 2013-09-27 19:22:10 +02:00
Jerome Nadaud c2b9ff40ef [-] BO : FixBig #PSCFV-10442 - Members Cutomer Group list 2013-09-27 19:20:46 +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
Gregory Roussac 40617c0a81 Merge pull request #761 from nuzelac/patch-1
[-] BO : fix multilingual field validity in AdminProductsController
2013-09-27 09:50:03 -07:00
Nino Uzelac ca01b58262 fix multilingual field validity in AdminProductsController 2013-09-27 18:22:07 +02:00
Fabio Chelly 9d94337c9b [-] MO sendtoafriend: The method used to check all required input fields could lead to errors 2013-09-27 16:08:00 +02:00
Jerome Nadaud 6449ecfb32 [-] BO : Force invoice footer text to 1 ligne 2013-09-27 14:41:50 +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
Fabio Chelly 345d4cdbcf [-] MO productcomments: prevents guests to add comments when guest comment is disabled in backoffice 2013-09-27 11:27:58 +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
Gregory Roussac 19fb32545d Merge pull request #749 from enumag/patch-1
[-] FO : Fixed products without images
2013-09-27 00:56:46 -07:00
djfm 4e472fae50 // updated Indonesian installer 2013-09-27 07:16:23 +00:00
Jáchym Toušek 30367e6427 [-] FO : Fixed products without images 2013-09-26 22:21:18 +02: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
Cosmin Hutanu 81ec2822ec Merge pull request #2 from PrestaShop/development
update from prestashop/development
2013-09-26 05:52:17 -07: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
Rémi Gaillard 252ab56d75 // error message in double 2013-09-26 13:47:42 +02: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
Gregory Roussac 37f928ade9 Merge pull request #746 from Mainmich/patch-1
[-] MO : Blocklayered Fix pagination incompatibility
2013-09-25 09:45:51 -07:00
gRoussac 48d9c37590 [-] BO : Remove duplicate sql insert in setProductOutOfStock in monoshop 2013-09-25 18:41:52 +02:00
Mainmich a6e67b078e Fix pagination incompatibility
Javascript function paginateButton does not work with "p" GET parameter in first position, regex only takes &p and not ?p.
2013-09-25 18:33:58 +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
Gregory Roussac 5245038ea1 Merge pull request #745 from djfm/localization_packs
[*] TR : Localization packs
2013-09-25 06:58:59 -07:00
djfm 91d495a4a8 [*] LO : Added states to Japanese localization pack 2013-09-25 13:31:45 +00:00
Damien Metzger ae8c8218fd // Fixed ISO code of japanese todōfuken 2013-09-25 15:30:16 +02:00
djfm 81e66233d8 [*] LO : Updated many localization packs 2013-09-25 13:11:52 +00:00
Fabio Chelly 1800c6589c Merge remote-tracking branch 'origin/development' into development 2013-09-25 14:43:42 +02:00
Fabio Chelly bdd84771b7 [-] MO productcomments and loyalty: loyalty doesn't disconnect current user anymore 2013-09-25 14:43:30 +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
Gregory Roussac 931d240ca1 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 11:33:48 -07: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
dlage 81ca3ac1f9 BO: Modules - show update button even if module is not installed but don't
warn for modules with updates available but not installed.
2013-09-24 17:42:43 +01:00
gRoussac 6f840eceba [-] BO : Fix bug #PSCFV-9675 could not import non existent parent category 2013-09-24 18:00:01 +02:00
Rémi Gaillard 5e7dbea970 // 2013-09-24 17:22:50 +02:00
Rémi Gaillard beb0a74135 // use ObjectModel::validateField on validaterules 2013-09-24 17:12:28 +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 3d477c62eb // remove notice 2013-09-24 16:03:39 +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
Gregory Roussac 4c399875d9 Merge pull request #737 from codeurWeb/patch-3
[-] BO : fix postProcess override on AdminImportController
2013-09-24 01:54:18 -07:00
Gregory Roussac 92b987c0f8 Merge pull request #736 from codeurWeb/patch-2
[-] BO : fix ovverride of constructor when PS_ADVANCED_STOCK_MANAGEMENT is off
2013-09-24 01:40:16 -07: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
Julien 6acebca8fa [-] BO : fix postProcess override on AdminImportController
When we override the constucteur of AdminImport to add an import type and PS_ADVANCED_STOCK_MANAGEMENT is off, switch index is undefined for "Supply Orders" and "Supply Order Details".
Default case of switch is never used.
2013-09-23 21:04:55 +02:00
Julien 6850db0612 [-] BO : fix contructor override on AdminImportController
When we overload the constucteur of AdminImport to add an import type and PS_ADVANCED_STOCK_MANAGEMENT is off, switch index is undefined for "Supply Orders" and "Supply Order Details".
2013-09-23 20:23:45 +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
Cosmin Hutanu 7491f46322 Merge pull request #1 from PrestaShop/development
update from prestashop/development
2013-09-06 12:42:22 -07:00
543 changed files with 12960 additions and 3498 deletions
+28 -7
View File
@@ -16,13 +16,14 @@
- bMancone - bMancone
- bumbu - bumbu
- Burhan - Burhan
- Cédric Mouleyre
- Caleydon Media - Caleydon Media
- cam.lafit - cam.lafit
- Captain FLAM - Captain FLAM
- Captain-FLAM - Captain-FLAM
- ccauw - ccauw
- Cédric Mouleyre
- ChristopheBoucaut - ChristopheBoucaut
- CINS
- cippest - cippest
- cmouleyre - cmouleyre
- Corentin Delcourt - Corentin Delcourt
@@ -34,42 +35,50 @@
- David Gasperoni - David Gasperoni
- Davy Rolink - Davy Rolink
- djfm - djfm
- dlage
- dMetzger - dMetzger
- (d)oekia - (d)oekia
- Dragan Skrbic - Dragan Skrbic
- DrÿSs'
- dreammeup - dreammeup
- DrySs - DrySs
- DrÿSs
- DrÿSs'
- dSevere - dSevere
- Edouard Gaulué - Edouard Gaulué
- emily-d - emily-d
- Fabio Chelly - Fabio Chelly
- fBrignoli - fBrignoli
- fram - fram
- Francois Gaillard
- François Gaillard - François Gaillard
- Fran?s Gaillard
- fSerny - fSerny
- Gabriel Schwardy - Gabriel Schwardy
- gBrunier - gBrunier
- gCharmes - gCharmes
- gPoulain - gPoulain
- gr4devel
- Grégoire Bélorgey - Grégoire Bélorgey
- Gregory Roussac - Gregory Roussac
- gRoussac - gRoussac
- Guillaume DELOINCE - Guillaume DELOINCE
- ha99y
- hAitmansour - hAitmansour
- Ha!*!*y - Ha!*!*y
- indesign47 - indesign47
- inem0o - inem0o
- ivancasasempere - ivancasasempere
- Jérôme Nadaud
- jBreux - jBreux
- jeckyl
- jeromenadaud - jeromenadaud
- Jerome Nadaud - Jerome Nadaud
- Jérôme Nadaud
- jessylenne - jessylenne
- jmCollin - jmCollin
- jObregon - jObregon
- Jonathan Danse - Jonathan Danse
- joseantgv - joseantgv
- Julien
- Kevin Granger - Kevin Granger
- kpodemski - kpodemski
- Krystian Podemski - Krystian Podemski
@@ -77,8 +86,11 @@
- lCherifi - lCherifi
- ldecoker - ldecoker
- lLefevre - lLefevre
- LOIC ROSSET ltd
- makk1ntosh
- marcinsz101 - marcinsz101
- Marco Cervellin - Marco Cervellin
- matiasiglesias
- Mats Rynge - Mats Rynge
- MatthieuB - MatthieuB
- Maxence - Maxence
@@ -101,32 +113,39 @@
- PhpMadman - PhpMadman
- Pierre - Pierre
- Piotr Kaczor - Piotr Kaczor
- Piotr Moćko - Piotr Mocko
- PrestaEdit - PrestaEdit
- prestarocket - prestarocket
- Prestaspirit
- pxls - pxls
- Rémi Gaillard
- Raphaël Malié - Raphaël Malié
- raulgundin - raulgundin
- Rémi Gaillard
- rGaillard - rGaillard
- Rimas Kudelis - Rimas Kudelis
- rMalie - rMalie
- rMontagne - rMontagne
- romainberger
- root - root
- runningz - runningz
- Sébastien - sagaradonis
- Sébastien Bocahu
- Samy Rabih - Samy Rabih
- Sarah Lorenzini - Sarah Lorenzini
- Seb - Seb
- Sébastien
- Sébastien Bocahu
- Seynaeve - Seynaeve
- Shagshag - Shagshag
- sjousse
- sLorenzini - sLorenzini
- smartdatasoft
- soufyan
- soware - soware
- Staging - Staging
- sThiebaut - sThiebaut
- Sylvain WITMEYER - Sylvain WITMEYER
- tDidierjean - tDidierjean
- unknown
- vAugagneur - vAugagneur
- vChabot - vChabot
- Vincent Augagneur - Vincent Augagneur
@@ -138,3 +157,5 @@
- Xavier - Xavier
- Xavier POITAU - Xavier POITAU
- Yoozio - Yoozio
- zimmi1
+5 -13
View File
@@ -22,26 +22,18 @@
$upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS)); $upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS));
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD)
{
$error = SYS_DISABLED; $error = SYS_DISABLED;
}
elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED; $error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else if(!$upload->isFileUploaded('file')) elseif (!$upload->isFileUploaded('file'))
{
$error = ERR_FILE_NOT_UPLOADED; $error = ERR_FILE_NOT_UPLOADED;
}else if(!$upload->moveUploadedFile($_GET['folder']))
{
$error = ERR_FILE_MOVE_FAILED;
}
elseif (!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) elseif (!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS)))
{
$error = ERR_FILE_TYPE_NOT_ALLOWED; $error = ERR_FILE_TYPE_NOT_ALLOWED;
}elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) elseif (defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE))
{
$error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE)); $error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE));
}else elseif (!$upload->moveUploadedFile($_GET['folder']))
$error = ERR_FILE_MOVE_FAILED;
else
{ {
include_once(CLASS_FILE); include_once(CLASS_FILE);
$path = $upload->getFilePath(); $path = $upload->getFilePath();
@@ -24,7 +24,8 @@
if(!empty($_GET['search'])) if(!empty($_GET['search']))
{ {
include_once(CLASS_SEARCH); include_once(CLASS_SEARCH);
if (!preg_match('/^'.Tools::pRegexp(realpath(dirname(__FILE__).'/'.$_GET['search_folder']), '/').'/i', _PS_ROOT_DIR_.'/img/cms'))
exit;
$search = new Search($_GET['search_folder']); $search = new Search($_GET['search_folder']);
$search->addSearchKeyword('recursive', @$_GET['search_recursively']); $search->addSearchKeyword('recursive', @$_GET['search_recursively']);
$search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']); $search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
@@ -78,9 +78,9 @@
define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid
define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png');// // define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,jpeg,png');// //
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');// //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');//
define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,jpg,png'); define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,jpg,jpeg,jpeg,png');
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
define('CONFIG_UPLOAD_INVALID_EXTS', ''); define('CONFIG_UPLOAD_INVALID_EXTS', '');
+3
View File
@@ -10,6 +10,9 @@
//FILESYSTEM CONFIG <br> //FILESYSTEM CONFIG <br>
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php"); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php");
if (_PS_MODE_DEMO_)
die('This functionality has been disabled.');
define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration
if(!isset($_SESSION)) if(!isset($_SESSION))
{ {
@@ -73,9 +73,9 @@
define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid
define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,jpeg,png,txt'); //
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');// //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');//
define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf'); define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,jpeg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf');
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
define('CONFIG_UPLOAD_INVALID_EXTS', ''); define('CONFIG_UPLOAD_INVALID_EXTS', '');
+3
View File
@@ -27,6 +27,9 @@
$timer_start = microtime(true); $timer_start = microtime(true);
define('_PS_ADMIN_DIR_', getcwd()); 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_.'/../config/config.inc.php');
require(_PS_ADMIN_DIR_.'/functions.php'); require(_PS_ADMIN_DIR_.'/functions.php');
+3
View File
@@ -49,8 +49,11 @@ try
AdminTab::$currentIndex = $currentIndex; AdminTab::$currentIndex = $currentIndex;
$iso = $context->language->iso_code; $iso = $context->language->iso_code;
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php'))
include(_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'); include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'))
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
/* Server Params */ /* Server Params */
+1 -1
View File
@@ -34,7 +34,7 @@
.toolbarBox .process-icon-new-module { background-image: url('../img/process-icon-new-module.png')} .toolbarBox .process-icon-new-module { background-image: url('../img/process-icon-new-module.png')}
.toolbarBox .process-icon-new-module-addon { background-image: url('../img/process-icon-new-module-addon.png')} .toolbarBox .process-icon-new-module-addon { background-image: url('../img/process-icon-new-module-addon.png')}
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:1} div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:11}
/*FILTER MODULE*/ /*FILTER MODULE*/
@@ -53,7 +53,7 @@
{if $smarty.foreach.ranges.first} {if $smarty.foreach.ranges.first}
<td class="center">&nbsp;</td> <td class="center">&nbsp;</td>
{else} {else}
<td class="center"><button class="button">{l s='Delete'}</button</td> <td class="center"><button class="button">{l s='Delete'}</button></td>
{/if} {/if}
{/foreach} {/foreach}
</tr> </tr>
@@ -50,7 +50,7 @@
<h2><img src="../img/admin/cart.gif" /> {l s='Order information'}</h2> <h2><img src="../img/admin/cart.gif" /> {l s='Order information'}</h2>
<span> <span>
{if $order->id} {if $order->id}
<a href="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&id_order={$order->id}&vieworder"> {l s='Order #%d' sprintf=$order->id|string_format:"%06d"}</a></span> <a href="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&id_order={$order->id}&vieworder"> {l s='Order #%s' sprintf=$order->reference}</a></span>
<br /><br /> <br /><br />
{l s='Made on:'} {dateFormat date=$order->date_add}<br /><br /><br /><br /> {l s='Made on:'} {dateFormat date=$order->date_add}<br /><br /><br /><br />
{else} {else}
@@ -57,14 +57,14 @@
<dl> <dl>
<dt>{l s='Sent on:'}</dt> <dt>{l s='Sent on:'}</dt>
<dd>{$message.date_add}</dd> <dd>{$message.date_add}&nbsp;</dd>
</dl> </dl>
{if empty($message.id_employee)} {if empty($message.id_employee)}
<dl> <dl>
<dt>{l s='Browser:'}</dt> <dt>{l s='Browser:'}</dt>
<dd>{$message.user_agent}</dd> <dd>{$message.user_agent}&nbsp;</dd>
</dl> </dl>
{/if} {/if}
@@ -79,27 +79,26 @@
</dl> </dl>
{/if} {/if}
{if !empty($message.id_order) && empty($message.id_employee)} {if !empty($message.id_order) && $is_valid_order_id && empty($message.id_employee)}
<dl> <dl>
<dt>{l s='Order #'}</dt> <dt>{l s='Order #'}</dt>
<dd><a href="index.php?tab=AdminOrders&id_order={$message.id_order}&vieworder&token={getAdminToken tab='AdminOrders'}" title="{l s='View order'}"> <dd><a href="index.php?tab=AdminOrders&id_order={$message.id_order}&vieworder&token={getAdminToken tab='AdminOrders'}" title="{l s='View order'}">{$message.id_order} <img src="../img/admin/search.gif" alt="{l s='View'}" /></a>
{$message.id_order} <img src="../img/admin/search.gif" alt="{l s='View'}" /> </dd>
</a></dd>
</dl> </dl>
{/if} {/if}
{if !empty($message.id_product) && empty($message.id_employee)} {if !empty($message.id_product) && empty($message.id_employee)}
<dl> <dl>
<dt>{l s='Product #'}</dt> <dt>{l s='Product #'}</dt>
<dd><a href="index.php?tab=AdminProducts&id_product={$message.id_product}&updateproduct&token={getAdminToken tab='AdminProducts'}" title="{l s='View order'}"> <dd><a href="index.php?tab=AdminProducts&id_product={$message.id_product}&updateproduct&token={getAdminToken tab='AdminProducts'}" title="{l s='View order'}">{$message.id_product} <img src="../img/admin/search.gif" alt="{l s='View'}" /></a></dd>
{$message.id_product} <img src="../img/admin/search.gif" alt="{l s='View'}" />
</a></dd>
</dl> </dl>
{/if} {/if}
<form action="{$current}&token={$token}&id_customer_thread={$message.id_customer_thread}&viewcustomer_thread" method="post"> <form action="{$current}&token={$token}&id_customer_thread={$message.id_customer_thread}&viewcustomer_thread" method="post">
<b>{l s='Subject:'}</b>
<input type="hidden" name="id_customer_message" value="{$message.id_customer_message}" /> <input type="hidden" name="id_customer_message" value="{$message.id_customer_message}" />
<dl>
<dt>{l s='Subject:'}</dt>
<dd>
<select name="id_contact" onchange="this.form.submit();"> <select name="id_contact" onchange="this.form.submit();">
{foreach $contacts as $contact} {foreach $contacts as $contact}
<option value="{$contact.id_contact}" {if $contact.id_contact == $message.id_contact}selected="selected"{/if}> <option value="{$contact.id_contact}" {if $contact.id_contact == $message.id_contact}selected="selected"{/if}>
@@ -107,6 +106,8 @@
</option> </option>
{/foreach} {/foreach}
</select> </select>
</dd>
</dl>
</form> </form>
@@ -35,7 +35,7 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "index.php", url: "index.php",
data: "token={getAdminToken tab='AdminCustomers'}&tab=AdminCustomers&ajax=1&action=updateCustomerNote&id_customer={$customer->id}&note="+noteContent, data: "token={getAdminToken tab='AdminCustomers'}&tab=AdminCustomers&ajax=1&action=updateCustomerNote&id_customer={$customer->id}&note="+encodeURIComponent(noteContent),
async : true, async : true,
success: function(r) { success: function(r) {
$('#note_feedback').html('').hide(); $('#note_feedback').html('').hide();
@@ -138,7 +138,7 @@
} }
else else
{ {
$('#group_discount_category_table').append('<tr class="alt_row" id="'+jsonData.id_category+'"><td>'+jsonData.catPath+'</td><td>{l s='Discount:'}'+jsonData.discount+'{l s='%'}</td><td><a href="#" onclick="deleteCategoryReduction('+jsonData.id_category+');"><img src="../img/admin/delete.gif"></a></td></tr>'); $('#group_discount_category_table').append('<tr class="alt_row" id="'+jsonData.id_category+'"><td>'+jsonData.catPath+'</td><td>{l s='Discount:'}' + ' ' + jsonData.discount+'{l s='%'}</td><td><a href="#" onclick="deleteCategoryReduction('+jsonData.id_category+');"><img src="../img/admin/delete.gif"></a></td></tr>');
var input_hidden = document.createElement("input"); var input_hidden = document.createElement("input");
input_hidden.setAttribute('type', 'hidden'); input_hidden.setAttribute('type', 'hidden');
@@ -168,7 +168,7 @@
{foreach $input['values'] key=key item=category } {foreach $input['values'] key=key item=category }
<tr class="alt_row" id="{$category.id_category}"> <tr class="alt_row" id="{$category.id_category}">
<td>{$category.path}</td> <td>{$category.path}</td>
<td>{l s='Discount: %d%%' sprintf=$category.reduction}</td> <td>{l s='Discount: %.2f%%' sprintf=$category.reduction}</td>
<td> <td>
<a href="#" onclick="deleteCategoryReduction({$category.id_category});"><img src="../img/admin/delete.gif"></a> <a href="#" onclick="deleteCategoryReduction({$category.id_category});"><img src="../img/admin/delete.gif"></a>
<input type="hidden" class="category_reduction" name="category_reduction[{$category.id_category}]" value="{$category.reduction}"> <input type="hidden" class="category_reduction" name="category_reduction[{$category.id_category}]" value="{$category.reduction}">
@@ -30,7 +30,7 @@
<fieldset> <fieldset>
<ul> <ul>
<li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Name:'}</span> {$group->name[$language->id]}</li> <li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Name:'}</span> {$group->name[$language->id]}</li>
<li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Discount: %d%%' sprintf=$group->reduction}</span></li> <li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Discount: %.2f%%' sprintf=$group->reduction}</span></li>
<li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Current category discount:'}</span> <li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Current category discount:'}</span>
{if !$categorieReductions} {if !$categorieReductions}
{l s='None'} {l s='None'}
@@ -39,7 +39,7 @@
{foreach $categorieReductions key=key item=category } {foreach $categorieReductions key=key item=category }
<tr class="alt_row"> <tr class="alt_row">
<td>{$category.path}</td> <td>{$category.path}</td>
<td>{l s='Discount: %d%%' sprintf=$category.reduction}</td> <td>{l s='Discount: %.2f%%' sprintf=$category.reduction}</td>
</tr> </tr>
{/foreach} {/foreach}
</table> </table>
@@ -58,7 +58,7 @@
</ul> </ul>
</fieldset> </fieldset>
<h2>{l s='Members of this customer group'}</h2> <h2>{l s='Members of this customer group'}</h2>
<p>{l s='Limited to the 100th first customers.'} {l s='Please use filters to narrow your search.'}</p> <p>{l s='Limited to the first 100 customers.'} {l s='Please use filters to narrow your search.'}</p>
{$customerList} {$customerList}
{/block} {/block}
@@ -26,7 +26,7 @@
<div class="leadin">{block name="leadin"}{/block}</div> <div class="leadin">{block name="leadin"}{/block}</div>
{if $module_confirmation} {if $module_confirmation}
<div class="module_confirmation conf confirm"> <div class="module_confirmation conf confirm">
{l s='Your .CSV file has been sucessfully imported into your shop.'} {l s='Your .CSV file has been sucessfully imported into your shop. Don\'t forget to Re-build the products search index.'}
</div> </div>
{/if} {/if}
<div style="display: none"> <div style="display: none">
@@ -59,7 +59,7 @@
{if count($files_to_import)} {if count($files_to_import)}
<select name="csv"> <select name="csv">
{foreach $files_to_import AS $filename} {foreach $files_to_import AS $filename}
<option value="{$filename}"{if $csv_selected == $filename} selected="selected"{/if}>{$filename}</option> <option value="{$filename}"{if $csv_selected == $filename} selected="selected"{/if}>{$filename|escape:'htmlall':'UTF-8'}</option>
{/foreach} {/foreach}
</select> </select>
{/if} {/if}
@@ -67,20 +67,32 @@
<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> <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>
<div style="width:50%; margin: 0 auto;"> <div style="width:50%; margin: 0 auto;">
<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> <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"> <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 class="_blank" 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 class="_blank" 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 class="_blank" 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 class="_blank" 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 class="_blank" 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 class="_blank" 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> <li><a class="_blank" href="../docs/csv_import/suppliers_import.csv">{l s='Sample Suppliers file'}</a></li>
<li><a class="_blank" href="../docs/csv_import/alias_import.csv">{l s='Sample Alias file'}</a></li>
{if $PS_ADVANCED_STOCK_MANAGEMENT} {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 class="_blank" 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> <li><a class="_blank" href="../docs/csv_import/supply_orders_details_import.csv">{l s='Supply Orders Details sample file'}</a></li>
{/if} {/if}
</ul> </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 class="clear">&nbsp;</div>
</div> </div>
<label class="clear">{l s='What kind of entity would you like to import?'} </label> <label class="clear">{l s='What kind of entity would you like to import?'} </label>
@@ -108,12 +120,12 @@
</div> </div>
<label class="clear">{l s='Field separator'} </label> <label class="clear">{l s='Field separator'} </label>
<div class="margin-form"> <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" {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> </div>
<label class="clear">{l s='Multiple value separator'} </label> <label class="clear">{l s='Multiple value separator'} </label>
<div class="margin-form"> <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" {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> </div>
<label for="truncate" class="clear">{l s='Delete all'} <span id="entitie">{l s='categories'}</span> {l s='before import?'} </label> <label for="truncate" class="clear">{l s='Delete all'} <span id="entitie">{l s='categories'}</span> {l s='before import?'} </label>
@@ -192,30 +204,35 @@
}); });
$("select#entity").change(function(){ $("select#entity").change(function(){
if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8) if ($("#entity > option:selected").val() == 8 || $("#entity > option:selected").val() == 9)
$("label[for=truncate],#truncate").hide(); $("label[for=truncate],#truncate").hide();
else else
$("label[for=truncate],#truncate").show(); $("label[for=truncate],#truncate").show();
if ($("#entity > option:selected").val() == 8) if ($("#entity > option:selected").val() == 9)
{
$(".import_supply_orders_details").show(); $(".import_supply_orders_details").show();
$('input[name=multiple_value_separator]').val('|');
}
else else
{ {
$(".import_supply_orders_details").hide(); $(".import_supply_orders_details").hide();
$('input[name=multiple_value_separator]').val(','); $('input[name=multiple_value_separator]').val('{if isset($multiple_value_separator_selected)}{$multiple_value_separator_selected}{else},{/if}');
} }
if ($("#entity > option:selected").val() == 1) if ($("#entity > option:selected").val() == 1)
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").show(); $("label[for=match_ref], #match_ref").show();
else else
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").hide(); $("label[for=match_ref], #match_ref").hide();
if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0) if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0)
$(".import_products_categories, label[for=regenerate], #regenerate").show(); $(".import_products_categories").show();
else else
$(".import_products_categories, label[for=regenerate], #regenerate").hide(); $(".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)
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 ||
$("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
$("label[for=regenerate], #regenerate").show()
else
$("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 || $("#entity > option:selected").val() == 7)
$("label[for=forceIDs], #forceIDs").show(); $("label[for=forceIDs], #forceIDs").show();
else else
$("label[for=forceIDs], #forceIDs").hide(); $("label[for=forceIDs], #forceIDs").hide();
@@ -25,7 +25,7 @@
{extends file="helpers/view/view.tpl"} {extends file="helpers/view/view.tpl"}
{block name="override_tpl"} {block name="override_tpl"}
<script type="text/javascript"> <script type="text/javascript">
var errorEmpty = '{l s='Please name your matching configuration to save.' js='1'}'; var errorEmpty = '{l s='Please name your matching configuration to save.' js=1}';
var token = '{$token}'; var token = '{$token}';
var current = 0; var current = 0;
function showTable(nb) function showTable(nb)
@@ -59,14 +59,14 @@
<td>{$module->categoryName}</td> <td>{$module->categoryName}</td>
<td> <td>
<select name="i_{$module->name}" class="moduleFavorite" style="width:50px"> <select name="i_{$module->name}" class="moduleFavorite" style="width:50px">
<option value="" selected="selected">---</option> <option value="" selected="selected">-</option>
<option value="1" {if isset($module->preferences.interest) && $module->preferences.interest eq '1'}selected="selected"{/if}>{l s='Yes'}</option> <option value="1" {if isset($module->preferences.interest) && $module->preferences.interest eq '1'}selected="selected"{/if}>{l s='Yes'}</option>
<option value="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>{l s='No'}</option> <option value="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>{l s='No'}</option>
</select> </select>
</td> </td>
<td> <td>
<select name="f_{$module->name}" class="moduleFavorite" style="width:50px"> <select name="f_{$module->name}" class="moduleFavorite" style="width:50px">
<option value="" selected="selected">---</option> <option value="" selected="selected">-</option>
<option value="1" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '1'}selected="selected"{/if}>{l s='Yes'}</option> <option value="1" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '1'}selected="selected"{/if}>{l s='Yes'}</option>
<option value="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>{l s='No'}</option> <option value="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>{l s='No'}</option>
</select> </select>
@@ -22,7 +22,7 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<script type="text/javascript" src="../js/jquery/plugins/jquery.uitablefilter.js"></script>
{if $add_permission eq '1'} {if $add_permission eq '1'}
{if isset($logged_on_addons)} {if isset($logged_on_addons)}
<!--start addons login--> <!--start addons login-->
@@ -62,10 +62,7 @@
<!--start filter module--> <!--start filter module-->
<style>.ac_results { border:1px solid #C2C4D9; }</style> <style>.ac_results { border:1px solid #C2C4D9; }</style>
<div class="filter-module"> <div class="filter-module">
<form id="filternameForm" method="post"> <input style="float: left; margin-right: 15px" placeholder="{l s='Search'}" type="text" value="" name="quicksearch" autocomplete="off" onkeyup="$.uiTableFilter($('#moduleContainer').find('table'), this.value);">
<input type="text" value="" name="filtername" autocomplete="off" class="ac_input">
<input type="submit" class="button" value="{l s='Search'}">
</form>
<form method="post"> <form method="post">
<div class="select-filter"> <div class="select-filter">
<label class="search-filter">{l s='Sort by'}:</label> <label class="search-filter">{l s='Sort by'}:</label>
@@ -87,7 +87,7 @@
}); });
// Method to check / uncheck all modules checkbox // Method to check / uncheck all modules checkbox
$('#checkme').click(function() $('#moduleContainer').on("click", "#checkme", function()
{ {
if ($(this).attr("rel") == 'false') if ($(this).attr("rel") == 'false')
{ {
@@ -322,7 +322,7 @@
return false; return false;
}); });
$('.toggle_favorite').live('click', function(event) $('#moduleContainer').on("click", ".toggle_favorite", function()
{ {
var el = $(this); var el = $(this);
var value_pref = el.data('value'); var value_pref = el.data('value');
@@ -46,8 +46,8 @@
</td> </td>
<td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td> <td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td>
<td> <td>
<div class="moduleDesc" id="anchor{$module->name|ucfirst}"> <div class="moduleDesc" id="anchor{$module->name|ucfirst}" title="{$module->name}">
<h3>{$module->displayName} <h3>{$module->displayName}<span style="display:none">{$module->name}</span>
{if isset($module->type) && $module->type == 'addonsMustHave'} {if isset($module->type) && $module->type == 'addonsMustHave'}
<span class="setup must-have">{l s='Must Have'}</span> <span class="setup must-have">{l s='Must Have'}</span>
{else} {else}
@@ -77,7 +77,7 @@
</dl> </dl>
</div> </div>
<p class="desc">{if isset($module->description) && $module->description ne ''}{l s='Description'} : {$module->description}{else}&nbsp;{/if}</p> <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"> <div class="row-actions-module">
{if !isset($module->not_on_disk)} {if !isset($module->not_on_disk)}
{$module->optionsHtml} {$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> <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> </li>
{else} {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> <li><a href="{$module->options.update_url}" class="button updated"><span>{l s='Update it!'}</span></a></li>
{/if} {/if}
<li> <li>
@@ -34,6 +34,7 @@
<td valign="top"> <td valign="top">
<div class="moduleDesc" id="anchor{$module->name|ucfirst}"> <div class="moduleDesc" id="anchor{$module->name|ucfirst}">
<h3> <h3>
<span style="display:none">{$module->name}</span>
{$module->displayName|truncate:36:'…'} {$module->version} {$module->displayName|truncate:36:'…'} {$module->version}
{if isset($module->id) && $module->id gt 0 } {if isset($module->id) && $module->id gt 0 }
{if $module->active} {if $module->active}
@@ -37,7 +37,7 @@
{l s='Show'} : {l s='Show'} :
<select id="show_modules" onChange="autoUrl('show_modules', '{$url_show_modules}')"> <select id="show_modules" onChange="autoUrl('show_modules', '{$url_show_modules}')">
<option value="all">{l s='All modules'}&nbsp;</option> <option value="all">{l s='All modules'}&nbsp;</option>
<option>---------------</option> <option>-</option>
{foreach $modules as $module} {foreach $modules as $module}
<option value="{$module->id|intval}" {if $display_key == $module->id}selected="selected"{/if}>{$module->displayName}</option> <option value="{$module->id|intval}" {if $display_key == $module->id}selected="selected"{/if}>{$module->displayName}</option>
@@ -26,7 +26,7 @@
{* Generate HTML code for printing Invoice Icon with link *} {* Generate HTML code for printing Invoice Icon with link *}
<span style="width:20px; margin-right:5px;"> <span style="width:20px; margin-right:5px;">
{if ($order_state->invoice || $order->invoice_number)} {if ($order_state->invoice || $order->invoice_number)}
<a target="_blank" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order={$order->id}"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a> <a href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order={$order->id}"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
{else} {else}
- -
{/if} {/if}
@@ -35,7 +35,7 @@
{* Generate HTML code for printing Delivery Icon with link *} {* Generate HTML code for printing Delivery Icon with link *}
<span style="width:20px;"> <span style="width:20px;">
{if ($order_state->delivery || $order->delivery_number)} {if ($order_state->delivery || $order->delivery_number)}
<a target="_blank" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateDeliverySlipPDF&id_order={$order->id}"><img src="../img/admin/delivery.gif" alt="delivery" /></a> <a href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateDeliverySlipPDF&id_order={$order->id}"><img src="../img/admin/delivery.gif" alt="delivery" /></a>
{else} {else}
- -
{/if} {/if}
@@ -56,7 +56,7 @@
</span> </span>
{/if} {/if}
</td> </td>
{if $display_warehouse}<td>{$product.warehouse_name|escape:'htmlall':'UTF-8'}</td>{/if} {if $display_warehouse}<td align="center">{$product.warehouse_name|escape:'htmlall':'UTF-8'}</td>{/if}
{if ($order->hasBeenPaid())} {if ($order->hasBeenPaid())}
<td align="center" class="productQuantity"> <td align="center" class="productQuantity">
{$product['product_quantity_refunded']} {$product['product_quantity_refunded']}
@@ -38,6 +38,11 @@
var defaults_order_state = new Array(); var defaults_order_state = new Array();
var customization_errors = false; var customization_errors = false;
var pic_dir = '{$pic_dir}'; 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'} {foreach from=$defaults_order_state key='module' item='id_order_state'}
defaults_order_state['{$module}'] = '{$id_order_state}'; defaults_order_state['{$module}'] = '{$id_order_state}';
{/foreach} {/foreach}
@@ -505,7 +510,6 @@
} }
displaySummary(res); displaySummary(res);
resetBind(); resetBind();
updateCurrencySign();
} }
}); });
} }
@@ -652,11 +656,12 @@
var id_product = Number(this.id_product); var id_product = Number(this.id_product);
var id_product_attribute = Number(this.id_product_attribute); 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_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="'+this.numeric_price+'" /></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;"><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 ? '<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 += (!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(this.numeric_total, currency_format, currency_sign, currency_blank) + '</td></tr>';
if (this.id_customization && this.id_customization != 0) if (this.id_customization && this.id_customization != 0)
{ {
$.each(this.customized_datas[this.id_product][this.id_product_attribute][id_address_delivery], function() { $.each(this.customized_datas[this.id_product][this.id_product_attribute][id_address_delivery], function() {
@@ -710,8 +715,23 @@
$('#payment_list').html(payment_list); $('#payment_list').html(payment_list);
} }
function fixPriceFormat(price)
{
if(price.indexOf(',') > 0 && price.indexOf('.') > 0) // if contains , and .
if(price.indexOf(',') < price.indexOf('.')) // if , is before .
price = price.replace(',',''); // remove ,
price = price.replace(' ',''); // remove any spaces
price = price.replace(',','.'); // remove , if price did not cotain both , and .
return price;
}
function displaySummary(jsonSummary) 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); updateCartProducts(jsonSummary.summary.products, jsonSummary.summary.gift_products, jsonSummary.cart.id_address_delivery);
updateCartVouchers(jsonSummary.summary.discounts); updateCartVouchers(jsonSummary.summary.discounts);
updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice); updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice);
@@ -738,19 +758,18 @@
$('#gift_message').html(jsonSummary.cart.gift_message); $('#gift_message').html(jsonSummary.cart.gift_message);
if (!changed_shipping_price) if (!changed_shipping_price)
$('#shipping_price').html('<b>'+jsonSummary.summary.total_shipping+'</b>'); $('#shipping_price').html('<b>' + formatCurrency(parseFloat(jsonSummary.summary.total_shipping), currency_format, currency_sign, currency_blank) + '</b>');
shipping_price_selected_carrier = jsonSummary.summary.total_shipping; shipping_price_selected_carrier = jsonSummary.summary.total_shipping;
$('#total_vouchers').html(jsonSummary.summary.total_discounts_tax_exc); $('#total_vouchers').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_discounts_tax_exc)), currency_format, currency_sign, currency_blank));
$('#total_shipping').html(jsonSummary.summary.total_shipping_tax_exc); $('#total_shipping').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_shipping_tax_exc)), currency_format, currency_sign, currency_blank));
$('#total_taxes').html(jsonSummary.summary.total_tax); $('#total_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_tax)), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(jsonSummary.summary.total_price_without_tax); $('#total_without_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_price_without_tax)), currency_format, currency_sign, currency_blank));
$('#total_with_taxes').html(jsonSummary.summary.total_price); $('#total_with_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_price)), currency_format, currency_sign, currency_blank));
$('#total_products').html(jsonSummary.summary.total_products); $('#total_products').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_products)), currency_format, currency_sign, currency_blank));
id_currency = jsonSummary.cart.id_currency; id_currency = jsonSummary.cart.id_currency;
$('#id_currency option').removeAttr('selected'); $('#id_currency option').removeAttr('selected');
$('#id_currency option[value="'+id_currency+'"]').attr('selected', true); $('#id_currency option[value="'+id_currency+'"]').attr('selected', true);
updateCurrencySign();
id_lang = jsonSummary.cart.id_lang; id_lang = jsonSummary.cart.id_lang;
$('#id_lang option').removeAttr('selected'); $('#id_lang option').removeAttr('selected');
$('#id_lang option[value="'+id_lang+'"]').attr('selected', true); $('#id_lang option[value="'+id_lang+'"]').attr('selected', true);
@@ -888,11 +907,6 @@
}); });
} }
function updateCurrencySign()
{
$('.currency_sign').html(currencies[id_currency]);
}
function sendMailToCustomer() function sendMailToCustomer()
{ {
$.ajax({ $.ajax({
@@ -925,11 +939,33 @@
var addresses_invoice_options = ''; var addresses_invoice_options = '';
var address_invoice_detail = ''; var address_invoice_detail = '';
var address_delivery_detail = ''; var address_delivery_detail = '';
var delivery_address_edit_link = '';
var invoice_address_edit_link = '';
$.each(addresses, function() { $.each(addresses, function() {
if (this.id_address == id_address_invoice) if (this.id_address == id_address_invoice)
address_invoice_detail = this.company+' '+this.firstname+' '+this.lastname+'<br />'+this.address1+'<br />'+this.address2+'<br />'+this.postcode+' '+this.city+' '+this.country; {
address_invoice_detail = this.company+' '+this.firstname+' '+this.lastname+'<br />'+this.address1+'<br />'+this.address2+'<br />'+this.postcode+' '+this.city;
if (this.state != null)
address_invoice_detail += ' '+this.state;
address_invoice_detail += '</br>'+this.country;
invoice_address_edit_link = "{$link->getAdminLink('AdminAddresses')}&id_address="+this.id_address+"&updateaddress&realedit=1&liteDisplaying=1&submitFormAjax=1#";
}
if(this.id_address == id_address_delivery) if(this.id_address == id_address_delivery)
address_delivery_detail = this.company+' '+this.firstname+' '+this.lastname+'<br />'+this.address1+'<br />'+this.address2+'<br />'+this.postcode+' '+this.city+' '+this.country; {
address_delivery_detail = this.company+' '+this.firstname+' '+this.lastname+'<br />'+this.address1+'<br />'+this.address2+'<br />'+this.postcode+' '+this.city;
if (this.state != null)
address_delivery_detail += ' '+this.state;
address_delivery_detail += '</br>'+this.country;
delivery_address_edit_link = "{$link->getAdminLink('AdminAddresses')}&id_address="+this.id_address+"&updateaddress&realedit=1&liteDisplaying=1&submitFormAjax=1#";
}
addresses_delivery_options += '<option value="'+this.id_address+'" '+(this.id_address == id_address_delivery ? 'selected="selected"' : '')+'>'+this.alias+'</option>'; addresses_delivery_options += '<option value="'+this.id_address+'" '+(this.id_address == id_address_delivery ? 'selected="selected"' : '')+'>'+this.alias+'</option>';
addresses_invoice_options += '<option value="'+this.id_address+'" '+(this.id_address == id_address_invoice ? 'selected="selected"' : '')+'>'+this.alias+'</option>'; addresses_invoice_options += '<option value="'+this.id_address+'" '+(this.id_address == id_address_invoice ? 'selected="selected"' : '')+'>'+this.alias+'</option>';
@@ -949,6 +985,8 @@
$('#id_address_invoice').html(addresses_invoice_options); $('#id_address_invoice').html(addresses_invoice_options);
$('#address_delivery_detail').html(address_delivery_detail); $('#address_delivery_detail').html(address_delivery_detail);
$('#address_invoice_detail').html(address_invoice_detail); $('#address_invoice_detail').html(address_invoice_detail);
$('#edit_delivery_address').attr('href', delivery_address_edit_link);
$('#edit_invoice_address').attr('href', invoice_address_edit_link);
} }
function updateAddresses() function updateAddresses()
@@ -984,7 +1022,7 @@
<label>{l s='Search customers'}</label> <label>{l s='Search customers'}</label>
<div class="margin-form"> <div class="margin-form">
<input type="text" id="customer" value="" /> <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#"> <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> <img src="../img/admin/add.gif" title="new"/><span>{l s='Add new customer'}</span>
</a> </a>
@@ -999,7 +1037,7 @@
<div class="margin-form"> <div class="margin-form">
<input type="hidden" value="" id="id_cart" name="id_cart" /> <input type="hidden" value="" id="id_cart" name="id_cart" />
<input type="text" id="product" value="" /> <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>
<div id="products_found"> <div id="products_found">
<div id="product_list"> <div id="product_list">
@@ -1159,14 +1197,14 @@
<div id="address_delivery"> <div id="address_delivery">
<h3>{l s='Delivery'}</h3> <h3>{l s='Delivery'}</h3>
<select id="id_address_delivery" name="id_address_delivery"> <select id="id_address_delivery" name="id_address_delivery">
</select> </select>&nbsp;<a class="fancybox" id="edit_delivery_address" href="#"><img src="../img/admin/edit.gif" /></a>
<div id="address_delivery_detail"> <div id="address_delivery_detail">
</div> </div>
</div> </div>
<div id="address_invoice"> <div id="address_invoice">
<h3>{l s='Invoice'}</h3> <h3>{l s='Invoice'}</h3>
<select id="id_address_invoice" name="id_address_invoice"> <select id="id_address_invoice" name="id_address_invoice">
</select> </select>&nbsp;<a class="fancybox" id="edit_invoice_address" href="#"><img src="../img/admin/edit.gif" /></a>
<div id="address_invoice_detail"> <div id="address_invoice_detail">
</div> </div>
</div> </div>
@@ -1184,7 +1222,7 @@
</select> </select>
</p> </p>
<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>
<p> <p>
<label for="free_shipping">{l s='Free shipping'}</label> <label for="free_shipping">{l s='Free shipping'}</label>
@@ -1208,12 +1246,12 @@
<div id="send_email_feedback"></div> <div id="send_email_feedback"></div>
<div id="cart_summary" style="clear:both;float:left;"> <div id="cart_summary" style="clear:both;float:left;">
<ul> <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 products'}</span><span id="total_products"></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 vouchers'}</span><span id="total_vouchers"></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 shipping'}</span><span id="total_shipping"></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 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><span class="currency_sign"></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><span class="currency_sign"></span></li> <li><span class="total_cart">{l s='Total with taxes'}</span><span id="total_with_taxes"></span></li>
</ul> </ul>
</div> </div>
<div class="order_message_right"> <div class="order_message_right">
@@ -65,7 +65,7 @@
<div class="bloc-command"> <div class="bloc-command">
<div class="button-command"> <div class="button-command">
{if (count($invoices_collection))} {if (count($invoices_collection))}
<a class="button" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order={$order->id}" target="_blank"> <a class="button" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order={$order->id}">
<img src="../img/admin/charged_ok.gif" alt="{l s='View invoice'}" /> {l s='View invoice'} <img src="../img/admin/charged_ok.gif" alt="{l s='View invoice'}" /> {l s='View invoice'}
</a> </a>
{else} {else}
@@ -73,7 +73,7 @@
{/if} {/if}
| |
{if (($currentState && $currentState->delivery) || $order->delivery_number)} {if (($currentState && $currentState->delivery) || $order->delivery_number)}
<a class="button" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateDeliverySlipPDF&id_order={$order->id}" target="_blank"> <a class="button" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateDeliverySlipPDF&id_order={$order->id}">
<img src="../img/admin/delivery.gif" alt="{l s='View delivery slip'}" /> {l s='View delivery slip'} <img src="../img/admin/delivery.gif" alt="{l s='View delivery slip'}" /> {l s='View delivery slip'}
</a> </a>
{else} {else}
@@ -124,10 +124,10 @@
<!-- History of status --> <!-- History of status -->
<table cellspacing="0" cellpadding="0" class="table history-status" style="width: 100%;"> <table cellspacing="0" cellpadding="0" class="table history-status" style="width: 100%;">
<colgroup> <colgroup>
<col width="1%"> <col width="1%"/>
<col width=""> <col width=""/>
<col width="20%"> <col width="20%"/>
<col width="20%"> <col width="20%"/>
</colgroup> </colgroup>
{foreach from=$history item=row key=key} {foreach from=$history item=row key=key}
{if ($key == 0)} {if ($key == 0)}
@@ -299,12 +299,12 @@
<form id="formAddPayment" method="post" action="{$current_index}&vieworder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}"> <form id="formAddPayment" method="post" action="{$current_index}&vieworder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<table class="table" width="100%" cellspacing="0" cellpadding="0"> <table class="table" width="100%" cellspacing="0" cellpadding="0">
<colgroup> <colgroup>
<col width="15%"> <col width="15%"/>
<col width=""> <col width=""/>
<col width="20%"> <col width="20%"/>
<col width="10%"> <col width="10%"/>
<col width="10%"> <col width="10%"/>
<col width="1%"> <col width="1%"/>
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
@@ -751,7 +751,7 @@
<a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'htmlall':'UTF-8'}"><b>{l s='Click here'}</b> {l s='to see all messages.'}</a><br> <a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'htmlall':'UTF-8'}"><b>{l s='Click here'}</b> {l s='to see all messages.'}</a><br>
<div id="message" style="display: {if Tools::getValue('message')}block{else}none{/if}"> <div id="message" style="display: {if Tools::getValue('message')}block{else}none{/if}">
<select name="order_message" id="order_message" onchange="orderOverwriteMessage(this, '{l s='Do you want to overwrite your existing message?'}')"> <select name="order_message" id="order_message" onchange="orderOverwriteMessage(this, '{l s='Do you want to overwrite your existing message?'}')">
<option value="0" selected="selected">-- {l s='Choose a standard message'} --</option> <option value="0" selected="selected">- {l s='Choose a standard message'} -</option>
{foreach from=$orderMessages item=orderMessage} {foreach from=$orderMessages item=orderMessage}
<option value="{$orderMessage['message']|escape:'htmlall':'UTF-8'}">{$orderMessage['name']}</option> <option value="{$orderMessage['message']|escape:'htmlall':'UTF-8'}">{$orderMessage['name']}</option>
{/foreach} {/foreach}
@@ -787,8 +787,6 @@
</fieldset> </fieldset>
{/if} {/if}
</div> </div>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<br /><br /><a href="{$current_index}&token={$smarty.get.token}"><img src="../img/admin/arrow2.gif" /> {l s='Back to list'}</a><br /> <br /><br /><a href="{$current_index}&token={$smarty.get.token}"><img src="../img/admin/arrow2.gif" /> {l s='Back to list'}</a><br />
{/block} {/block}
@@ -103,11 +103,11 @@
<td class="col-left"><label>{l s='Manufacturer:'}</label></td> <td class="col-left"><label>{l s='Manufacturer:'}</label></td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
<select name="id_manufacturer" id="id_manufacturer"> <select name="id_manufacturer" id="id_manufacturer">
<option value="0">-- {l s='Choose (optional)'} --</option> <option value="0">- {l s='Choose (optional)'} -</option>
{if $product->id_manufacturer} {if $product->id_manufacturer}
<option value="{$product->id_manufacturer}" selected="selected">{$product->manufacturer_name}</option> <option value="{$product->id_manufacturer}" selected="selected">{$product->manufacturer_name}</option>
{/if} {/if}
<option disabled="disabled">----------</option> <option disabled="disabled">-</option>
</select>&nbsp;&nbsp;&nbsp; </select>&nbsp;&nbsp;&nbsp;
<a class="button bt-icon confirm_leave" style="margin-bottom:0" href="{$link->getAdminLink('AdminManufacturers')|escape:'htmlall':'UTF-8'}&addmanufacturer"> <a class="button bt-icon confirm_leave" style="margin-bottom:0" href="{$link->getAdminLink('AdminManufacturers')|escape:'htmlall':'UTF-8'}&addmanufacturer">
<img src="../img/admin/add.gif" alt="{l s='Create new manufacturer'}" title="{l s='Create new manufacturer'}" /> <img src="../img/admin/add.gif" alt="{l s='Create new manufacturer'}" title="{l s='Create new manufacturer'}" />
@@ -85,7 +85,7 @@
</td> </td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
<select name="attribute" id="attribute" style="width: 200px;"> <select name="attribute" id="attribute" style="width: 200px;">
<option value="0">---</option> <option value="0">-</option>
</select> </select>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
@@ -252,7 +252,7 @@
<li style="float: left; width: {$imageWidth}px;"> <li style="float: left; width: {$imageWidth}px;">
<input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" /> <input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" />
<label for="id_image_attr_{$image.id_image}" style="float: none;"> <label for="id_image_attr_{$image.id_image}" style="float: none;">
<img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small_default.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" /> <img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-{$imageType}.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" />
</label> </label>
</li> </li>
{/foreach} {/foreach}
@@ -29,6 +29,19 @@
<h4>{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}</h4> <div class="separation"></div><br /> <h4>{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}</h4> <div class="separation"></div><br />
<table cellpadding="5" style="width:100%"> <table cellpadding="5" style="width:100%">
<tr>
<td class="col-left">
<label>{l s='Legend:'}</label>
</td>
<td style="padding-bottom:5px;" class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if} float: left;">
<input class="updateCurrentText" size="43" type="text" {if !$product->id}disabled="disabled"{/if} id="legend_{$language.id_lang}" name="legend_{$language.id_lang}" value="{$product->name[$language.id_lang]|escape:'htmlall':'UTF-8'}"/>
<span class="hint" name="help_box">{l s='Invalid characters:'} <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
</div>
{/foreach}
</td>
</tr>
<tr> <tr>
<td class="col-left"><label class="file_upload_label">{l s='File:'}</label></td> <td class="col-left"><label class="file_upload_label">{l s='File:'}</label></td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
@@ -57,6 +70,7 @@
<thead> <thead>
<tr class="nodrag nodrop"> <tr class="nodrag nodrop">
<th style="width: 100px;">{l s='Image'}</th> <th style="width: 100px;">{l s='Image'}</th>
<th>{l s='Legend'}</th>
<th>{l s='Position'}</th> <th>{l s='Position'}</th>
{if $shops} {if $shops}
{foreach from=$shops item=shop} {foreach from=$shops item=shop}
@@ -78,9 +92,10 @@
<tr id="image_id"> <tr id="image_id">
<td style="padding: 4px;"> <td style="padding: 4px;">
<a href="{$smarty.const._THEME_PROD_DIR_}image_path.jpg" class="fancybox"> <a href="{$smarty.const._THEME_PROD_DIR_}image_path.jpg" class="fancybox">
<img src="{$smarty.const._THEME_PROD_DIR_}{$iso_lang}-default-small_default.jpg" alt="image_id" title="image_id" /> <img src="{$smarty.const._THEME_PROD_DIR_}{$iso_lang}-default-{$imageType}.jpg" alt="legend" title="legend" />
</a> </a>
</td> </td>
<td>legend</td>
<td id="td_image_id" class="pointer dragHandle center positionImage"> <td id="td_image_id" class="pointer dragHandle center positionImage">
image_position image_position
</td> </td>
@@ -101,7 +116,6 @@
</td> </td>
</tr> </tr>
</table> </table>
<script type="text/javascript"> <script type="text/javascript">
var upbutton = '{l s='Upload an image'}'; var upbutton = '{l s='Upload an image'}';
var token = '{$token}'; var token = '{$token}';
@@ -128,7 +142,7 @@
} }
else else
assoc = false; assoc = false;
imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}enabled{else}forbbiden{/if}", assoc); imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}enabled{else}forbbiden{/if}", assoc, "{$image->legend[$default_language]|@addcslashes:'\"'}");
{/foreach} {/foreach}
{literal} {literal}
$("#imageTable").tableDnD( $("#imageTable").tableDnD(
@@ -147,20 +161,20 @@
updateImagePosition(image_up); updateImagePosition(image_up);
} }
}); });
var filecheck = 1; var filecheck = 1;
var uploader = new qq.FileUploader( var params = new Array;
params['id_product'] = {/literal}{$id_product|intval}{literal};
params['id_category'] = {/literal}{$id_category_default|intval}{literal};
params['token'] = "{/literal}{$token}{literal}";
params['tab'] = "AdminProducts";
params['action'] = "addImage";
params['ajax'] = 1;
uploader = new qq.FileUploader(
{ {
element: document.getElementById("file-uploader"), element: document.getElementById("file-uploader"),
action: "ajax-tab.php", action: "ajax-tab.php",
debug: false, debug: false,
params: {
id_product : {/literal}{$id_product}{literal},
id_category : {/literal}{$id_category_default}{literal},
token : "{/literal}{$token}{literal}",
tab : "AdminProducts",
action : 'addImage',
ajax: 1
},
onComplete: function(id, fileName, responseJSON) onComplete: function(id, fileName, responseJSON)
{ {
var percent = ((filecheck * 100) / nbfile); var percent = ((filecheck * 100) / nbfile);
@@ -185,7 +199,7 @@
cover = "forbbiden"; cover = "forbbiden";
if (responseJSON.cover == "1") if (responseJSON.cover == "1")
cover = "enabled"; cover = "enabled";
imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, responseJSON.shops) imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, responseJSON.shops, responseJSON.legend[{/literal}{$default_language|intval}{literal}])
$("#imageTable tr:last").after(responseJSON.html); $("#imageTable tr:last").after(responseJSON.html);
$("#countImage").html(parseInt($("#countImage").html()) + 1); $("#countImage").html(parseInt($("#countImage").html()) + 1);
$("#img" + id).remove(); $("#img" + id).remove();
@@ -198,6 +212,12 @@
}, },
onSubmit: function(id, filename) onSubmit: function(id, filename)
{ {
$('input[id^="legend_"]').each(function()
{
id = $(this).prop("id").replace("legend_", "legend[") + "]";
params[id] = $(this).val();
});
uploader.setParams(params);
$("#imageTable").show(); $("#imageTable").show();
$("#listImage").append("<li id='img"+id+"'><div class=\"float\" >" + filename + "</div></div><a style=\"margin-left:10px\"href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" alt=\"\" border=\"0\"></a><p class=\"errorImg\"></p></li>"); $("#listImage").append("<li id='img"+id+"'><div class=\"float\" >" + filename + "</div></div><a style=\"margin-left:10px\"href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" alt=\"\" border=\"0\"></a><p class=\"errorImg\"></p></li>");
} }
@@ -309,13 +329,14 @@
$("#img" + id).remove(); $("#img" + id).remove();
} }
function imageLine(id, path, position, cover, shops) function imageLine(id, path, position, cover, shops, legend)
{ {
line = $("#lineType").html(); line = $("#lineType").html();
line = line.replace(/image_id/g, id); line = line.replace(/image_id/g, id);
line = line.replace(/[a-z]{2}-default/g, path); line = line.replace(/[a-z]{0,2}-default/g, path);
line = line.replace(/image_path/g, path); line = line.replace(/image_path/g, path);
line = line.replace(/image_position/g, position); line = line.replace(/image_position/g, position);
line = line.replace(/legend/g, legend);
line = line.replace(/blank/g, cover); line = line.replace(/blank/g, cover);
line = line.replace(/<tbody>/gi, ""); line = line.replace(/<tbody>/gi, "");
line = line.replace(/<\/tbody>/gi, ""); line = line.replace(/<\/tbody>/gi, "");
@@ -330,7 +351,6 @@
$("#imageList").append(line); $("#imageList").append(line);
} }
$('.fancybox').fancybox(); $('.fancybox').fancybox();
}); });
{/literal} {/literal}
@@ -375,8 +375,19 @@
<td style="padding-bottom:5px;" class="translatable"> <td style="padding-bottom:5px;" class="translatable">
{foreach from=$languages item=language} {foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if}float: left;"> <div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if}float: left;">
{literal}
<script type="text/javascript">
$().ready(function () {
var input_id = '{/literal}tags_{$language.id_lang}{literal}';
$('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag' js=1}{literal}'});
$({/literal}'#{$table}{literal}_form').submit( function() {
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
});
});
</script>
{/literal}
<input size="55" type="text" id="tags_{$language.id_lang}" name="tags_{$language.id_lang}" <input size="55" type="text" id="tags_{$language.id_lang}" name="tags_{$language.id_lang}"
value="{$product->getTags($language.id_lang, true)|htmlentitiesUTF8}" /> value="{$product->getTags($language.id_lang, true)|htmlentitiesUTF8}" class="tagify" />
<span class="hint" name="help_box">{l s='Forbidden characters:'} !&lt;;&gt;;?=+#&quot;&deg;{}_$%<span class="hint-pointer">&nbsp;</span></span> <span class="hint" name="help_box">{l s='Forbidden characters:'} !&lt;;&gt;;?=+#&quot;&deg;{}_$%<span class="hint-pointer">&nbsp;</span></span>
</div> </div>
{/foreach} {/foreach}
@@ -223,7 +223,7 @@ $(document).ready(function () {
<tr> <tr>
<td class="col-left"><label><b>{l s='Final retail price:'}</b></label></td> <td class="col-left"><label><b>{l s='Final retail price:'}</b></label></td>
<td> <td>
<span {if !$country_display_tax_label}style="display:none"{/if} > <span>
{$currency->prefix}<span id="finalPrice" style="font-weight: bold;">0.00</span>{$currency->suffix}<span {if $ps_tax}style="display:none;"{/if}> ({l s='tax incl.'})</span> {$currency->prefix}<span id="finalPrice" style="font-weight: bold;">0.00</span>{$currency->suffix}<span {if $ps_tax}style="display:none;"{/if}> ({l s='tax incl.'})</span>
</span> </span>
<span {if $ps_tax}style="display:none;"{/if} > <span {if $ps_tax}style="display:none;"{/if} >
@@ -249,7 +249,7 @@ $(document).ready(function () {
<script type="text/javascript"> <script type="text/javascript">
var product_prices = new Array(); var product_prices = new Array();
{foreach from=$combinations item='combination'} {foreach from=$combinations item='combination'}
product_prices['{$combination.id_product_attribute}'] = '{$combination.price}'; product_prices['{$combination.id_product_attribute}'] = '{$combination.price|@addcslashes:'\''}';
{/foreach} {/foreach}
</script> </script>
<div id="add_specific_price" style="display: none;"> <div id="add_specific_price" style="display: none;">
@@ -375,7 +375,7 @@ $(document).ready(function () {
<div class="margin-form"> <div class="margin-form">
<input type="text" name="sp_reduction" value="0.00" size="11" /> <input type="text" name="sp_reduction" value="0.00" size="11" />
<select name="sp_reduction_type"> <select name="sp_reduction_type">
<option selected="selected">---</option> <option selected="selected">-</option>
<option value="amount">{l s='Amount'}</option> <option value="amount">{l s='Amount'}</option>
<option value="percentage">{l s='Percentage'}</option> <option value="percentage">{l s='Percentage'}</option>
</select> </select>
@@ -75,7 +75,7 @@
<p>{l s='Click "Save and Stay" after changing selected suppliers to display the associated product references.'}</p> <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;"> <div id="suppliers_accordion" style="margin-top:10px; display:block;">
{foreach from=$associated_suppliers item=supplier} {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;"> <div style="display:block;">
<table cellpadding="10" cellspacing="0" class="table"> <table cellpadding="10" cellspacing="0" class="table">
@@ -58,6 +58,7 @@
$('#file_missing').hide(); $('#file_missing').hide();
$('#virtual_product_name').attr('value', fileName); $('#virtual_product_name').attr('value', fileName);
$("#upload-confirmation .error").remove(); $("#upload-confirmation .error").remove();
$('#upload-confirmation div').find('span').remove();
$('#upload-confirmation div').prepend('<span>{l s='The file'}&nbsp;"<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">'+fileName+'</a>"&nbsp;{l s='has successfully been uploaded'}' + $('#upload-confirmation div').prepend('<span>{l s='The file'}&nbsp;"<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">'+fileName+'</a>"&nbsp;{l s='has successfully been uploaded'}' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" /></span>'); '<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" /></span>');
$("#upload-confirmation").show(); $("#upload-confirmation").show();
@@ -112,7 +112,7 @@
<label>{l s='Filter by product:'}</label> <label>{l s='Filter by product:'}</label>
<div class="margin-left"> <div class="margin-left">
<select id="selectProduct" name="selectProduct" style="width: 200px;" onfocus="fillProducts();" onchange="updateConversionRate(this.value);"> <select id="selectProduct" name="selectProduct" style="width: 200px;" onfocus="fillProducts();" onchange="updateConversionRate(this.value);">
<option value="0" selected="selected">-- {l s='All'} --</option> <option value="0" selected="selected">- {l s='All'} -</option>
</select> </select>
</div> </div>
<br class="clear" /> <br class="clear" />
@@ -41,7 +41,7 @@
<div class="margin-form"> <div class="margin-form">
<select id="id_category" name="id_category"> <select id="id_category" name="id_category">
{foreach from=$categories item='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} {/foreach}
</select> </select>
<a class="button bt-icon" href="#" id="add_condition_category"> <a class="button bt-icon" href="#" id="add_condition_category">
@@ -54,7 +54,7 @@ $(document).ready(function() {
</div> </div>
<div class="margin-form"> <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> </div>
{/if} {/if}
{/block} {/block}
+26 -29
View File
@@ -34,45 +34,42 @@
<title>{$meta_title} - PrestaShop&trade;</title> <title>{$meta_title} - PrestaShop&trade;</title>
{if $display_header} {if $display_header}
<script type="text/javascript"> <script type="text/javascript">
var help_class_name = '{$controller_name}'; var help_class_name = '{$controller_name|@addcslashes:'\''}';
var iso_user = '{$iso_user}'; var iso_user = '{$iso_user|@addcslashes:'\''}';
var country_iso_code = '{$country_iso_code}'; var country_iso_code = '{$country_iso_code|@addcslashes:'\''}';
var _PS_VERSION_ = '{$smarty.const._PS_VERSION_}'; var _PS_VERSION_ = '{$smarty.const._PS_VERSION_|@addcslashes:'\''}';
var helpboxes = {$help_box|intval};
var helpboxes = {$help_box}; var roundMode = {$round_mode|intval};
var roundMode = {$round_mode};
{if isset($shop_context)} {if isset($shop_context)}
{if $shop_context == Shop::CONTEXT_ALL} {if $shop_context == Shop::CONTEXT_ALL}
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops' slashes=1 }"; var youEditFieldFor = '{l s='A modification of this field will be applied for all shops' js=1}';
{elseif $shop_context == Shop::CONTEXT_GROUP} {elseif $shop_context == Shop::CONTEXT_GROUP}
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops of group ' slashes=1 }<b>{$shop_name}</b>"; var youEditFieldFor = '{l s='A modification of this field will be applied for all shops of group' js=1} <b>{$shop_name|@addcslashes:'\''}</b>';
{else} {else}
var youEditFieldFor = "{l s='A modification of this field will be applied for the shop ' slashes=1 }<b>{$shop_name}</b>"; var youEditFieldFor = '{l s='A modification of this field will be applied for the shop' js=1} <b>{$shop_name|@addcslashes:'\''}</b>';
{/if} {/if}
{else} {else}
var youEditFieldFor = ''; var youEditFieldFor = '';
{/if} {/if}
{* Notifications vars *} var autorefresh_notifications = '{$autorefresh_notifications|@addcslashes:'\''}';
var autorefresh_notifications = '{$autorefresh_notifications}'; var new_order_msg = '{l s='A new order has been placed on your shop.' js=1}';
var new_order_msg = '{l s='A new order has been placed on your shop.' slashes=1}'; var order_number_msg = '{l s='Order number: ' js=1}';
var order_number_msg = '{l s='Order number: ' slashes=1}'; var total_msg = '{l s='Total: ' js=1}';
var total_msg = '{l s='Total: ' slashes=1}'; var from_msg = '{l s='From: ' js=1}';
var from_msg = '{l s='From: ' slashes=1}'; var see_order_msg = '{l s='View this order' js=1}';
var see_order_msg = '{l s='View this order' slashes=1}'; var new_customer_msg = '{l s='A new customer registered on your shop.' js=1}';
var new_customer_msg = '{l s='A new customer registered on your shop.' slashes=1}'; var customer_name_msg = '{l s='Customer name: ' js=1}';
var customer_name_msg = '{l s='Customer name: ' slashes=1}'; var see_customer_msg = '{l s='View this customer' js=1}';
var see_customer_msg = '{l s='View this customer' slashes=1}'; var new_msg = '{l s='A new message posted on your shop.' js=1}';
var new_msg = '{l s='A new message posted on your shop.' slashes=1}'; var excerpt_msg = '{l s='Excerpt: ' js=1}';
var excerpt_msg = '{l s='Excerpt: ' slashes=1}'; var see_msg = '{l s='Read this message' js=1}';
var see_msg = '{l s='Read this message' slashes=1}'; var token_admin_orders = '{getAdminToken tab='AdminOrders'}';
var token_admin_orders = '{getAdminToken tab='AdminOrders' slashes=1}'; var token_admin_customers = '{getAdminToken tab='AdminCustomers'}';
var token_admin_customers = '{getAdminToken tab='AdminCustomers' slashes=1}'; var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads'}';
var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads' slashes=1}'; var currentIndex = '{$currentIndex|@addcslashes:'\''}';
var currentIndex = '{$currentIndex}'; var choose_language_translate = '{l s='Choose language' js=1}';
var choose_language_translate = "{l s='Choose language' slashes=1 }";
</script> </script>
{/if} {/if}
{if isset($css_files)} {if isset($css_files)}
{foreach from=$css_files key=css_uri item=media} {foreach from=$css_files key=css_uri item=media}
<link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" /> <link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" />
@@ -68,7 +68,7 @@
<script type="text/javascript"> <script type="text/javascript">
$().ready(function () { $().ready(function () {
var input_id = '{/literal}{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}{literal}'; var input_id = '{/literal}{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}{literal}';
$('#'+input_id).tagify({addTagPrompt: '{/literal}{l s='Add tag' js=1}{literal}'}); $('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag' js=1}{literal}'});
$({/literal}'#{$table}{literal}_form').submit( function() { $({/literal}'#{$table}{literal}_form').submit( function() {
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize')); $(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
}); });
@@ -97,8 +97,7 @@
<script type="text/javascript"> <script type="text/javascript">
$().ready(function () { $().ready(function () {
var input_id = '{/literal}{if isset($input.id)}{$input.id}{else}{$input.name}{/if}{literal}'; var input_id = '{/literal}{if isset($input.id)}{$input.id}{else}{$input.name}{/if}{literal}';
$('#'+input_id).tagify(); $('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag'}{literal}'});
$('#'+input_id).tagify({addTagPrompt: '{/literal}{l s='Add tag'}{literal}'});
$({/literal}'#{$table}{literal}_form').submit( function() { $({/literal}'#{$table}{literal}_form').submit( function() {
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize')); $(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
}); });
@@ -168,7 +167,7 @@
{/if} {/if}
>{$option->$input.options.name}</option> >{$option->$input.options.name}</option>
{elseif $option == "-"} {elseif $option == "-"}
<option value="">--</option> <option value="">-</option>
{else} {else}
<option value="{$option[$input.options.id]}" <option value="{$option[$input.options.id]}"
{if isset($input.multiple)} {if isset($input.multiple)}
@@ -237,7 +236,7 @@
{if isset($fields_value[$input.name].image) && $fields_value[$input.name].image} {if isset($fields_value[$input.name].image) && $fields_value[$input.name].image}
<div id="image"> <div id="image">
{$fields_value[$input.name].image} {$fields_value[$input.name].image}
<p align="center">{l s='File size'} {$fields_value[$input.name].size}kb</p> <p align="center">{l s='File size'} {$fields_value[$input.name].size}{l s='kb'}</p>
<a href="{$current}&{$identifier}={$form_id}&token={$token}&deleteImage=1"> <a href="{$current}&{$identifier}={$form_id}&token={$token}&deleteImage=1">
<img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'} <img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'}
</a> </a>
@@ -24,11 +24,11 @@
*} *}
{if count($categories) && isset($categories)} {if count($categories) && isset($categories)}
<script type="text/javascript"> <script type="text/javascript">
var inputName = '{$categories.input_name}'; var inputName = '{$categories.input_name|@addcslashes:'\''}';
var use_radio = {if $categories.use_radio}1{else}0{/if}; var use_radio = {if $categories.use_radio}1{else}0{/if};
var selectedCat = '{implode value=$categories.selected_cat}'; var selectedCat = {$categories.selected_cat|@implode|intval};
var selectedLabel = '{$categories.trads.selected}'; var selectedLabel = '{$categories.trads.selected|@addcslashes:'\''}';
var home = '{$categories.trads.Root.name}'; var home = '{$categories.trads.Root.name|@addcslashes:'\''}';
var use_radio = {if $categories.use_radio}1{else}0{/if}; var use_radio = {if $categories.use_radio}1{else}0{/if};
var use_context = {if isset($categories.use_context)}1{else}0{/if}; var use_context = {if isset($categories.use_context)}1{else}0{/if};
$(document).ready(function(){ $(document).ready(function(){
@@ -49,6 +49,7 @@
{/if} {/if}
class="{if !$no_link}pointer{/if} class="{if !$no_link}pointer{/if}
{if isset($params.position) && $order_by == 'position' && $order_way != 'DESC'} dragHandle{/if} {if isset($params.position) && $order_by == 'position' && $order_way != 'DESC'} dragHandle{/if}
{if isset($params.class)} {$params.class}{/if}
{if isset($params.align)} {$params.align}{/if}" {if isset($params.align)} {$params.align}{/if}"
{if (!isset($params.position) && !$no_link && !isset($params.remove_onclick))} {if (!isset($params.position) && !$no_link && !isset($params.remove_onclick))}
onclick="document.location = '{$current_index}&{$identifier}={$tr.$identifier}{if $view}&view{else}&update{/if}{$table}&token={$token}'"> onclick="document.location = '{$current_index}&{$identifier}={$tr.$identifier}{if $view}&view{else}&update{/if}{$table}&token={$token}'">
@@ -187,7 +187,7 @@
{else} {else}
{if $params.type == 'bool'} {if $params.type == 'bool'}
<select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$key}"> <select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$key}">
<option value="">--</option> <option value="">-</option>
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option> <option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option> <option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
</select> </select>
@@ -197,7 +197,7 @@
{elseif $params.type == 'select'} {elseif $params.type == 'select'}
{if isset($params.filter_key)} {if isset($params.filter_key)}
<select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}> <select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
<option value="" {if $params.value == ''} selected="selected" {/if}>--</option> <option value="" {if $params.value == ''} selected="selected" {/if}>-</option>
{if isset($params.list) && is_array($params.list)} {if isset($params.list) && is_array($params.list)}
{foreach $params.list AS $option_value => $option_display} {foreach $params.list AS $option_value => $option_display}
<option value="{$option_value}" {if $option_display == $params.value || $option_value == $params.value} selected="selected"{/if}>{$option_display}</option> <option value="{$option_value}" {if $option_display == $params.value || $option_value == $params.value} selected="selected"{/if}>{$option_display}</option>
@@ -87,7 +87,7 @@
btn_submit.hide(); btn_submit.hide();
//bind enter key press to validate form //bind enter key press to validate form
$('#{$table}_form').keypress(function (e) { $('#{$table}_form').keypress(function (e) {
if (e.which == 13 && e.target.localName != 'textarea') if (e.which == 13 && e.target.localName != 'textarea' && !e.target.hasClass('tagify'))
$('#desc-{$table}-save').click(); $('#desc-{$table}-save').click();
}); });
//submit the form //submit the form
+15 -7
View File
@@ -264,13 +264,17 @@ class AddressCore extends ObjectModel
if(!isset($id_address) || empty($id_address)) if(!isset($id_address) || empty($id_address))
return false; return false;
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $cache_id = 'Address::isCountryActiveById_'.(int)$id_address;
if (!Cache::isStored($cache_id))
{
$result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getvalue('
SELECT c.`active` SELECT c.`active`
FROM `'._DB_PREFIX_.'address` a FROM `'._DB_PREFIX_.'address` a
LEFT JOIN `'._DB_PREFIX_.'country` c ON c.`id_country` = a.`id_country` LEFT JOIN `'._DB_PREFIX_.'country` c ON c.`id_country` = a.`id_country`
WHERE a.`id_address` = '.(int)$id_address)) WHERE a.`id_address` = '.(int)$id_address);
return false; Cache::store($cache_id, $result);
return ($result['active']); }
return Cache::retrieve($cache_id);
} }
/** /**
@@ -324,12 +328,17 @@ class AddressCore extends ObjectModel
{ {
if (!$id_customer) if (!$id_customer)
return false; return false;
$cache_id = 'Address::getFirstCustomerAddressId_'.(int)$id_customer.'-'.(bool)$active;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_address` SELECT `id_address`
FROM `'._DB_PREFIX_.'address` FROM `'._DB_PREFIX_.'address`
WHERE `id_customer` = '.(int)$id_customer.' AND `deleted` = 0'.($active ? ' AND `active` = 1' : '') WHERE `id_customer` = '.(int)$id_customer.' AND `deleted` = 0'.($active ? ' AND `active` = 1' : '')
); );
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
@@ -380,4 +389,3 @@ class AddressCore extends ObjectModel
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
} }
} }
+2 -2
View File
@@ -1500,7 +1500,7 @@ abstract class AdminTabCore
case 'bool': case 'bool':
echo ' echo '
<select name="'.$this->table.'Filter_'.$key.'"> <select name="'.$this->table.'Filter_'.$key.'">
<option value="">--</option> <option value="">-</option>
<option value="1"'.($value == 1 ? ' selected="selected"' : '').'>'.$this->l('Yes').'</option> <option value="1"'.($value == 1 ? ' selected="selected"' : '').'>'.$this->l('Yes').'</option>
<option value="0"'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>'.$this->l('No').'</option> <option value="0"'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>'.$this->l('No').'</option>
</select>'; </select>';
@@ -1524,7 +1524,7 @@ abstract class AdminTabCore
if (isset($params['filter_key'])) if (isset($params['filter_key']))
{ {
echo '<select onchange="$(\'#submitFilter'.$this->table.'\').focus();$(\'#submitFilter'.$this->table.'\').click();" name="'.$this->table.'Filter_'.$params['filter_key'].'" '.(isset($params['width']) ? 'style="width: '.$params['width'].'px"' : '').'> echo '<select onchange="$(\'#submitFilter'.$this->table.'\').focus();$(\'#submitFilter'.$this->table.'\').click();" name="'.$this->table.'Filter_'.$params['filter_key'].'" '.(isset($params['width']) ? 'style="width: '.$params['width'].'px"' : '').'>
<option value=""'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>--</option>'; <option value=""'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>-</option>';
if (isset($params['select']) && is_array($params['select'])) if (isset($params['select']) && is_array($params['select']))
foreach ($params['select'] as $optionValue => $optionDisplay) foreach ($params['select'] as $optionValue => $optionDisplay)
{ {
+16
View File
@@ -124,5 +124,21 @@ class AliasCore extends ObjectModel
{ {
return Configuration::get('PS_ALIAS_FEATURE_ACTIVE'); return Configuration::get('PS_ALIAS_FEATURE_ACTIVE');
} }
/**
* This method is allow to know if a alias exist for AdminImportController
* @since 1.5.6.0
* @return bool
*/
public static function aliasExists($id_alias)
{
$row = Db::getInstance()->getRow('
SELECT `id_alias`
FROM '._DB_PREFIX_.'alias a
WHERE a.`id_alias` = '.(int)$id_alias
);
return isset($row['id_alias']);
}
} }
+1 -1
View File
@@ -139,7 +139,7 @@ class AttributeCore extends ObjectModel
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.') ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
'.Shop::addSqlAssociation('attribute_group', 'ag').' '.Shop::addSqlAssociation('attribute_group', 'ag').'
'.Shop::addSqlAssociation('attribute', 'a').' '.Shop::addSqlAssociation('attribute', 'a').'
'.($not_null ? 'WHERE a.`id_attribute` IS NOT NULL AND al.`name` IS NOT NULL' : '').' '.($not_null ? 'WHERE a.`id_attribute` IS NOT NULL AND al.`name` IS NOT NULL AND agl.`id_attribute_group` IS NOT NULL' : '').'
ORDER BY agl.`name` ASC, a.`position` ASC ORDER BY agl.`name` ASC, a.`position` ASC
'); ');
} }
+15 -13
View File
@@ -49,6 +49,8 @@ class Autoload
*/ */
public $index = array(); public $index = array();
public $_include_override_path = true;
protected function __construct() protected function __construct()
{ {
$this->root_dir = dirname(dirname(__FILE__)).'/'; $this->root_dir = dirname(dirname(__FILE__)).'/';
@@ -120,33 +122,33 @@ class Autoload
{ {
$classes = array_merge( $classes = array_merge(
$this->getClassesFromDir('classes/'), $this->getClassesFromDir('classes/'),
$this->getClassesFromDir('controllers/')
);
if ($this->_include_override_path)
$classes = array_merge(
$classes,
$this->getClassesFromDir('override/classes/'), $this->getClassesFromDir('override/classes/'),
$this->getClassesFromDir('controllers/'),
$this->getClassesFromDir('override/controllers/') $this->getClassesFromDir('override/controllers/')
); );
ksort($classes); ksort($classes);
$content = '<?php return '.var_export($classes, true).'; ?>'; $content = '<?php return '.var_export($classes, true).'; ?>';
// Write classes index on disc to cache it // Write classes index on disc to cache it
$filename = $this->root_dir.Autoload::INDEX_FILE; $filename = $this->root_dir.Autoload::INDEX_FILE;
if ((file_exists($filename) && !is_writable($filename)) || !is_writable(dirname($filename)))
{
header('HTTP/1.1 503 temporarily overloaded');
// Cannot use PrestaShopException in this context
die('/cache/class_index.php is not writable, please give write permissions (chmod 666) on this file.');
}
else
{
$filename_tmp = tempnam(dirname($filename), basename($filename.'.')); $filename_tmp = tempnam(dirname($filename), basename($filename.'.'));
if($filename_tmp !== FALSE and file_put_contents($filename_tmp, $content, LOCK_EX) !== FALSE) if ($filename_tmp !== false && file_put_contents($filename_tmp, $content, LOCK_EX) !== false)
{ {
@rename($filename_tmp, $filename); if (!rename($filename_tmp, $filename))
unlink($filename_tmp);
else
@chmod($filename, 0666); @chmod($filename, 0666);
} }
else
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die. // $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die.
else
error_log('Cannot write temporary file '.$filename_tmp); error_log('Cannot write temporary file '.$filename_tmp);
}
$this->index = $classes; $this->index = $classes;
} }
+6 -1
View File
@@ -34,6 +34,7 @@ class CMSCore extends ObjectModel
public $link_rewrite; public $link_rewrite;
public $id_cms_category; public $id_cms_category;
public $position; public $position;
public $indexation;
public $active; public $active;
/** /**
@@ -46,6 +47,7 @@ class CMSCore extends ObjectModel
'fields' => array( 'fields' => array(
'id_cms_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'id_cms_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'position' => array('type' => self::TYPE_INT), 'position' => array('type' => self::TYPE_INT),
'indexation' => array('type' => self::TYPE_BOOL),
'active' => array('type' => self::TYPE_BOOL), 'active' => array('type' => self::TYPE_BOOL),
// Lang fields // Lang fields
@@ -188,7 +190,7 @@ class CMSCore extends ObjectModel
return (Db::getInstance()->getValue($sql)); return (Db::getInstance()->getValue($sql));
} }
public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true) public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true, $id_shop = null)
{ {
$sql = new DbQuery(); $sql = new DbQuery();
$sql->select('*'); $sql->select('*');
@@ -196,6 +198,9 @@ class CMSCore extends ObjectModel
if ($id_lang) if ($id_lang)
$sql->innerJoin('cms_lang', 'l', 'c.id_cms = l.id_cms AND l.id_lang = '.(int)$id_lang); $sql->innerJoin('cms_lang', 'l', 'c.id_cms = l.id_cms AND l.id_lang = '.(int)$id_lang);
if ($id_shop)
$sql->innerJoin('cms_shop', 'cs', 'c.id_cms = cs.id_cms AND cs.id_shop = '.(int)$id_shop);
if ($active) if ($active)
$sql->where('c.active = 1'); $sql->where('c.active = 1');
+29 -10
View File
@@ -276,6 +276,9 @@ class CarrierCore extends ObjectModel
} }
public function getMaxDeliveryPriceByWeight($id_zone) public function getMaxDeliveryPriceByWeight($id_zone)
{
$cache_id = 'Carrier::getMaxDeliveryPriceByWeight_'.(int)$this->id.'-'.(int)$id_zone;
if (!Cache::isStored($cache_id))
{ {
$sql = 'SELECT d.`price` $sql = 'SELECT d.`price`
FROM `'._DB_PREFIX_.'delivery` d FROM `'._DB_PREFIX_.'delivery` d
@@ -283,11 +286,11 @@ class CarrierCore extends ObjectModel
WHERE d.`id_zone` = '.(int)$id_zone.' WHERE d.`id_zone` = '.(int)$id_zone.'
AND d.`id_carrier` = '.(int)$this->id.' AND d.`id_carrier` = '.(int)$this->id.'
'.Carrier::sqlDeliveryRangeShop('range_weight').' '.Carrier::sqlDeliveryRangeShop('range_weight').'
ORDER BY w.`delimiter2` DESC LIMIT 1'; ORDER BY w.`delimiter2` DESC';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if (!isset($result[0]['price'])) Cache::store($cache_id, $result);
return false; }
return $result[0]['price']; return Cache::retrieve($cache_id);
} }
/** /**
@@ -356,6 +359,9 @@ class CarrierCore extends ObjectModel
} }
public function getMaxDeliveryPriceByPrice($id_zone) public function getMaxDeliveryPriceByPrice($id_zone)
{
$cache_id = 'Carrier::getMaxDeliveryPriceByPrice_'.(int)$this->id.'-'.(int)$id_zone;
if (!Cache::isStored($cache_id))
{ {
$sql = 'SELECT d.`price` $sql = 'SELECT d.`price`
FROM `'._DB_PREFIX_.'delivery` d FROM `'._DB_PREFIX_.'delivery` d
@@ -363,11 +369,11 @@ class CarrierCore extends ObjectModel
WHERE d.`id_zone` = '.(int)$id_zone.' WHERE d.`id_zone` = '.(int)$id_zone.'
AND d.`id_carrier` = '.(int)$this->id.' AND d.`id_carrier` = '.(int)$this->id.'
'.Carrier::sqlDeliveryRangeShop('range_price').' '.Carrier::sqlDeliveryRangeShop('range_price').'
ORDER BY r.`delimiter2` DESC LIMIT 1'; ORDER BY r.`delimiter2` DESC';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if (!isset($result[0]['price'])) Cache::store($cache_id, $result);
return false; }
return $result[0]['price']; return Cache::retrieve($cache_id);
} }
/** /**
@@ -449,7 +455,13 @@ class CarrierCore extends ObjectModel
GROUP BY c.`id_carrier` GROUP BY c.`id_carrier`
ORDER BY c.`position` ASC'; ORDER BY c.`position` ASC';
$cache_id = 'Carrier::getCarriers_'.md5($sql);
if (!Cache::isStored($cache_id))
{
$carriers = Db::getInstance()->executeS($sql); $carriers = Db::getInstance()->executeS($sql);
Cache::store($cache_id, $carriers);
}
$carriers = Cache::retrieve($cache_id);
if (is_array($carriers) && count($carriers)) if (is_array($carriers) && count($carriers))
{ {
@@ -1199,7 +1211,14 @@ class CarrierCore extends ObjectModel
$query->where('pc.id_product = '.(int)$product->id); $query->where('pc.id_product = '.(int)$product->id);
$query->where('pc.id_shop = '.(int)$id_shop); $query->where('pc.id_shop = '.(int)$id_shop);
$cache_id = 'Carrier::getAvailableCarrierList_'.(int)$product->id.'-'.(int)$id_shop;
if (!Cache::isStored($cache_id))
{
$carriers_for_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); $carriers_for_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
Cache::store($cache_id, $carriers_for_product);
}
$carriers_for_product = Cache::retrieve($cache_id);
$carrier_list = array(); $carrier_list = array();
if (!empty($carriers_for_product)) if (!empty($carriers_for_product))
{ {
+45 -18
View File
@@ -325,7 +325,7 @@ class CartCore extends ObjectModel
if (!CartRule::isFeatureActive() || !$this->id) if (!CartRule::isFeatureActive() || !$this->id)
return array(); return array();
$cache_key = 'Cart::getCartRules'.$this->id.'-'.$filter; $cache_key = 'Cart::getCartRules_'.$this->id.'-'.$filter;
if (!Cache::isStored($cache_key)) if (!Cache::isStored($cache_key))
{ {
$result = Db::getInstance()->executeS(' $result = Db::getInstance()->executeS('
@@ -340,6 +340,7 @@ class CartCore extends ObjectModel
'.($filter == CartRule::FILTER_ACTION_SHIPPING ? 'AND free_shipping = 1' : '').' '.($filter == CartRule::FILTER_ACTION_SHIPPING ? 'AND free_shipping = 1' : '').'
'.($filter == CartRule::FILTER_ACTION_GIFT ? 'AND gift_product != 0' : '').' '.($filter == CartRule::FILTER_ACTION_GIFT ? 'AND gift_product != 0' : '').'
'.($filter == CartRule::FILTER_ACTION_REDUCTION ? 'AND (reduction_percent != 0 OR reduction_amount != 0)' : '') '.($filter == CartRule::FILTER_ACTION_REDUCTION ? 'AND (reduction_percent != 0 OR reduction_amount != 0)' : '')
.' ORDER by cr.priority ASC'
); );
Cache::store($cache_key, $result); Cache::store($cache_key, $result);
} }
@@ -367,12 +368,16 @@ class CartCore extends ObjectModel
{ {
if (!CartRule::isFeatureActive()) if (!CartRule::isFeatureActive())
return 0; return 0;
$cache_id = 'Cart::getDiscountsCustomer_'.(int)$this->id.'-'.(int)$id_cart_rule;
return Db::getInstance()->getValue(' if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('
SELECT COUNT(*) SELECT COUNT(*)
FROM `'._DB_PREFIX_.'cart_cart_rule` FROM `'._DB_PREFIX_.'cart_cart_rule`
WHERE `id_cart_rule` = '.(int)$id_cart_rule.' AND `id_cart` = '.(int)$this->id WHERE `id_cart_rule` = '.(int)$id_cart_rule.' AND `id_cart` = '.(int)$this->id);
); Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
public function getLastProduct() public function getLastProduct()
@@ -429,7 +434,7 @@ class CartCore extends ObjectModel
product_shop.`available_for_order`, product_shop.`price`, product_shop.`active`, product_shop.`unity`, product_shop.`unit_price_ratio`, 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`, 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, 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'); product_shop.`wholesale_price`, product_shop.advanced_stock_management, ps.product_supplier_reference supplier_reference');
// Build FROM // Build FROM
@@ -630,6 +635,9 @@ class CartCore extends ObjectModel
} }
if (!isset($row['pai_id_image']) || $row['pai_id_image'] == 0) if (!isset($row['pai_id_image']) || $row['pai_id_image'] == 0)
{
$cache_id = 'Cart::getProducts_'.'-pai_id_image-'.(int)$row['id_product'].'-'.(int)$this->id_lang.'-'.(int)$row['id_shop'];
if (!Cache::isStored($cache_id))
{ {
$row2 = Db::getInstance()->getRow(' $row2 = Db::getInstance()->getRow('
SELECT image_shop.`id_image` id_image, il.`legend` SELECT image_shop.`id_image` id_image, il.`legend`
@@ -638,7 +646,9 @@ class CartCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.') LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.')
WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1' WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1'
); );
Cache::store($cache_id, $row2);
}
$row2 = Cache::retrieve($cache_id);
if (!$row2) if (!$row2)
$row2 = array('id_image' => false, 'legend' => false); $row2 = array('id_image' => false, 'legend' => false);
else else
@@ -1079,7 +1089,7 @@ class CartCore extends ObjectModel
} }
$query = 'INSERT INTO `'._DB_PREFIX_.'customized_data` (`id_customization`, `type`, `index`, `value`) $query = 'INSERT INTO `'._DB_PREFIX_.'customized_data` (`id_customization`, `type`, `index`, `value`)
VALUES ('.(int)$id_customization.', '.(int)$type.', '.(int)$index.', \''.pSql($field).'\')'; VALUES ('.(int)$id_customization.', '.(int)$type.', '.(int)$index.', \''.pSQL($field).'\')';
if (!Db::getInstance()->execute($query)) if (!Db::getInstance()->execute($query))
return false; return false;
@@ -1093,7 +1103,13 @@ class CartCore extends ObjectModel
*/ */
public function orderExists() public function orderExists()
{ {
return (bool)Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int)$this->id); $cache_id = 'Cart::orderExists_'.(int)$this->id;
if (!Cache::isStored($cache_id))
{
$result = (bool)Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int)$this->id);
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
@@ -1260,7 +1276,7 @@ class CartCore extends ObjectModel
return true; 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); $cart = new Cart($id_cart);
if (!Validate::isLoadedObject($cart)) if (!Validate::isLoadedObject($cart))
@@ -1676,6 +1692,7 @@ class CartCore extends ObjectModel
$warehouse_count_by_address[$product['id_address_delivery']][$warehouse['id_warehouse']]++; $warehouse_count_by_address[$product['id_address_delivery']][$warehouse['id_warehouse']]++;
} }
} }
unset($product);
arsort($warehouse_count_by_address); arsort($warehouse_count_by_address);
@@ -1692,11 +1709,14 @@ class CartCore extends ObjectModel
$product['carrier_list'] = array(); $product['carrier_list'] = array();
$id_warehouse = 0; $id_warehouse = 0;
foreach ($warehouse_count_by_address[$product['id_address_delivery']] as $id_war => $val) foreach ($warehouse_count_by_address[$product['id_address_delivery']] as $id_war => $val)
{
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)); $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) if (!$id_warehouse)
$id_warehouse = (int)$id_war; $id_warehouse = (int)$id_war;
} }
}
if (!isset($grouped_by_warehouse[$product['id_address_delivery']]['in_stock'][$id_warehouse])) if (!isset($grouped_by_warehouse[$product['id_address_delivery']]['in_stock'][$id_warehouse]))
{ {
@@ -1714,6 +1734,7 @@ class CartCore extends ObjectModel
$grouped_by_warehouse[$product['id_address_delivery']][$key][$id_warehouse][] = $product; $grouped_by_warehouse[$product['id_address_delivery']][$key][$id_warehouse][] = $product;
} }
unset($product);
// Step 3 : grouped product from grouped_by_warehouse by available carriers // Step 3 : grouped product from grouped_by_warehouse by available carriers
$grouped_by_carriers = array(); $grouped_by_carriers = array();
@@ -1732,7 +1753,6 @@ class CartCore extends ObjectModel
{ {
if (!isset($grouped_by_carriers[$id_address_delivery][$key][$id_warehouse])) if (!isset($grouped_by_carriers[$id_address_delivery][$key][$id_warehouse]))
$grouped_by_carriers[$id_address_delivery][$key][$id_warehouse] = array(); $grouped_by_carriers[$id_address_delivery][$key][$id_warehouse] = array();
foreach ($product_list as $product) foreach ($product_list as $product)
{ {
$package_carriers_key = implode(',', $product['carrier_list']); $package_carriers_key = implode(',', $product['carrier_list']);
@@ -1797,7 +1817,6 @@ class CartCore extends ObjectModel
); );
$package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'] = $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']); 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'] = $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']); array_merge($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['product_list'], $data['product_list']);
@@ -2273,18 +2292,23 @@ class CartCore extends ObjectModel
public function getAddressCollection() public function getAddressCollection()
{ {
$collection = array(); $collection = array();
$cache_id = 'Cart::getAddressCollection'.(int)$this->id;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance()->executeS( $result = Db::getInstance()->executeS(
'SELECT DISTINCT `id_address_delivery` 'SELECT DISTINCT `id_address_delivery`
FROM `'._DB_PREFIX_.'cart_product` FROM `'._DB_PREFIX_.'cart_product`
WHERE id_cart = '.(int)$this->id WHERE id_cart = '.(int)$this->id
); );
Cache::store($cache_id, $result);
}
$result = Cache::retrieve($cache_id);
$result[] = array('id_address_delivery' => (int)$this->id_address_delivery); $result[] = array('id_address_delivery' => (int)$this->id_address_delivery);
foreach ($result as $row) foreach ($result as $row)
if ((int)$row['id_address_delivery'] != 0) if ((int)$row['id_address_delivery'] != 0)
$collection[(int)$row['id_address_delivery']] = new Address((int)$row['id_address_delivery']); $collection[(int)$row['id_address_delivery']] = new Address((int)$row['id_address_delivery']);
return $collection; return $collection;
} }
@@ -3034,7 +3058,6 @@ class CartCore extends ObjectModel
*/ */
public function addTextFieldToProduct($id_product, $index, $type, $text_value) public function addTextFieldToProduct($id_product, $index, $type, $text_value)
{ {
$text_value = str_replace(array("\n", "\r"), '', nl2br($text_value));
if (!_PS_MAGIC_QUOTES_GPC_){ if (!_PS_MAGIC_QUOTES_GPC_){
$text_value = str_replace('\\', '\\\\', $text_value); $text_value = str_replace('\\', '\\\\', $text_value);
$text_value = str_replace('\'', '\\\'', $text_value); $text_value = str_replace('\'', '\\\'', $text_value);
@@ -3215,7 +3238,7 @@ class CartCore extends ObjectModel
public function getWsCartRows() public function getWsCartRows()
{ {
return Db::getInstance()->executeS(' return Db::getInstance()->executeS('
SELECT id_product, id_product_attribute, quantity SELECT id_product, id_product_attribute, quantity, id_address_delivery
FROM `'._DB_PREFIX_.'cart_product` FROM `'._DB_PREFIX_.'cart_product`
WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id
); );
@@ -3463,9 +3486,13 @@ class CartCore extends ObjectModel
WHERE `id_cart` = '.(int)$this->id.' 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); $cache_id = 'Cart::setNoMultishipping'.(int)$this->id.'-'.(int)$this->id_shop;
if ($result) if (!Cache::isStored($cache_id))
{
if ($result = (bool)Db::getInstance()->execute($sql))
$emptyCache = true; $emptyCache = true;
Cache::store($cache_id, $result);
}
if (Customization::isFeatureActive()) if (Customization::isFeatureActive())
Db::getInstance()->execute(' Db::getInstance()->execute('
+11
View File
@@ -254,6 +254,17 @@ class CartRuleCore extends ObjectModel
} }
else else
$cart_rule['quantity_for_user'] = 0; $cart_rule['quantity_for_user'] = 0;
unset($cart_rule);
foreach ($result as $cart_rule)
if ($cart_rule['shop_restriction'])
{
$cartRuleShops = Db::getInstance()->executeS('SELECT id_shop FROM '._DB_PREFIX_.'cart_rule_shop WHERE id_cart_rule = '.(int)$cart_rule['id_cart_rule']);
foreach ($cartRuleShops as $cartRuleShop)
if (Shop::isFeatureActive() && ($cartRuleShop['id_shop'] == Context::getContext()->shop->id))
continue 2;
unset($result[$key]);
}
// Retrocompatibility with 1.4 discounts // Retrocompatibility with 1.4 discounts
foreach ($result as &$cart_rule) foreach ($result as &$cart_rule)
+50 -24
View File
@@ -107,8 +107,8 @@ class CategoryCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields // Lang fields
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', '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' => 64), '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'), 'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128), '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_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
@@ -666,9 +666,9 @@ class CategoryCore extends ObjectModel
* @param boolean $active return only active categories * @param boolean $active return only active categories
* @return array categories * @return array categories
*/ */
public static function getHomeCategories($id_lang, $active = true) public static function getHomeCategories($id_lang, $active = true, $id_shop = false)
{ {
return self::getChildren(Configuration::get('PS_HOME_CATEGORY'), $id_lang, $active); return self::getChildren(Configuration::get('PS_HOME_CATEGORY'), $id_lang, $active, $id_shop);
} }
public static function getRootCategory($id_lang = null, Shop $shop = null) public static function getRootCategory($id_lang = null, Shop $shop = null)
@@ -704,6 +704,9 @@ class CategoryCore extends ObjectModel
if (!Validate::isBool($active)) if (!Validate::isBool($active))
die(Tools::displayError()); die(Tools::displayError());
$cache_id = 'Category::getChildren_'.(int)$id_parent.'-'.(int)$id_lang.'-'.(bool)$active.'-'.(int)$id_shop;
if (!Cache::isStored($cache_id))
{
$query = 'SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, category_shop.`id_shop` $query = 'SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, category_shop.`id_shop`
FROM `'._DB_PREFIX_.'category` c FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').') LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
@@ -713,7 +716,10 @@ class CategoryCore extends ObjectModel
'.($active ? 'AND `active` = 1' : '').' '.($active ? 'AND `active` = 1' : '').'
GROUP BY c.`id_category` GROUP BY c.`id_category`
ORDER BY category_shop.`position` ASC'; ORDER BY category_shop.`position` ASC';
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
@@ -1008,14 +1014,20 @@ class CategoryCore extends ObjectModel
public function getGroups() public function getGroups()
{ {
$groups = array(); $groups = array();
$cache_id = 'Category::getGroups_'.(int)$this->id;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance()->executeS(' $result = Db::getInstance()->executeS('
SELECT cg.`id_group` SELECT cg.`id_group`
FROM '._DB_PREFIX_.'category_group cg FROM '._DB_PREFIX_.'category_group cg
WHERE cg.`id_category` = '.(int)$this->id WHERE cg.`id_category` = '.(int)$this->id
); );
$groups = array();
foreach ($result as $group) foreach ($result as $group)
$groups[] = $group['id_group']; $groups[] = $group['id_group'];
return $groups; Cache::store($cache_id, $groups);
}
return Cache::retrieve($cache_id);
} }
public function addGroupsIfNoExist($id_group) public function addGroupsIfNoExist($id_group)
@@ -1036,24 +1048,23 @@ class CategoryCore extends ObjectModel
*/ */
public function checkAccess($id_customer) public function checkAccess($id_customer)
{ {
if (!$id_customer) $cache_id = 'Category::checkAccess_'.(int)$this->id.'-'.$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : '');
if (!Cache::isStored($cache_id))
{ {
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' if (!$id_customer)
$result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT ctg.`id_group` SELECT ctg.`id_group`
FROM '._DB_PREFIX_.'category_group ctg FROM '._DB_PREFIX_.'category_group ctg
WHERE ctg.`id_category` = '.(int)$this->id.' AND ctg.`id_group` = '.(int)Group::getCurrent()->id.' WHERE ctg.`id_category` = '.(int)$this->id.' AND ctg.`id_group` = '.(int)Group::getCurrent()->id);
'); else
} else { $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT ctg.`id_group` SELECT ctg.`id_group`
FROM '._DB_PREFIX_.'category_group ctg FROM '._DB_PREFIX_.'category_group ctg
INNER JOIN '._DB_PREFIX_.'customer_group cg on (cg.`id_group` = ctg.`id_group` AND cg.`id_customer` = '.(int)$id_customer.') INNER JOIN '._DB_PREFIX_.'customer_group cg on (cg.`id_group` = ctg.`id_group` AND cg.`id_customer` = '.(int)$id_customer.')
WHERE ctg.`id_category` = '.(int)$this->id WHERE ctg.`id_category` = '.(int)$this->id);
); Cache::store($cache_id, $result);
} }
if ($result && isset($result['id_group']) && $result['id_group']) return Cache::retrieve($cache_id);
return true;
return false;
} }
/** /**
@@ -1198,13 +1209,17 @@ class CategoryCore extends ObjectModel
* @return array * @return array
*/ */
public static function getInterval($id) public static function getInterval($id)
{
$cache_id = 'Category::getInterval_'.(int)$id;
if (!Cache::isStored($cache_id))
{ {
$sql = 'SELECT nleft, nright, level_depth $sql = 'SELECT nleft, nright, level_depth
FROM '._DB_PREFIX_.'category FROM '._DB_PREFIX_.'category
WHERE id_category = '.(int)$id; WHERE id_category = '.(int)$id;
if (!$result = Db::getInstance()->getRow($sql)) $result = Db::getInstance()->getRow($sql);
return false; Cache::store($cache_id, $result);
return $result; }
return Cache::retrieve($cache_id);
} }
/** /**
@@ -1386,11 +1401,17 @@ class CategoryCore extends ObjectModel
public static function getCategoriesWithoutParent() public static function getCategoriesWithoutParent()
{ {
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' $cache_id = 'Category::getCategoriesWithoutParent_'.(int)Context::getContext()->language->id;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT DISTINCT c.* SELECT DISTINCT c.*
FROM `'._DB_PREFIX_.'category` c FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)Context::getContext()->language->id.') LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)Context::getContext()->language->id.')
WHERE `level_depth` = 1'); WHERE `level_depth` = 1');
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
public function isRootCategoryForAShop() public function isRootCategoryForAShop()
@@ -1409,12 +1430,17 @@ class CategoryCore extends ObjectModel
public static function getTopCategory($id_lang = null) public static function getTopCategory($id_lang = null)
{ {
if (is_null($id_lang)) if (is_null($id_lang))
$id_lang = Context::getContext()->language->id; $id_lang = (int)Context::getContext()->language->id;
$id_category = Db::getInstance()->getValue(' $cache_id = 'Category::getTopCategory_'.(int)$id_lang;
if (!Cache::isStored($cache_id))
{
$id_category = (int)Db::getInstance()->getValue('
SELECT `id_category` SELECT `id_category`
FROM `'._DB_PREFIX_.'category` FROM `'._DB_PREFIX_.'category`
WHERE `id_parent` = 0'); WHERE `id_parent` = 0');
return new Category($id_category, $id_lang); Cache::store($cache_id, new Category($id_category, $id_lang));
}
return Cache::retrieve($cache_id);
} }
public function addPosition($position, $id_shop = null) public function addPosition($position, $id_shop = null)
+22 -6
View File
@@ -73,7 +73,7 @@ class CurrencyCore extends ObjectModel
'sign' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 8), 'sign' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 8),
'format' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'format' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'decimals' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'decimals' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'conversion_rate' =>array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true, 'shop' => true), 'conversion_rate' =>array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat', 'required' => true, 'shop' => true),
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
), ),
@@ -107,14 +107,23 @@ class CurrencyCore extends ObjectModel
$this->suffix = $this->format % 2 == 0 ? ' '.$this->sign : ''; $this->suffix = $this->format % 2 == 0 ? ' '.$this->sign : '';
} }
/** /**
* Overriding check if currency with the same iso code already exists. * Overriding check if currency rate is not empty and if currency with the same iso code already exists.
* If it's true, currency is doesn't added. * If it's true, currency is not added.
* *
* @see ObjectModelCore::add() * @see ObjectModelCore::add()
*/ */
public function add($autodate = true, $nullValues = false) public function add($autodate = true, $nullValues = false)
{ {
return Currency::exists($this->iso_code, $this->iso_code_num) ? false : parent::add(); if ((float)$this->conversion_rate <= 0)
return false;
return Currency::exists($this->iso_code, $this->iso_code_num) ? false : parent::add($autodate, $nullValues);
}
public function update($autodate = true, $nullValues = false)
{
if ((float)$this->conversion_rate <= 0)
return false;
return parent::update($autodate, $nullValues);
} }
/** /**
@@ -188,8 +197,9 @@ class CurrencyCore extends ObjectModel
4 => array('left' => '', 'right' => &$formated_strings['right']), 4 => array('left' => '', 'right' => &$formated_strings['right']),
5 => array('left' => '', 'right' => &$formated_strings['right']) 5 => array('left' => '', 'right' => &$formated_strings['right'])
); );
if (isset($formats[$this->format][$side]))
return ($formats[$this->format][$side]); return ($formats[$this->format][$side]);
return $this->sign;
} }
/** /**
@@ -285,11 +295,17 @@ class CurrencyCore extends ObjectModel
* @return int * @return int
*/ */
public static function getIdByIsoCode($iso_code, $id_shop = 0) public static function getIdByIsoCode($iso_code, $id_shop = 0)
{
$cache_id = 'Currency::getIdByIsoCode_'.pSQL($iso_code).'-'.(int)$id_shop;
if (!Cache::isStored($cache_id))
{ {
$query = Currency::getIdByQuery($id_shop); $query = Currency::getIdByQuery($id_shop);
$query->where('iso_code = \''.pSQL($iso_code).'\''); $query->where('iso_code = \''.pSQL($iso_code).'\'');
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query->build()); $result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query->build());
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
+35 -14
View File
@@ -362,15 +362,18 @@ class CustomerCore extends ObjectModel
{ {
if (!Validate::isUnsignedId($id_customer)) if (!Validate::isUnsignedId($id_customer))
return true; return true;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $cache_id = 'Customer::isBanned_'.(int)$id_customer;
if (!Cache::isStored($cache_id))
{
$result = (bool)!Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `id_customer` SELECT `id_customer`
FROM `'._DB_PREFIX_.'customer` FROM `'._DB_PREFIX_.'customer`
WHERE `id_customer` = \''.(int)$id_customer.'\' WHERE `id_customer` = \''.(int)$id_customer.'\'
AND active = 1 AND active = 1
AND `deleted` = 0'); AND `deleted` = 0');
if (isset($result['id_customer'])) Cache::store($cache_id, $result);
return false; }
return true; return Cache::retrieve($cache_id);
} }
/** /**
@@ -413,7 +416,7 @@ class CustomerCore extends ObjectModel
public static function customerHasAddress($id_customer, $id_address) public static function customerHasAddress($id_customer, $id_address)
{ {
$key = (int)$id_customer.'-'.(int)$id_address; $key = (int)$id_customer.'-'.(int)$id_address;
if (!array_key_exists($id_address, self::$_customerHasAddress)) if (!array_key_exists($key, self::$_customerHasAddress))
{ {
self::$_customerHasAddress[$key] = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' self::$_customerHasAddress[$key] = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_address` SELECT `id_address`
@@ -438,16 +441,23 @@ class CustomerCore extends ObjectModel
* @return array Addresses * @return array Addresses
*/ */
public function getAddresses($id_lang) public function getAddresses($id_lang)
{
$share_order = (bool)Context::getContext()->shop->getGroup()->share_order;
$cache_id = 'Customer::getAddresses'.(int)$this->id.'-'.(int)$id_lang.'-'.$share_order;
if (!Cache::isStored($cache_id))
{ {
$sql = 'SELECT DISTINCT a.*, cl.`name` AS country, s.name AS state, s.iso_code AS state_iso $sql = 'SELECT DISTINCT a.*, cl.`name` AS country, s.name AS state, s.iso_code AS state_iso
FROM `'._DB_PREFIX_.'address` a FROM `'._DB_PREFIX_.'address` a
LEFT JOIN `'._DB_PREFIX_.'country` c ON (a.`id_country` = c.`id_country`) LEFT JOIN `'._DB_PREFIX_.'country` c ON (a.`id_country` = c.`id_country`)
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`) LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`)
LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = a.`id_state`) LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = a.`id_state`)
'.(Context::getContext()->shop->getGroup()->share_order ? '' : Shop::addSqlAssociation('country', 'c')).' '.($share_order ? '' : Shop::addSqlAssociation('country', 'c')).'
WHERE `id_lang` = '.(int)$id_lang.' AND `id_customer` = '.(int)$this->id.' AND a.`deleted` = 0'; WHERE `id_lang` = '.(int)$id_lang.' AND `id_customer` = '.(int)$this->id.' AND a.`deleted` = 0';
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
@@ -476,12 +486,17 @@ class CustomerCore extends ObjectModel
{ {
if (!Validate::isUnsignedId($id_customer) || !Validate::isMd5($passwd)) if (!Validate::isUnsignedId($id_customer) || !Validate::isMd5($passwd))
die (Tools::displayError()); die (Tools::displayError());
$cache_id = 'Customer::checkPassword'.(int)$id_customer.'-'.$passwd;
if (!Cache::isStored($cache_id))
{
$sql = 'SELECT `id_customer` $sql = 'SELECT `id_customer`
FROM `'._DB_PREFIX_.'customer` FROM `'._DB_PREFIX_.'customer`
WHERE `id_customer` = '.$id_customer.' WHERE `id_customer` = '.$id_customer.'
AND `passwd` = \''.$passwd.'\''; AND `passwd` = \''.$passwd.'\'';
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
@@ -574,12 +589,16 @@ class CustomerCore extends ObjectModel
public static function customerIdExistsStatic($id_customer) public static function customerIdExistsStatic($id_customer)
{ {
$row = Db::getInstance()->getRow(' $cache_id = 'Customer::customerIdExistsStatic'.(int)$id_customer;
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('
SELECT `id_customer` SELECT `id_customer`
FROM '._DB_PREFIX_.'customer c FROM '._DB_PREFIX_.'customer c
WHERE c.`id_customer` = '.(int)$id_customer); WHERE c.`id_customer` = '.(int)$id_customer);
Cache::store($cache_id, $result);
return isset($row['id_customer']); }
return Cache::retrieve($cache_id);
} }
/** /**
@@ -589,9 +608,11 @@ class CustomerCore extends ObjectModel
*/ */
public function updateGroup($list) public function updateGroup($list)
{ {
$this->cleanGroups();
if ($list && !empty($list)) if ($list && !empty($list))
{
$this->cleanGroups();
$this->addGroups($list); $this->addGroups($list);
}
else else
$this->addGroups(array($this->id_default_group)); $this->addGroups(array($this->id_default_group));
} }
@@ -606,7 +627,7 @@ class CustomerCore extends ObjectModel
foreach ($groups as $group) foreach ($groups as $group)
{ {
$row = array('id_customer' => (int)$this->id, 'id_group' => (int)$group); $row = array('id_customer' => (int)$this->id, 'id_group' => (int)$group);
Db::getInstance()->insert('customer_group', $row); Db::getInstance()->insert('customer_group', $row, false, true, Db::INSERT_IGNORE);
} }
} }
+1 -1
View File
@@ -46,7 +46,7 @@ class CustomerMessageCore extends ObjectModel
'fields' => array( 'fields' => array(
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_customer_thread' => array('type' => self::TYPE_INT), 'id_customer_thread' => array('type' => self::TYPE_INT),
'ip_address' => array('type' => self::TYPE_INT, 'validate' => 'isIp2Long'), 'ip_address' => array('type' => self::TYPE_STRING, 'validate' => 'isIp2Long', 'size' => 15),
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000), 'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000),
'file_name' => array('type' => self::TYPE_STRING), 'file_name' => array('type' => self::TYPE_STRING),
'user_agent' => array('type' => self::TYPE_STRING), 'user_agent' => array('type' => self::TYPE_STRING),
+1 -1
View File
@@ -369,7 +369,7 @@ class DispatcherCore
// If there are several languages, get language from uri // If there are several languages, get language from uri
if ($this->use_routes && Language::isMultiLanguageActivated()) 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]; $_GET['isolang'] = $m[1];
$this->request_uri = substr($this->request_uri, 3); $this->request_uri = substr($this->request_uri, 3);
+31 -10
View File
@@ -312,16 +312,37 @@ class FeatureCore extends ObjectModel
*/ */
public static function cleanPositions() public static function cleanPositions()
{ {
return Db::getInstance()->execute(' //Reordering positions to remove "holes" in them (after delete for instance)
UPDATE `'._DB_PREFIX_.'feature` f $sql = "SELECT id_feature, position FROM "._DB_PREFIX_."feature ORDER BY id_feature";
LEFT JOIN ( $db = Db::getInstance();
SELECT @i := @i +1 AS rank, id_feature, position $r = $db->executeS($sql, false);
FROM `'._DB_PREFIX_.'feature` $shiftTable = array(); //List of update queries (one query is necessary for each "hole" in the table)
JOIN (SELECT @i :=1) dummy $currentDelta = 0;
ORDER by position $minId = 0;
) AS f2 $maxId = 0;
USING (id_feature) $futurePosition = 1;
SET f.position = f2.rank - 1'); while ($line = $db->nextRow($r)) {
$delta = $futurePosition - $line['position']; //Difference between current position and future position
if ($delta != $currentDelta) {
$shiftTable[] = array('minId' => $minId, 'maxId' => $maxId, 'delta' => $currentDelta);
$currentDelta = $delta;
$minId = $line['id_feature'];
}
$maxId = $line['id_feature'];
$futurePosition++;
}
$shiftTable[] = array('minId' => $minId, 'maxId' => $maxId, 'delta' => $currentDelta);
//Executing generated queries
foreach ($shiftTable as $line) {
$delta = $line['delta'];
if ($delta == 0) continue;
$delta = $delta > 0 ? '+' . (int)$delta : (int)$delta;
$minId = (int)$line['minId'];
$maxId = (int)$line['maxId'];
$sql = "UPDATE "._DB_PREFIX_."feature SET position = position $delta WHERE id_feature >= $minId AND id_feature <= $maxId";
Db::getInstance()->execute($sql);
}
} }
/** /**
+33 -17
View File
@@ -128,35 +128,51 @@ class FeatureValueCore extends ObjectModel
return $tab['value']; return $tab['value'];
} }
public static function addFeatureValueImport($id_feature, $name) public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null, $custom = false)
{ {
$rq = Db::getInstance()->executeS(' $id_feature_value = false;
if (!is_null($id_product) && $id_product)
{
$id_feature_value = Db::getInstance()->getValue('
SELECT fp.`id_feature_value`
FROM '._DB_PREFIX_.'feature_product fp
INNER JOIN '._DB_PREFIX_.'feature_value fv USING (`id_feature_value`)
WHERE fp.`id_feature` = '.(int)$id_feature.'
AND fv.`custom` = '.(int)$custom.'
AND fp.`id_product` = '.(int)$id_product);
if ($custom && $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 `value` != \''.pSQL($value).'\'
AND `id_lang` = '.(int)$id_lang);
}
if (!$custom)
$id_feature_value = Db::getInstance()->getValue('
SELECT fv.`id_feature_value` SELECT fv.`id_feature_value`
FROM '._DB_PREFIX_.'feature_value fv FROM '._DB_PREFIX_.'feature_value fv
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value` AND fvl.`id_lang` = '.(int)$id_lang.')
ON (fvl.`id_feature_value` = fv.`id_feature_value`) WHERE `value` = \''.pSQL($value).'\'
WHERE `value` = \''.pSQL($name).'\'
AND fv.`id_feature` = '.(int)$id_feature.' AND fv.`id_feature` = '.(int)$id_feature.'
GROUP BY fv.`id_feature_value` LIMIT 1 AND fv.`custom` = 0
'); GROUP BY fv.`id_feature_value`');
if ($id_feature_value)
return (int)$id_feature_value;
if (!isset($rq[0]['id_feature_value']) || !$id_feature_value = (int)$rq[0]['id_feature_value'])
{
// Feature doesn't exist, create it // Feature doesn't exist, create it
$feature_value = new FeatureValue(); $feature_value = new FeatureValue();
$languages = Language::getLanguages();
foreach ($languages as $language)
$feature_value->value[$language['id_lang']] = strval($name);
$feature_value->id_feature = (int)$id_feature; $feature_value->id_feature = (int)$id_feature;
$feature_value->custom = 1; $feature_value->custom = (bool)$custom;
foreach (Language::getLanguages() as $language)
$feature_value->value[$language['id_lang']] = $value;
$feature_value->add(); $feature_value->add();
return (int)$feature_value->id; return (int)$feature_value->id;
} }
return (int)$id_feature_value;
}
public function add($autodate = true, $nullValues = false) public function add($autodate = true, $nullValues = false)
{ {
+16 -2
View File
@@ -102,6 +102,13 @@ class QqUploadedFileForm
$image = new Image(); $image = new Image();
$image->id_product = (int)$product->id; $image->id_product = (int)$product->id;
$image->position = Image::getHighestPosition($product->id) + 1; $image->position = Image::getHighestPosition($product->id) + 1;
$legends = Tools::getValue('legend');
if (is_array($legends))
foreach ($legends as $key => $legend)
if (!empty($legend) && Validate::isGenericName($legend))
$image->legend[(int)$key] = $legend;
else
return array('error' => sprintf(Tools::displayError('Error on image legend "%1s." is not a valid legend.'), Tools::safeOutput($legend)));
if (!Image::getCover($image->id_product)) if (!Image::getCover($image->id_product))
$image->cover = 1; $image->cover = 1;
else else
@@ -136,7 +143,7 @@ class QqUploadedFileForm
if (!$image->update()) if (!$image->update())
return array('error' => Tools::displayError('Error while updating status')); return array('error' => Tools::displayError('Error while updating status'));
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName()); $img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName(), 'legend' => $image->legend);
return array('success' => $img); return array('success' => $img);
} }
@@ -184,6 +191,13 @@ class QqUploadedFileXhr
$image = new Image(); $image = new Image();
$image->id_product = (int)($product->id); $image->id_product = (int)($product->id);
$image->position = Image::getHighestPosition($product->id) + 1; $image->position = Image::getHighestPosition($product->id) + 1;
$legends = Tools::getValue('legend');
if (is_array($legends))
foreach ($legends as $key => $legend)
if (!empty($legend) && Validate::isGenericName($legend))
$image->legend[(int)$key] = $legend;
else
return array('error' => sprintf(Tools::displayError('Error on image legend "%1s." is not a valid legend.'), Tools::safeOutput($legend)));
if (!Image::getCover($image->id_product)) if (!Image::getCover($image->id_product))
$image->cover = 1; $image->cover = 1;
else else
@@ -223,7 +237,7 @@ class QqUploadedFileXhr
if (!$image->update()) if (!$image->update())
return array('error' => Tools::displayError('Error while updating status')); return array('error' => Tools::displayError('Error while updating status'));
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName()); $img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName(), 'legend' => $image->legend);
return array('success' => $img); return array('success' => $img);
} }
+28 -2
View File
@@ -305,17 +305,43 @@ class GroupCore extends ObjectModel
public static function getCurrent() public static function getCurrent()
{ {
static $groups = array(); static $groups = array();
$customer = Context::getContext()->customer; $customer = Context::getContext()->customer;
if (Validate::isLoadedObject($customer)) if (Validate::isLoadedObject($customer))
{
$id_group = (int)$customer->id_default_group; $id_group = (int)$customer->id_default_group;
$group = new Group((int)$id_group);
if (!$group->isAssociatedToShop(Context::getContext()->shop->id))
$group = new Group((int)Configuration::get('PS_CUSTOMER_GROUP'));
}
else else
$id_group = (int)Configuration::get('PS_UNIDENTIFIED_GROUP'); $id_group = (int)Configuration::get('PS_UNIDENTIFIED_GROUP');
if (!isset($groups[$id_group]) && isset($group))
$groups[$id_group] = $group;
if (!isset($groups[$id_group])) if (!isset($groups[$id_group]))
$groups[$id_group] = new Group($id_group); $groups[$id_group] = new Group($id_group);
return $groups[$id_group]; return $groups[$id_group];
} }
/**
* Light back office search for Group
*
* @param integer $id_lang Language ID
* @param string $query Searched string
* @param boolean $unrestricted allows search without lang and includes first group and exact match
* @return array Corresponding groupes
*/
public static function searchByName($query)
{
return Db::getInstance()->getRow('
SELECT g.*, gl.*
FROM `'._DB_PREFIX_.'group` g
LEFT JOIN `'._DB_PREFIX_.'group_lang` gl
ON (g.`id_group` = gl.`id_group`)
WHERE `name` LIKE \''.pSQL($query).'\'
');
}
} }
+1
View File
@@ -137,6 +137,7 @@ class GroupReductionCore extends ObjectModel
SELECT `reduction` SELECT `reduction`
FROM `'._DB_PREFIX_.'product_group_reduction_cache` FROM `'._DB_PREFIX_.'product_group_reduction_cache`
WHERE `id_product` = '.(int)$id_product.' AND `id_group` = '.(int)$id_group); 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]; return self::$reduction_cache[$id_product.'-'.$id_group];
} }
+17 -1
View File
@@ -56,6 +56,8 @@ class HookCore extends ObjectModel
*/ */
public static $executed_hooks = array(); public static $executed_hooks = array();
public static $native_module;
/** /**
* @see ObjectModel::$definition * @see ObjectModel::$definition
*/ */
@@ -316,7 +318,7 @@ class HookCore extends ObjectModel
if (Validate::isLoadedObject($context->country)) if (Validate::isLoadedObject($context->country))
$sql->where('(h.name = "displayPayment" AND (SELECT id_country FROM '._DB_PREFIX_.'module_country mc WHERE mc.id_module = m.id_module AND id_country = '.(int)$context->country->id.' AND id_shop = '.(int)$context->shop->id.' LIMIT 1) = '.(int)$context->country->id.')'); $sql->where('(h.name = "displayPayment" AND (SELECT id_country FROM '._DB_PREFIX_.'module_country mc WHERE mc.id_module = m.id_module AND id_country = '.(int)$context->country->id.' AND id_shop = '.(int)$context->shop->id.' LIMIT 1) = '.(int)$context->country->id.')');
if (Validate::isLoadedObject($context->currency)) if (Validate::isLoadedObject($context->currency))
$sql->where('(h.name = "displayPayment" AND (SELECT id_currency FROM '._DB_PREFIX_.'module_currency mcr WHERE mcr.id_module = m.id_module AND id_currency IN ('.(int)$context->currency->id.', -2) LIMIT 1) IN ('.(int)$context->currency->id.', -2))'); $sql->where('(h.name = "displayPayment" AND (SELECT id_currency FROM '._DB_PREFIX_.'module_currency mcr WHERE mcr.id_module = m.id_module AND id_currency IN ('.(int)$context->currency->id.', -1, -2) LIMIT 1) IN ('.(int)$context->currency->id.', -1, -2))');
} }
if (Validate::isLoadedObject($context->shop)) if (Validate::isLoadedObject($context->shop))
$sql->where('hm.id_shop = '.(int)$context->shop->id); $sql->where('hm.id_shop = '.(int)$context->shop->id);
@@ -324,6 +326,9 @@ class HookCore extends ObjectModel
if ($frontend) if ($frontend)
{ {
$sql->leftJoin('module_group', 'mg', 'mg.`id_module` = m.`id_module`'); $sql->leftJoin('module_group', 'mg', 'mg.`id_module` = m.`id_module`');
if (Validate::isLoadedObject($context->shop))
$sql->where('mg.id_shop = '.((int)$context->shop->id).' AND mg.`id_group` IN ('.implode(', ', $groups).')');
else
$sql->where('mg.`id_group` IN ('.implode(', ', $groups).')'); $sql->where('mg.`id_group` IN ('.implode(', ', $groups).')');
$sql->groupBy('hm.id_hook, hm.id_module'); $sql->groupBy('hm.id_hook, hm.id_module');
} }
@@ -388,6 +393,10 @@ class HookCore extends ObjectModel
*/ */
public static function exec($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true) public static function exec($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true)
{ {
static $disable_non_native_modules = null;
if ($disable_non_native_modules === null)
$disable_non_native_modules = (bool)Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
// Check arguments validity // Check arguments validity
if (($id_module && !is_numeric($id_module)) || !Validate::isHookName($hook_name)) if (($id_module && !is_numeric($id_module)) || !Validate::isHookName($hook_name))
throw new PrestaShopException('Invalid id_module or hook_name'); throw new PrestaShopException('Invalid id_module or hook_name');
@@ -417,11 +426,18 @@ class HookCore extends ObjectModel
$altern = 0; $altern = 0;
$output = ''; $output = '';
if ($disable_non_native_modules && !isset(Hook::$native_module))
Hook::$native_module = Module::getNativeModuleList();
foreach ($module_list as $array) foreach ($module_list as $array)
{ {
// Check errors // Check errors
if ($id_module && $id_module != $array['id_module']) if ($id_module && $id_module != $array['id_module'])
continue; continue;
if ((bool)$disable_non_native_modules && Hook::$native_module && count(Hook::$native_module) && !in_array($array['module'], self::$native_module))
continue;
if (!($moduleInstance = Module::getInstanceByName($array['module']))) if (!($moduleInstance = Module::getInstanceByName($array['module'])))
continue; continue;
+4
View File
@@ -40,6 +40,9 @@ class ImageCore extends ObjectModel
/** @var boolean Image is cover */ /** @var boolean Image is cover */
public $cover; public $cover;
/** @var string Legend */
public $legend;
/** @var string image extension */ /** @var string image extension */
public $image_format = 'jpg'; public $image_format = 'jpg';
@@ -66,6 +69,7 @@ class ImageCore extends ObjectModel
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'shop' => true), 'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'shop' => true),
'legend' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
), ),
); );
+9 -5
View File
@@ -127,16 +127,20 @@ class ImageTypeCore extends ObjectModel
* @param string $name * @param string $name
* @param string $type * @param string $type
*/ */
public static function getByNameNType($name, $type = null) public static function getByNameNType($name, $type = null, $order = null)
{ {
if (!isset(self::$images_types_name_cache[$name.'_'.$type])) if (!isset(self::$images_types_name_cache[$name.'_'.$type.'_'.$order]))
{ {
self::$images_types_name_cache[$name.'_'.$type] = Db::getInstance()->getRow(' self::$images_types_name_cache[$name.'_'.$type.'_'.$order] = Db::getInstance()->getRow('
SELECT `id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes` SELECT `id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`
FROM `'._DB_PREFIX_.'image_type` FROM `'._DB_PREFIX_.'image_type`
WHERE `name` = \''.pSQL($name).'\' '.(!is_null($type) ? 'AND `'.pSQL($type).'` = 1' : '')); WHERE
`name` LIKE \''.pSQL($name).'\''
.(!is_null($type) ? ' AND `'.pSQL($type).'` = 1' : '')
.(!is_null($order) ? ' ORDER BY `'.bqSQL($order).'` ASC' : '')
);
} }
return self::$images_types_name_cache[$name.'_'.$type]; return self::$images_types_name_cache[$name.'_'.$type.'_'.$order];
} }
public static function getFormatedName($name) public static function getFormatedName($name)
+41 -10
View File
@@ -619,6 +619,35 @@ class LanguageCore extends ObjectModel
return Db::getInstance()->getValue('SELECT `language_code` FROM `'._DB_PREFIX_.'lang` WHERE `iso_code` = \''.pSQL(strtolower($iso_code)).'\''); return Db::getInstance()->getValue('SELECT `language_code` FROM `'._DB_PREFIX_.'lang` WHERE `iso_code` = \''.pSQL(strtolower($iso_code)).'\'');
} }
public static function getLanguageByIETFCode($code)
{
if (!Validate::isLanguageCode($code))
die(sprintf(Tools::displayError('Fatal error: IETF code %s is not correct'), $code));
// $code is in the form of 'xx-YY' where xx is the language code
// and 'YY' a country code identifying a variant of the language.
$lang_country = explode('-', $code);
// Get the language component of the code
$lang = $lang_country[0];
// Find the id_lang of the language.
// We look for anything with the correct language code
// and sort on equality with the exact IETF code wanted.
// That way using only one query we get either the exact wanted language
// or a close match.
$id_lang = Db::getInstance()->getValue(
'SELECT `id_lang` FROM '
.'`'._DB_PREFIX_.'lang` WHERE LEFT(`language_code`,2) = \''.pSQL($lang).'\' '
.'ORDER BY language_code = \''.pSQL($code).'\' DESC'
);
// Instantiate the Language object if we found it.
if ($id_lang)
return new Language($id_lang);
else
return false;
}
/** /**
* Return array (id_lang, iso_code) * Return array (id_lang, iso_code)
* *
@@ -688,25 +717,27 @@ class LanguageCore extends ObjectModel
if (Language::getIdByIso($iso_code)) if (Language::getIdByIso($iso_code))
return true; return true;
// Initialize the language
$lang = new Language(); $lang = new Language();
$lang->iso_code = $iso_code; $lang->iso_code = $iso_code;
$lang->language_code = $iso_code;
$lang->active = true; $lang->active = true;
// If the language pack has not been provided, retrieve it from prestashop.com
if (!$lang_pack) 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)); $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 ($lang_pack)
{ foreach (get_object_vars($lang_pack) as $key => $value)
if (isset($lang_pack->name) if ($key != 'iso_code' && isset(Language::$definition['fields'][$key]))
&& isset($lang_pack->version) $lang->$key = $value;
&& isset($lang_pack->iso_code))
$lang->name = $lang_pack->name; // Use the values given in parameters to override the data retrieved automatically
} if ($params_lang !== null && is_array($params_lang))
elseif ($params_lang !== null && is_array($params_lang)) foreach ($params_lang as $key => $value)
foreach ($params_lang as $key => $value) if ($key != 'iso_code' && isset(Language::$definition['fields'][$key]))
$lang->$key = $value; $lang->$key = $value;
else
return false;
if (!$lang->add(true, false, $only_add)) if (!$lang->add(true, false, $only_add))
return false; return false;
+9
View File
@@ -423,6 +423,15 @@ class LinkCore
*/ */
public function getPageLink($controller, $ssl = null, $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)
{ {
//If $controller contains '&' char, it means that $controller contains request data and must be parsed first
$p = strpos($controller, '&');
if ($p !== false) {
$request = substr($controller, $p + 1);
$request_url_encode = false;
$controller = substr($controller, 0, $p);
}
$controller = Tools::strReplaceFirst('.php', '', $controller); $controller = Tools::strReplaceFirst('.php', '', $controller);
if (!$id_lang) if (!$id_lang)
$id_lang = (int)Context::getContext()->language->id; $id_lang = (int)Context::getContext()->language->id;
+1
View File
@@ -63,6 +63,7 @@ class LocalizationPackCore
if ($install_mode && $res && isset($this->iso_currency)) if ($install_mode && $res && isset($this->iso_currency))
{ {
Cache::clean('Currency::getIdByIsoCode_*');
$res &= Configuration::updateValue('PS_CURRENCY_DEFAULT', (int)Currency::getIdByIsoCode($this->iso_currency)); $res &= Configuration::updateValue('PS_CURRENCY_DEFAULT', (int)Currency::getIdByIsoCode($this->iso_currency));
Currency::refreshCurrencies(); Currency::refreshCurrencies();
} }
+1 -1
View File
@@ -62,7 +62,7 @@ class LoggerCore extends ObjectModel
'fields' => array( 'fields' => array(
'severity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true), 'severity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'error_code' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'error_code' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true), 'message' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
'object_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'object_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'object_type' => array('type' => self::TYPE_STRING, 'validate' => 'isName'), 'object_type' => array('type' => self::TYPE_STRING, 'validate' => 'isName'),
+28 -13
View File
@@ -133,36 +133,46 @@ class MailCore
{ {
foreach ($to as $key => $addr) foreach ($to as $key => $addr)
{ {
$to_name = null;
$addr = trim($addr); $addr = trim($addr);
if (!Validate::isEmail($addr)) if (!Validate::isEmail($addr))
{ {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die); Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die);
return false; return false;
} }
if (is_array($to_name)) if (is_array($to_name))
{ {
if ($to_name && is_array($to_name) && Validate::isGenericName($to_name[$key])) if ($to_name && is_array($to_name) && Validate::isGenericName($to_name[$key]))
$to_name = $to_name[$key]; $to_name = $to_name[$key];
} }
if ($to_name == null)
$to_name = $addr; if ($to_name == null || $to_name == $addr)
/* Encode accentuated chars */ $to_name = '';
if (function_exists('mb_encode_mimeheader'))
$to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8'));
else else
$to_list->addTo($addr, self::mimeEncode($to_name)); {
if (function_exists('mb_encode_mimeheader'))
$to_name = mb_encode_mimeheader($to_name, 'utf-8');
else
$to_name = self::mimeEncode($to_name);
}
$to_list->addTo($addr, $to_name);
} }
$to_plugin = $to[0]; $to_plugin = $to[0];
} else { } else {
/* Simple recipient, one address */ /* Simple recipient, one address */
$to_plugin = $to; $to_plugin = $to;
if ($to_name == null) if ($to_name == null || $to_name == $to)
$to_name = $to; $to_name = '';
if (function_exists('mb_encode_mimeheader'))
$to_list->addTo($to, mb_encode_mimeheader($to_name, 'utf-8'));
else else
$to_list->addTo($to, self::mimeEncode($to_name)); {
if (function_exists('mb_encode_mimeheader'))
$to_name = mb_encode_mimeheader($to_name, 'utf-8');
else
$to_name = self::mimeEncode($to_name);
}
$to_list->addTo($to, $to_name);
} }
if(isset($bcc)) { if(isset($bcc)) {
$to_list->addBcc($bcc); $to_list->addBcc($bcc);
@@ -235,8 +245,13 @@ class MailCore
include_once($template_path.$iso.'/lang.php'); include_once($template_path.$iso.'/lang.php');
else if ($module_name && file_exists($theme_path.'mails/'.$iso.'/lang.php')) else if ($module_name && file_exists($theme_path.'mails/'.$iso.'/lang.php'))
include_once($theme_path.'mails/'.$iso.'/lang.php'); include_once($theme_path.'mails/'.$iso.'/lang.php');
else else if (file_exists(_PS_MAIL_DIR_.$iso.'/lang.php'))
include_once(_PS_MAIL_DIR_.$iso.'/lang.php'); include_once(_PS_MAIL_DIR_.$iso.'/lang.php');
else
{
Tools::dieOrLog(Tools::displayError('Error - The lang file is missing for :').' '.$iso, $die);
return false;
}
/* Create mail and attach differents parts */ /* Create mail and attach differents parts */
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject); $message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject);
+1 -1
View File
@@ -109,7 +109,7 @@ class MediaCore
// If the string is too big preg_replace return an error // If the string is too big preg_replace return an error
// In this case, we don't compress the content // In this case, we don't compress the content
if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) if (function_exists('preg_last_error') && preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR)
{ {
if (_PS_MODE_DEV_) if (_PS_MODE_DEV_)
error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML'); error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML');
+12 -5
View File
@@ -85,11 +85,11 @@ class MetaCore extends ObjectModel
// Add modules controllers to list (this function is cool !) // Add modules controllers to list (this function is cool !)
foreach (glob(_PS_MODULE_DIR_.'*/controllers/front/*.php') as $file) foreach (glob(_PS_MODULE_DIR_.'*/controllers/front/*.php') as $file)
{ {
$filename = basename($file, '.php'); $filename = Tools::strtolower(basename($file, '.php'));
if ($filename == 'index') if ($filename == 'index')
continue; continue;
$module = basename(dirname(dirname(dirname($file)))); $module = Tools::strtolower(basename(dirname(dirname(dirname($file)))));
$selected_pages[$module.' - '.$filename] = 'module-'.$module.'-'.$filename; $selected_pages[$module.' - '.$filename] = 'module-'.$module.'-'.$filename;
} }
@@ -277,6 +277,10 @@ class MetaCore extends ObjectModel
FROM `'._DB_PREFIX_.'category_lang` cl FROM `'._DB_PREFIX_.'category_lang` cl
WHERE cl.`id_lang` = '.(int)$id_lang.' WHERE cl.`id_lang` = '.(int)$id_lang.'
AND cl.`id_category` = '.(int)$id_category.Shop::addSqlRestrictionOnLang('cl'); AND cl.`id_category` = '.(int)$id_category.Shop::addSqlRestrictionOnLang('cl');
$cache_id = 'Meta::getCategoryMetas'.(int)$id_category.'-'.(int)$id_lang;
if (!Cache::isStored($cache_id))
{
if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql))
{ {
if (empty($row['meta_description'])) if (empty($row['meta_description']))
@@ -291,10 +295,13 @@ class MetaCore extends ObjectModel
if (!empty($title)) if (!empty($title))
$row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); $row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');
return Meta::completeMetaTags($row, $row['name']); $result = Meta::completeMetaTags($row, $row['name']);
} }
else
return Meta::getHomeMetas($id_lang, $page_name); $result = Meta::getHomeMetas($id_lang, $page_name);
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
+34 -8
View File
@@ -191,7 +191,7 @@ abstract class ObjectModelCore
if ($id) if ($id)
{ {
// Load object from database if object id is present // Load object from database if object id is present
$cache_id = 'objectmodel_'.$this->def['classname'].'_'.(int)$id.'_'.(int)$id_shop.'_'.(int)$id_lang; $cache_id = 'objectmodel_'.$this->def['classname'].'_'.(int)$id.'_'.(int)$this->id_shop.'_'.(int)$id_lang;
if (!Cache::isStored($cache_id)) if (!Cache::isStored($cache_id))
{ {
$sql = new DbQuery(); $sql = new DbQuery();
@@ -893,7 +893,7 @@ abstract class ObjectModelCore
* @param int $id_lang * @param int $id_lang
* @return bool|string * @return bool|string
*/ */
public function validateField($field, $value, $id_lang = null) public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
{ {
$this->cacheFieldsRequiredDatabase(); $this->cacheFieldsRequiredDatabase();
$data = $this->def['fields'][$field]; $data = $this->def['fields'][$field];
@@ -901,8 +901,11 @@ abstract class ObjectModelCore
// Check if field is required // Check if field is required
$required_fields = (isset(self::$fieldsRequiredDatabase[get_class($this)])) ? self::$fieldsRequiredDatabase[get_class($this)] : array(); $required_fields = (isset(self::$fieldsRequiredDatabase[get_class($this)])) ? self::$fieldsRequiredDatabase[get_class($this)] : array();
if (!$id_lang || $id_lang == Configuration::get('PS_LANG_DEFAULT')) if (!$id_lang || $id_lang == Configuration::get('PS_LANG_DEFAULT'))
if (!empty($data['required']) || in_array($field, $required_fields)) if (!in_array('required', $skip) && (!empty($data['required']) || in_array($field, $required_fields)))
if (Tools::isEmpty($value)) if (Tools::isEmpty($value))
if ($human_errors)
return sprintf(Tools::displayError('The %s field is required.'), $this->displayFieldName($field, get_class($this)));
else
return 'Property '.get_class($this).'->'.$field.' is empty'; return 'Property '.get_class($this).'->'.$field.' is empty';
// Default value // Default value
@@ -913,11 +916,11 @@ abstract class ObjectModelCore
} }
// Check field values // Check field values
if (!empty($data['values']) && is_array($data['values']) && !in_array($value, $data['values'])) if (!in_array('values', $skip) && !empty($data['values']) && is_array($data['values']) && !in_array($value, $data['values']))
return 'Property '.get_class($this).'->'.$field.' has bad value (allowed values are: '.implode(', ', $data['values']).')'; return 'Property '.get_class($this).'->'.$field.' has bad value (allowed values are: '.implode(', ', $data['values']).')';
// Check field size // Check field size
if (!empty($data['size'])) if (!in_array('size', $skip) && !empty($data['size']))
{ {
$size = $data['size']; $size = $data['size'];
if (!is_array($data['size'])) if (!is_array($data['size']))
@@ -925,11 +928,24 @@ abstract class ObjectModelCore
$length = Tools::strlen($value); $length = Tools::strlen($value);
if ($length < $size['min'] || $length > $size['max']) if ($length < $size['min'] || $length > $size['max'])
{
if ($human_errors)
{
if (isset($data['lang']) && $data['lang'])
{
$language = new Language((int)$id_lang);
return sprintf(Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'), $this->displayFieldName($field, get_class($this)), $language->name, $size['max']);
}
else
return sprintf(Tools::displayError('The %1$s field is too long (%2$d chars max).'), $this->displayFieldName($field, get_class($this)), $size['max']);
}
else
return 'Property '.get_class($this).'->'.$field.' length ('.$length.') must be between '.$size['min'].' and '.$size['max']; return 'Property '.get_class($this).'->'.$field.' length ('.$length.') must be between '.$size['min'].' and '.$size['max'];
} }
}
// Check field validator // Check field validator
if (!empty($data['validate'])) if (!in_array('validate', $skip) && !empty($data['validate']))
{ {
if (!method_exists('Validate', $data['validate'])) if (!method_exists('Validate', $data['validate']))
throw new PrestaShopException('Validation function not found. '.$data['validate']); throw new PrestaShopException('Validation function not found. '.$data['validate']);
@@ -948,9 +964,14 @@ abstract class ObjectModelCore
$res = false; $res = false;
} }
if (!$res) if (!$res)
{
if ($human_errors)
return sprintf(Tools::displayError('The %s field is invalid.'), $this->displayFieldName($field, get_class($this)));
else
return 'Property '.get_class($this).'->'.$field.' is not valid'; return 'Property '.get_class($this).'->'.$field.' is not valid';
} }
} }
}
return true; return true;
} }
@@ -1118,7 +1139,7 @@ abstract class ObjectModelCore
{ {
$vars = get_class_vars($class_name); $vars = get_class_vars($class_name);
foreach ($vars['shopIDs'] as $id_shop) foreach ($vars['shopIDs'] as $id_shop)
$or[] = ' main.id_shop = '.(int)$id_shop.' '; $or[] = '(main.id_shop = '.(int)$id_shop.(isset($this->def['fields']['id_shop_group']) ? ' OR (id_shop = 0 AND id_shop_group='.(int)Shop::getGroupFromShop((int)$id_shop).')' : '').')';
$prepend = ''; $prepend = '';
if (count($or)) if (count($or))
@@ -1213,11 +1234,16 @@ abstract class ObjectModelCore
if ($id_shop === null) if ($id_shop === null)
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$cache_id = 'objectmodel_shop_'.$this->def['classname'].'_'.(int)$this->id.'-'.(int)$id_shop;
if (!Cache::isStored($cache_id))
{
$sql = 'SELECT id_shop $sql = 'SELECT id_shop
FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_shop` FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_shop`
WHERE `'.$this->def['primary'].'` = '.(int)$this->id.' WHERE `'.$this->def['primary'].'` = '.(int)$this->id.'
AND id_shop = '.(int)$id_shop; AND id_shop = '.(int)$id_shop;
return (bool)Db::getInstance()->getValue($sql); Cache::store($cache_id, (bool)Db::getInstance()->getValue($sql));
}
return Cache::retrieve($cache_id);
} }
/** /**
+16 -10
View File
@@ -399,6 +399,8 @@ abstract class PaymentModuleCore extends Module
} // end foreach ($products) } // end foreach ($products)
$cart_rules_list = ''; $cart_rules_list = '';
$total_reduction_value_ti = 0;
$total_reduction_value_tex = 0;
foreach ($cart_rules as $cart_rule) foreach ($cart_rules as $cart_rule)
{ {
$package = array('id_carrier' => $order->id_carrier, 'id_address' => $order->id_address_delivery, 'products' => $order->product_list); $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 ** THEN
** The voucher is cloned with a new value corresponding to the remainder ** 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 // 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 $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 // Set the new voucher value
if ($voucher->reduction_tax) 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 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->id_customer = $order->id_customer;
$voucher->quantity = 1; $voucher->quantity = 1;
@@ -466,7 +469,10 @@ abstract class PaymentModuleCore extends Module
$values['tax_incl'] -= $values['tax_incl'] - $order->total_products_wt; $values['tax_incl'] -= $values['tax_incl'] - $order->total_products_wt;
$values['tax_excl'] -= $values['tax_excl'] - $order->total_products; $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); $order->addCartRule($cart_rule['obj']->id, $cart_rule['obj']->name, $values, 0, $cart_rule['obj']->free_shipping);
@@ -530,6 +536,13 @@ abstract class PaymentModuleCore extends Module
if ($order_status->logable) if ($order_status->logable)
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']); ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
// Set the order state
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
$new_history->addWithemail(true, $extra_vars);
// Switch to back order if needed
if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState()) if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState())
{ {
$history = new OrderHistory(); $history = new OrderHistory();
@@ -538,13 +551,6 @@ abstract class PaymentModuleCore extends Module
$history->addWithemail(); $history->addWithemail();
} }
// Set order state in order history ONLY even if the "out of stock" status has not been yet reached
// So you migth have two order states
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
$new_history->addWithemail(true, $extra_vars);
unset($order_detail); unset($order_detail);
// Order is reloaded because the status just changed // Order is reloaded because the status just changed
+72 -50
View File
@@ -229,7 +229,13 @@ class ProductCore extends ObjectModel
protected static $_prices = array(); protected static $_prices = array();
protected static $_pricesLevel2 = array(); protected static $_pricesLevel2 = array();
protected static $_incat = array(); protected static $_incat = array();
/**
* @since 1.5.6.1
* @var array $_cart_quantity is deprecated since 1.5.6.1
*/
protected static $_cart_quantity = array(); protected static $_cart_quantity = array();
protected static $_tax_rules_group = array(); protected static $_tax_rules_group = array();
protected static $_cacheFeatures = array(); protected static $_cacheFeatures = array();
protected static $_frontFeaturesCache = array(); protected static $_frontFeaturesCache = array();
@@ -519,6 +525,17 @@ class ProductCore extends ObjectModel
if (!Validate::isLoadedObject($customer)) if (!Validate::isLoadedObject($customer))
die(Tools::displayError()); die(Tools::displayError());
self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int)$customer->id_default_group); self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int)$customer->id_default_group);
$cur_cart = Context::getContext()->cart;
$id_address = 0;
if (Validate::isLoadedObject($cur_cart))
$id_address = (int)$cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
$address_infos = Address::getCountryAndState($id_address);
if (self::$_taxCalculationMethod != PS_TAX_EXC
&& !empty($address_infos['vat_number'])
&& $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY')
&& Configuration::get('VATNUMBER_MANAGEMENT'))
self::$_taxCalculationMethod = PS_TAX_EXC;
} }
else else
self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id); self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
@@ -730,10 +747,10 @@ class ProductCore extends ObjectModel
/** /**
* @see ObjectModel::validateField() * @see ObjectModel::validateField()
*/ */
public function validateField($field, $value, $id_lang = null) public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
{ {
$value = ($field == 'description_short' ? strip_tags($value) : $value); $value = ($field == 'description_short' ? strip_tags($value) : $value);
return parent::validateField($field, $value, $id_lang); return parent::validateField($field, $value, $id_lang, $skip, $human_errors);
} }
public function toggleStatus() public function toggleStatus()
@@ -1368,8 +1385,8 @@ class ProductCore extends ObjectModel
} }
$product_supplier->product_supplier_reference = pSQL($supplier_reference); $product_supplier->product_supplier_reference = pSQL($supplier_reference);
$product_supplier->product_supplier_price_te = (float)$price; $product_supplier->product_supplier_price_te = !is_null($price) ? (float)$price : (float)$product_supplier->product_supplier_price_te;
$product_supplier->id_currency = (int)$id_currency; $product_supplier->id_currency = !is_null($id_currency) ? (int)$id_currency : (int)$product_supplier->id_currency;
$product_supplier->save(); $product_supplier->save();
} }
} }
@@ -2423,13 +2440,18 @@ class ProductCore extends ObjectModel
{ {
if (!$context) if (!$context)
$context = Context::getContext(); $context = Context::getContext();
$cache_id = 'Product::getOrderStates_'.(int)$id_product.'-'.(int)$context->shop->id;
if (!Cache::isStored($cache_id))
{
$sql = 'SELECT image_shop.`id_image` $sql = 'SELECT image_shop.`id_image`
FROM `'._DB_PREFIX_.'image` i FROM `'._DB_PREFIX_.'image` i
'.Shop::addSqlAssociation('image', 'i').' '.Shop::addSqlAssociation('image', 'i').'
WHERE i.`id_product` = '.(int)$id_product.' WHERE i.`id_product` = '.(int)$id_product.'
AND image_shop.`cover` = 1'; AND image_shop.`cover` = 1';
return Db::getInstance()->getRow($sql); $result = Db::getInstance()->getRow($sql);
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
@@ -2491,15 +2513,17 @@ class ProductCore extends ObjectModel
$cart_quantity = 0; $cart_quantity = 0;
if ((int)$id_cart) if ((int)$id_cart)
{ {
$condition = ''; $cache_id = 'Product::getPriceStatic_'.(int)$id_product.'-'.(int)$id_cart;
$cache_name = (int)$id_cart.'_'.(int)$id_product; if (!Cache::isStored($cache_id))
if (!isset(self::$_cart_quantity[$cache_name]) || self::$_cart_quantity[$cache_name] != (int)$quantity) {
self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' $sql = 'SELECT SUM(`quantity`)
SELECT SUM(`quantity`)
FROM `'._DB_PREFIX_.'cart_product` FROM `'._DB_PREFIX_.'cart_product`
WHERE `id_product` = '.(int)$id_product.' WHERE `id_product` = '.(int)$id_product.'
AND `id_cart` = '.(int)$id_cart); AND `id_cart` = '.(int)$id_cart;
$cart_quantity = self::$_cart_quantity[$cache_name]; $cart_quantity = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
Cache::store($cache_id, $cart_quantity);
}
$cart_quantity = Cache::retrieve($cache_id);
} }
$id_currency = (int)Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT'); $id_currency = (int)Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT');
@@ -2509,7 +2533,7 @@ class ProductCore extends ObjectModel
$id_state = 0; $id_state = 0;
$zipcode = 0; $zipcode = 0;
if (!$id_address) if (!$id_address && Validate::isLoadedObject($cur_cart))
$id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}; $id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
if ($id_address) if ($id_address)
@@ -2720,8 +2744,7 @@ class ProductCore extends ObjectModel
if ($use_group_reduction) if ($use_group_reduction)
{ {
$reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group); $reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group);
if ($reduction_from_category !== false)
if (!empty($reduction_from_category) && (float)$reduction_from_category == 0)
$price -= $price * (float)$reduction_from_category; $price -= $price * (float)$reduction_from_category;
else // apply group reduction if there is no group reduction for this category else // apply group reduction if there is no group reduction for this category
$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100); $price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
@@ -3160,8 +3183,9 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`) LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`)
'.Product::sqlStock('p', 0).' '.Product::sqlStock('p', 0).'
WHERE `id_product_1` = '.(int)$this->id. 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'; GROUP BY product_shop.id_product';
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql)) if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
return false; return false;
foreach ($result as &$row) foreach ($result as &$row)
@@ -3313,7 +3337,7 @@ class ProductCore extends ObjectModel
$context = Context::getContext(); $context = Context::getContext();
$sql = new DbQuery(); $sql = new DbQuery();
$sql->select('p.`id_product`, pl.`name`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`, product_shop.advanced_stock_management, p.`customizable`'); $sql->select('p.`id_product`, pl.`name`, p.`ean13`, p.`upc`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`, product_shop.advanced_stock_management, p.`customizable`');
$sql->from('category_product', 'cp'); $sql->from('category_product', 'cp');
$sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`'); $sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
$sql->join(Shop::addSqlAssociation('product', 'p')); $sql->join(Shop::addSqlAssociation('product', 'p'));
@@ -3324,6 +3348,8 @@ class ProductCore extends ObjectModel
$sql->leftJoin('manufacturer', 'm', 'm.`id_manufacturer` = p.`id_manufacturer`'); $sql->leftJoin('manufacturer', 'm', 'm.`id_manufacturer` = p.`id_manufacturer`');
$where = 'pl.`name` LIKE \'%'.pSQL($query).'%\' $where = 'pl.`name` LIKE \'%'.pSQL($query).'%\'
OR p.`ean13` LIKE \'%'.pSQL($query).'%\'
OR p.`upc` LIKE \'%'.pSQL($query).'%\'
OR p.`reference` LIKE \'%'.pSQL($query).'%\' OR p.`reference` LIKE \'%'.pSQL($query).'%\'
OR p.`supplier_reference` LIKE \'%'.pSQL($query).'%\' OR p.`supplier_reference` LIKE \'%'.pSQL($query).'%\'
OR p.`id_product` IN (SELECT id_product FROM '._DB_PREFIX_.'product_supplier sp WHERE `product_supplier_reference` LIKE \'%'.pSQL($query).'%\')'; OR p.`id_product` IN (SELECT id_product FROM '._DB_PREFIX_.'product_supplier sp WHERE `product_supplier_reference` LIKE \'%'.pSQL($query).'%\')';
@@ -3577,6 +3603,7 @@ class ProductCore extends ObjectModel
if ($result3) if ($result3)
{ {
$result3['id_feature_value'] = $new_id_feature_value; $result3['id_feature_value'] = $new_id_feature_value;
$result3['value'] = pSQL($result3['value']);
$return &= Db::getInstance()->insert('feature_value_lang', $result3); $return &= Db::getInstance()->insert('feature_value_lang', $result3);
} }
} }
@@ -4285,20 +4312,26 @@ class ProductCore extends ObjectModel
} }
public function checkAccess($id_customer) public function checkAccess($id_customer)
{
$cache_id = 'Product::checkAccess_'.(int)$this->id.'-'.(int)$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : '');
if (!Cache::isStored($cache_id))
{ {
if (!$id_customer) if (!$id_customer)
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT ctg.`id_group` SELECT ctg.`id_group`
FROM `'._DB_PREFIX_.'category_product` cp FROM `'._DB_PREFIX_.'category_product` cp
INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`)
WHERE cp.`id_product` = '.(int)$this->id.' AND ctg.`id_group` = '.(int)Group::getCurrent()->id); WHERE cp.`id_product` = '.(int)$this->id.' AND ctg.`id_group` = '.(int)Group::getCurrent()->id);
else else
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT cg.`id_group` SELECT cg.`id_group`
FROM `'._DB_PREFIX_.'category_product` cp FROM `'._DB_PREFIX_.'category_product` cp
INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`)
INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group`) INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group`)
WHERE cp.`id_product` = '.(int)$this->id.' AND cg.`id_customer` = '.(int)$id_customer); WHERE cp.`id_product` = '.(int)$this->id.' AND cg.`id_customer` = '.(int)$id_customer);
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
@@ -4858,8 +4891,12 @@ class ProductCore extends ObjectModel
*/ */
public static function getAttributesParams($id_product, $id_product_attribute) public static function getAttributesParams($id_product, $id_product_attribute)
{ {
$id_lang = (int)Context::getContext()->language->id;
$id_shop = (int)Context::getContext()->shop->id;
$cache_id = 'Product::getAttributesParams_'.(int)$id_product.'-'.(int)$id_product_attribute.'-'.(int)$id_lang.'-'.(int)$id_shop;
// if blocklayered module is installed we check if user has set custom attribute name // if blocklayered module is installed we check if user has set custom attribute name
if (Module::isInstalled('blocklayered')) if (Module::isInstalled('blocklayered') && Module::isEnabled('blocklayered'))
{ {
$nb_custom_values = Db::getInstance()->executeS(' $nb_custom_values = Db::getInstance()->executeS('
SELECT DISTINCT la.`id_attribute`, la.`url_name` as `name` SELECT DISTINCT la.`id_attribute`, la.`url_name` as `name`
@@ -4870,7 +4907,7 @@ class ProductCore extends ObjectModel
ON (pac.`id_product_attribute` = pa.`id_product_attribute`) ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').' '.Shop::addSqlAssociation('product_attribute', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` la LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` la
ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)Context::getContext()->language->id.') ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)$id_lang.')
WHERE la.`url_name` IS NOT NULL AND la.`url_name` != \'\' WHERE la.`url_name` IS NOT NULL AND la.`url_name` != \'\'
AND pa.`id_product` = '.(int)$id_product.' AND pa.`id_product` = '.(int)$id_product.'
AND pac.`id_product_attribute` = '.(int)$id_product_attribute); AND pac.`id_product_attribute` = '.(int)$id_product_attribute);
@@ -4888,7 +4925,7 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'attribute` a LEFT JOIN `'._DB_PREFIX_.'attribute` a
ON (a.`id_attribute_group` = g.`id_attribute_group`) ON (a.`id_attribute_group` = g.`id_attribute_group`)
WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].' WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].'
AND g.`id_lang` = '.(int)Context::getContext()->language->id.' AND g.`id_lang` = '.(int)$id_lang.'
AND g.`url_name` IS NOT NULL AND g.`url_name` != \'\''); AND g.`url_name` IS NOT NULL AND g.`url_name` != \'\'');
if (empty($group)) if (empty($group))
{ {
@@ -4898,7 +4935,7 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'attribute` a LEFT JOIN `'._DB_PREFIX_.'attribute` a
ON (a.`id_attribute_group` = g.`id_attribute_group`) ON (a.`id_attribute_group` = g.`id_attribute_group`)
WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].' WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].'
AND g.`id_lang` = '.(int)Context::getContext()->language->id.' AND g.`id_lang` = '.(int)$id_lang.'
AND g.`name` IS NOT NULL'); AND g.`name` IS NOT NULL');
} }
$result[] = array_merge($attribute, $group[0]); $result[] = array_merge($attribute, $group[0]);
@@ -4907,9 +4944,9 @@ class ProductCore extends ObjectModel
SELECT DISTINCT a.`id_attribute_group`, al.`name`, agl.`name` as `group` SELECT DISTINCT a.`id_attribute_group`, al.`name`, agl.`name` as `group`
FROM `'._DB_PREFIX_.'attribute` a FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.') ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.') ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (a.`id_attribute` = pac.`id_attribute`) ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
@@ -4918,45 +4955,30 @@ class ProductCore extends ObjectModel
WHERE pa.`id_product` = '.(int)$id_product.' WHERE pa.`id_product` = '.(int)$id_product.'
AND pac.id_product_attribute = '.(int)$id_product_attribute.' AND pac.id_product_attribute = '.(int)$id_product_attribute.'
AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')'); AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')');
$result = array_merge($values_not_custom, $result); return array_merge($values_not_custom, $result);
} }
else }
if (!Cache::isStored($cache_id))
{ {
$result = Db::getInstance()->executeS(' $result = Db::getInstance()->executeS('
SELECT al.`name`, agl.`name` as `group` SELECT al.`name`, agl.`name` as `group`
FROM `'._DB_PREFIX_.'attribute` a FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.') ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (pac.`id_attribute` = a.`id_attribute`) ON (pac.`id_attribute` = a.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pa.`id_product_attribute` = pac.`id_product_attribute`) ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').' '.Shop::addSqlAssociation('product_attribute', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.') ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
WHERE pa.`id_product` = '.(int)$id_product.' WHERE pa.`id_product` = '.(int)$id_product.'
AND pac.`id_product_attribute` = '.(int)$id_product_attribute.' AND pac.`id_product_attribute` = '.(int)$id_product_attribute.'
AND agl.`id_lang` = '.(int)Context::getContext()->language->id); AND agl.`id_lang` = '.(int)$id_lang);
} Cache::store($cache_id, $result);
}
else
{
$result = Db::getInstance()->executeS('
SELECT al.`name`, agl.`name` as `group`
FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (pac.`id_attribute` = a.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.')
WHERE pa.`id_product` = '.(int)$id_product.'
AND pac.`id_product_attribute` = '.(int)$id_product_attribute.'
AND agl.`id_lang` = '.(int)Context::getContext()->language->id);
} }
$result = Cache::retrieve($cache_id);
return $result; return $result;
} }
+40 -16
View File
@@ -75,10 +75,20 @@ class ProductSaleCore
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20; $interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
$prefix = ''; //Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage
if ($order_by == 'date_add') $sql = 'SELECT cp.`id_product`
$prefix = 'p.'; FROM `'._DB_PREFIX_.'category_group` cg
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` '.$sql_groups;
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
$ids = array();
foreach ($products as $product)
$ids[$product['id_product']] = 1;
$ids = array_keys($ids);
sort($ids);
$ids = count($ids) > 0 ? implode(',', $ids) : 'NULL';
//Main query
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
@@ -104,12 +114,7 @@ class ProductSaleCore
'.Product::sqlStock('p').' '.Product::sqlStock('p').'
WHERE product_shop.`active` = 1 WHERE product_shop.`active` = 1
AND p.`visibility` != \'none\' AND p.`visibility` != \'none\'
AND p.`id_product` IN ( AND p.`id_product` IN ('.$ids.')
SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` '.$sql_groups.'
)
GROUP BY product_shop.id_product GROUP BY product_shop.id_product
ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
@@ -141,11 +146,27 @@ class ProductSaleCore
$groups = FrontController::getCurrentCustomerGroups(); $groups = FrontController::getCurrentCustomerGroups();
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
//Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage
$sql = 'SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` '.$sql_groups.' AND cp.`id_product` IS NOT NULL';
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
$ids = array();
foreach ($products as $product)
$ids[$product['id_product']] = 1;
$ids = array_keys($ids);
sort($ids);
$ids = count($ids) > 0 ? implode(',', $ids) : 'NULL';
//Main query
$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, MAX(image_shop.`id_image`) id_image, il.`legend`, $sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, MAX(image_shop.`id_image`) id_image, il.`legend`,
ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, p.show_price, p.available_for_order, p.quantity, p.customizable,
IFNULL(pa.minimal_quantity, p.minimal_quantity) as minimal_quantity, p.out_of_stock
FROM `'._DB_PREFIX_.'product_sale` ps FROM `'._DB_PREFIX_.'product_sale` ps
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product` LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
'.Shop::addSqlAssociation('product', 'p').' '.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (ps.`id_product` = pa.`id_product` AND pa.default_on = 1)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
ON p.`id_product` = pl.`id_product` ON p.`id_product` = pl.`id_product`
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
@@ -157,15 +178,11 @@ class ProductSaleCore
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').' AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
WHERE product_shop.`active` = 1 WHERE product_shop.`active` = 1
AND p.`visibility` != \'none\' AND p.`visibility` != \'none\'
AND p.`id_product` IN ( AND p.`id_product` IN ('.$ids.')
SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` '.$sql_groups.'
)
GROUP BY product_shop.id_product GROUP BY product_shop.id_product
ORDER BY sales DESC ORDER BY sales DESC
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql)) if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
return false; return false;
@@ -173,6 +190,13 @@ class ProductSaleCore
{ {
$row['link'] = $context->link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']); $row['link'] = $context->link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
$row['id_image'] = Product::defineProductImage($row, $id_lang); $row['id_image'] = Product::defineProductImage($row, $id_lang);
$row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
$row['price_tax_exc'] = Product::getPriceStatic(
(int)$row['id_product'],
false,
((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int)$row['id_product_attribute'] : null),
(Product::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6)
);
} }
return $result; return $result;
} }
+7 -5
View File
@@ -149,11 +149,12 @@ class ReferrerCore extends ObjectModel
LEFT JOIN '._DB_PREFIX_.'connections c ON cs.id_connections = c.id_connections LEFT JOIN '._DB_PREFIX_.'connections c ON cs.id_connections = c.id_connections
LEFT JOIN '._DB_PREFIX_.'connections_page cp ON cp.id_connections = c.id_connections LEFT JOIN '._DB_PREFIX_.'connections_page cp ON cp.id_connections = c.id_connections
'.$join.' '.$join.'
WHERE cs.date_add BETWEEN '.ModuleGraph::getDateBetween($employee).' WHERE 1'.
'.Shop::addSqlRestriction(false, 'rs').' ((isset($employee->stats_date_from) && isset($employee->stats_date_from))? ' AND cs.date_add BETWEEN \''.pSQL($employee->stats_date_from).' 00:00:00\' AND \''.pSQL($employee->stats_date_to).' 23:59:59\'' : '').
'.Shop::addSqlRestriction(false, 'c').' Shop::addSqlRestriction(false, 'rs').
AND rc.id_referrer = '.(int)$this->id Shop::addSqlRestriction(false, 'c').
.$where; ' AND rc.id_referrer = '.(int)$this->id.
$where;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
} }
@@ -314,6 +315,7 @@ class ReferrerCore extends ObjectModel
FROM '._DB_PREFIX_.'referrer r FROM '._DB_PREFIX_.'referrer r
LEFT JOIN '._DB_PREFIX_.'connections_source cs ON ('.self::$_join.') LEFT JOIN '._DB_PREFIX_.'connections_source cs ON ('.self::$_join.')
WHERE id_referrer = '.(int)$row['id_referrer'].' WHERE id_referrer = '.(int)$row['id_referrer'].'
AND id_connections_source IS NOT NULL
)'); )');
} }
} }
+25 -13
View File
@@ -94,7 +94,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::add($autodate, $nullValues)) if (parent::add($autodate, $nullValues))
{ {
// Flush cache when we adding a new specific price // Flush cache when we adding a new specific price
self::$_specificPriceCache = array(); SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache(); Product::flushPriceCache();
// Set cache of feature detachable to true // Set cache of feature detachable to true
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1'); Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1');
@@ -108,7 +108,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::update($null_values)) if (parent::update($null_values))
{ {
// Flush cache when we updating a new specific price // Flush cache when we updating a new specific price
self::$_specificPriceCache = array(); SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache(); Product::flushPriceCache();
return true; return true;
} }
@@ -120,7 +120,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::delete()) if (parent::delete())
{ {
// Flush cache when we deletind a new specific price // Flush cache when we deletind a new specific price
self::$_specificPriceCache = array(); SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache(); Product::flushPriceCache();
// Refresh cache of feature detachable // Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table'])); Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table']));
@@ -169,6 +169,7 @@ class SpecificPriceCore extends ObjectModel
$priority = SpecificPrice::getPriority($id_product); $priority = SpecificPrice::getPriority($id_product);
foreach (array_reverse($priority) as $k => $field) foreach (array_reverse($priority) as $k => $field)
if (!empty($field))
$select .= ' IF (`'.bqSQL($field).'` = '.(int)$$field.', '.pow(2, $k + 1).', 0) + '; $select .= ' IF (`'.bqSQL($field).'` = '.(int)$$field.', '.pow(2, $k + 1).', 0) + ';
return rtrim($select, ' +').') AS `score`'; return rtrim($select, ' +').') AS `score`';
@@ -179,9 +180,9 @@ class SpecificPriceCore extends ObjectModel
if (!SpecificPrice::isFeatureActive()) if (!SpecificPrice::isFeatureActive())
return explode(';', Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES')); return explode(';', Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES'));
if (!isset(self::$_cache_priorities[(int)$id_product])) if (!isset(SpecificPrice::$_cache_priorities[(int)$id_product]))
{ {
self::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SpecificPrice::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `priority`, `id_specific_price_priority` SELECT `priority`, `id_specific_price_priority`
FROM `'._DB_PREFIX_.'specific_price_priority` FROM `'._DB_PREFIX_.'specific_price_priority`
WHERE `id_product` = '.(int)$id_product.' WHERE `id_product` = '.(int)$id_product.'
@@ -189,7 +190,7 @@ class SpecificPriceCore extends ObjectModel
'); ');
} }
$priority = self::$_cache_priorities[(int)$id_product]; $priority = SpecificPrice::$_cache_priorities[(int)$id_product];
if (!$priority) if (!$priority)
$priority = Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES'); $priority = Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES');
@@ -208,10 +209,10 @@ class SpecificPriceCore extends ObjectModel
*/ */
$key = ((int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.(int)$id_group.'-'.(int)$quantity.'-'.(int)$id_product_attribute.'-'.(int)$id_cart.'-'.(int)$id_customer.'-'.(int)$real_quantity); $key = ((int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.(int)$id_group.'-'.(int)$quantity.'-'.(int)$id_product_attribute.'-'.(int)$id_cart.'-'.(int)$id_customer.'-'.(int)$real_quantity);
if (!array_key_exists($key, self::$_specificPriceCache)) if (!array_key_exists($key, SpecificPrice::$_specificPriceCache))
{ {
$now = date('Y-m-d H:i:s'); $now = date('Y-m-d H:i:s');
self::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $query = '
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).' SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
FROM `'._DB_PREFIX_.'specific_price` FROM `'._DB_PREFIX_.'specific_price`
WHERE `id_product` IN (0, '.(int)$id_product.') WHERE `id_product` IN (0, '.(int)$id_product.')
@@ -227,11 +228,22 @@ class SpecificPriceCore extends ObjectModel
AND AND
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`) (`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
) )
AND id_cart IN (0, '.(int)$id_cart.')'. 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).'
ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC'); if ($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION'))
$query .= ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')';
else
{
$qty_to_use = $id_cart ? (int)$quantity : (int)$real_quantity;
$query .= 'AND `from_quantity` <= '.max(1, $qty_to_use);
} }
return self::$_specificPriceCache[$key];
$query .= ' ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC';
SpecificPrice::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query);
}
return SpecificPrice::$_specificPriceCache[$key];
} }
public static function setPriorities($priorities) public static function setPriorities($priorities)
@@ -301,7 +313,7 @@ class SpecificPriceCore extends ObjectModel
if (!isset($last_quantity[(int)$specific_price['id_product_attribute']])) if (!isset($last_quantity[(int)$specific_price['id_product_attribute']]))
$last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity']; $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']) 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']; $last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
if ($specific_price['from_quantity'] > 1) if ($specific_price['from_quantity'] > 1)
+3 -3
View File
@@ -183,7 +183,7 @@ class SpecificPriceRuleCore extends ObjectModel
if ($conditions_group) if ($conditions_group)
{ {
$where .= ' AND ('; $where .= ' AND ((';
foreach ($conditions_group as $id_condition_group => $condition_group) foreach ($conditions_group as $id_condition_group => $condition_group)
{ {
$fields = array( $fields = array(
@@ -235,7 +235,7 @@ class SpecificPriceRuleCore extends ObjectModel
$where = rtrim($where, ' AND ').') OR ('; $where = rtrim($where, ' AND ').') OR (';
} }
$where = rtrim($where, 'OR ('); $where = rtrim($where, 'OR (').')';
} }
if ($products && count($products)) if ($products && count($products))
$where .= ' AND p.id_product IN ('.implode(', ', array_map('intval', $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) public static function applyRuleToProduct($id_rule, $id_product, $id_product_attribute = null)
{ {
$rule = new SpecificPriceRule((int)$id_rule); $rule = new SpecificPriceRule((int)$id_rule);
if (!Validate::isLoadedObject($rule)) if (!Validate::isLoadedObject($rule) || !$id_product)
return false; return false;
$specific_price = new SpecificPrice(); $specific_price = new SpecificPrice();
+18 -6
View File
@@ -80,13 +80,19 @@ class StateCore extends ObjectModel
*/ */
public static function getNameById($id_state) public static function getNameById($id_state)
{ {
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' if (!$id_state)
return false;
$cache_id = 'State::getNameById_'.(int)$id_state;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `name` SELECT `name`
FROM `'._DB_PREFIX_.'state` FROM `'._DB_PREFIX_.'state`
WHERE `id_state` = '.(int)$id_state WHERE `id_state` = '.(int)$id_state
); );
Cache::store($cache_id, $result);
return $result['name']; }
return Cache::retrieve($cache_id);
} }
/** /**
@@ -97,13 +103,19 @@ class StateCore extends ObjectModel
*/ */
public static function getIdByName($state) public static function getIdByName($state)
{ {
$result = Db::getInstance()->getValue(' if (empty($state))
return false;
$cache_id = 'State::getNameById_'.pSQL($state);
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('
SELECT `id_state` SELECT `id_state`
FROM `'._DB_PREFIX_.'state` FROM `'._DB_PREFIX_.'state`
WHERE `name` LIKE \''.pSQL($state).'\' WHERE `name` LIKE \''.pSQL($state).'\'
'); ');
Cache::store($cache_id, $result);
return (int)$result; }
return Cache::retrieve($cache_id);
} }
/** /**
+7 -1
View File
@@ -189,15 +189,21 @@ class TabCore extends ObjectModel
* @return array tab * @return array tab
*/ */
public static function getTab($id_lang, $id_tab) public static function getTab($id_lang, $id_tab)
{
$cache_id = 'Tab::getTab_'.(int)$id_lang.'-'.(int)$id_tab;
if (!Cache::isStored($cache_id))
{ {
/* Tabs selection */ /* Tabs selection */
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'tab` t FROM `'._DB_PREFIX_.'tab` t
LEFT JOIN `'._DB_PREFIX_.'tab_lang` tl LEFT JOIN `'._DB_PREFIX_.'tab_lang` tl
ON (t.`id_tab` = tl.`id_tab` AND tl.`id_lang` = '.(int)$id_lang.') ON (t.`id_tab` = tl.`id_tab` AND tl.`id_lang` = '.(int)$id_lang.')
WHERE t.`id_tab` = '.(int)$id_tab WHERE t.`id_tab` = '.(int)$id_tab
); );
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
+5 -3
View File
@@ -40,7 +40,7 @@ class TagCore extends ObjectModel
'primary' => 'id_tag', 'primary' => 'id_tag',
'fields' => array( 'fields' => array(
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), '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,16 +100,18 @@ class TagCore extends ObjectModel
$tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, null, PREG_SPLIT_NO_EMPTY)))); $tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
$list = array(); $list = array();
if (is_array($tag_list))
foreach ($tag_list as $tag) foreach ($tag_list as $tag)
{ {
if (!Validate::isGenericName($tag)) if (!Validate::isGenericName($tag))
return false; return false;
$tag_obj = new Tag(null, trim($tag), (int)$id_lang); $tag = trim(Tools::substr($tag, 0, self::$definition['fields']['name']['size']));
$tag_obj = new Tag(null, $tag, (int)$id_lang);
/* Tag does not exist in database */ /* Tag does not exist in database */
if (!Validate::isLoadedObject($tag_obj)) if (!Validate::isLoadedObject($tag_obj))
{ {
$tag_obj->name = trim($tag); $tag_obj->name = $tag;
$tag_obj->id_lang = (int)$id_lang; $tag_obj->id_lang = (int)$id_lang;
$tag_obj->add(); $tag_obj->add();
} }
+250 -55
View File
@@ -347,21 +347,14 @@ class ToolsCore
if ((!$cookie->id_lang || isset($cookie->detect_language)) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) if ((!$cookie->id_lang || isset($cookie->detect_language)) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{ {
$array = explode(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])); $array = explode(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
if (Tools::strlen($array[0]) > 2)
{
$tab = explode('-', $array[0]);
$string = $tab[0];
}
else
$string = $array[0]; $string = $array[0];
if (Validate::isLanguageIsoCode($string))
if (Validate::isLanguageCode($string))
{ {
$lang = new Language(Language::getIdByIso($string)); $lang = Language::getLanguageByIETFCode($string);
if (Validate::isLoadedObject($lang) && $lang->active) if (Validate::isLoadedObject($lang) && $lang->active && $lang->isAssociatedToShop())
{ {
$language = new Language((int)$lang->id); Context::getContext()->language = $lang;
if (Validate::isLoadedObject($language))
Context::getContext()->language = $language;
$cookie->id_lang = (int)$lang->id; $cookie->id_lang = (int)$lang->id;
} }
} }
@@ -494,6 +487,20 @@ class ToolsCore
if (($is_negative = ($price < 0))) if (($is_negative = ($price < 0)))
$price *= -1; $price *= -1;
$price = Tools::ps_round($price, $c_decimals); $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) switch ($c_format)
{ {
/* X 0,000.00 */ /* X 0,000.00 */
@@ -512,9 +519,9 @@ class ToolsCore
case 4: case 4:
$ret = number_format($price, $c_decimals, '.', ',').$blank.$c_char; $ret = number_format($price, $c_decimals, '.', ',').$blank.$c_char;
break; break;
/* 0 000.00 X Added for the switzerland currency */ /* X 0'000.00 Added for the switzerland currency */
case 5: case 5:
$ret = number_format($price, $c_decimals, '.', ' ').$blank.$c_char; $ret = $c_char.$blank.number_format($price, $c_decimals, '.', "'");
break; break;
} }
if ($is_negative) if ($is_negative)
@@ -661,20 +668,25 @@ class ToolsCore
{ {
if (is_array($string)) if (is_array($string))
return array_map(array('Tools', 'htmlentitiesUTF8'), $string); return array_map(array('Tools', 'htmlentitiesUTF8'), $string);
return htmlentities((string)$string, $type, 'utf-8'); return htmlentities((string)$string, $type, 'utf-8');
} }
public static function htmlentitiesDecodeUTF8($string) public static function htmlentitiesDecodeUTF8($string)
{ {
if (is_array($string)) if (is_array($string))
return array_map(array('Tools', 'htmlentitiesDecodeUTF8'), $string); {
$string = array_map(array('Tools', 'htmlentitiesDecodeUTF8'), $string);
return (string)array_shift($string);
}
return html_entity_decode((string)$string, ENT_QUOTES, 'utf-8'); return html_entity_decode((string)$string, ENT_QUOTES, 'utf-8');
} }
public static function safePostVars() public static function safePostVars()
{ {
if (!is_array($_POST)) if (!isset($_POST) || !is_array($_POST))
return array(); $_POST = array();
else
$_POST = array_map(array('Tools', 'htmlentitiesUTF8'), $_POST); $_POST = array_map(array('Tools', 'htmlentitiesUTF8'), $_POST);
} }
@@ -705,6 +717,21 @@ class ToolsCore
return false; return false;
} }
/**
* Delete file
*
* @param string File path
* @param array Excluded files
*/
public static function deleteFile($file, $exclude_files = array())
{
if (isset($exclude_files) && !is_array($exclude_files))
$exclude_files = array($exclude_files);
if (file_exists($file) && is_file($file) && array_search(basename($file), $exclude_files) === FALSE)
unlink($file);
}
/** /**
* Clear smarty cache folders * Clear smarty cache folders
*/ */
@@ -1077,63 +1104,94 @@ class ToolsCore
/* One source among others: /* One source among others:
http://www.tachyonsoft.com/uc0000.htm http://www.tachyonsoft.com/uc0000.htm
http://www.tachyonsoft.com/uc0001.htm http://www.tachyonsoft.com/uc0001.htm
http://www.tachyonsoft.com/uc0004.htm
*/ */
$patterns = array( $patterns = array(
/* Lowercase */ /* Lowercase */
/* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}]/u', /* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}\x{0430}]/u',
/* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}]/u', /* b */ '/[\x{0431}]/u',
/* d */ '/[\x{010F}\x{0111}]/u', /* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}\x{0446}]/u',
/* e */ '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{0113}\x{0115}\x{0117}\x{0119}\x{011B}]/u', /* d */ '/[\x{010F}\x{0111}\x{0434}]/u',
/* g */ '/[\x{011F}\x{0121}\x{0123}]/u', /* e */ '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{0113}\x{0115}\x{0117}\x{0119}\x{011B}\x{0435}\x{044D}]/u',
/* f */ '/[\x{0444}]/u',
/* g */ '/[\x{011F}\x{0121}\x{0123}\x{0433}\x{0491}]/u',
/* h */ '/[\x{0125}\x{0127}]/u', /* h */ '/[\x{0125}\x{0127}]/u',
/* i */ '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{0129}\x{012B}\x{012D}\x{012F}\x{0131}]/u', /* i */ '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{0129}\x{012B}\x{012D}\x{012F}\x{0131}\x{0438}\x{0456}]/u',
/* j */ '/[\x{0135}]/u', /* j */ '/[\x{0135}\x{0439}]/u',
/* k */ '/[\x{0137}\x{0138}]/u', /* k */ '/[\x{0137}\x{0138}\x{043A}]/u',
/* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}]/u', /* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}\x{043B}]/u',
/* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}]/u', /* m */ '/[\x{043C}]/u',
/* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}]/u', /* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}\x{043D}]/u',
/* r */ '/[\x{0155}\x{0157}\x{0159}]/u', /* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}\x{043E}]/u',
/* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}]/u', /* p */ '/[\x{043F}]/u',
/* r */ '/[\x{0155}\x{0157}\x{0159}\x{0440}]/u',
/* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}\x{0441}]/u',
/* ss */ '/[\x{00DF}]/u', /* ss */ '/[\x{00DF}]/u',
/* t */ '/[\x{0163}\x{0165}\x{0167}]/u', /* t */ '/[\x{0163}\x{0165}\x{0167}\x{0442}]/u',
/* u */ '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{0169}\x{016B}\x{016D}\x{016F}\x{0171}\x{0173}]/u', /* u */ '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{0169}\x{016B}\x{016D}\x{016F}\x{0171}\x{0173}\x{0443}]/u',
/* v */ '/[\x{0432}]/u',
/* w */ '/[\x{0175}]/u', /* w */ '/[\x{0175}]/u',
/* y */ '/[\x{00FF}\x{0177}\x{00FD}]/u', /* y */ '/[\x{00FF}\x{0177}\x{00FD}\x{044B}]/u',
/* z */ '/[\x{017A}\x{017C}\x{017E}]/u', /* z */ '/[\x{017A}\x{017C}\x{017E}\x{0437}]/u',
/* ae */ '/[\x{00E6}]/u', /* ae */ '/[\x{00E6}]/u',
/* ch */ '/[\x{0447}]/u',
/* kh */ '/[\x{0445}]/u',
/* oe */ '/[\x{0153}]/u', /* oe */ '/[\x{0153}]/u',
/* sh */ '/[\x{0448}]/u',
/* shh*/ '/[\x{0449}]/u',
/* ya */ '/[\x{044F}]/u',
/* ye */ '/[\x{0454}]/u',
/* yi */ '/[\x{0457}]/u',
/* yo */ '/[\x{0451}]/u',
/* yu */ '/[\x{044E}]/u',
/* zh */ '/[\x{0436}]/u',
/* Uppercase */ /* Uppercase */
/* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}]/u', /* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}\x{0410}]/u',
/* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}]/u', /* B */ '/[\x{0411}]]/u',
/* D */ '/[\x{010E}\x{0110}]/u', /* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}\x{0426}]/u',
/* E */ '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{0112}\x{0114}\x{0116}\x{0118}\x{011A}]/u', /* D */ '/[\x{010E}\x{0110}\x{0414}]/u',
/* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}]/u', /* E */ '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{0112}\x{0114}\x{0116}\x{0118}\x{011A}\x{0415}\x{042D}]/u',
/* F */ '/[\x{0424}]/u',
/* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}\x{0413}\x{0490}]/u',
/* H */ '/[\x{0124}\x{0126}]/u', /* H */ '/[\x{0124}\x{0126}]/u',
/* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}]/u', /* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}\x{0418}\x{0406}]/u',
/* J */ '/[\x{0134}]/u', /* J */ '/[\x{0134}\x{0419}]/u',
/* K */ '/[\x{0136}]/u', /* K */ '/[\x{0136}\x{041A}]/u',
/* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}]/u', /* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}\x{041B}]/u',
/* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}]/u', /* M */ '/[\x{041C}]/u',
/* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}]/u', /* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}\x{041D}]/u',
/* R */ '/[\x{0154}\x{0156}\x{0158}]/u', /* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}\x{041E}]/u',
/* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}]/u', /* P */ '/[\x{041F}]/u',
/* T */ '/[\x{0162}\x{0164}\x{0166}]/u', /* R */ '/[\x{0154}\x{0156}\x{0158}\x{0420}]/u',
/* U */ '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{0168}\x{016A}\x{016C}\x{016E}\x{0170}\x{0172}]/u', /* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}\x{0421}]/u',
/* T */ '/[\x{0162}\x{0164}\x{0166}\x{0422}]/u',
/* U */ '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{0168}\x{016A}\x{016C}\x{016E}\x{0170}\x{0172}\x{0423}]/u',
/* V */ '/[\x{0412}]/u',
/* W */ '/[\x{0174}]/u', /* W */ '/[\x{0174}]/u',
/* Y */ '/[\x{0176}]/u', /* Y */ '/[\x{0176}\x{042B}]/u',
/* Z */ '/[\x{0179}\x{017B}\x{017D}]/u', /* Z */ '/[\x{0179}\x{017B}\x{017D}\x{0417}]/u',
/* AE */ '/[\x{00C6}]/u', /* AE */ '/[\x{00C6}]/u',
/* OE*/ '/[\x{0152}]/u'); /* CH */ '/[\x{0427}]/u',
/* KH */ '/[\x{0425}]/u',
/* OE */ '/[\x{0152}]/u',
/* SH */ '/[\x{0428}]/u',
/* SHH*/ '/[\x{0429}]/u',
/* YA */ '/[\x{042F}]/u',
/* YE */ '/[\x{0404}]/u',
/* YI */ '/[\x{0407}]/u',
/* YO */ '/[\x{0401}]/u',
/* YU */ '/[\x{042E}]/u',
/* ZH */ '/[\x{0416}]/u');
// ö to oe // ö to oe
// å to aa // å to aa
// ä to ae // ä to ae
$replacements = array( $replacements = array(
'a', 'c', 'd', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'w', 'z', 'ae', 'oe', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 'ss', 't', 'u', 'v', 'w', 'y', 'z', 'ae', 'ch', 'kh', 'oe', 'sh', 'shh', 'ya', 'ye', 'yi', 'yo', 'yu', 'zh',
'A', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE' 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'V', 'W', 'Y', 'Z', 'AE', 'CH', 'KH', 'OE', 'SH', 'SHH', 'YA', 'YE', 'YI', 'YO', 'YU', 'ZH'
); );
return preg_replace($patterns, $replacements, $str); return preg_replace($patterns, $replacements, $str);
@@ -1157,6 +1215,134 @@ class ToolsCore
return (utf8_encode(substr($str, 0, $max_length - Tools::strlen($suffix)).$suffix)); return (utf8_encode(substr($str, 0, $max_length - Tools::strlen($suffix)).$suffix));
} }
/*Copied from CakePHP String utility file*/
public static function truncateString($text, $length = 120, $options = array())
{
$default = array(
'ellipsis' => '...', 'exact' => true, 'html' => true
);
if (isset($options['ending']))
$default['ellipsis'] = $options['ending'];
elseif (!empty($options['html']) && Configure::read('App.encoding') === 'UTF-8')
$default['ellipsis'] = "\xe2\x80\xa6";
$options = array_merge($default, $options);
extract($options);
if ($html)
{
if (Tools::strlen(preg_replace('/<.*?>/', '', $text)) <= $length)
return $text;
$totalLength = Tools::strlen(strip_tags($ellipsis));
$openTags = array();
$truncate = '';
preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
foreach ($tags as $tag)
{
if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s', $tag[2]))
{
if (preg_match('/<[\w]+[^>]*>/s', $tag[0]))
array_unshift($openTags, $tag[2]);
elseif (preg_match('/<\/([\w]+)[^>]*>/s', $tag[0], $closeTag))
{
$pos = array_search($closeTag[1], $openTags);
if ($pos !== false)
array_splice($openTags, $pos, 1);
}
}
$truncate .= $tag[1];
$contentLength = Tools::strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', ' ', $tag[3]));
if ($contentLength + $totalLength > $length)
{
$left = $length - $totalLength;
$entitiesLength = 0;
if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', $tag[3], $entities, PREG_OFFSET_CAPTURE))
{
foreach ($entities[0] as $entity)
{
if ($entity[1] + 1 - $entitiesLength <= $left)
{
$left--;
$entitiesLength += Tools::strlen($entity[0]);
}
else
break;
}
}
$truncate .= Tools::substr($tag[3], 0, $left + $entitiesLength);
break;
}
else
{
$truncate .= $tag[3];
$totalLength += $contentLength;
}
if ($totalLength >= $length)
break;
}
}
else
{
if (Tools::strlen($text) <= $length)
return $text;
$truncate = Tools::substr($text, 0, $length - Tools::strlen($ellipsis));
}
if (!$exact)
{
$spacepos = mb_strrpos($truncate, ' ');
if ($html)
{
$truncateCheck = Tools::substr($truncate, 0, $spacepos);
$lastOpenTag = Tools::strrpos($truncateCheck, '<');
$lastCloseTag = Tools::strrpos($truncateCheck, '>');
if ($lastOpenTag > $lastCloseTag)
{
preg_match_all('/<[\w]+[^>]*>/s', $truncate, $lastTagMatches);
$lastTag = array_pop($lastTagMatches[0]);
$spacepos = Tools::strrpos($truncate, $lastTag) + Tools::strlen($lastTag);
}
$bits = Tools::substr($truncate, $spacepos);
preg_match_all('/<\/([a-z]+)>/', $bits, $droppedTags, PREG_SET_ORDER);
if (!empty($droppedTags))
{
if (!empty($openTags))
{
foreach ($droppedTags as $closingTag)
if (!in_array($closingTag[1], $openTags))
array_unshift($openTags, $closingTag[1]);
}
else
{
foreach ($droppedTags as $closingTag)
$openTags[] = $closingTag[1];
}
}
}
$truncate = Tools::substr($truncate, 0, $spacepos);
}
$truncate .= $ellipsis;
if ($html)
foreach ($openTags as $tag)
$truncate .= '</' . $tag . '>';
return $truncate;
}
/** /**
* Generate date form * Generate date form
* *
@@ -1255,6 +1441,13 @@ class ToolsCore
return substr($str, $start, ($length === false ? Tools::strlen($str) : (int)$length)); return substr($str, $start, ($length === false ? Tools::strlen($str) : (int)$length));
} }
public static function strrpos($str, $find, $offset = 0, $encoding = 'utf-8')
{
if (function_exists('mb_strrpos'))
return mb_strrpos($str, $find, $offset, $encoding);
return strrpos($str, $find, $offset);
}
public static function ucfirst($str) public static function ucfirst($str)
{ {
return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1); return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1);
@@ -1662,13 +1855,15 @@ class ToolsCore
fwrite($write_fd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n\n"); fwrite($write_fd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n\n");
if ($disable_modsec) if ($disable_modsec)
fwrite($write_fd, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>\n"); fwrite($write_fd, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>\n\n");
// RewriteEngine // RewriteEngine
fwrite($write_fd, "<IfModule mod_rewrite.c>\n"); fwrite($write_fd, "<IfModule mod_rewrite.c>\n");
// Ensure HTTP_MOD_REWRITE variable is set in environment // Ensure HTTP_MOD_REWRITE variable is set in environment
fwrite($write_fd, "<IfModule mod_env.c>\n");
fwrite($write_fd, "SetEnv HTTP_MOD_REWRITE On\n"); fwrite($write_fd, "SetEnv HTTP_MOD_REWRITE On\n");
fwrite($write_fd, "</IfModule>\n\n");
// Disable multiviews ? // Disable multiviews ?
if ($disable_multiviews) if ($disable_multiviews)
+1 -1
View File
@@ -44,7 +44,7 @@ class ValidateCore
*/ */
public static function isEmail($email) public static function isEmail($email)
{ {
return !empty($email) && preg_match(Tools::cleanNonUnicodeSupport('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z0-9]+$/ui'), $email); return !empty($email) && preg_match(Tools::cleanNonUnicodeSupport('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z\p{L}0-9]+$/ui'), $email);
} }
/** /**
+7 -1
View File
@@ -54,12 +54,18 @@ class ZoneCore extends ObjectModel
*/ */
public static function getZones($active = false) public static function getZones($active = false)
{ {
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' $cache_id = 'Zone::getZones_'.(bool)$active;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'zone` FROM `'._DB_PREFIX_.'zone`
'.($active ? 'WHERE active = 1' : '').' '.($active ? 'WHERE active = 1' : '').'
ORDER BY `name` ASC ORDER BY `name` ASC
'); ');
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
+2
View File
@@ -153,6 +153,8 @@ class CacheMemcacheCore extends Cache
*/ */
protected function _writeKeys() protected function _writeKeys()
{ {
if (!$this->is_connected)
return false;
$this->memcache->set(_COOKIE_IV_, $this->keys); $this->memcache->set(_COOKIE_IV_, $this->keys);
} }
+68 -93
View File
@@ -693,7 +693,7 @@ class AdminControllerCore extends Controller
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token; $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token;
$this->errors[] = Tools::displayError('An error occurred during deletion.'); $this->errors[] = Tools::displayError('An error occurred during deletion.');
if ($res) if ($res)
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id); Logger::addLog(sprintf($this->l('%s deletion', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id);
} }
} }
else else
@@ -744,7 +744,7 @@ class AdminControllerCore extends Controller
/* voluntary do affectation here */ /* voluntary do affectation here */
elseif (($_POST[$this->identifier] = $this->object->id) && $this->postImage($this->object->id) && !count($this->errors) && $this->_redirect) elseif (($_POST[$this->identifier] = $this->object->id) && $this->postImage($this->object->id) && !count($this->errors) && $this->_redirect)
{ {
Logger::addLog(sprintf($this->l('%s addition'), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id); Logger::addLog(sprintf($this->l('%s addition', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id);
$parent_id = (int)Tools::getValue('id_parent', 1); $parent_id = (int)Tools::getValue('id_parent', 1);
$this->afterAdd($this->object); $this->afterAdd($this->object);
$this->updateAssoShop($this->object->id); $this->updateAssoShop($this->object->id);
@@ -841,10 +841,10 @@ class AdminControllerCore extends Controller
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=4&token='.$this->token; $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=4&token='.$this->token;
// Default behavior (save and back) // Default behavior (save and back)
if (empty($this->redirect_after)) if (empty($this->redirect_after) && $this->redirect_after !== false)
$this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=4&token='.$this->token; $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=4&token='.$this->token;
} }
Logger::addLog(sprintf($this->l('%s edition'), $this->className), 1, null, $this->className, (int)$object->id, true, (int)$this->context->employee->id); Logger::addLog(sprintf($this->l('%s edition', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$object->id, true, (int)$this->context->employee->id);
} }
else else
$this->errors[] = Tools::displayError('An error occurred while updating an object.'). $this->errors[] = Tools::displayError('An error occurred while updating an object.').
@@ -1542,10 +1542,12 @@ class AdminControllerCore extends Controller
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400)) 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')); file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'));
libxml_use_internal_errors(true);
$country_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST); $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)) if (!empty($country_module_list) && is_string($country_module_list) && $country_module_list_xml = simplexml_load_string($country_module_list))
{ {
$country_module_list_array = array(); $country_module_list_array = array();
if (is_array($country_module_list_xml->module))
foreach ($country_module_list_xml->module as $k => $m) foreach ($country_module_list_xml->module as $k => $m)
$country_module_list_array[] = (string)$m->name; $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); $this->tab_modules_list['slider_list'] = array_intersect($this->tab_modules_list['slider_list'], $country_module_list_array);
@@ -1941,6 +1943,9 @@ class AdminControllerCore extends Controller
elseif ($this->context->shop->id != $shop_id) elseif ($this->context->shop->id != $shop_id)
$this->context->shop = new Shop($shop_id); $this->context->shop = new Shop($shop_id);
// Replace current default country
$this->context->country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
$this->initBreadcrumbs(); $this->initBreadcrumbs();
} }
@@ -2112,6 +2117,7 @@ class AdminControllerCore extends Controller
*/ */
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
{ {
if (!isset($this->list_id)) if (!isset($this->list_id))
$this->list_id = $this->table; $this->list_id = $this->table;
@@ -2166,12 +2172,20 @@ class AdminControllerCore extends Controller
$order_by = $this->fields_list[$order_by]['order_key']; $order_by = $this->fields_list[$order_by]['order_key'];
/* Determine offset from current page */ /* Determine offset from current page */
if ((isset($_POST['submitFilter'.$this->list_id]) || if ((isset($_POST['submitFilter'.$this->list_id]) ||
isset($_POST['submitFilter'.$this->list_id.'_x']) || isset($_POST['submitFilter'.$this->list_id.'_x']) ||
isset($_POST['submitFilter'.$this->list_id.'_y'])) && isset($_POST['submitFilter'.$this->list_id.'_y'])) &&
!empty($_POST['submitFilter'.$this->list_id]) && !empty($_POST['submitFilter'.$this->list_id]) &&
is_numeric($_POST['submitFilter'.$this->list_id])) is_numeric($_POST['submitFilter'.$this->list_id]))
$start = ((int)$_POST['submitFilter'.$this->list_id] - 1) * $limit; $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 */ /* Cache */
$this->_lang = (int)$id_lang; $this->_lang = (int)$id_lang;
@@ -2180,8 +2194,10 @@ class AdminControllerCore extends Controller
if (preg_match('/[.!]/', $order_by)) if (preg_match('/[.!]/', $order_by))
{ {
$order_by_split = preg_split('/[.!]/', $order_by); $order_by_split = preg_split('/[.!]/', $order_by);
$order_by = pSQL($order_by_split[0]).'.`'.pSQL($order_by_split[1]).'`'; $order_by = bqSQL($order_by_split[0]).'.`'.bqSQL($order_by_split[1]).'`';
} }
elseif ($order_by)
$order_by = '`'.bqSQL($order_by).'`';
$this->_orderWay = Tools::strtoupper($order_way); $this->_orderWay = Tools::strtoupper($order_way);
@@ -2241,8 +2257,6 @@ class AdminControllerCore extends Controller
$having_clause .= $this->_having.' '; $having_clause .= $this->_having.' ';
} }
$this->_listsql = ' $this->_listsql = '
SELECT SQL_CALC_FOUND_ROWS SELECT SQL_CALC_FOUND_ROWS
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : ''); '.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '');
@@ -2277,7 +2291,7 @@ class AdminControllerCore extends Controller
(isset($this->_filter) ? $this->_filter : '').$where_shop.' (isset($this->_filter) ? $this->_filter : '').$where_shop.'
'.(isset($this->_group) ? $this->_group.' ' : '').' '.(isset($this->_group) ? $this->_group.' ' : '').'
'.$having_clause.' '.$having_clause.'
ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way). ORDER BY '.((str_replace('`', '', $order_by) == $this->identifier) ? 'a.' : '').$order_by.' '.pSQL($order_way).
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : ''). ($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').
(($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : ''); (($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');
@@ -2329,22 +2343,20 @@ class AdminControllerCore extends Controller
public function getLanguages() public function getLanguages()
{ {
$cookie = $this->context->cookie; $cookie = $this->context->cookie;
$this->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $this->allow_employee_form_lang = (int)Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG');
if ($this->allow_employee_form_lang && !$cookie->employee_form_lang) if ($this->allow_employee_form_lang && !$cookie->employee_form_lang)
$cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$use_lang_from_cookie = false;
$lang_exists = false;
$this->_languages = Language::getLanguages(false); $this->_languages = Language::getLanguages(false);
if ($this->allow_employee_form_lang)
foreach ($this->_languages as $lang) foreach ($this->_languages as $lang)
if ($cookie->employee_form_lang == $lang['id_lang']) if (isset($cookie->employee_form_lang) && $cookie->employee_form_lang == $lang['id_lang'])
$use_lang_from_cookie = true; $lang_exists = true;
if (!$use_lang_from_cookie)
$this->default_form_language = (int)Configuration::get('PS_LANG_DEFAULT'); $this->default_form_language = $lang_exists ? (int)$cookie->employee_form_lang : (int)Configuration::get('PS_LANG_DEFAULT');
else
$this->default_form_language = (int)$cookie->employee_form_lang;
foreach ($this->_languages as $k => $language) foreach ($this->_languages as $k => $language)
$this->_languages[$k]['is_default'] = (int)($language['id_lang'] == $this->default_form_language); $this->_languages[$k]['is_default'] = ((int)($language['id_lang'] == $this->default_form_language));
return $this->_languages; return $this->_languages;
} }
@@ -2426,103 +2438,66 @@ class AdminControllerCore extends Controller
if (!$class_name) if (!$class_name)
$class_name = $this->className; $class_name = $this->className;
/* Class specific validation rules */ $object = new $class_name();
if (!empty($class_name))
$rules = call_user_func(array($class_name, 'getValidationRules'), $class_name); if (method_exists($this, 'getValidationRules'))
$definition = $this->getValidationRules();
else
$definition = ObjectModel::getDefinition($class_name);
if (isset($rules) && count($rules) && (count($rules['requiredLang']) || count($rules['sizeLang']) || count($rules['validateLang'])))
{
/* Language() instance determined by default language */
$default_language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); $default_language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
/* All availables languages */ foreach ($definition['fields'] as $field => $def)
$languages = Language::getLanguages(false); {
} $skip = array();
if (in_array($field, array('passwd', 'no-picture')))
$skip = array('required');
/* Checking for required fields */ if (isset($def['lang']) && $def['lang'] && isset($def['required']) && $def['required'])
if (isset($rules['required']) && is_array($rules['required'])) {
foreach ($rules['required'] as $field) $value = Tools::getValue($field.'_'.$default_language->id);
if (($value = Tools::getValue($field)) == false && (string)$value != '0') if (Tools::isEmpty($value))
if (!Tools::getValue($this->identifier) || ($field != 'passwd' && $field != 'no-picture')) $this->errors[$field.'_'.$default_language->id] = sprintf(
$this->errors[$field] = sprintf(
Tools::displayError('The %s field is required.'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
);
/* Checking for multilingual required fields */
if (isset($rules['requiredLang']) && is_array($rules['requiredLang']))
foreach ($rules['requiredLang'] as $field_lang)
if (($empty = Tools::getValue($field_lang.'_'.$default_language->id)) === false || $empty !== '0' && empty($empty))
$this->errors[$field_lang.'_'.$default_language->id] = sprintf(
Tools::displayError('The field %1$s is required at least in %2$s.'), Tools::displayError('The field %1$s is required at least in %2$s.'),
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name), $object->displayFieldName($field, $class_name),
$default_language->name $default_language->name
); );
/* Checking for maximum fields sizes */ foreach (Language::getLanguages(false) as $language)
if (isset($rules['size']) && is_array($rules['size']))
foreach ($rules['size'] as $field => $max_length)
if (Tools::getValue($field) !== false && Tools::strlen(Tools::getValue($field)) > $max_length)
$this->errors[$field] = sprintf(
Tools::displayError('The %1$s field is too long (%2$d chars max).'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name),
$max_length
);
/* Checking for maximum multilingual fields size */
if (isset($rules['sizeLang']) && is_array($rules['sizeLang']))
foreach ($rules['sizeLang'] as $field_lang => $max_length)
foreach ($languages as $language)
{ {
$field_lang_value = Tools::getValue($field_lang.'_'.$language['id_lang']); $value = Tools::getValue($field.'_'.$language['id_lang']);
if ($field_lang_value !== false && Tools::strlen($field_lang_value) > $max_length) if (!empty($value))
$this->errors[$field_lang.'_'.$language['id_lang']] = sprintf( if (($error = $object->validateField($field, $value, $language['id_lang'], $skip, true)) !== true)
Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'), $this->errors[$field.'_'.$language['id_lang']] = $error;
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
$language['name'],
$max_length
);
} }
}
else
if (($error = $object->validateField($field, Tools::getValue($field), null, $skip, true)) !== true)
$this->errors[$field] = $error;
}
/* Overload this method for custom checking */ /* Overload this method for custom checking */
$this->_childValidation(); $this->_childValidation();
/* Checking for fields validity */
if (isset($rules['validate']) && is_array($rules['validate']))
foreach ($rules['validate'] as $field => $function)
if (($value = Tools::getValue($field)) !== false && ($field != 'passwd'))
if (!Validate::$function($value) && !empty($value))
$this->errors[$field] = sprintf(
Tools::displayError('The %s field is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
);
/* Checking for passwd_old validity */
if (($value = Tools::getValue('passwd')) != false)
{
if ($class_name == 'Employee' && !Validate::isPasswdAdmin($value))
$this->errors['passwd'] = sprintf(
Tools::displayError('The %s field is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
);
elseif ($class_name == 'Customer' && !Validate::isPasswd($value))
$this->errors['passwd'] = sprintf(
Tools::displayError('The %s field is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
);
}
/* Checking for multilingual fields validity */ /* Checking for multilingual fields validity */
if (isset($rules['validateLang']) && is_array($rules['validateLang'])) if (isset($rules['validateLang']) && is_array($rules['validateLang']))
foreach ($rules['validateLang'] as $field_lang => $function) foreach ($rules['validateLang'] as $field_lang => $function)
foreach ($languages as $language) foreach ($languages as $language)
if (($value = Tools::getValue($field_lang.'_'.$language['id_lang'])) !== false && !empty($value)) 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( $this->errors[$field_lang.'_'.$language['id_lang']] = sprintf(
Tools::displayError('The %1$s field (%2$s) is invalid.'), Tools::displayError('The %1$s field (%2$s) is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name), call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
$language['name'] $language['name']
); );
} }
}
/** /**
* Overload this method for custom checking * Overload this method for custom checking
@@ -2798,7 +2773,7 @@ class AdminControllerCore extends Controller
} }
if ($delete_ok) if ($delete_ok)
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$to_delete->id, true, (int)$this->context->employee->id); Logger::addLog(sprintf($this->l('%s deletion', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$to_delete->id, true, (int)$this->context->employee->id);
else else
$this->errors[] = sprintf(Tools::displayError('Can\'t delete #%d'), $id); $this->errors[] = sprintf(Tools::displayError('Can\'t delete #%d'), $id);
} }
+4 -2
View File
@@ -175,8 +175,8 @@ abstract class ControllerCore
// then using displayAjax[action] // then using displayAjax[action]
if ($this->ajax) if ($this->ajax)
{ {
$action = Tools::getValue('action'); $action = Tools::toCamelCase(Tools::getValue('action'), true);
if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action, true))) if (!empty($action) && method_exists($this, 'displayAjax'.$action))
$this->{'displayAjax'.$action}(); $this->{'displayAjax'.$action}();
elseif (method_exists($this, 'displayAjax')) elseif (method_exists($this, 'displayAjax'))
$this->displayAjax(); $this->displayAjax();
@@ -334,6 +334,7 @@ abstract class ControllerCore
} }
} }
else else
{
$plugin_path = Media::getJqueryPluginPath($name, $folder); $plugin_path = Media::getJqueryPluginPath($name, $folder);
if(!empty($plugin_path['css'])) if(!empty($plugin_path['css']))
@@ -341,6 +342,7 @@ abstract class ControllerCore
if(!empty($plugin_path['js'])) if(!empty($plugin_path['js']))
$this->addJS($plugin_path['js']); $this->addJS($plugin_path['js']);
} }
}
/** /**
* @since 1.5 * @since 1.5
+8 -3
View File
@@ -251,6 +251,8 @@ class FrontControllerCore extends Controller
$this->context->cart = $cart; $this->context->cart = $cart;
CartRule::autoAddToCart($this->context); CartRule::autoAddToCart($this->context);
} }
else
$this->context->cart = $cart;
/* get page name to display it in body id */ /* get page name to display it in body id */
@@ -325,7 +327,7 @@ class FrontControllerCore extends Controller
'currencies' => Currency::getCurrencies(), 'currencies' => Currency::getCurrencies(),
'languages' => $languages, 'languages' => $languages,
'meta_language' => implode('-', $meta_language), 'meta_language' => implode('-', $meta_language),
'priceDisplay' => Product::getTaxCalculationMethod(), 'priceDisplay' => Product::getTaxCalculationMethod((int)$this->context->cookie->id_customer),
'add_prod_display' => (int)Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'add_prod_display' => (int)Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'shop_name' => Configuration::get('PS_SHOP_NAME'), 'shop_name' => Configuration::get('PS_SHOP_NAME'),
'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'), 'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'),
@@ -578,6 +580,9 @@ class FrontControllerCore extends Controller
header('HTTP/1.1 503 temporarily overloaded'); header('HTTP/1.1 503 temporarily overloaded');
$this->context->smarty->assign($this->initLogoAndFavicon()); $this->context->smarty->assign($this->initLogoAndFavicon());
$this->context->smarty->assign(array(
'HOOK_MAINTENANCE' => Hook::exec('displayMaintenance', array()),
));
$template_dir = ($this->context->getMobileDevice() == true ? _PS_THEME_MOBILE_DIR_ : _PS_THEME_DIR_); $template_dir = ($this->context->getMobileDevice() == true ? _PS_THEME_MOBILE_DIR_ : _PS_THEME_DIR_);
$this->smartyOutputContent($template_dir.'maintenance.tpl'); $this->smartyOutputContent($template_dir.'maintenance.tpl');
@@ -845,7 +850,7 @@ class FrontControllerCore extends Controller
if (!is_numeric(Tools::getValue('p', 1)) || Tools::getValue('p', 1) < 0) if (!is_numeric(Tools::getValue('p', 1)) || Tools::getValue('p', 1) < 0)
Tools::redirect(self::$link->getPaginationLink(false, false, $this->n, false, 1, false)); Tools::redirect(self::$link->getPaginationLink(false, false, $this->n, false, 1, false));
$current_url = tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']); $current_url = Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']);
//delete parameter page //delete parameter page
$current_url = preg_replace('/(\?)?(&amp;)?p=\d+/', '$1', $current_url); $current_url = preg_replace('/(\?)?(&amp;)?p=\d+/', '$1', $current_url);
@@ -914,7 +919,7 @@ class FrontControllerCore extends Controller
$ips = array_map('trim', $ips); $ips = array_map('trim', $ips);
if (is_array($ips) && count($ips)) if (is_array($ips) && count($ips))
foreach ($ips as $ip) foreach ($ips as $ip)
if (!empty($ip) && strpos($user_ip, $ip) === 0) if (!empty($ip) && preg_match('/^'.$ip.'.*/', $user_ip))
$allowed = true; $allowed = true;
return $allowed; return $allowed;
} }
+1 -1
View File
@@ -60,7 +60,7 @@ class ModuleFrontControllerCore extends FrontController
elseif (Tools::file_exists_cache($this->getTemplatePath().$template)) elseif (Tools::file_exists_cache($this->getTemplatePath().$template))
$this->template = $this->getTemplatePath().$template; $this->template = $this->getTemplatePath().$template;
else else
throw new PrestaShopException("Template '$template'' not found"); throw new PrestaShopException("Template '$template' not found");
} }
/** /**
+2 -2
View File
@@ -523,13 +523,13 @@ abstract class DbCore
$this->last_cached = true; $this->last_cached = true;
return $result; return $result;
} }
$this->result = $this->query($sql); $this->result = $this->query($sql);
if (!$this->result) if (!$this->result)
return false; return false;
$this->last_cached = false; $this->last_cached = false;
$result = $this->nextRow($this->result); $result = $this->nextRow($this->result);
if (is_null($result))
$result = false;
if ($use_cache && $this->is_cache_enabled) if ($use_cache && $this->is_cache_enabled)
Cache::getInstance()->setQuery($sql, $result); Cache::getInstance()->setQuery($sql, $result);
return $result; return $result;
+7 -9
View File
@@ -27,7 +27,7 @@
class HelperCore class HelperCore
{ {
public $currentIndex; public $currentIndex;
public $table; public $table = 'configuration';
public $identifier; public $identifier;
public $token; public $token;
public $toolbar_btn; public $toolbar_btn;
@@ -213,20 +213,18 @@ class HelperCore
$html = ' $html = '
<script type="text/javascript"> <script type="text/javascript">
var inputName = "'.$input_name.'"; var inputName = \''.addcslashes($input_name, '\'').'\';'."\n";
';
if (count($selected_cat) > 0) if (count($selected_cat) > 0)
{ {
if (isset($selected_cat[0])) if (isset($selected_cat[0]))
$html .= 'var selectedCat = "'.implode(',', $selected_cat).'";'; $html .= ' var selectedCat = '.(int)implode(',', $selected_cat).';'."\n";
else else
$html .= 'var selectedCat = "'.implode(',', array_keys($selected_cat)).'";'; $html .= ' var selectedCat = '.(int)implode(',', array_keys($selected_cat)).';'."\n";
} }
else else
$html .= 'var selectedCat = "";'; $html .= ' var selectedCat = \'\';'."\n";
$html .= ' $html .= ' var selectedLabel = \''.$translations['selected'].'\';
var selectedLabel = \''.$translations['selected'].'\'; var home = \''.addcslashes($root['name'], '\'').'\';
var home = \''.$root['name'].'\';
var use_radio = '.(int)$use_radio.';'; var use_radio = '.(int)$use_radio.';';
if (!$use_in_popup) if (!$use_in_popup)
$html .= ' $html .= '
-2
View File
@@ -37,8 +37,6 @@ class HelperFormCore extends Helper
/** @var array values of form fields */ /** @var array values of form fields */
public $fields_value = array(); public $fields_value = array();
public $table = 'configuration';
public $name_controller = ''; public $name_controller = '';
/** @var string if not null, a title will be added on that list */ /** @var string if not null, a title will be added on that list */
+5 -5
View File
@@ -444,13 +444,13 @@ class HelperListCore extends Helper
self::$cache_lang['Delete'] = $this->l('Delete', 'Helper'); self::$cache_lang['Delete'] = $this->l('Delete', 'Helper');
if (!array_key_exists('DeleteItem', self::$cache_lang)) if (!array_key_exists('DeleteItem', self::$cache_lang))
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper'); self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper', true, false);
if (!array_key_exists('Name', self::$cache_lang)) if (!array_key_exists('Name', self::$cache_lang))
self::$cache_lang['Name'] = $this->l('Name:', 'Helper'); self::$cache_lang['Name'] = $this->l('Name:', 'Helper', true, false);
if (!is_null($name)) if (!is_null($name))
$name = '\n\n'.self::$cache_lang['Name'].' '.$name; $name = addcslashes('\n\n'.self::$cache_lang['Name'].' '.$name, '\'');
$data = array( $data = array(
$this->identifier => $id, $this->identifier => $id,
@@ -459,7 +459,7 @@ class HelperListCore extends Helper
); );
if ($this->specificConfirmDelete !== false) if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\'')); $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(self::$cache_lang['DeleteItem'].$name);
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data)); $tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
@@ -513,7 +513,7 @@ class HelperListCore extends Helper
if (Tools::getIsset($this->table.'Orderby')) if (Tools::getIsset($this->table.'Orderby'))
$order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay)); $order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay));
$action = $this->currentIndex.$identifier.'&token='.$token.$order.'#'.$this->table; $action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->table;
/* Determine current page number */ /* Determine current page number */
$page = (int)Tools::getValue('submitFilter'.$this->list_id); $page = (int)Tools::getValue('submitFilter'.$this->list_id);
+45 -10
View File
@@ -203,7 +203,7 @@ abstract class ModuleCore
} }
// Check PS version compliancy // Check PS version compliancy
if (version_compare(_PS_VERSION_, $this->ps_versions_compliancy['min']) < 0 || version_compare(_PS_VERSION_, $this->ps_versions_compliancy['max']) >= 0) if (version_compare(_PS_VERSION_, $this->ps_versions_compliancy['min']) < 0 || version_compare(_PS_VERSION_, $this->ps_versions_compliancy['max']) > 0)
{ {
$this->_errors[] = $this->l('The version of your module is not compliant with your PrestaShop version.'); $this->_errors[] = $this->l('The version of your module is not compliant with your PrestaShop version.');
return false; return false;
@@ -1234,11 +1234,7 @@ abstract class ModuleCore
$module->interest = 0; $module->interest = 0;
} }
usort($module_list, create_function('$a,$b', ' usort($module_list, create_function('$a,$b', 'return strnatcasecmp($a->displayName, $b->displayName);'));
if ($a->displayName == $b->displayName)
return 0;
return ($a->displayName < $b->displayName) ? -1 : 1;
'));
if ($errors) if ($errors)
{ {
@@ -1262,7 +1258,7 @@ abstract class ModuleCore
$modules = scandir(_PS_MODULE_DIR_); $modules = scandir(_PS_MODULE_DIR_);
foreach ($modules as $name) foreach ($modules as $name)
{ {
if (is_dir(_PS_MODULE_DIR_.$name) && Tools::file_exists_cache(_PS_MODULE_DIR_.$name.'/'.$name.'.php')) if (is_dir(_PS_MODULE_DIR_.$name.DIRECTORY_SEPARATOR) && Tools::file_exists_cache(_PS_MODULE_DIR_.$name.'/'.$name.'.php'))
{ {
if (!Validate::isModuleName($name)) if (!Validate::isModuleName($name))
throw new PrestaShopException(sprintf('Module %s is not a valid module name', $name)); throw new PrestaShopException(sprintf('Module %s is not a valid module name', $name));
@@ -1297,6 +1293,26 @@ abstract class ModuleCore
return $db->executeS('SELECT * FROM `'._DB_PREFIX_.'module` m WHERE `name` NOT IN ('.implode(',', $arr_native_modules).') '); return $db->executeS('SELECT * FROM `'._DB_PREFIX_.'module` m WHERE `name` NOT IN ('.implode(',', $arr_native_modules).') ');
} }
public static function getNativeModuleList()
{
$module_list_xml = _PS_ROOT_DIR_.self::CACHE_FILE_MODULES_LIST;
if (!file_exists($module_list_xml))
return false;
$native_modules = simplexml_load_file($module_list_xml);
$native_modules = $native_modules->modules;
$modules = array();
foreach ($native_modules as $native_modules_type)
if (in_array($native_modules_type['type'], array('native', 'partner')))
{
foreach ($native_modules_type->module as $module)
$modules[] = $module['name'];
}
return $modules;
}
/** /**
* Return installed modules * Return installed modules
* *
@@ -1580,6 +1596,18 @@ abstract class ModuleCore
return Cache::retrieve('Module::isInstalled'.$module_name); return Cache::retrieve('Module::isInstalled'.$module_name);
} }
public function isEnabledForShopContext()
{
$shop_list = Shop::getContextListShopID();
return (bool)Db::getInstance()->getValue('
SELECT COUNT(*) n
FROM `'._DB_PREFIX_.'module_shop`
WHERE id_module='.(int)$this->id.' AND id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID())).')
GROUP BY id_module
HAVING n='.(int)count(Shop::getContextListShopID())
);
}
public static function isEnabled($module_name) public static function isEnabled($module_name)
{ {
if (!Cache::isStored('Module::isEnabled'.$module_name)) if (!Cache::isStored('Module::isEnabled'.$module_name))
@@ -1730,7 +1758,7 @@ abstract class ModuleCore
{ {
Tools::enableCache(); Tools::enableCache();
if ($cache_id === null) if ($cache_id === null)
$cache_id = Module::getCacheId($this->name); $cache_id = $this->name;
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath($template), $cache_id, $compile_id); Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath($template), $cache_id, $compile_id);
Tools::restoreCacheSettings(); Tools::restoreCacheSettings();
} }
@@ -1757,6 +1785,7 @@ abstract class ModuleCore
@unlink($file); @unlink($file);
@file_put_contents($file, $xml); @file_put_contents($file, $xml);
} }
@chmod($file, 0664);
} }
} }
@@ -1835,7 +1864,13 @@ abstract class ModuleCore
*/ */
public static function getModuleIdByName($name) public static function getModuleIdByName($name)
{ {
return Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = "'.pSQL($name).'"'); $cache_id = 'Module::getModuleIdByName_'.pSQL($name);
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = "'.pSQL($name).'"');
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
@@ -2082,7 +2117,7 @@ abstract class ModuleCore
// Remplacer la ligne de declaration par "remove" // Remplacer la ligne de declaration par "remove"
foreach ($override_file as $line_number => &$line_content) foreach ($override_file as $line_number => &$line_content)
if (preg_match('/(public|private|protected)\s+(static\s+)?\$'.$property->getName().'/i', $line_content)) if (preg_match('/(public|private|protected|const)\s+(static\s+)?(\$)?'.$property->getName().'/i', $line_content))
{ {
$line_content = '#--remove--#'; $line_content = '#--remove--#';
break; break;
+85 -25
View File
@@ -721,11 +721,17 @@ class OrderCore extends ObjectModel
public static function getDiscountsCustomer($id_customer, $id_cart_rule) public static function getDiscountsCustomer($id_customer, $id_cart_rule)
{ {
return Db::getInstance()->getValue(' $cache_id = 'Order::getDiscountsCustomer_'.(int)$id_customer.'-'.(int)$id_cart_rule;
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('
SELECT COUNT(*) FROM `'._DB_PREFIX_.'orders` o SELECT COUNT(*) FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN '._DB_PREFIX_.'order_cart_rule ocr ON (ocr.id_order = o.id_order) LEFT JOIN '._DB_PREFIX_.'order_cart_rule ocr ON (ocr.id_order = o.id_order)
WHERE o.id_customer = '.(int)$id_customer.' WHERE o.id_customer = '.(int)$id_customer.'
AND ocr.id_cart_rule = '.(int)$id_cart_rule); AND ocr.id_cart_rule = '.(int)$id_cart_rule);
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**
@@ -1086,6 +1092,41 @@ class OrderCore extends ObjectModel
'); ');
} }
public static function setLastInvoiceNumber($order_invoice_id, $id_shop)
{
if (!$order_invoice_id)
return false;
$number = Configuration::get('PS_INVOICE_START_NUMBER', null, null, $id_shop);
// If invoice start number has been set, you clean the value of this configuration
if ($number)
Configuration::updateValue('PS_INVOICE_START_NUMBER', false, false, null, $id_shop);
$sql = 'UPDATE `'._DB_PREFIX_.'order_invoice` SET number =';
if ($number)
$sql .= (int)$number;
else
$sql .= '(SELECT new_number FROM (SELECT (MAX(`number`) + 1) AS new_number
FROM `'._DB_PREFIX_.'order_invoice`) AS result)';
$sql .=' WHERE `id_order_invoice` = '.(int)$order_invoice_id;
return Db::getInstance()->execute($sql);
}
public function getInvoiceNumber($order_invoice_id)
{
if (!$order_invoice_id)
return false;
return Db::getInstance()->getValue('
SELECT `number`
FROM `'._DB_PREFIX_.'order_invoice`
WHERE `id_order_invoice` = '.(int)$order_invoice_id
);
}
/** /**
* This method allows to generate first invoice of the current order * This method allows to generate first invoice of the current order
*/ */
@@ -1095,13 +1136,7 @@ class OrderCore extends ObjectModel
{ {
$order_invoice = new OrderInvoice(); $order_invoice = new OrderInvoice();
$order_invoice->id_order = $this->id; $order_invoice->id_order = $this->id;
$order_invoice->number = Configuration::get('PS_INVOICE_START_NUMBER', null, null, $this->id_shop); $order_invoice->number = 0;
// If invoice start number has been set, you clean the value of this configuration
if ($order_invoice->number)
Configuration::updateValue('PS_INVOICE_START_NUMBER', false, false, null, $this->id_shop);
else
$order_invoice->number = Order::getLastInvoiceNumber() + 1;
$invoice_address = new Address((int)$this->id_address_invoice); $invoice_address = new Address((int)$this->id_address_invoice);
$carrier = new Carrier((int)$this->id_carrier); $carrier = new Carrier((int)$this->id_carrier);
$tax_calculator = $carrier->getTaxCalculator($invoice_address); $tax_calculator = $carrier->getTaxCalculator($invoice_address);
@@ -1120,6 +1155,7 @@ class OrderCore extends ObjectModel
// Save Order invoice // Save Order invoice
$order_invoice->add(); $order_invoice->add();
$this->setLastInvoiceNumber($order_invoice->id, $this->id_shop);
$order_invoice->saveCarrierTaxCalculator($tax_calculator->getTaxesAmount($order_invoice->total_shipping_tax_excl)); $order_invoice->saveCarrierTaxCalculator($tax_calculator->getTaxesAmount($order_invoice->total_shipping_tax_excl));
@@ -1175,11 +1211,46 @@ class OrderCore extends ObjectModel
// Keep it for backward compatibility, to remove on 1.6 version // Keep it for backward compatibility, to remove on 1.6 version
$this->invoice_date = $order_invoice->date_add; $this->invoice_date = $order_invoice->date_add;
$this->invoice_number = $order_invoice->number; $this->invoice_number = $this->getInvoiceNumber($order_invoice->id);
$this->update(); $this->update();
} }
} }
public function setDeliveryNumber($order_invoice_id, $id_shop)
{
if (!$order_invoice_id)
return false;
$number = Configuration::get('PS_DELIVERY_NUMBER', null, null, $id_shop);
// If invoice start number has been set, you clean the value of this configuration
if ($number)
Configuration::updateValue('PS_DELIVERY_NUMBER', false, false, null, $id_shop);
$sql = 'UPDATE `'._DB_PREFIX_.'order_invoice` SET delivery_number =';
if ($number)
$sql .= (int)$number;
else
$sql .= '(SELECT new_number FROM (SELECT (MAX(`delivery_number`) + 1) AS new_number
FROM `'._DB_PREFIX_.'order_invoice`) AS result)';
$sql .=' WHERE `id_order_invoice` = '.(int)$order_invoice_id;
return Db::getInstance()->execute($sql);
}
public function getDeliveryNumber($order_invoice_id)
{
if (!$order_invoice_id)
return false;
return Db::getInstance()->getValue('
SELECT `delivery_number`
FROM `'._DB_PREFIX_.'order_invoice`
WHERE `id_order_invoice` = '.(int)$order_invoice_id
);
}
public function setDelivery() public function setDelivery()
{ {
// Get all invoice // Get all invoice
@@ -1189,23 +1260,13 @@ class OrderCore extends ObjectModel
if ($order_invoice->delivery_number) if ($order_invoice->delivery_number)
continue; continue;
$number = (int)Configuration::get('PS_DELIVERY_NUMBER', null, null, $this->id_shop);
if (!$number)
{
//if delivery number is not set or wrong, we set a default one.
Configuration::updateValue('PS_DELIVERY_NUMBER', 1, false, null, $this->id_shop);
$number = 1;
}
// Set delivery number on invoice // Set delivery number on invoice
$order_invoice->delivery_number = $number; $order_invoice->delivery_number = 0;
$order_invoice->delivery_date = date('Y-m-d H:i:s'); $order_invoice->delivery_date = date('Y-m-d H:i:s');
// Update Order Invoice // Update Order Invoice
$order_invoice->update(); $order_invoice->update();
$this->setDeliveryNumber($order_invoice->id, $this->id_shop);
// Keep for backward compatibility $this->delivery_number = $this->getDeliveryNumber($order_invoice->id);
$this->delivery_number = $number;
Configuration::updateValue('PS_DELIVERY_NUMBER', $number + 1, false, null, $this->id_shop);
} }
// Keep it for backward compatibility, to remove on 1.6 version // Keep it for backward compatibility, to remove on 1.6 version
@@ -1890,10 +1951,9 @@ class OrderCore extends ObjectModel
} }
/** /**
* Return a unique reference like : GWJTHMZUN#2 * Return id of carrier
* *
* With multishipping, order reference are the same for all orders made with the same cart * Get id of the carrier used in order
* in this case this method suffix the order reference by a # and the order number
* *
* @since 1.5.5.0 * @since 1.5.5.0
*/ */
+3 -3
View File
@@ -243,7 +243,7 @@ class OrderInvoiceCore extends ObjectModel
WHERE od.`id_order` = '.(int)$this->id_order.' WHERE od.`id_order` = '.(int)$this->id_order.'
AND od.`id_order_invoice` = '.(int)$this->id.' AND od.`id_order_invoice` = '.(int)$this->id.'
AND od.`tax_computation_method` = '.(int)TaxCalculator::ONE_AFTER_ANOTHER_METHOD 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 // sum by order details in order to retrieve real taxes rate
$taxes_infos = Db::getInstance()->executeS(' $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 FROM `'._DB_PREFIX_.'order_detail_tax` odt
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = odt.`id_tax`) 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`) LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = odt.`id_order_detail`)
@@ -466,7 +466,7 @@ class OrderInvoiceCore extends ObjectModel
FROM `'._DB_PREFIX_.'order_invoice` oi FROM `'._DB_PREFIX_.'order_invoice` oi
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = oi.`id_order`) LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = oi.`id_order`)
WHERE DATE_ADD(oi.delivery_date, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\' WHERE DATE_ADD(oi.delivery_date, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\'
AND oi.date_add >= \''.pSQL($date_from).'\' AND oi.delivery_date >= \''.pSQL($date_from).'\'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
ORDER BY oi.delivery_date ASC ORDER BY oi.delivery_date ASC
'); ');
+1 -1
View File
@@ -49,7 +49,7 @@ class OrderPaymentCore extends ObjectModel
'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true), 'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true),
'payment_method' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), '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), 'transaction_id' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
'card_number' => 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), 'card_brand' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
+1
View File
@@ -144,6 +144,7 @@ class OrderReturnCore extends ObjectModel
$data[$k]['type'] = 'Return'; $data[$k]['type'] = 'Return';
$data[$k]['tracking_number'] = $or['id_order_return']; $data[$k]['tracking_number'] = $or['id_order_return'];
$data[$k]['can_edit'] = false; $data[$k]['can_edit'] = false;
$data[$k]['reference'] = Order::getUniqReferenceOf($or['id_order']);
} }
return $data; return $data;
} }
+7 -1
View File
@@ -112,12 +112,18 @@ class OrderStateCore extends ObjectModel
*/ */
public static function getOrderStates($id_lang) public static function getOrderStates($id_lang)
{ {
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' $cache_id = 'OrderState::getOrderStates_'.(int)$id_lang;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'order_state` os FROM `'._DB_PREFIX_.'order_state` os
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$id_lang.') LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$id_lang.')
WHERE deleted = 0 WHERE deleted = 0
ORDER BY `name` ASC'); ORDER BY `name` ASC');
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
} }
/** /**

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