Version Notes
1.7.0.1.23.0 version of package
internal svn revision #3cd616975d5927903d4f34bde0d9e5e2e727e9ba
Download this release
Release Info
Developer | Magento Core Team |
Extension | Magento_Mobile |
Version | 1.7.0.1.23.0 |
Comparing to | |
See all releases |
Code changes from version 1.7.0.1.22.1 to 1.7.0.1.23.0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit.php +71 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Form.php +55 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tab/Settings.php +108 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tabs.php +62 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Config.php +68 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard.php +249 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/BestSellers.php +113 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/Customers.php +129 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphAmountsData.php +71 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphDataAbstract.php +350 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphInfo.php +160 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphOrderData.php +71 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphTotalsData.php +123 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastOrders.php +85 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/LastSearchTerms.php +118 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/MostViewedProducts.php +117 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/NewCustomers.php +129 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/SalesInfo.php +119 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/StoreSwitcher.php +198 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/TopSearchTerms.php +114 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Loginform.php +70 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/History.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/History/Grid.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile.php +3 -7
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Form.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Submission.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Cache.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php +55 -35
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Images.php +24 -9
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Tabs.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Themes.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Images.php +192 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Preview.php +4 -7
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Themes.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Flurryanalytics.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/General.php +9 -9
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Notification.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/OfflineCatalog.php +115 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Payment.php +3 -15
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Settings.php +11 -15
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Social.php +12 -27
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Submission/History.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tabs.php +3 -6
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Addrow.php +9 -19
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Color.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Country.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Datetime.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Font.php +3 -6
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Image.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Page.php +5 -8
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Tabs.php +4 -7
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Theme.php +4 -6
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Bool.php +3 -7
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Type.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Content.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Tabitems.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Form.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Androidmarket.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Istore.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php +18 -18
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tabs.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Widget/Form.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit.php +3 -5
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit/Form.php +8 -11
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php +4 -5
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Action.php +3 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Application.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Id.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Msgtitle.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Pushtitle.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Status.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Template.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit.php +6 -5
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit/Form.php +4 -9
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Application.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Name.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview/Form.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Cart.php +31 -19
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals.php +95 -0
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Default.php +93 -0
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Grandtotal.php +107 -0
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Default.php +63 -0
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Giftcardaccount.php +69 -0
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Shipping.php +113 -0
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Subtotal.php +108 -0
- app/code/core/Mage/XmlConnect/Block/Cart/Crosssell.php +7 -8
- app/code/core/Mage/XmlConnect/Block/Cart/Info.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer.php +260 -66
- app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Configurable.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Grouped.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Cart/Items.php +254 -0
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php +6 -10
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/OrderDetails.php +83 -0
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Review.php +16 -14
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php +105 -29
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php +2 -5
- app/code/core/Mage/XmlConnect/Block/Cart/Totals.php +6 -9
- app/code/core/Mage/XmlConnect/Block/Catalog.php +60 -6
- app/code/core/Mage/XmlConnect/Block/Catalog/Category.php +11 -7
- app/code/core/Mage/XmlConnect/Block/Catalog/Category/Info.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php +3 -2
- app/code/core/Mage/XmlConnect/Block/Catalog/Product.php +36 -26
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Attributes.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Gallery.php +14 -15
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice.php +98 -0
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Bundle.php +426 -0
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Default.php +740 -0
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Giftcard.php +98 -0
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/List.php +18 -10
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php +85 -2
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php +33 -17
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php +36 -27
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Downloadable.php +113 -0
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Giftcard.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php +12 -12
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Simple.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Virtual.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php +141 -159
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php +266 -268
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Giftcard.php +9 -8
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Related.php +3 -3
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review.php +2 -1
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review/List.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Catalog/Search.php +5 -5
- app/code/core/Mage/XmlConnect/Block/Catalog/Search/Suggest.php +2 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Address/Billing.php +3 -4
- app/code/core/Mage/XmlConnect/Block/Checkout/Address/Form.php +44 -95
- app/code/core/Mage/XmlConnect/Block/Checkout/Address/Shipping.php +2 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Agreements.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer.php +48 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Bundle.php +49 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Configurable.php +53 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Downloadable.php +49 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Giftcard.php +49 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Grouped.php +52 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address.php +69 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/Form.php +114 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/List.php +112 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Review.php +64 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review/Info.php +29 -19
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Authorizenet.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Ccsave.php +4 -4
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Checkmo.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Authorizenet.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Ccsave.php +3 -3
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Checkmo.php +2 -4
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Free.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Abstract.php +5 -8
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Express.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Mecl.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Authorizenet.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Paypal/Direct.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Paypaluk/Direct.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Verisign.php +4 -6
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Purchaseorder.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/List.php +120 -61
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/ListApi23.php +133 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Direct.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Payflow.php +10 -10
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Abstract.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Authorizenet.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Paypal.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Paypaluk.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Verisign.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Purchaseorder.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Pbridge/Result.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Shipping/Method/Available.php +18 -17
- app/code/core/Mage/XmlConnect/Block/Checkout/Shipping/Method/AvailableList.php +82 -0
- app/code/core/Mage/XmlConnect/Block/Cms/Page.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Configuration.php +40 -21
- app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php +47 -80
- app/code/core/Mage/XmlConnect/Block/Customer/Address/List.php +13 -13
- app/code/core/Mage/XmlConnect/Block/Customer/Downloads.php +80 -0
- app/code/core/Mage/XmlConnect/Block/Customer/Form.php +151 -48
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Boolean.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Date.php +17 -15
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/File.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Image.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Multiline.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Multiselect.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Select.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Text.php +6 -5
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Textarea.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/GiftcardCheck.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Details.php +11 -14
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Bundle.php +143 -12
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Default.php +74 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Downloadable.php +85 -14
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Giftcard.php +3 -3
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Grouped.php +6 -4
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Items.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Customer/Order/List.php +14 -16
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals.php +61 -11
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance.php +26 -2
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance/Refunded.php +26 -4
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Giftcards.php +40 -6
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Tax.php +45 -4
- app/code/core/Mage/XmlConnect/Block/Customer/Storecredit.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Home.php +6 -4
- app/code/core/Mage/XmlConnect/Block/Homebanners.php +156 -0
- app/code/core/Mage/XmlConnect/Block/Localization.php +55 -0
- app/code/core/Mage/XmlConnect/Block/Review/Form.php +3 -2
- app/code/core/Mage/XmlConnect/Block/ShoppingCart.php +108 -0
- app/code/core/Mage/XmlConnect/Block/Wishlist.php +7 -6
- app/code/core/Mage/XmlConnect/Controller/Action.php +37 -12
- app/code/core/Mage/XmlConnect/Controller/AdminAction.php +192 -0
- app/code/core/Mage/XmlConnect/Helper/AdminApplication.php +134 -0
- app/code/core/Mage/XmlConnect/Helper/Adminhtml/Dashboard/Order.php +68 -0
- app/code/core/Mage/XmlConnect/Helper/Android.php +43 -65
- app/code/core/Mage/XmlConnect/Helper/Catalog/Category/Image.php +59 -5
- app/code/core/Mage/XmlConnect/Helper/Catalog/Product/Image.php +46 -0
- app/code/core/Mage/XmlConnect/Helper/Customer/Form/Renderer.php +179 -1
- app/code/core/Mage/XmlConnect/Helper/Customer/Order.php +194 -32
- app/code/core/Mage/XmlConnect/Helper/Data.php +128 -33
- app/code/core/Mage/XmlConnect/Helper/Device/Abstract.php +309 -0
- app/code/core/Mage/XmlConnect/Helper/Image.php +50 -23
- app/code/core/Mage/XmlConnect/Helper/Ipad.php +66 -113
- app/code/core/Mage/XmlConnect/Helper/Iphone.php +40 -205
- app/code/core/Mage/XmlConnect/Helper/OfflineCatalog.php +307 -0
- app/code/core/Mage/XmlConnect/Helper/Payment.php +1 -1
- app/code/core/Mage/XmlConnect/Helper/Theme.php +49 -8
- app/code/core/Mage/XmlConnect/Helper/Translate.php +514 -0
- app/code/core/Mage/XmlConnect/Model/Adminhtml/Search/Catalog.php +71 -0
- app/code/core/Mage/XmlConnect/Model/Adminhtml/Search/Category.php +70 -0
- app/code/core/Mage/XmlConnect/Model/Adminhtml/System/Config/Backend/Baseurl.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Adminhtml/System/Config/Backend/Currency/Default.php +2 -2
- app/code/core/Mage/XmlConnect/Model/Application.php +195 -77
- app/code/core/Mage/XmlConnect/Model/Catalog/Category/Image.php +29 -12
- app/code/core/Mage/XmlConnect/Model/Catalog/Category/Media/Config.php +1 -1
- app/code/core/Mage/XmlConnect/Model/ConfigData.php +122 -10
- app/code/core/Mage/XmlConnect/Model/Configuration.php +271 -0
- app/code/core/Mage/XmlConnect/Model/Device/Abstract.php +179 -0
- app/code/core/Mage/XmlConnect/Model/Device/Android.php +111 -0
- app/code/core/Mage/XmlConnect/Model/Device/Ipad.php +174 -0
- app/code/core/Mage/XmlConnect/Model/Device/Iphone.php +117 -0
- app/code/core/Mage/XmlConnect/Model/History.php +1 -1
- app/code/core/Mage/XmlConnect/Model/ImageAction.php +321 -0
- app/code/core/Mage/XmlConnect/Model/ImageLimits.php +366 -0
- app/code/core/Mage/XmlConnect/Model/ImageLimits/Abstract.php +295 -0
- app/code/core/Mage/XmlConnect/Model/Images.php +551 -0
- app/code/core/Mage/XmlConnect/Model/Mysql4/Application.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/Application/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/Cms/Page/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/ConfigData.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/ConfigData/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/Filter/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/History.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/History/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/Queue.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/Queue/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/Setup.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/Template.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Mysql4/Template/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Observer.php +78 -8
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog.php +117 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Abstract.php +66 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category.php +120 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category/Category.php +61 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category/IndexCategory.php +61 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Config.php +77 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Home.php +61 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Homebanners.php +61 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product.php +111 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Gallery.php +61 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Product.php +61 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Review.php +61 -0
- app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Config.php +16 -1
- app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mecl.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mep.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Paypal/Mecl/Checkout.php +25 -1
- app/code/core/Mage/XmlConnect/Model/Paypal/Mep/Checkout.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Preview/Abstract.php +58 -6
- app/code/core/Mage/XmlConnect/Model/Preview/Android.php +14 -7
- app/code/core/Mage/XmlConnect/Model/Preview/Ipad.php +50 -45
- app/code/core/Mage/XmlConnect/Model/Preview/Iphone.php +0 -0
app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit.php
ADDED
@@ -0,0 +1,71 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,55 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,108 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,62 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,68 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,249 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,113 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,129 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,71 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,350 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,160 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,71 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,123 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,85 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,118 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,117 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,129 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,119 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,198 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,114 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,70 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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/History.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/History/Grid.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -40,12 +40,8 @@ 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(
|
44 |
-
|
45 |
-
);
|
46 |
-
$this->_headerText = $this->__('Manage Apps')
|
47 |
-
. ' '
|
48 |
-
. $this->__('ver. %s', $xmlconnectVersion);
|
49 |
Â
$this->_addButtonLabel = $this->__('Add App');
|
50 |
Â
|
51 |
Â
parent::__construct();
|
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 |
Â
|
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();
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Form.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Submission.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Cache.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -35,6 +35,11 @@ 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 |
Â
protected $_pages;
|
39 |
Â
|
40 |
Â
/**
|
@@ -45,63 +50,58 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
|
|
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 |
-
|
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 |
-
$
|
76 |
-
|
77 |
-
|
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 |
-
|
85 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
86 |
Â
|
87 |
-
$
|
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 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
Â
|
101 |
-
$
|
102 |
-
|
103 |
-
$form->setValues($data);
|
104 |
-
return parent::_prepareForm();
|
105 |
Â
}
|
106 |
Â
|
107 |
Â
/**
|
@@ -143,4 +143,24 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
|
|
143 |
Â
{
|
144 |
Â
return false;
|
145 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
146 |
Â
}
|
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 |
Â
|
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 |
Â
{
|
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 |
Â
{
|
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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion.php
CHANGED
@@ -20,12 +20,12 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
27 |
Â
/**
|
28 |
-
* Tab design accordion
|
29 |
Â
*
|
30 |
Â
* @category Mage
|
31 |
Â
* @package Mage_Xmlconnect
|
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 accordion block renderer
|
29 |
Â
*
|
30 |
Â
* @category Mage
|
31 |
Â
* @package Mage_Xmlconnect
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Images.php
CHANGED
@@ -20,13 +20,14 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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,6 +38,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
|
|
37 |
Â
/**
|
38 |
Â
* Getter for accordion item title
|
39 |
Â
*
|
Â
|
|
40 |
Â
* @return string
|
41 |
Â
*/
|
42 |
Â
public function getTitle()
|
@@ -47,6 +49,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
|
|
47 |
Â
/**
|
48 |
Â
* Getter for accordion item is open flag
|
49 |
Â
*
|
Â
|
|
50 |
Â
* @return bool
|
51 |
Â
*/
|
52 |
Â
public function getIsOpen()
|
@@ -57,6 +60,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
|
|
57 |
Â
/**
|
58 |
Â
* Prepare form
|
59 |
Â
*
|
Â
|
|
60 |
Â
* @throws Mage_Core_Exception
|
61 |
Â
* @return Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
|
62 |
Â
*/
|
@@ -69,7 +73,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
|
|
69 |
Â
$this->addImage($fieldset,
|
70 |
Â
'conf[native][navigationBar][icon]',
|
71 |
Â
$this->__('Logo in Header'),
|
72 |
-
$this->__('Recommended size
|
73 |
Â
$this->_getDesignPreviewImageUrl('conf/native/navigationBar/icon'),
|
74 |
Â
true
|
75 |
Â
);
|
@@ -80,14 +84,18 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
|
|
80 |
Â
$this->addImage($fieldset,
|
81 |
Â
'conf[native][body][bannerImage]',
|
82 |
Â
$this->__('Banner on Home Screen'),
|
83 |
-
$this->__('Recommended size
|
Â
|
|
Â
|
|
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
|
Â
|
|
Â
|
|
91 |
Â
$this->_getDesignPreviewImageUrl('conf/native/body/backgroundImage'),
|
92 |
Â
true
|
93 |
Â
);
|
@@ -96,28 +104,32 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
|
|
96 |
Â
$this->addImage($fieldset,
|
97 |
Â
'conf[native][body][bannerIpadLandscapeImage]',
|
98 |
Â
$this->__('Banner on Home Screen <br />(landscape mode)'),
|
99 |
-
$this->__('Recommended size
|
Â
|
|
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
|
Â
|
|
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
|
Â
|
|
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
|
Â
|
|
121 |
Â
$this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadPortraitImage'),
|
122 |
Â
true
|
123 |
Â
);
|
@@ -126,7 +138,9 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
|
|
126 |
Â
$this->addImage($fieldset,
|
127 |
Â
'conf[native][body][bannerAndroidImage]',
|
128 |
Â
$this->__('Banner on Home Screen'),
|
129 |
-
$this->__('Recommended size
|
Â
|
|
Â
|
|
130 |
Â
$this->_getDesignPreviewImageUrl('conf/native/body/bannerAndroidImage'),
|
131 |
Â
true
|
132 |
Â
);
|
@@ -146,6 +160,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
|
|
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 |
Â
*/
|
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 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 |
Â
/**
|
39 |
Â
* Getter for accordion item title
|
40 |
Â
*
|
41 |
+
* @deprecated will delete in the next version
|
42 |
Â
* @return string
|
43 |
Â
*/
|
44 |
Â
public function getTitle()
|
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 |
Â
/**
|
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 |
Â
$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 |
Â
$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 |
Â
$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 |
Â
$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 |
Â
/**
|
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 |
Â
*/
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Tabs.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Themes.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Images.php
ADDED
@@ -0,0 +1,192 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
@@ -20,19 +20,18 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
27 |
Â
/**
|
28 |
-
* Tab design preview
|
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,9 +44,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Preview
|
|
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);
|
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 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 |
Â
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);
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Themes.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Flurryanalytics.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/General.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -100,16 +100,16 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_General
|
|
100 |
Â
}
|
101 |
Â
|
102 |
Â
$fieldset->addField('showdev', 'select', array(
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
Â
));
|
109 |
Â
|
110 |
Â
$fieldset->addField('devtype', 'hidden', array(
|
111 |
-
|
112 |
-
|
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)
|
157 |
Â
}
|
158 |
Â
|
159 |
Â
/**
|
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 |
Â
|
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/Notification.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/OfflineCatalog.php
ADDED
@@ -0,0 +1,115 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -80,7 +80,6 @@ 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_IPHONE:
|
84 |
Â
case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
|
85 |
Â
/**
|
86 |
Â
* PayPal MEP management
|
@@ -192,13 +191,13 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Payment
|
|
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,17 +223,6 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Payment
|
|
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(
|
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 |
Â
|
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 |
Â
)
|
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 |
Â
'value' => $paypalMeclActive,
|
224 |
Â
'disabled' => !$paypalMeclIsAvailable
|
225 |
Â
));
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
226 |
Â
break;
|
227 |
Â
default:
|
228 |
Â
Mage::throwException(
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Settings.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -37,15 +37,11 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Settings
|
|
37 |
Â
{
|
38 |
Â
protected function _prepareLayout()
|
39 |
Â
{
|
40 |
-
$this->setChild('continue_button',
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
'class' => 'save'
|
46 |
-
)
|
47 |
-
)
|
48 |
-
);
|
49 |
Â
return parent::_prepareLayout();
|
50 |
Â
}
|
51 |
Â
|
@@ -63,11 +59,11 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Settings
|
|
63 |
Â
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Device Information')));
|
64 |
Â
|
65 |
Â
$fieldset->addField('type', 'select', array(
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
Â
));
|
72 |
Â
|
73 |
Â
$fieldset->addField('continue_button', 'note', array(
|
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 |
Â
|
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 |
Â
$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(
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Social.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -60,9 +60,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Social
|
|
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,16 +111,11 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Social
|
|
113 |
Â
)
|
114 |
Â
);
|
115 |
Â
|
116 |
-
$fieldsetTwitter->addField(
|
117 |
-
'
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
$noteText,
|
122 |
-
Mage::getStoreConfig(Mage_XmlConnect_Model_Application::XML_PATH_HOWTO_TWITTER_URL)
|
123 |
-
),
|
124 |
-
)
|
125 |
-
);
|
126 |
Â
|
127 |
Â
/**
|
128 |
Â
* Facebook fieldset options
|
@@ -163,23 +156,15 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Social
|
|
163 |
Â
)
|
164 |
Â
);
|
165 |
Â
|
166 |
-
$fieldsetFacebook->addField(
|
167 |
-
'
|
168 |
-
|
169 |
-
|
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]'];
|
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 |
Â
|
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 |
Â
)
|
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 |
Â
)
|
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]'];
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Submission/History.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -79,7 +79,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Submission_History
|
|
79 |
Â
*/
|
80 |
Â
public function canShowTab()
|
81 |
Â
{
|
82 |
-
return (bool)
|
83 |
Â
}
|
84 |
Â
|
85 |
Â
/**
|
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 |
Â
|
79 |
Â
*/
|
80 |
Â
public function canShowTab()
|
81 |
Â
{
|
82 |
+
return (bool)$this->_getApplication()->getId();
|
83 |
Â
}
|
84 |
Â
|
85 |
Â
/**
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tabs.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,11 +31,9 @@
|
|
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,8 +54,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tabs
|
|
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 |
Â
));
|
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 |
Â
|
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 |
Â
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 |
Â
));
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Addrow.php
CHANGED
@@ -20,19 +20,19 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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,17 +41,9 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow
|
|
41 |
Â
*/
|
42 |
Â
public function getElementHtml()
|
43 |
Â
{
|
44 |
-
$html = $this->getBeforeElementHtml()
|
45 |
-
. '
|
46 |
-
. '
|
47 |
-
. $this->getName()
|
48 |
-
. '" value="'.$this->getEscapedValue()
|
49 |
-
. '" '
|
50 |
-
. $this->serialize($this->getHtmlAttributes())
|
51 |
-
. ' ><span><span><span>'
|
52 |
-
. $this->getEscapedValue()
|
53 |
-
. '</span></span></span></button>'
|
54 |
-
. $this->getAfterElementHtml();
|
55 |
Â
return $html;
|
56 |
Â
}
|
57 |
Â
|
@@ -74,10 +66,8 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow
|
|
74 |
Â
public function getLabelHtml($idSuffix = '')
|
75 |
Â
{
|
76 |
Â
if ($this->getLabel() !== null) {
|
77 |
-
$html = '<label for="' . $this->getHtmlId() . $idSuffix . '">'
|
78 |
-
. $this->
|
79 |
-
. ($this->getRequired() ? ' <span class="required">*</span>' : '')
|
80 |
-
. '</label>';
|
81 |
Â
} else {
|
82 |
Â
$html = '';
|
83 |
Â
}
|
@@ -93,7 +83,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow
|
|
93 |
Â
public function toHtml()
|
94 |
Â
{
|
95 |
Â
$blockClassName = Mage::getConfig()->getBlockClassName('adminhtml/template');
|
96 |
-
$jsBlock =
|
97 |
Â
$jsBlock->setTemplate('xmlconnect/form/element/addrow.phtml');
|
98 |
Â
$jsBlock->setOptions($this->getOptions());
|
99 |
Â
return parent::toHtml() . $jsBlock->toHtml();
|
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 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 |
Â
*/
|
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 |
Â
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 |
Â
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();
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Color.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Country.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Datetime.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Font.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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,9 +96,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Font
|
|
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 |
Â
}
|
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 |
Â
|
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 |
Â
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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Image.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Page.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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,10 +97,8 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Page
|
|
98 |
Â
public function getElementHtml()
|
99 |
Â
{
|
100 |
Â
list($label, $element) = $this->getElements();
|
101 |
-
return $element->toHtml()
|
102 |
-
. '
|
103 |
-
. '
|
104 |
-
. Mage::helper('xmlconnect')->__('Delete')
|
105 |
-
. '</span></span></span></button>';
|
106 |
Â
}
|
107 |
Â
}
|
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 |
Â
|
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 |
Â
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="−"><span>'
|
102 |
+
. Mage::helper('xmlconnect')->__('Delete') . '</span></button>';
|
Â
|
|
Â
|
|
103 |
Â
}
|
104 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Tabs.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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,14 +45,12 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Tabs
|
|
46 |
Â
}
|
47 |
Â
|
48 |
Â
$blockClassName = Mage::getConfig()->getBlockClassName('adminhtml/template');
|
49 |
-
$block =
|
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);
|
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 |
Â
|
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 |
Â
}
|
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);
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Theme.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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,9 +40,8 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Theme
|
|
41 |
Â
*/
|
42 |
Â
public function getHtml()
|
43 |
Â
{
|
44 |
-
$blockClassName = Mage::getConfig()
|
45 |
-
|
46 |
-
$block = new $blockClassName;
|
47 |
Â
$block->setThemes($this->getThemes());
|
48 |
Â
$block->setName($this->getName());
|
49 |
Â
$block->setValue($this->getValue());
|
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 |
Â
|
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 |
Â
*/
|
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());
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Bool.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -46,14 +46,10 @@ 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="'
|
50 |
-
. Mage::helper('xmlconnect/image')->getSkinImagesUrl('gel_green.png')
|
51 |
-
. '" > '
|
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 |
-
. '" > '
|
57 |
Â
. (isset($options[$status]) ? $options[$status] : '');
|
58 |
Â
}
|
59 |
Â
return $result;
|
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 |
Â
|
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') . '" > '
|
Â
|
|
Â
|
|
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') . '" > '
|
Â
|
|
Â
|
|
53 |
Â
. (isset($options[$status]) ? $options[$status] : '');
|
54 |
Â
}
|
55 |
Â
return $result;
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Type.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Content.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Tabitems.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Form.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Androidmarket.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Istore.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -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' => '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). Required size:
|
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:
|
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:
|
280 |
Â
|
281 |
Â
$this->addImage($fieldset, 'conf/submit/logo', $this->__('Custom App Icon'),
|
282 |
-
$this->__('Icon that will appear on the user
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
321 |
Â
break;
|
322 |
Â
}
|
323 |
Â
|
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 |
Â
|
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 |
Â
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tabs.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Widget/Form.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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,8 +65,7 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit
|
|
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 |
Â
|
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 |
Â
|
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 |
Â
{
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit/Form.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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,15 +58,11 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit_Form
|
|
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,12 +150,14 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit_Form
|
|
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 |
Â
}
|
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 |
Â
|
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 |
Â
}
|
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 |
Â
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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -55,8 +55,7 @@ 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',
|
59 |
-
array('neq' => Mage_XmlConnect_Model_Queue::STATUS_DELETED)
|
60 |
Â
);
|
61 |
Â
$this->setCollection($collection);
|
62 |
Â
return parent::_prepareCollection();
|
@@ -159,13 +158,13 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Wi
|
|
159 |
Â
$this->getMassactionBlock()->addItem('delete', array(
|
160 |
Â
'label' => $this->__('Delete'),
|
161 |
Â
'url' => $this->getUrl('*/*/massDeleteQueue'),
|
162 |
-
'confirm' => $this->__('Are you sure you
|
163 |
Â
));
|
164 |
Â
|
165 |
Â
$this->getMassactionBlock()->addItem('cancel', array(
|
166 |
Â
'label' => $this->__('Cancel'),
|
167 |
Â
'url' => $this->getUrl('*/*/massCancelQueue'),
|
168 |
-
'confirm' => $this->__('Are you sure you
|
169 |
Â
));
|
170 |
Â
return $this;
|
171 |
Â
}
|
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 |
Â
|
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 |
Â
$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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Action.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -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
|
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
|
69 |
Â
);
|
70 |
Â
|
71 |
Â
$this->getColumn()->setActions($actions);
|
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 |
Â
|
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);
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Application.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Id.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Msgtitle.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Pushtitle.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Status.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Template.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -43,9 +43,8 @@ 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(\''
|
47 |
-
. $this->__('
|
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,7 +58,9 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Edit extends Mage_Adminhtml_Block
|
|
59 |
Â
*/
|
60 |
Â
public function getDeleteUrl()
|
61 |
Â
{
|
62 |
-
return $this->getUrl('*/*/deletetemplate', array(
|
Â
|
|
Â
|
|
63 |
Â
}
|
64 |
Â
|
65 |
Â
/**
|
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 |
Â
|
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 |
Â
*/
|
59 |
Â
public function getDeleteUrl()
|
60 |
Â
{
|
61 |
+
return $this->getUrl('*/*/deletetemplate', array(
|
62 |
+
$this->_objectId => $this->getRequest()->getParam($this->_objectId)
|
63 |
+
));
|
64 |
Â
}
|
65 |
Â
|
66 |
Â
/**
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit/Form.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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,12 +85,8 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form
|
|
86 |
Â
$this->_addElementTypes($fieldset);
|
87 |
Â
|
88 |
Â
if ($model->getId()) {
|
89 |
-
$fieldset->addField('id', 'hidden', array(
|
90 |
-
|
91 |
-
));
|
92 |
-
$fieldset->addField('template_id', 'hidden', array(
|
93 |
-
'name' => 'template_id',
|
94 |
-
));
|
95 |
Â
}
|
96 |
Â
|
97 |
Â
$fieldset->addField('application_id', 'select', array(
|
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 |
Â
|
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 |
Â
$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(
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Application.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Name.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -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 |
Â
}
|
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 |
Â
|
44 |
Â
{
|
45 |
Â
$str = $this->escapeHtml($row->getName());
|
46 |
Â
return $str;
|
47 |
+
}
|
48 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview/Form.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,8 +31,7 @@
|
|
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
|
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 |
Â
|
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
|
app/code/core/Mage/XmlConnect/Block/Cart.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -49,6 +49,8 @@ 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 |
Â
$products = $xmlObject->addChild('products');
|
53 |
Â
/* @var $item Mage_Sales_Model_Quote_Item */
|
54 |
Â
foreach ($this->getItems() as $item) {
|
@@ -64,12 +66,9 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
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 |
-
$
|
72 |
-
$iconXml->addAttribute('modification_time', filemtime($file));
|
73 |
Â
/**
|
74 |
Â
* Price
|
75 |
Â
*/
|
@@ -79,19 +78,19 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
79 |
Â
&& $item->getWeeeTaxAppliedAmount()
|
80 |
Â
) {
|
81 |
Â
$exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
|
82 |
-
|
83 |
Â
} else {
|
84 |
Â
$exclPrice = $item->getCalculationPrice();
|
85 |
Â
}
|
86 |
Â
}
|
87 |
Â
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
88 |
-
$
|
89 |
Â
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
90 |
Â
&& $item->getWeeeTaxAppliedAmount()
|
91 |
Â
) {
|
92 |
-
$inclPrice = $
|
93 |
Â
} else {
|
94 |
-
$inclPrice = $
|
95 |
Â
}
|
96 |
Â
}
|
97 |
Â
$exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
|
@@ -151,13 +150,13 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
151 |
Â
}
|
152 |
Â
}
|
153 |
Â
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
154 |
-
$
|
155 |
Â
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
156 |
Â
&& $item->getWeeeTaxAppliedAmount()
|
157 |
Â
) {
|
158 |
-
$inclPrice = $
|
159 |
Â
} else {
|
160 |
-
$inclPrice = $
|
161 |
Â
}
|
162 |
Â
}
|
163 |
Â
|
@@ -190,14 +189,27 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
190 |
Â
/**
|
191 |
Â
* Options list
|
192 |
Â
*/
|
193 |
-
$
|
194 |
-
if ($
|
195 |
Â
$itemOptionsXml = $itemXml->addChild('options');
|
196 |
-
foreach ($
|
197 |
-
$
|
198 |
Â
$optionXml = $itemOptionsXml->addChild('option');
|
199 |
-
$optionXml->addAttribute('label', $xmlObject->xmlAttribute($
|
200 |
-
$optionXml->addAttribute('text', $xmlObject->xmlAttribute($
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
201 |
Â
}
|
202 |
Â
}
|
203 |
Â
|
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 |
Â
|
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 |
Â
$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 |
Â
&& $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 |
Â
}
|
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 |
Â
/**
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals.php
ADDED
@@ -0,0 +1,95 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,93 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,107 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,63 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,69 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,113 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,108 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
@@ -13,14 +13,13 @@
|
|
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)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -46,23 +45,23 @@ class Mage_XmlConnect_Block_Cart_Crosssell extends Mage_Checkout_Block_Cart_Cros
|
|
46 |
Â
$this->getLayout()->createBlock($blockRenderer, $blockName);
|
47 |
Â
$this->setItems($this->getLayout()->getBlock($blockName)->getItemCollection());
|
48 |
Â
}
|
49 |
-
|
50 |
Â
$crossSellXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<crosssell></crosssell>');
|
51 |
Â
if (!$this->getItemCount()) {
|
52 |
Â
return $crossSellXmlObj->asNiceXml();
|
53 |
Â
}
|
54 |
Â
|
Â
|
|
Â
|
|
Â
|
|
55 |
Â
/** @var $product Mage_Catalog_Model_Product */
|
56 |
Â
foreach ($this->getItems() as $product) {
|
57 |
Â
$itemXmlObj = $crossSellXmlObj->addChild('item');
|
58 |
Â
$itemXmlObj->addChild('name', $crossSellXmlObj->escapeXml($product->getName()));
|
59 |
-
$icon = $
|
60 |
-
->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small'));
|
61 |
Â
|
62 |
Â
$iconXml = $itemXmlObj->addChild('icon', $icon);
|
63 |
-
|
64 |
-
$file = Mage::helper('xmlconnect')->urlToPath($icon);
|
65 |
-
$iconXml->addAttribute('modification_time', filemtime($file));
|
66 |
Â
|
67 |
Â
$itemXmlObj->addChild('entity_id', $product->getId());
|
68 |
Â
$itemXmlObj->addChild('entity_type', $product->getTypeId());
|
13 |
Â
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
Â
*
|
15 |
Â
* DISCLAIMER
|
Â
|
|
16 |
Â
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
Â
* versions in the future. If you wish to customize Magento for your
|
18 |
Â
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
Â
*
|
20 |
Â
* @category Mage
|
21 |
Â
* @package Mage_XmlConnect
|
22 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
23 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
Â
*/
|
25 |
Â
|
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());
|
app/code/core/Mage/XmlConnect/Block/Cart/Info.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer.php
CHANGED
@@ -13,14 +13,13 @@
|
|
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)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -41,36 +40,238 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
41 |
Â
*/
|
42 |
Â
public function addProductToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
|
43 |
Â
{
|
44 |
-
$
|
45 |
Â
$productXmlObj = $reviewXmlObj->addCustomChild('item');
|
46 |
Â
$productXmlObj->addCustomChild('name', $this->escapeHtml($this->getProductName()));
|
47 |
Â
|
48 |
-
if ($
|
49 |
Â
$optionsXmlObj = $productXmlObj->addChild('options');
|
50 |
-
foreach ($
|
51 |
-
$
|
52 |
Â
|
53 |
-
if (isset($
|
54 |
-
$value = $
|
55 |
Â
} else {
|
56 |
Â
$value = null;
|
57 |
Â
}
|
58 |
Â
|
59 |
Â
$optionsXmlObj->addCustomChild('option', $value, array(
|
60 |
-
'label' => $this->escapeHtml($
|
61 |
-
'value' => $
|
62 |
Â
));
|
63 |
Â
}
|
64 |
Â
}
|
65 |
Â
|
66 |
-
|
67 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
68 |
Â
|
69 |
-
$productXmlObj->addCustomChild('qty', $
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
70 |
Â
|
71 |
Â
return $reviewXmlObj;
|
72 |
Â
}
|
73 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
74 |
Â
/**
|
75 |
Â
* Add product subtotal info to xml object
|
76 |
Â
*
|
@@ -79,38 +280,38 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
79 |
Â
*/
|
80 |
Â
protected function _addSubtotalToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $productXmlObj)
|
81 |
Â
{
|
82 |
-
$
|
83 |
Â
$subtotalXmlObj = $productXmlObj->addCustomChild('subtotal');
|
84 |
Â
|
85 |
Â
if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
86 |
-
if (Mage::helper('weee')->typeOfDisplay($
|
87 |
-
&& $
|
88 |
-
|
89 |
-
|
90 |
-
+ $_item->getWeeeTaxRowDisposition();
|
91 |
Â
} else {
|
92 |
-
$exclPrice = $
|
93 |
Â
}
|
94 |
Â
$exclPrice = $this->_formatPrice($exclPrice);
|
Â
|
|
95 |
Â
$subtotalXmlObj->addAttribute('excluding_tax', $subtotalXmlObj->escapeXml($exclPrice));
|
96 |
Â
}
|
97 |
Â
|
98 |
Â
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
99 |
-
$
|
100 |
Â
|
101 |
-
if (Mage::helper('weee')->typeOfDisplay($
|
102 |
-
&& $
|
103 |
Â
) {
|
104 |
-
$inclPrice = $
|
105 |
Â
} else {
|
106 |
-
$inclPrice = $
|
107 |
Â
}
|
108 |
Â
$inclPrice = $this->_formatPrice($inclPrice);
|
109 |
Â
|
110 |
Â
$subtotalXmlObj->addAttribute('including_tax', $subtotalXmlObj->escapeXml($inclPrice));
|
111 |
Â
}
|
112 |
Â
|
113 |
-
if (Mage::helper('weee')->getApplied($
|
114 |
Â
$this->_addWeeeToXmlObj($subtotalXmlObj, true);
|
115 |
Â
}
|
116 |
Â
|
@@ -136,43 +337,38 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
136 |
Â
*/
|
137 |
Â
protected function _addPriceToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $productXmlObj)
|
138 |
Â
{
|
139 |
-
$
|
140 |
Â
$priceXmlObj = $productXmlObj->addCustomChild('price');
|
141 |
Â
|
142 |
-
if ($this->helper('tax')->displayCartPriceExclTax()
|
143 |
-
|
144 |
-
|
145 |
-
if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')
|
146 |
-
&& $_item->getWeeeTaxAppliedAmount()
|
147 |
Â
) {
|
148 |
-
$exclPrice = $
|
149 |
-
+ $
|
150 |
Â
} else {
|
151 |
-
$exclPrice = $
|
152 |
Â
}
|
153 |
Â
$exclPrice = $this->_formatPrice($exclPrice);
|
154 |
-
|
155 |
Â
$priceXmlObj->addAttribute('excluding_tax', $priceXmlObj->escapeXml($exclPrice));
|
156 |
Â
}
|
157 |
Â
|
158 |
-
if ($this->helper('tax')->displayCartPriceInclTax()
|
159 |
-
|
160 |
-
) {
|
161 |
-
$_incl = $this->helper('checkout')->getPriceInclTax($_item);
|
162 |
Â
|
163 |
-
if (Mage::helper('weee')->typeOfDisplay($
|
164 |
-
&& $
|
165 |
Â
) {
|
166 |
-
$inclPrice = $
|
167 |
Â
} else {
|
168 |
-
$inclPrice = $
|
169 |
Â
}
|
170 |
Â
$inclPrice = $this->_formatPrice($inclPrice);
|
171 |
Â
|
172 |
Â
$priceXmlObj->addAttribute('including_tax', $priceXmlObj->escapeXml($inclPrice));
|
173 |
Â
}
|
174 |
Â
|
175 |
-
if (Mage::helper('weee')->getApplied($
|
176 |
Â
$this->_addWeeeToXmlObj($priceXmlObj);
|
177 |
Â
}
|
178 |
Â
|
@@ -188,19 +384,19 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
188 |
Â
*/
|
189 |
Â
protected function _addWeeeToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $priceXmlObj, $subtotalFlag = false)
|
190 |
Â
{
|
191 |
-
$
|
192 |
Â
$weeeXmlObj = $priceXmlObj->addCustomChild('weee');
|
193 |
Â
|
194 |
Â
if ($subtotalFlag) {
|
195 |
-
$
|
196 |
Â
} else {
|
197 |
-
$
|
198 |
Â
}
|
199 |
Â
|
200 |
-
$typeOfDisplay2 = Mage::helper('weee')->typeOfDisplay($
|
201 |
Â
|
202 |
-
if (Mage::helper('weee')->typeOfDisplay($
|
203 |
-
foreach (Mage::helper('weee')->getApplied($
|
204 |
Â
|
205 |
Â
if ($subtotalFlag) {
|
206 |
Â
$amount = $tax['row_amount'];
|
@@ -209,14 +405,13 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
209 |
Â
}
|
210 |
Â
|
211 |
Â
$weeeXmlObj->addCustomChild('item', null, array(
|
212 |
-
'name'
|
213 |
-
'amount' => $this->_formatPrice($amount)
|
214 |
Â
));
|
215 |
Â
}
|
216 |
-
} elseif ($
|
217 |
-
&& ($typeOfDisplay2 || Mage::helper('weee')->typeOfDisplay($
|
218 |
Â
) {
|
219 |
-
foreach (Mage::helper('weee')->getApplied($
|
220 |
Â
if ($subtotalFlag) {
|
221 |
Â
$amount = $tax['row_amount_incl_tax'];
|
222 |
Â
} else {
|
@@ -224,30 +419,29 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
224 |
Â
}
|
225 |
Â
|
226 |
Â
$weeeXmlObj->addCustomChild('item', null, array(
|
227 |
-
'name'
|
228 |
-
'amount' => $this->_formatPrice($amount)
|
229 |
Â
));
|
230 |
Â
}
|
231 |
Â
}
|
232 |
Â
|
233 |
-
if ($typeOfDisplay2 && $
|
234 |
Â
if ($subtotalFlag) {
|
235 |
-
$totalExcl = $
|
236 |
-
+ $
|
237 |
Â
} else {
|
238 |
-
$totalExcl = $
|
239 |
-
+ $
|
240 |
Â
}
|
241 |
Â
|
242 |
Â
$totalExcl = $this->_formatPrice($totalExcl);
|
243 |
Â
$priceXmlObj->addAttribute('total_excluding_tax', $priceXmlObj->escapeXml($totalExcl));
|
244 |
Â
}
|
245 |
Â
|
246 |
-
if ($typeOfDisplay2 && $
|
247 |
Â
if ($subtotalFlag) {
|
248 |
-
$totalIncl = $
|
249 |
Â
} else {
|
250 |
-
$totalIncl = $
|
251 |
Â
}
|
252 |
Â
|
253 |
Â
$totalIncl = $this->_formatPrice($totalIncl);
|
13 |
Â
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
Â
*
|
15 |
Â
* DISCLAIMER
|
Â
|
|
16 |
Â
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
Â
* versions in the future. If you wish to customize Magento for your
|
18 |
Â
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
Â
*
|
20 |
Â
* @category Mage
|
21 |
Â
* @package Mage_XmlConnect
|
22 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
23 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
Â
*/
|
25 |
Â
|
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 |
Â
*/
|
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 |
Â
*/
|
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 |
Â
*/
|
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 |
Â
}
|
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 |
Â
}
|
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);
|
app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Configurable.php
CHANGED
@@ -13,14 +13,13 @@
|
|
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)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
13 |
Â
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
Â
*
|
15 |
Â
* DISCLAIMER
|
Â
|
|
16 |
Â
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
Â
* versions in the future. If you wish to customize Magento for your
|
18 |
Â
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
Â
*
|
20 |
Â
* @category Mage
|
21 |
Â
* @package Mage_XmlConnect
|
22 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
23 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
Â
*/
|
25 |
Â
|
app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Grouped.php
CHANGED
@@ -13,14 +13,13 @@
|
|
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)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
13 |
Â
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
Â
*
|
15 |
Â
* DISCLAIMER
|
Â
|
|
16 |
Â
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
Â
* versions in the future. If you wish to customize Magento for your
|
18 |
Â
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
Â
*
|
20 |
Â
* @category Mage
|
21 |
Â
* @package Mage_XmlConnect
|
22 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
23 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
Â
*/
|
25 |
Â
|
app/code/core/Mage/XmlConnect/Block/Cart/Items.php
ADDED
@@ -0,0 +1,254 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -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 $
|
46 |
-
$this->getItemXml($
|
47 |
Â
}
|
48 |
Â
|
49 |
Â
$reviewXmlObj->appendChild($this->getChild('totals')->setReturnObjectFlag(true)->_toHtml());
|
@@ -59,10 +59,8 @@ 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,
|
63 |
-
|
64 |
-
)
|
65 |
-
{
|
66 |
Â
$renderer = $this->getItemRenderer($item->getProductType())->setItem($item)->setQuote($this->getQuote());
|
67 |
Â
return $renderer->addProductToXmlObj($reviewXmlObj);
|
68 |
Â
}
|
@@ -78,9 +76,7 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details extends Mage_Paypal_Block_E
|
|
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 |
Â
}
|
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 |
Â
|
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, 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 |
Â
public function addItemRender($productType, $blockType, $template)
|
77 |
Â
{
|
78 |
Â
$this->_itemRenders[$productType] = array(
|
79 |
+
'block' => $blockType, 'template' => $template, 'blockInstance' => null
|
Â
|
|
Â
|
|
80 |
Â
);
|
81 |
Â
return $this;
|
82 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/OrderDetails.php
ADDED
@@ -0,0 +1,83 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -44,15 +44,14 @@ 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(
|
48 |
Â
}
|
49 |
Â
|
50 |
Â
if ($this->getShippingAddress()) {
|
51 |
-
$
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
);
|
56 |
Â
}
|
57 |
Â
|
58 |
Â
if ($this->_quote->isVirtual()) {
|
@@ -78,17 +77,20 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Review extends Mage_Paypal_Block_Ex
|
|
78 |
Â
$reviewXmlObj->addCustomChild('payment_method', $this->escapeHtml($this->getPaymentMethodTitle()), array(
|
79 |
Â
'label' => $this->__('Payment Method')
|
80 |
Â
));
|
81 |
-
|
82 |
-
$reviewXmlObj->addCustomChild(
|
83 |
-
'
|
84 |
-
|
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 |
Â
}
|
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 |
Â
|
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 |
Â
$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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,9 +31,30 @@
|
|
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,45 +64,100 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
|
|
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 (
|
53 |
-
$
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
$
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
65 |
Â
}
|
66 |
-
$rateXmlObj->addCustomChild('rate', null, $rateAttributes);
|
67 |
Â
}
|
Â
|
|
Â
|
|
68 |
Â
}
|
69 |
Â
} else {
|
70 |
-
$
|
71 |
-
|
72 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
73 |
Â
}
|
74 |
Â
} else {
|
75 |
-
$
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
80 |
Â
}
|
81 |
Â
|
82 |
Â
return $methodListXmlObj->asNiceXml();
|
83 |
Â
}
|
84 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
85 |
Â
/**
|
86 |
Â
* Add cart details to XML object
|
87 |
Â
*
|
@@ -89,7 +165,7 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
|
|
89 |
Â
* @param string $code
|
90 |
Â
* @return Mage_XmlConnect_Model_Simplexml_Element
|
91 |
Â
*/
|
92 |
-
protected function _addRatesToXmlObj(
|
93 |
Â
{
|
94 |
Â
$attributes = $code ? array('label' => $this->getCarrierName($code)) : array();
|
95 |
Â
return $methodListXmlObj->addCustomChild('method', null, $attributes)->addCustomChild('rates');
|
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 |
Â
|
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 |
Â
{
|
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 |
Â
* @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');
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -59,10 +59,7 @@ 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(
|
63 |
-
$code,
|
64 |
-
Mage::helper('xmlconnect')->formatPriceForXml($subtotal)
|
65 |
-
);
|
66 |
Â
break;
|
67 |
Â
case 'tax':
|
68 |
Â
$paypalTotals->addAttribute(
|
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 |
Â
|
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(
|
app/code/core/Mage/XmlConnect/Block/Cart/Totals.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -58,10 +58,7 @@ 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,
|
62 |
-
$code . '_excl_tax',
|
63 |
-
$title,
|
64 |
-
$total->getValueExclTax()
|
65 |
Â
);
|
66 |
Â
|
67 |
Â
$code = $code . '_incl_tax';
|
@@ -103,12 +100,12 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
|
|
103 |
Â
}
|
104 |
Â
continue 2;
|
105 |
Â
case 'giftcardaccount':
|
106 |
-
$
|
107 |
-
if (!$
|
108 |
-
$
|
109 |
Â
}
|
110 |
Â
if ($renderer->getTotal()->getValue()) {
|
111 |
-
foreach ($
|
112 |
Â
$title = $this->__('Gift Card (%s)', $cardCode['c']);
|
113 |
Â
$value = $cardCode['c'];
|
114 |
Â
$totalXmlObj = $totalsXmlObj->addChild($code);
|
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 |
Â
|
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 |
Â
}
|
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);
|
app/code/core/Mage/XmlConnect/Block/Catalog.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -31,7 +31,7 @@
|
|
31 |
Â
* @package Mage_Xmlconnect
|
32 |
Â
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
Â
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog extends
|
35 |
Â
{
|
36 |
Â
/**
|
37 |
Â
* Limit for product sorting fields to return
|
@@ -39,22 +39,48 @@ class Mage_XmlConnect_Block_Catalog extends Mage_Core_Block_Template
|
|
39 |
Â
const PRODUCT_SORT_FIELDS_NUMBER = 3;
|
40 |
Â
|
41 |
Â
/**
|
42 |
-
* Prefix that used in
|
Â
|
|
Â
|
|
43 |
Â
*/
|
44 |
-
const REQUEST_FILTER_PARAM_REFIX =
|
45 |
Â
|
46 |
Â
/**
|
47 |
-
* Prefix that used in
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
48 |
Â
*/
|
49 |
-
const REQUEST_SORT_ORDER_PARAM_REFIX =
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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,4 +98,32 @@ class Mage_XmlConnect_Block_Catalog extends Mage_Core_Block_Template
|
|
72 |
Â
|
73 |
Â
return $ordersXmlObject;
|
74 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
75 |
Â
}
|
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 |
Â
|
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 |
Â
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 |
Â
|
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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Category.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -43,8 +43,9 @@ 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 |
-
|
47 |
-
|
Â
|
|
48 |
Â
}
|
49 |
Â
|
50 |
Â
$productsXmlObj = $productListBlock = false;
|
@@ -73,10 +74,15 @@ class Mage_XmlConnect_Block_Catalog_Category extends Mage_XmlConnect_Block_Catal
|
|
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,12 +91,10 @@ class Mage_XmlConnect_Block_Catalog_Category extends Mage_XmlConnect_Block_Catal
|
|
85 |
Â
$itemXmlObj->addChild('parent_id', $item->getParentId());
|
86 |
Â
}
|
87 |
Â
$icon = Mage::helper('xmlconnect/catalog_category_image')->initialize($item, 'thumbnail')
|
88 |
-
->resize(
|
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 |
Â
|
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 |
Â
|
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 |
Â
// 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 |
Â
$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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Catalog/Category/Info.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
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 |
Â
|
app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -41,6 +41,7 @@ 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 |
Â
$categoryXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<category></category>');
|
45 |
Â
$filtersCollection = Mage::getResourceModel('xmlconnect/filter_collection')->setCategoryId($categoryId);
|
46 |
Â
|
@@ -61,7 +62,7 @@ class Mage_XmlConnect_Block_Catalog_Filters extends Mage_XmlConnect_Block_Catalo
|
|
61 |
Â
$valueXmlObj->addChild('count', (int)$value->getProductsCount());
|
62 |
Â
}
|
63 |
Â
}
|
64 |
-
$categoryXmlObj->appendChild($this->
|
65 |
Â
|
66 |
Â
return $categoryXmlObj->asNiceXml();
|
67 |
Â
}
|
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 |
Â
|
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 |
Â
$valueXmlObj->addChild('count', (int)$value->getProductsCount());
|
63 |
Â
}
|
64 |
Â
}
|
65 |
+
$categoryXmlObj->appendChild($this->getProductSortFieldsXmlObject());
|
66 |
Â
|
67 |
Â
return $categoryXmlObj->asNiceXml();
|
68 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -52,23 +52,24 @@ 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 |
Â
|
56 |
Â
if ($itemNodeName == 'item') {
|
57 |
-
$imageToResize =
|
58 |
Â
$propertyToResizeName = 'small_image';
|
59 |
Â
} else {
|
60 |
-
$imageToResize =
|
61 |
Â
$propertyToResizeName = 'image';
|
62 |
Â
}
|
63 |
Â
|
64 |
-
$icon = clone Mage::helper('
|
Â
|
|
65 |
Â
|
66 |
Â
$iconXml = $item->addChild('icon', $icon);
|
Â
|
|
67 |
Â
|
68 |
-
$
|
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,8 +88,14 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
|
|
87 |
Â
}
|
88 |
Â
$item->addChild('has_options', (int)$product->getHasOptions());
|
89 |
Â
|
90 |
-
|
91 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
92 |
Â
}
|
93 |
Â
|
94 |
Â
if (!$product->getRatingSummary()) {
|
@@ -99,8 +106,7 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
|
|
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,24 +142,28 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
|
|
136 |
Â
protected function _toHtml()
|
137 |
Â
{
|
138 |
Â
/** @var $product Mage_Catalog_Model_Product */
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
if (!$product) {
|
143 |
-
Mage::throwException($this->__('Selected product is unavailable.'));
|
144 |
Â
} else {
|
145 |
-
$
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
$
|
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 |
Â
}
|
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 |
Â
|
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 |
Â
}
|
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 |
Â
$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 |
Â
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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Attributes.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -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', $attribute);
|
57 |
Â
}
|
58 |
Â
}
|
59 |
Â
}
|
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 |
Â
|
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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Gallery.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
Â
*
|
21 |
Â
* @category Mage
|
22 |
Â
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c)
|
24 |
Â
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
Â
*/
|
26 |
Â
|
@@ -40,43 +40,42 @@ class Mage_XmlConnect_Block_Catalog_Product_Gallery extends Mage_XmlConnect_Bloc
|
|
40 |
Â
*/
|
41 |
Â
protected function _toHtml()
|
42 |
Â
{
|
43 |
-
$
|
44 |
-
|
45 |
Â
$collection = $product->getMediaGalleryImages();
|
46 |
Â
|
47 |
Â
$imagesNode = Mage::getModel('xmlconnect/simplexml_element', '<images></images>');
|
48 |
-
$
|
49 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
50 |
Â
foreach ($collection as $item) {
|
51 |
Â
$imageNode = $imagesNode->addChild('image');
|
52 |
Â
|
53 |
Â
/**
|
54 |
Â
* Big image
|
55 |
Â
*/
|
56 |
-
$bigImage = $
|
57 |
-
->
|
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($
|
67 |
Â
|
68 |
Â
/**
|
69 |
Â
* Small image
|
70 |
Â
*/
|
71 |
-
$smallImage = $
|
72 |
-
->
|
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 |
Â
}
|
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 |
Â
|
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 |
Â
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice.php
ADDED
@@ -0,0 +1,98 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
ADDED
@@ -0,0 +1,426 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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 |
|