Magento_Mobile - Version 1.7.0.0.22.1

Version Notes

1.7.0.0.22.1 version of package internal svn revision #121425

Download this release

Release Info

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


Code changes from version 1.6.0.0.23.0 to 1.7.0.0.22.1

Files changed (236) hide show
  1. app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit.php +0 -71
  2. app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Form.php +0 -55
  3. app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tab/Settings.php +0 -108
  4. app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tabs.php +0 -62
  5. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Config.php +0 -68
  6. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard.php +0 -249
  7. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/BestSellers.php +0 -113
  8. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/Customers.php +0 -129
  9. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphAmountsData.php +0 -71
  10. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphDataAbstract.php +0 -350
  11. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphInfo.php +0 -160
  12. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphOrderData.php +0 -71
  13. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphTotalsData.php +0 -123
  14. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastOrders.php +0 -85
  15. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastSearchTerms.php +0 -118
  16. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/MostViewedProducts.php +0 -117
  17. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/NewCustomers.php +0 -129
  18. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/SalesInfo.php +0 -119
  19. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/StoreSwitcher.php +0 -198
  20. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/TopSearchTerms.php +0 -114
  21. app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Loginform.php +0 -70
  22. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile.php +6 -2
  23. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit.php +2 -1
  24. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Submission.php +2 -1
  25. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php +34 -54
  26. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion.php +1 -1
  27. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Images.php +8 -23
  28. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Images.php +0 -192
  29. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Preview.php +6 -3
  30. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/General.php +8 -8
  31. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/OfflineCatalog.php +0 -115
  32. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Payment.php +14 -2
  33. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Settings.php +14 -10
  34. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Social.php +26 -11
  35. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Submission/History.php +1 -1
  36. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tabs.php +5 -2
  37. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Addrow.php +18 -8
  38. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Color.php +2 -1
  39. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Country.php +2 -1
  40. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Datetime.php +2 -1
  41. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Font.php +5 -2
  42. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Image.php +2 -1
  43. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Page.php +6 -3
  44. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Tabs.php +6 -3
  45. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Theme.php +5 -3
  46. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Bool.php +6 -2
  47. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Form.php +2 -1
  48. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php +17 -17
  49. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tabs.php +2 -1
  50. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit.php +4 -2
  51. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit/Form.php +10 -7
  52. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php +4 -3
  53. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Action.php +2 -2
  54. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit.php +4 -5
  55. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit/Form.php +8 -3
  56. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Name.php +1 -1
  57. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview/Form.php +2 -1
  58. app/code/core/Mage/XmlConnect/Block/Cart.php +18 -30
  59. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals.php +0 -95
  60. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Default.php +0 -93
  61. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Grandtotal.php +0 -107
  62. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Default.php +0 -63
  63. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Giftcardaccount.php +0 -69
  64. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Shipping.php +0 -113
  65. app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Subtotal.php +0 -108
  66. app/code/core/Mage/XmlConnect/Block/Cart/Crosssell.php +6 -6
  67. app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer.php +64 -259
  68. app/code/core/Mage/XmlConnect/Block/Cart/Items.php +0 -254
  69. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php +9 -5
  70. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/OrderDetails.php +0 -83
  71. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Review.php +13 -15
  72. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php +28 -104
  73. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php +4 -1
  74. app/code/core/Mage/XmlConnect/Block/Cart/Totals.php +8 -5
  75. app/code/core/Mage/XmlConnect/Block/Catalog.php +5 -59
  76. app/code/core/Mage/XmlConnect/Block/Catalog/Category.php +6 -10
  77. app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php +1 -2
  78. app/code/core/Mage/XmlConnect/Block/Catalog/Product.php +25 -35
  79. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Attributes.php +1 -1
  80. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Gallery.php +14 -13
  81. app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice.php +0 -98
  82. app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Bundle.php +0 -426
  83. app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Default.php +0 -740
  84. app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Giftcard.php +0 -98
  85. app/code/core/Mage/XmlConnect/Block/Catalog/Product/List.php +9 -17
  86. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php +1 -84
  87. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php +16 -32
  88. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php +26 -35
  89. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Downloadable.php +0 -113
  90. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Giftcard.php +1 -0
  91. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php +11 -11
  92. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php +158 -140
  93. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php +267 -265
  94. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Giftcard.php +7 -8
  95. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Related.php +2 -2
  96. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review.php +0 -1
  97. app/code/core/Mage/XmlConnect/Block/Catalog/Search.php +4 -4
  98. app/code/core/Mage/XmlConnect/Block/Catalog/Search/Suggest.php +0 -1
  99. app/code/core/Mage/XmlConnect/Block/Checkout/Address/Billing.php +3 -2
  100. app/code/core/Mage/XmlConnect/Block/Checkout/Address/Form.php +94 -43
  101. app/code/core/Mage/XmlConnect/Block/Checkout/Address/Shipping.php +0 -1
  102. app/code/core/Mage/XmlConnect/Block/Checkout/Agreements.php +1 -1
  103. app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer.php +0 -48
  104. app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Bundle.php +0 -49
  105. app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Configurable.php +0 -53
  106. app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Downloadable.php +0 -49
  107. app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Giftcard.php +0 -49
  108. app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Grouped.php +0 -52
  109. app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address.php +0 -69
  110. app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/Form.php +0 -114
  111. app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/List.php +0 -112
  112. app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Review.php +0 -64
  113. app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review/Info.php +18 -28
  114. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Ccsave.php +3 -3
  115. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Ccsave.php +2 -2
  116. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Checkmo.php +3 -1
  117. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Abstract.php +7 -4
  118. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Verisign.php +5 -3
  119. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/List.php +60 -119
  120. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/ListApi23.php +0 -133
  121. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Payflow.php +9 -9
  122. app/code/core/Mage/XmlConnect/Block/Checkout/Pbridge/Result.php +1 -1
  123. app/code/core/Mage/XmlConnect/Block/Checkout/Shipping/Method/Available.php +16 -17
  124. app/code/core/Mage/XmlConnect/Block/Checkout/Shipping/Method/AvailableList.php +0 -82
  125. app/code/core/Mage/XmlConnect/Block/Configuration.php +20 -39
  126. app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php +78 -45
  127. app/code/core/Mage/XmlConnect/Block/Customer/Address/List.php +12 -12
  128. app/code/core/Mage/XmlConnect/Block/Customer/Downloads.php +0 -80
  129. app/code/core/Mage/XmlConnect/Block/Customer/Form.php +47 -150
  130. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Date.php +14 -16
  131. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Text.php +4 -5
  132. app/code/core/Mage/XmlConnect/Block/Customer/Order/Details.php +13 -10
  133. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Bundle.php +11 -142
  134. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Default.php +0 -73
  135. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Downloadable.php +13 -84
  136. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Giftcard.php +2 -2
  137. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Grouped.php +3 -5
  138. app/code/core/Mage/XmlConnect/Block/Customer/Order/Items.php +2 -1
  139. app/code/core/Mage/XmlConnect/Block/Customer/Order/List.php +15 -13
  140. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals.php +10 -60
  141. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance.php +1 -25
  142. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance/Refunded.php +3 -25
  143. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Giftcards.php +5 -39
  144. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Tax.php +3 -44
  145. app/code/core/Mage/XmlConnect/Block/Customer/Storecredit.php +1 -1
  146. app/code/core/Mage/XmlConnect/Block/Home.php +3 -5
  147. app/code/core/Mage/XmlConnect/Block/Homebanners.php +0 -156
  148. app/code/core/Mage/XmlConnect/Block/Localization.php +0 -55
  149. app/code/core/Mage/XmlConnect/Block/Review/Form.php +1 -2
  150. app/code/core/Mage/XmlConnect/Block/ShoppingCart.php +0 -108
  151. app/code/core/Mage/XmlConnect/Block/Wishlist.php +5 -6
  152. app/code/core/Mage/XmlConnect/Controller/Action.php +11 -36
  153. app/code/core/Mage/XmlConnect/Controller/AdminAction.php +0 -192
  154. app/code/core/Mage/XmlConnect/Helper/AdminApplication.php +0 -134
  155. app/code/core/Mage/XmlConnect/Helper/Adminhtml/Dashboard/Order.php +0 -68
  156. app/code/core/Mage/XmlConnect/Helper/Android.php +64 -42
  157. app/code/core/Mage/XmlConnect/Helper/Catalog/Category/Image.php +4 -58
  158. app/code/core/Mage/XmlConnect/Helper/Catalog/Product/Image.php +0 -46
  159. app/code/core/Mage/XmlConnect/Helper/Customer/Form/Renderer.php +0 -178
  160. app/code/core/Mage/XmlConnect/Helper/Customer/Order.php +31 -193
  161. app/code/core/Mage/XmlConnect/Helper/Data.php +32 -127
  162. app/code/core/Mage/XmlConnect/Helper/Device/Abstract.php +0 -309
  163. app/code/core/Mage/XmlConnect/Helper/Image.php +22 -49
  164. app/code/core/Mage/XmlConnect/Helper/Ipad.php +112 -65
  165. app/code/core/Mage/XmlConnect/Helper/Iphone.php +204 -39
  166. app/code/core/Mage/XmlConnect/Helper/OfflineCatalog.php +0 -307
  167. app/code/core/Mage/XmlConnect/Helper/Theme.php +8 -49
  168. app/code/core/Mage/XmlConnect/Helper/Translate.php +0 -514
  169. app/code/core/Mage/XmlConnect/Model/Adminhtml/Search/Catalog.php +0 -71
  170. app/code/core/Mage/XmlConnect/Model/Adminhtml/Search/Category.php +0 -70
  171. app/code/core/Mage/XmlConnect/Model/Adminhtml/System/Config/Backend/Currency/Default.php +1 -1
  172. app/code/core/Mage/XmlConnect/Model/Application.php +76 -194
  173. app/code/core/Mage/XmlConnect/Model/Catalog/Category/Image.php +11 -28
  174. app/code/core/Mage/XmlConnect/Model/ConfigData.php +9 -121
  175. app/code/core/Mage/XmlConnect/Model/Configuration.php +0 -271
  176. app/code/core/Mage/XmlConnect/Model/Device/Abstract.php +0 -179
  177. app/code/core/Mage/XmlConnect/Model/Device/Android.php +0 -111
  178. app/code/core/Mage/XmlConnect/Model/Device/Ipad.php +0 -174
  179. app/code/core/Mage/XmlConnect/Model/Device/Iphone.php +0 -117
  180. app/code/core/Mage/XmlConnect/Model/ImageAction.php +0 -321
  181. app/code/core/Mage/XmlConnect/Model/ImageLimits.php +0 -366
  182. app/code/core/Mage/XmlConnect/Model/ImageLimits/Abstract.php +0 -295
  183. app/code/core/Mage/XmlConnect/Model/Images.php +0 -551
  184. app/code/core/Mage/XmlConnect/Model/Observer.php +7 -77
  185. app/code/core/Mage/XmlConnect/Model/OfflineCatalog.php +0 -117
  186. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Abstract.php +0 -66
  187. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category.php +0 -120
  188. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category/Category.php +0 -61
  189. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category/IndexCategory.php +0 -61
  190. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Config.php +0 -77
  191. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Home.php +0 -61
  192. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Homebanners.php +0 -61
  193. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product.php +0 -111
  194. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Gallery.php +0 -61
  195. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Product.php +0 -61
  196. app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Review.php +0 -61
  197. app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Config.php +0 -15
  198. app/code/core/Mage/XmlConnect/Model/Paypal/Mecl/Checkout.php +0 -24
  199. app/code/core/Mage/XmlConnect/Model/Preview/Abstract.php +5 -57
  200. app/code/core/Mage/XmlConnect/Model/Preview/Android.php +6 -13
  201. app/code/core/Mage/XmlConnect/Model/Preview/Ipad.php +44 -49
  202. app/code/core/Mage/XmlConnect/Model/Preview/Iphone.php +5 -14
  203. app/code/core/Mage/XmlConnect/Model/Queue.php +2 -31
  204. app/code/core/Mage/XmlConnect/Model/Resource/Application.php +1 -17
  205. app/code/core/Mage/XmlConnect/Model/Resource/CategorySearch/Collection.php +0 -120
  206. app/code/core/Mage/XmlConnect/Model/Resource/ConfigData.php +3 -3
  207. app/code/core/Mage/XmlConnect/Model/Resource/ConfigData/Collection.php +3 -1
  208. app/code/core/Mage/XmlConnect/Model/Resource/Filter/Collection.php +1 -0
  209. app/code/core/Mage/XmlConnect/Model/Resource/Images.php +0 -89
  210. app/code/core/Mage/XmlConnect/Model/Resource/Images/Collection.php +0 -91
  211. app/code/core/Mage/XmlConnect/Model/Simplexml/Element.php +2 -2
  212. app/code/core/Mage/XmlConnect/Model/Simplexml/Form.php +1 -25
  213. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Abstract.php +1 -1
  214. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Abstract.php +3 -9
  215. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/CountryListSelect.php +18 -45
  216. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Custom.php +0 -71
  217. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Date.php +2 -1
  218. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Email.php +2 -1
  219. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Fieldset.php +0 -2
  220. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/File.php +2 -1
  221. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Image.php +2 -1
  222. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Multiline.php +4 -1
  223. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Multiselect.php +5 -1
  224. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Password.php +0 -47
  225. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Select.php +13 -4
  226. app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Text.php +2 -1
  227. app/code/core/Mage/XmlConnect/Model/Simplexml/Message.php +0 -267
  228. app/code/core/Mage/XmlConnect/Model/Simplexml/Message/Abstract.php +0 -142
  229. app/code/core/Mage/XmlConnect/Model/Simplexml/Message/Error.php +0 -125
  230. app/code/core/Mage/XmlConnect/Model/Simplexml/Message/Success.php +0 -56
  231. app/code/core/Mage/XmlConnect/Model/Theme.php +5 -6
  232. app/code/core/Mage/XmlConnect/controllers/Adminhtml/Admin/ApplicationController.php +0 -69
  233. app/code/core/Mage/XmlConnect/controllers/Adminhtml/Connect/ConfigController.php +0 -126
  234. app/code/core/Mage/XmlConnect/controllers/Adminhtml/Connect/DashboardController.php +0 -55
  235. app/code/core/Mage/XmlConnect/controllers/Adminhtml/Connect/UserController.php +0 -165
  236. app/code/core/Mage/XmlConnect/controllers/Adminhtml/MobileController.php +72 -274
