Magento_Mobile - Version 1.4.2.0.23.0

Version Notes

1.4.2.0.23.0 version of package
internal svn revision #3cd616975d5927903d4f34bde0d9e5e2e727e9ba

Download this release

Release Info

Developer Magento Core Team
Extension Magento_Mobile
Version 1.4.2.0.23.0
Comparing to
See all releases


Code changes from version 1.4.1.0.23.0 to 1.4.2.0.23.0

Files changed (112) hide show
  1. app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tab/Settings.php +1 -1
  2. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Config.php +1 -1
  3. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard.php +1 -1
  4. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphInfo.php +1 -1
  5. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphTotalsData.php +1 -1
  6. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastOrders.php +1 -1
  7. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastSearchTerms.php +1 -1
  8. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/SalesInfo.php +1 -1
  9. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/TopSearchTerms.php +2 -2
  10. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Loginform.php +1 -1
  11. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php +20 -0
  12. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Images.php +1 -1
  13. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Notification/Helper.php +0 -167
  14. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php +17 -17
  15. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview.php +2 -0
  16. app/code/core/Mage/XmlConnect/Block/Cart.php +13 -12
  17. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals.php +29 -0
  18. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Giftcardaccount.php +4 -4
  19. app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Configurable.php +3 -75
  20. app/code/core/Mage/XmlConnect/Block/Cart/Items.php +11 -11
  21. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php +2 -2
  22. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/OrderDetails.php +2 -2
  23. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Review.php +0 -20
  24. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php +2 -76
  25. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php +6 -14
  26. app/code/core/Mage/XmlConnect/Block/Cart/Totals.php +5 -4
  27. app/code/core/Mage/XmlConnect/Block/Catalog.php +4 -4
  28. app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Giftcard.php +11 -12
  29. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php +1 -1
  30. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php +20 -20
  31. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php +27 -27
  32. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Giftcard.php +70 -108
  33. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php +10 -10
  34. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Simple.php +1 -1
  35. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Virtual.php +1 -1
  36. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php +3 -3
  37. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php +237 -237
  38. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Giftcard.php +6 -6
  39. app/code/core/Mage/XmlConnect/Block/Checkout/Address/Form.php +1 -48
  40. app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Configurable.php +1 -2
  41. app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Grouped.php +1 -2
  42. app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address.php +1 -1
  43. app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/Form.php +1 -1
  44. app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/List.php +34 -41
  45. app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review/Info.php +12 -12
  46. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Ccsave.php +3 -3
  47. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Ccsave.php +2 -2
  48. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Abstract.php +2 -2
  49. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Verisign.php +2 -2
  50. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/List.php +2 -28
  51. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/ListApi23.php +1 -1
  52. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Payflow.php +10 -10
  53. app/code/core/Mage/XmlConnect/Block/Checkout/Pbridge/Result.php +1 -1
  54. app/code/core/Mage/XmlConnect/Block/Configuration.php +1 -1
  55. app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php +0 -35
  56. app/code/core/Mage/XmlConnect/Block/Customer/Address/List.php +39 -46
  57. app/code/core/Mage/XmlConnect/Block/Customer/Form.php +121 -1
  58. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Bundle.php +7 -6
  59. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Downloadable.php +12 -0
  60. app/code/core/Mage/XmlConnect/Block/Customer/Order/List.php +10 -10
  61. app/code/core/Mage/XmlConnect/Block/Customer/Storecredit.php +9 -7
  62. app/code/core/Mage/XmlConnect/Block/Home.php +0 -1
  63. app/code/core/Mage/XmlConnect/Block/Homebanners.php +5 -4
  64. app/code/core/Mage/XmlConnect/Block/Localization.php +1 -1
  65. app/code/core/Mage/XmlConnect/Block/Review/Form.php +1 -1
  66. app/code/core/Mage/XmlConnect/Block/Wishlist.php +2 -2
  67. app/code/core/Mage/XmlConnect/Controller/AdminAction.php +3 -10
  68. app/code/core/Mage/XmlConnect/Helper/AdminApplication.php +2 -2
  69. app/code/core/Mage/XmlConnect/Helper/Android.php +86 -35
  70. app/code/core/Mage/XmlConnect/Helper/Customer/Form/Renderer.php +3 -3
  71. app/code/core/Mage/XmlConnect/Helper/Customer/Order.php +10 -10
  72. app/code/core/Mage/XmlConnect/Helper/Data.php +2 -1
  73. app/code/core/Mage/XmlConnect/Helper/Image.php +1 -3
  74. app/code/core/Mage/XmlConnect/Helper/Iphone.php +226 -11
  75. app/code/core/Mage/XmlConnect/Helper/Theme.php +1 -2
  76. app/code/core/Mage/XmlConnect/Model/AdminApplication.php +40 -0
  77. app/code/core/Mage/XmlConnect/Model/Application.php +6 -10
  78. app/code/core/Mage/XmlConnect/Model/ConfigData.php +8 -5
  79. app/code/core/Mage/XmlConnect/Model/Configuration.php +1 -1
  80. app/code/core/Mage/XmlConnect/Model/Corefix/Checkout/Session.php +137 -0
  81. app/code/core/Mage/XmlConnect/Model/Corefix/Checkout/Type/Onepage.php +465 -0
  82. app/code/core/Mage/XmlConnect/Model/Corefix/Sales/Quote.php +427 -0
  83. app/code/core/Mage/XmlConnect/Model/ImageLimits.php +8 -3
  84. app/code/core/Mage/XmlConnect/Model/Images.php +21 -29
  85. app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mecl.php +3 -28
  86. app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mep.php +2 -6
  87. app/code/core/Mage/XmlConnect/Model/Paypal/Mecl/Checkout.php +24 -0
  88. app/code/core/Mage/XmlConnect/Model/Paypal/Mep/Checkout.php +3 -2
  89. app/code/core/Mage/XmlConnect/Model/Queue.php +2 -8
  90. app/code/core/Mage/XmlConnect/Model/Resource/Application.php +5 -5
  91. app/code/core/Mage/XmlConnect/Model/Resource/ConfigData.php +5 -10
  92. app/code/core/Mage/XmlConnect/Model/Resource/History.php +2 -4
  93. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Validator/Abstract.php +15 -14
  94. app/code/core/Mage/XmlConnect/Model/Simplexml/Message/Error.php +3 -2
  95. app/code/core/Mage/XmlConnect/Model/Tabs.php +1 -0
  96. app/code/core/Mage/XmlConnect/Model/Template.php +1 -7
  97. app/code/core/Mage/XmlConnect/controllers/Adminhtml/Connect/ConfigController.php +2 -2
  98. app/code/core/Mage/XmlConnect/controllers/CartController.php +2 -2
  99. app/code/core/Mage/XmlConnect/controllers/CatalogController.php +62 -2
  100. app/code/core/Mage/XmlConnect/controllers/CheckoutController.php +1 -0
  101. app/code/core/Mage/XmlConnect/controllers/CustomerController.php +71 -54
  102. app/code/core/Mage/XmlConnect/controllers/Paypal/MeclController.php +47 -18
  103. app/code/core/Mage/XmlConnect/controllers/Paypal/MepController.php +6 -4
  104. app/code/core/Mage/XmlConnect/controllers/WishlistController.php +3 -4
  105. app/code/core/Mage/XmlConnect/etc/config.xml +0 -2
  106. app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-data-upgrade-1.6.0.0-1.6.0.0.1.php +5 -4
  107. app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +4 -3
  108. app/design/adminhtml/default/default/template/xmlconnect/edit/tab/content.phtml +3 -3
  109. app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/autocomplete.phtml +3 -3
  110. app/design/adminhtml/default/default/template/xmlconnect/form/element/addrow.phtml +1 -1
  111. app/design/adminhtml/default/default/template/xmlconnect/submission/app_icons_preview.phtml +2 -0
  112. package.xml +5 -5
app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tab/Settings.php CHANGED
@@ -59,7 +59,7 @@ class Mage_XmlConnect_Block_Adminhtml_Admin_Application_Edit_Tab_Settings
59
  'title' => $this->__('Enable Admin Application'),
60
  'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
61
  'required' => true,
62
- 'value' => (int)Mage::getSingleton('xmlconnect/configuration')->isActiveAdminApp()
63
  ));
64
 
65
  $this->setForm($form);
59
  'title' => $this->__('Enable Admin Application'),
60
  'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
61
  'required' => true,
62
+ 'value' => Mage::getSingleton('xmlconnect/configuration')->isActiveAdminApp()
63
  ));
64
 
