Mage_Core_Modules - Version 1.9.3.0

Version Notes

1.9.3.0

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Core_Modules
Version 1.9.3.0
Comparing to
See all releases


Code changes from version 1.9.2.4 to 1.9.3.0

Files changed (178) hide show
  1. .htaccess.sample +15 -0
  2. RELEASE_NOTES.txt +11 -1
  3. api.php +5 -2
  4. app/Mage.php +2 -2
  5. app/code/core/Mage/Admin/Model/User.php +3 -3
  6. app/code/core/Mage/Admin/etc/config.xml +1 -1
  7. app/code/core/Mage/Api/Model/Server/Handler/Abstract.php +47 -6
  8. app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php +1 -0
  9. app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php +7 -2
  10. app/code/core/Mage/Catalog/Block/Product/Abstract.php +11 -6
  11. app/code/core/Mage/Catalog/Block/Product/List.php +2 -5
  12. app/code/core/Mage/Catalog/Block/Product/View.php +6 -61
  13. app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php +33 -26
  14. app/code/core/Mage/Catalog/Helper/Image.php +8 -1
  15. app/code/core/Mage/Catalog/Helper/Product.php +40 -0
  16. app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php +195 -0
  17. app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Groupprice/Abstract.php +6 -3
  18. app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php +4 -1
  19. app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php +4 -4
  20. app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php +1 -1
  21. app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice.php +13 -0
  22. app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php +3 -3
  23. app/code/core/Mage/Catalog/Model/Resource/Product/Link/Product/Collection.php +48 -2
  24. app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php +11 -6
  25. app/code/core/Mage/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.19.1.3-1.6.0.0.19.1.4.php +77 -0
  26. app/code/core/Mage/Catalog/etc/config.xml +2 -1
  27. app/code/core/Mage/Catalog/etc/system.xml +9 -0
  28. app/code/core/Mage/Catalog/sql/catalog_setup/upgrade-1.6.0.0.19.1.2-1.6.0.0.19.1.3.php +44 -0
  29. app/code/core/Mage/Catalog/sql/catalog_setup/upgrade-1.6.0.0.19.1.4-1.6.0.0.19.1.5.php +37 -0
  30. app/code/core/Mage/CatalogInventory/Model/Observer.php +1 -0
  31. app/code/core/Mage/CatalogInventory/Model/Stock/Item.php +21 -0
  32. app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php +26 -4
  33. app/code/core/Mage/CatalogSearch/Model/Resource/Advanced.php +1 -1
  34. app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php +40 -42
  35. app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php +173 -13
  36. app/code/core/Mage/CatalogSearch/Model/Resource/Helper/Mysql4.php +16 -1
  37. app/code/core/Mage/Checkout/Model/Cart.php +9 -6
  38. app/code/core/Mage/Checkout/Model/Type/Multishipping.php +3 -0
  39. app/code/core/Mage/Checkout/Model/Type/Onepage.php +16 -0
  40. app/code/core/Mage/Checkout/controllers/CartController.php +26 -1
  41. app/code/core/Mage/Checkout/controllers/OnepageController.php +22 -10
  42. app/code/core/Mage/Cms/Block/Page.php +24 -2
  43. app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php +2 -1
  44. app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php +5 -4
  45. app/code/core/Mage/ConfigurableSwatches/Block/Catalog/Product/List/Price.php +95 -0
  46. app/code/core/Mage/ConfigurableSwatches/Helper/Data.php +27 -1
  47. app/code/core/Mage/ConfigurableSwatches/Helper/List/Price.php +118 -0
  48. app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php +52 -10
  49. app/code/core/Mage/ConfigurableSwatches/Model/Observer.php +14 -7
  50. app/code/core/Mage/ConfigurableSwatches/Model/Resource/Catalog/Product/Attribute/Super/Collection.php +52 -33
  51. app/code/core/Mage/ConfigurableSwatches/etc/system.xml +9 -0
  52. app/code/core/Mage/Core/Block/Abstract.php +11 -1
  53. app/code/core/Mage/Core/Block/Template.php +1 -1
  54. app/code/core/Mage/Core/Controller/Varien/Action.php +1 -0
  55. app/code/core/Mage/Core/Helper/String.php +41 -1
  56. app/code/core/Mage/Core/Helper/Url.php +1 -1
  57. app/code/core/Mage/Core/Model/Config.php +3 -0
  58. app/code/core/Mage/Core/Model/Email/Queue.php +0 -2
  59. app/code/core/Mage/Core/Model/Email/Template.php +1 -0
  60. app/code/core/Mage/Core/Model/Email/Template/Abstract.php +15 -31
  61. app/code/core/Mage/Core/Model/Encryption.php +2 -2
  62. app/code/core/Mage/Core/Model/File/Storage/Abstract.php +3 -3
  63. app/code/core/Mage/Core/Model/File/Validator/AvailablePath.php +6 -6
  64. app/code/core/Mage/Core/Model/Input/Filter/MaliciousCode.php +7 -1
  65. app/code/core/Mage/Core/Model/Layout.php +1 -1
  66. app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php +3 -3
  67. app/code/core/Mage/Core/Model/Resource/Variable/Collection.php +1 -1
  68. app/code/core/Mage/Core/Model/Session/Abstract/Varien.php +21 -0
  69. app/code/core/Mage/Core/etc/config.xml +8 -0
  70. app/code/core/Mage/Core/etc/jstranslator.xml +2 -2
  71. app/code/core/Mage/Core/etc/system.xml +1 -1
  72. app/code/core/Mage/Core/functions.php +35 -0
  73. app/code/core/Mage/Cron/Model/Schedule.php +5 -1
  74. app/code/core/Mage/Customer/Block/Address/Book.php +2 -1
  75. app/code/core/Mage/Customer/Helper/Data.php +37 -0
  76. app/code/core/Mage/Customer/Model/Customer.php +66 -8
  77. app/code/core/Mage/Customer/Model/Flowpassword.php +121 -0
  78. app/code/core/Mage/Customer/Model/Observer.php +13 -1
  79. app/code/core/Mage/Customer/Model/Resource/Flowpassword.php +44 -0
  80. app/code/core/Mage/Customer/Model/Resource/Flowpassword/Collection.php +44 -0
  81. app/code/core/Mage/Customer/controllers/AccountController.php +55 -25
  82. app/code/core/Mage/Customer/controllers/AddressController.php +3 -0
  83. app/code/core/Mage/Customer/data/customer_setup/data-upgrade-1.6.2.0.4-1.6.2.0.5.php +78 -0
  84. app/code/core/Mage/Customer/etc/config.xml +33 -2
  85. app/code/core/Mage/Customer/etc/system.xml +64 -1
  86. app/code/core/Mage/Customer/sql/customer_setup/upgrade-1.6.2.0.4-1.6.2.0.5.php +58 -0
  87. app/code/core/Mage/Dataflow/Model/Profile.php +14 -4
  88. app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +49 -21
  89. app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php +49 -24
  90. app/code/core/Mage/Downloadable/Helper/File.php +52 -612
  91. app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php +2 -3
  92. app/code/core/Mage/Eav/Model/Entity/Abstract.php +10 -5
  93. app/code/core/Mage/Eav/Model/Entity/Attribute.php +2 -1
  94. app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php +11 -2
  95. app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php +2 -2
  96. app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php +2 -0
  97. app/code/core/Mage/ImportExport/Helper/Data.php +13 -2
  98. app/code/core/Mage/ImportExport/Model/Export.php +47 -1
  99. app/code/core/Mage/ImportExport/Model/Export/Adapter/Abstract.php +17 -0
  100. app/code/core/Mage/ImportExport/Model/Export/Adapter/Csv.php +2 -0
  101. app/code/core/Mage/ImportExport/Model/Export/Entity/Abstract.php +58 -2
  102. app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php +312 -73
  103. app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php +161 -88
  104. app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php +1 -1
  105. app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php +62 -8
  106. app/code/core/Mage/ImportExport/Model/Import/Entity/Customer/Address.php +76 -36
  107. app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php +118 -46
  108. app/code/core/Mage/ImportExport/Model/Import/Entity/Product/Type/Configurable.php +27 -11
  109. app/code/core/Mage/ImportExport/Model/Import/Uploader.php +1 -1
  110. app/code/core/Mage/ImportExport/controllers/Adminhtml/ExportController.php +4 -1
  111. app/code/core/Mage/ImportExport/etc/config.xml +3 -0
  112. app/code/core/Mage/ImportExport/etc/system.xml +19 -0
  113. app/code/core/Mage/Oauth/Model/Server.php +3 -3
  114. app/code/core/Mage/Paygate/Model/Authorizenet.php +9 -3
  115. app/code/core/Mage/Payment/Block/Info/Checkmo.php +8 -2
  116. app/code/core/Mage/Payment/Model/Method/Cc.php +1 -1
  117. app/code/core/Mage/Paypal/Model/Api/Nvp.php +2 -1
  118. app/code/core/Mage/Paypal/Model/Express/Checkout.php +23 -1
  119. app/code/core/Mage/Paypal/Model/Resource/Payment/Transaction.php +20 -0
  120. app/code/core/Mage/Persistent/Model/Persistent/Config.php +3 -1
  121. app/code/core/Mage/Reports/Model/Product/Index/Abstract.php +20 -2
  122. app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php +29 -7
  123. app/code/core/Mage/Rss/Controller/Abstract.php +77 -0
  124. app/code/core/Mage/Rss/controllers/CatalogController.php +26 -38
  125. app/code/core/Mage/Rss/controllers/IndexController.php +2 -15
  126. app/code/core/Mage/Rss/controllers/OrderController.php +22 -18
  127. app/code/core/Mage/Rss/data/rss_setup/data-install-1.6.0.0.php +34 -0
  128. app/code/core/Mage/Rss/etc/config.xml +7 -3
  129. app/code/core/Mage/Rss/etc/system.xml +84 -5
  130. app/code/core/Mage/Sales/Helper/Guest.php +1 -1
  131. app/code/core/Mage/Sales/Model/Email/Template.php +1 -1
  132. app/code/core/Mage/Sales/Model/Order.php +17 -3
  133. app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php +4 -36
  134. app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php +1 -1
  135. app/code/core/Mage/Sales/Model/Quote/Item.php +1 -1
  136. app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php +4 -1
  137. app/code/core/Mage/Sales/Model/Resource/Order/Payment.php +24 -0
  138. app/code/core/Mage/Sales/Model/Resource/Order/Payment/Transaction.php +24 -0
  139. app/code/core/Mage/Sales/Model/Resource/Quote.php +2 -2
  140. app/code/core/Mage/Sales/Model/Resource/Quote/Payment.php +20 -0
  141. app/code/core/Mage/Sales/Model/Resource/Recurring/Profile.php +27 -0
  142. app/code/core/Mage/Sales/Model/Resource/Report/Bestsellers.php +3 -8
  143. app/code/core/Mage/Sales/Model/Resource/Report/Bestsellers/Collection.php +19 -6
  144. app/code/core/Mage/Sales/etc/config.xml +2 -1
  145. app/code/core/Mage/Sales/sql/sales_setup/upgrade-1.6.0.9-1.6.0.10.php +51 -0
  146. app/code/core/Mage/SalesRule/Model/Rule/Condition/Product.php +1 -1
  147. app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php +16 -1
  148. app/code/core/Mage/SalesRule/Model/Validator.php +182 -188
  149. app/code/core/Mage/SalesRule/etc/config.xml +2 -2
  150. app/code/core/Mage/Sitemap/Model/Sitemap.php +4 -2
  151. app/code/core/Mage/Tax/etc/config.xml +2 -2
  152. app/code/core/Mage/Uploader/Block/Abstract.php +247 -0
  153. app/code/core/Mage/Uploader/Block/Multiple.php +71 -0
  154. app/code/core/Mage/Uploader/Block/Single.php +52 -0
  155. app/code/core/Mage/Uploader/Helper/Data.php +35 -0
  156. app/code/core/Mage/Uploader/Helper/File.php +758 -0
  157. app/code/core/Mage/Uploader/Model/Config/Abstract.php +76 -0
  158. app/code/core/Mage/Uploader/Model/Config/Browsebutton.php +73 -0
  159. app/code/core/Mage/Uploader/Model/Config/Misc.php +54 -0
  160. app/code/core/Mage/Uploader/Model/Config/Uploader.php +128 -0
  161. app/code/core/Mage/Uploader/etc/config.xml +73 -0
  162. app/code/core/Mage/Uploader/etc/jstranslator.xml +45 -0
  163. app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php +4 -4
  164. app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php +18 -3
  165. app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php +3 -2
  166. app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php +3 -3
  167. app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php +6 -0
  168. app/code/core/Mage/Usa/etc/config.xml +5 -1
  169. app/code/core/Mage/Usa/etc/system.xml +27 -0
  170. app/code/core/Mage/Weee/Model/Observer.php +4 -1
  171. app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Options.php +6 -3
  172. app/code/core/Mage/Wishlist/Helper/Data.php +4 -1
  173. app/code/core/Mage/Wishlist/controllers/IndexController.php +3 -0
  174. app/code/core/Zend/Validate/Hostname.php +1684 -0
  175. app/etc/modules/Mage_All.xml +8 -1
  176. cron.php +1 -1
  177. errors/processor.php +21 -9
  178. package.xml +5 -5