app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit.php DELETED
@@ -1,71 +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
-
27
- /**
28
- * Xmlconnect edit admin application settings block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Admin_Application_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
35
- {
36
- /**
37
- * Setting action buttons for admin application settings
38
- */
39
- public function __construct()
40
- {
41
- $this->_objectId = 'id';
42
- $this->_controller = 'adminhtml_admin_application';
43
- $this->_blockGroup = 'xmlconnect';
44
- parent::__construct();
45
-
46
- $this->_removeButton('back');
47
- $this->_removeButton('reset');
48
- $this->_removeButton('delete');
49
- }
50
-
51
- /**
52
- * Get header text
53
- *
54
- * @return string
55
- */
56
- public function getHeaderText()
57
- {
58
- return $this->__('Admin Application Settings');
59
- }
60
-
61
- /**
62
- * Check permission for passed action
63
- *
64
- * @param string $action
65
- * @return bool
66
- */
67
- protected function _isAllowedAction($action)
68
- {
69
- return true;
70
- }
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Form.php DELETED
@@ -1,55 +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
-
27
- /**
28
- * Admin application form block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Admin_Application_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
35
- {
36
- /**
37
- * Prepare form before rendering HTML
38
- * Setting Form Fieldsets and fields
39
- *
40
- * @return Mage_Adminhtml_Block_Widget_Form
41
- */
42
- protected function _prepareForm()
43
- {
44
- /** @var $form Varien_Data_Form */
45
- $form = Mage::getModel('varien/data_form', array(
46
- 'id' => 'edit_form',
47
- 'action' => $this->getUrl('*/admin_application', array('_current' => true)),
48
- 'method' => 'post'
49
- ));
50
-
51
- $form->setUseContainer(true);
52
- $this->setForm($form);
53
- return parent::_prepareForm();
54
- }
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tab/Settings.php DELETED
@@ -1,108 +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
-
27
- /**
28
- * Tab for Settings Management
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Admin_Application_Edit_Tab_Settings
35
- extends Mage_Adminhtml_Block_Widget_Form
36
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
- {
38
- /**
39
- * Prepare form before rendering HTML
40
- * Setting Form Fieldsets and fields
41
- *
42
- * @return Mage_Adminhtml_Block_Widget_Form
43
- */
44
- protected function _prepareForm()
45
- {
46
- /** @var $form Varien_Data_Form */
47
- $form = Mage::getModel('varien/data_form', array(
48
- 'id' => 'edit_form',
49
- 'action' => $this->getUrl('*/admin_application', array('_current' => true)),
50
- 'method' => 'post'
51
- ));
52
-
53
- $form->setHtmlIdPrefix('admin_app_');
54
- $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Admin Application Settings')));
55
-
56
- $fieldset->addField('type', 'select', array(
57
- 'name' => 'is_active',
58
- 'label' => $this->__('Enable Admin Application'),
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);
66
- return parent::_prepareForm();
67
- }
68
-
69
- /**
70
- * Tab label getter
71
- *
72
- * @return string
73
- */
74
- public function getTabLabel()
75
- {
76
- return $this->__('Settings');
77
- }
78
-
79
- /**
80
- * Tab title getter
81
- *
82
- * @return string
83
- */
84
- public function getTabTitle()
85
- {
86
- return $this->__('Settings');
87
- }
88
-
89
- /**
90
- * Check if tab can be shown
91
- *
92
- * @return bool
93
- */
94
- public function canShowTab()
95
- {
96
- return true;
97
- }
98
-
99
- /**
100
- * Check if tab hidden
101
- *
102
- * @return bool
103
- */
104
- public function isHidden()
105
- {
106
- return false;
107
- }
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tabs.php DELETED
@@ -1,62 +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
-
27
- /**
28
- * Admin Application Settings Tabs block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Admin_Application_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
35
- {
36
- /**
37
- * Setting tab id, DOM destination element id, title
38
- */
39
- public function __construct()
40
- {
41
- parent::__construct();
42
- $this->setId('admin_application_app_tabs');
43
- $this->setDestElementId('edit_form');
44
- $this->setTitle($this->__('Admin Mobile Application'));
45
- }
46
-
47
- /**
48
- * Preparing global layout
49
- *
50
- * @return Mage_Core_Block_Abstract
51
- */
52
- protected function _prepareLayout()
53
- {
54
- $this->addTab('set', array(
55
- 'label' => $this->__('Settings'),
56
- 'content' => $this->getLayout()->createBlock('xmlconnect/adminhtml_admin_application_edit_tab_settings')
57
- ->toHtml(),
58
- 'active' => true
59
- ));
60
- return parent::_prepareLayout();
61
- }
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Config.php DELETED
@@ -1,68 +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
-
27
- /**
28
- * Admin application config renderer
29
- *
30
- * @category Mage
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
38
- *
39
- * @return string
40
- */
41
- protected function _toHtml()
42
- {
43
- /** @var Mage_XmlConnect_Model_Simplexml_Element $configXmlObj */
44
- $configXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<configuration></configuration>');
45
- $this->_addLocalization($configXmlObj);
46
- $configXmlObj->addCustomChild('xmlconnect_version', Mage::getConfig()->getNode(
47
- Mage_XmlConnect_Model_Application::XML_PATH_MODULE_VERSION
48
- ));
49
-
50
- return $configXmlObj->asNiceXml();
51
- }
52
-
53
- /**
54
- * Add localization data to xml object
55
- *
56
- * @param Mage_XmlConnect_Model_Simplexml_Element $xml
57
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Config
58
- */
59
- protected function _addLocalization(Mage_XmlConnect_Model_Simplexml_Element $xml)
60
- {
61
- /** @var $translateHelper Mage_XmlConnect_Helper_Translate */
62
- $translateHelper = Mage::helper('xmlconnect/translate');
63
- $xml->addCustomChild('localization', $this->getUrl('*/*/localization'), array(
64
- 'hash' => sha1(serialize($translateHelper->getLocalizationArray()))
65
- ));
66
- return $this;
67
- }
68
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard.php DELETED
@@ -1,249 +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
-
27
- /**
28
- * Admin application dashboard renderer
29
- *
30
- * @category Mage
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
38
- *
39
- * @var Mage_XmlConnect_Model_Simplexml_Element
40
- */
41
- protected $_xmlObject;
42
-
43
- /**
44
- * Render dashboard xml
45
- *
46
- * @return string
47
- */
48
- protected function _toHtml()
49
- {
50
- return $this->setXmlObject(Mage::getModel('xmlconnect/simplexml_element', '<dashboard></dashboard>'))
51
- ->_addStoreSwitcher()->_addSalesInfo()->_addGraphInfo()->_addDashboardFormData()->getXmlObject()
52
- ->asNiceXml();
53
- }
54
-
55
- /**
56
- * Add store switcher xml
57
- *
58
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
59
- */
60
- protected function _addStoreSwitcher()
61
- {
62
- $this->getChild('store_switcher')->addSwitcherToXmlObj($this->getXmlObject());
63
- return $this;
64
- }
65
-
66
- /**
67
- * Add sales info
68
- *
69
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
70
- */
71
- protected function _addSalesInfo()
72
- {
73
- $this->getChild('sales_info')->addSalesInfoToXmlObj($this->getXmlObject());
74
- return $this;
75
- }
76
-
77
- /**
78
- * Add graph info to xml object
79
- *
80
- * Add orders and amounts info to show diagram by selected range in application
81
- *
82
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
83
- */
84
- protected function _addGraphInfo()
85
- {
86
- $this->getChild('graph_info')->addGraphInfoToXmlObj($this->getXmlObject());
87
- return $this;
88
- }
89
-
90
- /**
91
- * Add dashboard form data
92
- *
93
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
94
- */
95
- protected function _addDashboardFormData()
96
- {
97
- /** @var Mage_XmlConnect_Model_Simplexml_Form $fromXmlObj */
98
- $fromXmlObj = Mage::getModel('xmlconnect/simplexml_form', array(
99
- 'xml_id' => 'dashboard_form', 'action' => '', 'use_container' => true
100
- ));
101
-
102
- $recentActivityFieldset = $fromXmlObj->addFieldset('recent_activity', array(
103
- 'title' => $this->__('Recent Activity')
104
- ));
105
-
106
- $this->_addLastOrders($recentActivityFieldset)->_addLastSearchTerms($recentActivityFieldset)
107
- ->_addNewCustomers($recentActivityFieldset);
108
-
109
- $overallActivityFieldset = $fromXmlObj->addFieldset('overall_activity', array(
110
- 'title' => $this->__('Overall Activity')
111
- ));
112
-
113
- $this->_addTopSearchTerms($overallActivityFieldset)->_addMostViewedProducts($overallActivityFieldset)
114
- ->_addBestSellers($overallActivityFieldset)->_addCustomers($overallActivityFieldset);
115
-
116
- $this->getXmlObject()->appendChild($fromXmlObj->toXmlObject());
117
- return $this;
118
- }
119
-
120
- /**
121
- * Add last orders info to xml object
122
- *
123
- * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $recentActivityFieldset
124
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
125
- */
126
- protected function _addLastOrders(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $recentActivityFieldset)
127
- {
128
- $lastOrdersField = $recentActivityFieldset->addField('last_orders', 'custom', array(
129
- 'label' => $this->__('Last 5 Orders')
130
- ));
131
- $this->getChild('last_orders')->addLastOrdersToXmlObj($lastOrdersField->getXmlObject());
132
- return $this;
133
- }
134
-
135
- /**
136
- * Add last search terms data
137
- *
138
- * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $recentActivityFieldset
139
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
140
- */
141
- protected function _addLastSearchTerms(
142
- Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $recentActivityFieldset
143
- ) {
144
- $lastSearchTermsField = $recentActivityFieldset->addField('last_search', 'custom', array(
145
- 'label' => $this->__('Last 5 Search Terms')
146
- ));
147
- $this->getChild('last_search_terms')->addLastSearchTermsToXmlObj($lastSearchTermsField->getXmlObject());
148
- return $this;
149
- }
150
-
151
- /**
152
- * Add new customers info to xml object
153
- *
154
- * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $recentActivityFieldset
155
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
156
- */
157
- protected function _addNewCustomers(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $recentActivityFieldset)
158
- {
159
- $newCustomersField = $recentActivityFieldset->addField('new_customers', 'custom', array(
160
- 'label' => $this->__('New Customers')
161
- ));
162
- $this->getChild('new_customers')->addNewCustomersToXmlObj($newCustomersField->getXmlObject());
163
- return $this;
164
- }
165
-
166
- /**
167
- * Add top search queries info to xml object
168
- *
169
- * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset
170
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
171
- */
172
- protected function _addTopSearchTerms(
173
- Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset
174
- ) {
175
- $topSearchField = $overallActivityFieldset->addField('top_search', 'custom', array(
176
- 'label' => $this->__('Top Search Terms')
177
- ));
178
- $this->getChild('top_search_terms')->addTopSearchTermsToXmlObj($topSearchField->getXmlObject());
179
- return $this;
180
- }
181
-
182
- /**
183
- * Add most viewed products to xml object
184
- *
185
- * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset
186
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
187
- */
188
- protected function _addMostViewedProducts(
189
- Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset
190
- ) {
191
- $mostViewedField = $overallActivityFieldset->addField('most_viewed', 'custom', array(
192
- 'label' => $this->__('Most Viewed Products')
193
- ));
194
- $this->getChild('most_viewed')->addMostViewedProductsToXmlObj($mostViewedField->getXmlObject());
195
- return $this;
196
- }
197
-
198
- /**
199
- * Add best sellers info to xml object
200
- *
201
- * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset
202
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
203
- */
204
- protected function _addBestSellers(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset)
205
- {
206
- $bestSellersField = $overallActivityFieldset->addField('best_sellers', 'custom', array(
207
- 'label' => $this->__('Best Sellers')
208
- ));
209
- $this->getChild('best_sellers')->addBestSellersToXmlObj($bestSellersField->getXmlObject());
210
- return $this;
211
- }
212
-
213
- /**
214
- * Add customer info to xml object
215
- *
216
- * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset
217
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
218
- */
219
- protected function _addCustomers(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset)
220
- {
221
- $customersField = $overallActivityFieldset->addField('customers', 'custom', array(
222
- 'label' => $this->__('Customers')
223
- ));
224
- $this->getChild('customers')->addCustomersToXmlObj($customersField->getXmlObject());
225
- return $this;
226
- }
227
-
228
- /**
229
- * Get xml object
230
- *
231
- * @return Mage_XmlConnect_Model_Simplexml_Element
232
- */
233
- public function getXmlObject()
234
- {
235
- return $this->_xmlObject;
236
- }
237
-
238
- /**
239
- * Set xml object
240
- *
241
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObject
242
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard
243
- */
244
- public function setXmlObject($xmlObject)
245
- {
246
- $this->_xmlObject = $xmlObject;
247
- return $this;
248
- }
249
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/BestSellers.php DELETED
@@ -1,113 +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
-
27
- /**
28
- * Best sellers products xml renderer block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_BestSellers
35
- extends Mage_Adminhtml_Block_Dashboard_Tab_Products_Ordered
36
- {
37
- /**
38
- * Best sellers count to display
39
- */
40
- const BESTSELLERS_COUNT_LIMIT = 5;
41
-
42
- /**
43
- * Get rid of unnecessary collection initialization
44
- *
45
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_BestSellers
46
- */
47
- protected function _prepareCollection()
48
- {
49
- return $this;
50
- }
51
-
52
- /**
53
- * Init last search terms collection
54
- *
55
- * @param int|null $storeId
56
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_BestSellers
57
- */
58
- protected function _initCollection($storeId)
59
- {
60
- /** @var $collection Mage_Sales_Model_Resource_Report_Bestsellers_Collection */
61
- $collection = Mage::getResourceModel('sales/report_bestsellers_collection')->setModel('catalog/product')
62
- ->addStoreFilter($storeId)->setPageSize(self::BESTSELLERS_COUNT_LIMIT);
63
- $this->setCollection($collection);
64
- return $this;
65
- }
66
-
67
- /**
68
- * Clear collection
69
- *
70
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_BestSellers
71
- */
72
- protected function _clearCollection()
73
- {
74
- $this->_collection = null;
75
- return $this;
76
- }
77
-
78
- /**
79
- * Add best sellers products to xml object
80
- *
81
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
82
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_BestSellers
83
- */
84
- public function addBestSellersToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
85
- {
86
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
87
- $this->_clearCollection()->_initCollection($storeId);
88
- $valuesXml = $xmlObj->addCustomChild('values', null, array(
89
- 'store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
90
- ));
91
-
92
- if(!count($this->getCollection()->getItems()) > 0) {
93
- continue;
94
- }
95
-
96
- /** @var $orderHelper Mage_XmlConnect_Helper_Adminhtml_Dashboard_Order */
97
- $orderHelper = Mage::helper('xmlconnect/adminhtml_dashboard_order');
98
-
99
- foreach ($this->getCollection()->getItems() as $item) {
100
- $itemListXml = $valuesXml->addCustomChild('item');
101
- $itemListXml->addCustomChild('name', $item->getName(), array(
102
- 'label' => Mage::helper('sales')->__('Product Name')
103
- ));
104
- $itemListXml->addCustomChild('price', $orderHelper->preparePrice($item->getProductPrice(), $storeId),
105
- array('label' => Mage::helper('sales')->__('Price')));
106
- $itemListXml->addCustomChild('qty_ordered', $item->getQtyOrdered(), array(
107
- 'label' => Mage::helper('sales')->__('Quantity Ordered')
108
- ));
109
- }
110
- }
111
- return $this;
112
- }
113
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/Customers.php DELETED
@@ -1,129 +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
-
27
- /**
28
- * Customers xml renderer block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_Customers
35
- extends Mage_Adminhtml_Block_Dashboard_Tab_Customers_Most
36
- {
37
- /**
38
- * Customers count to display
39
- */
40
- const CUSTOMERS_COUNT_LIMIT = 5;
41
-
42
- /**
43
- * Get rid of unnecessary collection initialization
44
- *
45
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_Customers
46
- */
47
- protected function _prepareCollection()
48
- {
49
- return $this;
50
- }
51
-
52
- /**
53
- * Init order collection
54
- *
55
- * @param int|null $storeId
56
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_Customers
57
- */
58
- protected function _initCollection($storeId)
59
- {
60
- /** @var $collection Mage_Reports_Model_Resource_Order_Collection */
61
- $collection = Mage::getResourceModel('reports/order_collection');
62
- $collection->groupByCustomer()->addOrdersCount()->joinCustomerName()->setPageSize(self::CUSTOMERS_COUNT_LIMIT);
63
-
64
- $storeFilter = 0;
65
- if ($storeId) {
66
- $collection->addAttributeToFilter('store_id', $storeId);
67
- $storeFilter = 1;
68
- }
69
-
70
- $collection->addSumAvgTotals($storeFilter)->orderByTotalAmount();
71
- $this->setCollection($collection);
72
- return $this;
73
- }
74
-
75
- /**
76
- * Clear collection
77
- *
78
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_Customers
79
- */
80
- protected function _clearCollection()
81
- {
82
- $this->_collection = null;
83
- return $this;
84
- }
85
-
86
- /**
87
- * Add customers statistic to xml object
88
- *
89
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
90
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_Customers
91
- */
92
- public function addCustomersToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
93
- {
94
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
95
- $this->_clearCollection()->_initCollection($storeId);
96
- $valuesXml = $xmlObj->addCustomChild('values', null, array(
97
- 'store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
98
- ));
99
-
100
- if(!count($this->getCollection()->getItems()) > 0) {
101
- continue;
102
- }
103
-
104
- /** @var $orderHelper Mage_XmlConnect_Helper_Adminhtml_Dashboard_Order */
105
- $orderHelper = Mage::helper('xmlconnect/adminhtml_dashboard_order');
106
-
107
- foreach ($this->getCollection()->getItems() as $item) {
108
- $itemListXml = $valuesXml->addCustomChild('item');
109
- $itemListXml->addCustomChild('name', $item->getName(), array(
110
- 'label' => $this->__('Customer Name')
111
- ));
112
- $itemListXml->addCustomChild('orders_count', $item->getOrdersCount(), array(
113
- 'label' => $this->__('Number of Orders')
114
- ));
115
- $itemListXml->addCustomChild(
116
- 'orders_avg_amount',
117
- $orderHelper->preparePrice($item->getOrdersAvgAmount(), $storeId),
118
- array('label' => $this->__('Average Order Amount'))
119
- );
120
- $itemListXml->addCustomChild(
121
- 'orders_sum_amount',
122
- $orderHelper->preparePrice($item->getOrdersSumAmount(), $storeId),
123
- array('label' => $this->__('Total Order Amount'))
124
- );
125
- }
126
- }
127
- return $this;
128
- }
129
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphAmountsData.php DELETED
@@ -1,71 +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
-
27
- /**
28
- * Amounts chart data xml renderer block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphAmountsData
35
- extends Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphDataAbstract
36
- {
37
- /**
38
- * Initialize object
39
- */
40
- public function __construct()
41
- {
42
- $this->setHtmlId('amounts');
43
- parent::__construct();
44
- }
45
-
46
- /**
47
- * Prepare chart data
48
- *
49
- * @return null
50
- */
51
- protected function _prepareData()
52
- {
53
- $this->setDataHelperName('xmlconnect/adminhtml_dashboard_order');
54
- $this->setDataRows('revenue');
55
- $this->_axisMaps = array('x' => 'range', 'y' => 'revenue');
56
- parent::_prepareData();
57
- }
58
-
59
- /**
60
- * Add order chart data to xml object
61
- *
62
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
63
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphAmountsData
64
- */
65
- public function addAmountsChartDataToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
66
- {
67
- $this->_xmlObj = $xmlObj->addCustomChild('chart_data_details', null, array('id' => 'amounts'));
68
- $this->_addAllStoreData();
69
- return $this;
70
- }
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphDataAbstract.php DELETED
@@ -1,350 +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
-
27
- /**
28
- * Chart data xml renderer block abstract
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- abstract class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphDataAbstract
35
- extends Mage_Adminhtml_Block_Dashboard_Graph
36
- {
37
- /**
38
- * X axis param
39
- */
40
- const AXIS_X = 'x';
41
-
42
- /**
43
- * Y axis param
44
- */
45
- const AXIS_Y = 'y';
46
-
47
- /**
48
- * Date range param for 24 hours
49
- */
50
- const DATE_RANGE_24H = '24h';
51
-
52
- /**
53
- * Date range param for 7 days
54
- */
55
- const DATE_RANGE_7D = '7d';
56
-
57
- /**
58
- * Date range param for 1 month
59
- */
60
- const DATE_RANGE_1M = '1m';
61
-
62
- /**
63
- * Date range param for 1 year
64
- */
65
- const DATE_RANGE_1Y = '1y';
66
-
67
- /**
68
- * Date range param for 2 years
69
- */
70
- const DATE_RANGE_2Y = '2y';
71
-
72
- /**
73
- * Chart xml object
74
- *
75
- * @var Mage_XmlConnect_Model_Simplexml_Element
76
- */
77
- protected $_xmlObj;
78
-
79
- /**
80
- * Add chart data from all stores
81
- *
82
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphDataAbstract
83
- */
84
- protected function _addAllStoreData()
85
- {
86
- $dataValuesXml = $this->getXmlObj()->addCustomChild('chart_data_values');
87
- $dataDescriptionXml = $this->getXmlObj()->addCustomChild('chart_data_description');
88
-
89
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeFilter) {
90
- $this->getDataHelper()->setParam('store', $storeFilter ? $storeFilter : null);
91
- $storeId = $this->getDataHelper()->getParam('store');
92
- $storeId = $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS;
93
-
94
- $valuesXml = $dataValuesXml->addCustomChild('values', null, array(
95
- 'store_id' => $storeId
96
- ));
97
-
98
- $descriptionXml = $dataDescriptionXml->addCustomChild('values', null, array(
99
- 'store_id' => $storeId
100
- ));
101
-
102
- foreach ($this->getRangeOptions() as $rangeFilter) {
103
- $this->getDataHelper()->setParam('period', $rangeFilter['value']);
104
- $this->getDataHelper()->initCollection();
105
- $chartData = $this->getChartData();
106
- $valuesXml->addCustomChild('item', $chartData['values'], array(
107
- 'range_id' => $this->getDataHelper()->getParam('period')
108
- ));
109
- $descriptionXml->addCustomChild('item', $chartData['description'], array(
110
- 'range_id' => $this->getDataHelper()->getParam('period')
111
- ));
112
- }
113
- }
114
- return $this;
115
- }
116
-
117
- /**
118
- * Get chart data array as chart values => chart reference axis description
119
- *
120
- * @throws Mage_Core_Exception
121
- * @return array
122
- */
123
- public function getChartData()
124
- {
125
- if (!$this->getCount()) {
126
- return array('values' => '', 'description' => '');
127
- }
128
-
129
- $this->_allSeries = $this->getRowsData($this->_dataRows);
130
-
131
- foreach ($this->_axisMaps as $axis => $attr) {
132
- $this->setAxisLabels($axis, $this->getRowsData($attr, true));
133
- }
134
-
135
- list($dateSeries, $dataSeries) = $this->_getRangeAndData();
136
-
137
- $this->_axisLabels[self::AXIS_X] = $this->_normalizeDateSeries($dateSeries);
138
- $this->_allSeries = $dataSeries;
139
-
140
- $valueBuffer = array();
141
- $params = array();
142
-
143
- if (sizeof($this->_axisLabels) > 0) {
144
- $indexId = 0;
145
- foreach ($this->_axisLabels as $idx => $labels) {
146
- if ($idx == self::AXIS_X) {
147
- $valueBuffer[] = $indexId . ":|" . implode('|', $this->_getXLabels());
148
- } elseif ($idx == self::AXIS_Y) {
149
- $valueBuffer[] = $indexId . ":|" . implode('|', $this->_getYLabels());
150
- }
151
- $indexId++;
152
- }
153
- $params['description'] = implode('|', $valueBuffer);
154
- };
155
-
156
- foreach ($this->getAllSeries() as $row) {
157
- array_walk($row, create_function('&$val', '$val = ceil($val);'));
158
- $params['values'] = implode('|', $row);
159
- }
160
- return $params;
161
- }
162
-
163
- /**
164
- * Get array of date range and values range series
165
- *
166
- * @return array
167
- */
168
- protected function _getRangeAndData()
169
- {
170
- $timezoneLocal = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
171
-
172
- list ($dateStart, $dateEnd) = Mage::getResourceModel('reports/order_collection')
173
- ->getDateRange($this->getDataHelper()->getParam('period'), '', '', true);
174
-
175
- $dateStart->setTimezone($timezoneLocal);
176
- $dateEnd->setTimezone($timezoneLocal);
177
-
178
- $dateSeries = array();
179
- $dataSeries = array();
180
- while ($dateStart->compare($dateEnd) < 0) {
181
- switch ($this->getDataHelper()->getParam('period')) {
182
- case self::DATE_RANGE_24H:
183
- $date = $dateStart->toString('yyyy-MM-dd HH:00');
184
- $dateStart->addHour(1);
185
- break;
186
- case self::DATE_RANGE_7D:
187
- case self::DATE_RANGE_1M:
188
- $date = $dateStart->toString('yyyy-MM-dd');
189
- $dateStart->addDay(1);
190
- break;
191
- case self::DATE_RANGE_1Y:
192
- case self::DATE_RANGE_2Y:
193
- $date = $dateStart->toString('yyyy-MM');
194
- $dateStart->addMonth(1);
195
- break;
196
- }
197
- foreach ($this->getAllSeries() as $index => $series) {
198
- if (in_array($date, $this->_axisLabels[self::AXIS_X])) {
199
- $dataSeries[$index][] = (float)array_shift($this->_allSeries[$index]);
200
- } else {
201
- $dataSeries[$index][] = 0;
202
- }
203
- }
204
- $dateSeries[] = $date;
205
- }
206
- return array($dateSeries, $dataSeries);
207
- }
208
-
209
- /**
210
- * Skip excess values of date series
211
- *
212
- * Keep count of date series up to 15 items
213
- *
214
- * @param array $dateSeries
215
- * @return array
216
- */
217
- protected function _normalizeDateSeries($dateSeries)
218
- {
219
- /**
220
- * setting skip step
221
- */
222
- if (count($dateSeries) > 8 && count($dateSeries) < 15) {
223
- $skipStep = 1;
224
- } elseif (count($dateSeries) >= 15) {
225
- $skipStep = 2;
226
- } else {
227
- $skipStep = 0;
228
- }
229
- /**
230
- * skipping some x labels for good reading
231
- */
232
- $i = 0;
233
- foreach ($dateSeries as $index => $date) {
234
- if ($i == $skipStep) {
235
- $dateSeries[$index] = $date;
236
- $i = 0;
237
- } else {
238
- $dateSeries[$index] = '';
239
- ++$i;
240
- }
241
- }
242
- return $dateSeries;
243
- }
244
-
245
- /**
246
- * Get X axis params array
247
- *
248
- * @return array
249
- */
250
- protected function _getXLabels()
251
- {
252
- /**
253
- * Format date
254
- */
255
- foreach ($this->_axisLabels[self::AXIS_X] as $index => $label) {
256
- if ($label != '') {
257
- switch ($this->getDataHelper()->getParam('period')) {
258
- case self::DATE_RANGE_24H:
259
- $this->_axisLabels[self::AXIS_X][$index] = $this->formatTime(
260
- new Zend_Date($label, 'yyyy-MM-dd HH:00'), 'short', false
261
- );
262
- break;
263
- case self::DATE_RANGE_7D:
264
- case self::DATE_RANGE_1M:
265
- $this->_axisLabels[self::AXIS_X][$index] = $this->formatDate(
266
- new Zend_Date($label, 'yyyy-MM-dd')
267
- );
268
- break;
269
- case self::DATE_RANGE_1Y:
270
- case self::DATE_RANGE_2Y:
271
- $formats = Mage::app()->getLocale()->getTranslationList('datetime');
272
- $format = isset($formats['yyMM']) ? $formats['yyMM'] : 'MM/yyyy';
273
- $format = str_replace(array("yyyy", "yy", "MM"), array("Y", "y", "m"), $format);
274
- $this->_axisLabels[self::AXIS_X][$index] = date($format, strtotime($label));
275
- break;
276
- default:
277
- Mage::throwException($this->__('Range param doesn\'t recognized'));
278
- break;
279
- }
280
- } else {
281
- $this->_axisLabels[self::AXIS_X][$index] = '';
282
- }
283
- }
284
- return $this->_axisLabels[self::AXIS_X];
285
- }
286
-
287
- /**
288
- * Get Y axis params array
289
- *
290
- * @return array
291
- */
292
- protected function _getYLabels()
293
- {
294
- $localMaxValue = $localMinValue = array();
295
- // process each string in the array, and find the max length
296
- foreach ($this->getAllSeries() as $index => $series) {
297
- $localMaxValue[$index] = max($series);
298
- $localMinValue[$index] = min($series);
299
- }
300
-
301
- if (is_numeric($this->_max)) {
302
- $maxvalue = $this->_max;
303
- } else {
304
- $maxvalue = max($localMaxValue);
305
- }
306
- if (is_numeric($this->_min)) {
307
- $minvalue = $this->_min;
308
- } else {
309
- $minvalue = min($localMinValue);
310
- }
311
-
312
- // default values
313
- $yLabels = array();
314
-
315
- if ($minvalue >= 0 && $maxvalue >= 0) {
316
- $miny = 0;
317
- if ($maxvalue > 10) {
318
- $p = pow(10, $this->_getPow($maxvalue));
319
- $maxy = ceil($maxvalue / $p) * $p;
320
- $yLabels = range($miny, $maxy, $p);
321
- } else {
322
- $maxy = ceil($maxvalue + 1);
323
- $yLabels = range($miny, $maxy, 1);
324
- }
325
- }
326
- return $yLabels;
327
- }
328
-
329
- /**
330
- * Get chart xml object
331
- *
332
- * @return Mage_XmlConnect_Model_Simplexml_Element
333
- */
334
- public function getXmlObj()
335
- {
336
- return $this->_xmlObj;
337
- }
338
-
339
- /**
340
- * Set chart xml object
341
- *
342
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
343
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphDataAbstract
344
- */
345
- public function setXmlObj($xmlObj)
346
- {
347
- $this->_xmlObj = $xmlObj;
348
- return $this;
349
- }
350
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphInfo.php DELETED
@@ -1,160 +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
-
27
- /**
28
- * Admin application diagram info renderer
29
- *
30
- * @category Mage
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
38
- *
39
- * @var array
40
- */
41
- protected $_timeRangeOptions;
42
-
43
- /**
44
- * Add last orders info to xml object
45
- *
46
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
47
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo
48
- */
49
- public function addGraphInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
50
- {
51
- /** @var $graphInfoXmlObj Mage_XmlConnect_Model_Simplexml_Element */
52
- $graphInfoXmlObj = $xmlObj->addCustomChild('chart');
53
- $this->_addRangeValues($graphInfoXmlObj)->_addDataSelector($graphInfoXmlObj)->_addTotalsBar($graphInfoXmlObj);
54
-
55
- $graphInfoXmlObj = $graphInfoXmlObj->addCustomChild('chart_data');
56
- $this->_addChartDataOrders($graphInfoXmlObj)->_addChartDataAmounts($graphInfoXmlObj);
57
- return $this;
58
- }
59
-
60
- /**
61
- * Add time range select filed to xml object
62
- *
63
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
64
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo
65
- */
66
- protected function _addRangeValues(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
67
- {
68
- $options = $this->_getRangeOptions();
69
-
70
- /** @var $rangeXmlObj Mage_XmlConnect_Model_Simplexml_Form_Element_Select */
71
- $rangeXmlObj = Mage::getModel('xmlconnect/simplexml_form_element_select', array(
72
- 'label' => $this->__('Select Range'),
73
- 'options' => $options,
74
- 'value' => $options[0]['value']
75
- ));
76
- $rangeXmlObj->setId('range_id');
77
- $xmlObj->appendChild($rangeXmlObj->toXmlObject());
78
- return $this;
79
- }
80
-
81
- /**
82
- * Get range filter options
83
- *
84
- * @return array
85
- */
86
- protected function _getRangeOptions()
87
- {
88
- if (null === $this->_timeRangeOptions) {
89
- $options = array();
90
- foreach ($this->helper('adminhtml/dashboard_data')->getDatePeriods() as $value => $label) {
91
- if (in_array($value, array('custom'))) {
92
- continue;
93
- }
94
- $options[] = array('label' => $label, 'value' => $value);
95
- }
96
- $this->_timeRangeOptions = $options;
97
- }
98
- return $this->_timeRangeOptions;
99
- }
100
-
101
- /**
102
- * Add data select field to xml object
103
- *
104
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
105
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo
106
- */
107
- protected function _addDataSelector(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
108
- {
109
- /** @var $rangeXmlObj Mage_XmlConnect_Model_Simplexml_Form_Element_Select */
110
- $rangeXmlObj = Mage::getModel('xmlconnect/simplexml_form_element_select', array(
111
- 'label' => $this->__('Select Chart'),
112
- 'value' => 'orders',
113
- 'options' => array(
114
- array('label' => $this->__('Orders'), 'value' => 'orders'),
115
- array('label' => $this->__('Amounts'), 'value' => 'amounts')
116
- )));
117
- $rangeXmlObj->setId('data_details_id');
118
- $xmlObj->appendChild($rangeXmlObj->toXmlObject());
119
- return $this;
120
- }
121
-
122
- /**
123
- * Add orders chart data to xml object
124
- *
125
- * @param Mage_XmlConnect_Model_Simplexml_Element $graphInfoXmlObj
126
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo
127
- */
128
- protected function _addChartDataOrders(Mage_XmlConnect_Model_Simplexml_Element $graphInfoXmlObj)
129
- {
130
- $this->getChild('graph_order_data')->setRangeOptions($this->_getRangeOptions())
131
- ->addOrderChartDataToXmlObj($graphInfoXmlObj);
132
- return $this;
133
- }
134
-
135
- /**
136
- * Add amounts chart data to xml object
137
- *
138
- * @param Mage_XmlConnect_Model_Simplexml_Element $graphInfoXmlObj
139
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo
140
- */
141
- protected function _addChartDataAmounts(Mage_XmlConnect_Model_Simplexml_Element $graphInfoXmlObj)
142
- {
143
- $this->getChild('graph_amounts_data')->setRangeOptions($this->_getRangeOptions())
144
- ->addAmountsChartDataToXmlObj($graphInfoXmlObj);
145
- return $this;
146
- }
147
-
148
- /**
149
- * Add totals chart data to xml object
150
- *
151
- * @param Mage_XmlConnect_Model_Simplexml_Element $graphInfoXmlObj
152
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo
153
- */
154
- protected function _addTotalsBar(Mage_XmlConnect_Model_Simplexml_Element $graphInfoXmlObj)
155
- {
156
- $this->getChild('graph_totals_data')->setRangeOptions($this->_getRangeOptions())
157
- ->addTotalsDataToXmlObj($graphInfoXmlObj);
158
- return $this;
159
- }
160
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphOrderData.php DELETED
@@ -1,71 +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
-
27
- /**
28
- * Orders chart data xml renderer block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphOrderData
35
- extends Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphDataAbstract
36
- {
37
- /**
38
- * Initialize object
39
- */
40
- public function __construct()
41
- {
42
- $this->setHtmlId('orders');
43
- parent::__construct();
44
- }
45
-
46
- /**
47
- * Prepare chart data
48
- *
49
- * @return null
50
- */
51
- protected function _prepareData()
52
- {
53
- $this->setDataHelperName('xmlconnect/adminhtml_dashboard_order');
54
- $this->setDataRows('quantity');
55
- $this->_axisMaps = array('x' => 'range', 'y' => 'quantity');
56
- parent::_prepareData();
57
- }
58
-
59
- /**
60
- * Add order chart data to xml object
61
- *
62
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
63
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphOrderData
64
- */
65
- public function addOrderChartDataToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
66
- {
67
- $this->_xmlObj = $xmlObj->addCustomChild('chart_data_details', null, array('id' => 'orders'));
68
- $this->_addAllStoreData();
69
- return $this;
70
- }
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphTotalsData.php DELETED
@@ -1,123 +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
-
27
- /**
28
- * Totals chart data xml renderer block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphTotalsData extends Mage_Adminhtml_Block_Dashboard_Totals
35
- {
36
- /**
37
- * Get rid of unnecessary collection initialization by parent
38
- *
39
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphTotalsData
40
- */
41
- protected function _prepareLayout()
42
- {
43
- return $this;
44
- }
45
-
46
- /**
47
- * Init totals collection and assign totals values
48
- *
49
- * @param null|int $storeId
50
- * @param string $rangeId
51
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphTotalsData
52
- */
53
- protected function _initCollection($storeId, $rangeId)
54
- {
55
- if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
56
- return $this;
57
- }
58
-
59
- /* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
60
- $collection = Mage::getResourceModel('reports/order_collection')->addCreateAtPeriodFilter($rangeId)
61
- ->calculateTotals((bool)$storeId);
62
-
63
- if ($storeId) {
64
- $collection->addFieldToFilter('store_id', $storeId);
65
- } elseif (!$collection->isLive()) {
66
- $collection->addFieldToFilter('store_id', array(
67
- 'eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId()
68
- ));
69
- }
70
-
71
- $collection->load();
72
- $totals = $collection->getFirstItem();
73
-
74
- $this->addTotal($this->__('Revenue'), $totals->getRevenue());
75
- $this->addTotal($this->__('Tax'), $totals->getTax());
76
- $this->addTotal($this->__('Shipping'), $totals->getShipping());
77
- $this->addTotal($this->__('Quantity'), $totals->getQuantity() * 1, true);
78
- return $this;
79
- }
80
-
81
- /**
82
- * Add cart totals data to xml object
83
- *
84
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
85
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphTotalsData
86
- */
87
- public function addTotalsDataToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
88
- {
89
- $dataValuesXml = $xmlObj->addCustomChild('chart_totals');
90
-
91
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeFilter) {
92
- $storeId = $storeFilter ? $storeFilter : null;
93
-
94
- $totalsXml = $dataValuesXml->addCustomChild('totals', null, array(
95
- 'store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
96
- ));
97
-
98
- foreach ($this->getRangeOptions() as $rangeFilter) {
99
- $this->_initCollection($storeId, $rangeFilter['value']);
100
- $valuesXml = $totalsXml->addCustomChild('values', null, array(
101
- 'range_id' => $rangeFilter['value']
102
- ));
103
- foreach ($this->getTotals() as $total) {
104
- $totalValue = $valuesXml->escapeXml($total['value'] . $total['decimals']);
105
- $valuesXml->addCustomChild('item', $totalValue, array('label' => $total['label']));
106
- }
107
- $this->_clearTotals();
108
- }
109
- }
110
- return $this;
111
- }
112
-
113
- /**
114
- * Clear totals values array
115
- *
116
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphTotalsData
117
- */
118
- protected function _clearTotals()
119
- {
120
- $this->_totals = array();
121
- return $this;
122
- }
123
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastOrders.php DELETED
@@ -1,85 +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
-
27
- /**
28
- * Admin application last orders renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastOrders extends Mage_Adminhtml_Block_Dashboard_Orders_Grid
35
- {
36
- /**
37
- * Last orders count limit
38
- */
39
- const LAST_ORDER_COUNT_LIMIT = 5;
40
-
41
- /**
42
- * Add last orders info to xml object
43
- *
44
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
45
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastOrders
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
-
53
- /** @var $collection Mage_Reports_Model_Resource_Order_Collection */
54
- $collection = Mage::getResourceModel('reports/order_collection')->addItemCountExpr()
55
- ->joinCustomerName('customer')->orderByCreatedAt()->setPageSize(self::LAST_ORDER_COUNT_LIMIT);
56
-
57
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
58
- if ($storeId) {
59
- $collection->addAttributeToFilter('store_id', $storeId);
60
- $collection->addRevenueToSelect();
61
- } else {
62
- $collection->addRevenueToSelect(true);
63
- }
64
-
65
- $this->setCollection($collection);
66
- $orderList = $this->_prepareColumns()->getCollection()->load();
67
- $valuesXmlObj = $xmlObj->addCustomChild('values', null, array(
68
- 'store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
69
- ));
70
-
71
- foreach ($orderList as $order) {
72
- $itemXmlObj = $valuesXmlObj->addCustomChild('item');
73
- $itemXmlObj->addCustomChild('customer', $order->getCustomer(), array('label' => $this->__('Customer')));
74
- $itemXmlObj->addCustomChild('items_count', $order->getItemsCount(), array(
75
- 'label' => $this->__('Items')
76
- ));
77
- $currency_code = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
78
- $itemXmlObj->addCustomChild('currency', Mage::app()->getLocale()->currency($currency_code)
79
- ->toCurrency($order->getRevenue()), array('label' => $this->__('Grand Total')));
80
- }
81
- $collection->clear();
82
- }
83
- return $this;
84
- }
85
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastSearchTerms.php DELETED
@@ -1,118 +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
-
27
- /**
28
- * Admin application last search terms xml renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastSearchTerms
35
- extends Mage_Adminhtml_Block_Dashboard_Searches_Last
36
- {
37
- /**
38
- * Search terms count to display
39
- */
40
- const TERMS_COUNT_LIMIT = 5;
41
-
42
- /**
43
- * Get rid of unnecessary collection initialization
44
- *
45
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastSearchTerms
46
- */
47
- protected function _prepareCollection()
48
- {
49
- return $this;
50
- }
51
-
52
- /**
53
- * Init last search terms collection
54
- *
55
- * @param int|null $storeId
56
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastSearchTerms
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 */
64
- $this->_collection = Mage::getModel('catalogsearch/query')->getResourceCollection();
65
- $this->_collection->setRecentQueryFilter()->setPageSize(self::TERMS_COUNT_LIMIT);
66
-
67
- if ($storeId) {
68
- $this->_collection->addFieldToFilter('store_id', $storeId);
69
- }
70
- $this->setCollection($this->_collection);
71
- return $this;
72
- }
73
-
74
- /**
75
- * Clear collection
76
- *
77
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastSearchTerms
78
- */
79
- protected function _clearCollection()
80
- {
81
- $this->_collection = null;
82
- return $this;
83
- }
84
-
85
- /**
86
- * Add last search terms info to xml object
87
- *
88
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
89
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastSearchTerms
90
- */
91
- public function addLastSearchTermsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
92
- {
93
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
94
- $this->_clearCollection()->_initCollection($storeId);
95
- $valuesXml = $xmlObj->addCustomChild('values', null, array(
96
- 'store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
97
- ));
98
-
99
- if(!count($this->getCollection()->getItems()) > 0) {
100
- continue;
101
- }
102
-
103
- foreach ($this->getCollection()->getItems() as $item) {
104
- $itemListXml = $valuesXml->addCustomChild('item');
105
- $itemListXml->addCustomChild('query_text', $item->getQueryText(), array(
106
- 'label' => $this->__('Search Term')
107
- ));
108
- $itemListXml->addCustomChild('num_results', $item->getNumResults(), array(
109
- 'label' => $this->__('Results')
110
- ));
111
- $itemListXml->addCustomChild('popularity', $item->getPopularity(), array(
112
- 'label' => $this->__('Number of Uses')
113
- ));
114
- }
115
- }
116
- return $this;
117
- }
118
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/MostViewedProducts.php DELETED
@@ -1,117 +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
-
27
- /**
28
- * Most viewed products xml renderer block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_MostViewedProducts
35
- extends Mage_Adminhtml_Block_Dashboard_Tab_Products_Viewed
36
- {
37
- /**
38
- * Products count to display
39
- */
40
- const PRODUCTS_COUNT_LIMIT = 5;
41
-
42
- /**
43
- * Get rid of unnecessary collection initialization
44
- *
45
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_MostViewedProducts
46
- */
47
- protected function _prepareCollection()
48
- {
49
- return $this;
50
- }
51
-
52
- /**
53
- * Init last search terms collection
54
- *
55
- * @param int|null $storeId
56
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_MostViewedProducts
57
- */
58
- protected function _initCollection($storeId)
59
- {
60
- $collection = Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->addViewsCount()
61
- ->setStoreId($storeId)->addStoreFilter($storeId)->setPageSize(self::PRODUCTS_COUNT_LIMIT);
62
- $this->setCollection($collection);
63
- return $this;
64
- }
65
-
66
- /**
67
- * Clear collection
68
- *
69
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_MostViewedProducts
70
- */
71
- protected function _clearCollection()
72
- {
73
- $this->_collection = null;
74
- return $this;
75
- }
76
-
77
- /**
78
- * Add most viewed products to xml object
79
- *
80
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
81
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_MostViewedProducts
82
- */
83
- public function addMostViewedProductsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
84
- {
85
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
86
- $this->_clearCollection()->_initCollection($storeId);
87
- $valuesXml = $xmlObj->addCustomChild('values', null, array(
88
- 'store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
89
- ));
90
-
91
- if(!count($this->getCollection()->getItems()) > 0) {
92
- continue;
93
- }
94
-
95
- /** @var $orderHelper Mage_XmlConnect_Helper_Adminhtml_Dashboard_Order */
96
- $orderHelper = Mage::helper('xmlconnect/adminhtml_dashboard_order');
97
-
98
- foreach ($this->getCollection()->getItems() as $item) {
99
- $itemListXml = $valuesXml->addCustomChild('item');
100
- $itemListXml->addCustomChild('name', $item->getName(), array(
101
- 'label' => Mage::helper('reports')->__('Product Name')
102
- ));
103
- $itemListXml->addCustomChild(
104
- 'price',
105
- $orderHelper->preparePrice($item->getPrice(), $storeId),
106
- array('label' => Mage::helper('reports')->__('Price'))
107
- );
108
- $itemListXml->addCustomChild(
109
- 'views',
110
- $item->getViews(),
111
- array('label' => Mage::helper('reports')->__('Number of Views'))
112
- );
113
- }
114
- }
115
- return $this;
116
- }
117
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/NewCustomers.php DELETED
@@ -1,129 +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
-
27
- /**
28
- * New customers xml block renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_NewCustomers
35
- extends Mage_Adminhtml_Block_Dashboard_Tab_Customers_Newest
36
- {
37
- /**
38
- * Customers count to display
39
- */
40
- const CUSTOMERS_COUNT_LIMIT = 5;
41
-
42
- /**
43
- * Get rid of unnecessary collection initialization
44
- *
45
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_NewCustomers
46
- */
47
- protected function _prepareCollection()
48
- {
49
- return $this;
50
- }
51
-
52
- /**
53
- * Init new customers collection
54
- *
55
- * @param int|null $storeId
56
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_NewCustomers
57
- */
58
- protected function _initCollection($storeId)
59
- {
60
- /** @var $collection Mage_Reports_Model_Resource_Customer_Collection */
61
- $collection = Mage::getResourceModel('reports/customer_collection')->addCustomerName()
62
- ->setPageSize(self::CUSTOMERS_COUNT_LIMIT);
63
-
64
- $storeFilter = 0;
65
- if ($storeId) {
66
- $collection->addAttributeToFilter('store_id', $storeId);
67
- $storeFilter = 1;
68
- }
69
-
70
- $collection->addOrdersStatistics($storeFilter)->orderByCustomerRegistration();
71
- $this->setCollection($collection);
72
- return $this;
73
- }
74
-
75
- /**
76
- * Clear collection
77
- *
78
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_NewCustomers
79
- */
80
- protected function _clearCollection()
81
- {
82
- $this->_collection = null;
83
- return $this;
84
- }
85
-
86
- /**
87
- * Add new customers statistic to xml object
88
- *
89
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
90
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_NewCustomers
91
- */
92
- public function addNewCustomersToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
93
- {
94
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
95
- $this->_clearCollection()->_initCollection($storeId);
96
- $valuesXml = $xmlObj->addCustomChild('values', null, array(
97
- 'store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
98
- ));
99
-
100
- if(!count($this->getCollection()->getItems()) > 0) {
101
- continue;
102
- }
103
-
104
- /** @var $orderHelper Mage_XmlConnect_Helper_Adminhtml_Dashboard_Order */
105
- $orderHelper = Mage::helper('xmlconnect/adminhtml_dashboard_order');
106
-
107
- foreach ($this->getCollection()->getItems() as $item) {
108
- $itemListXml = $valuesXml->addCustomChild('item');
109
- $itemListXml->addCustomChild('name', $item->getName(), array(
110
- 'label' => $this->__('Customer Name')
111
- ));
112
- $itemListXml->addCustomChild('orders_count', $item->getOrdersCount(), array(
113
- 'label' => $this->__('Number of Orders')
114
- ));
115
- $itemListXml->addCustomChild(
116
- 'orders_avg_amount',
117
- $orderHelper->preparePrice($item->getOrdersAvgAmount(), $storeId),
118
- array('label' => $this->__('Average Order Amount'))
119
- );
120
- $itemListXml->addCustomChild(
121
- 'orders_sum_amount',
122
- $orderHelper->preparePrice($item->getOrdersSumAmount(), $storeId),
123
- array('label' => $this->__('Total Order Amount'))
124
- );
125
- }
126
- }
127
- return $this;
128
- }
129
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/SalesInfo.php DELETED
@@ -1,119 +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
-
27
- /**
28
- * Admin application sales info renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_SalesInfo extends Mage_Adminhtml_Block_Dashboard_Sales
35
- {
36
- /**
37
- * Add sales info to xml object
38
- *
39
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
40
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_SalesInfo
41
- */
42
- public function addSalesInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
43
- {
44
- if (count($this->getTotals()) > 0) {
45
- /** @var $salesInfoField Mage_XmlConnect_Model_Simplexml_Form_Element_Custom */
46
- $salesInfoField = Mage::getModel('xmlconnect/simplexml_form_element_custom', array(
47
- 'label' => ''
48
- ));
49
- $salesInfoField->setId('sales_info');
50
- $salesInfoXmlObj = $salesInfoField->toXmlObject();
51
- $storeId = null;
52
- foreach ($this->getTotals() as $total) {
53
- if (null === $storeId || $storeId !== $total['store_id']) {
54
- $storeId = $total['store_id'];
55
- $valuesXmlObj = $salesInfoXmlObj->addCustomChild('values', null, array('store_id' => $storeId));
56
- }
57
- $valuesXmlObj->addCustomChild('item', strip_tags($total['value']), array(
58
- 'label' => $total['label']
59
- ));
60
- }
61
- $xmlObj->appendChild($salesInfoXmlObj);
62
- }
63
- return $this;
64
- }
65
-
66
- /**
67
- * Prepare sales data collection
68
- *
69
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_SalesInfo
70
- */
71
- protected function _prepareLayout()
72
- {
73
- if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
74
- return $this;
75
- }
76
-
77
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $filter) {
78
- $this->setCurrentStore($filter);
79
- if ($filter) {
80
- Mage::app()->getStore($filter);
81
- }
82
- $collection = Mage::getResourceModel('reports/order_collection')
83
- ->calculateSales($filter);
84
-
85
- if ($filter) {
86
- $collection->addFieldToFilter('store_id', $filter);
87
- }
88
-
89
- $collection->load();
90
- $sales = $collection->getFirstItem();
91
-
92
- $this->addTotal($this->__('Lifetime Sales'), $sales->getLifetime());
93
- $this->addTotal($this->__('Average Orders'), $sales->getAverage());
94
- }
95
- }
96
-
97
- /**
98
- * Add totals data with current store id to totals array
99
- *
100
- * @param string $label
101
- * @param string $value
102
- * @param bool $isQuantity
103
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_SalesInfo
104
- */
105
- public function addTotal($label, $value, $isQuantity = false)
106
- {
107
- if (!$isQuantity) {
108
- $value = $this->format($value);
109
- }
110
- $this->_totals[] = array(
111
- 'label' => $label,
112
- 'value' => $value,
113
- 'store_id' => $this->getCurrentStore() ? $this->getCurrentStore()
114
- : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
115
- );
116
-
117
- return $this;
118
- }
119
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/StoreSwitcher.php DELETED
@@ -1,198 +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
-
27
- /**
28
- * Admin application store switcher renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_StoreSwitcher extends Mage_Adminhtml_Block_Store_Switcher
35
- {
36
- /**
37
- * Add sales info to xml object
38
- *
39
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
40
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_StoreSwitcher
41
- */
42
- public function addSwitcherToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
43
- {
44
- $websites = $this->getWebsites();
45
- if ($websites) {
46
- $this->setUseConfirm(false);
47
-
48
- /** @var $storeSwitcherField Mage_XmlConnect_Model_Simplexml_Form_Element_Custom */
49
- $storeSwitcherField = Mage::getModel('xmlconnect/simplexml_form_element_custom', array(
50
- 'label' => $this->__('Choose Store View')
51
- ));
52
- $storeSwitcherField->setId('store_id');
53
- $storeSwitcherXmlObj = $storeSwitcherField->toXmlObject();
54
- $this->_createStoreItemList($websites, $storeSwitcherXmlObj);
55
-
56
- if (!$storeSwitcherXmlObj->getAttribute('value')) {
57
- $storeSwitcherXmlObj->addAttribute('value', Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS);
58
- }
59
- $xmlObj->appendChild($storeSwitcherXmlObj);
60
- }
61
- return $this;
62
- }
63
-
64
- /**
65
- * Create store item list for xml object
66
- *
67
- * @param array $websites
68
- * @param Mage_XmlConnect_Model_Simplexml_Element $storeSwitcherXmlObj
69
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_StoreSwitcher
70
- */
71
- protected function _createStoreItemList($websites, Mage_XmlConnect_Model_Simplexml_Element $storeSwitcherXmlObj)
72
- {
73
- $switcherItemsXmlObj = $storeSwitcherXmlObj->addCustomChild('values');
74
-
75
- if ($this->hasDefaultOption()) {
76
- $this->_addSwitcherItem($switcherItemsXmlObj, Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS,
77
- array('label' => $this->getDefaultStoreName(), 'level' => 1));
78
- }
79
-
80
- foreach ($websites as $website) {
81
- foreach ($website->getGroups() as $group) {
82
- $this->_setStoreItemsByNestingLevel($storeSwitcherXmlObj, $switcherItemsXmlObj, $website, $group);
83
- }
84
- }
85
- return $this;
86
- }
87
-
88
- /**
89
- * Set store items to xml object by nesting level
90
- *
91
- * @param Mage_XmlConnect_Model_Simplexml_Element $storeSwitcherXmlObj
92
- * @param Mage_XmlConnect_Model_Simplexml_Element $switcherItemsXmlObj
93
- * @param array $website
94
- * @param array $group
95
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_StoreSwitcher
96
- */
97
- protected function _setStoreItemsByNestingLevel($storeSwitcherXmlObj, $switcherItemsXmlObj, $website, $group)
98
- {
99
- $showWebsite = $showGroup = false;
100
- foreach ($this->getStores($group) as $store) {
101
- if ($showWebsite == false) {
102
- $showWebsite = true;
103
- $this->_addSwitcherItem($switcherItemsXmlObj, null, array(
104
- 'label' => $website->getName(), 'level' => 1
105
- ), true);
106
- }
107
-
108
- if ($showGroup == false) {
109
- $showGroup = true;
110
- $this->_addSwitcherItem($switcherItemsXmlObj, null, array(
111
- 'label' => $group->getName(), 'level' => 2
112
- ), true);
113
- }
114
-
115
- if ($this->getStoreId() == $store->getId()) {
116
- $storeSwitcherXmlObj->addAttribute('value', $this->getStoreId());
117
- }
118
-
119
- $this->_addSwitcherItem($switcherItemsXmlObj, $store->getId(), array(
120
- 'label' => $store->getName(), 'level' => 3
121
- ));
122
- }
123
- return $this;
124
- }
125
-
126
- /**
127
- * Add switcher item to xml object
128
- *
129
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
130
- * @param string $value
131
- * @param array $config
132
- * @param bool $isDisabled
133
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_StoreSwitcher
134
- */
135
- protected function _addSwitcherItem($xmlObj, $value, $config, $isDisabled = false)
136
- {
137
- if ($isDisabled) {
138
- $config += array('disabled' => 1);
139
- }
140
- $xmlObj->addCustomChild('item', $value, $config);
141
- return $this;
142
- }
143
-
144
- /**
145
- * Get store switcher params as array
146
- *
147
- * @return array
148
- */
149
- protected function _getStoreSwitcherParams()
150
- {
151
- $result = array();
152
- $websites = $this->getWebsites();
153
- foreach ($websites as $website) {
154
- $showWebsite = false;
155
- foreach ($website->getGroups() as $group) {
156
- $showGroup = false;
157
- foreach ($this->getStores($group) as $store) {
158
- if ($showWebsite == false) {
159
- $showWebsite = true;
160
- $result[$website->getId()]['name'] = $website->getName();
161
- $result[$website->getId()]['store_list'] = array();
162
- }
163
-
164
- if ($showGroup == false) {
165
- $showGroup = true;
166
- $result[$website->getId()]['store_list'][$group->getId()]['name'] = $group->getName();
167
- $result[$website->getId()]['store_list'][$group->getId()]['view_list'] = array();
168
- }
169
- $result[$website->getId()]['store_list'][$group->getId()]['view_list'][$store->getId()] = $store
170
- ->getName();
171
- }
172
- }
173
- }
174
- return $result;
175
- }
176
-
177
- /**
178
- * Prepare sales data collection
179
- *
180
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_SalesInfo
181
- */
182
- protected function _prepareLayout()
183
- {
184
- $this->registerStoreSwitcher();
185
- return parent::_prepareLayout();
186
- }
187
-
188
- /**
189
- * Set store switcher to registry
190
- *
191
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_StoreSwitcher
192
- */
193
- public function registerStoreSwitcher()
194
- {
195
- Mage::register('store_switcher', $this->_getStoreSwitcherParams());
196
- return $this;
197
- }
198
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/TopSearchTerms.php DELETED
@@ -1,114 +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
-
27
- /**
28
- * Top search terms xml renderer block
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
35
- extends Mage_Adminhtml_Block_Dashboard_Searches_Top
36
- {
37
- /**
38
- * Search terms count to display
39
- */
40
- const TERMS_COUNT_LIMIT = 5;
41
-
42
- /**
43
- * Get rid of unnecessary collection initialization
44
- *
45
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
46
- */
47
- protected function _prepareCollection()
48
- {
49
- return $this;
50
- }
51
-
52
- /**
53
- * Init last search terms collection
54
- *
55
- * @param int|null $storeId
56
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
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 */
64
- $this->_collection = Mage::getModel('catalogsearch/query')->getResourceCollection();
65
- $this->_collection->setPopularQueryFilter($storeId ? $storeId : '')->setPageSize(self::TERMS_COUNT_LIMIT);
66
- $this->setCollection($this->_collection);
67
- return $this;
68
- }
69
-
70
- /**
71
- * Clear collection
72
- *
73
- * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
74
- */
75
- protected function _clearCollection()
76
- {
77
- $this->_collection = null;
78
- return $this;
79
- }
80
-
81
- /**
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
- {
89
- foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
90
- $this->_clearCollection()->_initCollection($storeId);
91
- $valuesXml = $xmlObj->addCustomChild('values', null, array(
92
- 'store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS
93
- ));
94
-
95
- if(!count($this->getCollection()->getItems()) > 0) {
96
- continue;
97
- }
98
-
99
- foreach ($this->getCollection()->getItems() as $item) {
100
- $itemListXml = $valuesXml->addCustomChild('item');
101
- $itemListXml->addCustomChild('name', $item->getName(), array(
102
- 'label' => $this->__('Search Term')
103
- ));
104
- $itemListXml->addCustomChild('num_results', $item->getNumResults(), array(
105
- 'label' => $this->__('Results')
106
- ));
107
- $itemListXml->addCustomChild('popularity', $item->getPopularity(), array(
108
- 'label' => $this->__('Number of Uses')
109
- ));
110
- }
111
- }
112
- return $this;
113
- }
114
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Loginform.php DELETED
@@ -1,70 +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
-
27
- /**
28
- * Admin application login form renderer
29
- *
30
- * @category Mage
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
38
- *
39
- * @return string
40
- */
41
- protected function _toHtml()
42
- {
43
- $action = $this->getUrl('*/*/login');
44
-
45
- /** @var Mage_XmlConnect_Model_Simplexml_Form $fromXmlObj */
46
- $fromXmlObj = Mage::getModel('xmlconnect/simplexml_form', array(
47
- 'xml_id' => 'login_form',
48
- 'action' => $action,
49
- 'use_container' => true
50
- ))->setFieldNameSuffix('login_info');
51
-
52
- $formFieldset = $fromXmlObj->addFieldset('account_info', array(
53
- 'title' => $this->__('Log in to Admin Panel')
54
- ));
55
-
56
- $formFieldset->addField('username', 'text', array(
57
- 'label' => $this->__('User Name:'),
58
- 'name' => 'username',
59
- 'required' => 1
60
- ));
61
-
62
- $formFieldset->addField('password', 'password', array(
63
- 'label' => $this->__('Password:'),
64
- 'name' => 'password',
65
- 'required' => 1
66
- ));
67
-
68
- return $fromXmlObj->getXml();
69
- }
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile.php CHANGED
@@ -40,8 +40,12 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile extends Mage_Adminhtml_Block_Widget
40
  {
41
  $this->_controller = 'adminhtml_mobile';
42
  $this->_blockGroup = 'xmlconnect';
43
- $xmlconnectVersion = Mage::getConfig()->getNode(Mage_XmlConnect_Model_Application::XML_PATH_MODULE_VERSION);
44
- $this->_headerText = $this->__('Manage Apps') . ' ' . $this->__('ver. %s', $xmlconnectVersion);
 
 
 
 
45
  $this->_addButtonLabel = $this->__('Add App');
46
 
47
  parent::__construct();
40
  {
41
  $this->_controller = 'adminhtml_mobile';
42
  $this->_blockGroup = 'xmlconnect';
43
+ $xmlconnectVersion = Mage::getConfig()->getNode(
44
+ Mage_XmlConnect_Model_Application::XML_PATH_MODULE_VERSION
45
+ );
46
+ $this->_headerText = $this->__('Manage Apps')
47
+ . ' '
48
+ . $this->__('ver. %s', $xmlconnectVersion);
49
  $this->_addButtonLabel = $this->__('Add App');
50
 
51
  parent::__construct();
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
 
35
  {
36
  /**
37
  * Setting app action buttons for application
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit
35
+ extends Mage_Adminhtml_Block_Widget_Form_Container
36
  {
37
  /**
38
  * Setting app action buttons for application
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Submission.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Submission extends Mage_Adminhtml_Block_Widget_Tabs
 
35
  {
36
  /**
37
  * Constructor
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Submission
35
+ extends Mage_Adminhtml_Block_Widget_Tabs
36
  {
37
  /**
38
  * Constructor
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php CHANGED
@@ -35,11 +35,6 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
35
  extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
  implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
  {
38
- /**
39
- * List of static CMS pages
40
- *
41
- * @var array
42
- */
43
  protected $_pages;
44
 
45
  /**
@@ -50,58 +45,63 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
50
  {
51
  parent::__construct();
52
  $this->setShowGlobalIcon(true);
53
- $this->setTemplate('/xmlconnect/edit/tab/content.phtml');
54
- $this->_pages = Mage::getResourceModel('xmlconnect/cms_page_collection')->toOptionIdArray();
55
  }
56
 
57
  /**
58
  * Add page input to fieldset
59
  *
60
- * @deprecated will delete in the next version
61
  * @param Varien_Data_Form_Element_Fieldset $fieldset
62
  * @param string $fieldPrefix
63
- * @return null
64
  */
65
  protected function _addPage($fieldset, $fieldPrefix)
66
  {
67
- $element = $fieldset->addField($fieldPrefix, 'page', array('name' => $fieldPrefix));
68
- $element->initFields(array('name' => $fieldPrefix, 'values' => $this->_pages));
 
 
 
 
 
69
  }
70
 
71
  /**
72
  * Prepare form before rendering HTML
 
73
  *
74
  * @return Mage_Adminhtml_Block_Widget_Form
75
  */
76
  protected function _prepareForm()
77
  {
78
- $this->_prepareButtons();
79
- return parent::_prepareForm();
80
- }
 
81
 
82
- /**
83
- * Prepare add and delete buttons for content tab
84
- *
85
- * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
86
- */
87
- protected function _prepareButtons()
88
- {
89
- $addButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
90
- 'label' => $this->__('Add Page'),
91
- 'onclick' => 'cmsPageActionHelper.insertPage(); return false;',
92
- 'class' => 'add'
93
- ))->setName('add_page_item_button');
94
 
95
- $this->setChild('add_button', $addButton);
 
96
 
97
- $deleteButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
98
- 'label' => $this->__('Delete'),
99
- 'onclick' => "$(\'config_data[{{deleteId}}][tr]\').remove(); return false;",
100
- 'class' => 'delete'
101
- ))->setName('add_page_item_button');
 
 
102
 