65
  $this->setForm($form);
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Config.php CHANGED
@@ -31,7 +31,7 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Config extends Mage_Core_Block_Abstract
35
  {
36
  /**
37
  * Render login form xml
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Connect_Config extends Mage_Core_Block_Template
35
  {
36
  /**
37
  * Render login form xml
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard.php CHANGED
@@ -31,7 +31,7 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard extends Mage_Core_Block_Abstract
35
  {
36
  /**
37
  * Simple xml object
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard extends Mage_Core_Block_Template
35
  {
36
  /**
37
  * Simple xml object
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphInfo.php CHANGED
@@ -31,7 +31,7 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo extends Mage_Core_Block_Abstract
35
  {
36
  /**
37
  * Time range filter options
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo extends Mage_Core_Block_Template
35
  {
36
  /**
37
  * Time range filter options
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphTotalsData.php CHANGED
@@ -52,7 +52,7 @@ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphTotalsData extends
52
  */
53
  protected function _initCollection($storeId, $rangeId)
54
  {
55
- if (!is_object(Mage::getConfig()->getNode('modules/' . 'Mage_Reports'))) {
56
  return $this;
57
  }
58
 
52
  */
53
  protected function _initCollection($storeId, $rangeId)
54
  {
55
+ if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
56
  return $this;
57
  }
58
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastOrders.php CHANGED
@@ -46,7 +46,7 @@ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastOrders extends Mage_
46
  */
47
  public function addLastOrdersToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
48
  {
49
- if (!is_object(Mage::getConfig()->getNode('modules/' . 'Mage_Reports'))) {
50
  return $this;
51
  }
52
 
46
  */
47
  public function addLastOrdersToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
48
  {
49
+ if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
50
  return $this;
51
  }
52
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastSearchTerms.php CHANGED
@@ -57,7 +57,7 @@ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastSearchTerms
57
  */
58
  protected function _initCollection($storeId)
59
  {
60
- if (!is_object(Mage::getConfig()->getNode('modules/' . 'Mage_CatalogSearch'))) {
61
  return $this;
62
  }
63
  /** @var $_collection Mage_CatalogSearch_Model_Resource_Query_Collection */
57
  */
58
  protected function _initCollection($storeId)
59
  {
60
+ if (!Mage::helper('core')->isModuleEnabled('Mage_CatalogSearch')) {
61
  return $this;
62
  }
63
  /** @var $_collection Mage_CatalogSearch_Model_Resource_Query_Collection */
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/SalesInfo.php CHANGED
@@ -70,7 +70,7 @@ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_SalesInfo extends Mage_A
70
  */
71
  protected function _prepareLayout()
72
  {
73
- if (!is_object(Mage::getConfig()->getNode('modules/' . 'Mage_Reports'))) {
74
  return $this;
75
  }
76
 
70
  */
71
  protected function _prepareLayout()
72
  {
73
+ if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
74
  return $this;
75
  }
76
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/TopSearchTerms.php CHANGED
@@ -57,7 +57,7 @@ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
57
  */
58
  protected function _initCollection($storeId)
59
  {
60
- if (!is_object(Mage::getConfig()->getNode('modules/' . 'Mage_CatalogSearch'))) {
61
  return $this;
62
  }
63
  /** @var $_collection Mage_CatalogSearch_Model_Resource_Query_Collection */
@@ -82,7 +82,7 @@ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
82
  * Add last search terms info to xml object
83
  *
84
  * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
85
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
86
  */
87
  public function addTopSearchTermsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
88
  {
57
  */
58
  protected function _initCollection($storeId)
59
  {
60
+ if (!Mage::helper('core')->isModuleEnabled('Mage_CatalogSearch')) {
61
  return $this;
62
  }
63
  /** @var $_collection Mage_CatalogSearch_Model_Resource_Query_Collection */
82
  * Add last search terms info to xml object
83
  *
84
  * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
85
+ * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastOrders
86
  */
87
  public function addTopSearchTermsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
88
  {
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Loginform.php CHANGED
@@ -31,7 +31,7 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Loginform extends Mage_Core_Block_Abstract
35
  {
36
  /**
37
  * Render login form xml
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Connect_Loginform extends Mage_Core_Block_Template
35
  {
36
  /**
37
  * Render login form xml
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php CHANGED
@@ -104,6 +104,26 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
104
  return $this;
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  /**
108
  * Prepare label for tab
109
  *
104
  return $this;
105
  }
106
 
107
+ /**
108
+ * Retrieve add page button
109
+ *
110
+ * @return string
111
+ */
112
+ public function getAddButtonHtml()
113
+ {
114
+ return $this->getChildHtml('add_button');
115
+ }
116
+
117
+ /**
118
+ * Retrieve delete page button
119
+ *
120
+ * @return string
121
+ */
122
+ public function getDeleteButtonHtml()
123
+ {
124
+ return $this->getChildHtml('delete_button');
125
+ }
126
+
127
  /**
128
  * Prepare label for tab
129
  *
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Images.php CHANGED
@@ -168,7 +168,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Images extends Mage
168
  /**
169
  * Retrieve image config object
170
  *
171
- * @return Varien_Object
172
  */
173
  public function getConfig()
174
  {
168
  /**
169
  * Retrieve image config object
170
  *
171
+ * @return Varien_Config
172
  */
173
  public function getConfig()
174
  {
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Notification/Helper.php DELETED
@@ -1,167 +0,0 @@
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@magentocommerce.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.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_XmlConnect
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Notification_Helper extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
27
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
28
- {
29
- /**
30
- * Construnctor
31
- * Setting view options
32
- */
33
- public function __construct()
34
- {
35
- parent::__construct();
36
- $this->setShowGlobalIcon(true);
37
- }
38
-
39
- /**
40
- * Prepare form before rendering HTML
41
- * Setting Form Fieldsets and fields
42
- *
43
- * @return Mage_Adminhtml_Block_Widget_Form
44
- */
45
- protected function _prepareForm()
46
- {
47
- $form = new Varien_Data_Form();
48
-
49
- $this->setForm($form);
50
-
51
- $data = $this->getApplication()->getFormData();
52
-
53
- $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
54
-
55
- $fieldset = $form->addFieldset('notifications', array(
56
- 'legend' => Mage::helper('xmlconnect')->__('Push Notification'),
57
- ));
58
-
59
- $notificationEnabled = $fieldset->addField('conf/native/notifisations/isActive', 'select', array(
60
- 'label' => Mage::helper('xmlconnect')->__('Enable AirMail Message Push notification'),
61
- 'name' => 'conf[native][notifications][isActive]',
62
- 'values' => $yesNoValues,
63
- 'value' => (isset($data['conf[native][notifications][isActive]']) ? $data['conf[native][notifications][isActive]'] : '0'),
64
- ));
65
-
66
- $applicationKey = $fieldset->addField('conf/native/notifications/applicationKey', 'text', array(
67
- 'label' => Mage::helper('xmlconnect')->__('Application Key'),
68
- 'name' => 'conf[native][notifications][applicationKey]',
69
- 'value' => (isset($data['conf[native][notifications][applicationKey]']) ? $data['conf[native][notifications][applicationKey]'] : ''),
70
- 'required' => true
71
- ));
72
-
73
- $applicationSecret = $fieldset->addField('conf/native/notifications/applicationSecret', 'text', array(
74
- 'label' => Mage::helper('xmlconnect')->__('Application Secret'),
75
- 'name' => 'conf[native][notifications][applicationSecret]',
76
- 'value' => (isset($data['conf[native][notifications][applicationSecret]']) ? $data['conf[native][notifications][applicationSecret]'] : ''),
77
- 'required' => true
78
- ));
79
-
80
-
81
- $applicationMasterSecret = $fieldset->addField('conf/native/notifications/applicationMasterSecret', 'text', array(
82
- 'label' => Mage::helper('xmlconnect')->__('Application Master Secret'),
83
- 'name' => 'conf[native][notifications][applicationMasterSecret]',
84
- 'value' => (isset($data['conf[native][notifications][applicationMasterSecret]']) ? $data['conf[native][notifications][applicationMasterSecret]'] : ''),
85
- 'required' => true
86
- ));
87
-
88
- $mailboxTitle = $fieldset->addField('conf/native/notifications/mailboxTitle', 'text', array(
89
- 'label' => Mage::helper('xmlconnect')->__('Mailbox title'),
90
- 'name' => 'conf[native][notifications][mailboxTitle]',
91
- 'value' => (isset($data['conf[native][notifications][mailboxTitle]']) ? $data['conf[native][notifications][mailboxTitle]'] : ''),
92
- 'required' => true,
93
- 'note' => Mage::helper('xmlconnect')->__('The Mailbox title will be shown in the More Info tab. To understand more about the title, please <a href="some link">click here</a>')
94
- ));
95
-
96
- // field dependencies
97
- $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
98
- ->addFieldMap($applicationKey->getHtmlId(), $applicationKey->getName())
99
- ->addFieldMap($applicationSecret->getHtmlId(), $applicationSecret->getName())
100
- ->addFieldMap($applicationMasterSecret->getHtmlId(), $applicationMasterSecret->getName())
101
- ->addFieldMap($mailboxTitle->getHtmlId(), $mailboxTitle->getName())
102
- ->addFieldMap($notificationEnabled->getHtmlId(), $notificationEnabled->getName())
103
- ->addFieldDependence(
104
- $applicationKey->getName(),
105
- $notificationEnabled->getName(),
106
- 1)
107
- ->addFieldDependence(
108
- $applicationSecret->getName(),
109
- $notificationEnabled->getName(),
110
- 1)
111
- ->addFieldDependence(
112
- $applicationMasterSecret->getName(),
113
- $notificationEnabled->getName(),
114
- 1)
115
- ->addFieldDependence(
116
- $mailboxTitle->getName(),
117
- $notificationEnabled->getName(),
118
- 1)
119
- );
120
-
121
- return parent::_prepareForm();
122
- }
123
-
124
- /**
125
- * Tab label getter
126
- *
127
- * @return string
128
- */
129
- public function getTabLabel()
130
- {
131
- return Mage::helper('xmlconnect')->__('Push Notification');
132
- }
133
-
134
- /**
135
- * Tab title getter
136
- *
137
- * @return string
138
- */
139
- public function getTabTitle()
140
- {
141
- return Mage::helper('xmlconnect')->__('Push Notification');
142
- }
143
-
144
- /**
145
- * Check if tab can be shown
146
- *
147
- * @return bool
148
- */
149
- public function canShowTab()
150
- {
151
- return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
152
- }
153
-
154
- /**
155
- * Check if tab hidden
156
- *
157
- * @return bool
158
- */
159
- public function isHidden()
160
- {
161
- if (!$this->getData('conf/special/notifications_submitted')) {
162
- return false;
163
- } else {
164
- return true;
165
- }
166
- }
167
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php CHANGED
@@ -191,7 +191,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tab_Container_Submission
191
  $fieldset->addField('conf/submit_text/contact_email', 'text', array(
192
  'name' => 'conf[submit_text][email]',
193
  'label' => $this->__('Contact Email'),
194
- 'class' => 'validate-email email',
195
  'maxlength' => '40',
196
  'value' => isset($formData['conf[submit_text][email]']) ? $formData['conf[submit_text][email]'] : null,
197
  'note' => $this->__('Administrative contact for this app and for app submission issues.'),
@@ -270,54 +270,54 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tab_Container_Submission
270
  switch ($deviceType) {
271
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
272
  $this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
273
- $this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Required size: %spx x %spx.', 512, 512), '', true);
274
 
275
  $this->addImage($fieldset, 'conf/submit/loader_image', $this->__('Loader Splash Screen'),
276
- $this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 320, 460), '', true);
277
 
278
  $this->addImage($fieldset, 'conf/submit/loader_image_i4', $this->__('Loader Splash Screen <br />(iPhone 4 retina)'),
279
- $this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 640, 920), '', false);
280
 
281
  $this->addImage($fieldset, 'conf/submit/logo', $this->__('Custom App Icon'),
282
- $this->__('Icon that will appear on the user\'s phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Recommended size: %spx x %spx at %s dpi.', 57, 57, 72), '', true);
283
 
284
  $this->addImage($fieldset, 'conf/submit/logo_i4', $this->__('Custom App Icon <br />(iPhone 4 retina)'),
285
- $this->__('Icon that will appear on the user\'s phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Recommended size: %spx x %spx.', 114, 114), '', false);
286
 
287
  $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
288
- $this->__('Store logo that is displayed on copyright page of app.') . $this->__('Preferred size: %spx x %spx.', 100, 100), '', true);
289
 
290
  $this->addImage($fieldset, 'conf/submit/big_logo_i4', $this->__('Copyright Page Logo <br />(iPhone 4 retina)'),
291
- $this->__('Store logo that is displayed on copyright page of app.') . $this->__('Preferred size: %spx x %spx.', 200, 200), '', false);
292
  break;
293
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
294
  $this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
295
- $this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Required size: %spx x %spx.', 512, 512), '', true);
296
 
297
  $this->addImage($fieldset, 'conf/submit/ipad_loader_portrait_image', $this->__('Loader Splash Screen <br />(portrait mode)'),
298
- $this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 768, 1024), '', true);
299
 
300
  $this->addImage($fieldset, 'conf/submit/ipad_loader_landscape_image', $this->__('Loader Splash Screen <br />(landscape mode)'),
301
- $this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 1024, 768), '', true);
302
 
303
  $this->addImage($fieldset, 'conf/submit/ipad_logo', $this->__('Custom App Icon'),
304
- $this->__('Icon that will appear on the user\'s device after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Recommended size: %spx x %spx.', 72, 72), '', true);
305
 
306
  $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
307
- $this->__('Store logo that is displayed on copyright page of app.') . $this->__('Preferred size: %spx x %spx.', 100, 100), '', true);
308
  break;
309
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
310
  $this->addImage($fieldset, 'conf/submit/icon', $this->__('High Resolution Application Icon'),
311
- $this->__('The icon that appears in the Android Market.') . $this->__('Recommended size: %spx x %spx.', 512, 512) . $this->__('Maximum size: %s KB.', 1024), '', true);
312
 
313
  $this->addImage($fieldset, 'conf/submit/android_loader_image', $this->__('Loader Splash Screen'),
314
- $this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 320, 455), '', true);
315
 
316
  $this->addImage($fieldset, 'conf/submit/android_logo', $this->__('Custom App Icon'),
317
- $this->__('Icon that will appear on the user\'s device after they download your app.') . $this->__('Recommended size: %spx x %spx.', 48, 48), '', true);
318
 
319
  $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
320
- $this->__('Store logo that is displayed on copyright page of app.') . $this->__('Preferred size: %spx x %spx.', 100, 100), '', true);
321
  break;
322
  }
323
 
191
  $fieldset->addField('conf/submit_text/contact_email', 'text', array(
192
  'name' => 'conf[submit_text][email]',
193
  'label' => $this->__('Contact Email'),
194
+ 'class' => 'email',
195
  'maxlength' => '40',
196
  'value' => isset($formData['conf[submit_text][email]']) ? $formData['conf[submit_text][email]'] : null,
197
  'note' => $this->__('Administrative contact for this app and for app submission issues.'),
270
  switch ($deviceType) {
271
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
272
  $this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
273
+ $this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Required size: 512px x 512px.'), '', true);
274
 
275
  $this->addImage($fieldset, 'conf/submit/loader_image', $this->__('Loader Splash Screen'),
276
+ $this->__('Image that appears on first screen while your app is loading. Required size: 320px x 460px.'), '', true);
277
 
278
  $this->addImage($fieldset, 'conf/submit/loader_image_i4', $this->__('Loader Splash Screen <br />(iPhone 4 retina)'),
279
+ $this->__('Image that appears on first screen while your app is loading. Required size: 640px x 920px.'), '', false);
280
 
281
  $this->addImage($fieldset, 'conf/submit/logo', $this->__('Custom App Icon'),
282
+ $this->__('Icon that will appear on the users phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Recommended size: 57px x 57px at 72 dpi.'), '', true);
283
 
284
  $this->addImage($fieldset, 'conf/submit/logo_i4', $this->__('Custom App Icon <br />(iPhone 4 retina)'),
285
+ $this->__('Icon that will appear on the user\'s phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Recommended size: 114px x 114px.'), '', false);
286
 
287
  $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
288
+ $this->__('Store logo that is displayed on copyright page of app. Preferred size: 100px x 100px.'), '', true);
289
 
290
  $this->addImage($fieldset, 'conf/submit/big_logo_i4', $this->__('Copyright Page Logo <br />(iPhone 4 retina)'),
291
+ $this->__('Store logo that is displayed on copyright page of app. Preferred size: 200px x 200px.'), '', false);
292
  break;
293
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
294
  $this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
295
+ $this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Required size: 512px x 512px.'), '', true);
296
 
297
  $this->addImage($fieldset, 'conf/submit/ipad_loader_portrait_image', $this->__('Loader Splash Screen <br />(portrait mode)'),
298
+ $this->__('Image that appears on first screen while your app is loading. Required size: 768px x 1024px.'), '', true);
299
 
300
  $this->addImage($fieldset, 'conf/submit/ipad_loader_landscape_image', $this->__('Loader Splash Screen <br />(landscape mode)'),
301
+ $this->__('Image that appears on first screen while your app is loading. Required size: 1024px x 768px.'), '', true);
302
 
303
  $this->addImage($fieldset, 'conf/submit/ipad_logo', $this->__('Custom App Icon'),
304
+ $this->__('Icon that will appear on the user\'s device after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Recommended size: 72px x 72px.'), '', true);
305
 
306
  $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
307
+ $this->__('Store logo that is displayed on copyright page of app. Preferred size: 100px x 100px.'), '', true);
308
  break;
309
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
310
  $this->addImage($fieldset, 'conf/submit/icon', $this->__('High Resolution Application Icon'),
311
+ $this->__('The icon that appears in the Android Market. Recommended size: 512px x 512px. Maximum size: 1024 KB.'), '', true);
312
 
313
  $this->addImage($fieldset, 'conf/submit/android_loader_image', $this->__('Loader Splash Screen'),
314
+ $this->__('Image that appears on first screen while your app is loading. Required size: 320px x 455px.'), '', true);
315
 
316
  $this->addImage($fieldset, 'conf/submit/android_logo', $this->__('Custom App Icon'),
317
+ $this->__('Icon that will appear on the user\'s device after they download your app. Recommended size: 48px x 48px.'), '', true);
318
 
319
  $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
320
+ $this->__('Store logo that is displayed on copyright page of app. Preferred size: 100px x 100px.'), '', true);
321
  break;
322
  }
323
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview.php CHANGED
@@ -60,7 +60,9 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Preview extends Mage_Adminhtml_Bl
60
  $storeId = Mage::app()->getDefaultStoreView()->getId();
61
  }
62
 
 
63
  $templateProcessed = $template->getProcessedTemplate(array(), true);
 
64
 
65
  return $templateProcessed;
66
  }
60
  $storeId = Mage::app()->getDefaultStoreView()->getId();
61
  }
62
 
63
+ $template->emulateDesign($storeId);
64
  $templateProcessed = $template->getProcessedTemplate(array(), true);
65
+ $template->revertDesign();
66
 
67
  return $templateProcessed;
68
  }
app/code/core/Mage/XmlConnect/Block/Cart.php CHANGED
@@ -84,13 +84,13 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
84
  }
85
  }