.htaccess.sample CHANGED
@@ -127,6 +127,21 @@
127
 
128
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  ############################################
131
  ## always send 404 on missing files in these folders
132
 
127
 
128
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
129
 
130
+ <IfModule mod_setenvif.c>
131
+ <IfModule mod_headers.c>
132
+
133
+ ############################################
134
+ # X-Content-Type-Options: nosniff disable content-type sniffing on some browsers.
135
+ Header set X-Content-Type-Options: nosniff
136
+
137
+ ############################################
138
+ # This header forces to enables the Cross-site scripting (XSS) filter in browsers (if disabled)
139
+ BrowserMatch \bMSIE\s8 ie8
140
+ Header set X-XSS-Protection: "1; mode=block" env=!ie8
141
+
142
+ </IfModule>
143
+ </IfModule>
144
+
145
  ############################################
146
  ## always send 404 on missing files in these folders
147
 
RELEASE_NOTES.txt CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  ==== 1.9.2.4 ====
2
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -53,7 +63,7 @@
53
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54
  ] NOTE: Current Release Notes are maintained at: [
55
  ] [
56
- ] http://www.magentocommerce.com/knowledge-base/entry/ce-19-later-release-notes [
57
  ] [
58
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1
+ ==== 1.9.3.0 ====
2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+ ] NOTE: Current Release Notes are maintained at: [
5
+ ] [
6
+ ] http://merch.docs.magento.com/ce/user_guide/magento/release-notes-ce-1.9.3.0.html [
7
+ ] [
8
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
+
11
  ==== 1.9.2.4 ====
12
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64
  ] NOTE: Current Release Notes are maintained at: [
65
  ] [
66
+ ] http://devdocs.magento.com/guides/m1x/ce18-ee113/ce1.9_release-notes.html [
67
  ] [
68
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
api.php CHANGED
@@ -74,8 +74,11 @@ if (in_array($apiAlias, Mage_Api2_Model_Server::getApiTypes())) {
74
  } else {
75
  /* @var $server Mage_Api_Model_Server */
76
  $server = Mage::getSingleton('api/server');
77
- $adapterCode = $server->getAdapterCodeByAlias($apiAlias);
78
-
 
 
 
79
  // if no adapters found in aliases - find it by default, by code
80
  if (null === $adapterCode) {
81
  $adapterCode = $apiAlias;
74
  } else {
75
  /* @var $server Mage_Api_Model_Server */
76
  $server = Mage::getSingleton('api/server');
77
+ if (!$apiAlias) {
78
+ $adapterCode = 'default';
79
+ } else {
80
+ $adapterCode = $server->getAdapterCodeByAlias($apiAlias);
81
+ }
82
  // if no adapters found in aliases - find it by default, by code
83
  if (null === $adapterCode) {
84
  $adapterCode = $apiAlias;
app/Mage.php CHANGED
@@ -170,8 +170,8 @@ final class Mage
170
  return array(
171
  'major' => '1',
172
  'minor' => '9',
173
- 'revision' => '2',
174
- 'patch' => '4',
175
  'stability' => '',
176
  'number' => '',
177
  );
170
  return array(
171
  'major' => '1',
172
  'minor' => '9',
173
+ 'revision' => '3',
174
+ 'patch' => '0',
175
  'stability' => '',
176
  'number' => '',
177
  );
app/code/core/Mage/Admin/Model/User.php CHANGED
@@ -640,8 +640,8 @@ class Mage_Admin_Model_User extends Mage_Core_Model_Abstract
640
  return true;
641
  }
642
 
643
- $dayDifference = floor(($currentTimestamp - $tokenTimestamp) / (24 * 60 * 60));
644
- if ($dayDifference >= $tokenExpirationPeriod) {
645
  return true;
646
  }
647
 
@@ -665,7 +665,7 @@ class Mage_Admin_Model_User extends Mage_Core_Model_Abstract
665
  /**
666
  * Simple sql format date
667
  *
668
- * @param string $format
669
  * @return string
670
  */
671
  protected function _getDateNow($dayOnly = false)
640
  return true;
641
  }
642
 
643
+ $hoursDifference = floor(($currentTimestamp - $tokenTimestamp) / (60 * 60));
644
+ if ($hoursDifference >= $tokenExpirationPeriod) {
645
  return true;
646
  }
647
 
665
  /**
666
  * Simple sql format date
667
  *
668
+ * @param string | boolean $dayOnly
669
  * @return string
670
  */
671
  protected function _getDateNow($dayOnly = false)
app/code/core/Mage/Admin/etc/config.xml CHANGED
@@ -85,7 +85,7 @@
85
  <emails>
86
  <forgot_email_template>admin_emails_forgot_email_template</forgot_email_template>
87
  <forgot_email_identity>general</forgot_email_identity>
88
- <password_reset_link_expiration_period>1</password_reset_link_expiration_period>
89
  </emails>
90
  </admin>
91
  </default>
85
  <emails>
86
  <forgot_email_template>admin_emails_forgot_email_template</forgot_email_template>
87
  <forgot_email_identity>general</forgot_email_identity>
88
+ <password_reset_link_expiration_period>2</password_reset_link_expiration_period>
89
  </emails>
90
  </admin>
91
  </default>
app/code/core/Mage/Api/Model/Server/Handler/Abstract.php CHANGED
@@ -288,13 +288,15 @@ abstract class Mage_Api_Model_Server_Handler_Abstract
288
  }
289
 
290
  if (method_exists($model, $method)) {
 
291
  if (isset($methodInfo->arguments) && ((string)$methodInfo->arguments) == 'array') {
292
- return $model->$method((is_array($args) ? $args : array($args)));
293
  } elseif (!is_array($args)) {
294
- return $model->$method($args);
295
  } else {
296
- return call_user_func_array(array(&$model, $method), $args);
297
  }
 
298
  } else {
299
  throw new Mage_Api_Exception('resource_path_not_callable');
300
  }
@@ -401,13 +403,15 @@ abstract class Mage_Api_Model_Server_Handler_Abstract
401
  }
402
 