103
- $this->setChild('delete_button', $deleteButton);
104
- return $this;
 
 
 
 
 
 
 
 
105
  }
106
 
107
  /**
@@ -143,24 +143,4 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
143
  {
144
  return false;
145
  }
146
-
147
- /**
148
- * Return cms page list
149
- *
150
- * @return array
151
- */
152
- public function getPages()
153
- {
154
- return $this->_pages;
155
- }
156
-
157
- /**
158
- * Return saved static page list
159
- *
160
- * @return array
161
- */
162
- public function getStaticPageList()
163
- {
164
- return Mage::getSingleton('xmlconnect/configuration')->getDeviceStaticPages();
165
- }
166
  }
35
  extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
  implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
  {
 
 
 
 
 
38
  protected $_pages;
39
 
40
  /**
45
  {
46
  parent::__construct();
47
  $this->setShowGlobalIcon(true);
 
 
48
  }
49
 
50
  /**
51
  * Add page input to fieldset
52
  *
 
53
  * @param Varien_Data_Form_Element_Fieldset $fieldset
54
  * @param string $fieldPrefix
 
55
  */
56
  protected function _addPage($fieldset, $fieldPrefix)
57
  {
58
+ $element = $fieldset->addField($fieldPrefix, 'page', array(
59
+ 'name' => $fieldPrefix,
60
+ ));
61
+ $element->initFields(array(
62
+ 'name' => $fieldPrefix,
63
+ 'values' => $this->_pages,
64
+ ));
65
  }
66
 
67
  /**
68
  * Prepare form before rendering HTML
69
+ * Setting Form Fieldsets and fields
70
  *
71
  * @return Mage_Adminhtml_Block_Widget_Form
72
  */
73
  protected function _prepareForm()
74
  {
75
+ $model = Mage::helper('xmlconnect')->getApplication();
76
+ $conf = $model->getConf();
77
+ $form = new Varien_Data_Form();
78
+ $this->setForm($form);
79
 
80
+ $pages = Mage::getResourceModel('xmlconnect/cms_page_collection')->toOptionIdArray();
81
+ $dummy = array(array( 'value' => '', 'label' => '' ));
82
+ $this->_pages = array_merge($dummy, $pages);
 
 
 
 
 
 
 
 
 
83
 
84
+ $fieldset = $form->addFieldset('cms_pages', array('legend' => $this->__('Pages')));
85
+ $this->_addElementTypes($fieldset);
86
 
87
+ $fieldset->addField('page_row_add', 'addrow', array(
88
+ 'onclick' => 'insertNewTableRow(this)',
89
+ 'options' => $this->_pages,
90
+ 'class' => ' scalable save ',
91
+ 'label' => $this->__('Label'),
92
+ 'before_element_html' => $this->__('Get Content from CMS Page').'</td><td class="label">',
93
+ ));
94
 
95
+ if (!empty($conf['native']['pages'])) {
96
+ foreach ($conf['native']['pages'] as $key=>$dummy) {
97
+ $this->_addPage($fieldset, 'conf[native][pages]['.$key.']');
98
+ }
99
+ }
100
+
101
+ $data = $model->getFormData();
102
+ $data['page_row_add'] = $this->__('Add Page');
103
+ $form->setValues($data);
104
+ return parent::_prepareForm();
105
  }
106
 
107
  /**
143
  {
144
  return false;
145
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion.php CHANGED
@@ -25,7 +25,7 @@
25
  */
26
 
27
  /**
28
- * Tab design accordion block renderer
29
  *
30
  * @category Mage
31
  * @package Mage_Xmlconnect
25
  */
26
 
27
  /**
28
+ * Tab design accordion xml renderer
29
  *
30
  * @category Mage
31
  * @package Mage_Xmlconnect
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Images.php CHANGED
@@ -27,7 +27,6 @@
27
  /**
28
  * Tab design Accordion Images xml renderer
29
  *
30
- * @deprecated will delete in the next version
31
  * @category Mage
32
  * @package Mage_Xmlconnect
33
  * @author Magento Core Team <core@magentocommerce.com>
@@ -38,7 +37,6 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
38
  /**
39
  * Getter for accordion item title
40
  *
41
- * @deprecated will delete in the next version
42
  * @return string
43
  */
44
  public function getTitle()
@@ -49,7 +47,6 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
49
  /**
50
  * Getter for accordion item is open flag
51
  *
52
- * @deprecated will delete in the next version
53
  * @return bool
54
  */
55
  public function getIsOpen()
@@ -60,7 +57,6 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
60
  /**
61
  * Prepare form
62
  *
63
- * @deprecated will delete in the next version
64
  * @throws Mage_Core_Exception
65
  * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
66
  */
@@ -73,7 +69,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
73
  $this->addImage($fieldset,
74
  'conf[native][navigationBar][icon]',
75
  $this->__('Logo in Header'),
76
- $this->__('Recommended size %spx x %spx.', 35, 35),
77
  $this->_getDesignPreviewImageUrl('conf/native/navigationBar/icon'),
78
  true
79
  );
@@ -84,18 +80,14 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
84
  $this->addImage($fieldset,
85
  'conf[native][body][bannerImage]',
86
  $this->__('Banner on Home Screen'),
87
- $this->__('Recommended size %spx x %spx.', 320, 230)
88
- . $this->__(' Note: Image size affects the performance of your app.')
89
- . $this->__('Keep your image size below %s KB for optimal performance.', 50),
90
  $this->_getDesignPreviewImageUrl('conf/native/body/bannerImage'),
91
  true
92
  );
93
  $this->addImage($fieldset,
94
  'conf[native][body][backgroundImage]',
95
  $this->__('App Background'),
96
- $this->__('Recommended size %spx x %spx.', 320, 367)
97
- . $this->__('Note: Image size affects the performance of your app.')
98
- . $this->__('Keep your image size below %s KB for optimal performance.', 75),
99
  $this->_getDesignPreviewImageUrl('conf/native/body/backgroundImage'),
100
  true
101
  );
@@ -104,32 +96,28 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
104
  $this->addImage($fieldset,
105
  'conf[native][body][bannerIpadLandscapeImage]',
106
  $this->__('Banner on Home Screen <br />(landscape mode)'),
107
- $this->__('Recommended size %spx x %spx.', 1024, 344)
108
- . $this->__('Note: Image size affects the performance of your app.'),
109
  $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadLandscapeImage'),
110
  true
111
  );
112
  $this->addImage($fieldset,
113
  'conf[native][body][bannerIpadImage]',
114
  $this->__('Banner on Home Screen <br />(portrait mode)'),
115
- $this->__('Recommended size %spx x %spx.', 768, 294)
116
- . $this->__('Note: Image size affects the performance of your app.'),
117
  $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadImage'),
118
  true
119
  );
120
  $this->addImage($fieldset,
121
  'conf[native][body][backgroundIpadLandscapeImage]',
122
  $this->__('App Background <br />(landscape mode)'),
123
- $this->__('Recommended size %spx x %spx.', 1024, 704)
124
- . $this->__('Note: Image size affects the performance of your app.'),
125
  $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadLandscapeImage'),
126
  true
127
  );
128
  $this->addImage($fieldset,
129
  'conf[native][body][backgroundIpadPortraitImage]',
130
  $this->__('App Background <br />(portrait mode)'),
131
- $this->__('Recommended size %spx x %spx.', 768, 960)
132
- . $this->__('Note: Image size affects the performance of your app.'),
133
  $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadPortraitImage'),
134
  true
135
  );
@@ -138,9 +126,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
138
  $this->addImage($fieldset,
139
  'conf[native][body][bannerAndroidImage]',
140
  $this->__('Banner on Home Screen'),
141
- $this->__('Recommended size %spx x %spx.', 320, 258)
142
- . $this->__('Note: Image size affects the performance of your app.')
143
- . $this->__('Keep your image size below %s KB for optimal performance.', 50),
144
  $this->_getDesignPreviewImageUrl('conf/native/body/bannerAndroidImage'),
145
  true
146
  );
@@ -160,7 +146,6 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
160
  /**
161
  * Retrieve url for images in the skin folder
162
  *
163
- * @deprecated will delete in the next version
164
  * @param string $name - path to file name relative to the skin dir
165
  * @return string
166
  */
27
  /**
28
  * Tab design Accordion Images xml renderer
29
  *
 
30
  * @category Mage
31
  * @package Mage_Xmlconnect
32
  * @author Magento Core Team <core@magentocommerce.com>
37
  /**
38
  * Getter for accordion item title
39
  *
 
40
  * @return string
41
  */
42
  public function getTitle()
47
  /**
48
  * Getter for accordion item is open flag
49
  *
 
50
  * @return bool
51
  */
52
  public function getIsOpen()
57
  /**
58
  * Prepare form
59
  *
 
60
  * @throws Mage_Core_Exception
61
  * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
62
  */
69
  $this->addImage($fieldset,
70
  'conf[native][navigationBar][icon]',
71
  $this->__('Logo in Header'),
72
+ $this->__('Recommended size 35px x 35px.'),
73
  $this->_getDesignPreviewImageUrl('conf/native/navigationBar/icon'),
74
  true
75
  );
80
  $this->addImage($fieldset,
81
  'conf[native][body][bannerImage]',
82
  $this->__('Banner on Home Screen'),
83
+ $this->__('Recommended size 320px x 230px. Note: Image size affects the performance of your app. Keep your image size below 50 KB for optimal performance.'),
 
 
84
  $this->_getDesignPreviewImageUrl('conf/native/body/bannerImage'),
85
  true
86
  );
87
  $this->addImage($fieldset,
88
  'conf[native][body][backgroundImage]',
89
  $this->__('App Background'),
90
+ $this->__('Recommended size 320px x 367px. Note: Image size affects the performance of your app. Keep your image size below 75 KB for optimal performance.'),
 
 
91
  $this->_getDesignPreviewImageUrl('conf/native/body/backgroundImage'),
92
  true
93
  );
96
  $this->addImage($fieldset,
97
  'conf[native][body][bannerIpadLandscapeImage]',
98
  $this->__('Banner on Home Screen <br />(landscape mode)'),
99
+ $this->__('Recommended size 1024px x 344px. Note: Image size affects the performance of your app.'),
 
100
  $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadLandscapeImage'),
101
  true
102
  );
103
  $this->addImage($fieldset,
104
  'conf[native][body][bannerIpadImage]',
105
  $this->__('Banner on Home Screen <br />(portrait mode)'),
106
+ $this->__('Recommended size 768px x 294px. Note: Image size affects the performance of your app.'),
 
107
  $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadImage'),
108
  true
109
  );
110
  $this->addImage($fieldset,
111
  'conf[native][body][backgroundIpadLandscapeImage]',
112
  $this->__('App Background <br />(landscape mode)'),
113
+ $this->__('Recommended size 1024px x 704px. Note: Image size affects the performance of your app.'),
 
114
  $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadLandscapeImage'),
115
  true
116
  );
117
  $this->addImage($fieldset,
118
  'conf[native][body][backgroundIpadPortraitImage]',
119
  $this->__('App Background <br />(portrait mode)'),
120
+ $this->__('Recommended size 768px x 960px. Note: Image size affects the performance of your app.'),
 
121
  $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadPortraitImage'),
122
  true
123
  );
126
  $this->addImage($fieldset,
127
  'conf[native][body][bannerAndroidImage]',
128
  $this->__('Banner on Home Screen'),
129
+ $this->__('Recommended size 320px x 258px. Note: Image size affects the performance of your app. Keep your image size below 50 KB for optimal performance.'),
 
 
130
  $this->_getDesignPreviewImageUrl('conf/native/body/bannerAndroidImage'),
131
  true
132
  );
146
  /**
147
  * Retrieve url for images in the skin folder
148
  *
 
149
  * @param string $name - path to file name relative to the skin dir
150
  * @return string
151
  */
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Images.php DELETED
@@ -1,192 +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
-
27
- /**
28
- * Tab design images block renderer
29
- *
30
- * @category Mage
31
- * @package Mage_Xmlconnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Images extends Mage_Adminhtml_Block_Template
35
- {
36
- /**
37
- * Init block, set preview template
38
- */
39
- public function __construct()
40
- {
41
- parent::__construct();
42
-
43
- $device = Mage::helper('xmlconnect')->getDeviceType();
44
- if (array_key_exists($device, Mage::helper('xmlconnect')->getSupportedDevices())) {
45
- $template = 'xmlconnect/edit/tab/design/images_' . strtolower($device) . '.phtml';
46
- } else {
47
- Mage::throwException($this->__('Device doesn\'t recognized. Unable to load a template.'));
48
- }
49
-
50
- $this->setTemplate($template);
51
- }
52
-
53
- /**
54
- * Get application id
55
- *
56
- * @return int
57
- */
58
- public function getApplicationId()
59
- {
60
- return Mage::helper('xmlconnect')->getApplicationId();
61
- }
62
-
63
- /**
64
- * Get image data array for uploader needs
65
- *
66
- * @param string $type
67
- * @param int $imageLimit
68
- * @return array
69
- */
70
- public function getImagesData($type, $imageLimit = 1)
71
- {
72
- if (!$this->{'get' . ucwords($type)}()) {
73
- /** @var $imagesModel Mage_XmlConnect_Model_Images */
74
- $imagesModel = Mage::getModel('xmlconnect/images');
75
- $this->setImageCount($imagesModel->getImageCount($type));
76
- $result = $imagesModel->getDeviceImagesByType($type, $imageLimit);
77
- $imageCount = count($result);
78
- $this->setIsShowUploder(true);
79
- if ($imageCount < $imageLimit) {
80
- $result[] = array('image_type' => $type, 'order' => ++$imageCount,
81
- 'application_id' => $this->getApplicationId(), 'show_uploader' => (int)$this->getIsShowUploder());
82
- $this->setIsShowUploder(false);
83
- }
84
- $this->{'set' . ucwords($type)}($result);
85
- }
86
- return $this->{'get' . ucwords($type)}();
87
- }
88
-
89
- /**
90
- * Get image list by type and limit
91
- *
92
- * @param string $imageType
93
- * @param int $count
94
- * @return array
95
- */
96
- public function getImageList($imageType, $count)
97
- {
98
- $imageList = $this->getImagesData($imageType, $count);
99
- $result = array();
100
- foreach ($imageList as $image) {
101
- $result[] = $this->_prepareImagesData($image);
102
- }
103
- return $result;
104
- }
105
-
106
- /**
107
- * Prepare image data for uploader
108
- *
109
- * @param array $image
110
- * @return array
111
- */
112
- protected function _prepareImagesData($image)
113
- {
114
- $this->clearConfig();
115
- $params = array('image_type' => $image['image_type'], '_secure' => true, 'order' => $image['order'],
116
- 'application_id' => $this->getApplicationId());
117
-
118
- if (isset($image['image_id'])) {
119
- $this->getConfig()->setFileSave(Mage::getModel('xmlconnect/images')->getImageUrl($image['image_file']))
120
- ->setImageId($image['image_id']);
121
-
122
- $this->getConfig()->setThumbnail(Mage::getModel('xmlconnect/images')->getCustomSizeImageUrl(
123
- $image['image_file'],
124
- Mage_XmlConnect_Helper_Data::THUMBNAIL_IMAGE_WIDTH,
125
- Mage_XmlConnect_Helper_Data::THUMBNAIL_IMAGE_HEIGHT
126
- ))->setImageId($image['image_id']);
127
-
128
- $imageActionData = Mage::helper('xmlconnect')->getApplication()->getImageActionModel()
129
- ->getImageActionData($image['image_id']);
130
- if ($imageActionData) {
131
- $this->getConfig()->setImageActionData($imageActionData);
132
- }
133
- }
134
-
135
- if (isset($image['show_uploader'])) {
136
- $this->getConfig()->setShowUploader($image['show_uploader']);
137
- }
138
-
139
- $this->getConfig()->setUrl(
140
- Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/uploadimages', $params)
141
- );
142
- $this->getConfig()->setParams(array('form_key' => $this->getFormKey()));
143
- $this->getConfig()->setFileField($image['image_type']);
144
- $this->getConfig()->setFilters(array(
145
- 'images' => array(
146
- 'label' => Mage::helper('adminhtml')->__('Images (.gif, .jpg, .png)'),
147
- 'files' => array('*.gif', '*.jpg','*.jpeg', '*.png')
148
- )));
149
- $this->getConfig()->setReplaceBrowseWithRemove(true);
150
- $this->getConfig()->setWidth('32');
151
- $this->getConfig()->setHideUploadButton(true);
152
- $this->getConfig()->setImageCount($this->getImageCount());
153
-
154
- return $this->getConfig()->getData();
155
- }
156
-
157
- /**
158
- * Retrieve config json
159
- *
160
- * @param array $image
161
- * @return string
162
- */
163
- public function getConfigJson($image)
164
- {
165
- return Mage::helper('core')->jsonEncode($this->_prepareImagesData($image));
166
- }
167
-
168
- /**
169
- * Retrieve image config object
170
- *
171
- * @return Varien_Object
172
- */
173
- public function getConfig()
174
- {
175
- if(is_null($this->_config)) {
176
- $this->_config = new Varien_Object();
177
- }
178
-
179
- return $this->_config;
180
- }
181
-
182
- /**
183
- * Clear Image config object
184
- *
185
- * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Images
186
- */
187
- public function clearConfig()
188
- {
189
- $this->_config = null;
190
- return $this;
191
- }
192
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Preview.php CHANGED
@@ -25,13 +25,14 @@
25
  */
26
 
27
  /**
28
- * Tab design preview renderer
29
  *
30
  * @category Mage
31
  * @package Mage_Xmlconnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Preview extends Mage_Adminhtml_Block_Template
 
35
  {
36
  /**
37
  * Set preview template
@@ -44,7 +45,9 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Preview extends Mag
44
  if (array_key_exists($device, Mage::helper('xmlconnect')->getSupportedDevices())) {
45
  $template = 'xmlconnect/edit/tab/design/preview_' . strtolower($device) . '.phtml';
46
  } else {
47
- Mage::throwException($this->__('Device doesn\'t recognized. Unable to load a template.'));
 
 
48
  }
49
 
50
  $this->setTemplate($template);
25
  */
26
 
27
  /**
28
+ * Tab design preview xml renderer
29
  *
30
  * @category Mage
31
  * @package Mage_Xmlconnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Preview
35
+ extends Mage_Adminhtml_Block_Template
36
  {
37
  /**
38
  * Set preview template
45
  if (array_key_exists($device, Mage::helper('xmlconnect')->getSupportedDevices())) {
46
  $template = 'xmlconnect/edit/tab/design/preview_' . strtolower($device) . '.phtml';
47
  } else {
48
+ Mage::throwException(
49
+ $this->__('Device doesn\'t recognized. Unable to load a template.')
50
+ );
51
  }
52
 
53
  $this->setTemplate($template);
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/General.php CHANGED
@@ -100,16 +100,16 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_General
100
  }
101
 
102
  $fieldset->addField('showdev', 'select', array(
103
- 'name' => 'showdev',
104
- 'label' => $this->__('Device Type'),
105
- 'title' => $this->__('Device Type'),
106
- 'values' => array($model->getType() => $model->getDevtype()),
107
- 'disabled' => true,
108
  ));
109
 
110
  $fieldset->addField('devtype', 'hidden', array(
111
- 'name' => 'devtype',
112
- 'value' => $model->getType(),
113
  ));
114
 
115
  $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
@@ -153,7 +153,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_General
153
  */
154
  public function canShowTab()
155
  {
156
- return (bool)!Mage::getSingleton('adminhtml/session')->getNewApplication();
157
  }
158
 
159
  /**
100
  }
101
 
102
  $fieldset->addField('showdev', 'select', array(
103
+ 'name' => 'showdev',
104
+ 'label' => $this->__('Device Type'),
105
+ 'title' => $this->__('Device Type'),
106
+ 'values' => array($model->getType() => $model->getDevtype()),
107
+ 'disabled' => true,
108
  ));
109
 
110
  $fieldset->addField('devtype', 'hidden', array(
111
+ 'name' => 'devtype',
112
+ 'value' => $model->getType(),
113
  ));
114
 
115
  $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
153
  */
154
  public function canShowTab()
155
  {
156
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
157
  }
158
 
159
  /**
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/OfflineCatalog.php DELETED
@@ -1,115 +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
-
27
- /**
28
- * Tab for offline catalog management
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_OfflineCatalog
35
- extends Mage_Adminhtml_Block_Template
36
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
- {
38
- /**
39
- * Set design tab template
40
- * Set to show global icon
41
- */
42
- public function __construct()
43
- {
44
- parent::__construct();
45
- $this->setShowGlobalIcon(true);
46
- $this->setTemplate('xmlconnect/edit/tab/offlinecatalog.phtml');
47
- }
48
-
49
- /**
50
- * Prepare layout
51
- *
52
- * @return Mage_Core_Block_Abstract
53
- */
54
- protected function _prepareLayout()
55
- {
56
- $this->_addGenerateButton();
57
- return parent::_prepareLayout();
58
- }
59
-
60
- /**
61
- * Add generate button
62
- *
63
- * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_OfflineCatalog
64
- */
65
- protected function _addGenerateButton()
66
- {
67
- $generateButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
68
- 'label' => $this->__('Generate Offline Catalog'),
69
- 'onclick' => 'generateOfflineCatalog(); return false;',
70
- 'class' => 'save'
71
- ))->setName('generate_offline_catalog_button');
72
- $this->setChild('offline_catalog', $generateButton);
73
- return $this;
74
- }
75
-
76
- /**
77
- * Tab label getter
78
- *
79
- * @return string
80
- */
81
- public function getTabLabel()
82
- {
83
- return $this->__('Offline Catalog');
84
- }
85
-
86
- /**
87
- * Tab title getter
88
- *
89
- * @return string
90
- */
91
- public function getTabTitle()
92
- {
93
- return $this->__('Offline Catalog');
94
- }
95
-
96
- /**
97
- * Check if tab can be shown
98
- *
99
- * @return bool
100
- */
101
- public function canShowTab()
102
- {
103
- return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
104
- }
105
-
106
- /**
107
- * Check if tab hidden
108
- *
109
- * @return bool
110
- */
111
- public function isHidden()
112
- {
113
- return false;
114
- }
115
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Payment.php CHANGED
@@ -80,6 +80,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Payment
80
 