86
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
87
- $incl = $this->helper('checkout')->getPriceInclTax($item);
88
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
89
  && $item->getWeeeTaxAppliedAmount()
90
  ) {
91
- $inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
92
  } else {
93
- $inclPrice = $incl - $item->getWeeeTaxDisposition();
94
  }
95
  }
96
  $exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
@@ -150,13 +150,13 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
150
  }
151
  }
152
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
153
- $incl = $this->helper('checkout')->getSubtotalInclTax($item);
154
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
155
  && $item->getWeeeTaxAppliedAmount()
156
  ) {
157
- $inclPrice = $incl + $item->getWeeeTaxAppliedRowAmount();
158
  } else {
159
- $inclPrice = $incl - $item->getWeeeTaxRowDisposition();
160
  }
161
  }
162
 
@@ -172,6 +172,7 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
172
  if ($this->helper('tax')->displayCartBothPrices()) {
173
  $subtotalPriceXmlObj->addAttribute('excluding_tax', $exclPrice);
174
  $subtotalPriceXmlObj->addAttribute('including_tax', $inclPrice);
 
175
  $subtotalFormattedPriceXmlObj->addAttribute('excluding_tax', $formattedExclPrice);
176
  $subtotalFormattedPriceXmlObj->addAttribute('including_tax', $formattedInclPrice);
177
  } else {
@@ -188,14 +189,14 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
188
  /**
189
  * Options list
190
  */
191
- $options = $renderer->getOptionList();
192
- if ($options) {
193
  $itemOptionsXml = $itemXml->addChild('options');
194
- foreach ($options as $option) {
195
- $formattedOptionValue = $renderer->getFormatedOptionValue($option);
196
  $optionXml = $itemOptionsXml->addChild('option');
197
- $optionXml->addAttribute('label', $xmlObject->xmlAttribute($option['label']));
198
- $optionXml->addAttribute('text', $xmlObject->xmlAttribute($formattedOptionValue['value']));
199
  }
200
  }
201
 
84
  }
85
  }
86
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
87
+ $_incl = $this->helper('checkout')->getPriceInclTax($item);
88
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
89
  && $item->getWeeeTaxAppliedAmount()
90
  ) {
91
+ $inclPrice = $_incl + $item->getWeeeTaxAppliedAmount();
92
  } else {
93
+ $inclPrice = $_incl - $item->getWeeeTaxDisposition();
94
  }
95
  }
96
  $exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
150
  }
151
  }
152
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
153
+ $_incl = $this->helper('checkout')->getSubtotalInclTax($item);
154
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
155
  && $item->getWeeeTaxAppliedAmount()
156
  ) {
157
+ $inclPrice = $_incl + $item->getWeeeTaxAppliedRowAmount();
158
  } else {
159
+ $inclPrice = $_incl - $item->getWeeeTaxRowDisposition();
160
  }
161
  }
162
 
172
  if ($this->helper('tax')->displayCartBothPrices()) {
173
  $subtotalPriceXmlObj->addAttribute('excluding_tax', $exclPrice);
174
  $subtotalPriceXmlObj->addAttribute('including_tax', $inclPrice);
175
+
176
  $subtotalFormattedPriceXmlObj->addAttribute('excluding_tax', $formattedExclPrice);
177
  $subtotalFormattedPriceXmlObj->addAttribute('including_tax', $formattedInclPrice);
178
  } else {
189
  /**
190
  * Options list
191
  */
192
+ $_options = $renderer->getOptionList();
193
+ if ($_options) {
194
  $itemOptionsXml = $itemXml->addChild('options');
195
+ foreach ($_options as $_option) {
196
+ $_formattedOptionValue = $renderer->getFormatedOptionValue($_option);
197
  $optionXml = $itemOptionsXml->addChild('option');
198
+ $optionXml->addAttribute('label', $xmlObject->xmlAttribute($_option['label']));
199
+ $optionXml->addAttribute('text', $xmlObject->xmlAttribute($_formattedOptionValue['value']));
200
  }
201
  }
202
 
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals.php CHANGED
@@ -40,6 +40,13 @@ class Mage_XmlConnect_Block_Cart_CartTotals extends Mage_Checkout_Block_Cart_Tot
40
  */
41
  protected $_defaultRenderer = 'xmlconnect/cart_cartTotals_default';
42
 
 
 
 
 
 
 
 
43
  /**
44
  * Render cart totals xml
45
  *
@@ -92,4 +99,26 @@ class Mage_XmlConnect_Block_Cart_CartTotals extends Mage_Checkout_Block_Cart_Tot
92
  $block->setTotals($this->getTotals());
93
  return $block;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
40
  */
41
  protected $_defaultRenderer = 'xmlconnect/cart_cartTotals_default';
42
 
43
+ /**
44
+ * Cart xml object
45
+ *
46
+ * @var null|Mage_XmlConnect_Model_Simplexml_Element
47
+ */
48
+ protected $_cartXmlObject;
49
+
50
  /**
51
  * Render cart totals xml
52
  *
99
  $block->setTotals($this->getTotals());
100
  return $block;
101
  }
102
+
103
+ /**
104
+ * Set cart xml object
105
+ *
106
+ * @param Mage_XmlConnect_Model_Simplexml_Element $cartXmlObject
107
+ * @return Mage_XmlConnect_Block_Cart_CartTotals
108
+ */
109
+ public function setCartXmlObject($cartXmlObject)
110
+ {
111
+ $this->_cartXmlObject = $cartXmlObject;
112
+ return $this;
113
+ }
114
+
115
+ /**
116
+ * Get cart xml object
117
+ *
118
+ * @return Mage_XmlConnect_Model_Simplexml_Element|null
119
+ */
120
+ public function getCartXmlObject()
121
+ {
122
+ return $this->_cartXmlObject;
123
+ }
124
  }
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Giftcardaccount.php CHANGED
@@ -45,16 +45,16 @@ class Mage_Xmlconnect_Block_Cart_CartTotals_Nodes_Giftcardaccount extends Mage_C
45
  }