403
  if (method_exists($model, $method)) {
 
404
  if (isset($methodInfo->arguments) && ((string)$methodInfo->arguments) == 'array') {
405
- $result[] = $model->$method((is_array($args) ? $args : array($args)));
406
  } elseif (!is_array($args)) {
407
- $result[] = $model->$method($args);
408
  } else {
409
- $result[] = call_user_func_array(array(&$model, $method), $args);
410
  }
 
411
  } else {
412
  throw new Mage_Api_Exception('resource_path_not_callable');
413
  }
@@ -543,4 +547,41 @@ abstract class Mage_Api_Model_Server_Handler_Abstract
543
  $this->_startSession($sessionId);
544
  return array_values($this->_getConfig()->getFaults());
545
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  } // Class Mage_Api_Model_Server_Handler_Abstract End
288
  }
289
 
290
  if (method_exists($model, $method)) {
291
+ $result = array();
292
  if (isset($methodInfo->arguments) && ((string)$methodInfo->arguments) == 'array') {
293
+ $result = $model->$method((is_array($args) ? $args : array($args)));
294
  } elseif (!is_array($args)) {
295
+ $result = $model->$method($args);
296
  } else {
297
+ $result = call_user_func_array(array(&$model, $method), $args);
298
  }
299
+ return $this->processingMethodResult($result);
300
  } else {
301
  throw new Mage_Api_Exception('resource_path_not_callable');
302
  }
403
  }
404
 
405
  if (method_exists($model, $method)) {
406
+ $callResult = array();
407
  if (isset($methodInfo->arguments) && ((string)$methodInfo->arguments) == 'array') {
408
+ $callResult = $model->$method((is_array($args) ? $args : array($args)));
409
  } elseif (!is_array($args)) {
410
+ $callResult = $model->$method($args);
411
  } else {
412
+ $callResult = call_user_func_array(array(&$model, $method), $args);
413
  }
414
+ $result[] = $this->processingMethodResult($callResult);
415
  } else {
416
  throw new Mage_Api_Exception('resource_path_not_callable');
417
  }
547
  $this->_startSession($sessionId);
548
  return array_values($this->_getConfig()->getFaults());
549
  }
550
+
551
+ /**
552
+ * Prepare Api data for XML exporting
553
+ * See allowed characters in XML:
554
+ * @link http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char
555
+ *
556
+ * @param array $result
557
+ * @return mixed
558
+ */
559
+ public function processingMethodResult(array $result)
560
+ {
561
+ foreach ($result as &$row) {
562
+ if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
563
+ $row = $this->processingRow($row);
564
+ }
565
+ }
566
+ return $result;
567
+ }
568
+
569
+ /**
570
+ * Prepare Api row data for XML exporting
571
+ * Convert not allowed symbol to numeric character reference
572
+ *
573
+ * @param $row
574
+ * @return mixed
575
+ */
576
+ public function processingRow($row)
577
+ {
578
+ $row = preg_replace_callback(
579
+ '/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]/u',
580
+ function ($matches) {
581
+ return '&#' . Mage::helper('core/string')->uniOrd($matches[0]) . ';';
582
+ },
583
+ $row
584
+ );
585
+ return $row;
586
+ }
587
  } // Class Mage_Api_Model_Server_Handler_Abstract End
app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php CHANGED
@@ -121,6 +121,7 @@ class Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes
121
  $groupPrice->setRenderer(
122
  $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_group')
123
  ->setPriceColumnHeader(Mage::helper('bundle')->__('Percent Discount'))
 
124
  ->setPriceValidation('validate-greater-than-zero validate-percents')
125
  );
126
  }
121
  $groupPrice->setRenderer(
122
  $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_group')
123
  ->setPriceColumnHeader(Mage::helper('bundle')->__('Percent Discount'))
124
+ ->setIsPercent(true)
125
  ->setPriceValidation('validate-greater-than-zero validate-percents')
126
  );
127
  }
app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php CHANGED
@@ -85,8 +85,13 @@ class Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option extends Mage_Bun
85
  $_canChangeQty = $_default->getSelectionCanChangeQty();
86
  } elseif (!$inPreConfigured && $selectedOptions && is_numeric($selectedOptions)) {
87
  $selectedSelection = $_option->getSelectionById($selectedOptions);
88
- $_defaultQty = $selectedSelection->getSelectionQty() * 1;
89
- $_canChangeQty = $selectedSelection->getSelectionCanChangeQty();
 
 
 
 
 
90
  } elseif (!$this->_showSingle() || $inPreConfigured) {
91
  $_defaultQty = $this->_getSelectedQty();
92
  $_canChangeQty = (bool)$_defaultQty;
85
  $_canChangeQty = $_default->getSelectionCanChangeQty();
86
  } elseif (!$inPreConfigured && $selectedOptions && is_numeric($selectedOptions)) {
87
  $selectedSelection = $_option->getSelectionById($selectedOptions);
88
+ if ($selectedSelection) {
89
+ $_defaultQty = $selectedSelection->getSelectionQty() * 1;
90
+ $_canChangeQty = $selectedSelection->getSelectionCanChangeQty();
91
+ } else {
92
+ $_defaultQty = $_selections[0]->getSelectionQty() * 1;
93
+ $_canChangeQty = $_selections[0]->getSelectionCanChangeQty();
94
+ }
95
  } elseif (!$this->_showSingle() || $inPreConfigured) {
96
  $_defaultQty = $this->_getSelectedQty();
97
  $_canChangeQty = (bool)$_defaultQty;
app/code/core/Mage/Catalog/Block/Product/Abstract.php CHANGED
@@ -104,6 +104,16 @@ abstract class Mage_Catalog_Block_Product_Abstract extends Mage_Core_Block_Templ
104
  */
105
  protected $_mapRenderer = 'msrp';
106
 
 
 
 
 
 
 
 
 
 
 
107
  /**
108
  * Retrieve url for add product to cart
109
  * Will return product view page URL if product has required options
@@ -195,12 +205,7 @@ abstract class Mage_Catalog_Block_Product_Abstract extends Mage_Core_Block_Templ
195
  */
196
  public function getMinimalQty($product)
197
  {
198
- $stockItem = $product->getStockItem();
199
- if ($stockItem) {
200
- return ($stockItem->getMinSaleQty()
201
- && $stockItem->getMinSaleQty() > 0 ? $stockItem->getMinSaleQty() * 1 : null);
202
- }
203
- return null;
204
  }
205
 
206
  /**
104
  */
105
  protected $_mapRenderer = 'msrp';
106
 
107
+ /**
108
+ * Get catalog product helper
109
+ *
110
+ * @return Mage_Catalog_Helper_Product
111
+ */
112
+ public function getProductHelper()
113
+ {
114
+ return Mage::helper('catalog/product');
115
+ }
116
+
117
  /**
118
  * Retrieve url for add product to cart
119
  * Will return product view page URL if product has required options
205
  */
206
  public function getMinimalQty($product)
207
  {
208
+ return $this->getProductHelper()->getMinimalQty($product);
 
 
 
 
 
209
  }
210
 
211
  /**
app/code/core/Mage/Catalog/Block/Product/List.php CHANGED
@@ -62,16 +62,13 @@ class Mage_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_Abstrac
62
  $this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
63
  }
64
 
65
- // if this is a product view page
66
  if (Mage::registry('product')) {
67
- // get collection of categories this product is associated with
68
  $categories = Mage::registry('product')->getCategoryCollection()
69
  ->setPage(1, 1)
70
  ->load();
71
- // if the product is associated with any category
72
  if ($categories->count()) {
73
- // show products from this category
74
- $this->setCategoryId(current($categories->getIterator()));
75
  }
76
  }
77
 
62
  $this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
63
  }
64
 
 
65
  if (Mage::registry('product')) {
66
+ /** @var Mage_Catalog_Model_Resource_Category_Collection $categories */
67
  $categories = Mage::registry('product')->getCategoryCollection()
68
  ->setPage(1, 1)
69
  ->load();
 
70
  if ($categories->count()) {
71
+ $this->setCategoryId($categories->getFirstItem()->getId());
 
72
  }
73
  }
74
 
app/code/core/Mage/Catalog/Block/Product/View.php CHANGED
@@ -141,62 +141,14 @@ class Mage_Catalog_Block_Product_View extends Mage_Catalog_Block_Product_Abstrac
141
  return Mage::helper('core')->jsonEncode($config);
142
  }
143
 
144
- $_request = Mage::getSingleton('tax/calculation')->getDefaultRateRequest();
145
  /* @var $product Mage_Catalog_Model_Product */
146
  $product = $this->getProduct();
147
- $_request->setProductClassId($product->getTaxClassId());
148
- $defaultTax = Mage::getSingleton('tax/calculation')->getRate($_request);
149
 