81
  $deviceType = Mage::helper('xmlconnect')->getDeviceType();
82
  switch ($deviceType) {
 
83
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
84
  /**
85
  * PayPal MEP management
@@ -191,13 +192,13 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Payment
191
  )
192
  );
193
  break;
194
- case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
195
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
196
  /**
197
  * PayPal MECL management
198
  */
199
  if (Mage::app()->isSingleStoreMode() || Mage::helper('xmlconnect')->getApplication()->getId()) {
200
- $paypalMeclIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mecl')->isAvailable();
 
201
  $activateMeclMethodNote = $this->__('You need to enable PayPal Express Checkout first from the Payment configuration before enabling PayPal MECL.');
202
  } else {
203
  $paypalMeclIsAvailable = false;
@@ -223,6 +224,17 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Payment
223
  'value' => $paypalMeclActive,
224
  'disabled' => !$paypalMeclIsAvailable
225
  ));
 
 
 
 
 
 
 
 
 
 
 
226
  break;
227
  default:
228
  Mage::throwException(
80
 
81
  $deviceType = Mage::helper('xmlconnect')->getDeviceType();
82
  switch ($deviceType) {
83
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
84
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
85
  /**
86
  * PayPal MEP management
192
  )
193
  );
194
  break;
 
195
  case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
196
  /**
197
  * PayPal MECL management
198
  */
199
  if (Mage::app()->isSingleStoreMode() || Mage::helper('xmlconnect')->getApplication()->getId()) {
200
+ $paypalMeclIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mecl')
201
+ ->isAvailable();
202
  $activateMeclMethodNote = $this->__('You need to enable PayPal Express Checkout first from the Payment configuration before enabling PayPal MECL.');
203
  } else {
204
  $paypalMeclIsAvailable = false;
224
  'value' => $paypalMeclActive,
225
  'disabled' => !$paypalMeclIsAvailable
226
  ));
227
+
228
+ /**
229
+ * PayPal MEP management
230
+ */
231
+ $fieldsetPaypal = $form->addFieldset('paypal_mep_checkout', array(
232
+ 'legend' => $this->__('PayPal Mobile Embedded Payment (MEP)')
233
+ ));
234
+ $fieldsetPaypal->addField('paypal_note', 'note', array(
235
+ 'label' => $this->__('Notice'),
236
+ 'text' => $this->__('Currently, PayPal MEP is not available for the Android application')
237
+ ));
238
  break;
239
  default:
240
  Mage::throwException(
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Settings.php CHANGED
@@ -37,11 +37,15 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Settings
37
  {
38
  protected function _prepareLayout()
39
  {
40
- $this->setChild('continue_button', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
41
- 'label' => Mage::helper('catalog')->__('Continue'),
42
- 'onclick' => "if (editForm.submit()) { return false }",
43
- 'class' => 'save'
44
- )));
 
 
 
 
45
  return parent::_prepareLayout();
46
  }
47
 
@@ -59,11 +63,11 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Settings
59
  $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Device Information')));
60
 
61
  $fieldset->addField('type', 'select', array(
62
- 'name' => 'type',
63
- 'label' => $this->__('Device Type'),
64
- 'title' => $this->__('Device Type'),
65
- 'values' => Mage::helper('xmlconnect')->getDeviceTypeOptions(),
66
- 'required' => true
67
  ));
68
 
69
  $fieldset->addField('continue_button', 'note', array(
37
  {
38
  protected function _prepareLayout()
39
  {
40
+ $this->setChild('continue_button',
41
+ $this->getLayout()->createBlock('adminhtml/widget_button')
42
+ ->setData(array(
43
+ 'label' => Mage::helper('catalog')->__('Continue'),
44
+ 'onclick' => "if (editForm.submit()) { return false }",
45
+ 'class' => 'save'
46
+ )
47
+ )
48
+ );
49
  return parent::_prepareLayout();
50
  }
51
 
63
  $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Device Information')));
64
 
65
  $fieldset->addField('type', 'select', array(
66
+ 'name' => 'type',
67
+ 'label' => $this->__('Device Type'),
68
+ 'title' => $this->__('Device Type'),
69
+ 'values' => Mage::helper('xmlconnect')->getDeviceTypeOptions(),
70
+ 'required' => true
71
  ));
72
 
73
  $fieldset->addField('continue_button', 'note', array(
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Social.php CHANGED
@@ -60,7 +60,9 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Social
60
  /**
61
  * Twitter fieldset options
62
  */
63
- $fieldsetTwitter = $form->addFieldset('twitter', array('legend' => $this->__('Twitter API')));
 
 
64
 
65
  if (isset($data['conf[native][socialNetworking][twitter][isActive]'])) {
66
  $twitterStatus = (int)$data['conf[native][socialNetworking][twitter][isActive]'];
@@ -111,11 +113,16 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Social
111
  )
112
  );
113
 
114
- $fieldsetTwitter->addField('twitterNote', 'note', array(
115
- 'text' => sprintf(
116
- $noteText,
117
- Mage::getStoreConfig(Mage_XmlConnect_Model_Application::XML_PATH_HOWTO_TWITTER_URL)
118
- )));
 
 
 
 
 
119
 
120
  /**
121
  * Facebook fieldset options
@@ -156,15 +163,23 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Social
156
  )
157
  );
158
 
159
- $fieldsetFacebook->addField('facebookNote', 'note', array(
160
- 'text' => sprintf(
161
- $noteText, Mage::getStoreConfig(Mage_XmlConnect_Model_Application::XML_PATH_HOWTO_FACEBOOK_URL)
162
- )));
 
 
 
 
 
 
163
 
164
  /**
165
  * LinkedIn fieldset options
166
  */
167
- $fieldsetLinkedin = $form->addFieldset('linkedin', array('legend' => $this->__('LinkedIn API')));
 
 
168
 
169
  if (isset($data['conf[native][socialNetworking][linkedin][isActive]'])) {
170
  $linkedinStatus = (int)$data['conf[native][socialNetworking][linkedin][isActive]'];
60
  /**
61
  * Twitter fieldset options
62
  */
63
+ $fieldsetTwitter = $form->addFieldset('twitter', array(
64
+ 'legend' => $this->__('Twitter API')
65
+ ));
66
 
67
  if (isset($data['conf[native][socialNetworking][twitter][isActive]'])) {
68
  $twitterStatus = (int)$data['conf[native][socialNetworking][twitter][isActive]'];
113
  )
114
  );
115
 
116
+ $fieldsetTwitter->addField(
117
+ 'twitterNote',
118
+ 'note',
119
+ array(
120
+ 'text' => sprintf(
121
+ $noteText,
122
+ Mage::getStoreConfig(Mage_XmlConnect_Model_Application::XML_PATH_HOWTO_TWITTER_URL)
123
+ ),
124
+ )
125
+ );
126
 
127
  /**
128
  * Facebook fieldset options
163
  )
164
  );
165
 
166
+ $fieldsetFacebook->addField(
167
+ 'facebookNote',
168
+ 'note',
169
+ array(
170
+ 'text' => sprintf(
171
+ $noteText,
172
+ Mage::getStoreConfig(Mage_XmlConnect_Model_Application::XML_PATH_HOWTO_FACEBOOK_URL)
173
+ ),
174
+ )
175
+ );
176
 
177
  /**
178
  * LinkedIn fieldset options
179
  */
180
+ $fieldsetLinkedin = $form->addFieldset('linkedin', array(
181
+ 'legend' => $this->__('LinkedIn API'),
182
+ ));
183
 
184
  if (isset($data['conf[native][socialNetworking][linkedin][isActive]'])) {
185
  $linkedinStatus = (int)$data['conf[native][socialNetworking][linkedin][isActive]'];
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Submission/History.php CHANGED
@@ -79,7 +79,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Submission_History
79
  */
80
  public function canShowTab()
81
  {
82
- return (bool)$this->_getApplication()->getId();
83
  }
84
 
85
  /**
79
  */
80
  public function canShowTab()
81
  {
82
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
83
  }
84
 
85
  /**
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tabs.php CHANGED
@@ -31,9 +31,11 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
 
35
  {
36
  /**
 
37
  * Setting grid_id, DOM destination element id, Title
38
  */
39
  public function __construct()
@@ -54,7 +56,8 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tabs extends Mage_Adminhtml_Bl
54
  if (Mage::getSingleton('adminhtml/session')->getNewApplication()) {
55
  $this->addTab('set', array(
56
  'label' => $this->__('Settings'),
57
- 'content' => $this->getLayout()->createBlock('xmlconnect/adminhtml_mobile_edit_tab_settings')
 
58
  ->toHtml(),
59
  'active' => true
60
  ));
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tabs
35
+ extends Mage_Adminhtml_Block_Widget_Tabs
36
  {
37
  /**
38
+ * Constructor
39
  * Setting grid_id, DOM destination element id, Title
40
  */
41
  public function __construct()
56
  if (Mage::getSingleton('adminhtml/session')->getNewApplication()) {
57
  $this->addTab('set', array(
58
  'label' => $this->__('Settings'),
59
+ 'content' => $this->getLayout()
60
+ ->createBlock('xmlconnect/adminhtml_mobile_edit_tab_settings')
61
  ->toHtml(),
62
  'active' => true
63
  ));
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Addrow.php CHANGED
@@ -27,12 +27,12 @@
27
  /**
28
  * Xmlconnect Add row form element
29
  *
30
- * @deprecated will be removed
31
  * @category Mage
32
  * @package Mage_XmlConnect
33
  * @author Magento Core Team <core@magentocommerce.com>
34
  */
35
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow extends Varien_Data_Form_Element_Button
 
36
  {
37
  /**
38
  * Render Element Html
@@ -41,9 +41,17 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow extends Varien_
41
  */
42
  public function getElementHtml()
43
  {
44
- $html = $this->getBeforeElementHtml() . '<button id="'.$this->getHtmlId() . '" name="' . $this->getName()
45
- . '" value="'.$this->getEscapedValue() . '" ' . $this->serialize($this->getHtmlAttributes()) . ' ><span>'
46
- . $this->getEscapedValue() . '</span></button>' . $this->getAfterElementHtml();
 
 
 
 
 
 
 
 
47
  return $html;
48
  }
49
 
@@ -66,8 +74,10 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow extends Varien_
66
  public function getLabelHtml($idSuffix = '')
67
  {
68
  if ($this->getLabel() !== null) {
69
- $html = '<label for="' . $this->getHtmlId() . $idSuffix . '">' . $this->getLabel()
70
- . ($this->getRequired() ? ' <span class="required">*</span>' : '') . '</label>';
 
 
71
  } else {
72
  $html = '';
73
  }
@@ -83,7 +93,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow extends Varien_
83
  public function toHtml()
84
  {
85
  $blockClassName = Mage::getConfig()->getBlockClassName('adminhtml/template');
86
- $jsBlock = Mage::getModel($blockClassName);
87
  $jsBlock->setTemplate('xmlconnect/form/element/addrow.phtml');
88
  $jsBlock->setOptions($this->getOptions());
89
  return parent::toHtml() . $jsBlock->toHtml();
27
  /**
28
  * Xmlconnect Add row form element
29
  *
 
30
  * @category Mage
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow
35
+ extends Varien_Data_Form_Element_Button
36
  {
37
  /**
38
  * Render Element Html
41
  */
42
  public function getElementHtml()
43
  {
44
+ $html = $this->getBeforeElementHtml()
45
+ . '<button id="'.$this->getHtmlId()
46
+ . '" name="'
47
+ . $this->getName()
48
+ . '" value="'.$this->getEscapedValue()
49
+ . '" '
50
+ . $this->serialize($this->getHtmlAttributes())
51
+ . ' ><span>'
52
+ . $this->getEscapedValue()
53
+ . '</span></button>'
54
+ . $this->getAfterElementHtml();
55
  return $html;
56
  }
57
 
74
  public function getLabelHtml($idSuffix = '')
75
  {
76
  if ($this->getLabel() !== null) {
77
+ $html = '<label for="' . $this->getHtmlId() . $idSuffix . '">'
78
+ . $this->getLabel()
79
+ . ($this->getRequired() ? ' <span class="required">*</span>' : '')
80
+ . '</label>';
81
  } else {
82
  $html = '';
83
  }
93
  public function toHtml()
94
  {
95
  $blockClassName = Mage::getConfig()->getBlockClassName('adminhtml/template');
96
+ $jsBlock = new $blockClassName;
97
  $jsBlock->setTemplate('xmlconnect/form/element/addrow.phtml');
98
  $jsBlock->setOptions($this->getOptions());
99
  return parent::toHtml() . $jsBlock->toHtml();
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Color.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Color extends Varien_Data_Form_Element_Text
 
35
  {
36
  /**
37
  * Return html code for current block
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Color
35
+ extends Varien_Data_Form_Element_Text
36
  {
37
  /**
38
  * Return html code for current block
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Country.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Country extends Varien_Data_Form_Element_Checkboxes
 
35
  {
36
  /**
37
  * Flag of using the border in the table's TD
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Country
35
+ extends Varien_Data_Form_Element_Checkboxes
36
  {
37
  /**
38
  * Flag of using the border in the table's TD
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Datetime.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Datetime extends Varien_Data_Form_Element_Abstract
 
35
  {
36
  /**
37
  * Date
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Datetime
35
+ extends Varien_Data_Form_Element_Abstract
36
  {
37
  /**
38
  * Date
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Font.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Font extends Varien_Data_Form_Element_Abstract
 
35
  {
36
  /**
37
  * Init font element
@@ -96,7 +97,9 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Font extends Varien_Da
96
  foreach ($this->getElements() as $element) {
97
  $elementsArray[] .= $element->toHtml();
98
  }
99
- return $elementsArray[0] . $elementsArray[1] . '</td><td class="label" style="width: 2em !important">'
 
 
100
  . $elementsArray[2];
101
  }
102
  }
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Font
35
+ extends Varien_Data_Form_Element_Abstract
36
  {
37
  /**
38
  * Init font element
97
  foreach ($this->getElements() as $element) {
98
  $elementsArray[] .= $element->toHtml();
99
  }
100
+ return $elementsArray[0]
101
+ . $elementsArray[1]
102
+ . '</td><td class="label" style="width: 2em !important">'
103
  . $elementsArray[2];
104
  }
105
  }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Image.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Image extends Varien_Data_Form_Element_Image
 
35
  {
36
  /**
37
  * Function fetches image Url actual or default
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Image
35
+ extends Varien_Data_Form_Element_Image
36
  {
37
  /**
38
  * Function fetches image Url actual or default
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Page.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Page extends Varien_Data_Form_Element_Abstract
 
35
  {
36
  /**
37
  * Init page element
@@ -97,8 +98,10 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Page extends Varien_Da
97
  public function getElementHtml()
98
  {
99
  list($label, $element) = $this->getElements();
100
- return $element->toHtml() . '</td><td class="label" style="width: 5em">'
 
101
  . '<button class=" scalable save onclick_button" value="&minus;"><span>'
102
- . Mage::helper('xmlconnect')->__('Delete') . '</span></button>';
 
103
  }
104
  }
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Page
35
+ extends Varien_Data_Form_Element_Abstract
36
  {
37
  /**
38
  * Init page element
98
  public function getElementHtml()
99
  {
100
  list($label, $element) = $this->getElements();
101
+ return $element->toHtml()
102
+ . '</td><td class="label" style="width: 5em">'
103
  . '<button class=" scalable save onclick_button" value="&minus;"><span>'
104
+ . Mage::helper('xmlconnect')->__('Delete')
105
+ . '</span></button>';
106
  }
107
  }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Tabs.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Tabs extends Varien_Data_Form_Element_Text
 
35
  {
36
  /**
37
  * Generate application tabs html
@@ -45,12 +46,14 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Tabs extends Varien_Da
45
  }
46
 
47
  $blockClassName = Mage::getConfig()->getBlockClassName('adminhtml/template');
48
- $block = Mage::getModel($blockClassName);
49
  $device = Mage::helper('xmlconnect')->getDeviceType();
50
  if (array_key_exists($device, Mage::helper('xmlconnect')->getSupportedDevices())) {
51
  $template = 'xmlconnect/form/element/app_tabs_' . strtolower($device) . '.phtml';
52
  } else {
53
- Mage::throwException($this->__('Device doesn\'t recognized. Unable to load a template.'));
 
 
54
  }
55
 
56
  $block->setTemplate($template);
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Tabs
35
+ extends Varien_Data_Form_Element_Text
36
  {
37
  /**
38
  * Generate application tabs html
46
  }
47
 
48
  $blockClassName = Mage::getConfig()->getBlockClassName('adminhtml/template');
49
+ $block = new $blockClassName;
50
  $device = Mage::helper('xmlconnect')->getDeviceType();
51
  if (array_key_exists($device, Mage::helper('xmlconnect')->getSupportedDevices())) {
52
  $template = 'xmlconnect/form/element/app_tabs_' . strtolower($device) . '.phtml';
53
  } else {
54
+ Mage::throwException(
55
+ $this->__('Device doesn\'t recognized. Unable to load a template.')
56
+ );
57
  }
58
 
59
  $block->setTemplate($template);
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Theme.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Theme extends Varien_Data_Form_Element_Text
 
35
  {
36
  /**
37
  * Generate themes (colors) html
@@ -40,8 +41,9 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Theme extends Varien_D
40
  */
41
  public function getHtml()
42
  {
43
- $blockClassName = Mage::getConfig()->getBlockClassName('xmlconnect/adminhtml_mobile_edit_tab_design_themes');
44
- $block = Mage::getModel($blockClassName);
 
45
  $block->setThemes($this->getThemes());
46
  $block->setName($this->getName());
47
  $block->setValue($this->getValue());
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Theme
35
+ extends Varien_Data_Form_Element_Text
36
  {
37
  /**
38
  * Generate themes (colors) html
41
  */
42
  public function getHtml()
43
  {
44
+ $blockClassName = Mage::getConfig()
45
+ ->getBlockClassName('xmlconnect/adminhtml_mobile_edit_tab_design_themes');
46
+ $block = new $blockClassName;
47
  $block->setThemes($this->getThemes());
48
  $block->setName($this->getName());
49
  $block->setValue($this->getValue());
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Bool.php CHANGED
@@ -46,10 +46,14 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Grid_Renderer_Bool
46
  $status = (int) $row->getData($this->getColumn()->getIndex());
47
  $options = Mage::helper('xmlconnect')->getStatusOptions();
48
  if ($status == Mage_XmlConnect_Model_Application::APP_STATUS_SUCCESS) {
49
- $result = '<img src="' . Mage::helper('xmlconnect/image')->getSkinImagesUrl('gel_green.png') . '" >&nbsp;'
 
 
50
  . (isset($options[$status]) ? $options[$status] : '');
51
  } else if ($status == Mage_XmlConnect_Model_Application::APP_STATUS_INACTIVE) {
52
- $result = '<img src="' . Mage::helper('xmlconnect/image')->getSkinImagesUrl('gel_red.png') . '" >&nbsp;'
 
 
53
  . (isset($options[$status]) ? $options[$status] : '');
54
  }
55
  return $result;
46
  $status = (int) $row->getData($this->getColumn()->getIndex());
47
  $options = Mage::helper('xmlconnect')->getStatusOptions();
48
  if ($status == Mage_XmlConnect_Model_Application::APP_STATUS_SUCCESS) {
49
+ $result = '<img src="'
50
+ . Mage::helper('xmlconnect/image')->getSkinImagesUrl('gel_green.png')
51
+ . '" >&nbsp;'
52
  . (isset($options[$status]) ? $options[$status] : '');
53
  } else if ($status == Mage_XmlConnect_Model_Application::APP_STATUS_INACTIVE) {
54
+ $result = '<img src="'
55
+ . Mage::helper('xmlconnect/image')->getSkinImagesUrl('gel_red.png')
56
+ . '" >&nbsp;'
57
  . (isset($options[$status]) ? $options[$status] : '');
58
  }
59
  return $result;
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Form.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Form extends Mage_Adminhtml_Block_Widget_Form
 
35
  {
36
  /**
37
  * Prepare form before rendering HTML
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Form
35
+ extends Mage_Adminhtml_Block_Widget_Form
36
  {
37
  /**
38
  * Prepare form before rendering HTML
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/Mobile/Submission/Tabs.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
 
35
  {
36
  /**
37
  * Constructor
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tabs
35
+ extends Mage_Adminhtml_Block_Widget_Tabs
36
  {
37
  /**
38
  * Constructor
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Queue_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
 
35
  {
36
  /**
37
  * Constructor
@@ -65,7 +66,8 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit extends Mage_Adminhtml_Block_Wi
65
  {
66
  $template = Mage::registry('current_template');
67
  $message = Mage::registry('current_message');
68
- return $message && !$message->getId() && $template && $template->getId() ? $this->getUrl('*/*/template')
 
69
  : $this->getUrl('*/*/queue');
70
  }
71
 
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit
35
+ extends Mage_Adminhtml_Block_Widget_Form_Container
36
  {
37
  /**
38
  * Constructor
66
  {
67
  $template = Mage::registry('current_template');
68
  $message = Mage::registry('current_message');
69
+ return $message && !$message->getId() && $template && $template->getId()
70
+ ? $this->getUrl('*/*/template')
71
  : $this->getUrl('*/*/queue');
72
  }
73
 
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit/Form.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Queue_Edit_Form extends Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form
 
35
  {
36
  /**
37
  * Prepare form before rendering HTML
@@ -58,11 +59,15 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit_Form extends Mage_XmlConnect_Bl
58
  }
59
 
60
  $fieldset = $this->getForm()->addFieldset(
61
- "message_settings", array('legend' => $this->__('Message Settings')), '^'
 
 
62
  );
63
 
64
  if ($model->getId()) {
65
- $fieldset->addField('message_id', 'hidden', array('name' => 'message_id'));
 
 
66
  }
67
 
68
  // set exec_time for showing accordingly to locale datetime settings
@@ -150,14 +155,12 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit_Form extends Mage_XmlConnect_Bl
150
  if (!$model->getTemplateId()) {
151
  $model->setTemplateId($templateModel->getId());
152
  }
153
- if (!$model->getApplicationId()) {
154
- $model->setApplicationId($templateModel->getApplicationId());
155
- }
156
  $model->setMessageId($model->getId());
 
157
 
158
  $this->getForm()->setAction($this->getUrl('*/*/saveMessage'));
159
  $this->getForm()->setValues($model->getData());
160
 
161
  $this->setForm($this->getForm());
162
- }
163
  }
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit_Form
35
+ extends Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form
36
  {
37
  /**
38
  * Prepare form before rendering HTML
59
  }
60
 
61
  $fieldset = $this->getForm()->addFieldset(
62
+ "message_settings",
63
+ array('legend' => $this->__('Message Settings')),
64
+ '^'
65
  );
66
 
67
  if ($model->getId()) {
68
+ $fieldset->addField('message_id', 'hidden', array(
69
+ 'name' => 'message_id'
70
+ ));
71
  }
72
 
73
  // set exec_time for showing accordingly to locale datetime settings
155
  if (!$model->getTemplateId()) {
156
  $model->setTemplateId($templateModel->getId());
157
  }
 
 
 
158
  $model->setMessageId($model->getId());
159
+ $model->setData('app_code', $templateModel->getData('app_code'));
160
 
161
  $this->getForm()->setAction($this->getUrl('*/*/saveMessage'));
162
  $this->getForm()->setValues($model->getData());
163
 
164
  $this->setForm($this->getForm());
165
+ }
166
  }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php CHANGED
@@ -55,7 +55,8 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Wi
55
  $collection = Mage::getModel('xmlconnect/queue')->getCollection();
56
 
57
  $collection->addFieldToFilter(
58
- 'main_table.status', array('neq' => Mage_XmlConnect_Model_Queue::STATUS_DELETED)
 
59
  );
60
  $this->setCollection($collection);
61
  return parent::_prepareCollection();
@@ -158,13 +159,13 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Wi
158
  $this->getMassactionBlock()->addItem('delete', array(
159
  'label' => $this->__('Delete'),
160
  'url' => $this->getUrl('*/*/massDeleteQueue'),
161
- 'confirm' => $this->__('Are you sure you want to delete selected records?')
162
  ));
163
 
164
  $this->getMassactionBlock()->addItem('cancel', array(
165
  'label' => $this->__('Cancel'),
166
  'url' => $this->getUrl('*/*/massCancelQueue'),
167
- 'confirm' => $this->__('Are you sure you want to cancel selected records?')
168
  ));
169
  return $this;
170
  }
55
  $collection = Mage::getModel('xmlconnect/queue')->getCollection();
56
 
57
  $collection->addFieldToFilter(
58
+ 'main_table.status',
59
+ array('neq' => Mage_XmlConnect_Model_Queue::STATUS_DELETED)
60
  );
61
  $this->setCollection($collection);
62
  return parent::_prepareCollection();
159
  $this->getMassactionBlock()->addItem('delete', array(
160
  'label' => $this->__('Delete'),
161
  'url' => $this->getUrl('*/*/massDeleteQueue'),
162
+ 'confirm' => $this->__('Are you sure you what to delete selected records?')
163
  ));
164
 
165
  $this->getMassactionBlock()->addItem('cancel', array(
166
  'label' => $this->__('Cancel'),
167
  'url' => $this->getUrl('*/*/massCancelQueue'),
168
+ 'confirm' => $this->__('Are you sure you what to cancel selected records?')
169
  ));
170
  return $this;
171
  }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Action.php CHANGED
@@ -58,14 +58,14 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Action
58
  $actions[] = array(
59
  'caption' => $this->__('Cancel'),
60
  'url' => $this->getUrl('*/*/cancelQueue', array('id' => $row->getId())),
61
- 'confirm' => $this->__('Are you sure you want to cancel a message?')
62
  );
63
  }
64
 
65
  $actions[] = array(
66
  'caption' => $this->__('Delete'),
67
  'url' => $this->getUrl('*/*/deleteQueue', array('id' => $row->getId())),
68
- 'confirm' => $this->__('Are you sure you want to delete a message?')
69
  );
70
 
71
  $this->getColumn()->setActions($actions);
58
  $actions[] = array(
59
  'caption' => $this->__('Cancel'),
60
  'url' => $this->getUrl('*/*/cancelQueue', array('id' => $row->getId())),
61
+ 'confirm' => $this->__('Are you sure you whant to cancel a message?')
62
  );
63
  }
64
 
65
  $actions[] = array(
66
  'caption' => $this->__('Delete'),
67
  'url' => $this->getUrl('*/*/deleteQueue', array('id' => $row->getId())),
68
+ 'confirm' => $this->__('Are you sure you whant to delete a message?')
69
  );
70
 
71
  $this->getColumn()->setActions($actions);
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit.php CHANGED
@@ -43,8 +43,9 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Edit extends Mage_Adminhtml_Block
43
  $this->_blockGroup = 'xmlconnect';
44
  parent::__construct();
45
 
46
- $this->_updateButton('delete', 'onclick', 'deleteConfirm(\'' . $this->__('Warning: All related AirMail messages will be deleted!')
47
- . '\n' . $this->__('Are you sure you want to do this?') .'\', \'' . $this->getDeleteUrl() . '\')'
 
48
  );
49
  $this->_updateButton('save', 'label', $this->__('Save'));
50
  $this->_updateButton('save', 'onclick', 'if (editForm.submit()) {disableElements(\'save\')}');
@@ -58,9 +59,7 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Edit extends Mage_Adminhtml_Block
58
  */
59
  public function getDeleteUrl()
60
  {
61
- return $this->getUrl('*/*/deletetemplate', array(
62
- $this->_objectId => $this->getRequest()->getParam($this->_objectId)
63
- ));
64
  }
65
 
66
  /**
43
  $this->_blockGroup = 'xmlconnect';
44
  parent::__construct();
45
 
46
+ $this->_updateButton('delete', 'onclick', 'deleteConfirm(\''
47
+ . $this->__('Warning: All related AirMail messages will be deleted!') . PHP_EOL
48
+ . $this->__('Are you sure you want to do this?') .'\', \'' . $this->getDeleteUrl() . '\')'
49
  );
50
  $this->_updateButton('save', 'label', $this->__('Save'));
51
  $this->_updateButton('save', 'onclick', 'if (editForm.submit()) {disableElements(\'save\')}');
59
  */
60
  public function getDeleteUrl()
61
  {
62
+ return $this->getUrl('*/*/deletetemplate', array($this->_objectId => $this->getRequest()->getParam($this->_objectId)));
 
 
63
  }
64
 
65
  /**
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit/Form.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
 
35
  {
36
  /**
37
  * Enabled fields flag
@@ -85,8 +86,12 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form extends Mage_XmlConnect
85
  $this->_addElementTypes($fieldset);
86
 
87
  if ($model->getId()) {
88
- $fieldset->addField('id', 'hidden', array('name' => 'id'));
89
- $fieldset->addField('template_id', 'hidden', array('name' => 'template_id'));
 
 
 
 
90
  }
91
 
92
  $fieldset->addField('application_id', 'select', array(
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
  {
37
  /**
38
  * Enabled fields flag
86
  $this->_addElementTypes($fieldset);
87
 
88
  if ($model->getId()) {
89
+ $fieldset->addField('id', 'hidden', array(
90
+ 'name' => 'id',
91
+ ));
92
+ $fieldset->addField('template_id', 'hidden', array(
93
+ 'name' => 'template_id',
94
+ ));
95
  }
96
 
97
  $fieldset->addField('application_id', 'select', array(
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Name.php CHANGED
@@ -44,5 +44,5 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Grid_Renderer_Name
44
  {
45
  $str = $this->escapeHtml($row->getName());
46
  return $str;
47
- }
48
  }
44
  {
45
  $str = $this->escapeHtml($row->getName());
46
  return $str;
47
+ }
48
  }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview/Form.php CHANGED
@@ -31,7 +31,8 @@
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Adminhtml_Template_Preview_Form extends Mage_Adminhtml_Block_Widget_Form
 
35
  {
36
  /**
37
  * Preparing from for revision page
31
  * @package Mage_XmlConnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template_Preview_Form
35
+ extends Mage_Adminhtml_Block_Widget_Form
36
  {
37
  /**
38
  * Preparing from for revision page
app/code/core/Mage/XmlConnect/Block/Cart.php CHANGED
@@ -49,8 +49,6 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
49
  if (strlen($quote->getCouponCode())) {
50
  $xmlObject->addAttribute('has_coupon_code', 1);
51
  }
52
-
53
- $productSmallImageSize = Mage::getModel('xmlconnect/images')->getImageLimitParam('content/product_small');
54
  $products = $xmlObject->addChild('products');
55
  /* @var $item Mage_Sales_Model_Quote_Item */
56
  foreach ($this->getItems() as $item) {
@@ -66,9 +64,12 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
66
  $itemXml->addChild('name', $xmlObject->escapeXml($renderer->getProductName()));
67
  $itemXml->addChild('code', 'cart[' . $item->getId() . '][qty]');
68
  $itemXml->addChild('qty', $renderer->getQty());
69
- $icon = $renderer->getProductThumbnail()->resize($productSmallImageSize);
 
 
70
  $iconXml = $itemXml->addChild('icon', $icon);
71
- $iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
 
72
  /**
73
  * Price
74
  */
@@ -78,19 +79,19 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
78
  && $item->getWeeeTaxAppliedAmount()
79
  ) {
80
  $exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
81
- + $item->getWeeeTaxDisposition();
82
  } else {
83
  $exclPrice = $item->getCalculationPrice();
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 +151,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
 
@@ -189,27 +190,14 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
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
-
203
- /**
204
- * Downloadable products
205
- */
206
- $links = $renderer->getLinks();
207
- if ($links) {
208
- $itemOptionsXml = $itemXml->addCustomChild('options', null, array(
209
- 'label' => $renderer->getLinksTitle()
210
- ));
211
- foreach ($links as $link) {
212
- $itemOptionsXml->addCustomChild('option', null, array('label' => $link->getTitle()));
213
  }
214
  }
215
 
49
  if (strlen($quote->getCouponCode())) {
50
  $xmlObject->addAttribute('has_coupon_code', 1);
51
  }
 
 
52
  $products = $xmlObject->addChild('products');
53
  /* @var $item Mage_Sales_Model_Quote_Item */
54
  foreach ($this->getItems() as $item) {
64
  $itemXml->addChild('name', $xmlObject->escapeXml($renderer->getProductName()));
65
  $itemXml->addChild('code', 'cart[' . $item->getId() . '][qty]');
66
  $itemXml->addChild('qty', $renderer->getQty());
67
+ $icon = $renderer->getProductThumbnail()->resize(
68
+ Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small')
69
+ );
70
  $iconXml = $itemXml->addChild('icon', $icon);
71
+ $file = Mage::helper('xmlconnect')->urlToPath($icon);
72
+ $iconXml->addAttribute('modification_time', filemtime($file));
73
  /**
74
  * Price
75
  */
79
  && $item->getWeeeTaxAppliedAmount()
80
  ) {
81
  $exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
82
+ + $item->getWeeeTaxDisposition();
83
  } else {
84
  $exclPrice = $item->getCalculationPrice();
85
  }
86
  }
87
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
88
+ $_incl = $this->helper('checkout')->getPriceInclTax($item);
89
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
90
  && $item->getWeeeTaxAppliedAmount()
91
  ) {
92
+ $inclPrice = $_incl + $item->getWeeeTaxAppliedAmount();
93
  } else {
94
+ $inclPrice = $_incl - $item->getWeeeTaxDisposition();
95
  }
96
  }
97
  $exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
151
  }
152
  }
153
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
154
+ $_incl = $this->helper('checkout')->getSubtotalInclTax($item);
155
  if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
156
  && $item->getWeeeTaxAppliedAmount()
157
  ) {
158
+ $inclPrice = $_incl + $item->getWeeeTaxAppliedRowAmount();
159
  } else {
160
+ $inclPrice = $_incl - $item->getWeeeTaxRowDisposition();
161
  }
162
  }
163
 
190
  /**
191
  * Options list
192
  */
193
+ $_options = $renderer->getOptionList();
194
+ if ($_options) {
195
  $itemOptionsXml = $itemXml->addChild('options');
196
+ foreach ($_options as $_option) {
197
+ $_formattedOptionValue = $renderer->getFormatedOptionValue($_option);
198
  $optionXml = $itemOptionsXml->addChild('option');
199
+ $optionXml->addAttribute('label', $xmlObject->xmlAttribute($_option['label']));
200
+ $optionXml->addAttribute('text', $xmlObject->xmlAttribute($_formattedOptionValue['value']));
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  }
202
  }
203
 
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals.php DELETED
@@ -1,95 +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
-
27
- /**
28
- * Shopping cart totals xml renderer
29
- *
30
- * @category Mage
31
- * @package Mage_Xmlconnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Cart_CartTotals extends Mage_Checkout_Block_Cart_Totals
35
- {
36
- /**
37
- * Default totals renderer
38
- *
39
- * @var string
40
- */
41
- protected $_defaultRenderer = 'xmlconnect/cart_cartTotals_default';
42
-
43
- /**
44
- * Render cart totals xml
45
- *
46
- * @return Mage_XmlConnect_Model_Simplexml_Element
47
- */
48
- protected function _toHtml()
49
- {
50
- /** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
51
- $cartXmlObject = $this->getCartXmlObject();
52
- /** @var $totalsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
53
- $totalsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<totals></totals>');
54
-
55
- foreach($this->getTotals() as $total) {
56
- $code = $total->getCode();
57
- if ($total->getAs()) {
58
- $code = $total->getAs();
59
- }
60
- $isNode = Mage::getConfig()->getNode("global/xmlconnect/sales/quote/totals/{$code}/is_node");
61
- if ($isNode) {
62
- $this->_getTotalRenderer($code)->setTotal($total)->setCartObject($cartXmlObject)->toHtml();
63
- } else {
64
- $this->_getTotalRenderer($code)->setTotal($total)->setCartObject($totalsXmlObj)->toHtml();
65
- }
66
- }
67
- $cartXmlObject->appendChild($totalsXmlObj);
68
- return $this;
69
- }
70
-
71
- /**
72
- * Get renderer block
73
- *
74
- * @param string $code
75
- * @return Mage_Core_Block_Abstract
76
- */
77
- protected function _getTotalRenderer($code)
78
- {
79
- $blockName = $code . '_total_renderer';
80
- $block = $this->getLayout()->getBlock($blockName);
81
- if (!$block) {
82
- $block = $this->_defaultRenderer;
83
- $config = Mage::getConfig()->getNode("global/xmlconnect/sales/quote/totals/{$code}/renderer");
84
- if ($config) {
85
- $block = (string) $config;
86
- }
87
- $block = $this->getLayout()->createBlock($block, $blockName);
88
- }
89
- /**
90
- * Transfer totals to renderer
91
- */
92
- $block->setTotals($this->getTotals());
93
- return $block;
94
- }
95
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Default.php DELETED
@@ -1,93 +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
-
27
- /**
28
- * Cart totals default renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_Xmlconnect_Block_Cart_CartTotals_Default extends Mage_Checkout_Block_Total_Default
35
- {
36
- /**
37
- * Total id prefix
38
- *
39
- * @var string
40
- */
41
- protected $_totalIdPrefix = 'total_';
42
-
43
- /**
44
- * Add cart total to xml
45
- *
46
- * @return Mage_XmlConnect_Model_Simplexml_Element
47
- */
48
- protected function _toHtml()
49
- {
50
- if (!$this->getTotal()->getValue()) {
51
- return;
52
- }
53
- /** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
54
- $cartXmlObject = $this->getCartObject();
55
- $currentTotal = $this->getTotal();
56
-
57
- /** @var $xmlObj Mage_XmlConnect_Model_Simplexml_Element */
58
- $xmlObj = $cartXmlObject->addCustomChild('total', null, array(
59
- 'id' => $this->getTotalIdPrefix() . $currentTotal->getCode()
60
- ));
61
- $value = Mage::helper('xmlconnect')->formatPriceForXml($currentTotal->getValue());
62
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value, false);
63
-
64
- $xmlObj->addCustomChild('item', $value, array(
65
- 'id' => $currentTotal->getCode(),
66
- 'label' => $currentTotal->getTitle(),
67
- 'formatted_value' => $formattedValue
68
- ));
69
- return $xmlObj;
70
- }
71
-
72
- /**
73
- * Set total id prefix
74
- *
75
- * @param string $totalIdPrefix
76
- * @return Mage_Xmlconnect_Block_Cart_CartTotals_Default
77
- */
78
- public function setTotalIdPrefix($totalIdPrefix)
79
- {
80
- $this->_totalIdPrefix = $totalIdPrefix;
81
- return $this;
82
- }
83
-
84
- /**
85
- * Get total id prefix
86
- *
87
- * @return string
88
- */
89
- public function getTotalIdPrefix()
90
- {
91
- return $this->_totalIdPrefix;
92
- }
93
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Grandtotal.php DELETED
@@ -1,107 +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
-
27
- /**
28
- * Cart totals grand total renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_Xmlconnect_Block_Cart_CartTotals_Grandtotal extends Mage_Tax_Block_Checkout_Grandtotal
35
- {
36
- /**
37
- * Total id prefix
38
- *
39
- * @var string
40
- */
41
- protected $_totalIdPrefix = 'total_';
42
-
43
- /**
44
- * Add cart grand total to xml
45
- *
46
- * @return Mage_XmlConnect_Model_Simplexml_Element
47
- */
48
- protected function _toHtml()
49
- {
50
- $grandTotalValue = $this->getTotal()->getValue() ? $this->getTotal()->getValue(): 0;
51
-
52
- /** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
53
- $cartXmlObject = $this->getCartObject();
54
- $grandTotal = $this->getTotal();
55
- $code = $grandTotal->getCode();
56
-
57
- /** @var $helper Mage_XmlConnect_Helper_Data */
58
- $helper = Mage::helper('xmlconnect');
59
-
60
- /** @var $xmlObj Mage_XmlConnect_Model_Simplexml_Element */
61
- $xmlObj = $cartXmlObject->addCustomChild('total', null, array(
62
- 'id' => $this->getTotalIdPrefix() . $code
63
- ));
64
-
65
- if ($this->includeTax() && $this->getTotalExclTax() >= 0) {
66
- $label = $this->__('Grand Total (Excl. Tax)');
67
- $excludingTaxCode = $code . '_excl_tax';
68
- $value = $this->getTotalExclTax();
69
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
70
- $helper->addTotalItemToXmlObj($xmlObj, $excludingTaxCode, $label, $value, $formattedValue);
71
-
72
- $label = $this->__('Grand Total (Incl. Tax)');
73
- $includingTaxCode = $code . '_incl_tax';
74
- $value = $grandTotalValue;
75
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
76
- $helper->addTotalItemToXmlObj($xmlObj, $includingTaxCode, $label, $value, $formattedValue);
77
- } else {
78
- $label = $this->__('Grand Total');
79
- $value = $grandTotalValue;
80
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
81
- $helper->addTotalItemToXmlObj($xmlObj, $code, $label, $value, $formattedValue);
82
- }
83
- return $xmlObj;
84
- }
85
-
86
- /**
87
- * Set total id prefix
88
- *
89
- * @param string $totalIdPrefix
90
- * @return Mage_Xmlconnect_Block_Cart_CartTotals_Grandtotal
91
- */
92
- public function setTotalIdPrefix($totalIdPrefix)
93
- {
94
- $this->_totalIdPrefix = $totalIdPrefix;
95
- return $this;
96
- }
97
-
98
- /**
99
- * Get total id prefix
100
- *
101
- * @return string
102
- */
103
- public function getTotalIdPrefix()
104
- {
105
- return $this->_totalIdPrefix;
106
- }
107
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Default.php DELETED
@@ -1,63 +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
-
27
- /**
28
- * Cart totals default node renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_Xmlconnect_Block_Cart_CartTotals_Nodes_Default extends Mage_Checkout_Block_Total_Default
35
- {
36
- /**
37
- * Add cart total node to xml
38
- *
39
- * @return Mage_XmlConnect_Model_Simplexml_Element
40
- */
41
- protected function _toHtml()
42
- {
43
- if (!$this->getTotal()->getValue()) {
44
- return;
45
- }
46
- /** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
47
- $cartXmlObject = $this->getCartObject();
48
- $total = $this->getTotal();
49
-
50
- /** @var $nodeXmlObj Mage_XmlConnect_Model_Simplexml_Element */
51
- $nodeXmlObj = $cartXmlObject->addCustomChild($total->getCode());
52
- $value = Mage::helper('xmlconnect')->formatPriceForXml($total->getValue());
53
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value, false);
54
-
55
- $nodeXmlObj->addCustomChild('item', $value, array(
56
- 'id' => $total->getCode(),
57
- 'label' => $total->getTitle(),
58
- 'formatted_value' => $formattedValue
59
- ));
60
-
61
- return $nodeXmlObj;
62
- }
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Giftcardaccount.php DELETED
@@ -1,69 +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
-
27
- /**
28
- * Cart totals gift card renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_Xmlconnect_Block_Cart_CartTotals_Nodes_Giftcardaccount extends Mage_Checkout_Block_Total_Default
35
- {
36
- /**
37
- * Add gift card balance to xml
38
- *
39
- * @return Mage_XmlConnect_Model_Simplexml_Element
40
- */
41
- protected function _toHtml()
42
- {
43
- if (!$this->getTotal()->getValue()) {
44
- return;
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(
61
- 'id' => $code . '_' . $cardCode['i'],
62
- 'label' => $this->__('Gift Card (%s)', $cardCode['c']),
63
- 'formatted_value' => '-' . $formattedValue,
64
- 'code' => $cardCode['c']
65
- ));
66
- }
67
- return $giftCardsXmlObj;
68
- }
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Shipping.php DELETED
@@ -1,113 +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
-
27
- /**
28
- * Cart totals shipping renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_Xmlconnect_Block_Cart_CartTotals_Shipping extends Mage_Tax_Block_Checkout_Shipping
35
- {
36
- /**
37
- * Total id prefix
38
- *
39
- * @var string
40
- */
41
- protected $_totalIdPrefix = 'total_';
42
-
43
- /**
44
- * Add cart grand total to xml
45
- *
46
- * @return Mage_XmlConnect_Model_Simplexml_Element
47
- */
48
- protected function _toHtml()
49
- {
50
- if (!$this->getTotal()->getValue()) {
51
- return;
52
- }
53
- /** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
54
- $cartXmlObject = $this->getCartObject();
55
- $shippingTotal = $this->getTotal();
56
- $code = $shippingTotal->getCode();
57
-
58
- /** @var $helper Mage_XmlConnect_Helper_Data */
59
- $helper = Mage::helper('xmlconnect');
60
-
61
- /** @var $xmlObj Mage_XmlConnect_Model_Simplexml_Element */
62
- $xmlObj = $cartXmlObject->addCustomChild('total', null, array(
63
- 'id' => $this->getTotalIdPrefix() . $code
64
- ));
65
-
66
- if ($this->displayBoth()) {
67
- $label = $this->getExcludeTaxLabel();
68
- $excludingTaxCode = $code . '_excl_tax';
69
- $value = $this->getShippingIncludeTax();
70
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
71
- $helper->addTotalItemToXmlObj($xmlObj, $excludingTaxCode, $label, $value, $formattedValue);
72
-
73
- $label = $this->getIncludeTaxLabel();
74
- $includingTaxCode = $code . '_incl_tax';
75
- $value = $this->getShippingIncludeTax();
76
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
77
- $helper->addTotalItemToXmlObj($xmlObj, $includingTaxCode, $label, $value, $formattedValue);
78
- } else {
79
- if ($this->displayIncludeTax()) {
80
- $label = $this->getIncludeTaxLabel();
81
- $value = $this->getShippingIncludeTax();
82
- } else {
83
- $label = $this->getExcludeTaxLabel();
84
- $value = $this->getShippingIncludeTax();
85
- }
86
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
87
- $helper->addTotalItemToXmlObj($xmlObj, $code, $label, $value, $formattedValue);
88
- }
89
- return $xmlObj;
90
- }
91
-
92
- /**
93
- * Set total id prefix
94
- *
95
- * @param string $totalIdPrefix
96
- * @return Mage_Xmlconnect_Block_Cart_CartTotals_Shipping
97
- */
98
- public function setTotalIdPrefix($totalIdPrefix)
99
- {
100
- $this->_totalIdPrefix = $totalIdPrefix;
101
- return $this;
102
- }
103
-
104
- /**
105
- * Get total id prefix
106
- *
107
- * @return string
108
- */
109
- public function getTotalIdPrefix()
110
- {
111
- return $this->_totalIdPrefix;
112
- }
113
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Subtotal.php DELETED
@@ -1,108 +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
-
27
- /**
28
- * Cart totals subtotal renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_Xmlconnect_Block_Cart_CartTotals_Subtotal extends Mage_Tax_Block_Checkout_Subtotal
35
- {
36
- /**
37
- * Total id prefix
38
- *
39
- * @var string
40
- */
41
- protected $_totalIdPrefix = 'total_';
42
-
43
- /**
44
- * Add cart subtotal to xml
45
- *
46
- * @return Mage_XmlConnect_Model_Simplexml_Element
47
- */
48
- protected function _toHtml()
49
- {
50
- if (!$this->getTotal()->getValue()) {
51
- return;
52
- }
53
- /** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
54
- $cartXmlObject = $this->getCartObject();
55
- $subtotal = $this->getTotal();
56
- $code = $subtotal->getCode();
57
-
58
- /** @var $helper Mage_XmlConnect_Helper_Data */
59
- $helper = Mage::helper('xmlconnect');
60
-
61
- /** @var $xmlObj Mage_XmlConnect_Model_Simplexml_Element */
62
- $xmlObj = $cartXmlObject->addCustomChild('total', null, array(
63
- 'id' => $this->getTotalIdPrefix() . $code
64
- ));
65
-
66
- if ($this->displayBoth()) {
67
- $label = $this->__('Subtotal (Excl. Tax)');
68
- $excludingTaxCode = $code . '_excl_tax';
69
- $value = $subtotal->getValueExclTax();
70
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
71
- $helper->addTotalItemToXmlObj($xmlObj, $excludingTaxCode, $label, $value, $formattedValue);
72
-
73
- $label = $this->__('Subtotal (Incl. Tax)');
74
- $includingTaxCode = $code . '_incl_tax';
75
- $value = $subtotal->getValueInclTax();
76
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
77
- $helper->addTotalItemToXmlObj($xmlObj, $includingTaxCode, $label, $value, $formattedValue);
78
- } else {
79
- $label = $this->__('Subtotal');
80
- $value = $subtotal->getValue();
81
- $formattedValue = $this->getQuote()->getStore()->formatPrice($value);
82
- $helper->addTotalItemToXmlObj($xmlObj, $code, $label, $value, $formattedValue);
83
- }
84
- return $xmlObj;
85
- }
86
-
87
- /**
88
- * Set total id prefix
89
- *
90
- * @param string $totalIdPrefix
91
- * @return Mage_Xmlconnect_Block_Cart_CartTotals_Subtotal
92
- */
93
- public function setTotalIdPrefix($totalIdPrefix)
94
- {
95
- $this->_totalIdPrefix = $totalIdPrefix;
96
- return $this;
97
- }
98
-
99
- /**
100
- * Get total id prefix
101
- *
102
- * @return string
103
- */
104
- public function getTotalIdPrefix()
105
- {
106
- return $this->_totalIdPrefix;
107
- }
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Cart/Crosssell.php CHANGED
@@ -45,23 +45,23 @@ class Mage_XmlConnect_Block_Cart_Crosssell extends Mage_Checkout_Block_Cart_Cros
45
  $this->getLayout()->createBlock($blockRenderer, $blockName);
46
  $this->setItems($this->getLayout()->getBlock($blockName)->getItemCollection());
47
  }
48
- /** @var $crossSellXmlObj Mage_XmlConnect_Model_Simplexml_Element */
49
  $crossSellXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<crosssell></crosssell>');
50
  if (!$this->getItemCount()) {
51
  return $crossSellXmlObj->asNiceXml();
52
  }
53
 
54
- $productSmallImageSize = Mage::getModel('xmlconnect/images')->getImageLimitParam('content/product_small');
55
- /** @var $productImageHelper Mage_XmlConnect_Helper_Catalog_Product_Image */
56
- $productImageHelper = $this->helper('xmlconnect/catalog_product_image');
57
  /** @var $product Mage_Catalog_Model_Product */
58
  foreach ($this->getItems() as $product) {
59
  $itemXmlObj = $crossSellXmlObj->addChild('item');
60
  $itemXmlObj->addChild('name', $crossSellXmlObj->escapeXml($product->getName()));
61
- $icon = $productImageHelper->init($product, 'thumbnail')->resize($productSmallImageSize);
 
62
 
63
  $iconXml = $itemXmlObj->addChild('icon', $icon);
64
- $iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
 
 
65
 
66
  $itemXmlObj->addChild('entity_id', $product->getId());
67
  $itemXmlObj->addChild('entity_type', $product->getTypeId());
45
  $this->getLayout()->createBlock($blockRenderer, $blockName);
46
  $this->setItems($this->getLayout()->getBlock($blockName)->getItemCollection());
47
  }
48
+
49
  $crossSellXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<crosssell></crosssell>');
50
  if (!$this->getItemCount()) {
51
  return $crossSellXmlObj->asNiceXml();
52
  }
53
 
 
 
 
54
  /** @var $product Mage_Catalog_Model_Product */
55
  foreach ($this->getItems() as $product) {
56
  $itemXmlObj = $crossSellXmlObj->addChild('item');
57
  $itemXmlObj->addChild('name', $crossSellXmlObj->escapeXml($product->getName()));
58
+ $icon = $this->helper('catalog/image')->init($product, 'thumbnail')
59
+ ->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small'));
60
 
61
  $iconXml = $itemXmlObj->addChild('icon', $icon);
62
+
63
+ $file = Mage::helper('xmlconnect')->urlToPath($icon);
64
+ $iconXml->addAttribute('modification_time', filemtime($file));
65
 
66
  $itemXmlObj->addChild('entity_id', $product->getId());
67
  $itemXmlObj->addChild('entity_type', $product->getTypeId());
app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer.php CHANGED
@@ -40,238 +40,36 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
40
  */
41
  public function addProductToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
42
  {
43
- $item = $this->getItem();
44
  $productXmlObj = $reviewXmlObj->addCustomChild('item');
45
  $productXmlObj->addCustomChild('name', $this->escapeHtml($this->getProductName()));
46
 
47
- if ($options = $this->getOptionList()) {
48
  $optionsXmlObj = $productXmlObj->addChild('options');
49
- foreach ($options as $option) {
50
- $formattedOptionValue = $this->getFormatedOptionValue($option);
51
 
52
- if (isset($formattedOptionValue['full_view'])) {
53
- $value = $formattedOptionValue['full_view'];
54
  } else {
55
  $value = null;
56
  }
57
 
58
  $optionsXmlObj->addCustomChild('option', $value, array(
59
- 'label' => $this->escapeHtml($option['label']),
60
- 'value' => $formattedOptionValue['value']
61
  ));
62
  }
63
  }
64
 
65
- if (Mage::helper('xmlconnect')->checkApiVersion(Mage_XmlConnect_Helper_Data::DEVICE_API_V_23)) {
66
- $priceListXmlObj = $productXmlObj->addCustomChild('price_list');
67
- $this->_addPriceToXmlObj23($priceListXmlObj);
68
- $this->_addSubtotalToXmlObj23($priceListXmlObj);
69
- } else {
70
- $this->_addPriceToXmlObj($productXmlObj);
71
- $this->_addSubtotalToXmlObj($productXmlObj);
72
- }
73
 
74
- $productXmlObj->addCustomChild('qty', $item->getQty());
75
- $icon = $this->helper('xmlconnect/catalog_product_image')->init($this->getProduct(), 'thumbnail')
76
- ->resize(Mage::getModel('xmlconnect/images')->getImageLimitParam('content/product_small'));
77
- $iconXml = $productXmlObj->addChild('icon', $icon);
78
- $iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
79
 
80
  return $reviewXmlObj;
81
  }
82
 
83
- /**
84
- * Add product price info to xml object. API version 23
85
- *
86
- * @param Mage_XmlConnect_Model_Simplexml_Element $priceListXmlObj
87
- * @return Mage_XmlConnect_Model_Simplexml_Element
88
- */
89
- protected function _addPriceToXmlObj23(Mage_XmlConnect_Model_Simplexml_Element $priceListXmlObj)
90
- {
91
- $item = $this->getItem();
92
- $priceType = 'price';
93
- $priceXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => $priceType));
94
-
95
- if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
96
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
97
- && $item->getWeeeTaxAppliedAmount()
98
- ) {
99
- $exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
100
- + $item->getWeeeTaxDisposition();
101
- } else {
102
- $exclPrice = $item->getCalculationPrice();
103
- }
104
- $exclPrice = $this->_formatPrice($exclPrice);
105
- $priceXmlObj->addCustomChild('price', $exclPrice, array(
106
- 'id' => $priceType . '_excluding_tax',
107
- 'label' => $this->__('Excl. Tax'),
108
- 'formatted_value' => $priceXmlObj->escapeXml($exclPrice)
109
- ));
110
- }
111
-
112
- if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
113
- $incl = $this->helper('checkout')->getPriceInclTax($item);
114
-
115
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
116
- && $item->getWeeeTaxAppliedAmount()
117
- ) {
118
- $inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
119
- } else {
120
- $inclPrice = $incl - $item->getWeeeTaxDisposition();
121
- }
122
- $inclPrice = $this->_formatPrice($inclPrice);
123
-
124
- $priceXmlObj->addCustomChild('price', $inclPrice, array(
125
- 'id' => $priceType . '_including_tax',
126
- 'label' => $this->__('Incl. Tax'),
127
- 'formatted_value' => $priceXmlObj->escapeXml($inclPrice)
128
- ));
129
- }
130
-
131
- if (Mage::helper('weee')->getApplied($item)) {
132
- $this->_addWeeeToXmlObj23($priceXmlObj);
133
- }
134
-
135
- return $priceListXmlObj;
136
- }
137
-
138
- /**
139
- * Add product subtotal info to xml object. API version 23
140
- *
141
- * @param Mage_XmlConnect_Model_Simplexml_Element $priceListXmlObj
142
- * @return Mage_XmlConnect_Model_Simplexml_Element
143
- */
144
- protected function _addSubtotalToXmlObj23(Mage_XmlConnect_Model_Simplexml_Element $priceListXmlObj)
145
- {
146
- $item = $this->getItem();
147
- $priceType = 'subtotal';
148
- $subtotalXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => $priceType));
149
-
150
- if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
151
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
152
- && $item->getWeeeTaxAppliedAmount()) {
153
- $exclPrice = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount()
154
- + $item->getWeeeTaxRowDisposition();
155
- } else {
156
- $exclPrice = $item->getRowTotal();
157
- }
158
- $exclPrice = $this->_formatPrice($exclPrice);
159
-
160
- $subtotalXmlObj->addCustomChild('price', null, array(
161
- 'id' => $priceType . '_excluding_tax',
162
- 'label' => $this->__('Subtotal Excl. Tax'),
163
- 'formatted_value' => $subtotalXmlObj->escapeXml($exclPrice)
164
- ));
165
- }
166
-
167
- if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
168
- $incl = $this->helper('checkout')->getSubtotalInclTax($item);
169
-
170
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
171
- && $item->getWeeeTaxAppliedAmount()
172
- ) {
173
- $inclPrice = $incl + $item->getWeeeTaxAppliedRowAmount();
174
- } else {
175
- $inclPrice = $incl - $item->getWeeeTaxRowDisposition();
176
- }
177
- $inclPrice = $this->_formatPrice($inclPrice);
178
-
179
- $subtotalXmlObj->addCustomChild('price', null, array(
180
- 'id' => $priceType . '_including_tax',
181
- 'label' => $this->__('Subtotal Incl. Tax'),
182
- 'formatted_value' => $subtotalXmlObj->escapeXml($inclPrice)
183
- ));
184
- }
185
-
186
- if (Mage::helper('weee')->getApplied($item)) {
187
- $this->_addWeeeToXmlObj23($subtotalXmlObj, true);
188
- }
189
-
190
- return $priceListXmlObj;
191
- }
192
-
193
- /**
194
- * Add weee tax product info to xml object API version 23
195
- *
196
- * @param Mage_XmlConnect_Model_Simplexml_Element $priceListXmlObj
197
- * @param bool $subtotalFlag use true to get subtotal product info
198
- * @return Mage_XmlConnect_Model_Simplexml_Element
199
- */
200
- protected function _addWeeeToXmlObj23($priceListXmlObj, $subtotalFlag = false)
201
- {
202
- $item = $this->getItem();
203
- $weeeXmlObj = $priceListXmlObj->addCustomChild('price', null, array('id' => 'weee'));
204
-
205
- if ($subtotalFlag) {
206
- $incl = $this->helper('checkout')->getSubtotalInclTax($item);
207
- } else {
208
- $incl = $this->helper('checkout')->getPriceInclTax($item);
209
- }
210
-
211
- $typeOfDisplay2 = Mage::helper('weee')->typeOfDisplay($item, 2, 'sales');
212
-
213
- if (Mage::helper('weee')->typeOfDisplay($item, 1, 'sales') && $item->getWeeeTaxAppliedAmount()) {
214
- foreach (Mage::helper('weee')->getApplied($item) as $tax) {
215
-
216
- if ($subtotalFlag) {
217
- $amount = $tax['row_amount'];
218
- } else {
219
- $amount = $tax['amount'];
220
- }
221
-
222
- $weeeXmlObj->addCustomChild('item', $amount * 1, array(
223
- 'id' => 'weee_tax', 'label' => $tax['title'], 'formatted_value' => $this->_formatPrice($amount)
224
- ));
225
- }
226
- } elseif ($item->getWeeeTaxAppliedAmount()
227
- && ($typeOfDisplay2 || Mage::helper('weee')->typeOfDisplay($item, 4, 'sales'))
228
- ) {
229
- foreach (Mage::helper('weee')->getApplied($item) as $tax) {
230
- if ($subtotalFlag) {
231
- $amount = $tax['row_amount_incl_tax'];
232
- } else {
233
- $amount = $tax['amount_incl_tax'];
234
- }
235
-
236
- $weeeXmlObj->addCustomChild('item', $amount * 1, array(
237
- 'id' => 'weee_tax', 'label' => $tax['title'], 'formatted_value' => $this->_formatPrice($amount)
238
- ));
239
- }
240
- }
241
-
242
- if ($typeOfDisplay2 && $item->getWeeeTaxAppliedAmount()) {
243
- if ($subtotalFlag) {
244
- $totalExcl = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount()
245
- + $item->getWeeeTaxRowDisposition();
246
- } else {
247
- $totalExcl = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
248
- + $item->getWeeeTaxDisposition();
249
- }
250
-
251
- $weeeXmlObj->addCustomChild('item', $totalExcl * 1, array(
252
- 'id' => 'total_excluding_tax',
253
- 'label' => $this->__('Total'),
254
- 'formatted_value' => $priceListXmlObj->escapeXml($this->_formatPrice($totalExcl))
255
- ));
256
- }
257
-
258
- if ($typeOfDisplay2 && $item->getWeeeTaxAppliedAmount()) {
259
- if ($subtotalFlag) {
260
- $totalIncl = $incl + $item->getWeeeTaxAppliedRowAmount();
261
- } else {
262
- $totalIncl = $incl + $item->getWeeeTaxAppliedAmount();
263
- }
264
-
265
- $weeeXmlObj->addCustomChild('item', $totalIncl * 1, array(
266
- 'id' => 'total_including_tax',
267
- 'label' => $this->__('Total incl. tax'),
268
- 'formatted_value' => $priceListXmlObj->escapeXml($this->_formatPrice($totalIncl))
269
- ));
270
- }
271
-
272
- return $priceListXmlObj;
273
- }
274
-
275
  /**
276
  * Add product subtotal info to xml object
277
  *
@@ -280,38 +78,38 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
280
  */