46
  /** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
47
  $cartXmlObject = $this->getCartObject();
48
- $cards = $this->getTotal()->getGiftCards();
49
- if (!$cards) {
50
- $cards = $this->getQuoteGiftCards();
51
  }
52
  $code = $this->getTotal()->getCode();
53
 
54
  /** @var $giftCardsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
55
  $giftCardsXmlObj = $cartXmlObject->addCustomChild($code);
56
 
57
- foreach ($cards as $cardCode) {
58
  $giftCardValue = Mage::helper('xmlconnect')->formatPriceForXml($cardCode['a']);
59
  $formattedValue = $this->getQuote()->getStore()->formatPrice($giftCardValue, false);
60
  $giftCardsXmlObj->addCustomChild('item', '-' . $giftCardValue, array(
45
  }
46
  /** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
47
  $cartXmlObject = $this->getCartObject();
48
+ $_cards = $this->getTotal()->getGiftCards();
49
+ if (!$_cards) {
50
+ $_cards = $this->getQuoteGiftCards();
51
  }
52
  $code = $this->getTotal()->getCode();
53
 
54
  /** @var $giftCardsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
55
  $giftCardsXmlObj = $cartXmlObject->addCustomChild($code);
56
 
57
+ foreach ($_cards as $cardCode) {
58
  $giftCardValue = Mage::helper('xmlconnect')->formatPriceForXml($cardCode['a']);
59
  $formattedValue = $this->getQuote()->getStore()->formatPrice($giftCardValue, false);
60
  $giftCardsXmlObj->addCustomChild('item', '-' . $giftCardValue, array(
app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Configurable.php CHANGED
@@ -80,80 +80,8 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer_Configurable extends Mage_XmlConn
80
  */
81
  public function getOptionList()
82
  {
83
- return $this->_getConfigurableOptions($this->getItem());
84
- }
85
-
86
- /**
87
- * Retrieves configuration options for configurable product
88
- *
89
- * @param Mage_Sales_Model_Quote_Item $item
90
- * @return array
91
- */
92
- protected function _getConfigurableOptions($item)
93
- {
94
- $product = $item->getProduct();
95
- $typeId = $product->getTypeId();
96
- if ($typeId != Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
97
- Mage::throwException($this->__('Wrong product type to extract configurable options.'));
98
- }
99
- $attributes = $product->getTypeInstance(true)
100
- ->getSelectedAttributesInfo($product);
101
- return array_merge($attributes, $this->_getCustomOptions($item));
102
- }
103
-
104
- /**
105
- * Retrieves product configuration options
106
- *
107
- * @param Mage_Sales_Model_Quote_Item $item
108
- * @return array
109
- */
110
- protected function _getCustomOptions($item)
111
- {
112
- $product = $item->getProduct();
113
- $options = array();
114
- $optionIds = $item->getOptionByCode('option_ids');
115
- if ($optionIds) {
116
- $options = array();
117
- foreach (explode(',', $optionIds->getValue()) as $optionId) {
118
- $option = $product->getOptionById($optionId);
119
- if ($option) {
120
- $itemOption = $item->getOptionByCode('option_' . $option->getId());
121
- $group = $option->groupFactory($option->getType())
122
- ->setOption($option)
123
- ->setConfigurationItem($item)
124
- ->setConfigurationItemOption($itemOption);
125
-
126
- if ('file' == $option->getType()) {
127
- $downloadParams = $item->getFileDownloadParams();
128
- if ($downloadParams) {
129
- $url = $downloadParams->getUrl();
130
- if ($url) {
131
- $group->setCustomOptionDownloadUrl($url);
132
- }
133
- $urlParams = $downloadParams->getUrlParams();
134
- if ($urlParams) {
135
- $group->setCustomOptionUrlParams($urlParams);
136
- }
137
- }
138
- }
139
-
140
- $options[] = array(
141
- 'label' => $option->getTitle(),
142
- 'value' => $group->getFormattedOptionValue($itemOption->getValue()),
143
- 'print_value' => $group->getPrintableOptionValue($itemOption->getValue()),
144
- 'option_id' => $option->getId(),
145
- 'option_type' => $option->getType(),
146
- 'custom_view' => $group->isCustomizedView()
147
- );
148
- }
149
- }
150
- }
151
-
152
- $addOptions = $item->getOptionByCode('additional_options');
153
- if ($addOptions) {
154
- $options = array_merge($options, unserialize($addOptions->getValue()));
155
- }
156
-
157
- return $options;
158
  }
159
  }
80
  */
81
  public function getOptionList()
82
  {
83
+ /* @var $helper Mage_Catalog_Helper_Product_Configuration */
84
+ $helper = Mage::helper('catalog/product_configuration');
85
+ return $helper->getConfigurableOptions($this->getItem());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  }
87
  }
app/code/core/Mage/XmlConnect/Block/Cart/Items.php CHANGED
@@ -77,13 +77,13 @@ class Mage_XmlConnect_Block_Cart_Items extends Mage_Checkout_Block_Cart_Abstract
77
  }
78
  }
79
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
80
- $incl = $this->helper('checkout')->getPriceInclTax($item);
81
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
82
  && $item->getWeeeTaxAppliedAmount()
83
  ) {
84
- $inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
85
  } else {
86
- $inclPrice = $incl - $item->getWeeeTaxDisposition();
87
  }
88
  }
89
  $exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
@@ -162,13 +162,13 @@ class Mage_XmlConnect_Block_Cart_Items extends Mage_Checkout_Block_Cart_Abstract
162
  }
163
  }
164
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
165
- $incl = $this->helper('checkout')->getSubtotalInclTax($item);
166
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
167
  && $item->getWeeeTaxAppliedAmount()
168
  ) {
169
- $subtotalInclTax = $incl + $item->getWeeeTaxAppliedRowAmount();
170
  } else {
171
- $subtotalInclTax = $incl - $item->getWeeeTaxRowDisposition();
172
  }
173
  }
174
 
@@ -212,14 +212,14 @@ class Mage_XmlConnect_Block_Cart_Items extends Mage_Checkout_Block_Cart_Abstract
212
  /**
213
  * Options list
214
  */
215
- $options = $renderer->getOptionList();
216
- if ($options) {
217
  $itemOptionsXml = $itemXml->addCustomChild('options');
218
- foreach ($options as $_option) {
219
- $formattedOptionValue = $renderer->getFormatedOptionValue($_option);
220
  $itemOptionsXml->addCustomChild('option', null, array(
221
  'label' => $xmlObject->xmlAttribute($_option['label']),
222
- 'text' => $xmlObject->xmlAttribute($formattedOptionValue['value'])
223
  ));
224
  }
225
  }
77
  }
78
  }
79
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
80
+ $_incl = $this->helper('checkout')->getPriceInclTax($item);
81
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
82
  && $item->getWeeeTaxAppliedAmount()
83
  ) {
84
+ $inclPrice = $_incl + $item->getWeeeTaxAppliedAmount();
85
  } else {
86
+ $inclPrice = $_incl - $item->getWeeeTaxDisposition();
87
  }
88
  }
89
  $exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
162
  }
163
  }
164
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
165
+ $_incl = $this->helper('checkout')->getSubtotalInclTax($item);
166
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
167
  && $item->getWeeeTaxAppliedAmount()
168
  ) {
169
+ $subtotalInclTax = $_incl + $item->getWeeeTaxAppliedRowAmount();
170
  } else {
171
+ $subtotalInclTax = $_incl - $item->getWeeeTaxRowDisposition();
172
  }
173
  }
174
 
212
  /**
213
  * Options list
214
  */
215
+ $_options = $renderer->getOptionList();
216
+ if ($_options) {
217
  $itemOptionsXml = $itemXml->addCustomChild('options');
218
+ foreach ($_options as $_option) {
219
+ $_formattedOptionValue = $renderer->getFormatedOptionValue($_option);
220
  $itemOptionsXml->addCustomChild('option', null, array(
221
  'label' => $xmlObject->xmlAttribute($_option['label']),
222
+ 'text' => $xmlObject->xmlAttribute($_formattedOptionValue['value'])
223
  ));
224
  }
225
  }
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php CHANGED
@@ -42,8 +42,8 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details extends Mage_Paypal_Block_E
42
  public function addDetailsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