150
- $_request = Mage::getSingleton('tax/calculation')->getRateRequest();
151
- $_request->setProductClassId($product->getTaxClassId());
152
- $currentTax = Mage::getSingleton('tax/calculation')->getRate($_request);
153
-
154
- $_regularPrice = $product->getPrice();
155
- $_finalPrice = $product->getFinalPrice();
156
- if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
157
- $_priceInclTax = Mage::helper('tax')->getPrice($product, $_finalPrice, true,
158
- null, null, null, null, null, false);
159
- $_priceExclTax = Mage::helper('tax')->getPrice($product, $_finalPrice, false,
160
- null, null, null, null, null, false);
161
- } else {
162
- $_priceInclTax = Mage::helper('tax')->getPrice($product, $_finalPrice, true);
163
- $_priceExclTax = Mage::helper('tax')->getPrice($product, $_finalPrice);
164
- }
165
- $_tierPrices = array();
166
- $_tierPricesInclTax = array();
167
- foreach ($product->getTierPrice() as $tierPrice) {
168
- $_tierPrices[] = Mage::helper('core')->currency(
169
- Mage::helper('tax')->getPrice($product, (float)$tierPrice['website_price'], false) - $_priceExclTax
170
- , false, false);
171
- $_tierPricesInclTax[] = Mage::helper('core')->currency(
172
- Mage::helper('tax')->getPrice($product, (float)$tierPrice['website_price'], true) - $_priceInclTax
173
- , false, false);
174
- }
175
- $config = array(
176
- 'productId' => $product->getId(),
177
- 'priceFormat' => Mage::app()->getLocale()->getJsPriceFormat(),
178
- 'includeTax' => Mage::helper('tax')->priceIncludesTax() ? 'true' : 'false',
179
- 'showIncludeTax' => Mage::helper('tax')->displayPriceIncludingTax(),
180
- 'showBothPrices' => Mage::helper('tax')->displayBothPrices(),
181
- 'productPrice' => Mage::helper('core')->currency($_finalPrice, false, false),
182
- 'productOldPrice' => Mage::helper('core')->currency($_regularPrice, false, false),
183
- 'priceInclTax' => Mage::helper('core')->currency($_priceInclTax, false, false),
184
- 'priceExclTax' => Mage::helper('core')->currency($_priceExclTax, false, false),
185
- /**
186
- * @var skipCalculate
187
- * @deprecated after 1.5.1.0
188
- */
189
- 'skipCalculate' => ($_priceExclTax != $_priceInclTax ? 0 : 1),
190
- 'defaultTax' => $defaultTax,
191
- 'currentTax' => $currentTax,
192
- 'idSuffix' => '_clone',
193
- 'oldPlusDisposition' => 0,
194
- 'plusDisposition' => 0,
195
- 'plusDispositionTax' => 0,
196
- 'oldMinusDisposition' => 0,
197
- 'minusDisposition' => 0,
198
- 'tierPrices' => $_tierPrices,
199
- 'tierPricesInclTax' => $_tierPricesInclTax,
200
  );
201
 
202
  $responseObject = new Varien_Object();
@@ -259,14 +211,7 @@ class Mage_Catalog_Block_Product_View extends Mage_Catalog_Block_Product_Abstrac
259
  $product = $this->getProduct();
260
  }
261
 
262
- $qty = $this->getMinimalQty($product);
263
- $config = $product->getPreconfiguredValues();
264
- $configQty = $config->getQty();
265
- if ($configQty > $qty) {
266
- $qty = $configQty;
267
- }
268
-
269
- return $qty;
270
  }
271
 
272
  /**
141
  return Mage::helper('core')->jsonEncode($config);
142
  }
143
 
 
144
  /* @var $product Mage_Catalog_Model_Product */
145
  $product = $this->getProduct();
 
 
146
 
147
+ /** @var Mage_Catalog_Helper_Product_Type_Composite $compositeProductHelper */
148
+ $compositeProductHelper = $this->helper('catalog/product_type_composite');
149
+ $config = array_merge(
150
+ $compositeProductHelper->prepareJsonGeneralConfig(),
151
+ $compositeProductHelper->prepareJsonProductConfig($product)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  );
153
 
154
  $responseObject = new Varien_Object();
211
  $product = $this->getProduct();
212
  }
213
 
214
+ return $this->getProductHelper()->getDefaultQty($product);
 
 
 
 
 
 
 
215
  }
216
 
217
  /**
app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php CHANGED
@@ -48,6 +48,16 @@ class Mage_Catalog_Block_Product_View_Type_Configurable extends Mage_Catalog_Blo
48
  */
49
  protected $_resPrices = array();
50
 
 
 
 
 
 
 
 
 
 
 
51
  /**
52
  * Get allowed attributes
53
  *
@@ -91,7 +101,10 @@ class Mage_Catalog_Block_Product_View_Type_Configurable extends Mage_Catalog_Blo
91
  $allProducts = $this->getProduct()->getTypeInstance(true)
92
  ->getUsedProducts(null, $this->getProduct());
93
  foreach ($allProducts as $product) {
94
- if ($product->isSaleable() || $skipSaleableCheck) {
 
 
 
95
  $products[] = $product;
96
  }
97
  }
@@ -103,11 +116,12 @@ class Mage_Catalog_Block_Product_View_Type_Configurable extends Mage_Catalog_Blo
103
  /**
104
  * retrieve current store
105
  *
 
106
  * @return Mage_Core_Model_Store
107
  */
108
  public function getCurrentStore()
109
  {
110
- return Mage::app()->getStore();
111
  }
112
 
113
  /**
@@ -138,10 +152,10 @@ class Mage_Catalog_Block_Product_View_Type_Configurable extends Mage_Catalog_Blo
138
  $preconfiguredValues = $currentProduct->getPreconfiguredValues();
139
  $defaultValues = array();
140
  }
141
-
142
  foreach ($this->getAllowProducts() as $product) {
143
  $productId = $product->getId();
144
-
145
  foreach ($this->getAllowAttributes() as $attribute) {
146
  $productAttribute = $attribute->getProductAttribute();
147
  $productAttributeId = $productAttribute->getId();
@@ -189,7 +203,13 @@ class Mage_Catalog_Block_Product_View_Type_Configurable extends Mage_Catalog_Blo
189
  $configurablePrice = $currentProduct->getConfigurablePrice();
190
 
191
  if (isset($options[$attributeId][$value['value_index']])) {
192
- $productsIndex = $options[$attributeId][$value['value_index']];
 
 
 
 
 
 
193
  } else {
194
  $productsIndex = array();
195
  }
@@ -300,64 +320,51 @@ class Mage_Catalog_Block_Product_View_Type_Configurable extends Mage_Catalog_Blo
300
  /**
301
  * Calculation real price
302
  *
 
303
  * @param float $price
304
  * @param bool $isPercent
305
  * @return mixed
306
  */
307
  protected function _preparePrice($price, $isPercent = false)
308
  {
309
- if ($isPercent && !empty($price)) {
310
- $price = $this->getProduct()->getFinalPrice() * $price / 100;
311
- }
312
-
313
- return $this->_registerJsPrice($this->_convertPrice($price, true));
314
  }
315
 
316
  /**
317
  * Calculation price before special price
318
  *
 
319
  * @param float $price
320
  * @param bool $isPercent
321
  * @return mixed
322
  */
323
  protected function _prepareOldPrice($price, $isPercent = false)
324
  {
325
- if ($isPercent && !empty($price)) {
326
- $price = $this->getProduct()->getPrice() * $price / 100;
327
- }
328
-
329
- return $this->_registerJsPrice($this->_convertPrice($price, true));
330
  }
331
 
332
  /**
333
  * Replace ',' on '.' for js
334
  *
 
335
  * @param float $price
336
  * @return string
337
  */
338
  protected function _registerJsPrice($price)
339
  {
340
- return str_replace(',', '.', $price);
341
  }
342
 
343
  /**
344
  * Convert price from default currency to current currency
345
  *
 
346
  * @param float $price
347
  * @param boolean $round
348
  * @return float
349
  */
350
  protected function _convertPrice($price, $round = false)
351
  {
352
- if (empty($price)) {
353
- return 0;
354
- }
355
-
356
- $price = $this->getCurrentStore()->convertPrice($price);
357
- if ($round) {
358
- $price = $this->getCurrentStore()->roundPrice($price);
359
- }
360
-
361
- return $price;
362
  }
363
  }
48
  */
49
  protected $_resPrices = array();
50
 
51
+ /**
52
+ * Get helper for calculation purposes
53
+ *
54
+ * @return Mage_Catalog_Helper_Product_Type_Composite
55
+ */
56
+ protected function _getHelper()
57
+ {
58
+ return $this->helper('catalog/product_type_composite');
59
+ }
60
+
61
  /**
62
  * Get allowed attributes
63
  *
101
  $allProducts = $this->getProduct()->getTypeInstance(true)
102
  ->getUsedProducts(null, $this->getProduct());
103
  foreach ($allProducts as $product) {
104
+ if ($product->isSaleable()
105
+ || $skipSaleableCheck
106
+ || (!$product->getStockItem()->getIsInStock()
107
+ && Mage::helper('cataloginventory')->isShowOutOfStock())) {
108
  $products[] = $product;
109
  }
110
  }
116
  /**
117
  * retrieve current store
118
  *
119
+ * @deprecated
120
  * @return Mage_Core_Model_Store
121
  */
122
  public function getCurrentStore()
123
  {
124
+ return $this->_getHelper()->getCurrentStore();
125
  }
126
 
127
  /**
152
  $preconfiguredValues = $currentProduct->getPreconfiguredValues();
153
  $defaultValues = array();
154
  }
155
+ $productStock = array();
156
  foreach ($this->getAllowProducts() as $product) {
157
  $productId = $product->getId();
158
+ $productStock[$productId] = $product->getStockItem()->getIsInStock();
159
  foreach ($this->getAllowAttributes() as $attribute) {
160
  $productAttribute = $attribute->getProductAttribute();
161
  $productAttributeId = $productAttribute->getId();
203
  $configurablePrice = $currentProduct->getConfigurablePrice();
204
 
205
  if (isset($options[$attributeId][$value['value_index']])) {
206
+ $productsIndexOptions = $options[$attributeId][$value['value_index']];
207
+ $productsIndex = array();
208
+ foreach ($productsIndexOptions as $productIndex) {
209
+ if ($productStock[$productIndex]) {
210
+ $productsIndex[] = $productIndex;
211
+ }
212
+ }
213
  } else {
214
  $productsIndex = array();
215
  }
320
  /**
321
  * Calculation real price
322
  *
323
+ * @deprecated
324
  * @param float $price
325
  * @param bool $isPercent
326
  * @return mixed
327
  */
328
  protected function _preparePrice($price, $isPercent = false)