281
  protected function _addSubtotalToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $productXmlObj)
282
  {
283
- $item = $this->getItem();
284
  $subtotalXmlObj = $productXmlObj->addCustomChild('subtotal');
285
 
286
  if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
287
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
288
- && $item->getWeeeTaxAppliedAmount()) {
289
- $exclPrice = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount()
290
- + $item->getWeeeTaxRowDisposition();
 
291
  } else {
292
- $exclPrice = $item->getRowTotal();
293
  }
294
  $exclPrice = $this->_formatPrice($exclPrice);
295
-
296
  $subtotalXmlObj->addAttribute('excluding_tax', $subtotalXmlObj->escapeXml($exclPrice));
297
  }
298
 
299
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
300
- $incl = $this->helper('checkout')->getSubtotalInclTax($item);
301
 
302
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
303
- && $item->getWeeeTaxAppliedAmount()
304
  ) {
305
- $inclPrice = $incl + $item->getWeeeTaxAppliedRowAmount();
306
  } else {
307
- $inclPrice = $incl - $item->getWeeeTaxRowDisposition();
308
  }
309
  $inclPrice = $this->_formatPrice($inclPrice);
310
 
311
  $subtotalXmlObj->addAttribute('including_tax', $subtotalXmlObj->escapeXml($inclPrice));
312
  }
313
 
314
- if (Mage::helper('weee')->getApplied($item)) {
315
  $this->_addWeeeToXmlObj($subtotalXmlObj, true);
316
  }
317
 
@@ -337,38 +135,43 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
337
  */
338
  protected function _addPriceToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $productXmlObj)
339
  {
340
- $item = $this->getItem();
341
  $priceXmlObj = $productXmlObj->addCustomChild('price');
342
 
343
- if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
344
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
345
- && $item->getWeeeTaxAppliedAmount()
 
 
346
  ) {
347
- $exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
348
- + $item->getWeeeTaxDisposition();
349
  } else {
350
- $exclPrice = $item->getCalculationPrice();
351
  }
352
  $exclPrice = $this->_formatPrice($exclPrice);
 
353
  $priceXmlObj->addAttribute('excluding_tax', $priceXmlObj->escapeXml($exclPrice));
354
  }
355
 
356
- if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
357
- $incl = $this->helper('checkout')->getPriceInclTax($item);
 
 
358
 
359
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
360
- && $item->getWeeeTaxAppliedAmount()
361
  ) {
362
- $inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
363
  } else {
364
- $inclPrice = $incl - $item->getWeeeTaxDisposition();
365
  }