43
  {
44
  $itemsXmlObj = $reviewXmlObj->addChild('ordered_items');
45
- foreach ($this->getItems() as $item) {
46
- $this->getItemXml($item, $itemsXmlObj);
47
  }
48
 
49
  $reviewXmlObj->appendChild($this->getChild('totals')->setReturnObjectFlag(true)->_toHtml());
42
  public function addDetailsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
43
  {
44
  $itemsXmlObj = $reviewXmlObj->addChild('ordered_items');
45
+ foreach ($this->getItems() as $_item) {
46
+ $this->getItemXml($_item, $itemsXmlObj);
47
  }
48
 
49
  $reviewXmlObj->appendChild($this->getChild('totals')->setReturnObjectFlag(true)->_toHtml());
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/OrderDetails.php CHANGED
@@ -42,8 +42,8 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_OrderDetails extends Mage_Paypal_Bl
42
  public function addDetailsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
43
  {
44
  $itemsXmlObj = $reviewXmlObj->addChild('ordered_items');
45
- foreach ($this->getItems() as $item) {
46
- $this->getItemXml($item, $itemsXmlObj);
47
  }
48
 
49
  $this->getChild('totals')->setCartXmlObject($reviewXmlObj)->_toHtml();
42
  public function addDetailsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
43
  {
44
  $itemsXmlObj = $reviewXmlObj->addChild('ordered_items');
45
+ foreach ($this->getItems() as $_item) {
46
+ $this->getItemXml($_item, $itemsXmlObj);
47
  }
48
 
49
  $this->getChild('totals')->setCartXmlObject($reviewXmlObj)->_toHtml();
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Review.php CHANGED
@@ -33,26 +33,6 @@
33
  */
34
  class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Review extends Mage_Paypal_Block_Express_Review
35
  {
36
- /**
37
- * Get shipping rate code title and its price
38
- *
39
- * @param Varien_Object $rate
40
- * @return string
41
- */
42
- protected function _renderShippingRateOption($rate)
43
- {
44
- $result = $rate->getMethodTitle();
45
- $_excl = $this->getShippingPrice($rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax());
46
- $_incl = $this->getShippingPrice($rate->getPrice(), true);
47
-
48
- $result .= ' - ' . $_excl;
49
-
50
- if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl) {
51
- $result .= ' (' . $this->__('Incl. Tax') . ' ' . $_incl .')';
52
- }
53
- return $result;
54
- }
55
-
56
  /**
57
  * Render PayPal MECL details xml
58
  *
33
  */
34
  class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Review extends Mage_Paypal_Block_Express_Review
35
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Render PayPal MECL details xml
38
  *
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php CHANGED
@@ -70,7 +70,7 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods extends Mage_Paypal
70
 
71
  if (Mage::helper('xmlconnect')->checkApiVersion(Mage_XmlConnect_Helper_Data::DEVICE_API_V_23)) {
72
  if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
73
- $groups = $this->getShippingRates();
74
  if ($groups) {
75
  $currentRate = $this->getCurrentShippingRate();
76
  foreach ($groups as $code => $rates) {
@@ -108,7 +108,7 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods extends Mage_Paypal
108
  }
109
  } else {
110
  if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
111
- $groups = $this->getShippingRates();
112
  if ($groups) {
113
  $currentRate = $this->getCurrentShippingRate();
114
  foreach ($groups as $code => $rates) {
@@ -170,78 +170,4 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods extends Mage_Paypal
170
  $attributes = $code ? array('label' => $this->getCarrierName($code)) : array();
171
  return $methodListXmlObj->addCustomChild('method', null, $attributes)->addCustomChild('rates');
172
  }
173
-
174
- /**
175
- * Get either shipping rate code or empty value on error
176
- *
177
- * @param Varien_Object $rate
178
- * @return string
179
- */
180
- public function renderShippingRateValue(Varien_Object $rate)
181
- {
182
- if ($rate->getErrorMessage()) {
183
- return '';
184
- }
185
- return $rate->getCode();
186
- }
187
-
188
- /**
189
- * Get current shipping rate
190
- *
191
- * @return Mage_Sales_Model_Quote_Address_Rate|bool
192
- */
193
- public function getCurrentShippingRate()
194
- {
195
- /** @var $address Mage_Sales_Model_Quote_Address */
196
- $address = $this->getAddress();
197
- return $address->getShippingRateByCode($address->getShippingMethod());
198
- }
199
-
200
- /**
201
- * Get shipping rate code title and its price or error message
202
- *
203
- * @param Varien_Object $rate
204
- * @param string $format
205
- * @param string $inclTaxFormat
206
- * @return string
207
- */
208
- public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)')
209
- {
210
- $renderedInclTax = '';
211
- if ($rate->getErrorMessage()) {
212
- $price = $rate->getErrorMessage();
213
- } else {
214
- $price = $this->_getShippingPrice($rate->getPrice(), $this->helper('tax')
215
- ->displayShippingPriceIncludingTax());
216
- $incl = $this->_getShippingPrice($rate->getPrice(), true);
217
- if (($incl != $price) && $this->helper('tax')->displayShippingBothPrices()) {
218
- $renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl);
219
- }
220
- }
221
- return sprintf($format, $rate->getMethodTitle(), $price, $renderedInclTax);
222
- }
223
-
224
- /**
225
- * Return formatted shipping price
226
- *
227
- * @param float $price
228
- * @param bool $isInclTax
229
- *
230
- * @return bool
231
- */
232
- protected function _getShippingPrice($price, $isInclTax)
233
- {
234
- return $this->_formatPrice($this->helper('tax')->getShippingPrice($price, $isInclTax, $this->_address));
235
- }
236
-
237
- /**
238
- * Format price base on store convert price method
239
- *
240
- * @param float $price
241
- * @return string
242
- */
243
- protected function _formatPrice($price)
244
- {
245
- return $this->_quote->getStore()->convertPrice($price, true);
246
- }
247
  }
70
 
71
  if (Mage::helper('xmlconnect')->checkApiVersion(Mage_XmlConnect_Helper_Data::DEVICE_API_V_23)) {
72
  if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
73
+ $groups = $this->getShippingRateGroups();
74
  if ($groups) {
75
  $currentRate = $this->getCurrentShippingRate();
76
  foreach ($groups as $code => $rates) {
108
  }
109
  } else {
110
  if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
111
+ $groups = $this->getShippingRateGroups();
112
  if ($groups) {
113
  $currentRate = $this->getCurrentShippingRate();
114
  foreach ($groups as $code => $rates) {
170
  $attributes = $code ? array('label' => $this->getCarrierName($code)) : array();
171
  return $methodListXmlObj->addCustomChild('method', null, $attributes)->addCustomChild('rates');
172
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  }
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php CHANGED
@@ -40,21 +40,13 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mep_Totals extends Mage_Checkout_Block_C
40
  */
41
  protected function _toHtml()
42
  {
43
- $quote = $this->getQuote();
 
44
  /** @var $totalsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
45
- $totalsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<cart_totals></cart_totals>');
46
-
47
- list($items, $totals) = Mage::helper('paypal')->prepareLineItems($quote);
48
-
49
- if (Mage::helper('paypal')->areCartLineItemsValid($items, $totals, $quote->getBaseGrandTotal())) {
50
- foreach ($totals as $key => $total) {
51
- $totalAmount = $this->helper('core')->currency($total, false, false);
52
- $totalsXmlObj->addChild($key, sprintf('%01.2F', $totalAmount));
53
- }
54
- } else {
55
- Mage::throwException(
56
- Mage::helper('xmlconnect')->__('Cart line items are not eligible for exporting to PayPal API')
57
- );
58
  }
59
 
60
  $paypalTotals = $totalsXmlObj->addChild('paypal_totals');
40
  */
41
  protected function _toHtml()
42
  {
43
+ /** @var $paypalCart Mage_Paypal_Model_Cart */
44
+ $paypalCart = Mage::getModel('paypal/cart', array($this->getQuote()));
45
  /** @var $totalsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
46
+ $totalsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<cart_totals></cart_totals>');
47
+ foreach ($paypalCart->getTotals(true) as $code => $amount) {
48
+ $currencyAmount = $this->helper('core')->currency($amount, false, false);
49
+ $totalsXmlObj->addChild($code, sprintf('%01.2F', $currencyAmount));
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
  $paypalTotals = $totalsXmlObj->addChild('paypal_totals');
app/code/core/Mage/XmlConnect/Block/Cart/Totals.php CHANGED
@@ -90,6 +90,7 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
90
  $this->_addTotalDataToXmlObj(
91
  $totalsXmlObj, $code . '_excl_tax', $title, $grandTotalExlTax
92
  );
 
93
  $code = $code . '_incl_tax';
94
  $title = $this->__('Grand Total (Incl. Tax)');
95
  }
@@ -100,12 +101,12 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
100
  }
101
  continue 2;
102
  case 'giftcardaccount':
103
- $cards = $renderer->getTotal()->getGiftCards();
104
- if (!$cards) {
105
- $cards = $renderer->getQuoteGiftCards();
106
  }
107
  if ($renderer->getTotal()->getValue()) {
108
- foreach ($cards as $cardCode) {
109
  $title = $this->__('Gift Card (%s)', $cardCode['c']);
110
  $value = $cardCode['c'];
111
  $totalXmlObj = $totalsXmlObj->addChild($code);
90
  $this->_addTotalDataToXmlObj(
91
  $totalsXmlObj, $code . '_excl_tax', $title, $grandTotalExlTax
92
  );
93
+
94
  $code = $code . '_incl_tax';
95
  $title = $this->__('Grand Total (Incl. Tax)');
96
  }
101
  }
102
  continue 2;
103
  case 'giftcardaccount':
104
+ $_cards = $renderer->getTotal()->getGiftCards();
105
+ if (!$_cards) {
106
+ $_cards = $renderer->getQuoteGiftCards();
107
  }
108
  if ($renderer->getTotal()->getValue()) {
109
+ foreach ($_cards as $cardCode) {
110
  $title = $this->__('Gift Card (%s)', $cardCode['c']);
111
  $value = $cardCode['c'];
112
  $totalXmlObj = $totalsXmlObj->addChild($code);
app/code/core/Mage/XmlConnect/Block/Catalog.php CHANGED
@@ -116,13 +116,13 @@ class Mage_XmlConnect_Block_Catalog extends Mage_Catalog_Block_Product_List_Tool
116
  $sortOptions = array_merge(array('relevance' => $this->__('Relevance')), $sortOptions);
117
  $this->setAvailableOrders($sortOptions)->setDefaultDirection('desc')->setSortBy('relevance');
118
 
119
- foreach($this->getAvailableOrders() as $key => $order) {
120
  $item = $ordersXmlObject->addChild('item');
121
- if ($this->isOrderCurrent($key)) {
122
  $item->addAttribute('isDefault', 1);
123
  }
124
- $item->addChild('code', $key);
125
- $item->addChild('name', $ordersXmlObject->escapeXml($order));
126
  }
127
  return $ordersXmlObject;
128
  }
116
  $sortOptions = array_merge(array('relevance' => $this->__('Relevance')), $sortOptions);
117
  $this->setAvailableOrders($sortOptions)->setDefaultDirection('desc')->setSortBy('relevance');
118
 
119
+ foreach($this->getAvailableOrders() as $_key => $_order) {
120
  $item = $ordersXmlObject->addChild('item');
121
+ if ($this->isOrderCurrent($_key)) {
122
  $item->addAttribute('isDefault', 1);
123
  }
124
+ $item->addChild('code', $_key);
125
+ $item->addChild('name', $ordersXmlObject->escapeXml($_order));
126
  }
127
  return $ordersXmlObject;
128
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Giftcard.php CHANGED
@@ -66,31 +66,30 @@ class Mage_XmlConnect_Block_Catalog_Product_ItemPrice_Giftcard extends Mage_Bund
66
  *
67
  * @param Mage_Catalog_Model_Product $product
68
  * @param Mage_XmlConnect_Model_Simplexml_Element $item
69
- * @return null
70
  */
71
- public function collectProductPrices(Mage_Catalog_Model_Product $product,
72
- Mage_XmlConnect_Model_Simplexml_Element $item)
73
- {
74
  $this->setProduct($product);
75
 
76
  if ($product->getCanShowPrice() !== false) {
77
  $priceListXmlObj = $item->addCustomChild('price_list');
78
 
79
- $min = $this->getMinAmount();
80
- $max = $this->getMaxAmount();
81
- if ($min && $max && $min == $max) {
82
  $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
83
- $pricesXmlObj->addCustomChild('price', $min, array(
84
  'id' => 'regular',
85
  'label' => $this->__('Regular'),
86
- 'formatted_value' => Mage::helper('core')->currency($min, true, false)
87
  ));
88
- } elseif ($min && $min != 0) {
89
  $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
90
- $pricesXmlObj->addCustomChild('price', $min, array(
91
  'id' => 'regular',
92
  'label' => $this->__('From'),
93
- 'formatted_value' => Mage::helper('core')->currency($min, true, false)
94
  ));
95
  }
96
  }
66
  *
67
  * @param Mage_Catalog_Model_Product $product
68
  * @param Mage_XmlConnect_Model_Simplexml_Element $item
 
69
  */
70
+ public function collectProductPrices(
71
+ Mage_Catalog_Model_Product $product, Mage_XmlConnect_Model_Simplexml_Element $item
72
+ ) {
73
  $this->setProduct($product);
74
 
75
  if ($product->getCanShowPrice() !== false) {
76
  $priceListXmlObj = $item->addCustomChild('price_list');
77
 
78
+ $_min = $this->getMinAmount();
79
+ $_max = $this->getMaxAmount();
80
+ if ($_min && $_max && $_min == $_max) {
81
  $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
82
+ $pricesXmlObj->addCustomChild('price', $_min, array(
83
  'id' => 'regular',
84
  'label' => $this->__('Regular'),
85
+ 'formatted_value' => Mage::helper('core')->currency($_min, true, false)
86
  ));
87
+ } elseif ($_min && $_min != 0) {
88
  $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
89
+ $pricesXmlObj->addCustomChild('price', $_min, array(
90
  'id' => 'regular',
91
  'label' => $this->__('From'),
92
+ 'formatted_value' => Mage::helper('core')->currency($_min, true, false)
93
  ));
94
  }
95
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php CHANGED
@@ -64,7 +64,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options extends Mage_XmlConnect_Bloc
64
  }
65
 
66
  /**
67
- * Create produc custom options Mage_XmlConnect_Model_Simplexml_Element object
68
  *
69
  * @param Mage_Catalog_Model_Product $product
70
  * @return Mage_XmlConnect_Model_Simplexml_Element
64
  }
65
 
66
  /**
67
+ * Create product custom options Mage_XmlConnect_Model_Simplexml_Element object
68
  *
69
  * @param Mage_Catalog_Model_Product $product
70
  * @return Mage_XmlConnect_Model_Simplexml_Element
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php CHANGED
@@ -66,9 +66,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
66
  return $isObject ? $xmlModel : $xmlModel->asNiceXml();
67
  }
68
 
69
- foreach ($bundleOptions as $option) {
70
- $selections = $option->getSelections();
71
- $optionId = $option->getOptionId();
72
  if (empty($selections)) {
73
  continue;
74
  }
@@ -76,43 +76,43 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
76
  $optionNode = $optionsXmlObj->addChild('option');
77
 
78
  $type = parent::OPTION_TYPE_SELECT;
79
- if ($option->isMultiSelection()) {
80
  $type = parent::OPTION_TYPE_CHECKBOX;
81
  }
82
- $code = 'bundle_option[' . $option->getId() . ']';
83
  if ($type == parent::OPTION_TYPE_CHECKBOX) {
84
  $code .= '[]';
85
  }
86
  $optionNode->addAttribute('code', $code);
87
  $optionNode->addAttribute('type', $type);
88
- $optionNode->addAttribute('label', $optionsXmlObj->escapeXml($option->getTitle()));
89
- if ($option->getRequired()) {
90
  $optionNode->addAttribute('is_required', 1);
91
  }
92
 
93
- foreach ($selections as $selection) {
94
- if (!$selection->isSaleable()) {
95
  continue;
96
  }
97
- $qty = null;
98
  if ($product->hasPreconfiguredValues()) {
99
- $qty = $product->getPreconfiguredValues()->getData("bundle_option_qty/{$optionId}");
100
  }
101
- if (null === $qty) {
102
- $qty = !($selection->getSelectionQty() * 1) ? '1' : $selection->getSelectionQty() * 1;
103
  }
104
 
105
  $valueNode = $optionNode->addChild('value');
106
- $valueNode->addAttribute('code', $selection->getSelectionId());
107
- $valueNode->addAttribute('label', $optionsXmlObj->escapeXml($selection->getName()));
108
- if (!$option->isMultiSelection()) {
109
- if ($selection->getSelectionCanChangeQty()) {
110
  $valueNode->addAttribute('is_qty_editable', 1);
111
  }
112
  }
113
- $valueNode->addAttribute('qty', $qty);
114
 
115
- $price = $product->getPriceModel()->getSelectionPreFinalPrice($product, $selection);
116
  $price = Mage::helper('xmlconnect')->formatPriceForXml($price);
117
  if ((float)$price != 0.00) {
118
  $valueNode->addAttribute('price', Mage::helper('xmlconnect')->formatPriceForXml(
@@ -123,7 +123,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
123
 
124
  if ($product->hasPreconfiguredValues()) {
125
  $this->_setCartSelectedValue($valueNode, $type, $this->_getPreconfiguredOption(
126
- $optionData, $optionId, $selection->getSelectionId()
127
  ));
128
  }
129
  }
66
  return $isObject ? $xmlModel : $xmlModel->asNiceXml();
67
  }
68
 
69
+ foreach ($bundleOptions as $_option) {
70
+ $selections = $_option->getSelections();
71
+ $optionId = $_option->getOptionId();
72
  if (empty($selections)) {
73
  continue;
74
  }
76
  $optionNode = $optionsXmlObj->addChild('option');
77
 
78
  $type = parent::OPTION_TYPE_SELECT;
79
+ if ($_option->isMultiSelection()) {
80
  $type = parent::OPTION_TYPE_CHECKBOX;
81
  }
82
+ $code = 'bundle_option[' . $_option->getId() . ']';
83
  if ($type == parent::OPTION_TYPE_CHECKBOX) {
84
  $code .= '[]';
85
  }
86
  $optionNode->addAttribute('code', $code);
87
  $optionNode->addAttribute('type', $type);
88
+ $optionNode->addAttribute('label', $optionsXmlObj->escapeXml($_option->getTitle()));
89
+ if ($_option->getRequired()) {
90
  $optionNode->addAttribute('is_required', 1);
91
  }
92
 
93
+ foreach ($selections as $_selection) {
94
+ if (!$_selection->isSaleable()) {
95
  continue;
96
  }
97
+ $_qty = null;
98
  if ($product->hasPreconfiguredValues()) {
99
+ $_qty = $product->getPreconfiguredValues()->getData("bundle_option_qty/{$optionId}");
100
  }
101
+ if (null === $_qty) {
102
+ $_qty = !($_selection->getSelectionQty() * 1) ? '1' : $_selection->getSelectionQty() * 1;
103
  }
104
 
105
  $valueNode = $optionNode->addChild('value');
106
+ $valueNode->addAttribute('code', $_selection->getSelectionId());
107
+ $valueNode->addAttribute('label', $optionsXmlObj->escapeXml($_selection->getName()));
108
+ if (!$_option->isMultiSelection()) {
109
+ if ($_selection->getSelectionCanChangeQty()) {
110
  $valueNode->addAttribute('is_qty_editable', 1);
111
  }
112
  }
113
+ $valueNode->addAttribute('qty', $_qty);
114
 
115
+ $price = $product->getPriceModel()->getSelectionPreFinalPrice($product, $_selection);
116
  $price = Mage::helper('xmlconnect')->formatPriceForXml($price);
117
  if ((float)$price != 0.00) {
118
  $valueNode->addAttribute('price', Mage::helper('xmlconnect')->formatPriceForXml(
123
 
124
  if ($product->hasPreconfiguredValues()) {
125
  $this->_setCartSelectedValue($valueNode, $type, $this->_getPreconfiguredOption(
126
+ $optionData, $optionId, $_selection->getSelectionId()
127
  ));
128
  }
129
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php CHANGED
@@ -37,7 +37,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
37
  * Generate bundle product options xml
38
  *
39
  * @param Mage_Catalog_Model_Product $product
40
- * @param bool
41
  * @return string | Mage_XmlConnect_Model_Simplexml_Element
42
  */
43
  public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
@@ -57,28 +57,28 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
57
  /**
58
  * Configurable attributes
59
  */
60
- $productAttributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
61
- if (!sizeof($productAttributes)) {
62
  return $isObject ? $xmlModel : $xmlModel->asNiceXml();
63
  }
64
 
65
- $allowProducts = array();
66
- $allProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
67
- foreach ($allProducts as $productItem) {
68
- if ($productItem->isSaleable()) {
69
- $allowProducts[] = $productItem;
70
  }
71
  }
72
 
73
  /**
74
  * Allowed products options
75
  */
76
- foreach ($allowProducts as $item) {
77
- $productId = $item->getId();
78
 
79
- foreach ($productAttributes as $attribute) {
80
  $productAttribute = $attribute->getProductAttribute();
81
- $attributeValue = $item->getData($productAttribute->getAttributeCode());
82
  if (!isset($options[$productAttribute->getId()])) {
83
  $options[$productAttribute->getId()] = array();
84
  }
@@ -86,11 +86,11 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
86
  if (!isset($options[$productAttribute->getId()][$attributeValue])) {
87
  $options[$productAttribute->getId()][$attributeValue] = array();
88
  }
89
- $options[$productAttribute->getId()][$attributeValue][] = $productId;
90
  }
91
  }
92
 
93
- foreach ($productAttributes as $attribute) {
94
  $productAttribute = $attribute->getProductAttribute();
95
  $attributeId = $productAttribute->getId();
96
  $info = array(
@@ -129,8 +129,8 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
129
 
130
  $isFirst = true;
131
 
132
- $productAttributes = $attributes;
133
- reset($productAttributes);
134
  foreach ($attributes as $id => $attribute) {
135
  $optionNode = $optionsXmlObj->addChild('option');
136
  $optionNode->addAttribute('code', 'super_attribute[' . $id . ']');
@@ -146,8 +146,8 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
146
  $valueNode->addAttribute('price', $option['price']);
147
  $valueNode->addAttribute('formated_price', $option['formated_price']);
148
  }
149
- if (sizeof($productAttributes) > 1) {
150
- $this->_prepareRecursivelyRelatedValues($valueNode, $productAttributes, $option['products'], 1);
151
  }
152
  if ($product->hasPreconfiguredValues()) {
153
  $this->_setCartSelectedValue($valueNode, 'select', $this->_getPreconfiguredOption(
@@ -194,21 +194,21 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
194
  $relatedNode->addAttribute('to', 'super_attribute[' . $attrId . ']');
195
  }
196
 
197
- $nodeValue = $relatedNode->addChild('value');
198
- $nodeValue->addAttribute('code', $option['id']);
199
- $nodeValue->addAttribute('label', $nodeValue->escapeXml($option['label']));
200
  if ((float)$option['price'] != 0.00) {
201
- $nodeValue->addAttribute('price', $option['price']);
202
- $nodeValue->addAttribute('formated_price', $option['formated_price']);
203
  }
204
 
205
  /**
206
  * Recursive relation adding
207
  */
208
- $attrClone = $attributes;
209
- if (next($attrClone) != false) {
210
- reset($attrClone);
211
- $this->_prepareRecursivelyRelatedValues($nodeValue, $attrClone, $intersect, $cycle + 1);
212
  }
213
  }
214
  }
37
  * Generate bundle product options xml
38
  *
39
  * @param Mage_Catalog_Model_Product $product
40
+ * @param bool $isObject
41
  * @return string | Mage_XmlConnect_Model_Simplexml_Element
42
  */
43
  public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
57
  /**
58
  * Configurable attributes
59
  */
60
+ $_attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
61
+ if (!sizeof($_attributes)) {
62
  return $isObject ? $xmlModel : $xmlModel->asNiceXml();
63
  }
64
 
65
+ $_allowProducts = array();
66
+ $_allProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
67
+ foreach ($_allProducts as $_product) {
68
+ if ($_product->isSaleable()) {
69
+ $_allowProducts[] = $_product;
70
  }
71
  }
72
 
73
  /**
74
  * Allowed products options
75
  */
76
+ foreach ($_allowProducts as $_item) {
77
+ $_productId = $_item->getId();
78
 
79
+ foreach ($_attributes as $attribute) {
80
  $productAttribute = $attribute->getProductAttribute();
81
+ $attributeValue = $_item->getData($productAttribute->getAttributeCode());
82
  if (!isset($options[$productAttribute->getId()])) {
83
  $options[$productAttribute->getId()] = array();
84
  }
86
  if (!isset($options[$productAttribute->getId()][$attributeValue])) {
87
  $options[$productAttribute->getId()][$attributeValue] = array();
88
  }
89
+ $options[$productAttribute->getId()][$attributeValue][] = $_productId;
90
  }
91
  }
92
 
93
+ foreach ($_attributes as $attribute) {
94
  $productAttribute = $attribute->getProductAttribute();
95
  $attributeId = $productAttribute->getId();
96
  $info = array(
129
 
130
  $isFirst = true;
131
 
132
+ $_attributes = $attributes;
133
+ reset($_attributes);
134
  foreach ($attributes as $id => $attribute) {
135
  $optionNode = $optionsXmlObj->addChild('option');
136
  $optionNode->addAttribute('code', 'super_attribute[' . $id . ']');
146
  $valueNode->addAttribute('price', $option['price']);
147
  $valueNode->addAttribute('formated_price', $option['formated_price']);
148
  }
149
+ if (sizeof($_attributes) > 1) {
150
+ $this->_prepareRecursivelyRelatedValues($valueNode, $_attributes, $option['products'], 1);
151
  }
152
  if ($product->hasPreconfiguredValues()) {
153
  $this->_setCartSelectedValue($valueNode, 'select', $this->_getPreconfiguredOption(
194
  $relatedNode->addAttribute('to', 'super_attribute[' . $attrId . ']');
195
  }
196
 
197
+ $_valueNode = $relatedNode->addChild('value');
198
+ $_valueNode->addAttribute('code', $option['id']);
199
+ $_valueNode->addAttribute('label', $_valueNode->escapeXml($option['label']));
200
  if ((float)$option['price'] != 0.00) {
201
+ $_valueNode->addAttribute('price', $option['price']);
202
+ $_valueNode->addAttribute('formated_price', $option['formated_price']);
203
  }
204
 
205
  /**
206
  * Recursive relation adding
207
  */
208
+ $_attrClone = $attributes;
209
+ if (next($_attrClone) != false) {
210
+ reset($_attrClone);
211
+ $this->_prepareRecursivelyRelatedValues($_valueNode, $_attrClone, $intersect, $cycle + 1);
212
  }
213
  }
214
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Giftcard.php CHANGED
@@ -31,8 +31,7 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
35
- extends Mage_XmlConnect_Block_Catalog_Product_Options
36
  {
37
  /**
38
  * Get sender name
@@ -70,6 +69,21 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
70
  return $senderEmail;
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * Check is message available for current product
75
  *
@@ -113,22 +127,6 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
113
  return true;
114
  }
115
 
116
- /**
117
- * Get fixed gift card amounts
118
- *
119
- * @param $product
120
- * @return array
121
- */
122
- public function getAmounts($product)
123
- {
124
- $result = array();
125
- foreach ($product->getGiftcardAmounts() as $amount) {
126
- $result[] = Mage::app()->getStore()->roundPrice($amount['website_value']);
127
- }
128
- sort($result);
129
- return $result;
130
- }
131
-
132
  /**
133
  * Generate gift card product options xml
134
  *
@@ -157,23 +155,24 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
157
  /** @var $coreHelper Mage_Core_Helper_Data */
158
  $coreHelper = Mage::helper('core');
159
 
 
 
160
  /**
161
  * Render fixed amounts options
162
  */
163
-
164
  /** @var $fixedAmountsNode Mage_XmlConnect_Model_Simplexml_Element */
165
  $fixedAmountsNode = $optionsXmlObj->addChild('fixed_amounts');
166
  if ($this->isAmountAvailable($product)) {
167
- $amounts = $this->getAmounts($product);
168
  if (count($amounts)) {
169
  foreach ($amounts as $price) {
170
  $amountNode = $fixedAmountsNode->addChild('amount');
171
- $amountNode->addAttribute(
172
- 'formatted_price',
173
- $xmlModel->xmlAttribute(
174
- $coreHelper->currency($price, true, false)
175
- )
176
- );
177
  $amountNode->addAttribute('price', $price);
178
  }
179
  }
@@ -182,34 +181,30 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
182
  /**
183
  * Render open amount options
184
  */
185
-
186
  /** @var $openAmountNode Mage_XmlConnect_Model_Simplexml_Element */
187
  $openAmountNode = $optionsXmlObj->addChild('open_amount');
188
  if ($product->getAllowOpenAmount()) {
189
  $openAmountNode->addAttribute('enabled', 1);
190
 
191
- if ($product->getOpenAmountMin()) {
192
- $minPrice = Mage::app()->getStore()->roundPrice($product->getOpenAmountMin());
 
 
 
193
  $minAmount = $coreHelper->currency($minPrice, true, false);
194
  } else {
195
  $minAmount = $minPrice = 0;
196
  }
197
- $openAmountNode->addAttribute(
198
- 'formatted_min_amount',
199
- $xmlModel->xmlAttribute($minAmount)
200
- );
201
  $openAmountNode->addAttribute('min_amount', $minPrice);
202
 
203
- if ($product->getOpenAmountMax()) {
204
- $maxPrice = Mage::app()->getStore()->roundPrice($product->getOpenAmountMax());
205
  $maxAmount = $coreHelper->currency($maxPrice, true, false);
206
  } else {
207
  $maxAmount = $maxPrice = 0;
208
  }
209
- $openAmountNode->addAttribute(
210
- 'formatted_max_amount',
211
- $xmlModel->xmlAttribute($maxAmount)
212
- );
213
  $openAmountNode->addAttribute('max_amount', $maxPrice);
214
  } else {
215
  $openAmountNode->addAttribute('enabled', 0);
@@ -218,89 +213,56 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
218
  /**
219
  * Render Gift Card form options
220
  */
221
- $form = $optionsXmlObj->addCustomChild(
222
- 'form',
223
- null,
224
- array(
225
- 'name' => 'giftcard-send-form',
226
- 'method' => 'post'
227
- )
228
- );
229
 
230
- $senderFieldset = $form->addCustomChild(
231
- 'fieldset',
232
- null,
233
- array(
234
- 'legend' => $this->__('Sender Information')
235
- )
236
- );
237
 
238
- $senderFieldset->addField(
239
- 'giftcard_sender_name',
240
- 'text',
241
- array(
242
- 'label' => Mage::helper('enterprise_giftcard')->__('Sender Name'),
243
- 'required' => 'true',
244
- 'value' => $this->getSenderName()
245
- )
246
- );
247
 
248
- $recipientFieldset = $form->addCustomChild(
249
- 'fieldset',
250
- null,
251
- array(
252
- 'legend' => $this->__('Recipient Information')
253
- )
254
- );
255
 
256
- $recipientFieldset->addField(
257
- 'giftcard_recipient_name',
258
- 'text',
259
- array(
260
- 'label' => Mage::helper('enterprise_giftcard')->__('Recipient Name'),
261
- 'required' => 'true',
262
- 'value' => $this->getDefaultValue('giftcard_recipient_name')
263
- )
264
- );
265
 
266
  if ($this->isEmailAvailable($product)) {
267
- $senderFieldset->addField(
268
- 'giftcard_sender_email',
269
- 'email',
270
- array(
271
- 'label' => Mage::helper('enterprise_giftcard')->__('Sender Email'),
272
- 'required' => 'true',
273
- 'value' => $this->getSenderEmail()
274
- )
275
- );
276
 
277
- $recipientFieldset->addField(
278
- 'giftcard_recipient_email',
279
- 'email',
280
- array(
281
- 'label' => Mage::helper('enterprise_giftcard')->__('Recipient Email'),
282
- 'required' => 'true',
283
- 'value' => $this->getDefaultValue('giftcard_recipient_email')
284
- )
285
- );
286
  }
287
 
288
  if ($this->isMessageAvailable($product)) {
289
  $messageMaxLength = (int) Mage::getStoreConfig(
290
  Enterprise_GiftCard_Model_Giftcard::XML_PATH_MESSAGE_MAX_LENGTH
291
  );
292
- $recipientFieldset->addField(
293
- 'giftcard_message',
294
- 'textarea',
295
- array(
296
- 'label' => Mage::helper('enterprise_giftcard')->__('Message'),
297
- 'required' => 'false',
298
- 'max_length'=> $messageMaxLength,
299
- 'value' => $this->getDefaultValue('giftcard_message')
300
- )
301
- );
302
  }
303
-
304
  return $isObject ? $xmlModel : $xmlModel->asNiceXml();
305
  }
306
  }
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard extends Mage_XmlConnect_Block_Catalog_Product_Options
 
35
  {
36
  /**
37
  * Get sender name
69
  return $senderEmail;
70
  }
71
 
72
+ /**
73
+ * Get pre-configured values from product
74
+ *
75
+ * @param $value param id
76
+ * @return string
77
+ */
78
+ protected function getDefaultValue($value)
79
+ {
80
+ if ($this->getProduct()) {
81
+ return (string) $this->getProduct()->getPreconfiguredValues()->getData($value);
82
+ } else {
83
+ return '';
84
+ }
85
+ }
86
+
87
  /**
88
  * Check is message available for current product
89
  *
127
  return true;
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  /**
131
  * Generate gift card product options xml
132
  *
155
  /** @var $coreHelper Mage_Core_Helper_Data */
156
  $coreHelper = Mage::helper('core');
157
 
158
+ $configValue = $this->getDefaultValue('giftcard_amount');
159
+
160
  /**
161
  * Render fixed amounts options
162
  */
 
163
  /** @var $fixedAmountsNode Mage_XmlConnect_Model_Simplexml_Element */
164
  $fixedAmountsNode = $optionsXmlObj->addChild('fixed_amounts');
165
  if ($this->isAmountAvailable($product)) {
166
+ $amounts = $priceModel->getSortedAmounts($product);
167
  if (count($amounts)) {
168
  foreach ($amounts as $price) {
169
  $amountNode = $fixedAmountsNode->addChild('amount');
170
+ if ($configValue == $price) {
171
+ $amountNode->addAttribute('selected', 1);
172
+ }
173
+ $amountNode->addAttribute('formatted_price', $xmlModel->xmlAttribute(
174
+ $coreHelper->currency($price, true, false)
175
+ ));
176
  $amountNode->addAttribute('price', $price);
177
  }
178
  }
181
  /**
182
  * Render open amount options
183
  */
 
184
  /** @var $openAmountNode Mage_XmlConnect_Model_Simplexml_Element */
185
  $openAmountNode = $optionsXmlObj->addChild('open_amount');
186
  if ($product->getAllowOpenAmount()) {
187
  $openAmountNode->addAttribute('enabled', 1);
188
 
189
+ if ($configValue == 'custom') {
190
+ $openAmountNode->addAttribute('selected_amount', $this->getDefaultValue('custom_giftcard_amount'));
191
+ }
192
+ if ($priceModel->getMinAmount($product)) {
193
+ $minPrice = $product->getOpenAmountMin();
194
  $minAmount = $coreHelper->currency($minPrice, true, false);
195
  } else {
196
  $minAmount = $minPrice = 0;
197
  }
198
+ $openAmountNode->addAttribute('formatted_min_amount', $xmlModel->xmlAttribute($minAmount));
 
 
 
199
  $openAmountNode->addAttribute('min_amount', $minPrice);
200
 
201
+ if ($priceModel->getMaxAmount($product)) {
202
+ $maxPrice = $product->getOpenAmountMax();
203
  $maxAmount = $coreHelper->currency($maxPrice, true, false);
204
  } else {
205
  $maxAmount = $maxPrice = 0;
206
  }
207
+ $openAmountNode->addAttribute('formatted_max_amount', $xmlModel->xmlAttribute($maxAmount));
 
 
 
208
  $openAmountNode->addAttribute('max_amount', $maxPrice);
209
  } else {
210
  $openAmountNode->addAttribute('enabled', 0);
213
  /**
214
  * Render Gift Card form options
215
  */
216
+ $form = $optionsXmlObj->addCustomChild('form', null, array(
217
+ 'name' => 'giftcard-send-form',
218
+ 'method' => 'post'
219
+ ));
 
 
 
 
220
 
221
+ $senderFieldset = $form->addCustomChild('fieldset', null, array(
222
+ 'legend' => $this->__('Sender Information')
223
+ ));
 
 
 
 
224
 
225
+ $senderFieldset->addField('giftcard_sender_name', 'text', array(
226
+ 'label' => Mage::helper('enterprise_giftcard')->__('Sender Name'),
227
+ 'required' => 'true',
228
+ 'value' => $this->getSenderName()
229
+ ));
 
 
 
 
230
 
231
+ $recipientFieldset = $form->addCustomChild('fieldset', null, array(
232
+ 'legend' => $this->__('Recipient Information')
233
+ ));
 
 
 
 
234
 
235
+ $recipientFieldset->addField('giftcard_recipient_name', 'text', array(
236
+ 'label' => Mage::helper('enterprise_giftcard')->__('Recipient Name'),
237
+ 'required' => 'true',
238
+ 'value' => $this->getDefaultValue('giftcard_recipient_name')
239
+ ));
 
 
 
 
240
 
241
  if ($this->isEmailAvailable($product)) {
242
+ $senderFieldset->addField('giftcard_sender_email', 'email', array(
243
+ 'label' => Mage::helper('enterprise_giftcard')->__('Sender Email'),
244
+ 'required' => 'true',
245
+ 'value' => $this->getSenderEmail()
246
+ ));
 
 
 
 
247
 
248
+ $recipientFieldset->addField('giftcard_recipient_email', 'email', array(
249
+ 'label' => Mage::helper('enterprise_giftcard')->__('Recipient Email'),
250
+ 'required' => 'true',
251
+ 'value' => $this->getDefaultValue('giftcard_recipient_email')
252
+ ));
 
 
 
 
253
  }
254
 
255
  if ($this->isMessageAvailable($product)) {
256
  $messageMaxLength = (int) Mage::getStoreConfig(
257
  Enterprise_GiftCard_Model_Giftcard::XML_PATH_MESSAGE_MAX_LENGTH
258
  );
259
+ $recipientFieldset->addField('giftcard_message', 'textarea', array(
260
+ 'label' => Mage::helper('enterprise_giftcard')->__('Message'),
261
+ 'required' => 'false',
262
+ 'max_length'=> $messageMaxLength,
263
+ 'value' => $this->getDefaultValue('giftcard_message')
264
+ ));
 
 
 
 
265
  }
 
266
  return $isObject ? $xmlModel : $xmlModel->asNiceXml();
267
  }
268
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php CHANGED
@@ -55,30 +55,30 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Grouped extends Mage_XmlConn
55
  /**
56
  * Grouped (associated) products
57
  */
58
- $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
59
- if (!sizeof($associatedProducts)) {
60
  return $isObject ? $xmlModel : $xmlModel->asNiceXml();
61
  }
62
 
63
- foreach ($associatedProducts as $item) {
64
- if (!$item->isSaleable()) {
65
  continue;
66
  }
67
  $optionNode = $optionsNode->addChild('option');
68
 
69
- $optionNode->addAttribute('code', 'super_group[' . $item->getId() . ']');
70
  $optionNode->addAttribute('type', 'product');
71
- $optionNode->addAttribute('label', $xmlModel->escapeXml($item->getName()));
72
  $optionNode->addAttribute('is_qty_editable', 1);
73
- $optionNode->addAttribute('qty', $item->getQty()*1);
74
 
75
  /**
76
  * Process product price
77
  */
78
- if ($item->getPrice() != $item->getFinalPrice()) {
79
- $productPrice = $item->getFinalPrice();
80
  } else {
81
- $productPrice = $item->getPrice();
82
  }
83
 
84
  if ($productPrice != 0) {
55
  /**
56
  * Grouped (associated) products
57
  */
58
+ $_associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
59
+ if (!sizeof($_associatedProducts)) {
60
  return $isObject ? $xmlModel : $xmlModel->asNiceXml();
61
  }
62
 
63
+ foreach ($_associatedProducts as $_item) {
64
+ if (!$_item->isSaleable()) {
65
  continue;
66
  }
67
  $optionNode = $optionsNode->addChild('option');
68
 
69
+ $optionNode->addAttribute('code', 'super_group[' . $_item->getId() . ']');
70
  $optionNode->addAttribute('type', 'product');
71
+ $optionNode->addAttribute('label', $xmlModel->escapeXml($_item->getName()));
72
  $optionNode->addAttribute('is_qty_editable', 1);
73
+ $optionNode->addAttribute('qty', $_item->getQty()*1);
74
 
75
  /**
76
  * Process product price
77
  */
78
+ if ($_item->getPrice() != $_item->getFinalPrice()) {
79
+ $productPrice = $_item->getFinalPrice();
80
  } else {
81
+ $productPrice = $_item->getPrice();
82
  }
83
 
84
  if ($productPrice != 0) {
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Simple.php CHANGED
@@ -37,7 +37,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Simple extends Mage_XmlConne
37
  * Generate simple product options xml
38
  *
39
  * @param Mage_Catalog_Model_Product $product
40
- * @param bool
41
  * @return string | Mage_XmlConnect_Model_Simplexml_Element
42
  */
43
  public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
37
  * Generate simple product options xml
38
  *
39
  * @param Mage_Catalog_Model_Product $product
40
+ * @param bool $isObject
41
  * @return string | Mage_XmlConnect_Model_Simplexml_Element
42
  */
43
  public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Virtual.php CHANGED
@@ -37,7 +37,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Virtual extends Mage_XmlConn
37
  * Generate virtual product options xml
38
  *
39
  * @param Mage_Catalog_Model_Product $product
40
- * @param bool
41
  * @return string | Mage_XmlConnect_Model_Simplexml_Element
42
  */
43
  public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
37
  * Generate virtual product options xml
38
  *
39
  * @param Mage_Catalog_Model_Product $product
40
+ * @param bool $isObject
41
  * @return string | Mage_XmlConnect_Model_Simplexml_Element
42
  */
43
  public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php CHANGED
@@ -39,9 +39,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle extends Mage_Bundle_Blo
39
  * @param Mage_Catalog_Model_Product $product
40
  * @param Mage_XmlConnect_Model_Simplexml_Element $item
41
  */
42
- public function collectProductPrices(Mage_Catalog_Model_Product $product,
43
- Mage_XmlConnect_Model_Simplexml_Element $item)
44
- {
45
  $this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
46
 
47
  $priceXmlObj = $item->addChild('price');
39
  * @param Mage_Catalog_Model_Product $product
40
  * @param Mage_XmlConnect_Model_Simplexml_Element $item
41
  */
42
+ public function collectProductPrices(
43
+ Mage_Catalog_Model_Product $product, Mage_XmlConnect_Model_Simplexml_Element $item
44
+ ) {
45
  $this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
46
 
47
  $priceXmlObj = $item->addChild('price');
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php CHANGED
@@ -39,321 +39,321 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default extends Mage_Catalog_B
39
  * @param Mage_Catalog_Model_Product $product
40
  * @param Mage_XmlConnect_Model_Simplexml_Element $item
41
  */
42
- public function collectProductPrices(Mage_Catalog_Model_Product $product,
43
- Mage_XmlConnect_Model_Simplexml_Element $item)
44
- {
45
  $this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
46
 
47
  $priceXmlObj = $item->addChild('price');
48
- $tierPrices = $this->_getTierPrices($product);
49
- if (count($tierPrices) > 0) {
50
  $tierPricesTextArray = $item->escapeXml(implode(
51
- PHP_EOL, $this->_getTierPricesTextArray($tierPrices, $product)
52
  ));
53
  $item->addCustomChild('price_tier', $tierPricesTextArray);
54
  }
55
 
56
- /** @var $coreHelper Mage_Core_Helper_Data */
57
- $coreHelper = $this->helper('core');
58
- /** @var $weeeHelper Mage_Weee_Helper_Data */
59
- $weeeHelper = $this->helper('weee');
60
- /** @var $taxHelper Mage_Tax_Helper_Data */
61
- $taxHelper = $this->helper('tax');
62
 
63
- $simplePricesTax = ($taxHelper->displayPriceIncludingTax() || $taxHelper->displayBothPrices());
64
- $minimalPriceValue = $product->getMinimalPrice();
65
- $minimalPrice = $taxHelper->getPrice($product, $minimalPriceValue, $simplePricesTax);
66
 
67
  if (!$product->isGrouped()) {
68
- $weeeTaxAmount = $weeeHelper->getAmountForDisplay($product);
69
- if ($weeeHelper->typeOfDisplay($product, array(1, 2, 4))) {
70
- $weeeTaxAmount = $weeeHelper->getAmount($product);
71
- $weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForDisplay($product);
72
  }
73
 
74
- $price = $taxHelper->getPrice($product, $product->getPrice());
75
- $regularPrice = $taxHelper->getPrice($product, $product->getPrice(), $simplePricesTax);
76
- $finalPrice = $taxHelper->getPrice($product, $product->getFinalPrice());
77
- $finalPriceInclTax = $taxHelper->getPrice($product, $product->getFinalPrice(), true);
78
- $weeeHelper->getPriceDisplayType();
79
- if ($finalPrice == $price) {
80
- if ($taxHelper->displayBothPrices()) {
81
  /**
82