329
  {
330
+ return $this->_getHelper()->preparePrice($this->getProduct(), $price, $isPercent);
 
 
 
 
331
  }
332
 
333
  /**
334
  * Calculation price before special price
335
  *
336
+ * @deprecated
337
  * @param float $price
338
  * @param bool $isPercent
339
  * @return mixed
340
  */
341
  protected function _prepareOldPrice($price, $isPercent = false)
342
  {
343
+ return $this->_getHelper()->prepareOldPrice($this->getProduct(), $price, $isPercent);
 
 
 
 
344
  }
345
 
346
  /**
347
  * Replace ',' on '.' for js
348
  *
349
+ * @deprecated
350
  * @param float $price
351
  * @return string
352
  */
353
  protected function _registerJsPrice($price)
354
  {
355
+ return $this->_getHelper()->registerJsPrice($price);
356
  }
357
 
358
  /**
359
  * Convert price from default currency to current currency
360
  *
361
+ * @deprecated
362
  * @param float $price
363
  * @param boolean $round
364
  * @return float
365
  */
366
  protected function _convertPrice($price, $round = false)
367
  {
368
+ return $this->_getHelper()->convertPrice($price, $round);
 
 
 
 
 
 
 
 
 
369
  }
370
  }
app/code/core/Mage/Catalog/Helper/Image.php CHANGED
@@ -33,6 +33,7 @@ class Mage_Catalog_Helper_Image extends Mage_Core_Helper_Abstract
33
  {
34
  const XML_NODE_PRODUCT_BASE_IMAGE_WIDTH = 'catalog/product_image/base_width';
35
  const XML_NODE_PRODUCT_SMALL_IMAGE_WIDTH = 'catalog/product_image/small_width';
 
36
 
37
  /**
38
  * Current model
@@ -634,10 +635,16 @@ class Mage_Catalog_Helper_Image extends Mage_Core_Helper_Abstract
634
  * @throws Mage_Core_Exception
635
  */
636
  public function validateUploadFile($filePath) {
637
- if (!getimagesize($filePath)) {
 
 
638
  Mage::throwException($this->__('Disallowed file type.'));
639
  }
640
 
 
 
 
 
641
  $_processor = new Varien_Image($filePath);
642
  return $_processor->getMimeType() !== null;
643
  }
33
  {
34
  const XML_NODE_PRODUCT_BASE_IMAGE_WIDTH = 'catalog/product_image/base_width';
35
  const XML_NODE_PRODUCT_SMALL_IMAGE_WIDTH = 'catalog/product_image/small_width';
36
+ const XML_NODE_PRODUCT_MAX_DIMENSION = 'catalog/product_image/max_dimension';
37
 
38
  /**
39
  * Current model
635
  * @throws Mage_Core_Exception
636
  */
637
  public function validateUploadFile($filePath) {
638
+ $maxDimension = Mage::getStoreConfig(self::XML_NODE_PRODUCT_MAX_DIMENSION);
639
+ $imageInfo = getimagesize($filePath);
640
+ if (!$imageInfo) {
641
  Mage::throwException($this->__('Disallowed file type.'));
642
  }
643
 
644
+ if ($imageInfo[0] > $maxDimension || $imageInfo[1] > $maxDimension) {
645
+ Mage::throwException($this->__('Disalollowed file format.'));
646
+ }
647
+
648
  $_processor = new Varien_Image($filePath);
649
  return $_processor->getMimeType() !== null;
650
  }
app/code/core/Mage/Catalog/Helper/Product.php CHANGED
@@ -35,6 +35,8 @@ class Mage_Catalog_Helper_Product extends Mage_Core_Helper_Url
35
  const XML_PATH_PRODUCT_URL_USE_CATEGORY = 'catalog/seo/product_use_categories';
36
  const XML_PATH_USE_PRODUCT_CANONICAL_TAG = 'catalog/seo/product_canonical_tag';
37
 
 
 
38
  /**
39
  * Flag that shows if Magento has to check product to be saleable (enabled and/or inStock)
40
  *
@@ -485,4 +487,42 @@ class Mage_Catalog_Helper_Product extends Mage_Core_Helper_Url
485
  {
486
  return $this->_skipSaleableCheck;
487
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  }
35
  const XML_PATH_PRODUCT_URL_USE_CATEGORY = 'catalog/seo/product_use_categories';
36
  const XML_PATH_USE_PRODUCT_CANONICAL_TAG = 'catalog/seo/product_canonical_tag';
37
 
38
+ const DEFAULT_QTY = 1;
39
+
40
  /**
41
  * Flag that shows if Magento has to check product to be saleable (enabled and/or inStock)
42
  *
487
  {
488
  return $this->_skipSaleableCheck;
489
  }
490
+
491
+ /**
492
+ * Gets minimal sales quantity
493
+ *
494
+ * @param Mage_Catalog_Model_Product $product
495
+ * @return int|null
496
+ */
497
+ public function getMinimalQty($product)
498
+ {
499
+ $stockItem = $product->getStockItem();
500
+ if ($stockItem && $stockItem->getMinSaleQty()) {
501
+ return $stockItem->getMinSaleQty() * 1;
502
+ }
503
+ return null;
504
+ }
505
+
506
+ /**
507
+ * Get default qty - either as preconfigured, or as 1.
508
+ * Also restricts it by minimal qty.
509
+ *
510
+ * @param Mage_Catalog_Model_Product $product
511
+ * @return int|float
512
+ */
513
+ public function getDefaultQty($product)
514
+ {
515
+ $qty = $this->getMinimalQty($product);
516
+ $configQty = $product->getPreconfiguredValues()->getQty();
517
+
518
+ if ($product->isConfigurable() || $configQty > $qty) {
519
+ $qty = $configQty;
520
+ }
521
+
522
+ if (is_null($qty)) {
523
+ $qty = self::DEFAULT_QTY;
524
+ }
525
+
526
+ return $qty;
527
+ }
528
  }
app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Catalog
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Helper for preparing properties for configurable product
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Catalog
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_Catalog_Helper_Product_Type_Composite extends Mage_Core_Helper_Abstract
35
+ {
36
+ /**
37
+ * Calculation real price
38
+ *
39
+ * @param Mage_Catalog_Model_Product $product
40
+ * @param float $price
41
+ * @param bool $isPercent
42
+ * @param null|int $storeId
43
+ * @return mixed
44
+ */
45
+ public function preparePrice($product, $price, $isPercent = false, $storeId = null)
46
+ {
47
+ if ($isPercent && !empty($price)) {
48
+ $price = $product->getFinalPrice() * $price / 100;
49
+ }
50
+
51
+ return $this->registerJsPrice($this->convertPrice($price, true, $storeId));
52
+ }
53
+
54
+ /**
55
+ * Calculation price before special price
56
+ *
57
+ * @param Mage_Catalog_Model_Product $product
58
+ * @param float $price
59
+ * @param bool $isPercent
60
+ * @param null|int $storeId
61
+ * @return mixed
62
+ */
63
+ public function prepareOldPrice($product, $price, $isPercent = false, $storeId = null)
64
+ {
65
+ if ($isPercent && !empty($price)) {
66
+ $price = $product->getPrice() * $price / 100;
67
+ }
68
+
69
+ return $this->registerJsPrice($this->convertPrice($price, true, $storeId));
70
+ }
71
+
72
+ /**
73
+ * Replace ',' on '.' for js
74
+ *
75
+ * @param float $price
76
+ * @return string
77
+ */
78
+ public function registerJsPrice($price)
79
+ {
80
+ return str_replace(',', '.', $price);
81
+ }
82
+
83
+ /**
84
+ * Convert price from default currency to current currency
85
+ *
86
+ * @param float $price
87
+ * @param boolean $round
88
+ * @param null|int $storeId
89
+ * @return float
90
+ */
91
+ public function convertPrice($price, $round = false, $storeId = null)
92
+ {
93
+ if (empty($price)) {
94
+ return 0;
95
+ }
96
+
97
+ $price = $this->getCurrentStore($storeId)->convertPrice($price);
98
+ if ($round) {
99
+ $price = $this->getCurrentStore($storeId)->roundPrice($price);
100
+ }
101
+
102
+ return $price;
103
+ }
104
+
105
+ /**
106
+ * Retrieve current store
107
+ *
108
+ * @param null $storeId
109
+ * @return Mage_Core_Model_Store
110
+ */
111
+ public function getCurrentStore($storeId = null)
112
+ {
113
+ return Mage::app()->getStore($storeId);
114
+ }
115
+
116
+ /**
117
+ * Prepare general params for product to be used in getJsonConfig()
118
+ * @see Mage_Catalog_Block_Product_View::getJsonConfig()
119
+ * @see Mage_ConfigurableSwatches_Block_Catalog_Product_List_Price::getJsonConfig()
120
+ *
121
+ * @return array
122
+ */
123
+ public function prepareJsonGeneralConfig()
124
+ {
125
+ return array(
126
+ 'priceFormat' => Mage::app()->getLocale()->getJsPriceFormat(),
127
+ 'includeTax' => Mage::helper('tax')->priceIncludesTax() ? 'true' : 'false',
128
+ 'showIncludeTax' => Mage::helper('tax')->displayPriceIncludingTax(),
129
+ 'showBothPrices' => Mage::helper('tax')->displayBothPrices(),
130
+ 'idSuffix' => '',
131
+ 'oldPlusDisposition' => 0,
132
+ 'plusDisposition' => 0,
133
+ 'plusDispositionTax' => 0,
134
+ 'oldMinusDisposition' => 0,
135
+ 'minusDisposition' => 0,
136
+ );
137
+ }
138
+
139
+
140
+
141
+ /**
142
+ * Prepare product specific params to be used in getJsonConfig()
143
+ * @see Mage_Catalog_Block_Product_View::getJsonConfig()
144
+ * @see Mage_ConfigurableSwatches_Block_Catalog_Product_List_Price::getJsonConfig()
145
+ *
146
+ * @param Mage_Catalog_Model_Product $product
147
+ * @return array
148
+ */
149
+ public function prepareJsonProductConfig($product)
150
+ {
151
+ $_request = Mage::getSingleton('tax/calculation')->getDefaultRateRequest();
152
+ $_request->setProductClassId($product->getTaxClassId());
153
+ $defaultTax = Mage::getSingleton('tax/calculation')->getRate($_request);
154
+
155
+ $_request = Mage::getSingleton('tax/calculation')->getRateRequest();
156
+ $_request->setProductClassId($product->getTaxClassId());
157
+ $currentTax = Mage::getSingleton('tax/calculation')->getRate($_request);
158
+
159
+ $_regularPrice = $product->getPrice();
160
+ $_finalPrice = $product->getFinalPrice();
161
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
162
+ $_priceInclTax = Mage::helper('tax')->getPrice($product, $_finalPrice, true,
163
+ null, null, null, null, null, false);
164
+ $_priceExclTax = Mage::helper('tax')->getPrice($product, $_finalPrice, false,
165
+ null, null, null, null, null, false);
166
+ } else {
167
+ $_priceInclTax = Mage::helper('tax')->getPrice($product, $_finalPrice, true);
168
+ $_priceExclTax = Mage::helper('tax')->getPrice($product, $_finalPrice);
169
+ }
170
+ $_tierPrices = array();
171
+ $_tierPricesInclTax = array();
172
+ foreach ($product->getTierPrice() as $tierPrice) {
173
+ $_tierPrices[] = Mage::helper('core')->currency(
174
+ Mage::helper('tax')->getPrice($product, (float)$tierPrice['website_price'], false) - $_priceExclTax
175
+ , false, false);
176
+ $_tierPricesInclTax[] = Mage::helper('core')->currency(
177
+ Mage::helper('tax')->getPrice($product, (float)$tierPrice['website_price'], true) - $_priceInclTax
178
+ , false, false);
179
+ }
180
+
181
+ return array(
182
+ 'productId' => $product->getId(),
183
+ 'productPrice' => Mage::helper('core')->currency($_finalPrice, false, false),
184
+ 'productOldPrice' => Mage::helper('core')->currency($_regularPrice, false, false),
185
+ 'priceInclTax' => Mage::helper('core')->currency($_priceInclTax, false, false),
186
+ 'priceExclTax' => Mage::helper('core')->currency($_priceExclTax, false, false),
187
+ 'skipCalculate' => ($_priceExclTax != $_priceInclTax ? 0 : 1),
188
+ 'defaultTax' => $defaultTax,
189
+ 'currentTax' => $currentTax,
190
+ 'tierPrices' => $_tierPrices,
191
+ 'tierPricesInclTax' => $_tierPricesInclTax,
192
+ 'swatchPrices' => $product->getSwatchPrices(),
193
+ );
194
+ }
195
+ }
app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Groupprice/Abstract.php CHANGED
@@ -227,6 +227,7 @@ abstract class Mage_Catalog_Model_Product_Attribute_Backend_Groupprice_Abstract
227
  $data = $this->_getResource()->loadPriceData($object->getId(), $websiteId);