366
  $inclPrice = $this->_formatPrice($inclPrice);
367
 
368
  $priceXmlObj->addAttribute('including_tax', $priceXmlObj->escapeXml($inclPrice));
369
  }
370
 
371
- if (Mage::helper('weee')->getApplied($item)) {
372
  $this->_addWeeeToXmlObj($priceXmlObj);
373
  }
374
 
@@ -384,19 +187,19 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
384
  */
385
  protected function _addWeeeToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $priceXmlObj, $subtotalFlag = false)
386
  {
387
- $item = $this->getItem();
388
  $weeeXmlObj = $priceXmlObj->addCustomChild('weee');
389
 
390
  if ($subtotalFlag) {
391
- $incl = $this->helper('checkout')->getSubtotalInclTax($item);
392
  } else {
393
- $incl = $this->helper('checkout')->getPriceInclTax($item);
394
  }
395
 
396
- $typeOfDisplay2 = Mage::helper('weee')->typeOfDisplay($item, 2, 'sales');
397
 
398
- if (Mage::helper('weee')->typeOfDisplay($item, 1, 'sales') && $item->getWeeeTaxAppliedAmount()) {
399
- foreach (Mage::helper('weee')->getApplied($item) as $tax) {
400
 
401
  if ($subtotalFlag) {
402
  $amount = $tax['row_amount'];
@@ -405,13 +208,14 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
405
  }
406
 
407
  $weeeXmlObj->addCustomChild('item', null, array(
408
- 'name' => $tax['title'], 'amount' => $this->_formatPrice($amount)
 
409
  ));
410
  }
411
- } elseif ($item->getWeeeTaxAppliedAmount()
412
- && ($typeOfDisplay2 || Mage::helper('weee')->typeOfDisplay($item, 4, 'sales'))
413
  ) {
414
- foreach (Mage::helper('weee')->getApplied($item) as $tax) {
415
  if ($subtotalFlag) {
416
  $amount = $tax['row_amount_incl_tax'];
417
  } else {
@@ -419,29 +223,30 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
419
  }
420
 
421
  $weeeXmlObj->addCustomChild('item', null, array(
422
- 'name' => $tax['title'], 'amount' => $this->_formatPrice($amount)
 
423
  ));
424
  }
425
  }
426
 
427
- if ($typeOfDisplay2 && $item->getWeeeTaxAppliedAmount()) {
428
  if ($subtotalFlag) {
429
- $totalExcl = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount()
430
- + $item->getWeeeTaxRowDisposition();
431
  } else {
432
- $totalExcl = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
433
- + $item->getWeeeTaxDisposition();
434
  }
435
 
436
  $totalExcl = $this->_formatPrice($totalExcl);
437
  $priceXmlObj->addAttribute('total_excluding_tax', $priceXmlObj->escapeXml($totalExcl));
438
  }
439
 
440
- if ($typeOfDisplay2 && $item->getWeeeTaxAppliedAmount()) {
441
  if ($subtotalFlag) {
442
- $totalIncl = $incl + $item->getWeeeTaxAppliedRowAmount();
443
  } else {
444
- $totalIncl = $incl + $item->getWeeeTaxAppliedAmount();
445
  }
446
 
447
  $totalIncl = $this->_formatPrice($totalIncl);
40
  */
41
  public function addProductToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
42
  {
43
+ $_item = $this->getItem();
44
  $productXmlObj = $reviewXmlObj->addCustomChild('item');
45
  $productXmlObj->addCustomChild('name', $this->escapeHtml($this->getProductName()));
46
 
47
+ if ($_options = $this->getOptionList()) {
48
  $optionsXmlObj = $productXmlObj->addChild('options');
49
+ foreach ($_options as $_option) {
50
+ $_formattedOptionValue = $this->getFormatedOptionValue($_option);
51
 
52
+ if (isset($_formattedOptionValue['full_view'])) {
53
+ $value = $_formattedOptionValue['full_view'];
54
  } else {
55
  $value = null;
56
  }
57
 
58
  $optionsXmlObj->addCustomChild('option', $value, array(
59
+ 'label' => $this->escapeHtml($_option['label']),
60
+ 'value' => $_formattedOptionValue['value']
61
  ));
62
  }
63
  }
64
 
65
+ $this->_addPriceToXmlObj($productXmlObj);
66
+ $this->_addSubtotalToXmlObj($productXmlObj);
 
 
 
 
 
 
67
 
68
+ $productXmlObj->addCustomChild('qty', $_item->getQty());
 
 
 
 
69
 
70
  return $reviewXmlObj;
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * Add product subtotal info to xml object
75
  *
78
  */
79
  protected function _addSubtotalToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $productXmlObj)
80
  {
81
+ $_item = $this->getItem();
82
  $subtotalXmlObj = $productXmlObj->addCustomChild('subtotal');
83
 
84
  if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
85
+ if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')
86
+ && $_item->getWeeeTaxAppliedAmount()
87
+ ) {
88
+ $exclPrice = $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount()
89
+ + $_item->getWeeeTaxRowDisposition();
90
  } else {
91
+ $exclPrice = $_item->getRowTotal();
92
  }
93
  $exclPrice = $this->_formatPrice($exclPrice);
 
94
  $subtotalXmlObj->addAttribute('excluding_tax', $subtotalXmlObj->escapeXml($exclPrice));
95
  }
96
 
97
  if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
98
+ $_incl = $this->helper('checkout')->getSubtotalInclTax($_item);
99
 
100
+ if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')
101
+ && $_item->getWeeeTaxAppliedAmount()
102
  ) {
103
+ $inclPrice = $_incl + $_item->getWeeeTaxAppliedRowAmount();
104
  } else {
105
+ $inclPrice = $_incl - $_item->getWeeeTaxRowDisposition();
106
  }
107
  $inclPrice = $this->_formatPrice($inclPrice);
108
 
109
  $subtotalXmlObj->addAttribute('including_tax', $subtotalXmlObj->escapeXml($inclPrice));
110
  }
111
 
112
+ if (Mage::helper('weee')->getApplied($_item)) {
113
  $this->_addWeeeToXmlObj($subtotalXmlObj, true);
114
  }
115
 
135
  */
136
  protected function _addPriceToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $productXmlObj)
137
  {
138
+ $_item = $this->getItem();
139
  $priceXmlObj = $productXmlObj->addCustomChild('price');
140
 
141
+ if ($this->helper('tax')->displayCartPriceExclTax()
142
+ || $this->helper('tax')->displayCartBothPrices()
143
+ ) {
144
+ if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')
145
+ && $_item->getWeeeTaxAppliedAmount()
146
  ) {
147
+ $exclPrice = $_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount()
148
+ + $_item->getWeeeTaxDisposition();
149
  } else {
150
+ $exclPrice = $_item->getCalculationPrice();
151
  }
152
  $exclPrice = $this->_formatPrice($exclPrice);
153
+
154
  $priceXmlObj->addAttribute('excluding_tax', $priceXmlObj->escapeXml($exclPrice));
155
  }
156
 
157
+ if ($this->helper('tax')->displayCartPriceInclTax()
158
+ || $this->helper('tax')->displayCartBothPrices()
159
+ ) {
160
+ $_incl = $this->helper('checkout')->getPriceInclTax($_item);
161
 
162
+ if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')
163
+ && $_item->getWeeeTaxAppliedAmount()
164
  ) {
165
+ $inclPrice = $_incl + $_item->getWeeeTaxAppliedAmount();
166
  } else {
167
+ $inclPrice = $_incl - $_item->getWeeeTaxDisposition();
168
  }
169
  $inclPrice = $this->_formatPrice($inclPrice);
170
 
171
  $priceXmlObj->addAttribute('including_tax', $priceXmlObj->escapeXml($inclPrice));
172
  }
173
 
174
+ if (Mage::helper('weee')->getApplied($_item)) {
175
  $this->_addWeeeToXmlObj($priceXmlObj);
176
  }
177
 
187
  */
188
  protected function _addWeeeToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $priceXmlObj, $subtotalFlag = false)
189
  {
190
+ $_item = $this->getItem();
191
  $weeeXmlObj = $priceXmlObj->addCustomChild('weee');
192
 
193
  if ($subtotalFlag) {
194
+ $_incl = $this->helper('checkout')->getSubtotalInclTax($_item);
195
  } else {
196
+ $_incl = $this->helper('checkout')->getPriceInclTax($_item);
197
  }
198
 
199
+ $typeOfDisplay2 = Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales');
200
 
201
+ if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()) {
202
+ foreach (Mage::helper('weee')->getApplied($_item) as $tax) {
203
 
204
  if ($subtotalFlag) {
205
  $amount = $tax['row_amount'];
208
  }
209
 
210
  $weeeXmlObj->addCustomChild('item', null, array(
211
+ 'name' => $tax['title'],
212
+ 'amount' => $this->_formatPrice($amount)
213
  ));
214
  }
215
+ } elseif ($_item->getWeeeTaxAppliedAmount()
216
+ && ($typeOfDisplay2 || Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales'))
217
  ) {
218
+ foreach (Mage::helper('weee')->getApplied($_item) as $tax) {
219
  if ($subtotalFlag) {
220
  $amount = $tax['row_amount_incl_tax'];
221
  } else {
223
  }
224
 
225
  $weeeXmlObj->addCustomChild('item', null, array(
226
+ 'name' => $tax['title'],
227
+ 'amount' => $this->_formatPrice($amount)
228
  ));
229
  }
230
  }
231
 
232
+ if ($typeOfDisplay2 && $_item->getWeeeTaxAppliedAmount()) {
233
  if ($subtotalFlag) {
234
+ $totalExcl = $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount()
235
+ + $_item->getWeeeTaxRowDisposition();
236
  } else {
237
+ $totalExcl = $_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount()
238
+ + $_item->getWeeeTaxDisposition();
239
  }
240
 
241
  $totalExcl = $this->_formatPrice($totalExcl);
242
  $priceXmlObj->addAttribute('total_excluding_tax', $priceXmlObj->escapeXml($totalExcl));
243
  }
244
 
245
+ if ($typeOfDisplay2 && $_item->getWeeeTaxAppliedAmount()) {
246
  if ($subtotalFlag) {
247
+ $totalIncl = $_incl + $_item->getWeeeTaxAppliedRowAmount();
248
  } else {
249
+ $totalIncl = $_incl + $_item->getWeeeTaxAppliedAmount();
250
  }
251
 
252
  $totalIncl = $this->_formatPrice($totalIncl);
app/code/core/Mage/XmlConnect/Block/Cart/Items.php DELETED
@@ -1,254 +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
-
27
- /**
28
- * Shopping cart items renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Cart_Items extends Mage_Checkout_Block_Cart_Abstract
35
- {
36
- /**
37
- * Add product block to cart
38
- *
39
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObject
40
- * @param Mage_Sales_Model_Quote $quote
41
- * @return null
42
- */
43
- public function addCartProductsToXmlObj($xmlObject, $quote)
44
- {
45
- $productSmallImageSize = Mage::getModel('xmlconnect/images')->getImageLimitParam('content/product_small');
46
- $products = $xmlObject->addCustomChild('products');
47
- /* @var $item Mage_Sales_Model_Quote_Item */
48
- foreach ($this->getItems() as $item) {
49
- $type = $item->getProductType();
50
- $renderer = $this->getItemRenderer($type)->setItem($item);
51
- /**
52
- * General information
53
- */
54
- $itemXml = $products->addCustomChild('item', null, array('entity_id' => $item->getProduct()->getId()));
55
- $itemXml->addCustomChild('entity_type', $type);
56
- $itemXml->addCustomChild('item_id', $item->getId());
57
- $itemXml->addCustomChild('name', $xmlObject->escapeXml($renderer->getProductName()));
58
- $itemXml->addCustomChild('code', 'cart[' . $item->getId() . '][qty]');
59
- $itemXml->addCustomChild('qty', $renderer->getQty());
60
- $icon = $renderer->getProductThumbnail()->resize($productSmallImageSize);
61
- $iconXml = $itemXml->addChild('icon', $icon);
62
- $iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
63
-
64
- /**
65
- * Price
66
- */
67
- $pricesXmlObj = $itemXml->addCustomChild('price_list');
68
- $exclPrice = $inclPrice = 0;
69
- if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
70
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
71
- && $item->getWeeeTaxAppliedAmount()
72
- ) {
73
- $exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
74
- + $item->getWeeeTaxDisposition();
75
- } else {
76
- $exclPrice = $item->getCalculationPrice();
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);
90
- $paypalPrice = Mage::helper('xmlconnect')->formatPriceForXml($item->getCalculationPrice());
91
- $formattedExclPrice = $quote->getStore()->formatPrice($exclPrice, false);
92
- $inclPrice = Mage::helper('xmlconnect')->formatPriceForXml($inclPrice);
93
- $formattedInclPrice = $quote->getStore()->formatPrice($inclPrice, false);
94
-
95
- $priceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'price'));
96
-
97
- if ($this->helper('tax')->displayCartBothPrices()) {
98
- $priceXmlObj->addCustomChild('price', $exclPrice, array(
99
- 'id' => 'excluding_tax',
100
- 'label' => $this->__('Excl. Tax'),
101
- 'formatted_value' => $formattedExclPrice
102
- ));
103
-
104
- $priceXmlObj->addCustomChild('price', $inclPrice, array(
105
- 'id' => 'including_tax',
106
- 'label' => $this->__('Incl. Tax'),
107
- 'formatted_value' => $formattedInclPrice
108
- ));
109
- } else {
110
- if ($this->helper('tax')->displayCartPriceExclTax()) {
111
- $priceXmlObj->addCustomChild('price', $exclPrice, array(
112
- 'id' => 'regular',
113
- 'label' => $this->__('Unit Price'),
114
- 'formatted_value' => $formattedExclPrice
115
- ));
116
- }
117
- if ($this->helper('tax')->displayCartPriceInclTax()) {
118
- $priceXmlObj->addCustomChild('price', $inclPrice, array(
119
- 'id' => 'regular',
120
- 'label' => $this->__('Unit Price'),
121
- 'formatted_value' => $formattedInclPrice
122
- ));
123
- }
124
- }
125
-
126
- /**
127
- * Info for paypal MEP if it's enabled
128
- */
129
- $appConfig = Mage::helper('xmlconnect')->getApplication()->loadConfiguration()->getRenderConf();
130
- $isMepActive = $appConfig['paypal']['isActive'];
131
-
132
- $paypalMepIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mep')->isAvailable(null);
133
- if ($paypalMepIsAvailable && $isMepActive) {
134
- $paypalPriceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'paypal'));
135
-
136
- $paypalPriceXmlObj->addCustomChild('price', $paypalPrice, array(
137
- 'id' => 'regular',
138
- 'label' => $this->__('Unit Price'),
139
- 'formatted_value' => $quote->getStore()->formatPrice($paypalPrice, false)
140
- ));
141
-
142
- $paypalSubtotalPrice = Mage::helper('xmlconnect')->formatPriceForXml($item->getRowTotal());
143
- $paypalPriceXmlObj->addCustomChild('price', $paypalSubtotalPrice, array(
144
- 'id' => 'subtotal',
145
- 'label' => $this->__('Subtotal'),
146
- 'formatted_value' => $quote->getStore()->formatPrice($paypalSubtotalPrice, false)
147
- ));
148
- }
149
-
150
- /**
151
- * Subtotal
152
- */
153
- $subtotalExclTax = $subtotalInclTax = 0;
154
- if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
155
- if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
156
- && $item->getWeeeTaxAppliedAmount()
157
- ) {
158
- $subtotalExclTax = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount()
159
- + $item->getWeeeTaxRowDisposition();
160
- } else {
161
- $subtotalExclTax = $item->getRowTotal();
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
-
175
- $subtotalExclTax = Mage::helper('xmlconnect')->formatPriceForXml($subtotalExclTax);
176
- $formattedSubtotalExcl = $quote->getStore()->formatPrice($subtotalExclTax, false);
177
-
178
- $subtotalInclTax = Mage::helper('xmlconnect')->formatPriceForXml($subtotalInclTax);
179
- $formattedSubtotalIncl = $quote->getStore()->formatPrice($subtotalInclTax, false);
180
-
181
- $priceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'subtotal'));
182
-
183
- if ($this->helper('tax')->displayCartBothPrices()) {
184
- $priceXmlObj->addCustomChild('price', $subtotalExclTax, array(
185
- 'id' => 'excluding_tax',
186
- 'label' => $this->__('Subtotal Excl. Tax'),
187
- 'formatted_value' => $formattedSubtotalExcl
188
- ));
189
-
190
- $priceXmlObj->addCustomChild('price', $subtotalInclTax, array(
191
- 'id' => 'including_tax',
192
- 'label' => $this->__('Subtotal Incl. Tax'),
193
- 'formatted_value' => $formattedSubtotalIncl
194
- ));
195
- } else {
196
- if ($this->helper('tax')->displayCartPriceExclTax()) {
197
- $priceXmlObj->addCustomChild('price', $subtotalExclTax, array(
198
- 'id' => 'regular',
199
- 'label' => $this->__('Subtotal'),
200
- 'formatted_value' => $formattedSubtotalExcl
201
- ));
202
- }
203
- if ($this->helper('tax')->displayCartPriceInclTax()) {
204
- $priceXmlObj->addCustomChild('price', $subtotalInclTax, array(
205
- 'id' => 'regular',
206
- 'label' => $this->__('Subtotal'),
207
- 'formatted_value' => $formattedSubtotalIncl
208
- ));
209
- }
210
- }
211
-
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
- }
226
-
227
- /**
228
- * Downloadable products
229
- */
230
- $links = $renderer->getLinks();
231
- if ($links) {
232
- $itemOptionsXml = $itemXml->addCustomChild('options', null, array(
233
- 'label' => $renderer->getLinksTitle()
234
- ));
235
- foreach ($links as $link) {
236
- $itemOptionsXml->addCustomChild('option', null, array('label' => $link->getTitle()));
237
- }
238
- }
239
-
240
- /**
241
- * Item messages
242
- */
243
- $messages = $renderer->getMessages();
244
- if ($messages) {
245
- $itemMessagesXml = $itemXml->addCustomChild('messages');
246
- foreach ($messages as $message) {
247
- $messageXml = $itemMessagesXml->addCustomChild('option');
248
- $messageXml->addCustomChild('type', $message['type']);
249
- $messageXml->addCustomChild('text', $xmlObject->escapeXml($message['text']));
250
- }
251
- }
252
- }
253
- }
254
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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());
@@ -59,8 +59,10 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details extends Mage_Paypal_Block_E
59
  * @return Mage_XmlConnect_Model_Simplexml_Element
60
  */
61
  public function getItemXml(
62
- Mage_Sales_Model_Quote_Item $item, Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj
63
- ) {
 
 
64
  $renderer = $this->getItemRenderer($item->getProductType())->setItem($item)->setQuote($this->getQuote());
65
  return $renderer->addProductToXmlObj($reviewXmlObj);
66
  }
@@ -76,7 +78,9 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details extends Mage_Paypal_Block_E
76
  public function addItemRender($productType, $blockType, $template)
77
  {
78
  $this->_itemRenders[$productType] = array(
79
- 'block' => $blockType, 'template' => $template, 'blockInstance' => null
 
 
80
  );
81
  return $this;
82
  }
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());
59
  * @return Mage_XmlConnect_Model_Simplexml_Element
60
  */
61
  public function getItemXml(
62
+ Mage_Sales_Model_Quote_Item $item,
63
+ Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj
64
+ )
65
+ {
66
  $renderer = $this->getItemRenderer($item->getProductType())->setItem($item)->setQuote($this->getQuote());
67
  return $renderer->addProductToXmlObj($reviewXmlObj);
68
  }
78
  public function addItemRender($productType, $blockType, $template)
79
  {
80
  $this->_itemRenders[$productType] = array(
81
+ 'block' => $blockType,
82
+ 'template' => $template,
83
+ 'blockInstance' => null
84
  );
85
  return $this;
86
  }
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/OrderDetails.php DELETED
@@ -1,83 +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
-
27
- /**
28
- * PayPal MECL order details xml renderer
29
- *
30
- * @category Mage
31
- * @package Mage_Xmlconnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Cart_Paypal_Mecl_OrderDetails extends Mage_Paypal_Block_Express_Review_Details
35
- {
36
- /**
37
- * Add cart details to XML object
38
- *
39
- * @param Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj
40
- * @return Mage_XmlConnect_Model_Simplexml_Element
41
- */
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();
50
-
51
- return $reviewXmlObj;
52
- }
53
-
54
- /**
55
- * Get item row xml
56
- *
57
- * @param Mage_Sales_Model_Quote_Item $item
58
- * @param Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj
59
- * @return Mage_XmlConnect_Model_Simplexml_Element
60
- */
61
- public function getItemXml(
62
- Mage_Sales_Model_Quote_Item $item, Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj
63
- ) {
64
- $renderer = $this->getItemRenderer($item->getProductType())->setItem($item)->setQuote($this->getQuote());
65
- return $renderer->addProductToXmlObj($reviewXmlObj);
66
- }
67
-
68
- /**
69
- * Add renderer for item product type
70
- *
71
- * @param string $productType
72
- * @param string $blockType
73
- * @param string $template
74
- * @return Mage_Checkout_Block_Cart_Abstract
75
- */
76
- public function addItemRender($productType, $blockType, $template)
77
- {
78
- $this->_itemRenders[$productType] = array(
79
- 'block' => $blockType, 'template' => $template, 'blockInstance' => null
80
- );
81
- return $this;
82
- }
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Review.php CHANGED
@@ -44,14 +44,15 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Review extends Mage_Paypal_Block_Ex
44
  $reviewXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<mecl_cart_details></mecl_cart_details>');
45
 
46
  if ($this->getPaypalMessages()) {
47
- $reviewXmlObj->addChild('paypal_message', implode('\n', $this->getPaypalMessages()));
48
  }
49
 
50
  if ($this->getShippingAddress()) {
51
- $shipping = Mage::helper('xmlconnect')->trimLineBreaks($this->getShippingAddress()->format('text'));
52
- $reviewXmlObj->addCustomChild('shipping_address', $shipping, array(
53
- 'label' => $this->__('Shipping Address')
54
- ));
 
55
  }
56
 
57
  if ($this->_quote->isVirtual()) {
@@ -77,20 +78,17 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Review extends Mage_Paypal_Block_Ex
77
  $reviewXmlObj->addCustomChild('payment_method', $this->escapeHtml($this->getPaymentMethodTitle()), array(
78
  'label' => $this->__('Payment Method')
79
  ));
80
- $billing = Mage::helper('xmlconnect')->trimLineBreaks($this->getBillingAddress()->format('text'));
81
- $reviewXmlObj->addCustomChild('billing_address', $billing, array(
82
- 'label' => $this->__('Billing Address'),
83
- 'payer_email' => $this->__('Payer Email: %s', $this->getBillingAddress()->getEmail())
 
 
 
84
  ));
85
 
86
  $this->getChild('details')->addDetailsToXmlObj($reviewXmlObj);
87
 
88
- $agreements = $this->getChildHtml('agreements');
89
- if ($agreements) {
90
- $agreementsXmlObj = Mage::getModel('xmlconnect/simplexml_element', $agreements);
91
- $reviewXmlObj->appendChild($agreementsXmlObj);
92
- }
93
-
94
  return $reviewXmlObj->asNiceXml();
95
  }
96
  }
44
  $reviewXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<mecl_cart_details></mecl_cart_details>');
45
 
46
  if ($this->getPaypalMessages()) {
47
+ $reviewXmlObj->addChild('paypal_message', implode(PHP_EOL, $this->getPaypalMessages()));
48
  }
49
 
50
  if ($this->getShippingAddress()) {
51
+ $reviewXmlObj->addCustomChild(
52
+ 'shipping_address',
53
+ Mage::helper('xmlconnect')->trimLineBreaks($this->getShippingAddress()->format('text')),
54
+ array('label' => $this->__('Shipping Address'))
55
+ );
56
  }
57
 
58
  if ($this->_quote->isVirtual()) {
78
  $reviewXmlObj->addCustomChild('payment_method', $this->escapeHtml($this->getPaymentMethodTitle()), array(
79
  'label' => $this->__('Payment Method')
80
  ));
81
+
82
+ $reviewXmlObj->addCustomChild(
83
+ 'billing_address',
84
+ Mage::helper('xmlconnect')->trimLineBreaks($this->getBillingAddress()->format('text')),
85
+ array(
86
+ 'label' => $this->__('Billing Address'),
87
+ 'payer_email' => $this->__('Payer Email: %s', $this->getBillingAddress()->getEmail())
88
  ));
89
 
90
  $this->getChild('details')->addDetailsToXmlObj($reviewXmlObj);
91
 
 
 
 
 
 
 
92
  return $reviewXmlObj->asNiceXml();
93
  }
94
  }
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php CHANGED
@@ -31,30 +31,9 @@
31
  * @package Mage_Xmlconnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods extends Mage_Paypal_Block_Express_Review
 
35
  {
36
- /**
37
- * Add price details to xml object
38
- *
39
- * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
40
- * @param Mage_Sales_Model_Quote_Address_Rate $rate
41
- * @return Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
42
- */
43
- protected function _addPriceToXmlObj($xmlObj, $rate)
44
- {
45
- $price = $this->_getShippingPrice($rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax());
46
- $incl = $this->_getShippingPrice($rate->getPrice(), true);
47
- $renderedInclTax = '';
48
- if (($incl != $price) && $this->helper('tax')->displayShippingBothPrices()) {
49
- $inclTaxFormat = ' (%s %s)';
50
- $renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl);
51
- }
52
- $price .= $renderedInclTax;
53
- $xmlObj->addAttribute('price', $rate->getPrice() * 1);
54
- $xmlObj->addAttribute('formatted_price', $xmlObj->escapeXml($price));
55
- return $this;
56
- }
57
-
58
  /**
59
  * Render PayPal MECL shipping method list xml
60
  *
@@ -64,100 +43,45 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods extends Mage_Paypal
64
  {
65
  /** @var $listXmlObj Mage_XmlConnect_Model_Simplexml_Element */
66
  $methodListXmlObj = Mage::getModel(
67
- 'xmlconnect/simplexml_element', '<shipping_method_list></shipping_method_list>'
 
68
  );
 
69
  $methodListXmlObj->addAttribute('label', $this->__('Shipping Method'));
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) {
77
- $rateListXmlObj = $this->_addRatesToXmlObj($methodListXmlObj, $code);
78
- foreach ($rates as $rate) {
79
- $rateAttributes = array(
80
- 'label' => $rate->getMethodTitle(),
81
- 'code' => $this->renderShippingRateValue($rate)
82
- );
83
- $rateXmlObj = $rateListXmlObj->addCustomChild('rate', null, $rateAttributes);
84
- if ($rate->getErrorMessage()) {
85
- $rateXmlObj->addChild('error_message', $rateXmlObj->escapeXml(
86
- $rate->getErrorMessage()
87
- ));
88
- } else {
89
- $this->_addPriceToXmlObj($rateXmlObj, $rate);
90
- }
91
- if ($currentRate === $rate) {
92
- $rateXmlObj->addAttribute('selected', 1);
93
- }
94
  }
 
95
  }
96
- } else {
97
- $this->_addNoShippingMessage($methodListXmlObj);
98
  }
99
  } else {
100
- $rateListXmlObj = $this->_addRatesToXmlObj($methodListXmlObj);
101
- $rate = $this->getCurrentShippingRate();
102
- $rateXmlObj = $rateListXmlObj->addCustomChild('rate', null, array(
103
- 'label' => $rate->getMethodTitle(),
104
- 'code' => $this->renderShippingRateValue($rate),
105
- 'selected' => 1
106
- ));
107
- $this->_addPriceToXmlObj($rateXmlObj, $rate);
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) {
115
- $rateListXmlObj = $this->_addRatesToXmlObj($methodListXmlObj, $code);
116
- foreach ($rates as $rate) {
117
- if ($rate->getErrorMessage()) {
118
- $title = $rate->getErrorMessage();
119
- } else {
120
- $title = $this->renderShippingRateOption($rate);
121
- }
122
- $rateAttributes = array(
123
- 'label' => $rateListXmlObj->escapeXml($title),
124
- 'code' => $this->renderShippingRateValue($rate)
125
- );
126
- if ($currentRate === $rate) {
127
- $rateAttributes += array('selected' => 1);
128
- }
129
- $rateListXmlObj->addCustomChild('rate', null, $rateAttributes);
130
- }
131
- }
132
- } else {
133
- $this->_addNoShippingMessage($methodListXmlObj);
134
- }
135
- } else {
136
- $rateXmlObj = $this->_addRatesToXmlObj($methodListXmlObj);
137
- $rateXmlObj->addCustomChild('rate', null, array(
138
- 'label' => $this->renderShippingRateOption($this->getCurrentShippingRate()),
139
- 'selected' => 1
140
- ));
141
- }
142
  }
143
 
144
  return $methodListXmlObj->asNiceXml();
145
  }
146
 
147
- /**
148
- * Add message to describe that shipping is not required or not available
149
- *
150
- * @param Mage_XmlConnect_Model_Simplexml_Element $methodListXmlObj
151
- * @return Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
152
- */
153
- protected function _addNoShippingMessage($methodListXmlObj)
154
- {
155
- $message = $this->_quote->isVirtual() ? $this->__('No shipping method required.')
156
- : $this->__('Sorry, no quotes are available for this order at this time.');
157
- $methodListXmlObj->addCustomChild('method', null, array('label' => $message));
158
- return $this;
159
- }
160
-
161
  /**
162
  * Add cart details to XML object
163
  *
@@ -165,7 +89,7 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods extends Mage_Paypal
165
  * @param string $code
166
  * @return Mage_XmlConnect_Model_Simplexml_Element
167
  */