228
  foreach ($data as $k => $v) {
229
  $data[$k]['website_price'] = $v['price'];
 
230
  if ($v['all_groups']) {
231
  $data[$k]['cust_group'] = Mage_Customer_Model_Group::CUST_GROUP_ALL;
232
  }
@@ -318,6 +319,7 @@ abstract class Mage_Catalog_Model_Product_Attribute_Backend_Groupprice_Abstract
318
  'all_groups' => $useForAllGroups ? 1 : 0,
319
  'customer_group_id' => $customerGroupId,
320
  'value' => $data['price'],
 
321
  ), $this->_getAdditionalUniqueFields($data));
322
  }
323
 
@@ -347,10 +349,11 @@ abstract class Mage_Catalog_Model_Product_Attribute_Backend_Groupprice_Abstract
347
 
348
  if (!empty($update)) {
349
  foreach ($update as $k => $v) {
350
- if ($old[$k]['price'] != $v['value']) {
351
  $price = new Varien_Object(array(
352
- 'value_id' => $old[$k]['price_id'],
353
- 'value' => $v['value']
 
354
  ));
355
  $this->_getResource()->savePriceData($price);
356
 
227
  $data = $this->_getResource()->loadPriceData($object->getId(), $websiteId);
228
  foreach ($data as $k => $v) {
229
  $data[$k]['website_price'] = $v['price'];
230
+ $data[$k]['is_percent'] = isset($v['is_percent']) ? isset($v['is_percent']) : 0;
231
  if ($v['all_groups']) {
232
  $data[$k]['cust_group'] = Mage_Customer_Model_Group::CUST_GROUP_ALL;
233
  }
319
  'all_groups' => $useForAllGroups ? 1 : 0,
320
  'customer_group_id' => $customerGroupId,
321
  'value' => $data['price'],
322
+ 'is_percent' => isset($data['is_percent']) ? $data['is_percent'] : 0,
323
  ), $this->_getAdditionalUniqueFields($data));
324
  }
325
 
349
 
350
  if (!empty($update)) {
351
  foreach ($update as $k => $v) {
352
+ if ($old[$k]['price'] != $v['value'] || $old[$k]['is_percent'] != $v['is_percent']) {
353
  $price = new Varien_Object(array(
354
+ 'value_id' => $old[$k]['price_id'],
355
+ 'value' => $v['value'],
356
+ 'is_percent' => $v['is_percent']
357
  ));
358
  $this->_getResource()->savePriceData($price);
359
 
app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php CHANGED
@@ -643,8 +643,11 @@ class Mage_Catalog_Model_Product_Attribute_Backend_Media extends Mage_Eav_Model_
643
 
644
  } catch (Exception $e) {
645
  $file = $this->_getConfig()->getMediaPath($file);
 
646
  Mage::throwException(
647
- Mage::helper('catalog')->__('Failed to copy file %s. Please, delete media with non-existing images and try again.', $file)
 
 
648
  );
649
  }
650
 
643
 
644
  } catch (Exception $e) {
645
  $file = $this->_getConfig()->getMediaPath($file);
646
+ $io = new Varien_Io_File();
647
  Mage::throwException(
648
+ Mage::helper('catalog')->__(
649
+ 'Failed to copy file %s. Please, delete media with non-existing images and try again.',
650
+ $io->getFilteredPath($file))
651
  );
652
  }
653
 
app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php CHANGED
@@ -61,8 +61,8 @@ class Mage_Catalog_Model_Product_Link_Api_V2 extends Mage_Catalog_Model_Product_
61
 
62
  $links[(int)$linkedProductId] = array();
63
  foreach ($collection->getLinkModel()->getAttributes() as $attribute) {
64
- if (isset($data->$attribute['code'])) {
65
- $links[(int)$linkedProductId][$attribute['code']] = $data->$attribute['code'];
66
  }
67
  }
68
 
@@ -118,8 +118,8 @@ class Mage_Catalog_Model_Product_Link_Api_V2 extends Mage_Catalog_Model_Product_
118
  }
119
 
120
  foreach ($collection->getLinkModel()->getAttributes() as $attribute) {
121
- if (isset($data->$attribute['code'])) {
122
- $links[(int)$linkedProductId][$attribute['code']] = $data->$attribute['code'];
123
  }
124
  }
125
 
61
 
62
  $links[(int)$linkedProductId] = array();
63
  foreach ($collection->getLinkModel()->getAttributes() as $attribute) {
64
+ if (isset($data->{$attribute['code']})) {
65
+ $links[(int)$linkedProductId][$attribute['code']] = $data->{$attribute['code']};
66
  }
67
  }
68
 
118
  }
119
 
120
  foreach ($collection->getLinkModel()->getAttributes() as $attribute) {
121
+ if (isset($data->{$attribute['code']})) {
122
+ $links[(int)$linkedProductId][$attribute['code']] = $data->{$attribute['code']};
123
  }
124
  }
125
 
app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php CHANGED
@@ -359,7 +359,7 @@ class Mage_Catalog_Model_Resource_Eav_Attribute extends Mage_Eav_Model_Entity_At
359
 