168
- protected function _addRatesToXmlObj($methodListXmlObj, $code = '')
169
  {
170
  $attributes = $code ? array('label' => $this->getCarrierName($code)) : array();
171
  return $methodListXmlObj->addCustomChild('method', null, $attributes)->addCustomChild('rates');
31
  * @package Mage_Xmlconnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
35
+ extends Mage_Paypal_Block_Express_Review
36
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /**
38
  * Render PayPal MECL shipping method list xml
39
  *
43
  {
44
  /** @var $listXmlObj Mage_XmlConnect_Model_Simplexml_Element */
45
  $methodListXmlObj = Mage::getModel(
46
+ 'xmlconnect/simplexml_element',
47
+ '<shipping_method_list></shipping_method_list>'
48
  );
49
+
50
  $methodListXmlObj->addAttribute('label', $this->__('Shipping Method'));
51
 
52
+ if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
53
+ $groups = $this->getShippingRateGroups();
54
+ if ($groups) {
55
+ $currentRate = $this->getCurrentShippingRate();
56
+ foreach ($groups as $code => $rates) {
57
+ $rateXmlObj = $this->_addRatesToXmlObj($methodListXmlObj, $code);
58
+ foreach ($rates as $rate) {
59
+ $rateAttributes = array(
60
+ 'label' => strip_tags($this->renderShippingRateOption($rate)),
61
+ 'code' => $this->renderShippingRateValue($rate)
62
+ );
63
+ if ($currentRate === $rate) {
64
+ $rateAttributes += array('selected' => 1);
 
 
 
 
 
 
 
 
 
 
65
  }
66
+ $rateXmlObj->addCustomChild('rate', null, $rateAttributes);
67
  }
 
 
68
  }
69
  } else {
70
+ $message = $this->_quote->isVirtual() ? $this->__('No shipping method required.')
71
+ : $this->__('Sorry, no quotes are available for this order at this time.');
72
+ $methodListXmlObj->addCustomChild('method', null, array('label' => $message));
 
 
 
 
 
73
  }
74
  } else {
75
+ $rateXmlObj = $this->_addRatesToXmlObj($methodListXmlObj);
76
+ $rateXmlObj->addCustomChild('rate', null, array(
77
+ 'label' => $this->renderShippingRateOption($this->getCurrentShippingRate()),
78
+ 'selected' => 1
79
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
82
  return $methodListXmlObj->asNiceXml();
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * Add cart details to XML object
87
  *
89
  * @param string $code
90
  * @return Mage_XmlConnect_Model_Simplexml_Element
91
  */
92
+ protected function _addRatesToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $methodListXmlObj, $code = '')
93
  {
94
  $attributes = $code ? array('label' => $this->getCarrierName($code)) : array();
95
  return $methodListXmlObj->addCustomChild('method', null, $attributes)->addCustomChild('rates');
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php CHANGED
@@ -59,7 +59,10 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mep_Totals extends Mage_Checkout_Block_C
59
  switch ($code) {
60
  case 'subtotal':
61
  $subtotal = intval($total->getValueExclTax()) ? $total->getValueExclTax() : $total->getValue();
62
- $paypalTotals->addAttribute($code, Mage::helper('xmlconnect')->formatPriceForXml($subtotal));
 
 
 
63
  break;
64
  case 'tax':
65
  $paypalTotals->addAttribute(
59
  switch ($code) {
60
  case 'subtotal':
61
  $subtotal = intval($total->getValueExclTax()) ? $total->getValueExclTax() : $total->getValue();
62
+ $paypalTotals->addAttribute(
63
+ $code,
64
+ Mage::helper('xmlconnect')->formatPriceForXml($subtotal)
65
+ );
66
  break;
67
  case 'tax':
68
  $paypalTotals->addAttribute(
app/code/core/Mage/XmlConnect/Block/Cart/Totals.php CHANGED
@@ -58,7 +58,10 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
58
  if ($renderer->displayBoth()) {
59
  $title = $this->__('Subtotal (Excl. Tax)');
60
  $this->_addTotalDataToXmlObj(
61
- $totalsXmlObj, $code . '_excl_tax', $title, $total->getValueExclTax()
 
 
 
62
  );
63
 
64
  $code = $code . '_incl_tax';
@@ -100,12 +103,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);
58
  if ($renderer->displayBoth()) {
59
  $title = $this->__('Subtotal (Excl. Tax)');
60
  $this->_addTotalDataToXmlObj(
61
+ $totalsXmlObj,
62
+ $code . '_excl_tax',
63
+ $title,
64
+ $total->getValueExclTax()
65
  );
66
 
67
  $code = $code . '_incl_tax';
103
  }
104
  continue 2;
105
  case 'giftcardaccount':
106
+ $_cards = $renderer->getTotal()->getGiftCards();
107
+ if (!$_cards) {
108
+ $_cards = $renderer->getQuoteGiftCards();
109
  }
110
  if ($renderer->getTotal()->getValue()) {
111
+ foreach ($_cards as $cardCode) {
112
  $title = $this->__('Gift Card (%s)', $cardCode['c']);
113
  $value = $cardCode['c'];
114
  $totalXmlObj = $totalsXmlObj->addChild($code);
app/code/core/Mage/XmlConnect/Block/Catalog.php CHANGED
@@ -31,7 +31,7 @@
31
  * @package Mage_Xmlconnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Mage_XmlConnect_Block_Catalog extends Mage_Catalog_Block_Product_List_Toolbar
35
  {
36
  /**
37
  * Limit for product sorting fields to return
@@ -39,48 +39,22 @@ class Mage_XmlConnect_Block_Catalog extends Mage_Catalog_Block_Product_List_Tool
39
  const PRODUCT_SORT_FIELDS_NUMBER = 3;
40
 
41
  /**
42
- * Prefix that used in specifying filters on request
43
- *
44
- * @deprecated renamed
45
  */
46
- const REQUEST_FILTER_PARAM_REFIX = self::REQUEST_FILTER_PARAM_PREFIX;
47
 
48
  /**
49
- * Prefix that used in specifying filters on request
50
- */
51
- const REQUEST_FILTER_PARAM_PREFIX = 'filter_';
52
-
53
- /**
54
- * Prefix that used in specifying sort order params on request
55
- *
56
- * @deprecated renamed
57
  */
58
- const REQUEST_SORT_ORDER_PARAM_REFIX = self::REQUEST_SORT_ORDER_PARAM_PREFIX;
59
-
60
- /**
61
- * Prefix that used in specifying sort order params on request
62
- */
63
- const REQUEST_SORT_ORDER_PARAM_PREFIX = 'order_';
64
 
65
  /**
66
  * Retrieve product sort fields as xml object
67
  *
68
- * @deprecated method renamed
69
  * @return Mage_XmlConnect_Model_Simplexml_Element
70
  */
71
  public function getProductSortFeildsXmlObject()
72
  {
73
- $this->getProductSortFieldsXmlObject();
74
- }
75
-
76
- /**
77
- * Retrieve product sort fields as xml object
78
- *
79
- * @return Mage_XmlConnect_Model_Simplexml_Element
80
- */
81
- public function getProductSortFieldsXmlObject()
82
- {
83
- /** @var $ordersXmlObject Mage_XmlConnect_Model_Simplexml_Element */
84
  $ordersXmlObject = Mage::getModel('xmlconnect/simplexml_element', '<orders></orders>');
85
  /* @var $category Mage_Catalog_Model_Category */
86
  $category = Mage::getModel('catalog/category');
@@ -98,32 +72,4 @@ class Mage_XmlConnect_Block_Catalog extends Mage_Catalog_Block_Product_List_Tool
98
 
99
  return $ordersXmlObject;
100
  }
101
-
102
- /**
103
- * Retrieve catalog search product sort fields as xml object
104
- *
105
- * @return Mage_XmlConnect_Model_Simplexml_Element
106
- */
107
- public function getSearchProductSortFieldsXmlObject()
108
- {
109
- /** @var $ordersXmlObject Mage_XmlConnect_Model_Simplexml_Element */
110
- $ordersXmlObject = Mage::getModel('xmlconnect/simplexml_element', '<orders></orders>');
111
- /* @var $category Mage_Catalog_Model_Category */
112
- $category = Mage::getModel('catalog/category');
113
- $sortOptions = $category->getAvailableSortByOptions();
114
- $sortOptions = array_slice($sortOptions, 0, self::PRODUCT_SORT_FIELDS_NUMBER);
115
- unset($sortOptions['position']);
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
- }
129
  }
31
  * @package Mage_Xmlconnect
32
  * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
+ class Mage_XmlConnect_Block_Catalog extends Mage_Core_Block_Template
35
  {
36
  /**
37
  * Limit for product sorting fields to return
39
  const PRODUCT_SORT_FIELDS_NUMBER = 3;
40
 
41
  /**
42
+ * Prefix that used in specifing filters on request
 
 
43
  */
44
+ const REQUEST_FILTER_PARAM_REFIX = 'filter_';
45
 
46
  /**
47
+ * Prefix that used in specifing sort order params on request
 
 
 
 
 
 
 
48
  */
49
+ const REQUEST_SORT_ORDER_PARAM_REFIX = 'order_';
 
 
 
 
 
50
 
51
  /**
52
  * Retrieve product sort fields as xml object
53
  *
 
54
  * @return Mage_XmlConnect_Model_Simplexml_Element
55
  */
56
  public function getProductSortFeildsXmlObject()
57
  {
 
 
 
 
 
 
 
 
 
 
 
58
  $ordersXmlObject = Mage::getModel('xmlconnect/simplexml_element', '<orders></orders>');
59
  /* @var $category Mage_Catalog_Model_Category */
60
  $category = Mage::getModel('catalog/category');
72
 
73
  return $ordersXmlObject;
74
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Category.php CHANGED
@@ -43,9 +43,8 @@ class Mage_XmlConnect_Block_Catalog_Category extends Mage_XmlConnect_Block_Catal
43
  /** @var $categoryXmlObj Mage_XmlConnect_Model_Simplexml_Element */
44
  $categoryXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<category></category>');
45
  $categoryId = $this->getRequest()->getParam('id', null);
46
- $rootCategoryId = Mage::app()->getStore()->getRootCategoryId();
47
- if (null === $categoryId) {
48
- $categoryId = $rootCategoryId;
49
  }
50
 
51
  $productsXmlObj = $productListBlock = false;
@@ -74,15 +73,10 @@ class Mage_XmlConnect_Block_Catalog_Category extends Mage_XmlConnect_Block_Catal
74
  // subcategories are exists
75
  if (sizeof($categoryCollection)) {
76
  $itemsXmlObj = $categoryXmlObj->addChild('items');
77
- $categoryImageSize = Mage::getModel('xmlconnect/images')->getImageLimitParam('content/category');
78
  foreach ($categoryCollection as $item) {
79
  /** @var $item Mage_Catalog_Model_Category */
80
  $item = Mage::getModel('catalog/category')->load($item->getId());
81
 
82
- if ($categoryId == $rootCategoryId && !$item->getIncludeInMenu()) {
83
- continue;
84
- }
85
-
86
  $itemXmlObj = $itemsXmlObj->addChild('item');
87
  $itemXmlObj->addChild('label', $categoryXmlObj->escapeXml($item->getName()));
88
  $itemXmlObj->addChild('entity_id', $item->getId());
@@ -91,10 +85,12 @@ class Mage_XmlConnect_Block_Catalog_Category extends Mage_XmlConnect_Block_Catal
91
  $itemXmlObj->addChild('parent_id', $item->getParentId());
92
  }
93
  $icon = Mage::helper('xmlconnect/catalog_category_image')->initialize($item, 'thumbnail')
94
- ->resize($categoryImageSize);
95
 
96
  $iconXml = $itemXmlObj->addChild('icon', $icon);
97
- $iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
 
 
98
  }
99
  }
100
 
43
  /** @var $categoryXmlObj Mage_XmlConnect_Model_Simplexml_Element */
44
  $categoryXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<category></category>');
45
  $categoryId = $this->getRequest()->getParam('id', null);
46
+ if ($categoryId === null) {
47
+ $categoryId = Mage::app()->getStore()->getRootCategoryId();
 
48
  }
49
 
50
  $productsXmlObj = $productListBlock = false;
73
  // subcategories are exists
74
  if (sizeof($categoryCollection)) {
75
  $itemsXmlObj = $categoryXmlObj->addChild('items');
 
76
  foreach ($categoryCollection as $item) {
77
  /** @var $item Mage_Catalog_Model_Category */
78
  $item = Mage::getModel('catalog/category')->load($item->getId());
79
 
 
 
 
 
80
  $itemXmlObj = $itemsXmlObj->addChild('item');
81
  $itemXmlObj->addChild('label', $categoryXmlObj->escapeXml($item->getName()));
82
  $itemXmlObj->addChild('entity_id', $item->getId());
85
  $itemXmlObj->addChild('parent_id', $item->getParentId());
86
  }
87
  $icon = Mage::helper('xmlconnect/catalog_category_image')->initialize($item, 'thumbnail')
88
+ ->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('category'));
89
 
90
  $iconXml = $itemXmlObj->addChild('icon', $icon);
91
+
92
+ $file = Mage::helper('xmlconnect')->urlToPath($icon);
93
+ $iconXml->addAttribute('modification_time', filemtime($file));
94
  }
95
  }
96
 
app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php CHANGED
@@ -41,7 +41,6 @@ class Mage_XmlConnect_Block_Catalog_Filters extends Mage_XmlConnect_Block_Catalo
41
  protected function _toHtml()
42
  {
43
  $categoryId = $this->getRequest()->getParam('category_id', null);
44
- /** @var $categoryXmlObj Mage_XmlConnect_Model_Simplexml_Element */
45
  $categoryXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<category></category>');
46
  $filtersCollection = Mage::getResourceModel('xmlconnect/filter_collection')->setCategoryId($categoryId);
47
 
@@ -62,7 +61,7 @@ class Mage_XmlConnect_Block_Catalog_Filters extends Mage_XmlConnect_Block_Catalo
62
  $valueXmlObj->addChild('count', (int)$value->getProductsCount());
63
  }
64
  }
65
- $categoryXmlObj->appendChild($this->getProductSortFieldsXmlObject());
66
 
67
  return $categoryXmlObj->asNiceXml();
68
  }
41
  protected function _toHtml()
42
  {
43
  $categoryId = $this->getRequest()->getParam('category_id', null);
 
44
  $categoryXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<category></category>');
45
  $filtersCollection = Mage::getResourceModel('xmlconnect/filter_collection')->setCategoryId($categoryId);
46
 
61
  $valueXmlObj->addChild('count', (int)$value->getProductsCount());
62
  }
63
  }
64
+ $categoryXmlObj->appendChild($this->getProductSortFeildsXmlObject());
65
 
66
  return $categoryXmlObj->asNiceXml();
67
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product.php CHANGED
@@ -52,24 +52,23 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
52
  $description = Mage::helper('xmlconnect')->htmlize($item->xmlentities($product->getDescription()));
53
  $item->addChild('description', $description);
54
  $item->addChild('link', $product->getProductUrl());
55
- /** @var $imageLimitsModel Mage_XmlConnect_Model_Images */
56
- $imageLimitsModel = Mage::getModel('xmlconnect/images');
57
 
58
  if ($itemNodeName == 'item') {
59
- $imageToResize = $imageLimitsModel->getImageLimitParam('content/product_small');
60
  $propertyToResizeName = 'small_image';
61
  } else {
62
- $imageToResize = $imageLimitsModel->getImageLimitParam('content/product_big');
63
  $propertyToResizeName = 'image';
64
  }
65
 
66
- $icon = clone Mage::helper('xmlconnect/catalog_product_image')->init($product, $propertyToResizeName)
67
- ->resize($imageToResize);
68
 
69
  $iconXml = $item->addChild('icon', $icon);
70
- $iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
71
 
72
- $item->addChild('in_stock', (int)$product->getStockItem()->getIsInStock());
 
 
 
73
  $item->addChild('is_salable', (int)$product->isSalable());
74
  /**
75
  * By default all products has gallery (because of collection not load gallery attribute)
@@ -88,14 +87,8 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
88
  }
89
  $item->addChild('has_options', (int)$product->getHasOptions());
90
 
91
- $minSaleQty = null;
92
- if ($product->hasPreconfiguredValues()) {
93
- $minSaleQty = $product->getPreconfiguredValues()->getData('qty');
94
- }
95
- $minSaleQty = $minSaleQty ? $minSaleQty : $this->_getMinimalQty($product);
96
-
97
- if ($minSaleQty) {
98
- $item->addChild('min_sale_qty', (int)$minSaleQty);
99
  }
100
 
101
  if (!$product->getRatingSummary()) {
@@ -106,7 +99,8 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
106
  $item->addChild('reviews_count', $product->getRatingSummary()->getReviewsCount());
107
 
108
  if ($this->getChild('product_price')) {
109
- $this->getChild('product_price')->setProduct($product)->setProductXmlObj($item)->collectProductPrices();
 
110
  }
111
 
112
  if ($this->getChild('additional_info')) {
@@ -142,28 +136,24 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
142
  protected function _toHtml()
143
  {
144
  /** @var $product Mage_Catalog_Model_Product */
145
- if ($this->getProduct()) {
146
- $product = $this->getProduct();
 
 
 
147
  } else {
148
- $product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())
149
- ->load($this->getRequest()->getParam('id', 0));
150
- if (!$product) {
151
- Mage::throwException($this->__('Selected product is unavailable.'));
152
- } else {
153
- $this->setProduct($product);
 
154
  }
155
  }
156
- /** @var $productXmlObj Mage_XmlConnect_Model_Simplexml_Element */
157
- $productXmlObj = $this->productToXmlObject($product, 'product');
158
-
159
- /** @var $relatedProductsBlock Mage_XmlConnect_Block_Catalog_Product_Related */
160
- $relatedProductsBlock = $this->getChild('related_products');
161
- if ($relatedProductsBlock) {
162
- $relatedXmlObj = $relatedProductsBlock->getRelatedProductsXmlObj();
163
- $productXmlObj->appendChild($relatedXmlObj);
164
- }
165
 
166
- $productOptions = $this->getChild('xmlconnect.catalog.product.options')->getProductOptionsXmlObject($product);
 
167
  if ($productOptions instanceof Mage_XmlConnect_Model_Simplexml_Element) {
168
  $productXmlObj->appendChild($productOptions);
169
  }
52
  $description = Mage::helper('xmlconnect')->htmlize($item->xmlentities($product->getDescription()));
53
  $item->addChild('description', $description);
54
  $item->addChild('link', $product->getProductUrl());
 
 
55
 
56
  if ($itemNodeName == 'item') {
57
+ $imageToResize = Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small');
58
  $propertyToResizeName = 'small_image';
59
  } else {
60
+ $imageToResize = Mage::helper('xmlconnect/image')->getImageSizeForContent('product_big');
61
  $propertyToResizeName = 'image';
62
  }
63
 
64
+ $icon = clone Mage::helper('catalog/image')->init($product, $propertyToResizeName)->resize($imageToResize);
 
65
 
66
  $iconXml = $item->addChild('icon', $icon);
 
67
 
68
+ $file = Mage::helper('xmlconnect')->urlToPath($icon);
69
+ $iconXml->addAttribute('modification_time', filemtime($file));
70
+
71
+ $item->addChild('in_stock', (int)$product->getIsInStock());
72
  $item->addChild('is_salable', (int)$product->isSalable());
73
  /**
74
  * By default all products has gallery (because of collection not load gallery attribute)
87
  }
88
  $item->addChild('has_options', (int)$product->getHasOptions());
89
 
90
+ if ($minSaleQty = $this->_getMinimalQty($product)) {
91
+ $item->addChild('min_sale_qty', (int) $minSaleQty);
 
 
 
 
 
 
92
  }
93
 
94
  if (!$product->getRatingSummary()) {
99
  $item->addChild('reviews_count', $product->getRatingSummary()->getReviewsCount());
100
 
101
  if ($this->getChild('product_price')) {
102
+ $this->getChild('product_price')->setProduct($product)->setProductXmlObj($item)
103
+ ->collectProductPrices();
104
  }
105
 
106
  if ($this->getChild('additional_info')) {
136
  protected function _toHtml()
137
  {
138
  /** @var $product Mage_Catalog_Model_Product */
139
+ $product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())
140
+ ->load($this->getRequest()->getParam('id', 0));
141
+
142
+ if (!$product) {
143
+ Mage::throwException($this->__('Selected product is unavailable.'));
144
  } else {
145
+ $this->setProduct($product);
146
+ $productXmlObj = $this->productToXmlObject($product, 'product');
147
+
148
+ $relatedProductsBlock = $this->getChild('related_products');
149
+ if ($relatedProductsBlock) {
150
+ $relatedXmlObj = $relatedProductsBlock->getRelatedProductsXmlObj();
151
+ $productXmlObj->appendChild($relatedXmlObj);
152
  }
153
  }
 
 
 
 
 
 
 
 
 
154
 
155
+ $productOptions = $this->getChild('xmlconnect.catalog.product.options')
156
+ ->getProductOptionsXmlObject($product);
157
  if ($productOptions instanceof Mage_XmlConnect_Model_Simplexml_Element) {
158
  $productXmlObj->appendChild($productOptions);
159
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Attributes.php CHANGED
@@ -53,7 +53,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Attributes extends Mage_Catalog_Bloc
53
  /** @var $attrXmlObject Mage_XmlConnect_Model_Simplexml_Element */
54
  $attrXmlObject = $attributesXmlObj->addChild('item');
55
  $attrXmlObject->addCustomChild('label', $data['label']);
56
- $attrXmlObject->addCustomChild('value', $attrXmlObject->escapeXml($attribute));
57
  }
58
  }
59
  }
53
  /** @var $attrXmlObject Mage_XmlConnect_Model_Simplexml_Element */
54
  $attrXmlObject = $attributesXmlObj->addChild('item');
55
  $attrXmlObject->addCustomChild('label', $data['label']);
56
+ $attrXmlObject->addCustomChild('value', strip_tags($attribute));
57
  }
58
  }
59
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Gallery.php CHANGED
@@ -40,42 +40,43 @@ class Mage_XmlConnect_Block_Catalog_Product_Gallery extends Mage_XmlConnect_Bloc
40
  */
41
  protected function _toHtml()
42
  {
43
- $product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())
44
- ->load($this->getProductId());
45
  $collection = $product->getMediaGalleryImages();
46
 
47
  $imagesNode = Mage::getModel('xmlconnect/simplexml_element', '<images></images>');
48
- $productImageHelper = $this->helper('xmlconnect/catalog_product_image');
49
 
50
- /** @var $imageLimitsModel Mage_XmlConnect_Model_Images */
51
- $imageLimitsModel = Mage::getModel('xmlconnect/images');
52
- $gallerySmallImageSize = $imageLimitsModel->getImageLimitParam('content/product_gallery_small');
53
- $galleryBigImageSize = $imageLimitsModel->getImageLimitParam('content/product_gallery_big');
54
  foreach ($collection as $item) {
55
  $imageNode = $imagesNode->addChild('image');
56
 
57
  /**
58
  * Big image
59
  */
60
- $bigImage = $productImageHelper->init($product, 'image', $item->getFile())->constrainOnly(true)
61
- ->keepFrame(false)->resize($galleryBigImageSize);
62
 
63
  $fileNode = $imageNode->addChild('file');
64
  $fileNode->addAttribute('type', 'big');
65
  $fileNode->addAttribute('url', $bigImage);
 
 
 
66
  $fileNode->addAttribute('id', ($id = $item->getId()) ? (int) $id : 0);
67
- $fileNode->addAttribute('modification_time', filemtime($bigImage->getNewFile()));
68
 
69
  /**
70
  * Small image
71
  */
72
- $smallImage = $productImageHelper->init($product, 'thumbnail', $item->getFile())->constrainOnly(true)
73
- ->keepFrame(false)->resize($gallerySmallImageSize);
74
 
75
  $fileNode = $imageNode->addChild('file');
76
  $fileNode->addAttribute('type', 'small');
77
  $fileNode->addAttribute('url', $smallImage);
78
- $fileNode->addAttribute('modification_time', filemtime($smallImage->getNewFile()));
 
 
79
  }
80
  return $imagesNode->asNiceXml();
81
  }
40
  */
41
  protected function _toHtml()
42
  {
43
+ $productId = $this->getRequest()->getParam('id', null);
44
+ $product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($productId);
45
  $collection = $product->getMediaGalleryImages();
46
 
47
  $imagesNode = Mage::getModel('xmlconnect/simplexml_element', '<images></images>');
48
+ $helper = $this->helper('catalog/image');
49
 
 
 
 
 
50
  foreach ($collection as $item) {
51
  $imageNode = $imagesNode->addChild('image');
52
 
53
  /**
54
  * Big image
55
  */
56
+ $bigImage = $helper->init($product, 'image', $item->getFile())->constrainOnly(true)->keepFrame(false)
57
+ ->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_gallery_big'));
58
 
59
  $fileNode = $imageNode->addChild('file');
60
  $fileNode->addAttribute('type', 'big');
61
  $fileNode->addAttribute('url', $bigImage);
62
+
63
+ $file = Mage::helper('xmlconnect')->urlToPath($bigImage);
64
+
65
  $fileNode->addAttribute('id', ($id = $item->getId()) ? (int) $id : 0);
66
+ $fileNode->addAttribute('modification_time', filemtime($file));
67
 
68
  /**
69
  * Small image
70
  */
71
+ $smallImage = $helper->init($product, 'thumbnail', $item->getFile())->constrainOnly(true)->keepFrame(false)
72
+ ->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_gallery_small'));
73
 
74
  $fileNode = $imageNode->addChild('file');
75
  $fileNode->addAttribute('type', 'small');
76
  $fileNode->addAttribute('url', $smallImage);
77
+
78
+ $file = Mage::helper('xmlconnect')->urlToPath($smallImage);
79
+ $fileNode->addAttribute('modification_time', filemtime($file));
80
  }
81
  return $imagesNode->asNiceXml();
82
  }
app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice.php DELETED
@@ -1,98 +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
-
27
- /**
28
- * Item price xml renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Catalog_Product_ItemPrice extends Mage_XmlConnect_Block_Catalog
35
- {
36
- /**
37
- * Default product price renderer block factory name
38
- *
39
- * @var string
40
- */
41
- protected $_defaultPriceRenderer = 'xmlconnect/catalog_product_itemPrice_default';
42
-
43
- /**
44
- * Store supported product price xml renderers based on product types
45
- *
46
- * @var array
47
- */
48
- protected $_renderers = array();
49
-
50
- /**
51
- * Store already initialized renderers instances
52
- *
53
- * @var array
54
- */
55
- protected $_renderersInstances = array();
56
-
57
- /**
58
- * Add new product price renderer
59
- *
60
- * @param string $type
61
- * @param string $renderer
62
- * @return Mage_XmlConnect_Block_Catalog_Product_ItemPrice
63
- */
64
- public function addRenderer($type, $renderer)
65
- {
66
- if (!isset($this->_renderers[$type])) {
67
- $this->_renderers[$type] = $renderer;
68
- }
69
- return $this;
70
- }
71
-
72
- /**
73
- * Collect product prices to current xml object
74
- */
75
- public function collectProductPrices()
76
- {
77
- $product = $this->getProduct();
78
- $xmlObject = $this->getProductXmlObj();
79
-
80
- if ($product && $product->getId()) {
81
- $type = $product->getTypeId();
82
- if (isset($this->_renderers[$type])) {
83
- $blockName = $this->_renderers[$type];
84
- } else {
85
- $blockName = $this->_defaultPriceRenderer;
86
- }
87
-
88
- $renderer = $this->getLayout()->getBlock($blockName);
89
- if (!$renderer) {
90
- $renderer = $this->getLayout()->createBlock($blockName);
91
- }
92
-
93
- if ($renderer) {
94
- $renderer->collectProductPrices($product, $xmlObject);
95
- }
96
- }
97
- }
98
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Bundle.php DELETED
@@ -1,426 +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
-
27
- /**
28
- * Bundle product price xml renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Catalog_Product_ItemPrice_Bundle extends Mage_Bundle_Block_Catalog_Product_Price
35
- {
36
- /**
37
- * Collect product prices to specified item xml object
38
- *
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
- $priceListXmlObj = $item->addCustomChild('price_list');
48
-
49
- /** @var $coreHelper Mage_Core_Helper_Data */
50
- $coreHelper = $this->helper('core');
51
- /** @var $weeeHelper Mage_Weee_Helper_Data */
52
- $weeeHelper = $this->helper('weee');
53
- /** @var $taxHelper Mage_Tax_Helper_Data */
54
- $taxHelper = $this->helper('tax');
55
-
56
- $tierPrices = $this->_getTierPrices($product);
57
-
58
- if (count($tierPrices) > 0) {
59
- $tierPricesTextArray = array();
60
- foreach ($tierPrices as $price) {
61
- $discount = ' ' . ($price['price'] * 1) . '%';
62
- $tierPricesTextArray[] = $this->__('Buy %1$s with %2$s discount each', $price['price_qty'], $discount);
63
- }
64
- $item->addCustomChild('price_tier', implode(PHP_EOL, $tierPricesTextArray));
65
- }
66
-
67
- list($minimalPrice, $maximalPrice) = $product->getPriceModel()->getPrices($product);
68
-
69
- $weeeTaxAmount = 0;
70
- $minimalPriceTax = $taxHelper->getPrice($product, $minimalPrice);
71
- $minimalPriceInclTax = $taxHelper->getPrice($product, $minimalPrice, true);
72
-
73
- if ($product->getPriceType() == 1) {
74
- $weeeTaxAmount = $weeeHelper->getAmount($product);
75
- if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, array(0, 1, 4))) {
76
- $minimalPriceTax += $weeeTaxAmount;
77
- $minimalPriceInclTax += $weeeTaxAmount;
78
- }
79
- if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
80
- $minimalPriceInclTax += $weeeTaxAmount;
81
- }
82
-
83
- if ($weeeHelper->typeOfDisplay($product, array(1, 2, 4))) {
84
- $weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForDisplay($product);
85
- }
86
- }
87
-
88
- if ($product->getPriceView()) {
89
- if ($taxHelper->displayBothPrices()) {
90
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
91
- $pricesXmlObj->addCustomChild('price', $minimalPriceTax, array(
92
- 'id' => 'as_low_as_excluding_tax',
93
- 'label' => $this->__('As Low Excl. Tax'),
94
- 'formatted_value' => $coreHelper->currency($minimalPriceTax, true, false)
95
- ));
96
-
97
- if ($weeeTaxAmount && $product->getPriceType() == 1
98
- && $weeeHelper->typeOfDisplay($product, array(2, 1, 4))
99
- ) {
100
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
101
-
102
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
103
- if ($weeeHelper->typeOfDisplay($product, array(2, 4))) {
104
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
105
- } else {
106
- $amount = $weeeTaxAttribute->getAmount();
107
- }
108
-
109
- $priceWeeeXmlObj->addCustomChild('item', $amount, array(
110
- 'id' => 'weee_tax',
111
- 'label' => $weeeTaxAttribute->getName(),
112
- 'formatted_value' => $coreHelper->currency($amount, true, false)
113
- ));
114
- }
115
- }
116
-
117
- $pricesXmlObj->addCustomChild('price', $minimalPriceInclTax, array(
118
- 'id' => 'as_low_as_including_tax',
119
- 'label' => $this->__('As Low Incl. Tax'),
120
- 'formatted_value' => $coreHelper->currency($minimalPriceInclTax, true, false)
121
- ));
122
- } else {
123
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
124
- $pricesXmlObj->addCustomChild('price', $minimalPriceTax, array(
125
- 'id' => 'as_low_as',
126
- 'label' => $this->__('As Low As'),
127
- 'formatted_value' => $coreHelper->currency($minimalPriceTax, true, false)
128
- ));
129
-
130
- if ($weeeTaxAmount && $product->getPriceType() == 1
131
- && $weeeHelper->typeOfDisplay($product, array(2, 1, 4))
132
- ) {
133
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
134
-
135
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
136
- if ($weeeHelper->typeOfDisplay($product, array(2, 4))) {
137
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
138
- } else {
139
- $amount = $weeeTaxAttribute->getAmount();
140
- }
141
-
142
- $priceWeeeXmlObj->addCustomChild('item', $amount, array(
143
- 'id' => 'weee_tax',
144
- 'label' => $weeeTaxAttribute->getName(),
145
- 'formatted_value' => $coreHelper->currency($amount, true, false)
146
- ));
147
- }
148
- }
149
-
150
- if ($weeeHelper->typeOfDisplay($product, 2) && $weeeTaxAmount) {
151
- $pricesXmlObj->addCustomChild('price', $minimalPriceInclTax, array(
152
- 'id' => 'as_low_as_including_tax',
153
- 'label' => $this->__('As Low Incl. Tax'),
154
- 'formatted_value' => $coreHelper->currency($minimalPriceInclTax, true, false)
155
- ));
156
- }
157
- }
158
- /**
159
- * if ($product->getPriceView()) {
160
- */
161
- } else {
162
- if ($minimalPrice <> $maximalPrice) {
163
- if ($taxHelper->displayBothPrices()) {
164
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
165
- $pricesXmlObj->addCustomChild('price', $minimalPriceTax, array(
166
- 'id' => 'from_excluding_tax',
167
- 'label' => $this->__('From Excl. Tax'),
168
- 'formatted_value' => $coreHelper->currency($minimalPriceTax, true, false)
169
- ));
170
-
171
- if ($weeeTaxAmount && $product->getPriceType() == 1
172
- && $weeeHelper->typeOfDisplay($product, array(2, 1, 4))
173
- ) {
174
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'from_weee'));
175
-
176
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
177
- if ($weeeHelper->typeOfDisplay($product, array(2, 4))) {
178
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
179
- } else {
180
- $amount = $weeeTaxAttribute->getAmount();
181
- }
182
-
183
- $priceWeeeXmlObj->addCustomChild('item', $amount, array(
184
- 'id' => 'weee_tax',
185
- 'label' => $weeeTaxAttribute->getName(),
186
- 'formatted_value' => $coreHelper->currency($amount, true, false)
187
- ));
188
- }
189
- }
190
-
191
- $pricesXmlObj->addCustomChild('price', $minimalPriceInclTax, array(
192
- 'id' => 'from_including_tax',
193
- 'label' => $this->__('From Incl. Tax'),
194
- 'formatted_value' => $coreHelper->currency($minimalPriceInclTax, true, false)
195
- ));
196
- } else {
197
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
198
- $pricesXmlObj->addCustomChild('price', $minimalPriceTax, array(
199
- 'id' => 'from',
200
- 'label' => $this->__('From'),
201
- 'formatted_value' => $coreHelper->currency($minimalPriceTax, true, false)
202
- ));
203
-
204
- if ($weeeTaxAmount && $product->getPriceType() == 1
205
- && $weeeHelper->typeOfDisplay($product, array(2, 1, 4))
206
- ) {
207
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'from_weee'));
208
-
209
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
210
- if ($weeeHelper->typeOfDisplay($product, array(2, 4))) {
211
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
212
- } else {
213
- $amount = $weeeTaxAttribute->getAmount();
214
- }
215
-
216
- $priceWeeeXmlObj->addCustomChild('item', $amount, array(
217
- 'id' => 'weee_tax',
218
- 'label' => $weeeTaxAttribute->getName(),
219
- 'formatted_value' => $coreHelper->currency($amount, true, false)
220
- ));
221
- }
222
- }
223
-
224
- if ($weeeHelper->typeOfDisplay($product, 2) && $weeeTaxAmount) {
225
- $pricesXmlObj->addCustomChild('price', $minimalPriceInclTax, array(
226
- 'id' => 'from_including_tax',
227
- 'label' => $this->__('From Incl. Tax'),
228
- 'formatted_value' => $coreHelper->currency($minimalPriceInclTax, true, false)
229
- ));
230
- }
231
- }
232
-
233
- $maximalPriceTax = Mage::helper('tax')->getPrice($product, $maximalPrice);
234
- $maximalPriceInclTax = Mage::helper('tax')->getPrice($product, $maximalPrice, true);
235
-
236
- if ($product->getPriceType() == 1) {
237
- if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, array(0, 1, 4))) {
238
- $maximalPriceTax += $weeeTaxAmount;
239
- $maximalPriceInclTax += $weeeTaxAmount;
240
- }
241
- if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
242
- $maximalPriceInclTax += $weeeTaxAmount;
243
- }
244
- }
245
-
246
- if ($taxHelper->displayBothPrices()) {
247
- $pricesXmlObj->addCustomChild('price', $maximalPriceTax, array(
248
- 'id' => 'to_excluding_tax',
249
- 'label' => $this->__('To Excl. Tax'),
250
- 'formatted_value' => $coreHelper->currency($maximalPriceTax, true, false)
251
- ));
252
-
253
- if ($weeeTaxAmount && $product->getPriceType() == 1
254
- && $weeeHelper->typeOfDisplay($product, array(2, 1, 4))
255
- ) {
256
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
257
-
258
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
259
- if ($weeeHelper->typeOfDisplay($product, array(2, 4))) {
260
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
261
- } else {
262
- $amount = $weeeTaxAttribute->getAmount();
263
- }
264
-
265
- $priceWeeeXmlObj->addCustomChild('item', $amount, array(
266
- 'id' => 'weee_tax',
267
- 'label' => $weeeTaxAttribute->getName(),
268
- 'formatted_value' => $coreHelper->currency($amount, true, false)
269
- ));
270
- }
271
- }
272
-
273
- $pricesXmlObj->addCustomChild('price', $maximalPriceInclTax, array(
274
- 'id' => 'to_including_tax',
275
- 'label' => $this->__('To Incl. Tax'),
276
- 'formatted_value' => $coreHelper->currency($maximalPriceInclTax, true, false)
277
- ));
278
- } else {
279
- $pricesXmlObj->addCustomChild('price', $maximalPriceTax, array(
280
- 'id' => 'to',
281
- 'label' => $this->__('To'),
282
- 'formatted_value' => $coreHelper->currency($maximalPriceTax, true, false)
283
- ));
284
-
285
- if ($weeeTaxAmount && $product->getPriceType() == 1
286
- && $weeeHelper->typeOfDisplay($product, array(2, 1, 4))
287
- ) {
288
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'to_weee'));
289
-
290
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
291
- if ($weeeHelper->typeOfDisplay($product, array(2, 4))) {
292
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
293
- } else {
294
- $amount = $weeeTaxAttribute->getAmount();
295
- }
296
-
297
- $priceWeeeXmlObj->addCustomChild('item', $amount, array(
298
- 'id' => 'weee_tax',
299
- 'label' => $weeeTaxAttribute->getName(),
300
- 'formatted_value' => $coreHelper->currency($amount, true, false)
301
- ));
302
- }
303
- }
304
-
305
- if ($weeeHelper->typeOfDisplay($product, 2) && $weeeTaxAmount) {
306
- $pricesXmlObj->addCustomChild('price', $maximalPriceInclTax, array(
307
- 'id' => 'to_including_tax',
308
- 'label' => $this->__('To Incl. Tax'),
309
- 'formatted_value' => $coreHelper->currency($maximalPriceInclTax, true, false)
310
- ));
311
- }
312
- }
313
- /**
314
- * if ($minimalPrice <> $maximalPrice) {
315
- */
316
- } else {
317
- if ($taxHelper->displayBothPrices()) {
318
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
319
- $pricesXmlObj->addCustomChild('price', $minimalPriceTax, array(
320
- 'id' => 'excluding_tax',
321
- 'label' => $this->__('Excl. Tax'),
322
- 'formatted_value' => $coreHelper->currency($minimalPriceTax, true, false)
323
- ));
324
-
325
- if ($weeeTaxAmount && $product->getPriceType() == 1
326
- && $weeeHelper->typeOfDisplay($product, array(2, 1, 4))
327
- ) {
328
- $priceWeeeXmlObj = $item->addCustomChild('price', null, array('id' => 'weee'));
329
-
330
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
331
- if ($weeeHelper->typeOfDisplay($product, array(2, 4))) {
332
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
333
- } else {
334
- $amount = $weeeTaxAttribute->getAmount();
335
- }
336
-
337
- $priceWeeeXmlObj->addCustomChild('item', $amount, array(
338
- 'id' => 'weee_tax',
339
- 'label' => $weeeTaxAttribute->getName(),
340
- 'formatted_value' => $coreHelper->currency($amount, true, false)
341
- ));
342
- }
343
- }
344
-
345
- $pricesXmlObj->addCustomChild('price', $minimalPriceInclTax, array(
346
- 'id' => 'including_tax',
347
- 'label' => $this->__('Incl. Tax'),
348
- 'formatted_value' => $coreHelper->currency($minimalPriceInclTax, true, false)
349
- ));
350
- } else {
351
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
352
- $pricesXmlObj->addCustomChild('price', $minimalPriceTax, array(
353
- 'id' => 'regular',
354
- 'label' => $this->__('Regular'),
355
- 'formatted_value' => $coreHelper->currency($minimalPriceTax, true, false)
356
- ));
357
-
358
- if ($weeeTaxAmount && $product->getPriceType() == 1
359
- && $weeeHelper->typeOfDisplay($product, array(2, 1, 4))
360
- ) {
361
- $priceWeeeXmlObj = $item->addCustomChild('price', null, array('id' => 'weee'));
362
-
363
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
364
- if ($weeeHelper->typeOfDisplay($product, array(2, 4))) {
365
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
366
- } else {
367
- $amount = $weeeTaxAttribute->getAmount();
368
- }
369
-
370
- $priceWeeeXmlObj->addCustomChild('item', $amount, array(
371
- 'id' => 'weee_tax',
372
- 'label' => $weeeTaxAttribute->getName(),
373
- 'formatted_value' => $coreHelper->currency($amount, true, false)
374
- ));
375
- }
376
- }
377
-
378
- if ($weeeHelper->typeOfDisplay($product, 2) && $weeeTaxAmount) {
379
- $pricesXmlObj->addCustomChild('price', $minimalPriceInclTax, array(
380
- 'id' => 'including_tax',
381
- 'label' => $this->__('Incl. Tax'),
382
- 'formatted_value' => $coreHelper->currency($minimalPriceInclTax, true, false)
383
- ));
384
- }
385
- }
386
- }
387
- }
388
- }
389
-
390
- /**
391
- * Get tier prices (formatted)
392
- *
393
- * @param Mage_Catalog_Model_Product $product
394
- * @return array
395
- */
396
- protected function _getTierPrices($product)
397
- {
398
- if (null === $product) {
399
- return array();
400
- }
401
- $prices = $product->getFormatedTierPrice();
402
-
403
- $res = array();
404
- if (is_array($prices)) {
405
- foreach ($prices as $price) {
406
- $price['price_qty'] = $price['price_qty'] * 1;
407
- $price['savePercent'] = ceil(100 - $price['price']);
408
- $price['formated_price'] = Mage::app()->getStore()->formatPrice(
409
- Mage::app()->getStore()->convertPrice(
410
- Mage::helper('tax')->getPrice($product, $price['website_price'])
411
- ),
412
- false
413
- );
414
- $price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
415
- Mage::app()->getStore()->convertPrice(
416
- Mage::helper('tax')->getPrice($product, $price['website_price'], true)
417
- ),
418
- false
419
- );
420
- $res[] = $price;
421
- }
422
- }
423
-
424
- return $res;
425
- }
426
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Default.php DELETED
@@ -1,740 +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
-
27
- /**
28
- * Default product price xml renderer
29
- *
30
- * @category Mage
31
- * @package Mage_XmlConnect
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_XmlConnect_Block_Catalog_Product_ItemPrice_Default extends Mage_Catalog_Block_Product_Price
35
- {
36
- /**
37
- * Collect product prices to specified item xml object
38
- *
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
- $priceListXmlObj = $item->addCustomChild('price_list');
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
- * Including
83
- */
84
- if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
85
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
86
-
87
- $exclTaxValue = $price + $weeeTaxAmount;
88
- $pricesXmlObj->addCustomChild('price', $exclTaxValue, array(
89
- 'id' => 'excluding_tax',
90
- 'label' => $this->__('Excl. Tax'),
91
- 'formatted_value' => $coreHelper->currency($exclTaxValue, true, false)
92
- ));
93
-
94
- $inclTaxValue = $finalPriceInclTax + $weeeTaxAmount;
95
- $pricesXmlObj->addCustomChild('price', $inclTaxValue, array(
96
- 'id' => 'including_tax',
97
- 'label' => $this->__('Incl. Tax'),
98
- 'formatted_value' => $coreHelper->currency($inclTaxValue, true, false)
99
- ));
100
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
101
- /**
102
- * Including + Weee
103
- */
104
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
105
-
106
- $exclTaxValue = $price + $weeeTaxAmount;
107
- $pricesXmlObj->addCustomChild('price', $exclTaxValue, array(
108
- 'id' => 'excluding_tax',
109
- 'label' => $this->__('Excl. Tax'),
110
- 'formatted_value' => $coreHelper->currency($exclTaxValue, true, false)
111
- ));
112
-
113
-
114
- $inclTaxValue = $finalPriceInclTax + $weeeTaxAmount;
115
- $pricesXmlObj->addCustomChild('price', $inclTaxValue, array(
116
- 'id' => 'including_tax',
117
- 'label' => $this->__('Incl. Tax'),
118
- 'formatted_value' => $coreHelper->currency($inclTaxValue, true, false)
119
- ));
120
-
121
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
122
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
123
- $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array(
124
- 'id' => 'weee_tax',
125
- 'label' => $weeeTaxAttribute->getName(),
126
- 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
127
- ));
128
- }
129
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
130
- /**
131
- * Including + Weee
132
- */
133
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
134
-
135
- $exclTaxValue = $price + $weeeTaxAmount;
136
- $pricesXmlObj->addCustomChild('price', $exclTaxValue, array(
137
- 'id' => 'excluding_tax',
138
- 'label' => $this->__('Excl. Tax'),
139
- 'formatted_value' => $coreHelper->currency($exclTaxValue, true, false)
140
- ));
141
-
142
- $inclTaxValue = $finalPriceInclTax + $weeeTaxAmount;
143
- $pricesXmlObj->addCustomChild('price', $inclTaxValue, array(
144
- 'id' => 'including_tax',
145
- 'label' => $this->__('Incl. Tax'),
146
- 'formatted_value' => $coreHelper->currency($inclTaxValue, true, false)
147
- ));
148
-
149
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
150
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
151
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
152
- $priceWeeeXmlObj->addCustomChild('item', $amount * 1, array(
153
- 'id' => 'weee_tax',
154
- 'label' => $weeeTaxAttribute->getName(),
155
- 'formatted_value' => $coreHelper->currency($amount, true, false)
156
- ));
157
- }
158
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
159
- /**
160
- * Excluding + Weee + Final
161
- */
162
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
163
-
164
- $pricesXmlObj->addCustomChild('price', $price, array(
165
- 'id' => 'excluding_tax',
166
- 'label' => $this->__('Excl. Tax'),
167
- 'formatted_value' => $coreHelper->currency($price, true, false)
168
- ));
169
-
170
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
171
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
172
- $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array(
173
- 'id' => 'weee_tax',
174
- 'label' => $weeeTaxAttribute->getName(),
175
- 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
176
- ));
177
- }
178
-
179
- $inclTaxValue = $finalPriceInclTax + $weeeTaxAmount;
180
- $pricesXmlObj->addCustomChild('price', $inclTaxValue, array(
181
- 'id' => 'including_tax',
182
- 'label' => $this->__('Incl. Tax'),
183
- 'formatted_value' => $coreHelper->currency($inclTaxValue, true, false)
184
- ));
185
- } else {
186
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
187
- $pricesXmlObj->addCustomChild('price', $price, array(
188
- 'id' => 'excluding_tax',
189
- 'label' => $this->__('Excl. Tax'),
190
- 'formatted_value' => $coreHelper->currency($price, true, false)
191
- ));
192
-
193
- $pricesXmlObj->addCustomChild('price', $finalPriceInclTax, array(
194
- 'id' => 'including_tax',
195
- 'label' => $this->__('Incl. Tax'),
196
- 'formatted_value' => $coreHelper->currency($finalPriceInclTax, true, false)
197
- ));
198
- }
199
- /**
200
- * if ($taxHelper->displayBothPrices()) {
201
- */
202
- } else {
203
- /**
204
- * Including
205
- */
206
- if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
207
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
208
- $pricesXmlObj->addCustomChild('price', $price + $weeeTaxAmount, array(
209
- 'id' => 'regular',
210
- 'label' => $this->__('Unit Price'),
211
- 'formatted_value' => $coreHelper->currency($price + $weeeTaxAmount, true, false)
212
- ));
213
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
214
- /**
215
- * Including + Weee
216
- */
217
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
218
- $pricesXmlObj->addCustomChild('price', $price + $weeeTaxAmount, array(
219
- 'id' => 'regular',
220
- 'label' => $this->__('Unit Price'),
221
- 'formatted_value' => $coreHelper->currency($price + $weeeTaxAmount, true, false)
222
- ));
223
-
224
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
225
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
226
- $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array(
227
- 'id' => 'weee_tax',
228
- 'label' => $weeeTaxAttribute->getName(),
229
- 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
230
- ));
231
- }
232
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
233
- /**
234
- * Including + Weee
235
- */
236
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
237
- $pricesXmlObj->addCustomChild('price', $price + $weeeTaxAmount, array(
238
- 'id' => 'regular',
239
- 'label' => $this->__('Unit Price'),
240
- 'formatted_value' => $coreHelper->currency($price + $weeeTaxAmount, true, false)
241
- ));
242
-
243
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
244
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
245
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
246
- $priceWeeeXmlObj->addCustomChild('item', $amount * 1, array(
247
- 'id' => 'weee_tax',
248
- 'label' => $weeeTaxAttribute->getName(),
249
- 'formatted_value' => $coreHelper->currency($amount, true, false)
250
- ));
251
- }
252
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
253
- /**
254
- * Excluding + Weee + Final
255
- */
256
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
257
- $pricesXmlObj->addCustomChild('price', $price, array(
258
- 'id' => 'regular',
259
- 'label' => $this->__('Unit Price'),
260
- 'formatted_value' => $coreHelper->currency($price, true, false)
261
- ));
262
-
263
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
264
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
265
- $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array(
266
- 'id' => 'weee_tax',
267
- 'label' => $weeeTaxAttribute->getName(),
268
- 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
269
- ));
270
- }
271
-
272
- $pricesXmlObj->addCustomChild('price', $price + $weeeTaxAmount, array(
273
- 'id' => 'including_tax',
274
- 'label' => $this->__('Incl. Tax'),
275
- 'formatted_value' => $coreHelper->currency($price + $weeeTaxAmount, true, false)
276
- ));
277
- } else {
278
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
279
- $pricesXmlObj->addCustomChild('price', $price, array(
280
- 'id' => 'regular',
281
- 'label' => $this->__('Unit Price'),
282
- 'formatted_value' => $coreHelper->currency($price, true, false)
283
- ));
284
- }
285
- }
286
- /**
287
- * if ($finalPrice == $price) {
288
- */
289
- } else {
290
- $originalWeeeTaxAmount = $weeeHelper->getOriginalAmount($product);
291
- /**
292
- * Including
293
- */
294
- if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
295
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
296
-
297
- $unitPrice = $regularPrice + $originalWeeeTaxAmount;
298
- $pricesXmlObj->addCustomChild('price', $unitPrice, array(
299
- 'id' => 'regular',
300
- 'label' => $this->__('Unit Price'),
301
- 'formatted_value' => $coreHelper->currency($unitPrice, true, false)
302
- ));
303
- if ($taxHelper->displayBothPrices()) {
304
- $pricesXmlObj->addCustomChild('price', $finalPrice + $weeeTaxAmount, array(
305
- 'id' => 'special_excluding_tax',
306
- 'label' => $this->__('Special Excl. Tax'),
307
- 'formatted_value' => $coreHelper->currency($finalPrice + $weeeTaxAmount, true, false)
308
- ));
309
-
310
- $specialIncludingTax = $finalPriceInclTax + $weeeTaxAmount;
311
- $pricesXmlObj->addCustomChild('price', $specialIncludingTax, array(
312
- 'id' => 'special_including_tax',
313
- 'label' => $this->__('Special Incl. Tax'),
314
- 'formatted_value' => $coreHelper->currency($specialIncludingTax, true, false)
315
- ));
316
- } else {
317
- $pricesXmlObj->addCustomChild('price', $finalPrice + $weeeTaxAmount, array(
318
- 'id' => 'special',
319
- 'label' => $this->__('Special'),
320
- 'formatted_value' => $coreHelper->currency($finalPrice + $weeeTaxAmount, true, false)
321
- ));
322
- }
323
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
324
- /**
325
- * Including + Weee
326
- */
327
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
328
-
329
- $unitPrice = $regularPrice + $originalWeeeTaxAmount;
330
- $pricesXmlObj->addCustomChild('price', $unitPrice, array(
331
- 'id' => 'regular',
332
- 'label' => $this->__('Unit Price'),
333
- 'formatted_value' => $coreHelper->currency($unitPrice, true, false)
334
- ));
335
-
336
- $pricesXmlObj->addCustomChild('price', $finalPrice + $weeeTaxAmount, array(
337
- 'id' => 'special_excluding_tax',
338
- 'label' => $this->__('Special Excl. Tax'),
339
- 'formatted_value' => $coreHelper->currency($finalPrice + $weeeTaxAmount, true, false)
340
- ));
341
-
342
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'weee'));
343
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
344
- $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array(
345
- 'id' => 'weee_tax',
346
- 'label' => $weeeTaxAttribute->getName(),
347
- 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
348
- ));
349
- }
350
-
351
- $pricesXmlObj->addCustomChild('price', $finalPriceInclTax + $weeeTaxAmount, array(
352
- 'id' => 'special_including_tax',
353
- 'label' => $this->__('Special Incl. Tax'),
354
- 'formatted_value' => $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)
355
- ));
356
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
357
- /**
358
- * Including + Weee
359
- */
360
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
361
-
362
- $unitPrice = $regularPrice + $originalWeeeTaxAmount;
363
- $pricesXmlObj->addCustomChild('price', $unitPrice, array(
364
- 'id' => 'regular',
365
- 'label' => $this->__('Unit Price'),
366
- 'formatted_value' => $coreHelper->currency($unitPrice, true, false)
367
- ));
368
-
369
- $pricesXmlObj->addCustomChild('price', $finalPrice + $weeeTaxAmount, array(
370
- 'id' => 'special_excluding_tax',
371
- 'label' => $this->__('Special Excl. Tax'),
372
- 'formatted_value' => $coreHelper->currency($finalPrice + $weeeTaxAmount, true, false)
373
- ));
374
-
375
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
376
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
377
- $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
378
- $priceWeeeXmlObj->addCustomChild('item', $amount * 1, array(
379
- 'id' => 'weee_tax',
380
- 'label' => $weeeTaxAttribute->getName(),
381
- 'formatted_value' => $coreHelper->currency($amount, true, false)
382
- ));
383
- }
384
-
385
- $pricesXmlObj->addCustomChild('price', $finalPriceInclTax + $weeeTaxAmount, array(
386
- 'id' => 'special_including_tax',
387
- 'label' => $this->__('Special Incl. Tax'),
388
- 'formatted_value' => $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)
389
- ));
390
- } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
391
- /**
392
- * Excluding + Weee + Final
393
- */
394
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
395
- $pricesXmlObj->addCustomChild('price', $regularPrice, array(
396
- 'id' => 'regular',
397
- 'label' => $this->__('Unit Price'),
398
- 'formatted_value' => $coreHelper->currency($regularPrice, true, false)
399
- ));
400
-
401
- $pricesXmlObj->addCustomChild('price', $finalPrice, array(
402
- 'id' => 'special_excluding_tax',
403
- 'label' => $this->__('Special Excl. Tax'),
404
- 'formatted_value' => $coreHelper->currency($finalPrice, true, false)
405
- ));
406
-
407
- $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
408
- foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
409
- $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array(
410
- 'id' => 'weee_tax',
411
- 'label' => $weeeTaxAttribute->getName(),
412
- 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
413
- ));
414
- }
415
-
416
- $pricesXmlObj->addCustomChild('price', $finalPriceInclTax + $weeeTaxAmount, array(
417
- 'id' => 'special_including_tax',
418
- 'label' => $this->__('Special Incl. Tax'),
419
- 'formatted_value' => $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)
420
- ));
421
- } else {
422
- /**
423
- * Excluding
424
- */
425
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
426
- $pricesXmlObj->addCustomChild('price', $regularPrice, array(
427
- 'id' => 'regular',
428
- 'label' => $this->__('Unit Price'),
429
- 'formatted_value' => $coreHelper->currency($regularPrice, true, false)
430
- ));
431
-
432
- if ($taxHelper->displayBothPrices()) {
433
- $pricesXmlObj->addCustomChild('price', $finalPrice, array(
434
- 'id' => 'special_excluding_tax',
435
- 'label' => $this->__('Special Excl. Tax'),
436
- 'formatted_value' => $coreHelper->currency($finalPrice, true, false)
437
- ));
438
-
439
- $pricesXmlObj->addCustomChild('price', $finalPriceInclTax, array(
440
- 'id' => 'special_including_tax',
441
- 'label' => $this->__('Special Incl. Tax'),
442
- 'formatted_value' => $coreHelper->currency($finalPriceInclTax, true, false)
443
- ));
444
- } else {
445
- $pricesXmlObj->addCustomChild('price', $finalPrice, array(
446
- 'id' => 'special',
447
- 'label' => $this->__('Special'),
448
- 'formatted_value' => $coreHelper->currency($finalPrice, true, false)
449
- ));
450
- }
451
- }
452
- }
453
-
454
- if ($this->getDisplayMinimalPrice() && $minimalPriceValue
455
- && $minimalPriceValue < $product->getFinalPrice()
456
- ) {
457
- $minimalPriceDisplayValue = $minimalPrice;
458
-
459
- if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, array(0, 1, 4))) {
460
- $minimalPriceDisplayValue = $minimalPrice + $weeeTaxAmount;
461
- }
462
-
463
- if (!$this->getUseLinkForAsLowAs()) {
464
- $pricesXmlObj->addCustomChild('price', $minimalPriceDisplayValue, array(
465
- 'id' => 'as_low_as',
466
- 'label' => $this->__('As Low As'),
467
- 'formatted_value' => $coreHelper->currency($minimalPriceDisplayValue, true, false)
468
- ));
469
- }
470
- }
471
- /**
472
- * if (!$product->isGrouped()) {
473
- */
474
- } else {
475
- $exclTax = $taxHelper->getPrice($product, $minimalPriceValue, null);
476
- $inclTax = $taxHelper->getPrice($product, $minimalPriceValue, true);
477
-
478
- if ($this->getDisplayMinimalPrice() && $minimalPriceValue) {
479
- if ($taxHelper->displayBothPrices()) {
480
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
481
- $pricesXmlObj->addCustomChild('price', $exclTax, array(
482
- 'id' => 'starting_at_excluding_tax',
483
- 'label' => $this->__('Starting At Excl. Tax'),
484
- 'formatted_value' => $coreHelper->currency($exclTax, true, false)
485
- ));
486
-
487
- $pricesXmlObj->addCustomChild('price', $inclTax, array(
488
- 'id' => 'starting_at_including_tax',
489
- 'label' => $this->__('Starting At Incl. Tax'),
490
- 'formatted_value' => $coreHelper->currency($inclTax, true, false)
491
- ));
492
- } else {
493
- $showPrice = $inclTax;
494
- if (!$taxHelper->displayPriceIncludingTax()) {
495
- $showPrice = $exclTax;
496
- }
497
-
498
- $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
499
- $pricesXmlObj->addCustomChild('price', $showPrice, array(
500
- 'id' => 'starting_at',
501
- 'label' => $this->__('Starting At'),
502
- 'formatted_value' => $coreHelper->currency($showPrice, true, false)
503
- ));
504
- }
505
- }
506
- }
507
- }
508
-
509
- /**
510
- * Get tier prices (formatted)
511
- *
512
- * @param Mage_Catalog_Model_Product $product
513
- * @return array
514
- */
515
- protected function _getTierPrices(Mage_Catalog_Model_Product $product)
516
- {
517
- if (null === $product) {
518
- return array();
519
- }
520
- $prices = $product->getFormatedTierPrice();
521
-
522
- $res = array();
523
- if (is_array($prices)) {
524
- foreach ($prices as $price) {
525
- $price['price_qty'] = $price['price_qty']*1;
526
- if ($product->getPrice() != $product->getFinalPrice()) {
527
- if ($price['price'] < $product->getFinalPrice()) {
528
- $price['savePercent'] = ceil(100 - ((100 / $product->getFinalPrice()) * $price['price']));
529
- $price['formated_price'] = Mage::app()->getStore()->formatPrice(
530
- Mage::app()->getStore()->convertPrice(
531
- Mage::helper('tax')->getPrice($product, $price['website_price'])
532
- ),
533
- false
534
- );
535
- $price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
536
- Mage::app()->getStore()->convertPrice(Mage::helper('tax')->getPrice(
537
- $product, $price['website_price'], true
538
- )),
539
- false
540
- );
541
- $res[] = $price;
542
- }
543
- } else {
544
- if ($price['price'] < $product->getPrice()) {
545
- $price['savePercent'] = ceil(100 - ((100 / $product->getPrice()) * $price['price']));
546
- $price['formated_price'] = Mage::app()->getStore()->formatPrice(
547
- Mage::app()->getStore()->convertPrice(Mage::helper('tax')->getPrice(
548
- $product, $price['website_price']
549
- )),
550
- false
551
- );
552
- $price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
553
- Mage::app()->getStore()->convertPrice(Mage::helper('tax')->getPrice(
554
- $product, $price['website_price'], true
555
- )),
556
- false
557
- );
558
- $res[] = $price;
559
- }
560
- }
561
- }
562
- }
563
-
564
- return $res;
565
- }
566
-
567
- /**
568
- * Get tier prices (formatted) as array of strings
569
- *
570
- * @param array $tierPrices
571
- * @param Mage_Catalog_Model_Product $product
572
- * @return array
573
- */
574
- protected function _getTierPricesTextArray($tierPrices, $product)
575
- {
576
-
577
- $pricesArray = array();
578
- if (Mage::helper('weee')->typeOfDisplay($product, array(1, 2, 4))) {
579
- $weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($product);
580
- }
581
-
582
- if ($product->isGrouped()) {
583
- $tierPrices = $this->getTierPrices($product);
584
- }
585
- Mage::helper('weee')->processTierPrices($product, $tierPrices);
586
-
587
- foreach ($tierPrices as $price) {
588
- $s = '';
589
- if ($this->helper('tax')->displayBothPrices()) {
590
- if (Mage::helper('weee')->typeOfDisplay($product, 0)) {
591
- $s .= $this->__('Buy %1$s for %2$s (%3$s incl. tax) each', $price['price_qty'], $price['formated_price_incl_weee_only'], $price['formated_price_incl_weee']);
592
- } else if (Mage::helper('weee')->typeOfDisplay($product, 1)) {
593
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee_only']);
594
- if ($weeeTaxAttributes) {
595
- $s .= ' (' . $this->__('%1$s incl tax.', $price['formated_price_incl_weee']);
596
- $separator = ' + ';
597
- foreach ($weeeTaxAttributes as $attribute) {
598
- $s .= $separator . $attribute->getName() . ': ';
599
- $s .= Mage::helper('core')->currency($attribute->getAmount());
600
- }
601
- $s .= ')';
602
- }
603
- $s .= ' ' . $this->__('each');
604
- } else if (Mage::helper('weee')->typeOfDisplay($product, 4)) {
605
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee_only']);
606
- if ($weeeTaxAttributes) {
607
- $s .= ' (' . $this->__('%1$s incl tax.', $price['formated_price_incl_weee']);
608
- $separator = ' + ';
609
- foreach ($weeeTaxAttributes as $attribute) {
610
- $s .= $separator . $attribute->getName() . ': ';
611
- $s .= Mage::helper('core')->currency(
612
- $attribute->getAmount() + $attribute->getTaxAmount()
613
- );
614
- }
615
- $s .= ')';
616
- }
617
- $s .= ' ' . $this->__('each');
618
- } else if (Mage::helper('weee')->typeOfDisplay($product, 2)) {
619
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price']);
620
- if ($weeeTaxAttributes) {
621
- $s .= ' (';
622
- foreach ($weeeTaxAttributes as $attribute) {
623
- $s .= $attribute->getName() . ': ';
624
- $s .= Mage::helper('core')->currency($attribute->getAmount());
625
- }
626
- $s .= ' ' . $this->__('Total incl. Tax: %1$s', $price['formated_price_incl_weee']) . ')';
627
- }
628
- $s .= ' ' . $this->__('each');
629
- } else {
630
- $s .= $this->__('Buy %1$s for %2$s (%3$s incl. tax) each', $price['price_qty'], $price['formated_price'], $price['formated_price_incl_tax']);
631
- }
632
- } else {
633
- if ($this->helper('tax')->displayPriceIncludingTax()) {
634
- if (Mage::helper('weee')->typeOfDisplay($product, 0)) {
635
- $s .= $this->__('Buy %1$s for %2$s each', $price['price_qty'], $price['formated_price_incl_weee']);
636
- } else if (Mage::helper('weee')->typeOfDisplay($product, 1)) {
637
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee']);
638
- if ($weeeTaxAttributes) {
639
- $s .= ' (';
640
- $separator = '';
641
- foreach ($weeeTaxAttributes as $attribute) {
642
- $s .= $separator . $attribute->getName() . ': ';
643
- $s .= Mage::helper('core')->currency($attribute->getAmount());
644
- $separator = ' + ';
645
- }
646
- $s .= ')';
647
- }
648
- $s .= ' ' . $this->__('each');
649
- } else if (Mage::helper('weee')->typeOfDisplay($product, 4)) {
650
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee']);
651
- if ($weeeTaxAttributes) {
652
- $s .= ' (';
653
- $separator = '';
654
- foreach ($weeeTaxAttributes as $attribute) {
655
- $s .= $separator . $attribute->getName() . ': ';
656
- $s .= Mage::helper('core')->currency(
657
- $attribute->getAmount() + $attribute->getTaxAmount()
658
- );
659
- $separator = ' + ';
660
- }
661
- $s .= ')';
662
- }
663
- $s .= ' ' . $this->__('each');
664
- } else if (Mage::helper('weee')->typeOfDisplay($product, 2)) {
665
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_tax']);
666
- if ($weeeTaxAttributes) {
667
- $s .= ' (';
668
- foreach ($weeeTaxAttributes as $attribute) {
669
- $s .= $attribute->getName() . ': ';
670
- $s .= Mage::helper('core')->currency($attribute->getAmount());
671
- }
672
- $s .= ' ' . $this->__('Total incl. Tax: %1$s', $price['formated_price_incl_weee']) . ')';
673
- }
674
- $s .= ' ' . $this->__('each');
675
- } else {
676
- $s .= $this->__('Buy %1$s for %2$s each', $price['price_qty'], $price['formated_price_incl_tax']);
677
- }
678
- } else {
679
- if (Mage::helper('weee')->typeOfDisplay($product, 0)) {
680
- $s .= $this->__('Buy %1$s for %2$s each', $price['price_qty'], $price['formated_price_incl_weee_only']);
681
- } else if (Mage::helper('weee')->typeOfDisplay($product, 1)) {
682
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee_only']);
683
- if ($weeeTaxAttributes) {
684
- $s .= ' (';
685
- $separator = '';
686
- foreach ($weeeTaxAttributes as $attribute) {
687
- $s .= $separator . $attribute->getName() . ': ';
688
- $s .= Mage::helper('core')->currency($attribute->getAmount());
689
- $separator = ' + ';
690
- }
691
- $s .= ')';
692
- }
693
- $s .= ' ' . $this->__('each');
694
- } else if (Mage::helper('weee')->typeOfDisplay($product, 4)) {
695
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee_only']);
696
- if ($weeeTaxAttributes) {
697
- $s .= ' (';
698
- $separator = '';
699
- foreach ($weeeTaxAttributes as $attribute) {
700
- $s .= $separator . $attribute->getName() . ': ';
701
- $s .= Mage::helper('core')->currency(
702
- $attribute->getAmount() + $attribute->getTaxAmount()
703
- );
704
- $separator = ' + ';
705
- }
706
- $s .= ')';
707
- }
708
- $s .= ' ' . $this->__('each');
709
- } else if (Mage::helper('weee')->typeOfDisplay($product, 2)) {
710
- $s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price']);
711
- if ($weeeTaxAttributes) {
712
- $s .= ' (';
713
- foreach ($weeeTaxAttributes as $attribute) {
714
- $s .= $attribute->getName() . ': ';
715
- $s .= Mage::helper('core')->currency($attribute->getAmount());
716
- }
717
- $s .= ' ' . $this->__('Total incl. Tax: %1$s', $price['formated_price_incl_weee_only']) . ')';
718
- }
719
- $s .= ' ' . $this->__('each');
720
- } else {
721
- $s .= $this->__('Buy %1$s for %2$s each', $price['price_qty'], $price['formated_price']);
722
- }
723
- }
724
- }
725
- if (!$product->isGrouped()) {
726
- $condition1 = ($product->getPrice() == $product->getFinalPrice()
727
- && $product->getPrice() > $price['price']);
728
-
729
- $condition2 = ($product->getPrice() != $product->getFinalPrice()
730
- && $product->getFinalPrice() > $price['price']);
731
-
732
- if ($condition1 || $condition2) {
733
- $s .= ' ' . $this->__('and') . ' ' . $this->__('save') . ' ' . $price['savePercent'] . '%';
734
- }
735
- }
736
- $pricesArray[] = $s;
737
- }
738
- return $pricesArray;
739
- }
740
- }