360
  if ($backendType == 'int' && $frontendInput == 'select') {
361
  return true;
362
- } else if ($backendType == 'varchar' && $frontendInput == 'multiselect') {
363
  return true;
364
  } else if ($backendType == 'decimal') {
365
  return true;
359
 
360
  if ($backendType == 'int' && $frontendInput == 'select') {
361
  return true;
362
+ } else if (($backendType == 'varchar' || $backendType == 'text') && $frontendInput == 'multiselect') {
363
  return true;
364
  } else if ($backendType == 'decimal') {
365
  return true;
app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice.php CHANGED
@@ -43,4 +43,17 @@ class Mage_Catalog_Model_Resource_Product_Attribute_Backend_Groupprice
43
  {
44
  $this->_init('catalog/product_attribute_group_price', 'value_id');
45
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
43
  {
44
  $this->_init('catalog/product_attribute_group_price', 'value_id');
45
  }
46
+
47
+ /**
48
+ * Add is_percent column
49
+ *
50
+ * @param array $columns
51
+ * @return array
52
+ */
53
+ protected function _loadPriceDataColumns($columns)
54
+ {
55
+ $columns = parent::_loadPriceDataColumns($columns);
56
+ $columns['is_percent'] = 'is_percent';
57
+ return $columns;
58
+ }
59
  }
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php CHANGED
@@ -61,7 +61,7 @@ class Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source
61
  ->where($this->_getIndexableAttributesCondition());
62
 
63
  if ($multiSelect == true) {
64
- $select->where('ea.backend_type = ?', 'varchar')
65
  ->where('ea.frontend_input = ?', 'multiselect');
66
  } else {
67
  $select->where('ea.backend_type = ?', 'int')
@@ -203,14 +203,14 @@ class Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source
203
  $productValueExpression = $adapter->getCheckSql('pvs.value_id > 0', 'pvs.value', 'pvd.value');
204
  $select = $adapter->select()
205
  ->from(
206
- array('pvd' => $this->getValueTable('catalog/product', 'varchar')),
207
  array('entity_id', 'attribute_id'))
208
  ->join(
209
  array('cs' => $this->getTable('core/store')),
210
  '',
211
  array('store_id'))
212
  ->joinLeft(
213
- array('pvs' => $this->getValueTable('catalog/product', 'varchar')),
214
  'pvs.entity_id = pvd.entity_id AND pvs.attribute_id = pvd.attribute_id'
215
  . ' AND pvs.store_id=cs.store_id',
216
  array('value' => $productValueExpression))
61
  ->where($this->_getIndexableAttributesCondition());
62
 
63
  if ($multiSelect == true) {
64
+ $select->where('ea.backend_type = ?', 'text')
65
  ->where('ea.frontend_input = ?', 'multiselect');
66
  } else {
67
  $select->where('ea.backend_type = ?', 'int')
203
  $productValueExpression = $adapter->getCheckSql('pvs.value_id > 0', 'pvs.value', 'pvd.value');
204
  $select = $adapter->select()
205
  ->from(
206
+ array('pvd' => $this->getValueTable('catalog/product', 'text')),
207
  array('entity_id', 'attribute_id'))
208
  ->join(
209
  array('cs' => $this->getTable('core/store')),
210
  '',
211
  array('store_id'))
212
  ->joinLeft(
213
+ array('pvs' => $this->getValueTable('catalog/product', 'text')),
214
  'pvs.entity_id = pvd.entity_id AND pvs.attribute_id = pvd.attribute_id'
215
  . ' AND pvs.store_id=cs.store_id',
216
  array('value' => $productValueExpression))
app/code/core/Mage/Catalog/Model/Resource/Product/Link/Product/Collection.php CHANGED
@@ -282,6 +282,19 @@ class Mage_Catalog_Model_Resource_Product_Link_Product_Collection extends Mage_C
282
  return $this;
283
  }
284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  /**
286
  * Join attributes
287
  *
@@ -294,10 +307,9 @@ class Mage_Catalog_Model_Resource_Product_Link_Product_Collection extends Mage_C
294
  }
295
  $attributes = $this->getLinkModel()->getAttributes();
296
 
297
- $attributesByType = array();
298
  foreach ($attributes as $attribute) {
299
  $table = $this->getLinkModel()->getAttributeTypeTable($attribute['type']);
300
- $alias = sprintf('link_attribute_%s_%s', $attribute['code'], $attribute['type']);
301
 
302
  $joinCondiotion = array(
303
  "{$alias}.link_id = links.link_id",
@@ -331,4 +343,38 @@ class Mage_Catalog_Model_Resource_Product_Link_Product_Collection extends Mage_C
331
  }
332
  return parent::setOrder($attribute, $dir);
333
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
282
  return $this;
283
  }
284
 
285
+ /**
286
+ * Get table alias for link model attribute
287
+ *
288
+ * @param string $attributeCode
289
+ * @param string $attributeType
290
+ *
291
+ * @return string
292
+ */
293
+ protected function _getLinkAttributeTableAlias($attributeCode, $attributeType)
294
+ {
295
+ return sprintf('link_attribute_%s_%s', $attributeCode, $attributeType);
296
+ }
297
+
298
  /**
299
  * Join attributes
300
  *
307
  }
308
  $attributes = $this->getLinkModel()->getAttributes();
309
 
 
310
  foreach ($attributes as $attribute) {
311
  $table = $this->getLinkModel()->getAttributeTypeTable($attribute['type']);
312
+ $alias = $this->_getLinkAttributeTableAlias($attribute['code'], $attribute['type']);
313
 
314
  $joinCondiotion = array(
315
  "{$alias}.link_id = links.link_id",
343
  }
344
  return parent::setOrder($attribute, $dir);
345
  }
346
+
347
+ /**
348
+ * Add specific link model attribute to collection filter
349
+ *
350
+ * @param string $attributeCode
351
+ * @param array|null $condition
352
+ *
353
+ * @return Mage_Catalog_Model_Resource_Product_Link_Product_Collection
354
+ */
355
+ public function addLinkModelFieldToFilter($attributeCode, $condition = null)
356
+ {
357
+ if (!$this->getProduct() || !$this->getProduct()->getId()) {
358
+ return $this;
359
+ }
360
+
361
+ $attribute = null;
362
+ foreach ($this->getLinkModel()->getAttributes() as $attributeData) {
363
+ if ($attributeData['code'] == $attributeCode) {
364
+ $attribute = $attributeData;
365
+ break;
366
+ }
367
+ }
368
+
369
+ if (!$attribute) {
370
+ return $this;
371
+ }
372
+
373
+ $this->_hasLinkFilter = true;
374
+
375
+ $field = $this->_getLinkAttributeTableAlias($attribute['code'], $attribute['type']) . '.value';
376
+ $this->getSelect()->where($this->_getConditionSql($field, $condition));
377
+
378
+ return $this;
379
+ }
380
  }
app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php CHANGED
@@ -241,7 +241,7 @@ class Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
241
  }
242
 
243
  $values = array();
244
-
245
  foreach ($this->_items as $item) {
246
  $productAttribute = $item->getProductAttribute();
247
  if (!($productAttribute instanceof Mage_Eav_Model_Entity_Attribute_Abstract)) {
@@ -251,7 +251,7 @@ class Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
251
 
252
  $optionsByValue = array();
253
  foreach ($options as $option) {
254
- $optionsByValue[$option['value']] = $option['label'];
255
  }
256
 
257
  foreach ($this->getProduct()->getTypeInstance(true)
@@ -267,18 +267,23 @@ class Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
267
  $values[$item->getId() . ':' . $optionValue] = array(
268
  'product_super_attribute_id' => $item->getId(),
269
  'value_index' => $optionValue,
270
- 'label' => $optionsByValue[$optionValue],
271
- 'default_label' => $optionsByValue[$optionValue],
272
- 'store_label' => $optionsByValue[$optionValue],
273
  'is_percent' => 0,
274
  'pricing_value' => null,
275
- 'use_default_value' => true
 
276
  );
277
  }
278
  }
279
  }
280
  }
281
 
 
 
 
 
282
  foreach ($pricings[0] as $pricing) {
283
  // Addding pricing to options
284
  $valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index'];
241
  }
242
 
243
  $values = array();
244
+ $sortOrder = 1;
245
  foreach ($this->_items as $item) {
246
  $productAttribute = $item->getProductAttribute();
247
  if (!($productAttribute instanceof Mage_Eav_Model_Entity_Attribute_Abstract)) {
251
 
252
  $optionsByValue = array();
253
  foreach ($options as $option) {
254
+ $optionsByValue[$option['value']] = array('label' => $option['label'], 'order' => $sortOrder++);
255
  }
256
 
257
  foreach ($this->getProduct()->getTypeInstance(true)
267
  $values[$item->getId() . ':' . $optionValue] = array(
268
  'product_super_attribute_id' => $item->getId(),
269
  'value_index' => $optionValue,
270
+ 'label' => $optionsByValue[$optionValue]['label'],
271
+ 'default_label' => $optionsByValue[$optionValue]['label'],
272
+ 'store_label' => $optionsByValue[$optionValue]['label'],
273
  'is_percent' => 0,
274
  'pricing_value' => null,
275
+ 'use_default_value' => true,
276
+ 'order' => $optionsByValue[$optionValue]['order']
277
  );
278
  }
279
  }
280
  }
281
  }
282
 
283
+ uasort($values, function($a, $b) {
284
+ return $a['order'] - $b['order'];
285
+ });
286
+
287
  foreach ($pricings[0] as $pricing) {
288
  // Addding pricing to options
289
  $valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index'];
app/code/core/Mage/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.19.1.3-1.6.0.0.19.1.4.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Catalog
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
27
+
28
+ $installer = $this;
29
+ $installer->startSetup();
30
+ $connection = $installer->getConnection();
31
+
32
+ $catalogProductEntityTypeId = Mage::getSingleton('eav/config')->getEntityType('catalog_product')->getEntityTypeId();
33
+
34
+ $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
35
+ ->addFieldToFilter('frontend_input', 'multiselect')
36
+ ->addFieldToFilter('entity_type_id', $catalogProductEntityTypeId)
37
+ ->getItems();
38
+
39
+ foreach ($attributes as $attribute) {
40
+ $entityTypeId = $attribute->getEntityTypeId();
41
+ $attributeId = $attribute->getId();
42
+ $attributeTableOld = $installer->getAttributeTable($entityTypeId, $attributeId);
43
+
44
+ $installer->updateAttribute($entityTypeId, $attributeId, 'backend_type', 'text');
45
+
46
+ $attributeTableNew = $installer->getAttributeTable($entityTypeId, $attributeId);
47
+
48
+ if ($attributeTableOld != $attributeTableNew) {
49
+ $connection->disableTableKeys($attributeTableOld)
50
+ ->disableTableKeys($attributeTableNew);
51
+
52
+ $select = $connection->select()
53
+ ->from($attributeTableOld, array('entity_type_id', 'attribute_id', 'store_id', 'entity_id', 'value'))
54
+ ->where('entity_type_id = ?', $entityTypeId)
55
+ ->where('attribute_id = ?', $attributeId);
56
+
57
+ $query = $select->insertFromSelect($attributeTableNew,
58
+ array('entity_type_id', 'attribute_id', 'store_id', 'entity_id', 'value')
59
+ );
60
+
61
+ $connection->query($query);
62
+
63
+ $connection->delete($attributeTableOld,
64
+ $connection->quoteInto('entity_type_id = ?', $entityTypeId)
65
+ . $connection->quoteInto(' AND attribute_id = ?', $attributeId)
66
+ );
67
+
68
+ $connection->enableTableKeys($attributeTableOld)
69
+ ->enableTableKeys($attributeTableNew);
70
+ }
71
+ }
72
+
73
+ Mage::getModel('index/indexer')
74
+ ->getProcessByCode(Mage_Catalog_Helper_Product_Flat::CATALOG_FLAT_PROCESS_CODE)
75
+ ->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
76
+
77
+ $installer->endSetup();
app/code/core/Mage/Catalog/etc/config.xml CHANGED
@@ -28,7 +28,7 @@
28
  <config>
29
  <modules>
30
  <Mage_Catalog>
31
- <version>1.6.0.0.19.1.2</version>
32
  </Mage_Catalog>
33
  </modules>
34
  <admin>
@@ -807,6 +807,7 @@
807
  <product_image>
808
  <base_width>1800</base_width>
809
  <small_width>210</small_width>
 
810
  </product_image>
811
  <seo>
812
  <product_url_suffix>.html</product_url_suffix>
28
  <config>
29
  <modules>
30
  <Mage_Catalog>
31
+ <version>1.6.0.0.19.1.5</version>
32
  </Mage_Catalog>
33
  </modules>
34
  <admin>
807
  <product_image>
808
  <base_width>1800</base_width>
809
  <small_width>210</small_width>
810
+ <max_dimension>5000</max_dimension>
811
  </product_image>
812
  <seo>
813
  <product_url_suffix>.html</product_url_suffix>
app/code/core/Mage/Catalog/etc/system.xml CHANGED
@@ -211,6 +211,15 @@
211
  <show_in_website>1</show_in_website>
212
  <show_in_store>1</show_in_store>
213
  </small_width>
 
 
 
 
 
 
 
 
 
214
  </fields>
215
  </product_image>
216
  <placeholder translate="label">
211
  <show_in_website>1</show_in_website>
212
  <show_in_store>1</show_in_store>
213
  </small_width>
214
+ <max_dimension translate="label comment">
215
+ <label>Maximum resolution for upload image</label>
216
+ <comment>Maximum width and height resolutions for upload image</comment>
217
+ <frontend_type>text</frontend_type>
218
+ <sort_order>30</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>1</show_in_store>
222
+ </max_dimension>
223
  </fields>
224
  </product_image>
225
  <placeholder translate="label">
app/code/core/Mage/Catalog/sql/catalog_setup/upgrade-1.6.0.0.19.1.2-1.6.0.0.19.1.3.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Catalog
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ $installer = $this;
28
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
29
+
30
+ $attribute = 'special_price';
31
+ $installer
32
+ ->updateAttribute(
33
+ Mage_Catalog_Model_Product::ENTITY,
34
+ 'special_price',
35
+ 'note',
36
+ NULL
37
+ )
38
+ ->updateAttribute(
39
+ Mage_Catalog_Model_Product::ENTITY,
40
+ 'special_price',
41
+ 'frontend_class',
42
+ 'validate-special-price'
43
+ )
44
+ ;
app/code/core/Mage/Catalog/sql/catalog_setup/upgrade-1.6.0.0.19.1.4-1.6.0.0.19.1.5.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Catalog
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
28
+ $installer = $this;
29
+ $connection = $installer->getConnection();
30
+
31
+ $connection->addColumn($installer->getTable('catalog/product_attribute_group_price'), 'is_percent', array(
32
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
33
+ 'unsigned' => true,
34
+ 'nullable' => false,
35
+ 'default' => '0',
36
+ 'comment' => 'Is Percent',
37
+ ));
app/code/core/Mage/CatalogInventory/Model/Observer.php CHANGED
@@ -384,6 +384,7 @@ class Mage_CatalogInventory_Model_Observer
384
  $stockItem = $option->getProduct()->getStockItem();
385
 
386
  if ($quoteItem->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
 
387
  $stockItem->setProductName($quoteItem->getName());
388
  }
389
 
384
  $stockItem = $option->getProduct()->getStockItem();
385
 
386
  if ($quoteItem->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
387
+ $stockItem->setParentItem($quoteItem);
388
  $stockItem->setProductName($quoteItem->getName());
389
  }
390
 
app/code/core/Mage/CatalogInventory/Model/Stock/Item.php CHANGED
@@ -525,6 +525,27 @@ class Mage_CatalogInventory_Model_Stock_Item extends Mage_Core_Model_Abstract
525
  $qty = Mage::app()->getLocale()->getNumber($qty);
526
  }
527
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  /**
529
  * Check quantity type
530
  */
525
  $qty = Mage::app()->getLocale()->getNumber($qty);
526
  }
527
 
528
+ /**
529
+ * Check if child product assigned to parent
530
+ */
531
+ $parentItem = $this->getParentItem();
532
+ if ($this->getIsChildItem() && !empty($parentItem)) {
533
+ $typeInstance = $parentItem->getProduct()->getTypeInstance(true);
534
+ $requiredChildrenIds = $typeInstance->getChildrenIds($parentItem->getProductId(), true);
535
+ $childrenIds = array();
536
+ foreach ($requiredChildrenIds as $groupedChildrenIds) {
537
+ $childrenIds = array_merge($childrenIds, $groupedChildrenIds);
538
+ }
539
+ if (!in_array($this->getProductId(), $childrenIds)) {
540
+ $result->setHasError(true)
541
+ ->setMessage(Mage::helper('cataloginventory')
542
+ ->__('This product with current option is not available'))
543
+ ->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products are not available'))
544
+ ->setQuoteMessageIndex('stock');
545
+ return $result;
546
+ }
547
+ }
548
+
549
  /**
550
  * Check quantity type
551
  */
app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php CHANGED
@@ -319,8 +319,16 @@ class Mage_CatalogRule_Model_Action_Index_Refresh
319
  );
320
  $priceColumn = $this->_connection->getIfNullSql(
321
  $this->_connection->getIfNullSql(
322
- 'pg.value',
323
- 'pgd.value'
 
 
 
 
 
 
 
 
324
  ),
325
  'p.price'
326
  );
@@ -343,8 +351,22 @@ class Mage_CatalogRule_Model_Action_Index_Refresh
343
  );
344
  $priceColumn = $this->_connection->getIfNullSql(
345
  $this->_connection->getIfNullSql(
346
- 'pg.value',
347
- 'pgd.value'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  ),
349
  $this->_connection->getIfNullSql(
350
  'p.value',
319
  );
320
  $priceColumn = $this->_connection->getIfNullSql(
321
  $this->_connection->getIfNullSql(
322
+ $this->_connection->getCheckSql(
323
+ 'pg.is_percent = 1',
324
+ 'p.price * (100 - pg.value)/100',
325
+ 'pg.value'
326
+ ),
327
+ $this->_connection->getCheckSql(
328
+ 'pgd.is_percent = 1',
329
+ 'p.price * (100 - pgd.value)/100',
330
+ 'pgd.value'
331
+ )
332
  ),
333
  'p.price'
334
  );
351
  );
352
  $priceColumn = $this->_connection->getIfNullSql(
353
  $this->_connection->getIfNullSql(
354
+ $this->_connection->getCheckSql(
355
+ 'pg.is_percent = 1',
356
+ $this->_connection->getIfNullSql(
357
+ 'p.value',
358
+ 'pd.value'
359
+ ) . ' * (100 - pg.value)/100',
360
+ 'pg.value'
361
+ ),
362
+ $this->_connection->getCheckSql(
363
+ 'pgd.is_percent = 1',
364
+ $this->_connection->getIfNullSql(
365
+ 'p.value',
366
+ 'pd.value'
367
+ ) . ' * (100 - pgd.value)/100',
368
+ 'pgd.value'
369
+ )
370
  ),
371
  $this->_connection->getIfNullSql(
372
  'p.value',
app/code/core/Mage/CatalogSearch/Model/Resource/Advanced.php CHANGED
@@ -84,7 +84,7 @@ class Mage_CatalogSearch_Model_Resource_Advanced extends Mage_Core_Model_Resourc
84
  if (is_array($value)) {
85
  if (!empty($value['from']) || !empty($value['to'])) { // range
86
  $condition = $value;
87
- } else if ($attribute->getBackendType() == 'varchar') { // multiselect
88
  $condition = array('in_set' => $value);
89
  } else if (!isset($value['from']) && !isset($value['to'])) { // select
90
  $condition = array('in' => $value);
84
  if (is_array($value)) {
85
  if (!empty($value['from']) || !empty($value['to'])) { // range
86
  $condition = $value;
87
+ } else if (in_array($attribute->getBackendType(), array('varchar', 'text'))) { // multiselect
88
  $condition = array('in_set' => $value);
89
  } else if (!isset($value['from']) && !isset($value['to'])) { // select
90
  $condition = array('in' => $value);
app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php CHANGED
@@ -77,9 +77,10 @@ class Mage_CatalogSearch_Model_Resource_Fulltext extends Mage_Core_Model_Resourc
77
  */
78
  protected $_allowTableChanges = true;
79
 
80
-
81
-
82
-
 
83
 
84
  /**
85
  * Init resource model
@@ -298,12 +299,7 @@ class Mage_CatalogSearch_Model_Resource_Fulltext extends Mage_Core_Model_Resourc
298
  */
299
  public function resetSearchResults()
300
  {
301
- $adapter = $this->_getWriteAdapter();
302