From 1485e28a3fdb8541d42144a605605cf69c1bd9bd Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Mon, 18 Aug 2014 08:09:40 -0700 Subject: [PATCH] 0.1.0-alpha91 * Added the following functional tests: * Action Newsletter Template * Import Custom Options * Low Stock Products Report * Search Terms Report * Catalog: * Removed the unused old pricing .phtml templates * Removed direct dependencies on the Weee and Tax modules * Tax: * Added new price renderers for the Weee and Tax modules * Fixed the @covers annotation in Integration tests * Fixed bugs: * Fixed an issue with FPT total line on the Shopping Cart page * Fixed the Inline translation functionality both in the backend and the storefront * Fixed an issue with the Translation dialog layout on the storefront * Fixed an issue where only the first Tier Price row was saved during simple product creation * Fixed an issue where it was impossible to save more than one group price * Fixed an issue where it was impossible to create a shipping label * Fixed an issue where Google Items synchronization resulted in a blank page * Fixed an issue where a Shopping Cart with a lot of entries did not fit the page * Fixed an issue where a JavaScript error blocked the checkout with credit cards type Other in online payment methods * Fixed JavaScript error on the Payment Methods tab in System Configuration --- CHANGELOG.md | 25 + .../Magento/AdminNotification/composer.json | 12 +- app/code/Magento/Authorization/composer.json | 6 +- app/code/Magento/Authorizenet/composer.json | 20 +- app/code/Magento/Backend/composer.json | 46 +- app/code/Magento/Backup/composer.json | 14 +- .../Bundle/Block/Catalog/Product/Price.php | 13 +- .../Product/View/Type/Bundle/Option.php | 25 +- .../Magento/Bundle/Model/Product/Price.php | 37 +- app/code/Magento/Bundle/composer.json | 34 +- .../templates/rss/catalog/product/price.phtml | 273 ---------- app/code/Magento/Captcha/composer.json | 14 +- .../Edit/Action/Attribute/Tab/Attributes.php | 4 +- .../Catalog/Block/Product/AbstractProduct.php | 12 - .../Magento/Catalog/Block/Product/Price.php | 14 +- .../Catalog/Block/Product/View/Options.php | 22 +- .../Product/View/Options/AbstractOptions.php | 20 +- .../Block/Product/View/Options/Type/Date.php | 6 +- .../Product/View/Options/Type/Select.php | 6 +- .../Product/Action/Attribute/Save.php | 5 +- app/code/Magento/Catalog/Helper/Data.php | 187 ++++++- app/code/Magento/Catalog/composer.json | 49 +- app/code/Magento/Catalog/etc/module.xml | 1 - .../templates/catalog/product/price.phtml | 381 ------------- .../view/adminhtml/web/catalog/product.js | 10 +- .../templates/product/price_msrp.phtml | 61 --- .../templates/product/price_msrp_item.phtml | 75 --- .../templates/product/price_msrp_noform.phtml | 60 --- .../templates/rss/product/price.phtml | 320 ----------- .../Magento/CatalogImportExport/composer.json | 20 +- .../Magento/CatalogInventory/composer.json | 20 +- app/code/Magento/CatalogRule/composer.json | 18 +- .../adminhtml/templates/promo/fieldset.phtml | 2 +- .../view/adminhtml/templates/promo/js.phtml | 5 +- app/code/Magento/CatalogSearch/composer.json | 22 +- .../Magento/CatalogUrlRewrite/composer.json | 12 +- app/code/Magento/Centinel/composer.json | 14 +- .../Checkout/Block/Cart/Item/Renderer.php | 98 ++++ .../Magento/Checkout/Block/Cart/Shipping.php | 41 +- .../Magento/Checkout/Block/Cart/Sidebar.php | 102 +--- .../Checkout/Block/Cart/Sidebar/Totals.php | 48 ++ .../Checkout/Block/Item/Price/Renderer.php | 61 +++ .../Block/Onepage/AbstractOnepage.php | 14 + .../Checkout/Block/Onepage/Progress.php | 88 +-- .../Onepage/Shipping/Method/Available.php | 23 - .../Magento/Checkout/Block/Shipping/Price.php | 68 +++ app/code/Magento/Checkout/composer.json | 33 +- app/code/Magento/Checkout/etc/module.xml | 1 - .../frontend/layout/checkout_cart_index.xml | 1 + .../layout/checkout_cart_item_renderers.xml | 1 + ...out_cart_sidebar_item_price_renderers.xml} | 4 +- ...checkout_cart_sidebar_total_renderers.xml} | 5 +- .../layout/checkout_item_price_renderers.xml | 34 ++ .../layout/checkout_onepage_index.xml | 1 + .../layout/checkout_onepage_progress.xml | 1 + ...checkout_onepage_review_item_renderers.xml | 1 + .../checkout_onepage_shippingmethod.xml | 1 + .../checkout_shipping_price_renderer.xml | 29 + .../Checkout/view/frontend/layout/default.xml | 2 + .../templates/cart/item/default.phtml | 251 ++------- .../templates/cart/item/price/sidebar.phtml | 33 ++ .../frontend/templates/cart/minicart.phtml | 14 +- .../templates/cart/minicart/totals.phtml} | 16 +- .../frontend/templates/cart/shipping.phtml | 7 +- .../templates/cart/sidebar/default.phtml | 105 +--- .../frontend/templates/item/price/row.phtml | 33 ++ .../frontend/templates/item/price/unit.phtml | 33 ++ .../frontend/templates/onepage/progress.phtml | 11 +- .../templates/onepage/review/item.phtml | 164 +----- .../review/item/price/row_excl_tax.phtml | 31 ++ .../review/item/price/row_incl_tax.phtml | 32 ++ .../review/item/price/unit_excl_tax.phtml | 31 ++ .../review/item/price/unit_incl_tax.phtml | 32 ++ .../onepage/shipping_method/available.phtml | 7 +- .../frontend/templates/shipping/price.phtml | 28 + .../view/frontend/templates/total/tax.phtml | 74 --- .../Magento/CheckoutAgreements/composer.json | 10 +- app/code/Magento/Cms/composer.json | 20 +- app/code/Magento/CmsUrlRewrite/composer.json | 8 +- .../ConfigurableImportExport/composer.json | 14 +- .../Magento/ConfigurableProduct/composer.json | 32 +- app/code/Magento/Contact/composer.json | 12 +- app/code/Magento/Core/composer.json | 16 +- .../view/frontend/web/prototype/magento.css | 10 +- app/code/Magento/Cron/composer.json | 8 +- app/code/Magento/CurrencySymbol/composer.json | 14 +- app/code/Magento/Customer/composer.json | 40 +- .../CustomerImportExport/composer.json | 18 +- app/code/Magento/DesignEditor/composer.json | 16 +- .../frontend/templates/translate_inline.phtml | 2 +- app/code/Magento/Dhl/composer.json | 22 +- app/code/Magento/Directory/composer.json | 10 +- app/code/Magento/Downloadable/composer.json | 34 +- .../checkout/cart/item/default.phtml | 196 +------ app/code/Magento/Eav/composer.json | 12 +- app/code/Magento/Email/composer.json | 14 +- app/code/Magento/Fedex/composer.json | 18 +- app/code/Magento/GiftMessage/composer.json | 22 +- app/code/Magento/GoogleAdwords/composer.json | 8 +- .../Magento/GoogleAnalytics/composer.json | 8 +- .../Magento/GoogleOptimizer/composer.json | 14 +- .../GoogleShopping/Model/Attribute/Price.php | 12 +- app/code/Magento/GoogleShopping/composer.json | 22 +- .../Magento/GroupedImportExport/composer.json | 14 +- .../Product/Composite/Fieldset/Grouped.php | 6 - app/code/Magento/GroupedProduct/composer.json | 26 +- .../product/composite/fieldset/grouped.phtml | 2 +- ...catalog_product_rss_feed_renderer_list.xml | 3 - .../frontend/templates/product/price.phtml | 10 +- .../templates/rss/product/price.phtml | 67 --- app/code/Magento/ImportExport/composer.json | 14 +- app/code/Magento/Index/composer.json | 8 +- app/code/Magento/Indexer/composer.json | 8 +- app/code/Magento/Install/composer.json | 14 +- app/code/Magento/Integration/composer.json | 18 +- .../Magento/LayeredNavigation/composer.json | 8 +- app/code/Magento/Log/composer.json | 16 +- app/code/Magento/Multishipping/composer.json | 22 +- app/code/Magento/Newsletter/composer.json | 24 +- .../Magento/OfflinePayments/composer.json | 6 +- .../Magento/OfflineShipping/composer.json | 20 +- app/code/Magento/Ogone/composer.json | 12 +- app/code/Magento/PageCache/composer.json | 8 +- .../PayPalRecurringPayment/composer.json | 16 +- app/code/Magento/Payment/composer.json | 14 +- app/code/Magento/Paypal/composer.json | 30 +- app/code/Magento/Persistent/composer.json | 16 +- .../Magento/ProductAlert/Model/Observer.php | 16 +- app/code/Magento/ProductAlert/composer.json | 13 +- app/code/Magento/ProductAlert/etc/module.xml | 1 - .../Magento/RecurringPayment/composer.json | 24 +- app/code/Magento/Reports/composer.json | 36 +- app/code/Magento/RequireJs/composer.json | 6 +- app/code/Magento/Review/composer.json | 22 +- app/code/Magento/Rss/composer.json | 26 +- .../frontend/layout/rss_catalog_category.xml | 5 +- .../view/frontend/layout/rss_catalog_new.xml | 1 - app/code/Magento/Rule/composer.json | 12 +- app/code/Magento/Sales/composer.json | 44 +- .../Magento/SalesRule/Model/Validator.php | 16 +- app/code/Magento/SalesRule/composer.json | 35 +- app/code/Magento/SalesRule/etc/module.xml | 1 - app/code/Magento/Sendfriend/composer.json | 14 +- app/code/Magento/Shipping/composer.json | 26 +- app/code/Magento/Sitemap/composer.json | 16 +- app/code/Magento/Store/composer.json | 10 +- .../Block/Checkout/Cart/Sidebar/Totals.php | 146 +++++ .../Tax/Block/Checkout/Shipping/Price.php | 119 +++++ .../Magento/Tax/Block/Item/Price/Renderer.php | 83 +++ app/code/Magento/Tax/Helper/Data.php | 199 +------ app/code/Magento/Tax/Model/Config.php | 51 ++ app/code/Magento/Tax/Pricing/Adjustment.php | 37 +- app/code/Magento/Tax/composer.json | 30 +- ...kout_cart_sidebar_item_price_renderers.xml | 30 ++ .../checkout_cart_sidebar_total_renderers.xml | 30 ++ .../layout/checkout_item_price_renderers.xml | 30 ++ .../checkout_shipping_price_renderer.xml | 29 + .../checkout/cart/item/price/sidebar.phtml | 51 ++ .../checkout/cart/minicart/totals.phtml | 40 ++ .../templates/checkout/shipping/price.phtml | 36 ++ .../frontend/templates/item/price/row.phtml | 43 ++ .../frontend/templates/item/price/unit.phtml | 45 ++ app/code/Magento/Theme/composer.json | 16 +- .../Translation/Model/Inline/Parser.php | 3 +- app/code/Magento/Translation/composer.json | 10 +- .../templates/translate_inline.phtml | 2 +- .../frontend/templates/translate_inline.phtml | 22 +- app/code/Magento/Ups/composer.json | 18 +- app/code/Magento/UrlRedirect/composer.json | 16 +- app/code/Magento/UrlRewrite/composer.json | 10 +- app/code/Magento/User/composer.json | 16 +- app/code/Magento/Usps/composer.json | 18 +- app/code/Magento/Webapi/composer.json | 16 +- .../Weee/Block/Item/Price/Renderer.php | 267 ++++++++++ app/code/Magento/Weee/composer.json | 24 +- app/code/Magento/Weee/etc/config.xml | 1 + ...kout_cart_sidebar_item_price_renderers.xml | 30 ++ .../layout/checkout_item_price_renderers.xml | 34 ++ .../checkout/cart/item/price/sidebar.phtml | 87 +++ .../review/item/price/row_excl_tax.phtml | 55 ++ .../review/item/price/row_incl_tax.phtml | 56 ++ .../review/item/price/unit_excl_tax.phtml | 54 ++ .../review/item/price/unit_incl_tax.phtml | 57 ++ .../frontend/templates/item/price/row.phtml | 92 ++++ .../frontend/templates/item/price/unit.phtml | 93 ++++ app/code/Magento/Widget/composer.json | 16 +- app/code/Magento/Wishlist/composer.json | 31 +- app/code/Magento/Wishlist/etc/module.xml | 1 - .../render/item/price_msrp_item.phtml | 2 +- .../adminhtml/Magento/backend/composer.json | 4 +- .../adminhtml/Magento/backend/theme.xml | 2 +- .../frontend/Magento/blank/composer.json | 4 +- app/design/frontend/Magento/blank/theme.xml | 2 +- .../frontend/Magento/plushe/composer.json | 6 +- app/design/frontend/Magento/plushe/theme.xml | 2 +- app/design/install/Magento/basic/theme.xml | 2 +- app/i18n/magento/de_de/composer.json | 4 +- app/i18n/magento/en_us/composer.json | 4 +- app/i18n/magento/es_es/composer.json | 4 +- app/i18n/magento/fr_fr/composer.json | 4 +- app/i18n/magento/nl_nl/composer.json | 4 +- app/i18n/magento/pt_br/composer.json | 4 +- app/i18n/magento/zh_cn/composer.json | 4 +- composer.json | 2 +- dev/tests/functional/composer.json.dist | 2 +- .../Magento/Backend/Test/Block/Template.php | 10 +- .../Catalog/Product/Edit/Tab/Bundle.php | 21 +- .../Product/Edit/Tab/Bundle/Option.php | 4 +- .../Catalog/Product/View/Type/Bundle.php | 14 +- .../Test/Constraint/AssertBundlePriceType.php | 2 +- .../Constraint/AssertBundleProductForm.php | 49 +- ...roductCustomOptionsOnBundleProductPage.php | 57 ++ .../CatalogProductBundle/CheckoutData.php | 91 +++- .../Fixture/CatalogProductBundle/Price.php | 4 +- .../Test/Page/Product/CatalogProductView.php | 17 +- .../CreateBundleProductEntityTest/test.csv | 30 +- .../Bundle/Test/etc/global/constraint.xml | 3 + .../Adminhtml/Product/Edit/Tab/Options.php | 89 +++- .../Product/Edit/Tab/Options/Search/Grid.php | 70 +++ .../Block/Adminhtml/Product/ProductForm.xml | 2 +- .../Test/Block/Product/View/CustomOptions.php | 124 ++++- .../Test/Block/Product/View/CustomOptions.xml | 4 +- ...ssertProductCustomOptionsOnProductPage.php | 55 +- .../Constraint/AssertProductDuplicateForm.php | 5 +- .../Test/Constraint/AssertProductForm.php | 40 +- .../Test/Fixture/CatalogProductSimple.php | 11 + .../Test/Fixture/CatalogProductSimple.xml | 5 + .../CatalogProductSimple/CustomOptions.php | 107 +++- .../Handler/CatalogProductSimple/Curl.php | 74 ++- .../Test/Repository/CatalogProductSimple.php | 38 ++ .../testCreate.csv | 38 +- .../testCreate.csv | 16 +- .../AssertDownloadableProductForm.php | 42 -- .../testCreateDownloadableProduct.csv | 30 +- .../Test/Block/Adminhtml/Template/Grid.php | 28 +- .../Test/Block/Adminhtml/Template/Preview.php | 76 +++ .../Constraint/AssertNewsletterPreview.php | 74 +++ .../Test/Constraint/AssertNewsletterQueue.php | 73 +++ .../Newsletter/Test/Fixture/Template.php | 13 +- .../Newsletter/Test/Fixture/Template.xml | 2 + .../Newsletter/Test/Handler/Template/Curl.php | 65 +++ .../Handler/Template/TemplateInterface.php | 16 +- .../Test/Page/Adminhtml/TemplatePreview.php | 53 ++ .../Test/Page/Adminhtml/TemplatePreview.xml | 33 ++ .../Test/Page/Adminhtml/TemplateQueue.php | 81 +++ .../Test/Page/Adminhtml/TemplateQueue.xml | 45 ++ .../Newsletter/Test/Repository/Template.php | 51 ++ .../ActionNewsletterTemplateEntityTest.php | 85 +++ .../test.csv | 3 + .../Magento/Newsletter/Test/etc/curl/di.xml | 28 + .../Newsletter/Test/etc/global/constraint.xml | 6 + .../Newsletter/Test/etc/global/page.xml | 10 + .../Block/Adminhtml/Product/Lowstock/Grid.php | 43 ++ .../Test/Block/Adminhtml/SearchTermsGrid.php | 56 ++ .../AssertLowStockProductInGrid.php | 69 +++ .../Constraint/AssertSearchTermReportForm.php | 83 +++ .../Constraint/AssertSearchTermsInGrid.php | 74 +++ .../Test/Page/Adminhtml/ProductLowStock.php | 53 ++ .../Test/Page/Adminhtml/ProductLowStock.xml | 33 ++ .../Test/Page/Adminhtml/SearchIndex.php | 53 ++ .../Test/Page/Adminhtml/SearchIndex.xml | 33 ++ .../LowStockProductsReportEntityTest.php | 58 ++ .../LowStockProductsReportEntityTest/test.csv | 2 + .../TestCase/SearchTermsReportEntityTest.php | 137 +++++ .../SearchTermsReportEntityTest/test.csv | 3 + .../Reports/Test/etc/global/constraint.xml | 36 ++ .../Magento/Reports/Test/etc/global/page.xml | 37 ++ .../Backend/Controller/Adminhtml/AuthTest.php | 12 +- .../Controller/Adminhtml/IndexTest.php | 6 +- .../Product/Action/AttributeTest.php | 4 +- .../Magento/Catalog/Helper/DataTest.php | 374 ++++++++++++- .../testsuite/Magento/Tax/Helper/DataTest.php | 308 ----------- .../Test/Integrity/StaticFilesTest.php | 2 + .../User/Controller/Adminhtml/AuthTest.php | 19 +- .../Controller/Adminhtml/User/RoleTest.php | 4 +- .../Bundle/Model/Product/PriceTest.php | 6 +- .../Product/Action/Attribute/SaveTest.php | 258 +++++++++ .../Checkout/Block/Cart/ShippingTest.php | 85 +++ .../Block/Cart/Sidebar/TotalsTest.php | 87 +++ .../Checkout/Block/Cart/SidebarTest.php | 39 ++ .../Block/Item/Price/RendererTest.php | 53 ++ .../Block/Onepage/AbstractOnepageTest.php | 85 +++ .../Checkout/Block/Onepage/ProgressTest.php | 26 +- .../Checkout/Block/Shipping/PriceTest.php | 101 ++++ .../Magento/SalesRule/Model/ValidatorTest.php | 4 +- .../Checkout/Cart/Sidebar/TotalsTest.php | 220 ++++++++ .../Tax/Block/Checkout/Shipping/PriceTest.php | 167 ++++++ .../Tax/Block/Item/Price/RendererTest.php | 82 +++ .../Magento/Tax/Pricing/AdjustmentTest.php | 24 +- .../Weee/Block/Item/Price/RendererTest.php | 499 ++++++++++++++++++ .../Magento/Framework/AppInterface.php | 2 +- lib/internal/Magento/Framework/composer.json | 2 +- 292 files changed, 7788 insertions(+), 4087 deletions(-) delete mode 100644 app/code/Magento/Bundle/view/frontend/templates/rss/catalog/product/price.phtml delete mode 100644 app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/price.phtml delete mode 100644 app/code/Magento/Catalog/view/frontend/templates/product/price_msrp.phtml delete mode 100644 app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_item.phtml delete mode 100644 app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_noform.phtml delete mode 100644 app/code/Magento/Catalog/view/frontend/templates/rss/product/price.phtml create mode 100644 app/code/Magento/Checkout/Block/Cart/Sidebar/Totals.php create mode 100644 app/code/Magento/Checkout/Block/Item/Price/Renderer.php create mode 100644 app/code/Magento/Checkout/Block/Shipping/Price.php rename app/code/Magento/{Bundle/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml => Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml} (85%) rename app/code/Magento/{Catalog/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml => Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml} (79%) create mode 100644 app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml create mode 100644 app/code/Magento/Checkout/view/frontend/layout/checkout_shipping_price_renderer.xml create mode 100644 app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml rename app/code/Magento/{Catalog/view/frontend/templates/product/price_msrp_rss.phtml => Checkout/view/frontend/templates/cart/minicart/totals.phtml} (67%) create mode 100644 app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml create mode 100644 app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml create mode 100644 app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml create mode 100644 app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml create mode 100644 app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml create mode 100644 app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml create mode 100644 app/code/Magento/Checkout/view/frontend/templates/shipping/price.phtml delete mode 100644 app/code/Magento/Checkout/view/frontend/templates/total/tax.phtml delete mode 100644 app/code/Magento/GroupedProduct/view/frontend/templates/rss/product/price.phtml create mode 100644 app/code/Magento/Tax/Block/Checkout/Cart/Sidebar/Totals.php create mode 100644 app/code/Magento/Tax/Block/Checkout/Shipping/Price.php create mode 100644 app/code/Magento/Tax/Block/Item/Price/Renderer.php create mode 100644 app/code/Magento/Tax/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml create mode 100644 app/code/Magento/Tax/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml create mode 100644 app/code/Magento/Tax/view/frontend/layout/checkout_item_price_renderers.xml create mode 100644 app/code/Magento/Tax/view/frontend/layout/checkout_shipping_price_renderer.xml create mode 100644 app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml create mode 100644 app/code/Magento/Tax/view/frontend/templates/checkout/cart/minicart/totals.phtml create mode 100644 app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml create mode 100644 app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml create mode 100644 app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml create mode 100644 app/code/Magento/Weee/Block/Item/Price/Renderer.php create mode 100644 app/code/Magento/Weee/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml create mode 100644 app/code/Magento/Weee/view/frontend/layout/checkout_item_price_renderers.xml create mode 100644 app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml create mode 100644 app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml create mode 100644 app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml create mode 100644 app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml create mode 100644 app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml create mode 100644 app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml create mode 100644 app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertProductCustomOptionsOnBundleProductPage.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Options/Search/Grid.php create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterPreview.php create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterQueue.php create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Handler/Template/Curl.php rename app/code/Magento/Checkout/Block/Total/Tax.php => dev/tests/functional/tests/app/Magento/Newsletter/Test/Handler/Template/TemplateInterface.php (77%) create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.php create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.xml create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.php create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Repository/Template.php create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/curl/di.xml create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Product/Lowstock/Grid.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/SearchTermsGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertLowStockProductInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSearchTermReportForm.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSearchTermsInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.xml create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.xml create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/constraint.xml create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/page.xml create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/ShippingTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Sidebar/TotalsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Block/Item/Price/RendererTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/AbstractOnepageTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Block/Shipping/PriceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Block/Checkout/Cart/Sidebar/TotalsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Block/Checkout/Shipping/PriceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Block/Item/Price/RendererTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Weee/Block/Item/Price/RendererTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index a00a72467d3..2984a09d513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,28 @@ +0.1.0-alpha91 +============= + * Added the following functional tests: + * Action Newsletter Template + * Import Custom Options + * Low Stock Products Report + * Search Terms Report + * Catalog: + * Removed the unused old pricing .phtml templates + * Removed direct dependencies on the Weee and Tax modules + * Tax: + * Added new price renderers for the Weee and Tax modules + * Fixed the @covers annotation in Integration tests + * Fixed bugs: + * Fixed an issue with FPT total line on the Shopping Cart page + * Fixed the Inline translation functionality both in the backend and the storefront + * Fixed an issue with the Translation dialog layout on the storefront + * Fixed an issue where only the first Tier Price row was saved during simple product creation + * Fixed an issue where it was impossible to save more than one group price + * Fixed an issue where it was impossible to create a shipping label + * Fixed an issue where Google Items synchronization resulted in a blank page + * Fixed an issue where a Shopping Cart with a lot of entries did not fit the page + * Fixed an issue where a JavaScript error blocked the checkout with credit cards type “Other†in online payment methods + * Fixed JavaScript error on the Payment Methods tab in System Configuration + 0.1.0-alpha90 ============= * Service layer implementation: diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index ebd21d9c35d..e460f773cda 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index a00c08d4b68..97243800f89 100644 --- a/app/code/Magento/Authorization/composer.json +++ b/app/code/Magento/Authorization/composer.json @@ -3,12 +3,12 @@ "description": "Authorization module provides access to Magento ACL functionality.", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json index 6b8835ccde6..cdb900f8b94 100644 --- a/app/code/Magento/Authorizenet/composer.json +++ b/app/code/Magento/Authorizenet/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-centinel": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-centinel": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index 2ff611ae678..263e29d914d 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -3,32 +3,32 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-cron": "0.1.0-alpha90", - "magento/module-sendfriend": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-weee": "0.1.0-alpha90", - "magento/module-reports": "0.1.0-alpha90", - "magento/module-catalog-search": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-user": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-backup": "0.1.0-alpha90", - "magento/module-email": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-url-rewrite": "0.1.0-alpha90", - "magento/module-translation": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-cron": "0.1.0-alpha91", + "magento/module-sendfriend": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-weee": "0.1.0-alpha91", + "magento/module-reports": "0.1.0-alpha91", + "magento/module-catalog-search": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-user": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-backup": "0.1.0-alpha91", + "magento/module-email": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-url-rewrite": "0.1.0-alpha91", + "magento/module-translation": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index b14d7243026..e37e10dc988 100644 --- a/app/code/Magento/Backup/composer.json +++ b/app/code/Magento/Backup/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-cron": "0.1.0-alpha90", - "magento/module-index": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-cron": "0.1.0-alpha91", + "magento/module-index": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php index 792c4dcd357..9b6e5eb6326 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php @@ -29,33 +29,38 @@ namespace Magento\Bundle\Block\Catalog\Product; */ class Price extends \Magento\Catalog\Block\Product\Price { + /** + * @var \Magento\Tax\Helper\Data + */ + protected $_taxHelper; + /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Stdlib\String $string * @param \Magento\Framework\Math\Random $mathRandom * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Tax\Helper\Data $taxData * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Registry $registry, \Magento\Framework\Stdlib\String $string, \Magento\Framework\Math\Random $mathRandom, \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Tax\Helper\Data $taxData, array $data = array() ) { + $this->_taxHelper = $taxData; parent::__construct( $context, $jsonEncoder, $catalogData, - $taxData, $registry, $string, $mathRandom, @@ -78,7 +83,7 @@ class Price extends \Magento\Catalog\Block\Product\Price ) { return false; } - return $this->_taxData->displayBothPrices(); + return $this->_taxHelper->displayBothPrices(); } /** diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php index 5db6ad5396e..c20dc7bf9be 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php @@ -49,15 +49,25 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price */ protected $_coreHelper; + /** + * @var \Magento\Tax\Helper\Data + */ + protected $_taxHelper; + + /** + * @var \Magento\Catalog\Helper\Data + */ + protected $_catalogHelper; + /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Stdlib\String $string * @param \Magento\Framework\Math\Random $mathRandom * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Helper\Data $coreHelper * @param array $data * @@ -67,24 +77,26 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Registry $registry, \Magento\Framework\Stdlib\String $string, \Magento\Framework\Math\Random $mathRandom, \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Tax\Helper\Data $taxData, \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { $this->_coreHelper = $coreHelper; + $this->_catalogHelper = $catalogData; + $this->_taxHelper = $taxData; parent::__construct( $context, $jsonEncoder, $catalogData, - $taxData, $registry, $string, $mathRandom, $cartHelper, + $taxData, $data ); } @@ -294,7 +306,8 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price */ public function formatPriceString($price, $includeContainer = true) { - $taxHelper = $this->_taxData; + $catalogHelper = $this->_catalogHelper; + $taxHelper = $this->_taxHelper; $coreHelper = $this->_coreHelper; $currentProduct = $this->getProduct(); if ($currentProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC && $this->getFormatProduct()) { @@ -303,8 +316,8 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price $product = $currentProduct; } - $priceTax = $taxHelper->getPrice($product, $price); - $priceIncTax = $taxHelper->getPrice($product, $price, true); + $priceTax = $catalogHelper->getTaxPrice($product, $price); + $priceIncTax = $catalogHelper->getTaxPrice($product, $price, true); $formatted = $coreHelper->currencyByStore($priceTax, $product->getStore(), true, $includeContainer); if ($taxHelper->displayBothPrices() && $priceTax != $priceIncTax) { diff --git a/app/code/Magento/Bundle/Model/Product/Price.php b/app/code/Magento/Bundle/Model/Product/Price.php index 0a06eec93cb..fa90ad6c36d 100644 --- a/app/code/Magento/Bundle/Model/Product/Price.php +++ b/app/code/Magento/Bundle/Model/Product/Price.php @@ -49,16 +49,11 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price protected $_isPricesCalculatedByIndex; /** - * Is min/max prices have been calculated by index + * Catalog data * - * @return bool + * @var \Magento\Catalog\Helper\Data */ - /** - * Tax data - * - * @var \Magento\Tax\Helper\Data - */ - protected $_taxData = null; + protected $_catalogData = null; /** * Construct @@ -68,7 +63,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\Catalog\Helper\Data $catalogData */ public function __construct( \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory, @@ -76,13 +71,15 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Tax\Helper\Data $taxData + \Magento\Catalog\Helper\Data $catalogData ) { - $this->_taxData = $taxData; + $this->_catalogData = $catalogData; parent::__construct($ruleFactory, $storeManager, $localeDate, $customerSession, $eventManager); } /** + * Is min/max prices have been calculated by index + * * @return bool */ public function getIsPricesCalculatedByIndex() @@ -196,8 +193,8 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price { // check calculated price index if ($product->getData('min_price') && $product->getData('max_price')) { - $minimalPrice = $this->_taxData->getPrice($product, $product->getData('min_price'), $includeTax); - $maximalPrice = $this->_taxData->getPrice($product, $product->getData('max_price'), $includeTax); + $minimalPrice = $this->_catalogData->getTaxPrice($product, $product->getData('min_price'), $includeTax); + $maximalPrice = $this->_catalogData->getTaxPrice($product, $product->getData('max_price'), $includeTax); $this->_isPricesCalculatedByIndex = true; } else { /** @@ -205,7 +202,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price */ $finalPrice = $product->getFinalPrice(); if ($product->getPriceType() == self::PRICE_TYPE_FIXED) { - $minimalPrice = $maximalPrice = $this->_taxData->getPrice($product, $finalPrice, $includeTax); + $minimalPrice = $maximalPrice = $this->_catalogData->getTaxPrice($product, $finalPrice, $includeTax); } else { // PRICE_TYPE_DYNAMIC $minimalPrice = $maximalPrice = 0; @@ -235,7 +232,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price $item = $product->getPriceType() == self::PRICE_TYPE_FIXED ? $product : $selection; - $selectionMinimalPrices[] = $this->_taxData->getPrice( + $selectionMinimalPrices[] = $this->_catalogData->getTaxPrice( $item, $this->getSelectionFinalTotalPrice( $product, @@ -247,7 +244,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price ), $includeTax ); - $selectionMaximalPrices[] = $this->_taxData->getPrice( + $selectionMaximalPrices[] = $this->_catalogData->getTaxPrice( $item, $this->getSelectionFinalTotalPrice( $product, @@ -303,7 +300,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price } if (count($prices)) { if ($customOption->getIsRequire()) { - $minimalPrice += $this->_taxData->getPrice($product, min($prices), $includeTax); + $minimalPrice += $this->_catalogData->getTaxPrice($product, min($prices), $includeTax); } $multiTypes = array( @@ -316,15 +313,15 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price } else { $maximalValue = max($prices); } - $maximalPrice += $this->_taxData->getPrice($product, $maximalValue, $includeTax); + $maximalPrice += $this->_catalogData->getTaxPrice($product, $maximalValue, $includeTax); } } else { $valuePrice = $customOption->getPrice(true); if ($customOption->getIsRequire()) { - $minimalPrice += $this->_taxData->getPrice($product, $valuePrice, $includeTax); + $minimalPrice += $this->_catalogData->getTaxPrice($product, $valuePrice, $includeTax); } - $maximalPrice += $this->_taxData->getPrice($product, $valuePrice, $includeTax); + $maximalPrice += $this->_catalogData->getTaxPrice($product, $valuePrice, $includeTax); } } } diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index c0a9d91f9b5..1bc4d0b8abc 100644 --- a/app/code/Magento/Bundle/composer.json +++ b/app/code/Magento/Bundle/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-catalog-rule": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-weee": "0.1.0-alpha90", - "magento/module-gift-message": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", - "magento/module-webapi": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-catalog-rule": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-weee": "0.1.0-alpha91", + "magento/module-gift-message": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", + "magento/module-webapi": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Bundle/view/frontend/templates/rss/catalog/product/price.phtml b/app/code/Magento/Bundle/view/frontend/templates/rss/catalog/product/price.phtml deleted file mode 100644 index 209d6a4c6a3..00000000000 --- a/app/code/Magento/Bundle/view/frontend/templates/rss/catalog/product/price.phtml +++ /dev/null @@ -1,273 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> - -<?php -/** - * Template for displaying bundle product price in RSS feeds - * - * @var $this \Magento\Bundle\Block\Catalog\Product\Price - */ -?> - -<?php $_product = $this->getProduct() ?> -<?php -/** @var \Magento\Bundle\Model\Product\Price $_priceModel */ -$_priceModel = $_product->getPriceModel() -?> -<?php list($_minimalPrice, $_maximalPrice) = $_priceModel->getTotalPrices($_product) ?> -<?php $_id = $_product->getId() ?> - -<?php $_weeeTaxAmount = 0; ?> - -<?php $_minimalPriceTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_minimalPrice); ?> -<?php $_minimalPriceInclTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_minimalPrice, true); ?> - -<?php -if ($_product->getPriceType() == 1) { - $_weeeTaxAmount = $this->helper('Magento\Weee\Helper\Data')->getAmount($_product); - if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4))) { - $_minimalPriceTax += $_weeeTaxAmount; - $_minimalPriceInclTax += $_weeeTaxAmount; - } - if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2)) { - $_minimalPriceInclTax += $_weeeTaxAmount; - } - - if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1,2,4))) { - $_weeeTaxAttributes = $this->helper('Magento\Weee\Helper\Data')->getProductWeeeAttributesForDisplay($_product); - } -} -?> - -<div class="price-box"> - <?php if ($_product->getPriceView()): ?> - <p class="minimal-price"> - <span class="price-label"><?php echo __('As low as') ?>:</span> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - </span> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 1, 4))): ?> - <span class="weee">(<small> - <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 4))): ?> - <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> - <?php else: ?> - <?php $amount = $_weeeTaxAttribute->getAmount(); ?> - <?php endif; ?> - - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($amount, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php endif; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> - </span> - <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 1, 4))): ?> - <span class="weee">(<small> - <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 4))): ?> - <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> - <?php else: ?> - <?php $amount = $_weeeTaxAttribute->getAmount(); ?> - <?php endif; ?> - - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($amount, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2) && $_weeeTaxAmount): ?> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> - <?php endif; ?> - <?php endif; ?> - </p> - <?php else: ?> - <?php if ($_minimalPrice <> $_maximalPrice): ?> - <p class="price-from"> - <span class="price-label"><?php echo __('From') ?>:</span> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - </span> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 1, 4))): ?> - <span class="weee">(<small> - <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 4))): ?> - <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> - <?php else: ?> - <?php $amount = $_weeeTaxAttribute->getAmount(); ?> - <?php endif; ?> - - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($amount, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php endif; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> - </span> - <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 1, 4))): ?> - <span class="weee">(<small> - <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 4))): ?> - <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> - <?php else: ?> - <?php $amount = $_weeeTaxAttribute->getAmount(); ?> - <?php endif; ?> - - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($amount, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2) && $_weeeTaxAmount): ?> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> - <?php endif; ?> - <?php endif; ?> - </p> - <?php $_maximalPriceTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_maximalPrice); ?> - <?php $_maximalPriceInclTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_maximalPrice, true); ?> - <?php - if ($_product->getPriceType() == 1) { - if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4))) { - $_maximalPriceTax += $_weeeTaxAmount; - $_maximalPriceInclTax += $_weeeTaxAmount; - } - if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2)) { - $_maximalPriceInclTax += $_weeeTaxAmount; - } - } - ?> - <p class="price-to"> - <span class="price-label"><?php echo __('To') ?>:</span> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_maximalPriceTax) ?> - </span> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 1, 4))): ?> - <span class="weee">(<small> - <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 4))): ?> - <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> - <?php else: ?> - <?php $amount = $_weeeTaxAttribute->getAmount(); ?> - <?php endif; ?> - - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($amount, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php endif; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax') ?></span> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_maximalPriceInclTax) ?> - </span> - <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_maximalPriceTax) ?> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 1, 4))): ?> - <span class="weee">(<small> - <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 4))): ?> - <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> - <?php else: ?> - <?php $amount = $_weeeTaxAttribute->getAmount(); ?> - <?php endif; ?> - - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($amount, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2) && $_weeeTaxAmount): ?> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_maximalPriceInclTax) ?> - <?php endif; ?> - <?php endif; ?> - </p> - <?php else: ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - </span> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 1, 4))): ?> - <span class="weee">(<small> - <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 4))): ?> - <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> - <?php else: ?> - <?php $amount = $_weeeTaxAttribute->getAmount(); ?> - <?php endif; ?> - - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($amount, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php endif; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> - </span> - <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 1, 4))): ?> - <span class="weee">(<small> - <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(2, 4))): ?> - <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> - <?php else: ?> - <?php $amount = $_weeeTaxAttribute->getAmount(); ?> - <?php endif; ?> - - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($amount, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2) && $_weeeTaxAmount): ?> - <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> - <?php endif; ?> - <?php endif; ?> - <?php endif; ?> - <?php endif; ?> -</div> diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index c00bf2b0825..0a57db0f697 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php index 210bae3a109..05d7aed24b6 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php @@ -146,15 +146,15 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form implements // Add name attribute to checkboxes that correspond to multiselect elements $nameAttributeHtml = $element->getExtType() === 'multiple' ? 'name="' . $element->getId() . '_checkbox"' : ''; $elementId = $element->getId(); + $dataAttribute = "data-disable='{$elementId}'"; $checkboxLabel = __('Change'); $html = <<<HTML <span class="attribute-change-checkbox"> <label> - <input type="checkbox" $nameAttributeHtml onclick="toogleFieldEditMode(this, '{$elementId}')" /> + <input type="checkbox" $nameAttributeHtml onclick="toogleFieldEditMode(this, '{$elementId}')" $dataAttribute /> {$checkboxLabel} </label> </span> -<script>initDisableFields("{$elementId}")</script> HTML; if ($elementId === 'weight') { $html .= <<<HTML diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index d1a2a44fcf6..b8d09e0cbcc 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -33,18 +33,6 @@ abstract class AbstractProduct extends \Magento\Framework\View\Element\Template */ protected $_priceBlock = array(); - /** - * Default price block - * - * @var string - */ - protected $_block = 'Magento\Catalog\Block\Product\Price'; - - /** - * @var string - */ - protected $_priceBlockDefaultTemplate = 'product/price.phtml'; - /** * Flag which allow/disallow to use link for as low as price * diff --git a/app/code/Magento/Catalog/Block/Product/Price.php b/app/code/Magento/Catalog/Block/Product/Price.php index 5eb7f77d1a6..5d0593e5c9b 100644 --- a/app/code/Magento/Catalog/Block/Product/Price.php +++ b/app/code/Magento/Catalog/Block/Product/Price.php @@ -46,13 +46,6 @@ class Price extends \Magento\Framework\View\Element\Template implements \Magento */ protected $_coreRegistry = null; - /** - * Tax data - * - * @var \Magento\Tax\Helper\Data - */ - protected $_taxData = null; - /** * Catalog data * @@ -84,7 +77,6 @@ class Price extends \Magento\Framework\View\Element\Template implements \Magento * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Stdlib\String $string * @param \Magento\Framework\Math\Random $mathRandom @@ -95,20 +87,18 @@ class Price extends \Magento\Framework\View\Element\Template implements \Magento \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Registry $registry, \Magento\Framework\Stdlib\String $string, \Magento\Framework\Math\Random $mathRandom, \Magento\Checkout\Helper\Cart $cartHelper, array $data = array() ) { - $this->_cartHelper = $cartHelper; $this->_jsonEncoder = $jsonEncoder; - $this->_coreRegistry = $registry; $this->_catalogData = $catalogData; - $this->_taxData = $taxData; + $this->_coreRegistry = $registry; $this->string = $string; $this->mathRandom = $mathRandom; + $this->_cartHelper = $cartHelper; parent::__construct($context, $data); } diff --git a/app/code/Magento/Catalog/Block/Product/View/Options.php b/app/code/Magento/Catalog/Block/Product/View/Options.php index 7fc9f67cc4a..982273aa7fc 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options.php @@ -53,13 +53,6 @@ class Options extends \Magento\Framework\View\Element\Template */ protected $_registry = null; - /** - * Tax data - * - * @var \Magento\Tax\Helper\Data - */ - protected $_taxData = null; - /** * Catalog product * @@ -77,11 +70,16 @@ class Options extends \Magento\Framework\View\Element\Template */ protected $_coreData; + /** + * @var \Magento\Catalog\Helper\Data + */ + protected $_catalogData; + /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Model\Product\Option $option * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils @@ -90,18 +88,18 @@ class Options extends \Magento\Framework\View\Element\Template public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Core\Helper\Data $coreData, + \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\Json\EncoderInterface $jsonEncoder, - \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Model\Product\Option $option, \Magento\Framework\Registry $registry, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, array $data = array() ) { $this->_coreData = $coreData; + $this->_catalogData = $catalogData; $this->_jsonEncoder = $jsonEncoder; $this->_registry = $registry; $this->_option = $option; - $this->_taxData = $taxData; $this->arrayUtils = $arrayUtils; parent::__construct($context, $data); } @@ -181,8 +179,8 @@ class Options extends \Magento\Framework\View\Element\Template $data['oldPrice'] = $this->_coreData->currency($option->getPrice(false), false, false); $data['priceValue'] = $option->getPrice(false); $data['type'] = $option->getPriceType(); - $data['exclTaxPrice'] = $price = $this->_taxData->getPrice($option->getProduct(), $data['price'], false); - $data['inclTaxPrice'] = $price = $this->_taxData->getPrice($option->getProduct(), $data['price'], true); + $data['exclTaxPrice'] = $price = $this->_catalogData->getTaxPrice($option->getProduct(), $data['price']); + $data['inclTaxPrice'] = $price = $this->_catalogData->getTaxPrice($option->getProduct(), $data['price'], true); return $data; } diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php b/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php index fe1bb8360e3..817eecc34a8 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php @@ -47,31 +47,29 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template protected $_option; /** - * Tax data - * - * @var \Magento\Tax\Helper\Data + * @var \Magento\Core\Helper\Data */ - protected $_taxData = null; + protected $_coreHelper; /** - * @var \Magento\Core\Helper\Data + * @var \Magento\Catalog\Helper\Data */ - protected $_coreHelper; + protected $_catalogHelper; /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Helper\Data $coreHelper + * @param \Magento\Catalog\Helper\Data $catalogData, * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Tax\Helper\Data $taxData, \Magento\Core\Helper\Data $coreHelper, + \Magento\Catalog\Helper\Data $catalogData, array $data = array() ) { $this->_coreHelper = $coreHelper; - $this->_taxData = $taxData; + $this->_catalogHelper = $catalogData; parent::__construct($context, $data); } @@ -181,9 +179,9 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template public function getPrice($price, $includingTax = null) { if (!is_null($includingTax)) { - $price = $this->_taxData->getPrice($this->getProduct(), $price, true); + $price = $this->_catalogHelper->getTaxPrice($this->getProduct(), $price, true); } else { - $price = $this->_taxData->getPrice($this->getProduct(), $price); + $price = $this->_catalogHelper->getTaxPrice($this->getProduct(), $price); } return $price; } diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php index a191249c092..3369bd4238f 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php @@ -48,20 +48,20 @@ class Date extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Helper\Data $coreHelper + * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Product\Option\Type\Date $catalogProductOptionTypeDate * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Tax\Helper\Data $taxData, \Magento\Core\Helper\Data $coreHelper, + \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Product\Option\Type\Date $catalogProductOptionTypeDate, array $data = array() ) { $this->_catalogProductOptionTypeDate = $catalogProductOptionTypeDate; - parent::__construct($context, $taxData, $coreHelper, $data); + parent::__construct($context, $coreHelper, $catalogData, $data); } /** diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php index 4baa482fa63..244891b4f3d 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php @@ -39,18 +39,18 @@ class Select extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Helper\Data $coreHelper + * @param \Magento\Catalog\Helper\Data $catalogData * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Tax\Helper\Data $taxData, \Magento\Core\Helper\Data $coreHelper, + \Magento\Catalog\Helper\Data $catalogData, array $data = array() ) { $this->_coreHelper = $coreHelper; - parent::__construct($context, $taxData, $coreHelper, $data); + parent::__construct($context, $coreHelper, $catalogData, $data); } /** diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php index a1d9f92e294..8bcf964d191 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php @@ -154,8 +154,7 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribut /** @var \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService */ $stockItemService = $this->_objectManager ->create('Magento\CatalogInventory\Service\V1\StockItemService'); - - foreach ($this->_helper->getProductIds() as $productId) { + foreach ($this->attributeHelper->getProductIds() as $productId) { $stockItemDo = $stockItemService->getStockItem($productId); if (!$stockItemDo->getProductId()) { $inventoryData[] = $productId; @@ -165,7 +164,7 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribut $this->stockItemBuilder->mergeDataObjectWithArray($stockItemDo, $inventoryData) ); } - $this->_stockIndexerProcessor->reindexList($this->_helper->getProductIds()); + $this->_stockIndexerProcessor->reindexList($this->attributeHelper->getProductIds()); } if ($websiteAddData || $websiteRemoveData) { diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php index 36b8da0aa9b..1a1bf36b4c5 100644 --- a/app/code/Magento/Catalog/Helper/Data.php +++ b/app/code/Magento/Catalog/Helper/Data.php @@ -24,6 +24,14 @@ namespace Magento\Catalog\Helper; use Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type; +use Magento\Tax\Service\V1\Data\QuoteDetailsBuilder; +use Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder as QuoteDetailsItemBuilder; +use Magento\Tax\Service\V1\Data\TaxClassKey; +use Magento\Tax\Service\V1\Data\TaxClassKeyBuilder; +use Magento\Tax\Service\V1\TaxCalculationServiceInterface; +use Magento\Customer\Model\Address\Converter as AddressConverter; +use Magento\Customer\Model\Session as CustomerSession; +use Magento\Tax\Model\Config; /** * Catalog data helper @@ -167,6 +175,53 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $_escaper; + /** + * Tax class key builder + * + * @var \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder + */ + protected $_taxClassKeyBuilder; + + /** + * Tax helper + * + * @var \Magento\Tax\Model\Config + */ + protected $_taxConfig; + + /** + * Quote details builder + * + * @var QuoteDetailsBuilder + */ + protected $_quoteDetailsBuilder; + + /** + * Quote details item builder + * + * @var QuoteDetailsItemBuilder + */ + protected $_quoteDetailsItemBuilder; + + /** + * Address converter + * + * @var AddressConverter + */ + protected $_addressConverter; + + /** + * @var CustomerSession + */ + protected $_customerSession; + + /** + * Tax calculation service interface + * + * @var \Magento\Tax\Service\V1\TaxCalculationServiceInterface + */ + protected $_taxCalculationService; + /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeFactory @@ -182,6 +237,13 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory * @param \Magento\Framework\Escaper $escaper * @param string $templateFilterModel + * @param \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder + * @param \Magento\Tax\Model\Config $taxConfig + * @param QuoteDetailsBuilder $quoteDetailsBuilder + * @param QuoteDetailsItemBuilder $quoteDetailsItemBuilder + * @param \Magento\Tax\Service\V1\TaxCalculationServiceInterface $taxCalculationService + * @param CustomerSession $customerSession + * @param AddressConverter $addressConverter */ public function __construct( \Magento\Framework\App\Helper\Context $context, @@ -197,7 +259,14 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory, \Magento\Framework\Escaper $escaper, - $templateFilterModel + $templateFilterModel, + \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder, + \Magento\Tax\Model\Config $taxConfig, + QuoteDetailsBuilder $quoteDetailsBuilder, + QuoteDetailsItemBuilder $quoteDetailsItemBuilder, + \Magento\Tax\Service\V1\TaxCalculationServiceInterface $taxCalculationService, + CustomerSession $customerSession, + AddressConverter $addressConverter ) { $this->_eavAttributeFactory = $eavAttributeFactory; $this->_categoryFactory = $categoryFactory; @@ -212,6 +281,13 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $this->_coreRegistry = $coreRegistry; $this->_templateFilterModel = $templateFilterModel; $this->_escaper = $escaper; + $this->_taxClassKeyBuilder = $taxClassKeyBuilder; + $this->_taxConfig = $taxConfig; + $this->_quoteDetailsBuilder = $quoteDetailsBuilder; + $this->_quoteDetailsItemBuilder = $quoteDetailsItemBuilder; + $this->_taxCalculationService = $taxCalculationService; + $this->_customerSession = $customerSession; + $this->_addressConverter = $addressConverter; parent::__construct($context); } @@ -626,4 +702,113 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $storeId ); } + + /** + * Get product price with all tax settings processing + * + * @param \Magento\Catalog\Model\Product $product + * @param float $price inputted product price + * @param bool $includingTax return price include tax flag + * @param null|Address $shippingAddress + * @param null|Address $billingAddress + * @param null|int $ctc customer tax class + * @param null|string|bool|int|Store $store + * @param bool $priceIncludesTax flag what price parameter contain tax + * @param bool $roundPrice + * @return float + */ + public function getTaxPrice( + $product, + $price, + $includingTax = null, + $shippingAddress = null, + $billingAddress = null, + $ctc = null, + $store = null, + $priceIncludesTax = null, + $roundPrice = true + ) { + if (!$price) { + return $price; + } + + $store = $this->_storeManager->getStore($store); + if ($this->_taxConfig->needPriceConversion($store)) { + if (is_null($priceIncludesTax)) { + $priceIncludesTax = $this->_taxConfig->priceIncludesTax($store); + } + + $shippingAddressDataObject = null; + if ($shippingAddress instanceof \Magento\Customer\Model\Address\AbstractAddress) { + $shippingAddressDataObject = $this->_addressConverter->createAddressFromModel( + $shippingAddress, + null, + null + ); + } + + $billingAddressDataObject = null; + if ($billingAddress instanceof \Magento\Customer\Model\Address\AbstractAddress) { + $billingAddressDataObject = $this->_addressConverter->createAddressFromModel( + $billingAddress, + null, + null + ); + } + + $item = $this->_quoteDetailsItemBuilder->setQuantity(1) + ->setCode($product->getSku()) + ->setShortDescription($product->getShortDescription()) + ->setTaxClassKey( + $this->_taxClassKeyBuilder->setType(TaxClassKey::TYPE_ID) + ->setValue($product->getTaxClassId())->create() + )->setTaxIncluded($priceIncludesTax) + ->setType('product') + ->setUnitPrice($price) + ->create(); + $quoteDetails = $this->_quoteDetailsBuilder + ->setShippingAddress($shippingAddressDataObject) + ->setBillingAddress($billingAddressDataObject) + ->setCustomerTaxClassKey( + $this->_taxClassKeyBuilder->setType(TaxClassKey::TYPE_ID) + ->setValue($ctc)->create() + )->setItems([$item]) + ->setCustomerId($this->_customerSession->getCustomerId()) + ->create(); + + $storeId = null; + if ($store) { + $storeId = $store->getId(); + } + $taxDetails = $this->_taxCalculationService->calculateTax($quoteDetails, $storeId); + $items = $taxDetails->getItems(); + $taxDetailsItem = array_shift($items); + + if (!is_null($includingTax)) { + if ($includingTax) { + $price = $taxDetailsItem->getPriceInclTax(); + } else { + $price = $taxDetailsItem->getPrice(); + } + } else { + switch ($this->_taxConfig->getPriceDisplayType($store)) { + case Config::DISPLAY_TYPE_EXCLUDING_TAX: + case Config::DISPLAY_TYPE_BOTH: + $price = $taxDetailsItem->getPrice(); + break; + case Config::DISPLAY_TYPE_INCLUDING_TAX: + $price = $taxDetailsItem->getPriceInclTax(); + break; + default: + break; + } + } + } + + if ($roundPrice) { + return $store->roundPrice($price); + } else { + return $price; + } + } } diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index 76630102310..7ab74d258bd 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -3,34 +3,33 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-index": "0.1.0-alpha90", - "magento/module-indexer": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-log": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-widget": "0.1.0-alpha90", - "magento/module-wishlist": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-bundle": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-catalog-rule": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-catalog-search": "0.1.0-alpha90", - "magento/module-weee": "0.1.0-alpha90", - "magento/module-product-alert": "0.1.0-alpha90", - "magento/module-url-rewrite": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-index": "0.1.0-alpha91", + "magento/module-indexer": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-log": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-widget": "0.1.0-alpha91", + "magento/module-wishlist": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-bundle": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-catalog-rule": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-catalog-search": "0.1.0-alpha91", + "magento/module-product-alert": "0.1.0-alpha91", + "magento/module-url-rewrite": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index f9b6b5c0836..575f1f91c18 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -53,7 +53,6 @@ <module name="Magento_CatalogRule"/> <module name="Magento_Sales"/> <module name="Magento_CatalogSearch"/> - <module name="Magento_Weee"/> <module name="Magento_ProductAlert"/> <module name="Magento_UrlRewrite"/> </depends> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/price.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/price.phtml deleted file mode 100644 index 9f5f6a91e3a..00000000000 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/price.phtml +++ /dev/null @@ -1,381 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> - -<?php -/** - * Template for displaying product price in different places (products grid, product view page etc) - * - * @var $this \Magento\Catalog\Block\Adminhtml\Product\Price - */ -?> -<?php - /** @var $_coreHelper \Magento\Core\Helper\Data */ - $_coreHelper = $this->helper('Magento\Core\Helper\Data'); - /** @var $weeeHelper \Magento\Weee\Helper\Data */ - $weeeHelper = $this->helper('Magento\Weee\Helper\Data'); - /** @var $taxHelper \Magento\Tax\Helper\Data */ - $taxHelper = $this->helper('Magento\Tax\Helper\Data'); - - $_product = $this->getProduct(); - $_id = $_product->getId(); - $_storeId = $_product->getStoreId(); - $_website = $this->getWebsite($_storeId); - - $_weeeSeparator = ''; - $_simplePricesTax = ($taxHelper->displayPriceIncludingTax() || $taxHelper->displayBothPrices()); - $_minimalPriceValue = $_product->getMinimalPrice(); - $_minimalPrice = $taxHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax); -?> - - -<?php -$_exclTax = $taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax = null); -$_inclTax = $taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax = true); -?> -<?php $_weeeTaxAmount = $weeeHelper->getAmount($_product, $_website); ?> -<?php if ($weeeHelper->typeOfDisplay(array(1,2,4))): ?> - <?php $_weeeTaxAmount = $weeeHelper->getAmount($_product, $_website); ?> - <?php $_weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, $_website); ?> -<?php endif; ?> - -<div class="price-box"> -<?php $_price = $taxHelper->getPrice($_product, $_product->getPrice()) ?> -<?php $_regularPrice = $taxHelper->getPrice($_product, $_product->getPrice(), $_simplePricesTax) ?> -<?php $_finalPrice = $taxHelper->getPrice($_product, $_product->getFinalPrice()) ?> -<?php $_finalPriceInclTax = $taxHelper->getPrice($_product, $_product->getFinalPrice(), true) ?> -<?php $_weeeDisplayType = $weeeHelper->getPriceDisplayType(); ?> -<?php if ($_finalPrice == $_price): ?> - <?php if ($taxHelper->displayBothPrices()): ?> - <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(0)): // including ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?> - </span> - </span> - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(1)): // incl. + weee ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount(), $_storeId, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> - </span> - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(4)): // incl. + weee ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), $_storeId, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> - </span> - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(2)): // excl. + weee + final ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price, $_storeId, true, false) ?> - </span> - </span> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount(), $_storeId, true, true); ?> - </span> - <?php endforeach; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - <?php else: ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price, $_storeId, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax, $_storeId, true, false) ?> - </span> - </span> - <?php endif; ?> - <?php else: ?> - <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(0)): // including ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, true) ?> - </span> - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(1)): // incl. + weee ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, true) ?> - </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount(), $_storeId, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(4)): // incl. + weee ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, true) ?> - </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), $_storeId, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(2)): // excl. + weee + final ?> - <span class="regular-price"><?php echo $_coreHelper->currencyByStore($_price, $_storeId, true, true) ?></span><br /> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount(), $_storeId, true, true); ?> - </span> - <?php endforeach; ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, true) ?> - </span> - <?php else: ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_price, $_storeId, true, true) ?> - </span> - <?php endif; ?> - <?php endif; ?> -<?php else: /* if ($_finalPrice == $_price): */ ?> - <?php $_originalWeeeTaxAmount = $weeeHelper->getOriginalAmount($_product); ?> - - <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(0)): // including ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_regularPrice+$_originalWeeeTaxAmount, $_storeId, true, false) ?> - </span> - </p> - - <?php if ($taxHelper->displayBothPrices()): ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPrice+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - </p> - <?php else: ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPrice+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </p> - <?php endif; ?> - - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(1)): // incl. + weee ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_regularPrice+$_originalWeeeTaxAmount, $_storeId, true, false) ?> - </span> - </p> - - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPrice+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount(), $_storeId, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - </p> - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(4)): // incl. + weee ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_regularPrice+$_originalWeeeTaxAmount, $_storeId, true, false) ?> - </span> - </p> - - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPrice+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), $_storeId, true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - </p> - <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(2)): // excl. + weee + final ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_regularPrice, $_storeId, true, false) ?> - </span> - </p> - - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPrice, $_storeId, true, false) ?> - </span> - </span> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currencyByStore($_weeeTaxAttribute->getAmount(), $_storeId, true, true); ?> - </span> - <?php endforeach; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount, $_storeId, true, false) ?> - </span> - </span> - </p> - <?php else: // excl. ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_regularPrice, $_storeId, true, false) ?> - </span> - </p> - - <?php if ($taxHelper->displayBothPrices()): ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPrice, $_storeId, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax, $_storeId, true, false) ?> - </span> - </span> - </p> - <?php else: ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_finalPrice, $_storeId, true, false) ?> - </span> - </p> - <?php endif; ?> - <?php endif; ?> - -<?php endif; /* if ($_finalPrice == $_price): */ ?> - -<?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_product->getFinalPrice()): ?> - - <?php $_minimalPriceDisplayValue = $_minimalPrice; ?> - <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay(array(0, 1, 4))): ?> - <?php $_minimalPriceDisplayValue = $_minimalPrice+$_weeeTaxAmount; ?> - <?php endif; ?> - - <?php if ($this->getUseLinkForAsLowAs()):?> - <a href="<?php echo $_product->getProductUrl(); ?>" class="minimal-price-link"> - <?php else:?> - <span class="minimal-price-link"> - <?php endif?> - <span class="label"><?php echo __('As low as:') ?></span> - <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currencyByStore($_minimalPriceDisplayValue, $_storeId, true, false) ?> - </span> - <?php if ($this->getUseLinkForAsLowAs()):?> - </a> - <?php else:?> - </span> - <?php endif?> -<?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?> -</div> diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js index 2ff7ac0fd82..0be24d61481 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js @@ -82,8 +82,6 @@ window.Product = {}; }); })(jQuery); -window.onInitDisableFieldsList = []; - function toogleFieldEditMode(toogleIdentifier, fieldContainer) { if ($(toogleIdentifier).checked) { enableFieldEditMode(fieldContainer); @@ -106,12 +104,9 @@ function enableFieldEditMode(fieldContainer) { } } -function initDisableFields(fieldContainer) { - onInitDisableFieldsList.push(fieldContainer); -} - function onCompleteDisableInited() { - onInitDisableFieldsList.each( function(item) { + jQuery.each(jQuery('[data-disable]'), function() { + var item = jQuery(this).data('disable'); disableFieldEditMode(item); }); } @@ -144,7 +139,6 @@ function onCustomUseParentChanged(element) { window.onCustomUseParentChanged = onCustomUseParentChanged; window.onUrlkeyChanged = onUrlkeyChanged; window.onCompleteDisableInited = onCompleteDisableInited; -window.initDisableFields = initDisableFields; window.enableFieldEditMode = enableFieldEditMode; window.disableFieldEditMode = disableFieldEditMode; window.toogleFieldEditMode = toogleFieldEditMode; diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp.phtml deleted file mode 100644 index 6cc66fcc4c1..00000000000 --- a/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp.phtml +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> - -<?php -/** - * Template for displaying product price at catalog and sidebars - * - * @var $this \Magento\Catalog\Block\Product\Price - */ -?> -<?php - /** @var $_product \Magento\Catalog\Model\Product */ - $_product = $this->getProduct(); - $_msrpPrice = ""; - $priceElementIdPrefix = $this->getPriceElementIdPrefix() ? $this->getPriceElementIdPrefix() : 'product-price-'; - $priceElementId = $priceElementIdPrefix . $_product->getId() . $this->getIdSuffix(); -?> - <div class="price-box map info"> - <?php $_price = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getMsrp()) ?> - <?php if ($_product->getMsrp()): ?> - <?php $_msrpPrice = $this->helper('Magento\Core\Helper\Data')->currency($_product->getMsrp(),true,false) ?> - <span class="old price" id="product-price-<?php echo $_product->getId() ?><?php echo $this->getIdSuffix() ?>"><?php echo $_msrpPrice ?></span> - <?php endif; ?> - <?php $popupId = 'msrp-click-' . $_product->getId() . $this->getRandomString(20); ?> - <?php if ($this->helper('Magento\Catalog\Helper\Data')->isShowPriceOnGesture($_product)): ?> - <a href="#" - id="<?php echo($popupId); ?>" - data-mage-init='{"addToCart":{"popupId": "#<?php echo($popupId); ?>", - "productName": "<?php echo $_product->getName() ?>", - "realPrice": <?php echo $this->getRealPriceJs($_product) ?>, - "msrpPrice": "<?php echo $_msrpPrice ?>", - "priceElementId":"<?php echo $priceElementId ?>", - "popupCartButtonId": "#map-popup-button", - "addToCartUrl": "<?php echo $this->getAddToCartUrl($_product) ?>"}}'><?php echo __('Click for price') ?> - </a> - <?php else: ?> - <a href="#" id="<?php echo($popupId);?>" data-mage-init='{"addToCart":{"popupId": "#<?php echo($popupId);?>", "submitUrl": "<?php echo $_product->getProductUrl() ?>"}}'><?php echo __('Click for price') ?></a> - <?php endif; ?> - </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_item.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_item.phtml deleted file mode 100644 index 7772285a4e9..00000000000 --- a/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_item.phtml +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -?> - -<?php -/** - * Template for displaying product price at product view page, gift registry and wishlist - * - * @var $this \Magento\Catalog\Block\Product\Price - */ -?> -<?php -/** @var $_coreHelper \Magento\Core\Helper\Data */ -$_coreHelper = $this->helper('Magento\Core\Helper\Data'); -/** @var $_catalogHelper \Magento\Catalog\Helper\Data */ -$_catalogHelper = $this->helper('Magento\Catalog\Helper\Data'); - -/** @var $_product \Magento\Catalog\Model\Product */ -$_product = $this->getProduct(); -$_id = $_product->getId(); -$_msrpPrice = ''; -$priceElementIdPrefix = $this->getPriceElementIdPrefix() ? $this->getPriceElementIdPrefix() : 'product-price-'; -?> -<div class="price-box map info"> - <?php $_price = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getMsrp()) ?> - <?php if ($_product->getMsrp()): ?> - <?php $_msrpPrice = $_coreHelper->currency($_product->getMsrp(), true, true) ?> - <span class="old-price"><?php echo $_msrpPrice ?></span> - <?php endif; ?> - - <?php if ($_catalogHelper->isShowPriceOnGesture($_product)): ?> - <?php $priceElementId = $priceElementIdPrefix . $_id . $this->getIdSuffix(); ?> - <span id="<?php echo $priceElementId ?>" style="display:none"></span> - <?php $popupId = 'msrp-popup-' . $_id . $this->getRandomString(20); ?> - <a href="#" - id="<?php echo($popupId);?>" - data-mage-init='{"addToCart":{"popupId": "#<?php echo($popupId);?>", - "productName": "<?php echo $_product->getName() ?>", - "realPrice": <?php echo $this->getRealPriceJs($_product) ?>, - "msrpPrice": "<?php echo $_msrpPrice ?>", - "priceElementId":"<?php echo $priceElementId ?>", - "popupCartButtonId": "#map-popup-button", - "cartForm": "#product_addtocart_form"}}'><?php echo __('Click for price') ?> - </a> - <?php else: ?> - <span class="msrp message"> - <?php echo $_catalogHelper->getMsrpPriceMessage($_product) ?> - </span> - <?php endif; ?> - - <?php $helpLinkId = 'msrp-help-' . $_id . $this->getRandomString(20); ?> - <a href="#" id="<?php echo($helpLinkId);?>" data-mage-init='{"addToCart":{"helpLinkId": "#<?php echo($helpLinkId);?>", "productName": "<?php echo $_product->getName() ?>"}}' class="action show map"><span><?php echo __("What's this?"); ?></span></a> -</div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_noform.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_noform.phtml deleted file mode 100644 index b72e92b2ac7..00000000000 --- a/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_noform.phtml +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> - -<?php -/** - * Template for displaying product price at catalog and sidebars - * - * @var $this \Magento\Catalog\Block\Product\Price - */ -?> -<?php - /** @var $_product \Magento\Catalog\Model\Product */ - $_product = $this->getProduct(); - $_msrpPrice = ""; - $priceElementId = 'product-price-' . $_product->getId() . $this->getIdSuffix(); -?> - <div class="price-box map-info"> - <?php $_price = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getMsrp()) ?> - <?php if ($_product->getMsrp()): ?> - <?php $_msrpPrice = $this->helper('Magento\Core\Helper\Data')->currency($_product->getMsrp(),true,false) ?> - <span class="old-price" id="product-price-<?php echo $_product->getId() ?><?php echo $this->getIdSuffix() ?>"><?php echo $_msrpPrice ?></span> - <?php endif; ?> - <?php $popupId = 'msrp-click-' . $_product->getId() . $this->getRandomString(20); ?> - <?php if ($this->helper('Magento\Catalog\Helper\Data')->isShowPriceOnGesture($_product)): ?> - <a href="#" - id="<?php echo($popupId); ?>" - data-mage-init='{"addToCart":{"popupId": "#<?php echo($popupId); ?>", - "productName": "<?php echo $_product->getName() ?>", - "realPrice": <?php echo $this->getRealPriceJs($_product) ?>, - "msrpPrice": "<?php echo $_msrpPrice ?>", - "priceElementId":"<?php echo $priceElementId ?>", - "popupCartButtonId": "#map-popup-button", - "addToCartUrl": "<?php echo $this->getAddToCartUrl($_product) ?>"}}'><?php echo __('Click for price') ?> - </a> - <?php else: ?> - <a href="#" id="<?php echo($popupId);?>" data-mage-init='{"addToCart":{"popupId": "#<?php echo($popupId);?>", "submitUrl": "<?php echo $_product->getProductUrl() ?>"}}'><?php echo __('Click for price') ?></a> - <?php endif; ?> - </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/rss/product/price.phtml b/app/code/Magento/Catalog/view/frontend/templates/rss/product/price.phtml deleted file mode 100644 index 55f0ea599f6..00000000000 --- a/app/code/Magento/Catalog/view/frontend/templates/rss/product/price.phtml +++ /dev/null @@ -1,320 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> - -<?php -/** - * Template for displaying product price in RSS feeds - * - * @var $this \Magento\Catalog\Block\Product\Price - */ -?> -<?php $_product = $this->getProduct() ?> -<?php /* @var $taxHelper \Magento\Tax\Helper\Data */ ?> -<?php $_id = $_product->getId() ?> -<?php $taxHelper = $this->helper('Magento\Tax\Helper\Data'); ?> -<?php if ($_product->getCanShowPrice() !== false):?> - - <?php $_weeeSeparator = ''; ?> - <?php $simplePricesTax = ($taxHelper->displayPriceIncludingTax() || $taxHelper->displayBothPrices()); ?> - <?php $_minimalPriceValue = $_product->getMinimalPrice() ?> - <?php $_minimalPrice = $taxHelper->getPrice($_product, $_minimalPriceValue, $simplePricesTax) ?> - - <?php $_weeeTaxAmount = $this->helper('Magento\Weee\Helper\Data')->getAmountForDisplay($_product); ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1,2,4))): ?> - <?php $_weeeTaxAmount = $this->helper('Magento\Weee\Helper\Data')->getAmount($_product); ?> - <?php $_weeeTaxAttributes = $this->helper('Magento\Weee\Helper\Data')->getProductWeeeAttributesForDisplay($_product); ?> - <?php endif; ?> - - <div class="price-box"> - <?php $_price = $taxHelper->getPrice($_product, $_product->getPrice()) ?> - <?php $_regularPrice = $taxHelper->getPrice($_product, $_product->getPrice(), $simplePricesTax) ?> - <?php $_finalPrice = $taxHelper->getPrice($_product, $_product->getFinalPrice()) ?> - <?php $_finalPriceInclTax = $taxHelper->getPrice($_product, $_product->getFinalPrice(), true) ?> - <?php $_weeeDisplayType = $this->helper('Magento\Weee\Helper\Data')->getPriceDisplayType(); ?> - <?php if ($_finalPrice == $_price): ?> - <?php if ($taxHelper->displayBothPrices()): ?> - <?php if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(0)): // including ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price+$_weeeTaxAmount,true,false) ?></span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?></span> - </span> - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1)): // incl. + weee ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price+$_weeeTaxAmount,true,false) ?></span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?></span> - <br /> - <span class="weee">(<small> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - </span> - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4)): // incl. + weee ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price+$_weeeTaxAmount,true,false) ?></span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?></span> - <br /> - <span class="weee">(<small> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - </span> - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2)): // excl. + weee + final ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price,true,false) ?></span> - </span> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <small> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - </small> - </span> - <br /> - <?php endforeach; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?></span> - </span> - <?php else: ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price,true,false) ?></span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax,true,false) ?></span> - </span> - <?php endif; ?> - <?php else: ?> - <?php if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(0)): // including ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price+$_weeeTaxAmount,true,true) ?></span> - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1)): // incl. + weee ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price+$_weeeTaxAmount,true,true) ?></span> - <br /> - <span class="weee">(<small> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4)): // incl. + weee ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price+$_weeeTaxAmount,true,true) ?></span> - <br /> - <span class="weee">(<small> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2)): // excl. + weee + final ?> - <span class="regular-price"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price,true,true) ?></span><br /> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <small> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - </small> - </span> - <br /> - <?php endforeach; ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price+$_weeeTaxAmount,true,true) ?></span> - <?php else: ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_price,true,true) ?></span> - <?php endif; ?> - <?php endif; ?> - <?php else: /* if ($_finalPrice == $_price): */ ?> - <?php $_originalWeeeTaxAmount = $this->helper('Magento\Weee\Helper\Data')->getOriginalAmount($_product); ?> - - <?php if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(0)): // including ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_regularPrice+$_originalWeeeTaxAmount,true,false) ?></span> - </p> - - <?php if ($taxHelper->displayBothPrices()): ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPrice+$_weeeTaxAmount,true,false) ?></span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?></span> - </span> - </p> - <?php else: ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPrice+$_weeeTaxAmount,true,false) ?></span> - </p> - <?php endif; ?> - - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1)): // incl. + weee ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_regularPrice+$_originalWeeeTaxAmount,true,false) ?></span> - </p> - - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPrice+$_weeeTaxAmount,true,false) ?></span> - </span> - <br /> - <span class="weee">(<small> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?></span> - </span> - </p> - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4)): // incl. + weee ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_regularPrice+$_originalWeeeTaxAmount,true,false) ?></span> - </p> - - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPrice+$_weeeTaxAmount,true,false) ?></span> - </span> - <br /> - <span class="weee">(<small> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - </small>)</span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?></span> - </span> - </p> - <?php elseif ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2)): // excl. + weee + final ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_regularPrice,true,false) ?></span> - </p> - - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPrice,true,false) ?></span> - </span> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <small> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - </small> - </span> - <br /> - <?php endforeach; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?></span> - </span> - </p> - <?php else: // excl. ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_regularPrice,true,false) ?></span> - </p> - - <?php if ($taxHelper->displayBothPrices()): ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPrice,true,false) ?></span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPriceInclTax,true,false) ?></span> - </span> - </p> - <?php else: ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_finalPrice,true,false) ?></span> - </p> - <?php endif; ?> - <?php endif; ?> - - <?php endif; /* if ($_finalPrice == $_price): */ ?> - - <?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_product->getFinalPrice()): ?> - - <?php $_minimalPriceDisplayValue = $_minimalPrice; ?> - <?php if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4))): ?> - <?php $_minimalPriceDisplayValue = $_minimalPrice+$_weeeTaxAmount; ?> - <?php endif; ?> - - <?php if ($this->getUseLinkForAsLowAs()):?> - <a href="<?php echo $_product->getProductUrl(); ?>" class="minimal-price-link"> - <?php else:?> - <span class="minimal-price-link"> - <?php endif?> - <span class="label"><?php echo __('As low as:') ?></span> - <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceDisplayValue,true,false) ?></span> - <?php if ($this->getUseLinkForAsLowAs()):?> - </a> - <?php else:?> - </span> - <?php endif?> - <?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?> - </div> -<?php else: ?> - <?php //echo __('Price is not available');?> -<?php endif; /* if (!$_product->getCanShowPrice()): */?> diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json index 0425996d87d..06bd15c68c2 100644 --- a/app/code/Magento/CatalogImportExport/composer.json +++ b/app/code/Magento/CatalogImportExport/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-core": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-import-export": "0.1.0-alpha90", - "magento/module-indexer": "0.1.0-alpha90", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-import-export": "0.1.0-alpha91", + "magento/module-indexer": "0.1.0-alpha91", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json index f9750651c87..5721d7045b0 100644 --- a/app/code/Magento/CatalogInventory/composer.json +++ b/app/code/Magento/CatalogInventory/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-indexer": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-indexer": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json index 6a1e618d320..28608b1c1fe 100644 --- a/app/code/Magento/CatalogRule/composer.json +++ b/app/code/Magento/CatalogRule/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-rule": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-index": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-rule": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-index": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml index ea5cea28b4d..cb7ee134697 100644 --- a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml +++ b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml @@ -36,7 +36,7 @@ </fieldset> </div> <script type="text/javascript"> -require(["prototype","Magento_Rule/rules"], function(jQuery){ +require(["jquery", "prototype","Magento_Rule/rules"], function(jQuery){ var <?php echo $_element->getHtmlId() ?> = new VarienRulesForm('<?php echo $_element->getHtmlId() ?>', '<?php echo $this->getNewChildUrl() ?>'); <?php if ($_element->getReadonly()): ?> diff --git a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/js.phtml b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/js.phtml index 6a7bf107341..121c0841837 100644 --- a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/js.phtml +++ b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/js.phtml @@ -23,7 +23,7 @@ */ ?> <script type="text/javascript"> -require(["prototype"], function(){ +require(["jquery", "prototype"], function(jQuery){ function hideShowSubproductOptions() { @@ -39,8 +39,7 @@ function hideShowSubproductOptions() return true; } - -document.observe("dom:loaded", hideShowSubproductOptions); +jQuery(document).ready(hideShowSubproductOptions); window.hideShowSubproductOptions = hideShowSubproductOptions; }); </script> diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index 8942d05ba4e..e0fdcebdc80 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-index": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-index": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json index 7c65d2df592..69054e6d6eb 100644 --- a/app/code/Magento/CatalogUrlRewrite/composer.json +++ b/app/code/Magento/CatalogUrlRewrite/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-store": "0.1.0-alpha90", - "magento/module-url-redirect": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90" + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-store": "0.1.0-alpha91", + "magento/module-url-redirect": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json index d3387325b8f..9de60f403a4 100644 --- a/app/code/Magento/Centinel/composer.json +++ b/app/code/Magento/Centinel/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php index 9d731deb3b1..1676d151002 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php @@ -519,4 +519,102 @@ class Renderer extends \Magento\Framework\View\Element\Template implements \Mage return $store->convertPrice($amount, $format); } + + /** + * Return the unit price html + * + * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item + * @return string + */ + public function getUnitPriceHtml(\Magento\Sales\Model\Quote\Item\AbstractItem $item) + { + /** @var Renderer $block */ + $block = $this->getLayout()->getBlock('checkout.item.price.unit'); + $block->setItem($item); + return $block->toHtml(); + } + + /** + * Return row total html + * + * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item + * @return string + */ + public function getRowTotalHtml(\Magento\Sales\Model\Quote\Item\AbstractItem $item) + { + /** @var Renderer $block */ + $block = $this->getLayout()->getBlock('checkout.item.price.row'); + $block->setItem($item); + return $block->toHtml(); + } + + /** + * Return item price html for sidebar + * + * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item + * @return string + */ + public function getSidebarItemPriceHtml(\Magento\Sales\Model\Quote\Item\AbstractItem $item) + { + /** @var Renderer $block */ + $block = $this->getLayout()->getBlock('checkout.cart.item.price.sidebar'); + $block->setItem($item); + return $block->toHtml(); + } + + /** + * Get unit price excluding tax html + * + * @param Item\AbstractItem $item + * @return string + */ + public function getUnitPriceExclTaxHtml(\Magento\Sales\Model\Quote\Item\AbstractItem $item) + { + /** @var Renderer $block */ + $block = $this->getLayout()->getBlock('checkout.onepage.review.item.price.unit.excl'); + $block->setItem($item); + return $block->toHtml(); + } + + /** + * Get unit price including tax html + * + * @param Item\AbstractItem $item + * @return string + */ + public function getUnitPriceInclTaxHtml(\Magento\Sales\Model\Quote\Item\AbstractItem $item) + { + /** @var Renderer $block */ + $block = $this->getLayout()->getBlock('checkout.onepage.review.item.price.unit.incl'); + $block->setItem($item); + return $block->toHtml(); + } + + /** + * Get row total excluding tax html + * + * @param Item\AbstractItem $item + * @return string + */ + public function getRowtotalExclTaxHtml(\Magento\Sales\Model\Quote\Item\AbstractItem $item) + { + /** @var Renderer $block */ + $block = $this->getLayout()->getBlock('checkout.onepage.review.item.price.rowtotal.excl'); + $block->setItem($item); + return $block->toHtml(); + } + + /** + * Get row total including tax html + * + * @param Item\AbstractItem $item + * @return string + */ + public function getRowtotalInclTaxHtml(\Magento\Sales\Model\Quote\Item\AbstractItem $item) + { + /** @var Renderer $block */ + $block = $this->getLayout()->getBlock('checkout.onepage.review.item.price.rowtotal.incl'); + $block->setItem($item); + return $block->toHtml(); + } } diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index 3aeb01eaac9..0a09072292a 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -49,11 +49,6 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ protected $_directoryBlock; - /** - * @var \Magento\Tax\Helper\Data - */ - protected $_taxHelper; - /** * @var \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface */ @@ -65,7 +60,6 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Directory\Block\Data $directoryBlock - * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory * @param array $data */ @@ -75,12 +69,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Directory\Block\Data $directoryBlock, - \Magento\Tax\Helper\Data $taxHelper, \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, array $data = array() ) { $this->_directoryBlock = $directoryBlock; - $this->_taxHelper = $taxHelper; $this->_carrierFactory = $carrierFactory; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; @@ -241,25 +233,6 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart return $this->getQuote()->getStore()->convertPrice($price, true); } - /** - * Get Shipping Price - * - * @param float $price - * @param bool $flag - * @return float - */ - public function getShippingPrice($price, $flag) - { - return $this->formatPrice( - $this->_taxHelper->getShippingPrice( - $price, - $flag, - $this->getAddress(), - $this->getQuote()->getCustomerTaxClassId() - ) - ); - } - /** * Obtain available carriers instances * @@ -325,4 +298,18 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart } return false; } + + /** + * Get shipping price html + * + * @param \Magento\Sales\Model\Quote\Address\Rate $shippingRate + * @return string + */ + public function getShippingPriceHtml(\Magento\Sales\Model\Quote\Address\Rate $shippingRate) + { + /** @var \Magento\Checkout\Block\Shipping\Price $block */ + $block = $this->getLayout()->getBlock('checkout.shipping.price'); + $block->setShippingRate($shippingRate); + return $block->toHtml(); + } } diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php index 1daf4dd68cf..d54530e2f67 100644 --- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php +++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php @@ -36,23 +36,11 @@ class Sidebar extends AbstractCart implements IdentityInterface */ const XML_PATH_CHECKOUT_SIDEBAR_COUNT = 'checkout/sidebar/count'; - /** - * Tax data - * - * @var \Magento\Tax\Helper\Data - */ - protected $_taxData; - /** * @var \Magento\Catalog\Model\Resource\Url */ protected $_catalogUrl; - /** - * @var \Magento\Tax\Model\Config - */ - protected $_taxConfig; - /** * @var \Magento\Checkout\Model\Cart */ @@ -68,9 +56,7 @@ class Sidebar extends AbstractCart implements IdentityInterface * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Model\Resource\Url $catalogUrl - * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Checkout\Model\Cart $checkoutCart * @param \Magento\Checkout\Helper\Data $checkoutHelper * @param array $data @@ -82,17 +68,13 @@ class Sidebar extends AbstractCart implements IdentityInterface \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Model\Resource\Url $catalogUrl, - \Magento\Tax\Model\Config $taxConfig, \Magento\Checkout\Model\Cart $checkoutCart, \Magento\Checkout\Helper\Data $checkoutHelper, array $data = array() ) { $this->_checkoutHelper = $checkoutHelper; - $this->_taxData = $taxData; $this->_catalogUrl = $catalogUrl; - $this->_taxConfig = $taxConfig; $this->_checkoutCart = $checkoutCart; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; @@ -159,79 +141,18 @@ class Sidebar extends AbstractCart implements IdentityInterface /** * Get shopping cart subtotal. * - * It will include tax, if required by config settings. - * - * @param bool $skipTax flag for getting price with tax or not. Ignored in case when we display just subtotal incl.tax - * @return float + * @return float */ - public function getSubtotal($skipTax = true) + public function getSubtotal() { $subtotal = 0; $totals = $this->getTotals(); if (isset($totals['subtotal'])) { - if ($this->_taxConfig->displayCartSubtotalBoth()) { - if ($skipTax) { - $subtotal = $totals['subtotal']->getValueExclTax(); - } else { - $subtotal = $totals['subtotal']->getValueInclTax(); - } - } elseif ($this->_taxConfig->displayCartSubtotalInclTax()) { - $subtotal = $totals['subtotal']->getValueInclTax(); - } else { - $subtotal = $totals['subtotal']->getValue(); - if (!$skipTax && isset($totals['tax'])) { - $subtotal += $totals['tax']->getValue(); - } - } + $subtotal = $totals['subtotal']->getValue(); } return $subtotal; } - /** - * Get subtotal, including tax. - * Will return > 0 only if appropriate config settings are enabled. - * - * @return float - */ - public function getSubtotalInclTax() - { - if (!$this->_taxConfig->displayCartSubtotalBoth()) { - return 0; - } - return $this->getSubtotal(false); - } - - /** - * Add tax to amount - * - * @param float $price - * @param bool $exclShippingTax - * @return float - */ - private function _addTax($price, $exclShippingTax = true) - { - $totals = $this->getTotals(); - if (isset($totals['tax'])) { - if ($exclShippingTax) { - $price += $totals['tax']->getValue() - $this->_getShippingTaxAmount(); - } else { - $price += $totals['tax']->getValue(); - } - } - return $price; - } - - /** - * Get shipping tax amount - * - * @return float - */ - protected function _getShippingTaxAmount() - { - $quote = $this->getCustomQuote() ? $this->getCustomQuote() : $this->getQuote(); - return $quote->getShippingAddress()->getShippingTaxAmount(); - } - /** * Get shopping cart items qty based on configuration (summary qty or items qty) * @@ -245,18 +166,6 @@ class Sidebar extends AbstractCart implements IdentityInterface return $this->_checkoutCart->getSummaryQty(); } - /** - * Get incl/excl tax label - * - * @param bool $flag - * @return string - */ - public function getIncExcTax($flag) - { - $text = $this->_taxData->getIncExcText($flag); - return $text ? ' (' . $text . ')' : ''; - } - /** * Check if one page checkout is available * @@ -390,4 +299,9 @@ class Sidebar extends AbstractCart implements IdentityInterface } return $identities; } + + public function getTotalsHtml() + { + return $this->getLayout()->getBlock('checkout.cart.minicart.totals')->toHtml(); + } } diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar/Totals.php b/app/code/Magento/Checkout/Block/Cart/Sidebar/Totals.php new file mode 100644 index 00000000000..ab13796b39a --- /dev/null +++ b/app/code/Magento/Checkout/Block/Cart/Sidebar/Totals.php @@ -0,0 +1,48 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Cart\Sidebar; + +use Magento\Checkout\Block\Cart\AbstractCart; +use Magento\Framework\View\Block\IdentityInterface; + +/** + * Sidebar totals block + */ +class Totals extends AbstractCart +{ + /** + * Get shopping cart subtotal. + * + * @return float + */ + public function getSubtotal() + { + $subtotal = 0; + $totals = $this->getTotals(); + if (isset($totals['subtotal'])) { + $subtotal = $totals['subtotal']->getValue(); + } + return $subtotal; + } +} diff --git a/app/code/Magento/Checkout/Block/Item/Price/Renderer.php b/app/code/Magento/Checkout/Block/Item/Price/Renderer.php new file mode 100644 index 00000000000..eb3f7c0eb6f --- /dev/null +++ b/app/code/Magento/Checkout/Block/Item/Price/Renderer.php @@ -0,0 +1,61 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Item\Price; + +use Magento\Sales\Model\Quote\Item\AbstractItem; + +/** + * Item price render block + * + * @author Magento Core Team <core@magentocommerce.com> + */ +class Renderer extends \Magento\Framework\View\Element\Template +{ + /** + * @var AbstractItem + */ + protected $item; + + /** + * Set item for render + * + * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item + * @return $this + */ + public function setItem(\Magento\Sales\Model\Quote\Item\AbstractItem $item) + { + $this->item = $item; + return $this; + } + + /** + * Get quote item + * + * @return AbstractItem + */ + public function getItem() + { + return $this->item; + } +} diff --git a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php index 29a280b2cc2..f2dd37e7f8e 100644 --- a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php +++ b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php @@ -388,4 +388,18 @@ abstract class AbstractOnepage extends \Magento\Framework\View\Element\Template { return true; } + + /** + * Return the html text for shipping price + * + * @param \Magento\Sales\Model\Quote\Address\Rate $rate + * @return string + */ + public function getShippingPriceHtml(\Magento\Sales\Model\Quote\Address\Rate $rate) + { + /** @var \Magento\Checkout\Block\Shipping\Price $block */ + $block = $this->getLayout()->getBlock('checkout.shipping.price'); + $block->setShippingRate($rate); + return $block->toHtml(); + } } diff --git a/app/code/Magento/Checkout/Block/Onepage/Progress.php b/app/code/Magento/Checkout/Block/Onepage/Progress.php index 203705e6386..a82c21b96c1 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Progress.php +++ b/app/code/Magento/Checkout/Block/Onepage/Progress.php @@ -35,59 +35,6 @@ use Magento\Sales\Model\Quote\Address; */ class Progress extends \Magento\Checkout\Block\Onepage\AbstractOnepage { - /** - * @var \Magento\Tax\Helper\Data - */ - protected $_taxData; - - /** - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Framework\App\Cache\Type\Config $configCacheType - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Checkout\Model\Session $resourceSession - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory - * @param CustomerAccountService $customerAccountService - * @param CustomerAddressService $customerAddressService - * @param AddressConfig $addressConfig - * @param \Magento\Framework\App\Http\Context $httpContext - * @param \Magento\Tax\Helper\Data $taxData - * @param array $data - */ - public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Core\Helper\Data $coreData, - \Magento\Framework\App\Cache\Type\Config $configCacheType, - \Magento\Customer\Model\Session $customerSession, - \Magento\Checkout\Model\Session $resourceSession, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, - CustomerAccountService $customerAccountService, - CustomerAddressService $customerAddressService, - AddressConfig $addressConfig, - \Magento\Framework\App\Http\Context $httpContext, - \Magento\Tax\Helper\Data $taxData, - array $data = array() - ) { - parent::__construct( - $context, - $coreData, - $configCacheType, - $customerSession, - $resourceSession, - $countryCollectionFactory, - $regionCollectionFactory, - $customerAccountService, - $customerAddressService, - $addressConfig, - $httpContext, - $data - ); - $this->_taxData = $taxData; - } - - /** * @return Address */ @@ -162,42 +109,15 @@ class Progress extends \Magento\Checkout\Block\Onepage\AbstractOnepage } /** - * Get selected shipping method price + * Return selected shipping rate * - * @param bool $inclTax - * @return string + * @return false|Address\Rate */ - protected function _getShippingPrice($inclTax) + public function getShippingRate() { $address = $this->getQuote()->getShippingAddress(); $rate = $address->getShippingRateByCode($address->getShippingMethod()); - return $this->formatPrice($this->_taxData->getShippingPrice($rate->getPrice(), $inclTax, $address)); - } - /** - * Get quote shipping price including tax - * - * @return float - */ - public function getShippingPriceInclTax() - { - return $this->_getShippingPrice(true); - } - - /** - * @return string - */ - public function getShippingPriceExclTax() - { - return $this->_getShippingPrice(false); - } - - /** - * @param float $price - * @return string - */ - public function formatPrice($price) - { - return $this->getQuote()->getStore()->formatPrice($price); + return $rate; } } diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php index 2963cac3a75..25ab9639223 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php +++ b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php @@ -43,13 +43,6 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage */ protected $_address; - /** - * Tax data - * - * @var \Magento\Tax\Helper\Data - */ - protected $_taxData = null; - /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Core\Helper\Data $coreData @@ -62,7 +55,6 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage * @param CustomerAddressService $customerAddressService * @param AddressConfig $addressConfig * @param \Magento\Framework\App\Http\Context $httpContext - * @param \Magento\Tax\Helper\Data $taxData * @param array $data */ public function __construct( @@ -77,10 +69,8 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage CustomerAddressService $customerAddressService, AddressConfig $addressConfig, \Magento\Framework\App\Http\Context $httpContext, - \Magento\Tax\Helper\Data $taxData, array $data = array() ) { - $this->_taxData = $taxData; parent::__construct( $context, $coreData, @@ -145,17 +135,4 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage { return $this->getAddress()->getShippingMethod(); } - - /** - * @param float $price - * @param bool|null $flag - * @return float - */ - public function getShippingPrice($price, $flag) - { - return $this->getQuote()->getStore()->convertPrice( - $this->_taxData->getShippingPrice($price, $flag, $this->getAddress()), - true - ); - } } diff --git a/app/code/Magento/Checkout/Block/Shipping/Price.php b/app/code/Magento/Checkout/Block/Shipping/Price.php new file mode 100644 index 00000000000..1e88af05e61 --- /dev/null +++ b/app/code/Magento/Checkout/Block/Shipping/Price.php @@ -0,0 +1,68 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Shipping; + +use Magento\Sales\Model\Quote\Address\Rate; +use Magento\Checkout\Block\Cart\AbstractCart; + +class Price extends AbstractCart +{ + /** + * @var Rate + */ + protected $shippingRate; + + /** + * Set the shipping rate + * + * @param Rate $shippingRate + * @return $this + */ + public function setShippingRate(Rate $shippingRate) + { + $this->shippingRate = $shippingRate; + return $this; + } + + /** + * Return shipping rate + * + * @return Rate + */ + public function getShippingRate() + { + return $this->shippingRate; + } + + /** + * Get Shipping Price + * + * @return float + */ + public function getShippingPrice() + { + $price = $this->shippingRate->getPrice(); + return $this->getQuote()->getStore()->convertPrice($price, true); + } +} diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index 8517a00dd58..2e559e01a6b 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -3,26 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-gift-message": "0.1.0-alpha90", - "magento/module-wishlist": "0.1.0-alpha90", - "magento/module-weee": "0.1.0-alpha90", - "magento/module-page-cache": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-gift-message": "0.1.0-alpha91", + "magento/module-wishlist": "0.1.0-alpha91", + "magento/module-page-cache": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml index a4558a93dc1..38fae388995 100644 --- a/app/code/Magento/Checkout/etc/module.xml +++ b/app/code/Magento/Checkout/etc/module.xml @@ -42,7 +42,6 @@ <module name="Magento_Eav"/> <module name="Magento_GiftMessage"/> <module name="Magento_Wishlist"/> - <module name="Magento_Weee"/> <module name="Magento_PageCache"/> <module name="Magento_Theme"/> </depends> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml index e8ac9f9cae1..149824798fb 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml @@ -26,6 +26,7 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="page_one_column"/> <update handle="checkout_cart_item_renderers" /> + <update handle="checkout_shipping_price_renderer" /> <referenceContainer name="content"> <block class="Magento\Checkout\Block\Cart" name="checkout.cart" template="cart.phtml"> <container name="checkout.cart.items" label="invisible" as="with-items"> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml index 084af9a57b2..e028ee7a7d4 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml @@ -24,6 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <update handle="checkout_item_price_renderers" /> <referenceBlock name="checkout.cart.item.renderers"> <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="cart/item/default.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="simple" template="cart/item/default.phtml"/> diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml similarity index 85% rename from app/code/Magento/Bundle/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml rename to app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml index 9179f6c7af5..55c9683a000 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <referenceBlock name="catalog.product.rss.feed.renderer.list"> - <block class="Magento\Bundle\Block\Catalog\Product\Price" as="bundle" template="rss/catalog/product/price.phtml" /> + <referenceBlock name="minicart"> + <block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.cart.item.price.sidebar" template="cart/item/price/sidebar.phtml"/> </referenceBlock> </layout> diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml similarity index 79% rename from app/code/Magento/Catalog/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml rename to app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml index b636cf0843c..a060ae1915a 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml @@ -24,8 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <referenceBlock name="catalog.product.rss.feed.renderer.list"> - <block class="Magento\Catalog\Block\Product\Price" as="default" template="rss/product/price.phtml" /> - <block class="Magento\Catalog\Block\Product\Price" as="msrp_rss" template="product/price_msrp_rss.phtml" /> + <referenceBlock name="minicart"> + <block class="Magento\Checkout\Block\Cart\Sidebar" name="checkout.cart.minicart.totals" template="cart/minicart/totals.phtml"/> </referenceBlock> </layout> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml new file mode 100644 index 00000000000..f7d411546d9 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.item.price.unit" template="item/price/unit.phtml"/> + <block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.item.price.row" template="item/price/row.phtml"/> + <block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.unit.excl" template="onepage/review/item/price/unit_excl_tax.phtml"/> + <block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.unit.incl" template="onepage/review/item/price/unit_incl_tax.phtml"/> + <block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.rowtotal.excl" template="onepage/review/item/price/row_excl_tax.phtml"/> + <block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.rowtotal.incl" template="onepage/review/item/price/row_incl_tax.phtml"/> +</layout> + diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_index.xml index ac0c94c543e..8ba34b0a851 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_index.xml @@ -25,6 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="page_one_column"/> + <update handle="checkout_shipping_price_renderer" /> <referenceContainer name="content"> <block class="Magento\Checkout\Block\Onepage" name="checkout.onepage" template="onepage.phtml"> <block class="Magento\Checkout\Block\Onepage\Login" name="checkout.onepage.login" as="login" template="onepage/login.phtml" cacheable="false"> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_progress.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_progress.xml index 99957b42bd9..6799c05055b 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_progress.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_progress.xml @@ -24,6 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <update handle="checkout_shipping_price_renderer" /> <block class="Magento\Checkout\Block\Onepage\Progress" name="progress" output="1" template="onepage/progress.phtml"> <block class="Magento\Checkout\Block\Onepage\Payment\Info" name="payment_info" cacheable="false"> <action method="setInfoTemplate"> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml index 2de7a5f9f38..cb328bbefff 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -24,6 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <update handle="checkout_item_price_renderers" /> <referenceBlock name="checkout.onepage.review.item.renderers"> <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> </referenceBlock> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_shippingmethod.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_shippingmethod.xml index d2ef4d0e6ff..36e31690129 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_shippingmethod.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_shippingmethod.xml @@ -24,5 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <update handle="checkout_shipping_price_renderer" /> <block class="Magento\Checkout\Block\Onepage\Shipping\Method\Available" name="shipping_method" output="1" template="onepage/shipping_method/available.phtml"/> </layout> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_shipping_price_renderer.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_shipping_price_renderer.xml new file mode 100644 index 00000000000..e7e061fa3c6 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_shipping_price_renderer.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <block class="Magento\Checkout\Block\Shipping\Price" name="checkout.shipping.price" as="shipping.price" template="shipping/price.phtml"/> +</layout> + diff --git a/app/code/Magento/Checkout/view/frontend/layout/default.xml b/app/code/Magento/Checkout/view/frontend/layout/default.xml index 9c372841803..a8748a6d115 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/default.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/default.xml @@ -25,6 +25,8 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="checkout_cart_sidebar_item_renderers" /> + <update handle="checkout_cart_sidebar_item_price_renderers" /> + <update handle="checkout_cart_sidebar_total_renderers" /> <referenceBlock name="head.components"> <block class="Magento\Framework\View\Element\Js\Components" name="checkout_page_head_components" template="Magento_Checkout::js/components.phtml"/> </referenceBlock> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml index 63e830d57ce..c94ff5af7e4 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml @@ -32,42 +32,42 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite <tr class="item info item-info"> <td class="col item"> <?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product photo product-item-photo"> - <?php else:?> + <?php else:?> <span class="product photo product-item-photo"> <?php endif;?> <?php echo $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Image')->init($this->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml(); ?> - <?php if ($this->hasProductUrl()):?></a><?php else: ?></span><?php endif; ?> + <?php if ($this->hasProductUrl()):?></a><?php else: ?></span><?php endif; ?> <div class="product details product-item-details"> <strong class="product name product-item-name"> - <?php if ($this->hasProductUrl()):?> - <a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a> - <?php else: ?> - <?php echo $this->escapeHtml($this->getProductName()) ?> - <?php endif; ?> + <?php if ($this->hasProductUrl()):?> + <a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a> + <?php else: ?> + <?php echo $this->escapeHtml($this->getProductName()) ?> + <?php endif; ?> </strong> <?php if ($_options = $this->getOptionList()):?> - <dl class="cart-item-options"> - <?php foreach ($_options as $_option) : ?> - <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?> - <dt><?php echo $this->escapeHtml($_option['label']) ?></dt> - <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="tooltip wrapper"<?php endif; ?>> - <?php echo $_formatedOptionValue['value'] ?> - <?php if (isset($_formatedOptionValue['full_view'])): ?> - <div class="tooltip content"> - <dl class="item options"> - <dt><?php echo $this->escapeHtml($_option['label']) ?></dt> - <dd><?php echo $_formatedOptionValue['full_view'] ?></dd> - </dl> - </div> - <?php endif; ?> - </dd> - <?php endforeach; ?> - </dl> + <dl class="cart-item-options"> + <?php foreach ($_options as $_option) : ?> + <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?> + <dt><?php echo $this->escapeHtml($_option['label']) ?></dt> + <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="tooltip wrapper"<?php endif; ?>> + <?php echo $_formatedOptionValue['value'] ?> + <?php if (isset($_formatedOptionValue['full_view'])): ?> + <div class="tooltip content"> + <dl class="item options"> + <dt><?php echo $this->escapeHtml($_option['label']) ?></dt> + <dd><?php echo $_formatedOptionValue['full_view'] ?></dd> + </dl> + </div> + <?php endif; ?> + </dd> + <?php endforeach; ?> + </dl> <?php endif;?> <?php if ($messages = $this->getMessages()): ?> - <?php foreach ($messages as $message): ?> - <div class="cart item message <?php echo $message['type'] ?>"><div><?php echo $this->escapeHtml($message['text']) ?></div></div> - <?php endforeach; ?> + <?php foreach ($messages as $message): ?> + <div class="cart item message <?php echo $message['type'] ?>"><div><?php echo $this->escapeHtml($message['text']) ?></div></div> + <?php endforeach; ?> <?php endif; ?> <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?> <?php if ($addInfoBlock): ?> @@ -97,211 +97,42 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite </td> <?php else: ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <td class="col price" data-th="<?php echo $this->escapeHtml(__('Price')); ?>"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <span class="incl tax" data-th="<?php echo $this->escapeHtml(__('Incl. Tax')); ?>"> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?> - <?php endif; ?> - </span> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display: none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee" data-th="<?php echo $this->escapeHtml(__('Total incl. tax')); ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - </span> - <?php endif; ?> - - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax')); ?>"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> - <?php endif; ?> - </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'], true, true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'], true, true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'], true, true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee" data-th="<?php echo $this->escapeHtml(__('Total')); ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - </span> - <?php endif; ?> - <?php $cols++; ?> - </td> - <?php endif; ?> + <td class="col price" data-th="<?php echo $this->escapeHtml(__('Price')); ?>"> + <?php echo $this->getUnitPriceHtml($_item); ?> + <?php $cols++; ?> + </td> <?php endif; ?> <td class="col qty" data-th="<?php echo $this->escapeHtml(__('Qty')); ?>"> <div class="control qty"> - <input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" type="number" size="4" title="<?php echo __('Qty') ?>" class="input-text qty" maxlength="12" data-validate="{required:true,'validate-greater-than-zero':true}"/> + <input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" type="number" size="4" title="<?php echo __('Qty') ?>" class="input-text qty" maxlength="12" data-validate="{required:true,'validate-greater-than-zero':true}"/> </div> <?php $cols++; ?> </td> - <?php if (($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?> <td class="col subtotal" data-th="<?php echo $this->escapeHtml(__('Subtotal'));?>"> - <?php if (($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?> - <span class="incl tax" data-th="<?php echo $this->escapeHtml(__('Incl. Tax'));?>"> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart-tax-total" data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - <?php if ($canApplyMsrp): ?> - <span class="cart msrp subtotal">--</span> - <?php else: ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?> - <?php endif; ?> - <?php endif; ?> - </span> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee" data-th="<?php echo __('Total incl. tax'); ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - </span> - <?php endif; ?> - - <?php if (($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?> - <span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax'));?>"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart-tax-total" data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - <?php if ($canApplyMsrp): ?> - <span class="cart msrp subtotal">--</span> - <?php else: ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> - <?php endif; ?> - <?php endif; ?> - </span> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee" data-th="<?php echo __('Total'); ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - </span> + <?php if ($canApplyMsrp): ?> + <span class="cart msrp subtotal">--</span> + <?php else: ?> + <?php echo $this->getRowTotalHtml($_item); ?> <?php endif; ?> <?php $cols++; ?> </td> - <?php endif; ?> + </tr> <tr class="item actions item-actions"> <td colspan="<?php echo $cols;?>"> <div class="actions"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllowInCart()) : ?> <?php if ($isVisibleProduct): ?> - <a href="#" data-post='<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getMoveFromCartParams($_item->getId()); ?>' class="use-ajax action towishlist"> - <span><?php echo __('Move to Wishlist'); ?></span> - </a> + <a href="#" data-post='<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getMoveFromCartParams($_item->getId()); ?>' class="use-ajax action towishlist"> + <span><?php echo __('Move to Wishlist'); ?></span> + </a> <?php endif ?> <?php endif ?> <?php if ($isVisibleProduct): ?> - <a class="action edit" href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo __('Edit item parameters') ?>"><span><?php echo __('Edit') ?></span></a> + <a class="action edit" href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo __('Edit item parameters') ?>"><span><?php echo __('Edit') ?></span></a> <?php endif ?> <button title="<?php echo __('Remove item') ?>" diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml new file mode 100644 index 00000000000..cae1afcee5c --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml @@ -0,0 +1,33 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Checkout\Block\Item\Price\Renderer */ +?> +<?php $_item = $this->getItem() ?> +<div class="pricing details"> + <div class="rate"> + <span class="label display"><?php echo __('Price'); ?></span> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> + </div> +</div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml index 8216a39c0f1..319c68dbc82 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml @@ -77,18 +77,10 @@ <span class="mark"> <?php echo __('Cart Subtotal') ?> </span> - <div class="amount"> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($this->getSubtotal()) ?> - <?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?> - <span class="amount incl tax"> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_subtotalInclTax) ?> - <?php echo $this->helper('Magento\Tax\Helper\Data')->getIncExcText(true) ?> - </span> - <?php endif; ?> - </div> - <?php endif; ?> + <?php echo $this->getTotalsHtml() ?> + <?php endif ?> </div> - <?php endif ?> + <?php endif; ?> <?php echo $this->getChildHtml('minicart_info') ?> <div class="actions"> <div class="primary"> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_rss.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart/totals.phtml similarity index 67% rename from app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_rss.phtml rename to app/code/Magento/Checkout/view/frontend/templates/cart/minicart/totals.phtml index 933f9e9ee66..914a1795c2c 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/price_msrp_rss.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart/totals.phtml @@ -21,20 +21,10 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -?> -<?php -/** - * Template for displaying product price at rss feeds pages - * - * @var $this \Magento\Catalog\Block\Product\Price - */ -/** @var $_product \Magento\Catalog\Model\Product */ -$_product = $this->getProduct(); +/** @var $this Magento\Checkout\Block\Cart\Sidebar\Totals */ ?> -<div class="price-box map-info"> - <?php if ($this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_product)): ?> - <a href="<?php echo $_product->getProductUrl() ?>"><?php echo __('Click for price'); ?></a> - <?php endif; ?> +<div class="amount"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($this->getSubtotal()) ?> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml index f8ebc3e7357..80b6c5762b6 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml @@ -106,12 +106,7 @@ require([ <input name="estimate_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" /> <label class="label" for="s_method_<?php echo $_rate->getCode() ?>"> <span><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?></span> - <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()); ?> - <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?> - <?php echo $_excl; ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> - (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) - <?php endif; ?> + <?php echo $this->getShippingPriceHtml($_rate) ?> </label> <?php endif ?> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml index ad98c68f8aa..a06f9acf686 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml @@ -72,7 +72,6 @@ <?php // Prices ?> - <div class="pricing details<?php echo $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? ' complex' : ''; ?>"> <?php if ($canApplyMsrp): ?> <div class="rate map"> @@ -81,115 +80,13 @@ </div> <?php else: ?> - - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <div class="rate"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <span class="label excl tax"><?php echo __('Excl. Tax'); ?></span> - <?php else: ?> - <span class="label display"><?php echo __('Price'); ?></span> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales')): ?> - <span class="value excl tax"> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?> - </span> - <?php else: ?> - <span class="value display"> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> - </span> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales')): ?> - - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <div class="rate weee"> - <span class="label weee"><?php echo $tax['title']; ?></span> - <span class="value weee"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'],true,true); ?></span> - </div> - <?php endforeach; ?> - - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales')): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <div class="rate weee"> - <span class="label weee"><?php echo $tax['title']; ?></span> - <span class="value weee"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - </div> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales')): ?> - - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <div class="rate weee"> - <span class="label weee"><?php echo $tax['title']; ?></span> - <span class="value weee"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - </div> - <?php endforeach; ?> - - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales')): ?> - <div class="rate weee total"> - <span class="label weee"><?php echo __('Total:'); ?></span> - <span class="value weee"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - <?php endif; ?> - - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> - <div class="rate"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <span class="label tax incl"><?php echo __('Incl. Tax'); ?></span> - <?php else: ?> - <span class="label display"><?php echo __('Price'); ?></span> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales')): ?> - <span class="value tax incl"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span> - <?php else: ?> - <span class="value display"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?></span> - <?php endif; ?> - </div> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales')): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <div class="rate weee"> - <span class="label weee"><?php echo $tax['title']; ?></span> - <span class="value weee"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'],true,true); ?></span> - </div> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales')): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <div class="rate weee"> - <span class="label weee"><?php echo $tax['title']; ?></span> - <span class="value weee"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - </div> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales')): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <div class="rate weee"> - <span class="label weee"><?php echo $tax['title']; ?></span> - <span class="value weee"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - </div> - <?php endforeach; ?> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales')): ?> - <div class="rate weee total"> - <span class="label weee tax incl"><?php echo __('Total incl. tax'); ?></span> - <span class="value weee"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - <?php endif; ?> - + <?php echo $this->getSidebarItemPriceHtml($_item); ?> <?php endif; //Can apply MSRP ?> <div class="details qty"> <span class="label"><?php echo __('Qty'); ?></span> <span class="value qty"><?php echo $this->getQty() ?></span> </div> - </div> <div class="product actions"> <?php if ($_item->getProduct()->isVisibleInSiteVisibility()):?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml new file mode 100644 index 00000000000..f521c33736b --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml @@ -0,0 +1,33 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Checkout\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax'));?>"> + <span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> + </span> +</span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml new file mode 100644 index 00000000000..8da9e3d05c6 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml @@ -0,0 +1,33 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Checkout\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax')); ?>"> + <span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> + </span> +</span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/progress.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/progress.phtml index 5bd564e8519..0a6c13ef2e7 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/progress.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/progress.phtml @@ -71,16 +71,7 @@ <?php if ($this->getShippingMethod()): ?> <?php echo $this->escapeHtml($this->getShippingDescription()) ?> - <?php $_excl = $this->getShippingPriceExclTax(); ?> - <?php $_incl = $this->getShippingPriceInclTax(); ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()): ?> - <?php echo $_incl; ?> - <?php else: ?> - <?php echo $_excl; ?> - <?php endif; ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> - (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) - <?php endif; ?> + <?php echo $this->getShippingPriceHtml($this->getShippingRate()) ?> <?php else: ?> <?php echo __('Shipping method has not been selected yet') ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml index d303b4da48f..e4fe7fc63a0 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml @@ -25,8 +25,6 @@ /** @var $this Magento\Checkout\Block\Cart\Item\Renderer */ $_item = $this->getItem(); -/** @var $_weeeHelper \Magento\Weee\Helper\Data */ -$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); ?> <tr> <td class="col item" data-th="<?php echo $this->escapeHtml(__('Product Name'));?>"><strong class="product name"><?php echo $this->escapeHtml($this->getProductName()) ?></strong> @@ -55,173 +53,23 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); </td> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> <td class="col price excl tax" data-th="<?php echo $this->escapeHtml(__('Price'));?>"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart tax total" data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> - <?php endif; ?> - - </span> - - - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - - <div class="cart tax info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart tax total" data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee"><?php echo __('Total'); ?><br /> <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> + <?php echo $this->getUnitPriceExclTaxHtml($_item); ?> </td> <?php endif; ?> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> <td class="col price incl tax"> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart tax total" data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_weeeHelper->getWeeeTaxInclTax($_item)); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?> - <?php endif; ?> - - </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - - <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?>></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart tax total" data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee"><?php echo __('Total incl. tax'); ?>:<br /> <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_weeeHelper->getWeeeTaxInclTax($_item)); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> + <?php echo $this->getUnitPriceInclTaxHtml($_item); ?> </td> <?php endif; ?> - <td class="col qty" data-th="<?php echo $this->escapeHtml(__('Qty'));?>"><span class="qty"><?php echo $_item->getQty() ?></span></td> + <td class="col qty"><span class="qty"><?php echo $_item->getQty() ?></span></td> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <td class="col subtotal excl tax" data-th="<?php echo $this->escapeHtml(__('Subtotal'));?>"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart tax total" data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> - <?php endif; ?> - - </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - - <div class="cart tax info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee"><?php echo __('Total'); ?>:<br /> <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> + <td class="col subtotal excl tax"> + <?php echo $this->getRowtotalExclTaxHtml($_item); ?> </td> <?php endif; ?> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> <td class="col subtotal incl tax"> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart tax total" data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_weeeHelper->getRowWeeeTaxInclTax($_item)); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?> - <?php endif; ?> - - </span> - - - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - - <div class="cart tax info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart tax total" data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee"><?php echo __('Total incl. tax'); ?>:<br /> <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_weeeHelper->getRowWeeeTaxInclTax($_item)); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> + <?php echo $this->getRowtotalInclTaxHtml($_item); ?> </td> <?php endif; ?> </tr> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml new file mode 100644 index 00000000000..2624f4597a3 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml @@ -0,0 +1,31 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Checkout\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> +</span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml new file mode 100644 index 00000000000..97f5021039b --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml @@ -0,0 +1,32 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Checkout\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> +<span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> +</span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml new file mode 100644 index 00000000000..5f62b4ef2cf --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml @@ -0,0 +1,31 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Checkout\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> +</span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml new file mode 100644 index 00000000000..cfdc0239fc8 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml @@ -0,0 +1,32 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Checkout\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> +<span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> +</span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/available.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/available.phtml index bae3a2e7c7c..1a861ebcd02 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/available.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/available.phtml @@ -44,12 +44,7 @@ <input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/> <?php endif; ?> <label class="label" for="s_method_<?php echo $_rate->getCode() ?>"><span><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?> - <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()); ?> - <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?> - <?php echo $_excl; ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> - (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) - <?php endif; ?> + <?php echo $this->getShippingPriceHtml($_rate); ?> </span> </label> <?php endif ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/shipping/price.phtml b/app/code/Magento/Checkout/view/frontend/templates/shipping/price.phtml new file mode 100644 index 00000000000..9c1d33fc074 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/shipping/price.phtml @@ -0,0 +1,28 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +?> +<?php /** @var $this \Magento\Checkout\Block\Shipping\Price */ ?> + +<?php $shippingPrice = $this->getShippingPrice(); ?> +<?php echo $shippingPrice; ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/total/tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/total/tax.phtml deleted file mode 100644 index 7689b84c361..00000000000 --- a/app/code/Magento/Checkout/view/frontend/templates/total/tax.phtml +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<?php global $taxIter; $taxIter++; ?> - -<?php - $attributes = 'class="totals-tax"'; - if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() && $this->getTotal()->getValue()!=0) { - $attributes = 'class="totals-tax-summary"'; - } -?> -<tr <?php echo $attributes; ?>> - <td class="mark" colspan="<?php echo $this->getColspan(); ?>" style="<?php echo $this->getTotal()->getStyle() ?>"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> - <div class="detailed"><?php echo $this->getTotal()->getTitle() ?></div> - <?php else: ?> - <?php echo $this->getTotal()->getTitle() ?> - <?php endif;?> - </td> - <td class="amount" style="<?php echo $this->getTotal()->getStyle() ?>"> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($this->getTotal()->getValue()) ?> - </td> -</tr> - -<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() && $this->getTotal()->getValue()!=0): ?> - <?php $isTop = 1; ?> - <?php foreach ($this->getTotal()->getFullInfo() as $info): ?> - <?php if (isset($info['hidden']) && $info['hidden']) continue; ?> - <?php $percent = $info['percent']; ?> - <?php $amount = $info['amount']; ?> - <?php $rates = $info['rates']; ?> - <?php $isFirst = 1; ?> - - <?php foreach ($rates as $rate): ?> - <tr class="totals tax details details-<?php echo $taxIter; ?>"> - <td class="mark" style="<?php echo $this->getTotal()->getStyle() ?>" colspan="<?php echo $this->getColspan(); ?>"> - <?php echo $this->escapeHtml($rate['title']); ?> - <?php if (!is_null($rate['percent'])): ?> - (<?php echo (float)$rate['percent']; ?>%) - <?php endif; ?> - <br /> - </td> - <?php if ($isFirst): ?> - <td class="amount" rowspan="<?php echo count($rates); ?>" style="<?php echo $this->getTotal()->getStyle() ?>"> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($amount); ?> - </td> - <?php endif; ?> - </tr> - <?php $isFirst = 0; ?> - <?php $isTop = 0; ?> - <?php endforeach; ?> - <?php endforeach; ?> -<?php endif;?> diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json index 53612c3a15a..35a7284e76f 100644 --- a/app/code/Magento/CheckoutAgreements/composer.json +++ b/app/code/Magento/CheckoutAgreements/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json index 04e668fb805..8b65e07c9de 100644 --- a/app/code/Magento/Cms/composer.json +++ b/app/code/Magento/Cms/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-widget": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-email": "0.1.0-alpha90", - "magento/module-install": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-widget": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-email": "0.1.0-alpha91", + "magento/module-install": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json index 091d2ae7c31..ee8135442f5 100644 --- a/app/code/Magento/CmsUrlRewrite/composer.json +++ b/app/code/Magento/CmsUrlRewrite/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-url-redirect": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90" + "magento/module-store": "0.1.0-alpha91", + "magento/module-url-redirect": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json index f00320c5f0e..e73c6a4fc62 100644 --- a/app/code/Magento/ConfigurableImportExport/composer.json +++ b/app/code/Magento/ConfigurableImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-catalog-import-export": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-import-export": "0.1.0-alpha90", - "magento/module-configurable-product": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90" + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-catalog-import-export": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-import-export": "0.1.0-alpha91", + "magento/module-configurable-product": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index 7c456e44c9b..5ccabdd7a7a 100644 --- a/app/code/Magento/ConfigurableProduct/composer.json +++ b/app/code/Magento/ConfigurableProduct/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-catalog-rule": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-weee": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", - "magento/module-webapi": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-catalog-rule": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-weee": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", + "magento/module-webapi": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json index acae9e53d5a..bd64a3c22e5 100644 --- a/app/code/Magento/Contact/composer.json +++ b/app/code/Magento/Contact/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Core/composer.json b/app/code/Magento/Core/composer.json index a79885d900b..fe40e8dd03b 100644 --- a/app/code/Magento/Core/composer.json +++ b/app/code/Magento/Core/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-cron": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-page-cache": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-cron": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-page-cache": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Core/view/frontend/web/prototype/magento.css b/app/code/Magento/Core/view/frontend/web/prototype/magento.css index 973df1582cd..97a1b34a5cc 100644 --- a/app/code/Magento/Core/view/frontend/web/prototype/magento.css +++ b/app/code/Magento/Core/view/frontend/web/prototype/magento.css @@ -25,6 +25,7 @@ background: #fff; -webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, .4); box-shadow: 0 3px 6px rgba(0, 0, 0, .4); + z-index: 1000; } .dialog.ui-dialog { @@ -73,18 +74,23 @@ width: 16px; z-index: 1000; text-decoration: none; + line-height: 90%; } .ui-dialog .ui-dialog-titlebar-close:before { color: #676056; - content: "\e012"; - font-family: 'icons'; + content: 'X'; + font-family: sans-serif; font-style: normal; speak: none; font-weight: normal; -webkit-font-smoothing: antialiased; } +.ui-dialog .ui-dialog-titlebar-close .ui-button-text { + display: none; +} + .ui-dialog .ui-dialog-titlebar-close .ui-icon { display: none; } diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json index 24bb9c00e22..aa23e8c2982 100644 --- a/app/code/Magento/Cron/composer.json +++ b/app/code/Magento/Cron/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json index 616e2e5509a..e4057a028bf 100644 --- a/app/code/Magento/CurrencySymbol/composer.json +++ b/app/code/Magento/CurrencySymbol/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-page-cache": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-page-cache": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index 883e23e784e..24835cd97b1 100644 --- a/app/code/Magento/Customer/composer.json +++ b/app/code/Magento/Customer/composer.json @@ -3,29 +3,29 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-newsletter": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-wishlist": "0.1.0-alpha90", - "magento/module-index": "0.1.0-alpha90", - "magento/module-log": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-review": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-page-cache": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", - "magento/module-authorization": "0.1.0-alpha90", - "magento/module-integration": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-newsletter": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-wishlist": "0.1.0-alpha91", + "magento/module-index": "0.1.0-alpha91", + "magento/module-log": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-review": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-page-cache": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", + "magento/module-authorization": "0.1.0-alpha91", + "magento/module-integration": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json index 1ac83c3b036..5230a785e9c 100644 --- a/app/code/Magento/CustomerImportExport/composer.json +++ b/app/code/Magento/CustomerImportExport/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-import-export": "0.1.0-alpha90", - "magento/module-store": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-import-export": "0.1.0-alpha91", + "magento/module-store": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json index ac8de66b7a1..989e8759253 100644 --- a/app/code/Magento/DesignEditor/composer.json +++ b/app/code/Magento/DesignEditor/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-url-rewrite": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-url-rewrite": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml b/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml index 1f250a9966a..e5c673265c7 100644 --- a/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml +++ b/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml @@ -31,7 +31,7 @@ <form id="${id}" data-form="translate-inline-dialog-form"> {{each(i, item) items}} <input id="perstore_${i}" name="translate[${i}][perstore]" type="hidden" value="0"/> - <input name="translate[${i}][original]" type="hidden" value="${item.scope}::${escape(item.original)}"/> + <input name="translate[${i}][original]" type="hidden" value="${escape(item.original)}"/> <textarea id="custom_${i}" name="translate[${i}][custom]" data-translate-input-index="${i}">${escape(item.translated)}</textarea> {{/each}} </form> diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index 0832f2077df..e9347ff479d 100644 --- a/app/code/Magento/Dhl/composer.json +++ b/app/code/Magento/Dhl/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-shipping": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-shipping": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json index d8fee1dd15c..f4f9ad63d70 100644 --- a/app/code/Magento/Directory/composer.json +++ b/app/code/Magento/Directory/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json index dfaa9b07ab4..015b58a6c06 100644 --- a/app/code/Magento/Downloadable/composer.json +++ b/app/code/Magento/Downloadable/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-weee": "0.1.0-alpha90", - "magento/module-wishlist": "0.1.0-alpha90", - "magento/module-gift-message": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-weee": "0.1.0-alpha91", + "magento/module-wishlist": "0.1.0-alpha91", + "magento/module-gift-message": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml b/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml index aae54e11456..8f5d0924188 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml @@ -78,7 +78,7 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite <?php $cols = 1; ?> </td> <?php if ($canApplyMsrp): ?> - <td class="col msrp"<?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> colspan="2"<?php endif; ?>> + <td class="col msrp"> <span class="cart price"> <span class="msrp notice"><?php echo __('See price before order confirmation.'); ?></span> <?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?> @@ -94,95 +94,13 @@ require(['prototype'], function(){ <?php $cols++; ?> </td> <?php else: ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <td class="col price" data-th="<?php echo $this->escapeHtml(__('Price')); ?>"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <span class="incl tax" data-th="<?php echo $this->escapeHtml(__('Incl. Tax')); ?>"> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?> - <?php endif; ?> - </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee" data-th="<?php echo __('Total incl. tax'); ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - <?php $cols++; ?> - </span> - <?php endif; ?> - - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - <span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax')); ?>"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> - <?php endif; ?> - </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee" data-th="<?php echo $this->escapeHtml(__('Total')); ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - </span> - <?php endif; ?> + <td class="col price" data-th="<?php echo $this->escapeHtml(__('Price')); ?>"> + <?php echo $this->getUnitPriceHtml($_item); ?> <?php $cols++; ?> </td> - <?php endif; ?> + + <?php endif; ?> <td class="col qty"> <div class="control qty"> @@ -191,104 +109,14 @@ require(['prototype'], function(){ <?php $cols++; ?> </td> - <?php if (($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() ||$this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?> - <td class="col subtotal" data-th="<?php echo $this->escapeHtml(__('Subtotal'));?>"> - <?php if (($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?> - <span class="incl tax" data-th="<?php echo __('Incl. Tax'); ?>"> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - <?php if ($canApplyMsrp): ?> - <span class="cart msrp subtotal">--</span> - <?php else: ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?> - <?php endif; ?> - <?php endif; ?> - </span> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee" data-th="<?php echo __('Total incl. tax'); ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - </span> + <td class="col subtotal" data-th="<?php echo $this->escapeHtml(__('Subtotal'));?>"> + <?php if ($canApplyMsrp): ?> + <span class="cart msrp subtotal">--</span> + <?php else: ?> + <?php echo $this->getRowTotalHtml($_item); ?> <?php endif; ?> - - <?php if (($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?> - <span class="excl tax" data-th="<?php echo __('Excl. Tax'); ?>"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <span class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <?php else: ?> - <span class="cart price"> - <?php endif; ?> - - <?php if ($canApplyMsrp): ?> - <span class="cart msrp subtotal">--</span> - <?php else: ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?> - <?php else: ?> - <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> - <?php endif; ?> - <?php endif; ?> - - </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php elseif ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-th="<?php echo $tax['title']; ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> - <div class="cart-tax-total" - data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> - <span class="weee" data-th="<?php echo __('Total'); ?>"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span> - </div> - <?php endif; ?> - <?php endif; ?> - </span> - <?php endif; ?> - <?php $cols++; ?> - </td> - <?php endif; ?> + <?php $cols++; ?> + </td> </tr> <tr class="item actions"> <td colspan="<?php echo $cols;?>"> diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json index 4ff54743f58..e8ca0452908 100644 --- a/app/code/Magento/Eav/composer.json +++ b/app/code/Magento/Eav/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 1f01b6d4c0d..acdd4206e94 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index 462b906d620..fc1956a3165 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-shipping": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-shipping": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index 1b7228317bb..27667e3e25a 100644 --- a/app/code/Magento/GiftMessage/composer.json +++ b/app/code/Magento/GiftMessage/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-multishipping": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-multishipping": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json index d6f7e5d6a8e..c923d16192f 100644 --- a/app/code/Magento/GoogleAdwords/composer.json +++ b/app/code/Magento/GoogleAdwords/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json index 4919131005d..098c375ca4a 100644 --- a/app/code/Magento/GoogleAnalytics/composer.json +++ b/app/code/Magento/GoogleAnalytics/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json index c4caba7bbb7..abb7d23a5d4 100644 --- a/app/code/Magento/GoogleOptimizer/composer.json +++ b/app/code/Magento/GoogleOptimizer/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-google-analytics": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-google-analytics": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Price.php b/app/code/Magento/GoogleShopping/Model/Attribute/Price.php index 305eec75a99..81a8cbcc417 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute/Price.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute/Price.php @@ -41,6 +41,11 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute */ protected $_taxData = null; + /** + * @var \Magento\Catalog\Helper\Data|null + */ + protected $_catalogData = null; + /** * Config * @@ -77,6 +82,7 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\GoogleShopping\Model\Config $config * @param \Magento\Customer\Service\V1\CustomerGroupService $customerGroupService + * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data * @@ -94,6 +100,7 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute \Magento\Tax\Helper\Data $taxData, \Magento\GoogleShopping\Model\Config $config, \Magento\Customer\Service\V1\CustomerGroupService $customerGroupService, + \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -102,6 +109,7 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute $this->_taxData = $taxData; $this->_customerGroupService = $customerGroupService; $this->catalogPrice = $catalogPrice; + $this->_catalogData = $catalogData; parent::__construct( $context, $registry, @@ -236,7 +244,7 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute } } if ($product->getTypeId() != Product\Type::TYPE_BUNDLE) { - $price = $this->_taxData->getPrice($product, $price, $inclTax, null, null, null, $product->getStoreId()); + $price = $this->_catalogData->getTaxPrice($product, $price, $inclTax, null, null, null, $product->getStoreId()); } return $price; } @@ -267,7 +275,7 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute } } if ($product->getTypeId() != Product\Type::TYPE_BUNDLE) { - $finalPrice = $this->_taxData->getPrice( + $finalPrice = $this->_catalogData->getTaxPrice( $product, $finalPrice, $inclTax, diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json index 5fc87f04a43..99c1f0a77aa 100644 --- a/app/code/Magento/GoogleShopping/composer.json +++ b/app/code/Magento/GoogleShopping/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json index 9ddd9462305..ffd9ef845df 100644 --- a/app/code/Magento/GroupedImportExport/composer.json +++ b/app/code/Magento/GroupedImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-import-export": "0.1.0-alpha90", - "magento/module-catalog-import-export": "0.1.0-alpha90", - "magento/module-grouped-product": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90" + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-import-export": "0.1.0-alpha91", + "magento/module-catalog-import-export": "0.1.0-alpha91", + "magento/module-grouped-product": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php index be12f61a002..168538c1d4a 100644 --- a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php @@ -35,11 +35,6 @@ use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccou */ class Grouped extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped { - /** - * @var string - */ - protected $_priceBlockDefaultTemplate = 'catalog/product/price.phtml'; - /** * @var \Magento\Core\Helper\Data */ @@ -83,7 +78,6 @@ class Grouped extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped { parent::_construct(); - $this->_block = 'Magento\Catalog\Block\Adminhtml\Product\Price'; $this->_useLinkForAsLowAs = false; } diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index cf8b138e08e..2093d016c8f 100644 --- a/app/code/Magento/GroupedProduct/composer.json +++ b/app/code/Magento/GroupedProduct/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/templates/catalog/product/composite/fieldset/grouped.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/templates/catalog/product/composite/fieldset/grouped.phtml index a8c10055c84..e08864f0138 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/templates/catalog/product/composite/fieldset/grouped.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/templates/catalog/product/composite/fieldset/grouped.phtml @@ -53,7 +53,7 @@ <?php if ($_hasAssociatedProducts): ?> <?php $i = 0 ?> <?php foreach ($_associatedProducts as $_item): ?> - <?php $_finalPriceInclTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_item, $_item->getFinalPrice(), true) ?> + <?php $_finalPriceInclTax = $this->helper('Magento\Catalog\Helper\Data')->getTaxPrice($_item, $_item->getFinalPrice(), true) ?> <tr class="<?php echo (++$i % 2) ? 'even' : 'odd' ?>"> <td class="col-id"><?php echo $_item->getId() ?></td> <td class="col-sku"><?php echo $this->escapeHtml($_item->getSku()) ?></td> diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml index 1b2ed7999cd..6ce28a49898 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_rss_feed_renderer_list.xml @@ -24,9 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <referenceBlock name="catalog.product.rss.feed.renderer.list"> - <block class="Magento\Catalog\Block\Product\Price" as="grouped" template="Magento_GroupedProduct::rss/product/price.phtml" /> - </referenceBlock> <block class="Magento\Framework\Pricing\Render" name="product.price.render.grouped"> <arguments> <argument name="price_render_handle" xsi:type="string">catalog_product_prices</argument> diff --git a/app/code/Magento/GroupedProduct/view/frontend/templates/product/price.phtml b/app/code/Magento/GroupedProduct/view/frontend/templates/product/price.phtml index eb2f83a9815..7199a5fc7ed 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/templates/product/price.phtml +++ b/app/code/Magento/GroupedProduct/view/frontend/templates/product/price.phtml @@ -31,6 +31,8 @@ $_coreHelper = $this->helper('Magento\Core\Helper\Data'); /* @var $taxHelper \Magento\Tax\Helper\Data */ $taxHelper = $this->helper('Magento\Tax\Helper\Data'); +/* @var $catalogHelper \Magento\Catalog\Helper\Data */ +$catalogHelper = $this->helper('Magento\Catalog\Helper\Data'); $_product = $this->getProduct(); $_id = $_product->getId(); @@ -38,13 +40,13 @@ $_minimalPriceValue = $_product->getMinimalPrice(); $showMinPrice = $this->getDisplayMinimalPrice(); if ($showMinPrice && $_minimalPriceValue) { - $_exclTax = $taxHelper->getPrice($_product, $_minimalPriceValue); - $_inclTax = $taxHelper->getPrice($_product, $_minimalPriceValue, true); + $_exclTax = $catalogHelper->getTaxPrice($_product, $_minimalPriceValue); + $_inclTax = $catalogHelper->getTaxPrice($_product, $_minimalPriceValue, true); $price = $showMinPrice ? $_minimalPriceValue : 0; } else { $price = $_product->getFinalPrice(); - $_exclTax = $taxHelper->getPrice($_product, $price); - $_inclTax = $taxHelper->getPrice($_product, $price, true); + $_exclTax = $catalogHelper->getTaxPrice($_product, $price); + $_inclTax = $catalogHelper->getTaxPrice($_product, $price, true); } ?> diff --git a/app/code/Magento/GroupedProduct/view/frontend/templates/rss/product/price.phtml b/app/code/Magento/GroupedProduct/view/frontend/templates/rss/product/price.phtml deleted file mode 100644 index 8624390034a..00000000000 --- a/app/code/Magento/GroupedProduct/view/frontend/templates/rss/product/price.phtml +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -/** - * Template for displaying product price in RSS feeds - * - * @var $this \Magento\Catalog\Block\Product\Price - */ -?> -<?php -$_product = $this->getProduct(); -$_id = $_product->getId(); -$_minimalPriceValue = $_product->getMinimalPrice(); - -/** @var \Magento\Tax\Helper\Data $taxHelper */ -$taxHelper = $this->helper('Magento\Tax\Helper\Data'); -$_exclTax = $taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax = null); -$_inclTax = $taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax = true); -?> - -<?php if ($_product->getCanShowPrice() !== false):?> - <?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue): ?> - <div class="price-box"> - <p class="minimal-price"> - <span class="price-label"><?php echo __('Starting at:') ?></span> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_exclTax, true, false) ?></span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_inclTax, true, false) ?></span> - </span> - <?php else: ?> - <?php - $_showPrice = $_inclTax; - if (!$taxHelper->displayPriceIncludingTax()) { - $_showPrice = $_exclTax; - } - ?> - <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_showPrice, true, false) ?></span> - <?php endif; ?> - </p> - </div> - <?php endif; ?> -<?php endif; ?> diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json index 3b83b038476..224484fd26f 100644 --- a/app/code/Magento/ImportExport/composer.json +++ b/app/code/Magento/ImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-index": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-index": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Index/composer.json b/app/code/Magento/Index/composer.json index fcf3e916598..23a23289511 100644 --- a/app/code/Magento/Index/composer.json +++ b/app/code/Magento/Index/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index 4409860e4a0..3556507c3e1 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-page-cache": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-page-cache": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Install/composer.json b/app/code/Magento/Install/composer.json index 37ae0241420..07bc5522643 100644 --- a/app/code/Magento/Install/composer.json +++ b/app/code/Magento/Install/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-user": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-user": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json index 221c3807348..66472fc0f95 100644 --- a/app/code/Magento/Integration/composer.json +++ b/app/code/Magento/Integration/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-user": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", - "magento/module-authorization": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-user": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", + "magento/module-authorization": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json index 00ec2ff67d6..2b6661ad712 100644 --- a/app/code/Magento/LayeredNavigation/composer.json +++ b/app/code/Magento/LayeredNavigation/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json index 5fb3aacf06e..f582ea2c56c 100644 --- a/app/code/Magento/Log/composer.json +++ b/app/code/Magento/Log/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json index 023416f651c..1413284e44a 100644 --- a/app/code/Magento/Multishipping/composer.json +++ b/app/code/Magento/Multishipping/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-weee": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-weee": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json index 4bc48b94f69..f4b419d6a84 100644 --- a/app/code/Magento/Newsletter/composer.json +++ b/app/code/Magento/Newsletter/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-widget": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-email": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-cron": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-widget": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-email": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-cron": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json index ec0bfcae4b8..a280b3e9cd8 100644 --- a/app/code/Magento/OfflinePayments/composer.json +++ b/app/code/Magento/OfflinePayments/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-payment": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json index e35cbbe2196..46380fe5154 100644 --- a/app/code/Magento/OfflineShipping/composer.json +++ b/app/code/Magento/OfflineShipping/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-shipping": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-sales-rule": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-shipping": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-sales-rule": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Ogone/composer.json b/app/code/Magento/Ogone/composer.json index c32adb17524..846030f27c4 100644 --- a/app/code/Magento/Ogone/composer.json +++ b/app/code/Magento/Ogone/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json index 1a1968b4da9..b3052028f0d 100644 --- a/app/code/Magento/PageCache/composer.json +++ b/app/code/Magento/PageCache/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/PayPalRecurringPayment/composer.json b/app/code/Magento/PayPalRecurringPayment/composer.json index 8c2e560ad96..b057a1b3882 100644 --- a/app/code/Magento/PayPalRecurringPayment/composer.json +++ b/app/code/Magento/PayPalRecurringPayment/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-paypal": "0.1.0-alpha90", - "magento/module-recurring-payment": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-paypal": "0.1.0-alpha91", + "magento/module-recurring-payment": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index fce23ae8959..79f3726af36 100644 --- a/app/code/Magento/Payment/composer.json +++ b/app/code/Magento/Payment/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-centinel": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-centinel": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json index cd97fcde61a..2093260f349 100644 --- a/app/code/Magento/Paypal/composer.json +++ b/app/code/Magento/Paypal/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-centinel": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-centinel": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json index 9f15f4a5107..0c3540b5ac1 100644 --- a/app/code/Magento/Persistent/composer.json +++ b/app/code/Magento/Persistent/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-cron": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-cron": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index 3bb08cf5e15..361ade36842 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -72,11 +72,11 @@ class Observer protected $_errors = array(); /** - * Tax data + * Catalog data * - * @var \Magento\Tax\Helper\Data + * @var \Magento\Catalog\Helper\Data */ - protected $_taxData = null; + protected $_catalogData = null; /** * Core store config @@ -131,7 +131,7 @@ class Observer protected $inlineTranslation; /** - * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ProductAlert\Model\Resource\Price\CollectionFactory $priceColFactory @@ -144,7 +144,7 @@ class Observer * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( - \Magento\Tax\Helper\Data $taxData, + \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ProductAlert\Model\Resource\Price\CollectionFactory $priceColFactory, @@ -156,7 +156,7 @@ class Observer \Magento\ProductAlert\Model\EmailFactory $emailFactory, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation ) { - $this->_taxData = $taxData; + $this->_catalogData = $catalogData; $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_priceColFactory = $priceColFactory; @@ -249,8 +249,8 @@ class Observer $product->setCustomerGroupId($customer->getGroupId()); if ($alert->getPrice() > $product->getFinalPrice()) { $productPrice = $product->getFinalPrice(); - $product->setFinalPrice($this->_taxData->getPrice($product, $productPrice)); - $product->setPrice($this->_taxData->getPrice($product, $product->getPrice())); + $product->setFinalPrice($this->_catalogData->getTaxPrice($product, $productPrice)); + $product->setPrice($this->_catalogData->getTaxPrice($product, $product->getPrice())); $email->addPriceProduct($product); $alert->setPrice($productPrice); diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json index cae86a3d2c9..525c8d9ed50 100644 --- a/app/code/Magento/ProductAlert/composer.json +++ b/app/code/Magento/ProductAlert/composer.json @@ -3,16 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/ProductAlert/etc/module.xml b/app/code/Magento/ProductAlert/etc/module.xml index 301a9234e2d..24262c0128c 100644 --- a/app/code/Magento/ProductAlert/etc/module.xml +++ b/app/code/Magento/ProductAlert/etc/module.xml @@ -34,7 +34,6 @@ <module name="Magento_Catalog"/> <module name="Magento_Customer"/> <module name="Magento_Core"/> - <module name="Magento_Tax"/> </depends> </module> </config> diff --git a/app/code/Magento/RecurringPayment/composer.json b/app/code/Magento/RecurringPayment/composer.json index 1c8a325da56..0e07d3798a3 100644 --- a/app/code/Magento/RecurringPayment/composer.json +++ b/app/code/Magento/RecurringPayment/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json index a1ffb433672..f506ed02d89 100644 --- a/app/code/Magento/Reports/composer.json +++ b/app/code/Magento/Reports/composer.json @@ -3,27 +3,27 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-widget": "0.1.0-alpha90", - "magento/module-log": "0.1.0-alpha90", - "magento/module-wishlist": "0.1.0-alpha90", - "magento/module-review": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-downloadable": "0.1.0-alpha90", - "magento/module-sales-rule": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-widget": "0.1.0-alpha91", + "magento/module-log": "0.1.0-alpha91", + "magento/module-wishlist": "0.1.0-alpha91", + "magento/module-review": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-downloadable": "0.1.0-alpha91", + "magento/module-sales-rule": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json index 6ff6189d3f8..a5a5b0acffa 100644 --- a/app/code/Magento/RequireJs/composer.json +++ b/app/code/Magento/RequireJs/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json index 17d0c66fe78..fb3bc3b4c9d 100644 --- a/app/code/Magento/Review/composer.json +++ b/app/code/Magento/Review/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-newsletter": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-newsletter": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json index dcef739b2ff..c34c06f6bb5 100644 --- a/app/code/Magento/Rss/composer.json +++ b/app/code/Magento/Rss/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-sales-rule": "0.1.0-alpha90", - "magento/module-wishlist": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-review": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-gift-message": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-sales-rule": "0.1.0-alpha91", + "magento/module-wishlist": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-review": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-gift-message": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_category.xml b/app/code/Magento/Rss/view/frontend/layout/rss_catalog_category.xml index 39dcba19076..b22f4d7f108 100644 --- a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_category.xml +++ b/app/code/Magento/Rss/view/frontend/layout/rss_catalog_category.xml @@ -24,10 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <update handle="catalog_product_rss_feed_renderer_list" /> - <block class="Magento\Rss\Block\Catalog\Category" output="1" name="rss.catalog.category" cacheable="false"> - <block class="Magento\Framework\View\Element\RendererList" name="catalog.product.rss.feed.renderer.list" as="renderer.list" /> - </block> + <block class="Magento\Rss\Block\Catalog\Category" output="1" name="rss.catalog.category" cacheable="false"/> <block class="Magento\Framework\Pricing\Render" name="product.price.render.default"> <arguments> <argument name="price_render_handle" xsi:type="string">catalog_product_prices</argument> diff --git a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_new.xml b/app/code/Magento/Rss/view/frontend/layout/rss_catalog_new.xml index eb952b5fc58..abb1d44b535 100644 --- a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_new.xml +++ b/app/code/Magento/Rss/view/frontend/layout/rss_catalog_new.xml @@ -24,7 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <update handle="catalog_product_rss_feed_renderer_list" /> <block class="Magento\Rss\Block\Catalog\NewCatalog" output="1" name="rss.catalog.new" cacheable="false"> <block class="Magento\Framework\Pricing\Render" name="product.price.render.default"> <arguments> diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json index c673316805a..1cfb1de550d 100644 --- a/app/code/Magento/Rule/composer.json +++ b/app/code/Magento/Rule/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json index 3fc154834cc..5baf94d7b0a 100644 --- a/app/code/Magento/Sales/composer.json +++ b/app/code/Magento/Sales/composer.json @@ -3,31 +3,31 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-sales-rule": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-widget": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-gift-message": "0.1.0-alpha90", - "magento/module-reports": "0.1.0-alpha90", - "magento/module-weee": "0.1.0-alpha90", - "magento/module-rss": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-wishlist": "0.1.0-alpha90", - "magento/module-email": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-sales-rule": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-widget": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-gift-message": "0.1.0-alpha91", + "magento/module-reports": "0.1.0-alpha91", + "magento/module-weee": "0.1.0-alpha91", + "magento/module-rss": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-wishlist": "0.1.0-alpha91", + "magento/module-email": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index c89304ffb3f..31548d5e297 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -70,11 +70,11 @@ class Validator extends \Magento\Framework\Model\AbstractModel protected $_skipActionsValidation = false; /** - * Tax data + * Catalog data * - * @var \Magento\Tax\Helper\Data|null + * @var \Magento\Catalog\Helper\Data|null */ - protected $_taxData = null; + protected $_catalogData = null; /** * @var \Magento\SalesRule\Model\Resource\Rule\CollectionFactory @@ -95,7 +95,7 @@ class Validator extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param Resource\Rule\CollectionFactory $collectionFactory - * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\Catalog\Helper\Data $catalogData * @param Utility $utility * @param RulesApplier $rulesApplier * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -106,7 +106,7 @@ class Validator extends \Magento\Framework\Model\AbstractModel \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\SalesRule\Model\Resource\Rule\CollectionFactory $collectionFactory, - \Magento\Tax\Helper\Data $taxData, + \Magento\Catalog\Helper\Data $catalogData, \Magento\SalesRule\Model\Utility $utility, \Magento\SalesRule\Model\RulesApplier $rulesApplier, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -114,7 +114,7 @@ class Validator extends \Magento\Framework\Model\AbstractModel array $data = array() ) { $this->_collectionFactory = $collectionFactory; - $this->_taxData = $taxData; + $this->_catalogData = $catalogData; $this->validatorUtility = $utility; $this->rulesApplier = $rulesApplier; parent::__construct($context, $registry, $resource, $resourceCollection, $data); @@ -391,7 +391,7 @@ class Validator extends \Magento\Framework\Model\AbstractModel */ public function getItemOriginalPrice($item) { - return $this->_taxData->getPrice($item, $item->getOriginalPrice(), true); + return $this->_catalogData->getTaxPrice($item, $item->getOriginalPrice(), true); } /** @@ -414,7 +414,7 @@ class Validator extends \Magento\Framework\Model\AbstractModel */ public function getItemBaseOriginalPrice($item) { - return $this->_taxData->getPrice($item, $item->getBaseOriginalPrice(), true); + return $this->_catalogData->getTaxPrice($item, $item->getBaseOriginalPrice(), true); } /** diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json index 5c5e2f7a787..669dc21cf29 100644 --- a/app/code/Magento/SalesRule/composer.json +++ b/app/code/Magento/SalesRule/composer.json @@ -3,27 +3,26 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-rule": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-shipping": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-reports": "0.1.0-alpha90", - "magento/module-catalog-rule": "0.1.0-alpha90", - "magento/module-widget": "0.1.0-alpha90", - "magento/module-cron": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-rule": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-shipping": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-reports": "0.1.0-alpha91", + "magento/module-catalog-rule": "0.1.0-alpha91", + "magento/module-widget": "0.1.0-alpha91", + "magento/module-cron": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/SalesRule/etc/module.xml b/app/code/Magento/SalesRule/etc/module.xml index 0d241d2a8da..64ccddb8b01 100644 --- a/app/code/Magento/SalesRule/etc/module.xml +++ b/app/code/Magento/SalesRule/etc/module.xml @@ -37,7 +37,6 @@ <module name="Magento_Sales"/> <module name="Magento_Eav"/> <module name="Magento_Core"/> - <module name="Magento_Tax"/> <module name="Magento_Backend"/> <module name="Magento_Customer"/> <module name="Magento_Directory"/> diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json index 2f7f51b67ec..81cc667f62e 100644 --- a/app/code/Magento/Sendfriend/composer.json +++ b/app/code/Magento/Sendfriend/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json index fc4e89cab74..422520ed3e1 100644 --- a/app/code/Magento/Shipping/composer.json +++ b/app/code/Magento/Shipping/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-contact": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-payment": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-contact": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-payment": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "ext-gd": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json index 11958116c04..e96bf61d3d7 100644 --- a/app/code/Magento/Sitemap/composer.json +++ b/app/code/Magento/Sitemap/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index 47e2308ae58..e2581170559 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-core": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-index": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-index": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Tax/Block/Checkout/Cart/Sidebar/Totals.php b/app/code/Magento/Tax/Block/Checkout/Cart/Sidebar/Totals.php new file mode 100644 index 00000000000..37886ded4b9 --- /dev/null +++ b/app/code/Magento/Tax/Block/Checkout/Cart/Sidebar/Totals.php @@ -0,0 +1,146 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Block\Checkout\Cart\Sidebar; + +use Magento\Checkout\Block\Cart\Sidebar\Totals as SidebarTotals; + +/** + * Block for displaying totals in sidebar + */ +class Totals extends SidebarTotals +{ + /** + * Tax data + * + * @var \Magento\Tax\Helper\Data + */ + protected $_taxData; + + /** + * @var \Magento\Tax\Model\Config + */ + protected $_taxConfig; + + /** + * @param \Magento\Framework\View\Element\Template\Context $context + * @param \Magento\Catalog\Helper\Data $catalogData + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Tax\Helper\Data $taxHelper + * @param \Magento\Tax\Model\Config $taxConfig + * @param array $data + */ + public function __construct( + \Magento\Framework\View\Element\Template\Context $context, + \Magento\Catalog\Helper\Data $catalogData, + \Magento\Customer\Model\Session $customerSession, + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Tax\Helper\Data $taxHelper, + \Magento\Tax\Model\Config $taxConfig, + array $data = array() + ) { + $this->_taxData = $taxHelper; + $this->_taxConfig = $taxConfig; + parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + } + + /** + * Get subtotal, including tax. + * + * @return float + */ + public function getSubtotalInclTax() + { + $subtotal = 0; + $totals = $this->getTotals(); + if (isset($totals['subtotal'])) { + $subtotal = $totals['subtotal']->getValueInclTax(); + if (!$subtotal) { + $subtotal = $totals['subtotal']->getValue(); + } + } + + return $subtotal; + } + + /** + * Get subtotal, excluding tax. + * + * @return float + */ + public function getSubtotalExclTax() + { + $subtotal = 0; + $totals = $this->getTotals(); + if (isset($totals['subtotal'])) { + $subtotal = $totals['subtotal']->getValueExclTax(); + if (!$subtotal) { + $subtotal = $totals['subtotal']->getValue(); + } + } + return $subtotal; + } + + /** + * Return whether subtotal should be displayed including tax + * + * @return bool + */ + public function getDisplaySubtotalInclTax() + { + return $this->_taxConfig->displayCartSubtotalInclTax(); + } + + /** + * Return whether subtotal should be displayed excluding tax + * + * @return bool + */ + public function getDisplaySubtotalExclTax() + { + return $this->_taxConfig->displayCartSubtotalExclTax(); + } + + /** + * Return whether subtotal should be displayed excluding and including tax + * + * @return bool + */ + public function getDisplaySubtotalBoth() + { + return $this->_taxConfig->displayCartSubtotalBoth(); + } + + /** + * Get incl/excl tax label + * + * @param bool $flag + * @return string + */ + public function getIncExcTaxLabel($flag) + { + $text = $this->_taxData->getIncExcText($flag); + return $text ? ' (' . $text . ')' : ''; + } +} diff --git a/app/code/Magento/Tax/Block/Checkout/Shipping/Price.php b/app/code/Magento/Tax/Block/Checkout/Shipping/Price.php new file mode 100644 index 00000000000..10d61a940b6 --- /dev/null +++ b/app/code/Magento/Tax/Block/Checkout/Shipping/Price.php @@ -0,0 +1,119 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Block\Checkout\Shipping; + +use Magento\Sales\Model\Quote\Address\Rate; +use Magento\Checkout\Block\Cart\AbstractCart; + +class Price extends \Magento\Checkout\Block\Shipping\Price +{ + /** + * @var \Magento\Tax\Helper\Data + */ + protected $taxHelper; + + /** + * @param \Magento\Framework\View\Element\Template\Context $context + * @param \Magento\Catalog\Helper\Data $catalogData + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Tax\Helper\Data $taxHelper + * @param array $data + */ + public function __construct( + \Magento\Framework\View\Element\Template\Context $context, + \Magento\Catalog\Helper\Data $catalogData, + \Magento\Customer\Model\Session $customerSession, + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Tax\Helper\Data $taxHelper, + array $data = array() + ) { + $this->taxHelper = $taxHelper; + parent::__construct( + $context, + $catalogData, + $customerSession, + $checkoutSession, + $data + ); + } + + /** + * Get Shipping Price including or excluding tax + * + * @param bool $flag + * @return float + */ + protected function getShippingPriceWithFlag($flag) + { + $price = $this->taxHelper->getShippingPrice( + $this->getShippingRate()->getPrice(), + $flag, + $this->getAddress(), + $this->getQuote()->getCustomerTaxClassId() + ); + + return $this->getQuote()->getStore()->convertPrice($price, true); + } + + /** + * Get shipping price excluding tax + * + * @return float + */ + public function getShippingPriceExclTax() + { + return $this->getShippingPriceWithFlag(false); + } + + /** + * Get shipping price including tax + * + * @return float + */ + public function getShippingPriceInclTax() + { + return $this->getShippingPriceWithFlag(true); + } + + /** + * Return flag whether to display shipping price including tax + * + * @return bool + */ + public function displayShippingPriceInclTax() + { + return $this->taxHelper->displayShippingPriceIncludingTax(); + } + + /** + * Return flag whether to display shipping price including and excluding tax + * + * @return bool + */ + public function displayShippingBothPrices() + { + return $this->taxHelper->displayShippingBothPrices(); + } +} diff --git a/app/code/Magento/Tax/Block/Item/Price/Renderer.php b/app/code/Magento/Tax/Block/Item/Price/Renderer.php new file mode 100644 index 00000000000..278de31027f --- /dev/null +++ b/app/code/Magento/Tax/Block/Item/Price/Renderer.php @@ -0,0 +1,83 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Block\Item\Price; + +use Magento\Tax\Helper\Data as TaxHelper; +use Magento\Framework\View\Element\Template\Context; + +/** + * Item price render block + * + * @author Magento Core Team <core@magentocommerce.com> + */ +class Renderer extends \Magento\Checkout\Block\Item\Price\Renderer +{ + /** + * @var \Magento\Tax\Helper\Data + */ + protected $taxHelper; + + /** + * Constructor + * + * @param Context $context + * @param TaxHelper $taxHelper + * @param array $data + */ + public function __construct(Context $context, TaxHelper $taxHelper, array $data = array()) + { + $this->taxHelper = $taxHelper; + parent::__construct($context, $data); + } + + /** + * Return whether display setting is to display price including tax + * + * @return bool + */ + public function displayPriceInclTax() + { + return $this->taxHelper->displayCartPriceInclTax(); + } + + /** + * Return whether display setting is to display price excluding tax + * + * @return bool + */ + public function displayPriceExclTax() + { + return $this->taxHelper->displayCartPriceExclTax(); + } + + /** + * Return whether display setting is to display both price including tax and price excluding tax + * + * @return bool + */ + public function displayBothPrices() + { + return $this->taxHelper->displayCartBothPrices(); + } +} diff --git a/app/code/Magento/Tax/Helper/Data.php b/app/code/Magento/Tax/Helper/Data.php index cb42eb26400..f53c288c487 100644 --- a/app/code/Magento/Tax/Helper/Data.php +++ b/app/code/Magento/Tax/Helper/Data.php @@ -39,16 +39,6 @@ use Magento\Customer\Model\Session as CustomerSession; */ class Data extends \Magento\Framework\App\Helper\AbstractHelper { - /** - * Price conversion constant for positive - */ - const PRICE_CONVERSION_PLUS = 1; - - /** - * Price conversion constant for negative - */ - const PRICE_CONVERSION_MINUS = 2; - /** * Default tax class for customers */ @@ -164,6 +154,13 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $taxClassKeyBuilder; + /** + * \Magento\Catalog\Helper\Data + * + * @var CatalogHelper + */ + protected $catalogHelper; + /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData @@ -182,6 +179,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param TaxCalculationServiceInterface $taxCalculationService * @param CustomerSession $customerSession * @param AddressConverter $addressConverter + * @param \Magento\Catalog\Helper\Data $catalogHelper */ public function __construct( \Magento\Framework\App\Helper\Context $context, @@ -200,7 +198,8 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper TaxClassKeyBuilder $taxClassKeyBuilder, TaxCalculationServiceInterface $taxCalculationService, CustomerSession $customerSession, - AddressConverter $addressConverter + AddressConverter $addressConverter, + \Magento\Catalog\Helper\Data $catalogHelper ) { parent::__construct($context); $this->_scopeConfig = $scopeConfig; @@ -219,6 +218,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $this->taxCalculationService = $taxCalculationService; $this->customerSession = $customerSession; $this->addressConverter = $addressConverter; + $this->catalogHelper = $catalogHelper; } /** @@ -320,35 +320,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ public function needPriceConversion($store = null) { - $res = false; - if ($this->priceIncludesTax($store)) { - switch ($this->getPriceDisplayType($store)) { - case Config::DISPLAY_TYPE_EXCLUDING_TAX: - case Config::DISPLAY_TYPE_BOTH: - return self::PRICE_CONVERSION_MINUS; - case Config::DISPLAY_TYPE_INCLUDING_TAX: - $res = true; - break; - default: - break; - } - } else { - switch ($this->getPriceDisplayType($store)) { - case Config::DISPLAY_TYPE_INCLUDING_TAX: - case Config::DISPLAY_TYPE_BOTH: - return self::PRICE_CONVERSION_PLUS; - case Config::DISPLAY_TYPE_EXCLUDING_TAX: - $res = false; - break; - default: - break; - } - } - - if ($res === false) { - $res = $this->displayTaxColumn(); - } - return $res; + return $this->_config->needPriceConversion($store); } /** @@ -499,151 +471,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper return $this->_coreData->jsonEncode($priceFormat); } - /** - * Get unrounded product price - * - * @param \Magento\Catalog\Model\Product $product - * @param float $price inputed product price - * @param bool $includingTax return price include tax flag - * @param null|Address $shippingAddress - * @param null|Address $billingAddress - * @param null|int $ctc customer tax class - * @param null|string|bool|int|Store $store - * @param bool $priceIncludesTax flag what price parameter contain tax - * @return float - */ - public function getPriceUnrounded( - $product, - $price, - $includingTax = null, - $shippingAddress = null, - $billingAddress = null, - $ctc = null, - $store = null, - $priceIncludesTax = null - ) { - return $this->getPrice( - $product, - $price, - $includingTax, - $shippingAddress, - $billingAddress, - $ctc, - $store, - $priceIncludesTax, - false - ); - } - - /** - * Get product price with all tax settings processing - * - * @param \Magento\Catalog\Model\Product $product - * @param float $price inputed product price - * @param bool $includingTax return price include tax flag - * @param null|Address $shippingAddress - * @param null|Address $billingAddress - * @param null|int $ctc customer tax class - * @param null|string|bool|int|Store $store - * @param bool $priceIncludesTax flag what price parameter contain tax - * @param bool $roundPrice - * @return float - */ - public function getPrice( - $product, - $price, - $includingTax = null, - $shippingAddress = null, - $billingAddress = null, - $ctc = null, - $store = null, - $priceIncludesTax = null, - $roundPrice = true - ) { - if (!$price) { - return $price; - } - - $store = $this->_storeManager->getStore($store); - if ($this->needPriceConversion($store)) { - if (is_null($priceIncludesTax)) { - $priceIncludesTax = $this->priceIncludesTax($store); - } - - $shippingAddressDataObject = null; - if ($shippingAddress instanceof \Magento\Customer\Model\Address\AbstractAddress) { - $shippingAddressDataObject = $this->addressConverter->createAddressFromModel( - $shippingAddress, - null, - null - ); - } - - $billingAddressDataObject = null; - if ($billingAddress instanceof \Magento\Customer\Model\Address\AbstractAddress) { - $billingAddressDataObject = $this->addressConverter->createAddressFromModel( - $billingAddress, - null, - null - ); - } - - $item = $this->quoteDetailsItemBuilder->setQuantity(1) - ->setCode($product->getSku()) - ->setShortDescription($product->getShortDescription()) - ->setTaxClassKey( - $this->taxClassKeyBuilder->setType(TaxClassKey::TYPE_ID) - ->setValue($product->getTaxClassId())->create() - )->setTaxIncluded($priceIncludesTax) - ->setType('product') - ->setUnitPrice($price) - ->create(); - $quoteDetails = $this->quoteDetailsBuilder - ->setShippingAddress($shippingAddressDataObject) - ->setBillingAddress($billingAddressDataObject) - ->setCustomerTaxClassKey( - $this->taxClassKeyBuilder->setType(TaxClassKey::TYPE_ID) - ->setValue($ctc)->create() - )->setItems([$item]) - ->setCustomerId($this->customerSession->getCustomerId()) - ->create(); - - $storeId = null; - if ($store) { - $storeId = $store->getId(); - } - $taxDetails = $this->taxCalculationService->calculateTax($quoteDetails, $storeId); - $items = $taxDetails->getItems(); - $taxDetailsItem = array_shift($items); - - if (!is_null($includingTax)) { - if ($includingTax) { - $price = $taxDetailsItem->getPriceInclTax(); - } else { - $price = $taxDetailsItem->getPrice(); - } - } else { - switch ($this->getPriceDisplayType($store)) { - case Config::DISPLAY_TYPE_EXCLUDING_TAX: - case Config::DISPLAY_TYPE_BOTH: - $price = $taxDetailsItem->getPrice(); - break; - case Config::DISPLAY_TYPE_INCLUDING_TAX: - $price = $taxDetailsItem->getPriceInclTax(); - break; - default: - break; - } - } - } - - if ($roundPrice) { - return $store->roundPrice($price); - } else { - return $price; - } - } - /** * Check if we have display in catalog prices including tax * @@ -770,7 +597,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $billingAddress = $shippingAddress->getQuote()->getBillingAddress(); } - $price = $this->getPrice( + $price = $this->catalogHelper->getTaxPrice( $pseudoProduct, $price, $includingTax, diff --git a/app/code/Magento/Tax/Model/Config.php b/app/code/Magento/Tax/Model/Config.php index e338e2d86e1..88454551201 100644 --- a/app/code/Magento/Tax/Model/Config.php +++ b/app/code/Magento/Tax/Model/Config.php @@ -116,6 +116,16 @@ class Config const DISPLAY_TYPE_BOTH = 3; + /** + * Price conversion constant for positive + */ + const PRICE_CONVERSION_PLUS = 1; + + /** + * Price conversion constant for negative + */ + const PRICE_CONVERSION_MINUS = 2; + /** * @var bool|null */ @@ -801,4 +811,45 @@ class Config $store ); } + + /** + * Check if necessary do product price conversion + * If it necessary will be returned conversion type (minus or plus) + * + * @param null|int|string|Store $store + * @return bool + */ + public function needPriceConversion($store = null) + { + $res = false; + $priceIncludesTax = $this->priceIncludesTax($store) || $this->getNeedUseShippingExcludeTax(); + if ($priceIncludesTax) { + switch ($this->getPriceDisplayType($store)) { + case self::DISPLAY_TYPE_EXCLUDING_TAX: + case self::DISPLAY_TYPE_BOTH: + return self::PRICE_CONVERSION_MINUS; + case self::DISPLAY_TYPE_INCLUDING_TAX: + $res = true; + break; + default: + break; + } + } else { + switch ($this->getPriceDisplayType($store)) { + case self::DISPLAY_TYPE_INCLUDING_TAX: + case self::DISPLAY_TYPE_BOTH: + return self::PRICE_CONVERSION_PLUS; + case self::DISPLAY_TYPE_EXCLUDING_TAX: + $res = false; + break; + default: + break; + } + } + + if ($res === false) { + $res = $this->displayCartPricesBoth(); + } + return $res; + } } diff --git a/app/code/Magento/Tax/Pricing/Adjustment.php b/app/code/Magento/Tax/Pricing/Adjustment.php index edd8467edf5..2497c1da400 100644 --- a/app/code/Magento/Tax/Pricing/Adjustment.php +++ b/app/code/Magento/Tax/Pricing/Adjustment.php @@ -43,6 +43,13 @@ class Adjustment implements AdjustmentInterface */ protected $taxHelper; + /** + * \Magento\Catalog\Helper\Data + * + * @var CatalogHelper + */ + protected $catalogHelper; + /** * @var int|null */ @@ -50,11 +57,13 @@ class Adjustment implements AdjustmentInterface /** * @param TaxHelper $taxHelper - * @param int $sortOrder + * @param \Magento\Catalog\Helper\Data $catalogHelper + * @param int|null $sortOrder */ - public function __construct(TaxHelper $taxHelper, $sortOrder = null) + public function __construct(TaxHelper $taxHelper, \Magento\Catalog\Helper\Data $catalogHelper, $sortOrder = null) { $this->taxHelper = $taxHelper; + $this->catalogHelper = $catalogHelper; $this->sortOrder = $sortOrder; } @@ -98,7 +107,17 @@ class Adjustment implements AdjustmentInterface public function extractAdjustment($amount, SaleableInterface $saleableItem) { if ($this->taxHelper->priceIncludesTax()) { - $adjustedAmount = $this->taxHelper->getPriceUnrounded($saleableItem, $amount); + $adjustedAmount = $this->catalogHelper->getTaxPrice( + $saleableItem, + $amount, + false, + null, + null, + null, + null, + null, + false + ); $result = $amount - $adjustedAmount; } else { $result = 0.; @@ -116,7 +135,17 @@ class Adjustment implements AdjustmentInterface public function applyAdjustment($amount, SaleableInterface $saleableItem) { $includingTax = !$this->taxHelper->priceIncludesTax(); - return $this->taxHelper->getPriceUnrounded($saleableItem, $amount, $includingTax); + return $this->catalogHelper->getTaxPrice( + $saleableItem, + $amount, + $includingTax, + null, + null, + null, + null, + null, + false + ); } /** diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json index c8aeb245caa..965f34bc6c6 100644 --- a/app/code/Magento/Tax/composer.json +++ b/app/code/Magento/Tax/composer.json @@ -3,24 +3,24 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-shipping": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-reports": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-configurable-product": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-shipping": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-reports": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-configurable-product": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Tax/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml b/app/code/Magento/Tax/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml new file mode 100644 index 00000000000..58f761eb8bf --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceBlock name="minicart"> + <block class="Magento\Tax\Block\Item\Price\Renderer" name="checkout.cart.item.price.sidebar" template="Magento_Tax::checkout/cart/item/price/sidebar.phtml"/> + </referenceBlock> +</layout> diff --git a/app/code/Magento/Tax/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml b/app/code/Magento/Tax/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml new file mode 100644 index 00000000000..f0228cef996 --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceBlock name="minicart"> + <block class="Magento\Tax\Block\Checkout\Cart\Sidebar\Totals" name="checkout.cart.minicart.totals" template="Magento_Tax::checkout/cart/minicart/totals.phtml"/> + </referenceBlock> +</layout> diff --git a/app/code/Magento/Tax/view/frontend/layout/checkout_item_price_renderers.xml b/app/code/Magento/Tax/view/frontend/layout/checkout_item_price_renderers.xml new file mode 100644 index 00000000000..704ad0daf23 --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/layout/checkout_item_price_renderers.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <block class="Magento\Tax\Block\Item\Price\Renderer" name="checkout.item.price.unit" template="Magento_Tax::item/price/unit.phtml"/> + <block class="Magento\Tax\Block\Item\Price\Renderer" name="checkout.item.price.row" template="Magento_Tax::item/price/row.phtml"/> +</layout> + diff --git a/app/code/Magento/Tax/view/frontend/layout/checkout_shipping_price_renderer.xml b/app/code/Magento/Tax/view/frontend/layout/checkout_shipping_price_renderer.xml new file mode 100644 index 00000000000..60ff63f4260 --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/layout/checkout_shipping_price_renderer.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <block class="Magento\Tax\Block\Checkout\Shipping\Price" name="checkout.shipping.price" as="shipping.price" template="Magento_Tax::checkout/shipping/price.phtml"/> +</layout> + diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml new file mode 100644 index 00000000000..79e3ace1251 --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml @@ -0,0 +1,51 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Tax\Block\Item\Price\Renderer */ +?> +<?php $_item = $this->getItem() ?> +<div class="pricing details<?php echo $this->displayBothPrices() ? ' complex' : ''; ?>"> +<?php if ($this->displayPriceExclTax() || $this->displayBothPrices()): ?> + <div class="rate"> + <?php if ($this->displayBothPrices()): ?> + <span class="label excl tax"><?php echo __('Excl. Tax'); ?></span> + <?php else: ?> + <span class="label display"><?php echo __('Price'); ?></span> + <?php endif; ?> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> + <?php endif; ?> + </div> + + <?php if ($this->displayPriceInclTax() || $this->displayBothPrices()): ?> + <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> + <div class="rate"> + <?php if ($this->displayBothPrices()): ?> + <span class="label tax incl"><?php echo __('Incl. Tax'); ?></span> + <?php else: ?> + <span class="label display"><?php echo __('Price'); ?></span> + <?php endif; ?> + <span class="value display"><?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?></span> + </div> +<?php endif; ?> +</div> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/cart/minicart/totals.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/minicart/totals.phtml new file mode 100644 index 00000000000..7233ae8212b --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/minicart/totals.phtml @@ -0,0 +1,40 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this Magento\Tax\Block\Checkout\Cart\Sidebar\Totals */ +?> + +<div class="amount"> + <?php if ($this->getDisplaySubtotalExclTax()): ?> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($this->getSubtotalExclTax()); ?> + <?php elseif ($this->getDisplaySubtotalInclTax()): ?> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($this->getSubtotalInclTax()); ?> + <?php else: ?> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($this->getSubtotalExclTax()); ?> + <span class="amount incl tax"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($this->getSubtotalInclTax()) ?> + <?php echo $this->getIncExcTaxLabel(true) ?> + </span> + <?php endif; ?> +</div> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml new file mode 100644 index 00000000000..58246b11f91 --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml @@ -0,0 +1,36 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +?> +<?php /** @var $this \Magento\Tax\Block\Checkout\Shipping\Price */ ?> + +<?php $_excl = $this->getShippingPriceExclTax(); ?> +<?php $_incl = $this->getShippingPriceInclTax(); ?> +<?php if ($this->displayShippingPriceInclTax()): ?> + <?php echo $_incl; ?> +<?php else: ?> + <?php echo $_excl; ?> +<?php endif; ?> +<?php if ($this->displayShippingBothPrices() && $_incl != $_excl): ?> + (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) +<?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml new file mode 100644 index 00000000000..59506d4369b --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml @@ -0,0 +1,43 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Tax\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<?php if (($this->displayPriceInclTax() || $this->displayBothPrices()) && !$_item->getNoSubtotal()): ?> + <span class="incl tax" data-th="<?php echo $this->escapeHtml(__('Incl. Tax'));?>"> + <span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotalInclTax()) ?> + </span> + </span> +<?php endif; ?> + +<?php if (($this->displayPriceExclTax() || $this->displayBothPrices()) && !$_item->getNoSubtotal()): ?> + <span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax'));?>"> + <span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> + </span> + </span> +<?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml new file mode 100644 index 00000000000..0e55d449a60 --- /dev/null +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml @@ -0,0 +1,45 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Tax\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> + +<?php if ($this->displayPriceInclTax() || $this->displayBothPrices()): ?> + <span class="incl tax" data-th="<?php echo $this->escapeHtml(__('Incl. Tax')); ?>"> + <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> + <span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> + </span> + </span> +<?php endif; ?> + +<?php if ($this->displayPriceExclTax() || $this->displayBothPrices()): ?> + <span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax')); ?>"> + <span class="cart price"> + <?php echo $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> + </span> + </span> +<?php endif; ?> diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json index d67905d325b..4fe9b958cc4 100644 --- a/app/code/Magento/Theme/composer.json +++ b/app/code/Magento/Theme/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-translation": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-translation": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index fb8e5baeac5..1c809410bd4 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -384,8 +384,7 @@ class Parser implements \Magento\Framework\Translate\Inline\ParserInterface 'shown' => $matches[1][0], 'translated' => $matches[2][0], 'original' => $matches[3][0], - 'location' => call_user_func($locationCallback, $matches, $options), - 'scope' => $matches[4][0] + 'location' => call_user_func($locationCallback, $matches, $options) ) ); $text = substr_replace($text, $matches[1][0], $matches[0][1], strlen($matches[0][0])); diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json index 400b266e4c5..b15810ed78a 100644 --- a/app/code/Magento/Translation/composer.json +++ b/app/code/Magento/Translation/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-core": "0.1.0-alpha90", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha91", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml b/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml index 246c1994471..64860327bbd 100644 --- a/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml +++ b/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml @@ -49,7 +49,7 @@ <tr> <th class="label"><label for="custom_${i}">Custom:</label></th> <td class="value"> - <input name="translate[${i}][original]" type="hidden" value="${item.scope}::${escape(item.original)}"/> + <input name="translate[${i}][original]" type="hidden" value="${escape(item.original)}"/> <input id="custom_${i}" name="translate[${i}][custom]" class="input-text" value="${escape(item.translated)}" /> </td> </tr> diff --git a/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml b/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml index 1e6c22653e1..3b3e35cd980 100644 --- a/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml +++ b/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml @@ -23,16 +23,17 @@ */ ?> +<link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('prototype/windows/themes/default.css') ?>"/> <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('Magento_Core::prototype/magento.css') ?>"/> <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('mage/translate-inline.css') ?>"/> <script id="translate-inline-icon" type="text/x-jQuery-tmpl"> - <span class="action translate"></span> + <img src="${img}" height="16" width="16" class="translate-edit-icon"> </script> <script id="translate-form-template" type="text/x-jquery-tmpl"> <form id="${id}"> {{each(i, item) items}} - <div class="data table translate"><table cellspacing="0"> + <div class="magento_table_container"><table cellspacing="0"> {{each item}} <tr> <th class="label" style="text-transform: capitalize;">${$index}:</th> @@ -40,15 +41,16 @@ </tr> {{/each}} <tr> - <th class="label"><label for="custom_${i}">Custom:</label></th> + <th class="label"><label for="perstore_${i}">Store View Specific:</label></th> <td class="value"> - <input name="translate[${i}][original]" type="hidden" value="${item.scope}::${escape(item.original)}"/> - <input id="custom_${i}" name="translate[${i}][custom]" class="input-text" value="${escape(item.translated)}" /> + <input id="perstore_${i}" name="translate[${i}][perstore]" type="checkbox" value="1"/> </td> </tr> <tr> - <td colspan="2"> - <label for="perstore_${i}"><input id="perstore_${i}" name="translate[${i}][perstore]" type="checkbox" value="1"/> Store View Specific</label> + <th class="label"><label for="custom_${i}">Custom:</label></th> + <td class="value"> + <input name="translate[${i}][original]" type="hidden" value="${escape(item.original)}"/> + <input id="custom_${i}" name="translate[${i}][custom]" class="input-text" value="${escape(item.translated)}" /> </td> </tr> </table></div> @@ -57,13 +59,15 @@ {{if message}}<p class="a-center accent">${message}</p>{{/if}} </script> -<div data-role="translate-dialog" data-mage-init='{"translateInline":{"ajaxUrl":"<?php echo $this->getAjaxUrl() ?>"}, "loader": {}}'></div> +<div data-role="translate-dialog" + data-mage-init='{"translateInline":{"ajaxUrl":"<?php echo $this->getAjaxUrl() ?>"},"loader":{}}'></div> <script type="text/javascript"> require([ "jquery", "mage/edit-trigger", "mage/translate-inline" ], function($){ - $('body').editTrigger({alwaysShown:true, singleElement:false}).addClass('trnslate-inline-area'); + $('body').editTrigger({img: '<?php echo $this->getViewFileUrl('Magento_Core::fam_book_open.png') ?>', alwaysShown:true, singleElement:false}); + $('body').addClass('trnslate-inline-area'); }); </script> diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json index 19eded9e999..e22b920d2ed 100644 --- a/app/code/Magento/Ups/composer.json +++ b/app/code/Magento/Ups/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-shipping": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-shipping": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/UrlRedirect/composer.json b/app/code/Magento/UrlRedirect/composer.json index 6a171dcaeeb..619f5061120 100644 --- a/app/code/Magento/UrlRedirect/composer.json +++ b/app/code/Magento/UrlRedirect/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-install": "0.1.0-alpha90", - "magento/module-store": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90" + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-install": "0.1.0-alpha91", + "magento/module-store": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json index ddbfb0b1570..e609b938b0c 100644 --- a/app/code/Magento/UrlRewrite/composer.json +++ b/app/code/Magento/UrlRewrite/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-store": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-store": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json index e33b3316815..05bd790e0d3 100644 --- a/app/code/Magento/User/composer.json +++ b/app/code/Magento/User/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-authorization": "0.1.0-alpha90", - "magento/module-store": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-integration": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-authorization": "0.1.0-alpha91", + "magento/module-store": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-integration": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json index 373b6e91de3..b52ac78c7cb 100644 --- a/app/code/Magento/Usps/composer.json +++ b/app/code/Magento/Usps/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-shipping": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-shipping": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json index 266cfd75b83..d9f70c2a1ee 100644 --- a/app/code/Magento/Webapi/composer.json +++ b/app/code/Magento/Webapi/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-authorization": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-integration": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-user": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-authorization": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-integration": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-user": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Weee/Block/Item/Price/Renderer.php b/app/code/Magento/Weee/Block/Item/Price/Renderer.php new file mode 100644 index 00000000000..b9731673b32 --- /dev/null +++ b/app/code/Magento/Weee/Block/Item/Price/Renderer.php @@ -0,0 +1,267 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Weee\Block\Item\Price; + +use Magento\Weee\Model\Tax as WeeeDisplayConfig; +use Magento\Framework\Pricing\PriceCurrencyInterface; + +/** + * Item price render block + * + * @author Magento Core Team <core@magentocommerce.com> + */ +class Renderer extends \Magento\Tax\Block\Item\Price\Renderer +{ + /** + * @var \Magento\Weee\Helper\Data + */ + protected $weeeHelper; + + /** + * @var \Magento\Framework\Pricing\PriceCurrencyInterface + */ + protected $priceCurrency; + + /** + * @param \Magento\Framework\View\Element\Template\Context $context + * @param \Magento\Tax\Helper\Data $taxHelper + * @param \Magento\Weee\Helper\Data $weeeHelper + * @param PriceCurrencyInterface $priceCurrency + * @param array $data + */ + public function __construct( + \Magento\Framework\View\Element\Template\Context $context, + \Magento\Tax\Helper\Data $taxHelper, + \Magento\Weee\Helper\Data $weeeHelper, + PriceCurrencyInterface $priceCurrency, + array $data = array() + ) { + $this->weeeHelper = $weeeHelper; + $this->priceCurrency = $priceCurrency; + parent::__construct($context, $taxHelper, $data); + $this->_isScopePrivate = true; + } + + /** + * Whether to display weee details together with price + * + * @return bool + */ + public function displayPriceWithWeeeDetails() + { + if (!$this->weeeHelper->isEnabled()) { + return false; + } + + if (!$this->weeeHelper->typeOfDisplay([WeeeDisplayConfig::DISPLAY_INCL_DESCR], 'sales')) { + return false; + } + + if (!$this->getItem()->getWeeeTaxAppliedAmount()) { + return false; + } + + return true; + } + + /** + * Get display price for unit price including tax. The Weee amount will be added to unit price including tax + * depending on Weee display setting + * + * @return float + */ + public function getUnitDisplayPriceInclTax() + { + $priceInclTax = $this->getItem()->getPriceInclTax(); + + if (!$this->weeeHelper->isEnabled()) { + return $priceInclTax; + } + + if ($this->weeeHelper + ->typeOfDisplay([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'sales')) { + return $priceInclTax + $this->weeeHelper->getWeeeTaxInclTax($this->getItem()); + } + + return $priceInclTax; + } + + /** + * Get display price for row total including tax. The Weee amount will be added to row total including tax + * depending on Weee display setting + * + * @return float + */ + public function getRowDisplayPriceInclTax() + { + $rowTotalInclTax = $this->getItem()->getRowTotalInclTax(); + + if (!$this->weeeHelper->isEnabled()) { + return $rowTotalInclTax; + } + + if ($this->weeeHelper-> + typeOfDisplay([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'sales')) { + return $rowTotalInclTax + $this->weeeHelper->getRowWeeeTaxInclTax($this->getItem()); + } + + return $rowTotalInclTax; + } + + /** + * Get display price for unit price excluding tax. The Weee amount will be added to unit price + * depending on Weee display setting + * + * @return float + */ + public function getUnitDisplayPriceExclTax() + { + $priceExclTax = $this->getItem()->getCalculationPrice(); + + if (!$this->weeeHelper->isEnabled()) { + return $priceExclTax; + } + + if ($this->weeeHelper + ->typeOfDisplay([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'sales')) { + return $priceExclTax + $this->getItem()->getWeeeTaxAppliedAmount(); + } + + return $priceExclTax; + } + + /** + * Get display price for row total excluding tax. The Weee amount will be added to row total + * depending on Weee display setting + * + * @return float + */ + public function getRowDisplayPriceExclTax() + { + $rowTotalExclTax = $this->getItem()->getRowTotal(); + + if (!$this->weeeHelper->isEnabled()) { + return $rowTotalExclTax; + } + + if ($this->weeeHelper + ->typeOfDisplay([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'sales')) { + return $rowTotalExclTax + $this->getItem()->getWeeeTaxAppliedRowAmount(); + } + + return $rowTotalExclTax; + } + + /** + * Get final unit display price including tax, this will add Weee amount to unit price include tax + * + * @return float + */ + public function getFinalUnitDisplayPriceInclTax() + { + $priceInclTax = $this->getItem()->getPriceInclTax(); + + if (!$this->weeeHelper->isEnabled()) { + return $priceInclTax; + } + + return $priceInclTax + $this->weeeHelper->getWeeeTaxInclTax($this->getItem()); + } + + /** + * Get final row display price including tax, this will add weee amount to rowTotalInclTax + * + * @return float + */ + public function getFinalRowDisplayPriceInclTax() + { + $rowTotalInclTax = $this->getItem()->getRowTotalInclTax(); + + if (!$this->weeeHelper->isEnabled()) { + return $rowTotalInclTax; + } + + return $rowTotalInclTax + $this->weeeHelper->getRowWeeeTaxInclTax($this->getItem()); + } + + /** + * Get final unit display price excluding tax + * + * @return float + */ + public function getFinalUnitDisplayPriceExclTax() + { + $priceExclTax = $this->getItem()->getCalculationPrice(); + + if (!$this->weeeHelper->isEnabled()) { + return $priceExclTax; + } + + return $priceExclTax + $this->getItem()->getWeeeTaxAppliedAmount(); + } + + /** + * Get final row display price excluding tax, this will add Weee amount to rowTotal + * + * @return float + */ + public function getFinalRowDisplayPriceExclTax() + { + $rowTotalExclTax = $this->getItem()->getRowTotal(); + + if (!$this->weeeHelper->isEnabled()) { + return $rowTotalExclTax; + } + + return $rowTotalExclTax + $this->getItem()->getWeeeTaxAppliedRowAmount(); + } + + /** + * Whether to display final price that include Weee amounts + * + * @return bool + */ + public function displayFinalPrice() + { + if (!$this->weeeHelper->typeOfDisplay(WeeeDisplayConfig::DISPLAY_EXCL_DESCR_INCL, 'sales')) { + return false; + } + + if (!$this->getItem()->getWeeeTaxAppliedAmount()) { + return false; + } + return true; + } + + /** + * Format price + * + * @param float $price + * @return string + */ + public function formatPrice($price) + { + return $this->priceCurrency->format($price); + } +} diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json index df204ed3d47..8566ab317d2 100644 --- a/app/code/Magento/Weee/composer.json +++ b/app/code/Magento/Weee/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-directory": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-eav": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-bundle": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-tax": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-directory": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-eav": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-bundle": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Weee/etc/config.xml b/app/code/Magento/Weee/etc/config.xml index b8ee23f8e3e..6d881543070 100644 --- a/app/code/Magento/Weee/etc/config.xml +++ b/app/code/Magento/Weee/etc/config.xml @@ -28,6 +28,7 @@ <sales> <totals_sort> <weee>35</weee> + <weee_tax>35</weee_tax> </totals_sort> </sales> <tax> diff --git a/app/code/Magento/Weee/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml b/app/code/Magento/Weee/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml new file mode 100644 index 00000000000..c3d94a8bd2a --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceBlock name="minicart"> + <block class="Magento\Weee\Block\Item\Price\Renderer" name="checkout.cart.item.price.sidebar" template="Magento_Weee::checkout/cart/item/price/sidebar.phtml"/> + </referenceBlock> +</layout> diff --git a/app/code/Magento/Weee/view/frontend/layout/checkout_item_price_renderers.xml b/app/code/Magento/Weee/view/frontend/layout/checkout_item_price_renderers.xml new file mode 100644 index 00000000000..4daf41e0d72 --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/layout/checkout_item_price_renderers.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <block class="Magento\Weee\Block\Item\Price\Renderer" name="checkout.item.price.unit" template="Magento_Weee::item/price/unit.phtml"/> + <block class="Magento\Weee\Block\Item\Price\Renderer" name="checkout.item.price.row" template="Magento_Weee::item/price/row.phtml"/> + <block class="Magento\Weee\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.unit.excl" template="checkout/onepage/review/item/price/unit_excl_tax.phtml"/> + <block class="Magento\Weee\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.unit.incl" template="checkout/onepage/review/item/price/unit_incl_tax.phtml"/> + <block class="Magento\Weee\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.rowtotal.excl" template="checkout/onepage/review/item/price/row_excl_tax.phtml"/> + <block class="Magento\Weee\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.rowtotal.incl" template="checkout/onepage/review/item/price/row_incl_tax.phtml"/> +</layout> + diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml new file mode 100644 index 00000000000..8b8c19ddaf2 --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml @@ -0,0 +1,87 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Weee\Block\Item\Price\Renderer */ +?> +<?php $_item = $this->getItem() ?> +<div class="pricing details<?php echo $this->displayBothPrices() ? ' complex' : ''; ?>"> + <?php if ($this->displayPriceExclTax() || $this->displayBothPrices()): ?> + <div class="rate"> + <?php if ($this->displayBothPrices()): ?> + <span class="label excl tax"><?php echo __('Excl. Tax'); ?></span> + <?php else: ?> + <span class="label display"><?php echo __('Price'); ?></span> + <?php endif; ?> + <span class="value display"> + <?php echo $this->formatPrice($this->getUnitDisplayPriceExclTax()) ?> + </span> + </div> + + <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <div class="rate weee"> + <span class="label weee"><?php echo $tax['title']; ?></span> + <span class="value weee"><?php echo $this->formatPrice($tax['amount'],true,true); ?></span> + </div> + <?php endforeach; ?> + + <?php if ($this->displayFinalPrice()): ?> + <div class="rate weee total"> + <span class="label weee"><?php echo __('Total:'); ?></span> + <span class="value weee"><?php echo $this->formatPrice($this->getFinalUnitDisplayPriceExclTax()); ?></span> + </div> + <?php endif; ?> + <?php endif; ?> + <?php endif; ?> + +<?php if ($this->displayPriceInclTax() || $this->displayBothPrices()): ?> +<?php $_incl = $this->getPriceInclTax($_item); ?> + <div class="rate"> + <?php if ($this->displayBothPrices()): ?> + <span class="label tax incl"><?php echo __('Incl. Tax'); ?></span> + <?php else: ?> + <span class="label display"><?php echo __('Price'); ?></span> + <?php endif; ?> + + <span class="value display"> + <?php echo $this->formatPrice($this->getUnitDisplayPriceInclTax()) ?> + </span> + </div> + <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <div class="rate weee"> + <span class="label weee"><?php echo $tax['title']; ?></span> + <span class="value weee"><?php echo $this->formatPrice($tax['amount_incl_tax'],true,true); ?></span> + </div> + <?php endforeach; ?> + + <?php if ($this->displayFinalPrice()): ?> + <div class="rate weee total"> + <span class="label weee"><?php echo __('Total:'); ?></span> + <span class="value weee"><?php echo $this->formatPrice($this->getFinalUnitDisplayPriceInclTax()); ?></span> + </div> + <?php endif; ?> + <?php endif; ?> +<?php endif; ?> +</div> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml new file mode 100644 index 00000000000..c0229fe426c --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml @@ -0,0 +1,55 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Weee\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<?php if ($this->displayPriceWithWeeeDetails()): ?> + <span class="cart tax total" data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> +<?php else: ?> + <span class="cart price"> +<?php endif; ?> + +<?php echo $this->formatPrice($this->getRowDisplayPriceExclTax()); ?> + </span> + +<?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <div class="cart tax info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> + <?php if ($this->displayPriceWithWeeeDetails()): ?> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->formatPrice($tax['row_amount'],true,true); ?></span> + <?php endforeach; ?> + <?php endif; ?> + </div> + + <?php if ($this->displayFinalPrice()): ?> + <div class="cart-tax-total" data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> + <span class="weee"><?php echo __('Total'); ?>:<br /> + <?php echo $this->formatPrice($this->getFinalRowDisplayPriceExclTax()); ?> + </span> + </div> + <?php endif; ?> +<?php endif; ?> + diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml new file mode 100644 index 00000000000..dab120b2152 --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml @@ -0,0 +1,56 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Weee\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +/** @var $_weeeHelper \Magento\Weee\Helper\Data */ +$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); +?> +<?php $_incl = $_item->getRowTotalInclTax(); ?> +<?php if ($this->displayPriceWithWeeeDetails()): ?> + <span class="cart tax total" data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> +<?php else: ?> + <span class="cart price"> +<?php endif; ?> +<?php echo $this->formatPrice($this->getRowDisplayPriceInclTax()); ?> + </span> + +<?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <div class="cart tax info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> + <?php if ($this->displayPriceWithWeeeDetails()): ?> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span> + <?php endforeach; ?> + <?php endif; ?> + </div> + + <?php if ($this->displayFinalPrice()): ?> + <div class="cart tax total" data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $_item->getId(); ?>"}'> + <span class="weee"><?php echo __('Total incl. tax'); ?>:<br /> + <?php echo $this->formatPrice($this->getFinalRowDisplayPriceInclTax()); ?> + </span> + </div> + <?php endif; ?> +<?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml new file mode 100644 index 00000000000..d0699e03a57 --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml @@ -0,0 +1,54 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Weee\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +?> +<?php if ($this->displayPriceWithWeeeDetails()): ?> + <span class="cart tax total" data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $_item->getId(); ?>"}'> +<?php else: ?> + <span class="cart price"> +<?php endif; ?> + +<?php echo $this->formatPrice($this->getUnitDisplayPriceExclTax()); ?> + </span> + +<?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <div class="cart tax info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> + <?php if ($this->displayPriceWithWeeeDetails()): ?> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->formatPrice($tax['amount'],true,true); ?></span> + <?php endforeach; ?> + <?php endif; ?> + </div> + + <?php if ($this->displayFinalPrice()): ?> + <div class="cart tax total" data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $_item->getId(); ?>"}'> + <span class="weee"><?php echo __('Total'); ?><br /> + <?php echo $this->formatPrice($this->getFinalUnitDisplayPriceExclTax()); ?> + </span> + </div> + <?php endif; ?> +<?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml new file mode 100644 index 00000000000..a3dfa7bbb0f --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml @@ -0,0 +1,57 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Weee\Block\Item\Price\Renderer */ + +$_item = $this->getItem(); +/** @var $_weeeHelper \Magento\Weee\Helper\Data */ +$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); +?> +<?php $_incl = $_item->getPriceInclTax(); ?> +<?php if ($this->displayPriceWithWeeeDetails()): ?> + <span class="cart tax total" data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $_item->getId(); ?>"}'> +<?php else: ?> + <span class="cart price"> +<?php endif; ?> + +<?php echo $this->formatPrice($this->getUnitDisplayPriceInclTax()); ?> + </span> + +<?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;"> + <?php if ($this->displayPriceWithWeeeDetails()): ?> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <span class="weee"><?php echo $tax['title']; ?>: <?php echo $this->formatPrice($tax['amount_incl_tax'],true,true); ?></span> + <?php endforeach; ?> + <?php endif; ?> + </div> + + <?php if ($this->displayFinalPrice()): ?> + <div class="cart tax total" data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $_item->getId(); ?>"}'> + <span class="weee"><?php echo __('Total incl. tax'); ?>:<br /> + <?php echo $this->formatPrice($this->getFinalUnitDisplayPriceInclTax()); ?> + </span> + </div> + <?php endif; ?> +<?php endif; ?> \ No newline at end of file diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml new file mode 100644 index 00000000000..b56723ae6ab --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml @@ -0,0 +1,92 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Weee\Block\Item\Price\Renderer */ + +$item = $this->getItem(); +?> +<?php if (($this->displayPriceInclTax() || $this->displayBothPrices()) && !$item->getNoSubtotal()): ?> + <span class="incl tax" data-th="<?php echo $this->escapeHtml(__('Incl. Tax')); ?>"> + <?php if ($this->displayPriceWithWeeeDetails()): ?> + <span class="cart-tax-total" + data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $item->getId(); ?>"}'> + <?php else: ?> + <span class="cart price"> + <?php endif; ?> + <?php echo $this->formatPrice($this->getRowDisplayPriceInclTax()); ?> + </span> + + <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $item->getId(); ?>" style="display: none;"> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <span class="weee" data-th="<?php echo $tax['title']; ?>"> + <?php echo $this->formatPrice($tax['row_amount_incl_tax'], true, true); ?> + </span> + <?php endforeach; ?> + </div> + + <?php if ($this->displayFinalPrice()): ?> + <div class="cart-tax-total" + data-tax-toggle='{"itemTaxId" : "#subtotal-item-tax-details<?php echo $item->getId(); ?>"}'> + <span class="weee" data-th="<?php echo $this->escapeHtml(__('Total incl. tax')); ?>"> + <?php echo $this->formatPrice($this->getFinalRowDisplayPriceInclTax()); ?> + </span> + </div> + <?php endif; ?> + <?php endif; ?> + </span> +<?php endif; ?> + +<?php if ($this->displayPriceExclTax() || $this->displayBothPrices()): ?> + <span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax')); ?>"> + <?php if ($this->displayPriceWithWeeeDetails()): ?> + <span class="cart-tax-total" + data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $item->getId(); ?>"}'> + <?php else: ?> + <span class="cart price"> + <?php endif; ?> + <?php echo $this->formatPrice($this->getRowDisplayPriceExclTax()); ?> + </span> + + <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $item->getId(); ?>" + style="display:none;"> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <span class="weee" data-th="<?php echo $tax['title']; ?>"> + <?php echo $this->formatPrice($tax['row_amount'], true, true); ?> + </span> + <?php endforeach; ?> + </div> + + <?php if ($this->displayFinalPrice()): ?> + <div class="cart-tax-total" + data-tax-toggle='{"itemTaxId" : "#esubtotal-item-tax-details<?php echo $item->getId(); ?>"}'> + <span class="weee" data-th="<?php echo $this->escapeHtml(__('Total')); ?>"> + <?php echo $this->formatPrice($this->getFinalRowDisplayPriceExclTax()); ?> + </span> + </div> + <?php endif; ?> + <?php endif; ?> + </span> +<?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml new file mode 100644 index 00000000000..b5190c715df --- /dev/null +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml @@ -0,0 +1,93 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** @var $this \Magento\Weee\Block\Item\Price\Renderer */ + +$item = $this->getItem(); +?> + +<?php if ($this->displayPriceInclTax() || $this->displayBothPrices()): ?> + <span class="incl tax" data-th="<?php echo $this->escapeHtml(__('Incl. Tax')); ?>"> + <?php if ($this->displayPriceWithWeeeDetails()): ?> + <span class="cart-tax-total" + data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $item->getId(); ?>"}'> + <?php else: ?> + <span class="cart price"> + <?php endif; ?> + <?php echo $this->formatPrice($this->getUnitDisplayPriceInclTax()); ?> + </span> + + <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <div class="cart-tax-info" id="unit-item-tax-details<?php echo $item->getId(); ?>" style="display: none;"> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <span class="weee" data-th="<?php echo $tax['title']; ?>"> + <?php echo $this->formatPrice($tax['amount_incl_tax'], true, true); ?> + </span> + <?php endforeach; ?> + </div> + + <?php if ($this->displayFinalPrice()): ?> + <div class="cart-tax-total" + data-tax-toggle='{"itemTaxId" : "#unit-item-tax-details<?php echo $item->getId(); ?>"}'> + <span class="weee" data-th="<?php echo $this->escapeHtml(__('Total incl. tax')); ?>"> + <?php echo $this->formatPrice($this->getFinalUnitDisplayPriceInclTax()); ?> + </span> + </div> + <?php endif; ?> + <?php endif; ?> + </span> +<?php endif; ?> + +<?php if ($this->displayPriceExclTax() || $this->displayBothPrices()): ?> + <span class="excl tax" data-th="<?php echo $this->escapeHtml(__('Excl. Tax')); ?>"> + <?php if ($this->displayPriceWithWeeeDetails()): ?> + <span class="cart-tax-total" + data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $item->getId(); ?>"}'> + <?php else: ?> + <span class="cart price"> + <?php endif; ?> + <?php echo $this->formatPrice($this->getUnitDisplayPriceExclTax()); ?> + </span> + + <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $item->getId(); ?>" + style="display:none;"> + <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <span class="weee" data-th="<?php echo $tax['title']; ?>"> + <?php echo $this->formatPrice($tax['amount'], true, true); ?> + </span> + <?php endforeach; ?> + </div> + + <?php if ($this->displayFinalPrice()): ?> + <div class="cart-tax-total" + data-tax-toggle='{"itemTaxId" : "#eunit-item-tax-details<?php echo $item->getId(); ?>"}'> + <span class="weee" data-th="<?php echo $this->escapeHtml(__('Total')); ?>"> + <?php echo $this->formatPrice($this->getFinalUnitDisplayPriceExclTax()); ?> + </span> + </div> + <?php endif; ?> + <?php endif; ?> + </span> +<?php endif; ?> diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json index 2403b38e284..547554a1b9c 100644 --- a/app/code/Magento/Widget/composer.json +++ b/app/code/Magento/Widget/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-cms": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-cms": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json index 6dd7470f703..b1235d7a0aa 100644 --- a/app/code/Magento/Wishlist/composer.json +++ b/app/code/Magento/Wishlist/composer.json @@ -3,25 +3,24 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha90", - "magento/module-customer": "0.1.0-alpha90", - "magento/module-catalog": "0.1.0-alpha90", - "magento/module-core": "0.1.0-alpha90", - "magento/module-checkout": "0.1.0-alpha90", - "magento/module-theme": "0.1.0-alpha90", - "magento/module-catalog-inventory": "0.1.0-alpha90", - "magento/module-tax": "0.1.0-alpha90", - "magento/module-backend": "0.1.0-alpha90", - "magento/module-bundle": "0.1.0-alpha90", - "magento/module-sales": "0.1.0-alpha90", - "magento/module-grouped-product": "0.1.0-alpha90", - "magento/module-configurable-product": "0.1.0-alpha90", - "magento/module-downloadable": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha91", + "magento/module-customer": "0.1.0-alpha91", + "magento/module-catalog": "0.1.0-alpha91", + "magento/module-core": "0.1.0-alpha91", + "magento/module-checkout": "0.1.0-alpha91", + "magento/module-theme": "0.1.0-alpha91", + "magento/module-catalog-inventory": "0.1.0-alpha91", + "magento/module-backend": "0.1.0-alpha91", + "magento/module-bundle": "0.1.0-alpha91", + "magento/module-sales": "0.1.0-alpha91", + "magento/module-grouped-product": "0.1.0-alpha91", + "magento/module-configurable-product": "0.1.0-alpha91", + "magento/module-downloadable": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/code/Magento/Wishlist/etc/module.xml b/app/code/Magento/Wishlist/etc/module.xml index fbf025e1362..b2d43717cc4 100644 --- a/app/code/Magento/Wishlist/etc/module.xml +++ b/app/code/Magento/Wishlist/etc/module.xml @@ -37,7 +37,6 @@ <module name="Magento_Checkout"/> <module name="Magento_Theme"/> <module name="Magento_CatalogInventory"/> - <module name="Magento_Tax"/> <module name="Magento_Backend"/> <module name="Magento_Bundle" type="soft"/> <module name="Magento_Sales"/> diff --git a/app/code/Magento/Wishlist/view/frontend/templates/render/item/price_msrp_item.phtml b/app/code/Magento/Wishlist/view/frontend/templates/render/item/price_msrp_item.phtml index 46adf8abbd8..f37f68a1237 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/render/item/price_msrp_item.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/render/item/price_msrp_item.phtml @@ -42,7 +42,7 @@ $_msrpPrice = ''; ?> <div class="price-box msrp"> - <?php $_price = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getMsrp()) ?> + <?php $_price = $this->helper('Magento\Catalog\Helper\Data')->getTaxPrice($_product, $_product->getMsrp()) ?> <?php if($_product->getMsrp()): ?> <?php $_msrpPrice = $_coreHelper->currency($_product->getMsrp(),true,false) ?> <span class="old-price" ><?php echo $_msrpPrice ?></span> diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json index e6a1b089950..9d0746de0d3 100644 --- a/app/design/adminhtml/Magento/backend/composer.json +++ b/app/design/adminhtml/Magento/backend/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/design/adminhtml/Magento/backend/theme.xml b/app/design/adminhtml/Magento/backend/theme.xml index fe67f100a60..e1241b1f7e1 100644 --- a/app/design/adminhtml/Magento/backend/theme.xml +++ b/app/design/adminhtml/Magento/backend/theme.xml @@ -24,5 +24,5 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> <title>Magento 2 backend</title> - <version>0.1.0-alpha90</version> + <version>0.1.0-alpha91</version> </theme> diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json index 5542bb6163a..755c77f48ac 100644 --- a/app/design/frontend/Magento/blank/composer.json +++ b/app/design/frontend/Magento/blank/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/design/frontend/Magento/blank/theme.xml b/app/design/frontend/Magento/blank/theme.xml index 314963981af..6c89ce8a33f 100644 --- a/app/design/frontend/Magento/blank/theme.xml +++ b/app/design/frontend/Magento/blank/theme.xml @@ -24,7 +24,7 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> <title>Magento Blank</title> - <version>0.1.0-alpha90</version> + <version>0.1.0-alpha91</version> <media> <preview_image>media/preview.jpg</preview_image> </media> diff --git a/app/design/frontend/Magento/plushe/composer.json b/app/design/frontend/Magento/plushe/composer.json index 1e262635487..72363cea632 100644 --- a/app/design/frontend/Magento/plushe/composer.json +++ b/app/design/frontend/Magento/plushe/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/theme-frontend-blank": "0.1.0-alpha90", - "magento/framework": "0.1.0-alpha90", + "magento/theme-frontend-blank": "0.1.0-alpha91", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "extra": { "map": [ [ diff --git a/app/design/frontend/Magento/plushe/theme.xml b/app/design/frontend/Magento/plushe/theme.xml index b97568f87d7..566974dc62e 100644 --- a/app/design/frontend/Magento/plushe/theme.xml +++ b/app/design/frontend/Magento/plushe/theme.xml @@ -24,7 +24,7 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> <title>Magento Plushe</title> - <version>0.1.0-alpha90</version> + <version>0.1.0-alpha91</version> <parent>Magento/blank</parent> <media> <preview_image>media/preview.jpg</preview_image> diff --git a/app/design/install/Magento/basic/theme.xml b/app/design/install/Magento/basic/theme.xml index 78050dd98f9..24d35b0131b 100644 --- a/app/design/install/Magento/basic/theme.xml +++ b/app/design/install/Magento/basic/theme.xml @@ -24,5 +24,5 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> <title>Magento Basic</title> - <version>0.1.0-alpha90</version> + <version>0.1.0-alpha91</version> </theme> diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json index f15bf8e8c62..a1e261976da 100644 --- a/app/i18n/magento/de_de/composer.json +++ b/app/i18n/magento/de_de/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-de_de", "description": "German (Germany) language", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/en_us/composer.json b/app/i18n/magento/en_us/composer.json index 4353c63040f..86d92fb28c5 100644 --- a/app/i18n/magento/en_us/composer.json +++ b/app/i18n/magento/en_us/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-en_us", "description": "English (United States) language", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/es_es/composer.json b/app/i18n/magento/es_es/composer.json index 0051cd143cf..06ff6c53170 100644 --- a/app/i18n/magento/es_es/composer.json +++ b/app/i18n/magento/es_es/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-es_es", "description": "Spanish (Spain) language", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/fr_fr/composer.json b/app/i18n/magento/fr_fr/composer.json index 7ec67b4fe37..9abad4a014c 100644 --- a/app/i18n/magento/fr_fr/composer.json +++ b/app/i18n/magento/fr_fr/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-fr_fr", "description": "French (France) language", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/nl_nl/composer.json b/app/i18n/magento/nl_nl/composer.json index 3b2dc8f8dac..d18687dd182 100644 --- a/app/i18n/magento/nl_nl/composer.json +++ b/app/i18n/magento/nl_nl/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-nl_nl", "description": "Dutch (Netherlands) language", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/pt_br/composer.json b/app/i18n/magento/pt_br/composer.json index fd9d2f8b4fc..5c27edf02a0 100644 --- a/app/i18n/magento/pt_br/composer.json +++ b/app/i18n/magento/pt_br/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-pt_br", "description": "Portuguese (Brazil) language", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/zh_cn/composer.json b/app/i18n/magento/zh_cn/composer.json index c92f93e6234..3484087c8d1 100644 --- a/app/i18n/magento/zh_cn/composer.json +++ b/app/i18n/magento/zh_cn/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-zh_cn", "description": "Chinese (China) language", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { - "magento/framework": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha91", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/composer.json b/composer.json index f1577e2f357..5a5756d06fb 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/project-community-edition", "description": "Magento project (Community Edition)", "type": "project", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { "php": "~5.4.11|~5.5.0" }, diff --git a/dev/tests/functional/composer.json.dist b/dev/tests/functional/composer.json.dist index e2d1dd19e9d..00488d8d096 100644 --- a/dev/tests/functional/composer.json.dist +++ b/dev/tests/functional/composer.json.dist @@ -2,7 +2,7 @@ "require": { "magento/mtf": "dev-master", "php": ">=5.4.0", - "phpunit/phpunit": "3.7.*", + "phpunit/phpunit": "4.1.0", "phpunit/phpunit-selenium": ">=1.2", "netwing/selenium-server-standalone": ">=2.35" }, diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Template.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Template.php index 038a00bdf90..c0f21a0f302 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Template.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Template.php @@ -26,12 +26,10 @@ namespace Magento\Backend\Test\Block; use Mtf\Block\Block; -use Mtf\Client\Element\Locator; /** * Class Template * Backend abstract block - * */ class Template extends Block { @@ -40,7 +38,7 @@ class Template extends Block * * @var string */ - protected $loader = '[data-role=loader]'; + protected $loader = '[data-role="loader"]'; /** * Magento varienLoader.js loader @@ -51,10 +49,12 @@ class Template extends Block /** * Wait until loader will be disappeared + * + * @return void */ public function waitLoader() { - $this->waitForElementNotVisible($this->loader, Locator::SELECTOR_CSS); - $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_CSS); + $this->waitForElementNotVisible($this->loader); + $this->waitForElementNotVisible($this->loaderOld); } } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php index ff2a43e7792..c1beedc5ba9 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php @@ -48,6 +48,13 @@ class Bundle extends Tab */ protected $openOption = '[data-target="#bundle_option_%d-content"]'; + /** + * Selector for 'Add Products to Option' button + * + * @var string + */ + protected $optionContent = '#bundle_option_%d-content'; + /** * Get bundle options block * @@ -76,12 +83,13 @@ class Bundle extends Tab } foreach ($fields['bundle_selections']['value']['bundle_options'] as $key => $bundleOption) { $itemOption = $this->_rootElement->find(sprintf($this->openOption, $key)); - if ($itemOption->isVisible()) { + $isContent = $this->_rootElement->find(sprintf($this->optionContent, $key))->isVisible(); + if ($itemOption->isVisible() && !$isContent) { $itemOption->click(); - } else { + } elseif (!$itemOption->isVisible()) { $this->_rootElement->find($this->addNewOption)->click(); } - $this->getBundleOptionBlock($key)->fillBundleOption($bundleOption); + $this->getBundleOptionBlock($key)->fillOption($bundleOption); } return $this; } @@ -101,12 +109,13 @@ class Bundle extends Tab } $index = 0; foreach ($fields['bundle_selections']['value']['bundle_options'] as $key => &$bundleOption) { - $this->_rootElement->find(sprintf($this->openOption, $index))->click(); + if (!$this->_rootElement->find(sprintf($this->optionContent, $key))->isVisible()) { + $this->_rootElement->find(sprintf($this->openOption, $index))->click(); + } foreach ($bundleOption['assigned_products'] as &$product) { $product['data']['getProductName'] = $product['search_data']['name']; } - $newFields['bundle_selections'][$key] = $this->getBundleOptionBlock($key) - ->getBundleOptionData($bundleOption); + $newFields['bundle_selections'][$key] = $this->getBundleOptionBlock($key)->getOptionData($bundleOption); $index++; } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php index cf1ae7edca2..95ebe787dea 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php @@ -106,7 +106,7 @@ class Option extends Form * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function fillBundleOption(array $fields) + public function fillOption(array $fields) { $mapping = $this->dataMapping($fields); $this->_fill($mapping); @@ -131,7 +131,7 @@ class Option extends Form * @param array $fields * @return array */ - public function getBundleOptionData(array $fields) + public function getOptionData(array $fields) { $mapping = $this->dataMapping($fields); $newField = $this->_getData($mapping); diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php index 4e2ab8a1412..276829518d5 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php @@ -26,6 +26,7 @@ namespace Magento\Bundle\Test\Block\Catalog\Product\View\Type; use Mtf\Block\Block; use Mtf\Client\Element\Locator; +use Magento\Bundle\Test\Fixture\CatalogProductBundle; use Magento\Bundle\Test\Page\Product\CatalogProductView; use Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option; @@ -101,17 +102,18 @@ class Bundle extends Block /** * Fill bundle option on frontend add click "Add to cart" button * - * @param array $fillData + * @param CatalogProductBundle $product * @param CatalogProductView $catalogProductView * @return void */ - public function addToCart(array $fillData, CatalogProductView $catalogProductView) + public function addToCart(CatalogProductBundle $product, CatalogProductView $catalogProductView) { - $this->fillBundleOptions($fillData['bundle_options']); + $fillData = $product->getDataFieldConfig('checkout_data')['source']->getPreset(); + if (isset($fillData['bundle_options'])) { + $this->fillBundleOptions($fillData['bundle_options']); + } if (isset($fillData['custom_options'])) { - foreach ($fillData['custom_options'] as $option) { - $catalogProductView->getCustomOptionsBlock()->fillCustomOptions($option); - } + $catalogProductView->getCustomOptionsBlock()->fillCustomOptions($product, $fillData['custom_options']); } $catalogProductView->getViewBlock()->clickAddToCart(); } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php index c05c517b04e..aa34b81f22c 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php @@ -100,7 +100,7 @@ class AssertBundlePriceType extends AbstractConstraint : $product->getPriceType(); $fillData = $product->getDataFieldConfig('checkout_data')['source']->getPreset(); $bundleBlock = $catalogProductView->getBundleViewBlock()->getBundleBlock(); - $bundleBlock->addToCart($fillData, $catalogProductView); + $bundleBlock->addToCart($product, $catalogProductView); $cartBlock = $checkoutCartView->getCartBlock(); $specialPrice = 0; if (isset($bundleData['group_price'])) { diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductForm.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductForm.php index 4eff17432fe..76880a4c015 100755 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductForm.php @@ -26,8 +26,6 @@ namespace Magento\Bundle\Test\Constraint; use Mtf\Fixture\FixtureInterface; use Magento\Catalog\Test\Constraint\AssertProductForm; -use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; -use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; /** * Class AssertBundleProductForm @@ -55,62 +53,21 @@ class AssertBundleProductForm extends AssertProductForm ] ]; - /** - * Assert form data equals fixture data - * - * @param FixtureInterface $product - * @param CatalogProductIndex $productGrid - * @param CatalogProductEdit $productPage - * @return void - */ - public function processAssert( - FixtureInterface $product, - CatalogProductIndex $productGrid, - CatalogProductEdit $productPage - ) { - $filter = ['sku' => $product->getSku()]; - $productGrid->open(); - $productGrid->getProductGrid()->searchAndOpen($filter); - - $formData = $productPage->getForm()->getData($product); - $fixtureData = $this->prepareFixtureData($product->getData()); - $errors = $this->verifyData($fixtureData, $formData); - \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); - } - /** * Prepares fixture data for comparison * * @param array $data + * @param FixtureInterface $product * @param array $sortFields [optional] * @return array */ - protected function prepareFixtureData(array $data, array $sortFields = []) + protected function prepareFixtureData(array $data, FixtureInterface $product, array $sortFields = []) { - $data = $this->prepareSpecialPriceArray($data); $data['bundle_selections'] = $this->prepareBundleOptions( $data['bundle_selections']['bundle_options'] ); - return parent::prepareFixtureData($data, $sortFields); - } - - /** - * Prepare special price array for Bundle product - * - * @param array $fields - * @return array - */ - protected function prepareSpecialPriceArray(array $fields) - { - foreach ($this->specialArray as $key => $value) { - if (array_key_exists($key, $fields)) { - if (isset($value['type']) && $value['type'] == 'date') { - $fields[$key] = vsprintf('%d/%d/%d', explode('/', $fields[$key])); - } - } - } - return $fields; + return parent::prepareFixtureData($data, $product, $sortFields); } /** diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertProductCustomOptionsOnBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertProductCustomOptionsOnBundleProductPage.php new file mode 100644 index 00000000000..502fabef02f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertProductCustomOptionsOnBundleProductPage.php @@ -0,0 +1,57 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Bundle\Test\Constraint; + +use Mtf\Fixture\FixtureInterface; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage; + +/** + * Class AssertProductCustomOptionsOnBundleProductPage + * Assertion that commodity options are displayed correctly on bundle product page + */ +class AssertProductCustomOptionsOnBundleProductPage extends AssertProductCustomOptionsOnProductPage +{ + /** + * Flag for verify price data + * + * @var bool + */ + protected $isPrice = false; + + /** + * Open product view page + * + * @param CatalogProductView $catalogProductView + * @param FixtureInterface $product + * @return void + */ + protected function openProductPage(CatalogProductView $catalogProductView, FixtureInterface $product) + { + $catalogProductView->init($product); + $catalogProductView->open(); + $catalogProductView->getViewBlock()->clickCustomize(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/CheckoutData.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/CheckoutData.php index fcd9289437f..1485dc79402 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/CheckoutData.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/CheckoutData.php @@ -84,9 +84,52 @@ class CheckoutData extends AbstractCheckoutData ], 'custom_options' => [ [ - 'type' => 'Drop-down', - 'title' => 'custom option drop down', - 'value' => ['30 bucks'], + 'option' => 1, + 'value' => [1], + ], + [ + 'option' => 2, + 'value' => [1], + ], + [ + 'option' => 3, + 'value' => ['Field'], + ], + [ + 'option' => 4, + 'value' => ['Field'], + ], + [ + 'option' => 5, + 'value' => ['Area'], + ], + [ + 'option' => 7, + 'value' => [1], + ], + [ + 'option' => 8, + 'value' => [1], + ], + [ + 'option' => 9, + 'value' => [1], + ], + [ + 'option' => 10, + 'value' => [1], + ], + [ + 'option' => 11, + 'value' => ['12/12/2014'], + ], + [ + 'option' => 12, + 'value' => ['12/12/2014/12/30/AM'], + ], + [ + 'option' => 13, + 'value' => ['12/12/AM'], ], ] ], @@ -102,9 +145,8 @@ class CheckoutData extends AbstractCheckoutData ], 'custom_options' => [ [ - 'type' => 'Drop-down', - 'title' => 'custom option drop down', - 'value' => ['10 percent'], + 'option' => 1, + 'value' => [1], ], ] ], @@ -141,49 +183,40 @@ class CheckoutData extends AbstractCheckoutData ], 'custom_options' => [ [ - 'type' => 'Field', - 'title' => 'custom option field', + 'option' => 1, 'value' => ['Field'], ], [ - 'type' => 'Area', - 'title' => 'custom option Area', + 'option' => 2, 'value' => ['Area'], ], [ - 'type' => 'Radio Buttons', - 'title' => 'custom option Radio Buttons', - 'value' => ['20 percent'], + 'option' => 4, + 'value' => [1], ], [ - 'type' => 'Drop-down', - 'title' => 'custom option drop down', - 'value' => ['20 percent'], + 'option' => 5, + 'value' => [1], ], [ - 'type' => 'Checkbox', - 'title' => 'custom option Checkbox', - 'value' => ['20 percent'], + 'option' => 6, + 'value' => [1], ], [ - 'type' => 'Multiple Select', - 'title' => 'custom option Multiple Select', - 'value' => ['20 percent'], + 'option' => 7, + 'value' => [1], ], [ - 'type' => 'Date', - 'title' => 'custom option Date', + 'option' => 8, 'value' => ['12/12/2014'], ], [ - 'type' => 'Date & Time', - 'title' => 'custom option Date & Time', + 'option' => 9, 'value' => ['12/12/2014/12/30/AM'], ], [ - 'type' => 'Time', - 'title' => 'custom option Time', - 'value' => ['12/12/2014/12/30/AM'], + 'option' => 10, + 'value' => ['12/12/AM'], ], ] ], diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/Price.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/Price.php index d92d5f7f1c9..e4a01716fca 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/Price.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/Price.php @@ -140,7 +140,7 @@ class Price implements FixtureInterface 'fixed-24' => [ 'price_from' => '96.00', 'price_to' => '97.00', - 'cart_price' => '252.00' + 'cart_price' => '244.00' ], 'fixed-1' => [ 'price_from' => '1.00', @@ -168,7 +168,7 @@ class Price implements FixtureInterface 'fixed-115' => [ 'price_from' => '115.00', 'price_to' => '120.00', - 'cart_price' => '145.00' + 'cart_price' => '317.00' ], 'fixed-126' => [ 'price_from' => '115.00', diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.php index bf983be1386..455f7dbe322 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.php @@ -34,16 +34,25 @@ class CatalogProductView extends ParentCatalogProductView { const MCA = 'bundle/catalog/product/view'; - protected $_blocks = [ - 'bundleViewBlock' => [ + /** + * Custom constructor + * + * @return void + */ + protected function _init() + { + $this->_blocks['bundleViewBlock'] = [ 'name' => 'bundleViewBlock', 'class' => 'Magento\Bundle\Test\Block\Catalog\Product\View', 'locator' => '.bundle-options-container', 'strategy' => 'css selector', - ], - ]; + ]; + parent::_init(); + } /** + * Bundle block on frontend + * * @return \Magento\Bundle\Test\Block\Catalog\Product\View */ public function getBundleViewBlock() diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest/test.csv index 35d7c627982..c5a33ebf810 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest/test.csv +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest/test.csv @@ -1,15 +1,15 @@ -"product/data/name";"product/data/sku_type";"product/data/sku";"product/data/status";"product/data/price_type";"product/data/price/value";"product/data/price/preset";"product/data/tax_class_id/dataSet";"product/data/quantity_and_stock_status/is_in_stock";"product/data/weight_type";"product/data/weight";"product/data/category";"product/data/description";"product/data/group_price/preset";"product/data/special_price";"product/data/special_from_date/pattern";"product/data/special_to_date/pattern";"product/data/tier_price/preset";"product/data/price_view";"product/data/stock_data/use_config_manage_stock";"product/data/stock_data/manage_stock";"product/data/shipment_type";"product/data/bundle_selections/preset";"product/data/bundle_selections/products";"product/data/checkout_data/preset";"product/data/custom_options/preset";"product/data/visibility";"product/data/use_config_gift_message_available";"product/data/gift_message_available";"constraint" -"BundleProduct %isolation%";"-";"bundle_sku_%isolation%";"-";"-";"-";"-";"-";"-";"-";"-";"-";"Bundle Product Dynamic Required";"-";"-";"-";"-";"-";"-";"No";"No";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"default";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertBundleItemsOnProductPage" -"BundleProduct %isolation%";"Fixed";"bundle_sku_%isolation%";"Product offline";"Dynamic";"-";"-";"-";"Out of Stock";"Dynamic";"-";"category_%isolation%";"-";"-";"-";"-";"-";"-";"-";"-";"-";"Separately";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"default";"-";"Catalog, Search";"No";"Yes";"assertProductSaveMessage, assertProductNotSearchableBySku" -"BundleProduct %isolation%";"Dynamic";"bundle_sku_%isolation%";"Product online";"Dynamic";"-";"dynamic-200";"-";"In Stock";"Dynamic";"-";"category_%isolation%";"Bundle Product Dynamic";"-";"-";"-";"-";"-";"Price Range";"-";"-";"Together";"all_types_dynamic";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"all_types_bundle_options";"-";"Catalog, Search";"No";"Yes";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertProductSearchableBySku, assertBundleProductPage, assertProductInStock, assertBundleItemsOnProductPage, assertProductVisibleInCategory, assertBundlePriceView, assertBundlePriceType" -"BundleProduct %isolation%";"Fixed";"bundle_sku_%isolation%";"-";"Fixed";"10";"fixed-15";"None";"-";"Fixed";"10";"-";"Bundle Product Fixed Required";"-";"-";"-";"-";"-";"-";"-";"-";"-";"default_fixed";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"default";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertProductSearchableBySku, assertBundleProductPage, assertBundleItemsOnProductPage" -"BundleProduct %isolation%";"Fixed";"bundle_sku_%isolation%";"Product online";"Fixed";"100";"fixed-24";"Taxable Goods";"In Stock";"Fixed";"10";"category_%isolation%";"Bundle Product Fixed";"default";"-";"-";"-";"-";"As Low as";"-";"-";"Separately";"all_types_fixed";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"all_types_bundle_fixed_and_custom_options";"all_types";"Catalog, Search";"No";"No";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertProductVisibleInCategory, assertBundleProductPage, assertProductInStock, assertGroupedPriceOnBundleProductPage, assertBundleItemsOnProductPage, assertBundlePriceView, assertBundlePriceType" -"BundleProduct %isolation%";"Fixed";"bundle_sku_%isolation%";"Product online";"Fixed";"10";"fixed-1";"Taxable Goods";"Out of Stock";"Fixed";"10";"category_%isolation%";"-";"-";"10";"m/d/Y";"m/d/Y +3 days";"-";"Price Range";"No";"Yes";"Together";"with_not_required_options";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"with_not_required_options";"-";"Catalog";"No";"No";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertBundleProductPage, assertProductOutOfStock, assertBundlePriceView" -"BundleProduct %isolation%";"Dynamic";"bundle_sku_%isolation%";"-";"Dynamic";"-";"dynamic-50";"-";"-";"Fixed";"10";"-";"-";"-";"-";"-";"-";"default";"As Low as";"No";"No";"Together";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"default";"-";"Search";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertProductSearchableBySku, assertBundleProductPage, assertBundleItemsOnProductPage, assertTierPriceOnBundleProductPage" -"Bundle Dynamic %isolation%";"Dynamic";"sku_bundle_dynamic_%isolation%";"-";"Dynamic";"-";"dynamic-8";"-";"-";"-";"-";"-";"-";"-";"20";"-";"-";"-";"-";"-";"-";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory" -"Bundle Dynamic %isolation%";"Dynamic";"sku_bundle_dynamic_%isolation%";"-";"Dynamic";"-";"dynamic-32";"-";"-";"-";"-";"-";"-";"MAGETWO-23061";"-";"-";"-";"-";"-";"-";"-";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory, assertBundlePriceView, assertBundlePriceType" -"Bundle Dynamic %isolation%";"Dynamic";"sku_bundle_dynamic_%isolation%";"-";"Dynamic";"-";"dynamic-40";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory, assertBundlePriceView, assertBundlePriceType" -"Bundle Fixed %isolation%";"Fixed";"sku_bundle_fixed_%isolation%";"-";"Fixed";"110";"fixed-115";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"second";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"with_custom_options_1";"MAGETWO-23066";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory, assertBundlePriceView, assertBundlePriceType" -"Bundle Fixed %isolation%";"Fixed";"sku_bundle_fixed_%isolation%";"-";"Fixed";"110";"fixed-126";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"second";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"with_custom_options_2";"MAGETWO-23069";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory, assertBundlePriceView, assertBundlePriceType" -"Bundle Dynamic %isolation%";"Dynamic";"sku_bundle_dynamic_%isolation%";"-";"Dynamic";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"assertProductSaveMessage" -"Bundle Fixed %isolation%";"Fixed";"sku_bundle_fixed_%isolation%";"-";"Fixed";"10";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"second";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"assertProductSaveMessage" +"product/data/name";"product/data/sku_type";"product/data/sku";"product/data/status";"product/data/price_type";"product/data/price/value";"product/data/price/preset";"product/data/tax_class_id/dataSet";"product/data/quantity_and_stock_status/is_in_stock";"product/data/weight_type";"product/data/weight";"product/data/category";"product/data/description";"product/data/group_price/preset";"product/data/special_price";"product/data/special_from_date/pattern";"product/data/special_to_date/pattern";"product/data/tier_price/preset";"product/data/price_view";"product/data/stock_data/use_config_manage_stock";"product/data/stock_data/manage_stock";"product/data/shipment_type";"product/data/bundle_selections/preset";"product/data/bundle_selections/products";"product/data/checkout_data/preset";"product/data/custom_options/preset";"product/data/custom_options/import_products";"product/data/visibility";"product/data/use_config_gift_message_available";"product/data/gift_message_available";"constraint";"issue" +"BundleProduct %isolation%";"-";"bundle_sku_%isolation%";"-";"-";"-";"-";"-";"-";"-";"-";"-";"Bundle Product Dynamic Required";"-";"-";"-";"-";"-";"-";"No";"No";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertBundleItemsOnProductPage";"" +"BundleProduct %isolation%";"Fixed";"bundle_sku_%isolation%";"Product offline";"Dynamic";"-";"-";"-";"Out of Stock";"Dynamic";"-";"category_%isolation%";"-";"-";"-";"-";"-";"-";"-";"-";"-";"Separately";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"default";"-";"-";"Catalog, Search";"No";"Yes";"assertProductSaveMessage, assertProductNotSearchableBySku";"" +"BundleProduct %isolation%";"Dynamic";"bundle_sku_%isolation%";"Product online";"Dynamic";"-";"dynamic-200";"-";"In Stock";"Dynamic";"-";"category_%isolation%";"Bundle Product Dynamic";"-";"-";"-";"-";"-";"Price Range";"-";"-";"Together";"all_types_dynamic";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"all_types_bundle_options";"-";"-";"Catalog, Search";"No";"Yes";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertProductSearchableBySku, assertBundleProductPage, assertProductInStock, assertBundleItemsOnProductPage, assertProductVisibleInCategory, assertBundlePriceView, assertBundlePriceType";"" +"BundleProduct %isolation%";"Fixed";"bundle_sku_%isolation%";"-";"Fixed";"10";"fixed-15";"None";"-";"Fixed";"10";"-";"Bundle Product Fixed Required";"-";"-";"-";"-";"-";"-";"-";"-";"-";"default_fixed";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertProductSearchableBySku, assertBundleProductPage, assertBundleItemsOnProductPage";"" +"BundleProduct %isolation%";"Fixed";"bundle_sku_%isolation%";"Product online";"Fixed";"100";"fixed-24";"Taxable Goods";"In Stock";"Fixed";"10";"category_%isolation%";"Bundle Product Fixed";"default";"-";"-";"-";"-";"As Low as";"-";"-";"Separately";"all_types_fixed";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"all_types_bundle_fixed_and_custom_options";"all_types";"-";"Catalog, Search";"No";"No";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertProductVisibleInCategory, assertBundleProductPage, assertProductInStock, assertGroupedPriceOnBundleProductPage, assertBundleItemsOnProductPage, assertBundlePriceView, assertBundlePriceType";"Bug: MAGETWO-26969" +"BundleProduct %isolation%";"Fixed";"bundle_sku_%isolation%";"Product online";"Fixed";"10";"fixed-1";"Taxable Goods";"Out of Stock";"Fixed";"10";"category_%isolation%";"-";"-";"10";"m/d/Y";"m/d/Y +3 days";"-";"Price Range";"No";"Yes";"Together";"with_not_required_options";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product|catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"with_not_required_options";"-";"-";"Catalog";"No";"No";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertBundleProductPage, assertProductOutOfStock, assertBundlePriceView";"Bug: MAGETWO-26980" +"BundleProduct %isolation%";"Dynamic";"bundle_sku_%isolation%";"-";"Dynamic";"-";"dynamic-50";"-";"-";"Fixed";"10";"-";"-";"-";"-";"-";"-";"default";"As Low as";"No";"No";"Together";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductVirtual::50_dollar_product";"default";"-";"-";"Search";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertBundleProductForm, assertProductSearchableBySku, assertBundleProductPage, assertBundleItemsOnProductPage, assertTierPriceOnBundleProductPage";"Bug: MAGETWO-26853" +"Bundle Dynamic %isolation%";"Dynamic";"sku_bundle_dynamic_%isolation%";"-";"Dynamic";"-";"dynamic-8";"-";"-";"-";"-";"-";"-";"-";"20";"-";"-";"-";"-";"-";"-";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory";"" +"Bundle Dynamic %isolation%";"Dynamic";"sku_bundle_dynamic_%isolation%";"-";"Dynamic";"-";"dynamic-32";"-";"-";"-";"-";"-";"-";"MAGETWO-23061";"-";"-";"-";"-";"-";"-";"-";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory, assertBundlePriceView, assertBundlePriceType";"" +"Bundle Dynamic %isolation%";"Dynamic";"sku_bundle_dynamic_%isolation%";"-";"Dynamic";"-";"dynamic-40";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory, assertBundlePriceView, assertBundlePriceType";"" +"Bundle Fixed %isolation%";"Fixed";"sku_bundle_fixed_%isolation%";"-";"Fixed";"110";"fixed-115";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"second";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"with_custom_options_1";"MAGETWO-23066";"catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory, assertBundlePriceView, assertBundlePriceType, assertProductCustomOptionsOnBundleProductPage";"" +"Bundle Fixed %isolation%";"Fixed";"sku_bundle_fixed_%isolation%";"-";"Fixed";"110";"fixed-126";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"second";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"with_custom_options_2";"MAGETWO-23069";"-";"-";"-";"-";"assertProductSaveMessage, assertBundleInCategory, assertBundlePriceView, assertBundlePriceType";"" +"Bundle Dynamic %isolation%";"Dynamic";"sku_bundle_dynamic_%isolation%";"-";"Dynamic";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"default_dynamic";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage";"" +"Bundle Fixed %isolation%";"Fixed";"sku_bundle_fixed_%isolation%";"-";"Fixed";"10";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"second";"catalogProductSimple::100_dollar_product,catalogProductSimple::40_dollar_product";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage";"" diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/global/constraint.xml index 017c23441d6..db84e1416f8 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/global/constraint.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/global/constraint.xml @@ -54,4 +54,7 @@ <assertGroupedPriceOnBundleProductPage module="Magento_Bundle"> <severeness>low</severeness> </assertGroupedPriceOnBundleProductPage> + <assertProductCustomOptionsOnBundleProductPage module="Magento_Bundle"> + <severeness>low</severeness> + </assertProductCustomOptionsOnBundleProductPage> </constraint> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Options.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Options.php index 3b3056997e8..879c19657d5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Options.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Options.php @@ -26,7 +26,9 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab; use Mtf\ObjectManager; use Mtf\Client\Element; +use Mtf\Client\Element\Locator; use Magento\Backend\Test\Block\Widget\Tab; +use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Options\Search\Grid; /** * Class Options @@ -35,11 +37,18 @@ use Magento\Backend\Test\Block\Widget\Tab; class Options extends Tab { /** - * Custom option row CSS locator + * Custom option row * * @var string */ - protected $customOptionRow = '#product-custom-options-content .fieldset-wrapper:nth-child(%d)'; + protected $customOptionRow = '//*[*[@class="fieldset-wrapper-title"]//span[.="%s"]]'; + + /** + * New custom option row CSS locator + * + * @var string + */ + protected $newCustomOptionRow = '#product-custom-options-content .fieldset-wrapper:nth-child(%d)'; /** * Add an option button @@ -48,6 +57,20 @@ class Options extends Tab */ protected $buttonFormLocator = '[data-ui-id="admin-product-options-add-button"]'; + /** + * Import an option button + * + * @var string + */ + protected $buttonImportOptions = '[data-ui-id="admin-product-options-import-button"]'; + + /** + * Selector block import products grid + * + * @var string + */ + protected $importGrid = "//ancestor::body/div[*[@id='import-container'] and contains(@style,'display: block')]"; + /** * Fill custom options form on tab * @@ -63,6 +86,10 @@ class Options extends Tab } foreach ($fields['value'] as $keyRoot => $field) { + if ($keyRoot === 'import') { + $this->importOptions($field['products']); + continue; + } $options = null; $this->_rootElement->find($this->buttonFormLocator)->click(); if (!empty($field['options'])) { @@ -70,13 +97,13 @@ class Options extends Tab unset($field['options']); } - $rootElement = $this->_rootElement->find(sprintf($this->customOptionRow, $keyRoot + 1)); + $rootElement = $this->_rootElement->find(sprintf($this->newCustomOptionRow, $keyRoot + 1)); $data = $this->dataMapping($field); $this->_fill($data, $rootElement); // Fill subform if (isset($field['type']) && !empty($options)) { - /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Options\OptionsAbstract $optionsForm */ + /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Options\AbstractOptions $optionsForm */ $optionsForm = $this->blockFactory->create( __NAMESPACE__ . '\Options\Type\\' . $this->optionNameConvert($field['type']), ['element' => $rootElement] @@ -95,6 +122,35 @@ class Options extends Tab return $this; } + /** + * Import custom options + * + * @param array $products + * @return void + */ + protected function importOptions(array $products) + { + foreach ($products as $product) { + $this->_rootElement->find($this->buttonImportOptions)->click(); + $searchBlock = $this->getSearchGridBlock(); + $searchBlock->searchAndSelect(['sku' => $product]); + $searchBlock->addProducts(); + } + } + + /** + * Get grid for import custom options products + * + * @return Grid + */ + protected function getSearchGridBlock() + { + return $this->blockFactory->create( + 'Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Options\Search\Grid', + ['element' => $this->_rootElement->find($this->importGrid, Locator::SELECTOR_XPATH)] + ); + } + /** * Get data of tab * @@ -109,6 +165,9 @@ class Options extends Tab if (empty($fields['value'])) { return $formData; } + if (isset($fields['value']['import'])) { + $fields['value'] = $this->prepareCustomOptions($fields['value']); + } foreach ($fields['value'] as $keyRoot => $field) { $formDataItem = null; @@ -118,15 +177,15 @@ class Options extends Tab unset($field['options']); } - $rootLocator = sprintf($this->customOptionRow, $keyRoot + 1); - $rootElement = $this->_rootElement->find($rootLocator); - $this->waitForElementVisible($rootLocator); + $rootLocator = sprintf($this->customOptionRow, $field['title']); + $rootElement = $this->_rootElement->find($rootLocator, Locator::SELECTOR_XPATH); + $this->waitForElementVisible($rootLocator, Locator::SELECTOR_XPATH); $data = $this->dataMapping($field); $formDataItem = $this->_getData($data, $rootElement); // Data collection subform if (isset($field['type']) && !empty($options)) { - /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Options\OptionsAbstract $optionsForm */ + /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Options\AbstractOptions $optionsForm */ $optionsForm = $this->blockFactory->create( __NAMESPACE__ . '\Options\Type\\' . $this->optionNameConvert($field['type']), ['element' => $rootElement] @@ -145,6 +204,20 @@ class Options extends Tab return $formData; } + /** + * Prepare custom options with import options + * + * @param array $options + * @return array + */ + protected function prepareCustomOptions(array $options) + { + $importOptions = $options['import']['options']; + $options = array_merge($options, $importOptions); + unset($options['import']); + return $options; + } + /** * Convert option name * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Options/Search/Grid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Options/Search/Grid.php new file mode 100644 index 00000000000..2de58d1a861 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Options/Search/Grid.php @@ -0,0 +1,70 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Options\Search; + +use Magento\Backend\Test\Block\Widget\Grid as GridInterface; + +/** + * Class Grid + * 'Import custom options to product' grid + */ +class Grid extends GridInterface +{ + /** + * Selector for 'Import' button + * + * @var string + */ + protected $importProducts = '#import-custom-options-apply-button'; + + /** + * An element locator which allows to select entities in grid + * + * @var string + */ + protected $selectItem = 'tbody tr .col-id'; + + /** + * Filters param for grid + * + * @var array + */ + protected $filters = [ + 'sku' => [ + 'selector' => 'input[name=sku]' + ], + ]; + + /** + * Press 'Import' button + * + * @return void + */ + public function addProducts() + { + $this->_rootElement->find($this->importProducts)->click(); + $this->getTemplateBlock()->waitForElementNotVisible($this->importProducts); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml index 56f08f31376..1d5f379a164 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml @@ -166,7 +166,7 @@ <type> <selector>.field [id$='_type']</selector> <strategy>css selector</strategy> - <input>select</input> + <input>strictselect</input> </type> </fields> </customer-options> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php index af6f96cb667..f46da17bfd1 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php @@ -135,7 +135,9 @@ class CustomOptions extends Form */ public function getOptions(FixtureInterface $product = null) { - $dataOptions = ($product && $product->hasData('custom_options')) ? $product->getCustomOptions() : []; + $dataOptions = ($product && $product->hasData('custom_options')) + ? $product->getDataFieldConfig('custom_options')['source']->getCustomOptions() + : []; $listCustomOptions = $this->getListCustomOptions(); $readyOptions = []; $result = []; @@ -406,14 +408,12 @@ class CustomOptions extends Form */ protected function parseOptionText($optionText) { - preg_match('/\+?.([0-9.]+)$/', $optionText, $match); - $optionPrice = isset($match[1]) ? $match[1] : 0; - $optionTitle = isset($match[0]) - ? substr($optionText, 0, strlen($optionText) - strlen($match[0])) - : $optionText; + preg_match('`^(.*?)\+\$(\d.*?)$`', $optionText, $match); + $optionPrice = isset($match[2]) ? str_replace(',', '', $match[2]) : 0; + $optionTitle = isset($match[1]) ? trim($match[1]) : $optionText; return [ - 'title' => trim($optionTitle), + 'title' => $optionTitle, 'price' => $optionPrice ]; } @@ -439,37 +439,104 @@ class CustomOptions extends Form /** * Fill custom options * + * @param FixtureInterface $product * @param array $customOptions * @return void */ - public function fillCustomOptions(array $customOptions) + public function fillCustomOptions(FixtureInterface $product, array $customOptions) { - $type = strtolower(preg_replace('/[^a-zA-Z]/', '', $customOptions['type'])); - $customOptions += $this->dataMapping([$type => []]); + $customOptions = $this->prepareCustomOptions($product, $customOptions); + foreach ($customOptions as $option) { + $this->fillOption($option); + } + } + + /** + * Prepare custom options for fill + * + * @param FixtureInterface $product + * @param array $customOptions + * @return array + */ + protected function prepareCustomOptions(FixtureInterface $product, array $customOptions) + { + $options = []; + $productCustomOptions = $product->hasData('custom_options') + ? $product->getDataFieldConfig('custom_options')['source']->getCustomOptions() + : null; + + if ($productCustomOptions !== null) { + foreach ($customOptions as $key => $option) { + $type = $productCustomOptions[$option['option'] - 1]['type']; + $title = $productCustomOptions[$option['option'] - 1]['title']; + $titleOption = []; + foreach ($option['value'] as $value) { + $titleOption[] = is_numeric($value) + ? $productCustomOptions[$option['option'] - 1]['options'][$value - 1]['title'] + : null; + } + + $options[$key] = $this->dataMapping([$option, $type, $title, $titleOption]); + } + } + + return $options; + } + + /** + * Custom options mapping + * + * @param array|null $fields + * @param string|null $parent + * @return array + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function dataMapping(array $fields = null, $parent = null) + { + list($option, $type, $title, $titleOption) = $fields; + + $isDate = $type == 'Date' || $type == 'Time' || $type == 'Date & Time'; + $isChecked = $type == 'Checkbox' || $type == 'Radio Buttons'; + $isField = $type == 'Field' || $type == 'Area'; - $isDate = $customOptions['type'] == 'Date' || - $customOptions['type'] == 'Time' || - $customOptions['type'] == 'Date & Time'; - $isChecked = $customOptions['type'] == 'Checkbox' || $customOptions['type'] == 'Radio Buttons'; + $optionName = strtolower(preg_replace('/[^a-zA-Z]/', '', $type)); + $option += parent::dataMapping([$optionName => []]); + $selector = [$option[$optionName]['selector']]; if ($isDate) { - $customOptions['value'] = explode('/', $customOptions['value'][0]); - $customOptions['dateSelector'] = $this->setDateTypeSelector(count($customOptions['value'])); + $value = explode('/', $option['value'][0]); + $selector = $this->setDateTypeSelector(count($value), $selector[0]); + } elseif ($isChecked) { + $selector[0] = str_replace('%option_name%', $titleOption[0], $selector[0]); + $value = ['Yes']; + } elseif ($isField) { + $value = $option['value']; + } else { + $value = $titleOption; } - foreach ($customOptions['value'] as $key => $attributeValue) { - $selector = $customOptions[$type]['selector']; - if ($isDate) { - $selector .= $customOptions['dateSelector'][$key]; - } elseif ($isChecked) { - $selector = str_replace('%product_name%', $attributeValue, $selector); - $attributeValue = 'Yes'; - } + return [ + 'title' => $title, + 'value' => $value, + 'selector' => $selector, + 'input' => $option[$optionName]['input'] + ]; + } + /** + * Fill custom option + * + * @param array $customOption + * @return void + */ + public function fillOption(array $customOption) + { + foreach ($customOption['value'] as $key => $attributeValue) { $select = $this->_rootElement->find( - sprintf($this->optionByName, $customOptions['title']) . $selector, + sprintf($this->optionByName, $customOption['title']) . $customOption['selector'][$key], Locator::SELECTOR_XPATH, - $customOptions[$type]['input'] + $customOption['input'] ); $select->setValue($attributeValue); } @@ -479,9 +546,10 @@ class CustomOptions extends Form * Set item data type selector * * @param int $count + * @param string $selector [optional] * @return array */ - protected function setDateTypeSelector($count) + protected function setDateTypeSelector($count, $selector = '') { $result = []; $parent = ''; @@ -489,7 +557,7 @@ class CustomOptions extends Form if (!(($i + 1) % 4)) { $parent = '//span'; } - $result[$i] = $parent . '//select[' . ($i % 3 + 1) . ']'; + $result[$i] = $selector . $parent . '//select[' . ($i % 3 + 1) . ']'; } return $result; diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.xml index 44504ba1c17..af94825cc49 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.xml @@ -34,11 +34,11 @@ <input>multiselect</input> </multipleselect> <checkbox> - <selector>//div[label[span[contains(text(), "%product_name%")]]]/input</selector> + <selector>//div[label[span[contains(text(), "%option_name%")]]]/input</selector> <input>checkbox</input> </checkbox> <radiobuttons> - <selector>//div[label[span[contains(text(), "%product_name%")]]]/input</selector> + <selector>//div[label[span[contains(text(), "%option_name%")]]]/input</selector> <input>checkbox</input> </radiobuttons> <date> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCustomOptionsOnProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCustomOptionsOnProductPage.php index 2de9af98ded..751ece734dd 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCustomOptionsOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCustomOptionsOnProductPage.php @@ -24,10 +24,9 @@ namespace Magento\Catalog\Test\Constraint; -use Mtf\Constraint\AbstractAssertForm; use Mtf\Fixture\FixtureInterface; +use Mtf\Constraint\AbstractAssertForm; use Magento\Catalog\Test\Page\Product\CatalogProductView; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; /** * Class AssertProductCustomOptionsOnProductPage @@ -89,6 +88,13 @@ class AssertProductCustomOptionsOnProductPage extends AbstractAssertForm ] ]; + /** + * Flag for verify price data + * + * @var bool + */ + protected $isPrice = true; + /** * Assertion that commodity options are displayed correctly * @@ -98,19 +104,43 @@ class AssertProductCustomOptionsOnProductPage extends AbstractAssertForm */ public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product) { - // TODO fix initialization url for frontend page - // Open product view page - $catalogProductView->init($product); - $catalogProductView->open(); + $this->openProductPage($catalogProductView, $product); // Prepare data $formCustomOptions = $catalogProductView->getCustomOptionsBlock()->getOptions($product); + $actualPrice = $this->isPrice ? $this->getProductPrice($catalogProductView) : null; + $fixtureCustomOptions = $this->prepareOptions($product, $actualPrice); + + $error = $this->verifyData($fixtureCustomOptions, $formCustomOptions); + \PHPUnit_Framework_Assert::assertEmpty($error, $error); + } + + /** + * Get price from product page + * + * @param CatalogProductView $catalogProductView + * @return string + */ + protected function getProductPrice(CatalogProductView $catalogProductView) + { $prices = $catalogProductView->getViewBlock()->getProductPriceBlock()->getPrice(); $actualPrice = isset($prices['price_special_price']) ? $prices['price_special_price'] : $prices['price_regular_price']; - $fixtureCustomOptions = $this->prepareOptions($product, $actualPrice); - $error = $this->verifyData($fixtureCustomOptions, $formCustomOptions); - \PHPUnit_Framework_Assert::assertEmpty($error, $error); + + return $actualPrice; + } + + /** + * Open product view page + * + * @param CatalogProductView $catalogProductView + * @param FixtureInterface $product + * @return void + */ + protected function openProductPage(CatalogProductView $catalogProductView, FixtureInterface $product) + { + $catalogProductView->init($product); + $catalogProductView->open(); } /** @@ -119,12 +149,15 @@ class AssertProductCustomOptionsOnProductPage extends AbstractAssertForm * @param FixtureInterface $product * @param int|null $actualPrice * @return array + * + * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function prepareOptions(FixtureInterface $product, $actualPrice = null) { - $customOptions = $product->getCustomOptions(); $result = []; - + $customOptions = $product->hasData('custom_options') + ? $product->getDataFieldConfig('custom_options')['source']->getCustomOptions() + : null; $actualPrice = $actualPrice ? $actualPrice : $product->getPrice(); foreach ($customOptions as $customOption) { $skippedField = isset($this->skippedFieldOptions[$customOption['type']]) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductDuplicateForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductDuplicateForm.php index 2fde4a0da85..93defce60ad 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductDuplicateForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductDuplicateForm.php @@ -80,7 +80,7 @@ class AssertProductDuplicateForm extends AssertProductForm $productGrid->open()->getProductGrid()->searchAndOpen($filter); $formData = $productPage->getForm()->getData($product); - $fixtureData = $this->prepareFixtureData($product->getData()); + $fixtureData = $this->prepareFixtureData($product->getData(), $product); $errors = $this->verifyData($fixtureData, $formData); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); @@ -90,10 +90,11 @@ class AssertProductDuplicateForm extends AssertProductForm * Prepares fixture data for comparison * * @param array $data + * @param FixtureInterface $product * @param array $sortFields [optional] * @return array */ - protected function prepareFixtureData(array $data, array $sortFields = []) + protected function prepareFixtureData(array $data, FixtureInterface $product, array $sortFields = []) { $compareData = array_filter($data); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductForm.php index b5ade64e7f2..46d4fe28d6f 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductForm.php @@ -39,7 +39,16 @@ class AssertProductForm extends AbstractAssertForm * * @var array */ - protected $sortFields = []; + protected $sortFields = [ + 'custom_options::title' + ]; + + /** + * Formatting options for array values + * + * @var array + */ + protected $specialArray = []; /** * Constraint severeness @@ -65,7 +74,7 @@ class AssertProductForm extends AbstractAssertForm $productGrid->open(); $productGrid->getProductGrid()->searchAndOpen($filter); - $fixtureData = $this->prepareFixtureData($product->getData(), $this->sortFields); + $fixtureData = $this->prepareFixtureData($product->getData(), $product, $this->sortFields); $formData = $this->prepareFormData($productPage->getForm()->getData($product), $this->sortFields); $error = $this->verifyData($fixtureData, $formData); \PHPUnit_Framework_Assert::assertTrue(empty($error), $error); @@ -75,14 +84,21 @@ class AssertProductForm extends AbstractAssertForm * Prepares fixture data for comparison * * @param array $data + * @param FixtureInterface $product * @param array $sortFields [optional] * @return array */ - protected function prepareFixtureData(array $data, array $sortFields = []) + protected function prepareFixtureData(array $data, FixtureInterface $product, array $sortFields = []) { if (isset($data['website_ids']) && !is_array($data['website_ids'])) { $data['website_ids'] = [$data['website_ids']]; } + if (isset($data['custom_options'])) { + $data['custom_options'] = $product->getDataFieldConfig('custom_options')['source']->getCustomOptions(); + } + if (!empty($this->specialArray)) { + $data = $this->prepareSpecialPriceArray($data); + } foreach ($sortFields as $path) { $data = $this->sortDataByPath($data, $path); @@ -90,6 +106,24 @@ class AssertProductForm extends AbstractAssertForm return $data; } + /** + * Prepare special price array for product + * + * @param array $fields + * @return array + */ + protected function prepareSpecialPriceArray(array $fields) + { + foreach ($this->specialArray as $key => $value) { + if (array_key_exists($key, $fields)) { + if (isset($value['type']) && $value['type'] == 'date') { + $fields[$key] = vsprintf('%d/%d/%d', explode('/', $fields[$key])); + } + } + } + return $fields; + } + /** * Prepares form data for comparison * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.php index d34ea99c689..f029c62865b 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.php @@ -591,6 +591,12 @@ class CatalogProductSimple extends InjectableFixture 'source' => 'Magento\Backend\Test\Fixture\Date', ]; + protected $stock_data = [ + 'attribute_code' => 'stock_data', + 'backend_type' => 'virtual', + 'group' => 'advanced-inventory' + ]; + public function getCategoryIds() { return $this->getData('category_ids'); @@ -880,4 +886,9 @@ class CatalogProductSimple extends InjectableFixture { return $this->getData('news_to_date'); } + + public function getStockDate() + { + return $this->getData('stock_data'); + } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml index 52b9547ef7f..8f88072b983 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml @@ -454,6 +454,11 @@ <input>select</input> <group>autosettings</group> </is_returnable> + <stock_data> + <attribute_code>stock_data</attribute_code> + <backend_type>virtual</backend_type> + <group>advanced-inventory</group> + </stock_data> </fields> <data_set> <sku></sku> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple/CustomOptions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple/CustomOptions.php index ae564f6f61f..6eb83048281 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple/CustomOptions.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple/CustomOptions.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Mtf\Fixture\FixtureFactory; use Mtf\Fixture\FixtureInterface; /** @@ -32,25 +33,80 @@ use Mtf\Fixture\FixtureInterface; * * Data keys: * - preset (Custom options preset name) - * - products (comma separated sku identifiers) + * - import_products (comma separated data set name) */ class CustomOptions implements FixtureInterface { /** - * @var \Mtf\Fixture\FixtureFactory + * Prepared dataSet data + * + * @var array + */ + protected $data; + + /** + * Custom options data + * + * @var array */ - protected $fixtureFactory; + protected $customOptions; /** + * Data set configuration settings + * + * @var array + */ + protected $params; + + /** + * @constructor * @param array $params * @param array $data + * @param FixtureFactory|null $fixtureFactory */ - public function __construct(array $params, array $data = []) + public function __construct(array $params, array $data, FixtureFactory $fixtureFactory) { $this->params = $params; if (isset($data['preset'])) { - $this->data = $this->getPreset($data['preset']); + $this->data = $this->replaceData($this->getPreset($data['preset']), mt_rand()); + $this->customOptions = $this->data; + } + if (isset($data['import_products'])) { + $importData = explode(',', $data['import_products']); + $importCustomOptions = []; + $importProducts = []; + foreach ($importData as $item) { + list($fixture, $dataSet) = explode('::', $item); + $product = $fixtureFactory->createByCode($fixture, ['dataSet' => $dataSet]); + if ($product->hasData('id') !== null) { + $product->persist(); + } + $importCustomOptions = array_merge($importCustomOptions, $product->getCustomOptions()); + $importProducts[] = $product->getSku(); + } + $this->customOptions = array_merge($this->data, $importCustomOptions); + $this->data['import'] = ['options' => $importCustomOptions, 'products' => $importProducts]; + } + } + + /** + * Replace custom options data + * + * @param array $data + * @param int $replace + * @return array + */ + protected function replaceData(array $data, $replace) + { + $result = []; + foreach ($data as $key => $value) { + if (is_array($value)) { + $value = $this->replaceData($value, $replace); + } + $result[$key] = str_replace('%isolation%', $replace, $value); } + + return $result; } /** @@ -66,7 +122,7 @@ class CustomOptions implements FixtureInterface /** * Return prepared data set * - * @param $key [optional] + * @param string $key [optional] * @return mixed * * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -76,6 +132,16 @@ class CustomOptions implements FixtureInterface return $this->data; } + /** + * Return all custom options + * + * @return array + */ + public function getCustomOptions() + { + return $this->customOptions; + } + /** * Return data set configuration settings * @@ -97,7 +163,7 @@ class CustomOptions implements FixtureInterface $presets = [ 'MAGETWO-23062' => [ [ - 'title' => 'custom option drop down', + 'title' => 'custom option drop down %isolation%', 'is_require' => 'Yes', 'type' => 'Drop-down', 'options' => [ @@ -112,7 +178,7 @@ class CustomOptions implements FixtureInterface ], 'MAGETWO-23063' => [ [ - 'title' => 'custom option drop down', + 'title' => 'custom option drop down %isolation%', 'is_require' => 'Yes', 'type' => 'Drop-down', 'options' => [ @@ -127,7 +193,7 @@ class CustomOptions implements FixtureInterface ], 'MAGETWO-23066' => [ [ - 'title' => 'custom option drop down', + 'title' => 'custom option drop down %isolation%', 'is_require' => 'Yes', 'type' => 'Drop-down', 'options' => [ @@ -142,7 +208,7 @@ class CustomOptions implements FixtureInterface ], 'MAGETWO-23069' => [ [ - 'title' => 'custom option drop down', + 'title' => 'custom option drop down %isolation%', 'is_require' => 'Yes', 'type' => 'Drop-down', 'options' => [ @@ -223,7 +289,7 @@ class CustomOptions implements FixtureInterface ], 'default' => [ [ - 'title' => 'custom option drop down', + 'title' => 'custom option drop down %isolation%', 'is_require' => 'Yes', 'type' => 'Drop-down', 'options' => [ @@ -236,7 +302,7 @@ class CustomOptions implements FixtureInterface ] ], [ - 'title' => 'custom option drop down2', + 'title' => 'custom option drop down2 %isolation%', 'is_require' => 'Yes', 'type' => 'Drop-down', 'options' => [ @@ -251,7 +317,7 @@ class CustomOptions implements FixtureInterface ], 'two_options' => [ [ - 'title' => 'custom option drop down', + 'title' => 'custom option drop down %isolation%', 'is_require' => 'Yes', 'type' => 'Drop-down', 'options' => [ @@ -264,15 +330,15 @@ class CustomOptions implements FixtureInterface ] ], [ - 'title' => 'custom option drop down2', + 'title' => 'custom option field %isolation%', 'is_require' => 'Yes', - 'type' => 'Drop-down', + 'type' => 'Field', 'options' => [ [ - 'title' => '20 percent', - 'price' => 20, - 'price_type' => 'Percent', - 'sku' => 'sku_drop_down_row_2' + 'price' => 10, + 'price_type' => 'Fixed', + 'sku' => 'sku_field_option_%isolation%', + 'max_characters' => 1024 ] ] ] @@ -408,10 +474,9 @@ class CustomOptions implements FixtureInterface ] ], [ - //TODO fixed setValue() for select type (contains => "=") 'title' => 'custom option Time %isolation%', 'is_require' => 'Yes', - 'type' => 'Date & Time', + 'type' => 'Time', 'options' => [ [ 'price' => 20, diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php index 94226e34082..82523cf8cec 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php @@ -47,6 +47,10 @@ class Curl extends AbstractCurl implements CatalogProductSimpleInterface 'Yes' => 1, 'No' => 0 ], + 'use_config_notify_stock_qty' => [ + 'Yes' => 1, + 'No' => 0 + ], 'is_shareable' => [ 'Yes' => 1, 'No' => 0, @@ -91,6 +95,10 @@ class Curl extends AbstractCurl implements CatalogProductSimpleInterface 'status' => [ 'Product offline' => 2, 'Product online' => 1 + ], + 'is_require' => [ + 'Yes' => 1, + 'No' => 0 ] ]; @@ -115,6 +123,13 @@ class Curl extends AbstractCurl implements CatalogProductSimpleInterface ] ]; + /** + * Select custom options + * + * @var array + */ + protected $selectOptions = ['Drop-down', 'Radio Buttons', 'Checkbox', 'Multiple Select']; + /** * Post request for creating simple product * @@ -158,14 +173,17 @@ class Curl extends AbstractCurl implements CatalogProductSimpleInterface } $fields['category_ids'] = $categoryIds; } - + if (isset($fields['tier_price'])) { $fields['tier_price'] = $this->preparePriceData($fields['tier_price']); } if (isset($fields['group_price'])) { $fields['group_price'] = $this->preparePriceData($fields['group_price']); } - + if ($isCustomOptions = isset($fields['custom_options'])) { + $fields = $this->prepareCustomOptionsData($fields); + } + if (!empty($fields['website_ids'])) { foreach ($fields['website_ids'] as &$value) { $value = isset($this->mappingData['website_ids'][$value]) @@ -184,8 +202,56 @@ class Curl extends AbstractCurl implements CatalogProductSimpleInterface } $fields = $this->prepareStockData($fields); + $fields = $prefix ? [$prefix => $fields] : $fields; + if ($isCustomOptions) { + $fields['affect_product_custom_options'] = 1; + } + + return $fields; + } - return $prefix ? [$prefix => $fields] : $fields; + /** + * Preparation of custom options data + * + * @param array $fields + * @return array + */ + protected function prepareCustomOptionsData(array $fields) + { + $options = []; + foreach ($fields['custom_options'] as $key => $customOption) { + $options[$key] = ['option_id' => 0, 'is_delete' => '']; + foreach ($customOption['options'] as $index => $option) { + $customOption['options'][$index]['is_delete'] = ''; + $customOption['options'][$index]['price_type'] = strtolower($option['price_type']); + } + $options[$key] += in_array($customOption['type'], $this->selectOptions) + ? ['values' => $customOption['options']] + : $customOption['options'][0]; + unset($customOption['options']); + $options[$key] += $customOption; + $options[$key]['type'] = $this->optionNameConvert($customOption['type']); + } + $fields['options'] = $options; + unset($fields['custom_options']); + + return $fields; + } + + /** + * Convert option name + * + * @param string $optionName + * @return string + */ + protected function optionNameConvert($optionName) + { + $optionName = str_replace(['-', ' & '], "_", trim($optionName)); + $end = strpos($optionName, ' '); + if ($end !== false) { + $optionName = substr($optionName, 0, $end); + } + return strtolower($optionName); } /** @@ -275,7 +341,7 @@ class Curl extends AbstractCurl implements CatalogProductSimpleInterface protected function createProduct(array $data, array $config) { $url = $this->getUrl($config); - $curl = new BackendDecorator(new CurlTransport(), new Config); + $curl = new BackendDecorator(new CurlTransport(), new Config()); $curl->addOption(CURLOPT_HEADER, 1); $curl->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $curl->read(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php index 6d2d48f4950..b770f0bbc73 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php @@ -251,5 +251,43 @@ class CatalogProductSimple extends AbstractRepository 'weight' => 1, 'tier_price' => ['preset' => 'default'], ]; + + $this->_data['with_two_custom_option'] = [ + 'type_id' => 'simple', + 'attribute_set_id' => ['dataSet' => 'default'], + 'name' => 'Simple Product %isolation%', + 'sku' => 'sku_simple_product_%isolation%', + 'price' => ['value' => 300, 'preset' => '-'], + 'weight' => 1, + 'custom_options' => ['preset' => 'two_options'], + ]; + + $this->_data['with_all_custom_option'] = [ + 'type_id' => 'simple', + 'attribute_set_id' => ['dataSet' => 'default'], + 'name' => 'Simple Product %isolation%', + 'sku' => 'sku_simple_product_%isolation%', + 'price' => ['value' => 300, 'preset' => '-'], + 'weight' => 1, + 'custom_options' => ['preset' => 'all_types'], + ]; + + $this->_data['low_stock_product'] = [ + 'sku' => 'low_stock_product%isolation%', + 'name' => 'low_stock_product%isolation%', + 'type_id' => 'simple', + 'quantity_and_stock_status' => [ + 'qty' => 1.0000, + 'is_in_stock' => 'In Stock', + ], + 'stock_data' => [ + 'use_config_notify_stock_qty' => 'No', + 'notify_stock_qty' => 2, + ], + 'weight' => 1, + 'attribute_set_id' => ['dataSet' => 'default'], + 'price' => ['value' => 100, 'preset' => '-'], + 'website_ids' => ['Main Website'], + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest/testCreate.csv b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest/testCreate.csv index 3fdd14092f4..2741e51bef7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest/testCreate.csv +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest/testCreate.csv @@ -1,19 +1,19 @@ -"product/data/name";"product/data/sku";"product/data/tax_class_id/dataSet";"product/data/price/value";"product/data/special_price";"product/data/short_description";"product/data/description";"product/data/weight";"product/data/quantity_and_stock_status/qty";"product/data/quantity_and_stock_status/is_in_stock";"product/data/visibility";"constraint";"product/data/custom_options/preset";"product/data/price/preset";"product/data/group_price/preset";"product/data/tier_price/preset" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10000";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"50";"657";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"MAGETWO-23062";"MAGETWO-23062";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10001";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"51";"658";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"MAGETWO-23063";"MAGETWO-23063";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10002";"90";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"52";"659";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"MAGETWO-23062";"MAGETWO-23029";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10003";"90";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"53";"660";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"MAGETWO-23063";"MAGETWO-23030";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10004";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"54";"661";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"MAGETWO-23063";"MAGETWO-23030";"MAGETWO-23055";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10005";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"55";"662";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"MAGETWO-23062";"MAGETWO-23029";"MAGETWO-23055";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10006";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"56";"663";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"MAGETWO-23063";"MAGETWO-23030";"-";"MAGETWO-23002" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10007";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"57";"664";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"MAGETWO-23062";"MAGETWO-23029";"-";"MAGETWO-23002" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10008";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"58";"665";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductVisibleInCategory, assertProductPage";"-";"-";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10009";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"59";"75";"In Stock";"-";"assertProductSaveMessage, assertProductInStock";"-";"-";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10010";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"60";"0";"Out of Stock";"-";"assertProductSaveMessage, assertProductOutOfStock";"-";"-";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10011";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"61";"138";"-";"Search";"assertProductSaveMessage, assertProductSearchableBySku";"-";"-";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10012";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"62";"139";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductSearchableBySku, assertProductPage";"-";"-";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10013";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"63";"140";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage";"-";"-";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"Taxable Goods";"10014";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"64";"141";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage, assertProductGroupedPriceOnProductPage";"-";"-";"default";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"Taxable Goods";"10015";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"65";"142";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage, assertProductSpecialPriceOnProductPage";"-";"-";"-";"-" -"Simple Product %isolation%";"simple_sku_%isolation%";"None";"10016";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"66";"143";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage, assertProductTierPriceOnProductPage";"-";"-";"-";"default" -"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10017";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"67";"144";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage, assertProductCustomOptionsOnProductPage";"options-suite";"-";"-";"-" +"product/data/name";"product/data/sku";"product/data/tax_class_id/dataSet";"product/data/price/value";"product/data/special_price";"product/data/short_description";"product/data/description";"product/data/weight";"product/data/quantity_and_stock_status/qty";"product/data/quantity_and_stock_status/is_in_stock";"product/data/visibility";"product/data/custom_options/preset";"product/data/custom_options/import_products";"product/data/price/preset";"product/data/group_price/preset";"product/data/tier_price/preset";"constraint";"issue" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10000";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"50";"657";"-";"-";"MAGETWO-23062";"-";"MAGETWO-23062";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10001";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"51";"658";"-";"-";"MAGETWO-23063";"-";"MAGETWO-23063";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10002";"90";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"52";"659";"-";"-";"MAGETWO-23062";"-";"MAGETWO-23029";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10003";"90";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"53";"660";"-";"-";"MAGETWO-23063";"-";"MAGETWO-23030";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10004";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"54";"661";"-";"-";"MAGETWO-23063";"-";"MAGETWO-23030";"MAGETWO-23055";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10005";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"55";"662";"-";"-";"MAGETWO-23062";"-";"MAGETWO-23029";"MAGETWO-23055";"-";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10006";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"56";"663";"-";"-";"MAGETWO-23063";"-";"MAGETWO-23030";"-";"MAGETWO-23002";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10007";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"57";"664";"-";"-";"MAGETWO-23062";"-";"MAGETWO-23029";"-";"MAGETWO-23002";"assertProductSaveMessage, assertProductInGrid, assertProductInCategory, assertProductPage, assertProductInCart";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10008";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"58";"665";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductVisibleInCategory, assertProductPage";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10009";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"59";"75";"In Stock";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInStock";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10010";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"60";"0";"Out of Stock";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductOutOfStock";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10011";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"61";"138";"-";"Search";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductSearchableBySku";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10012";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"62";"139";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductSearchableBySku, assertProductPage";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10013";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"63";"140";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"Taxable Goods";"10014";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"64";"141";"-";"-";"-";"-";"-";"default";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage, assertProductGroupedPriceOnProductPage";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"Taxable Goods";"10015";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"65";"142";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage, assertProductSpecialPriceOnProductPage";"" +"Simple Product %isolation%";"simple_sku_%isolation%";"None";"10016";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"66";"143";"-";"-";"-";"-";"-";"-";"default";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage, assertProductTierPriceOnProductPage";"Bug: MAGETWO-26853" +"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10017";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"67";"144";"-";"-";"options-suite";"catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductInStock, assertProductVisibleInCategory, assertProductPage, assertProductCustomOptionsOnProductPage";"" diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest/testCreate.csv b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest/testCreate.csv index 204ed2c43a4..cbc73ef8063 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest/testCreate.csv +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest/testCreate.csv @@ -1,8 +1,8 @@ -"product/data/name";"product/data/sku";"product/data/price/value";"product/data/tax_class_id/dataSet";"product/data/quantity_and_stock_status/qty";"product/data/is_virtual";"product/data/category";"product/data/group_price/preset";"product/data/price/preset";"product/data/tier_price/preset";"product/data/inventory_manage_stock";"product/data/quantity_and_stock_status/is_in_stock";"product/data/custom_options/preset";"product/data/visibility";"constraint" -"VirtualProduct %isolation%";"virtual_sku_%isolation%";"10";"-";"-";"Yes";"-";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid" -"VirtualProduct %isolation%";"virtual_sku_%isolation%";"10";"None";"999";"Yes";"category_%isolation%";"-";"-";"MAGETWO-23002";"Yes";"In Stock";"-";"Catalog, Search";"assertProductSaveMessage, assertProductVisibleInCategory, assertProductForm, assertProductSearchableBySku" -"VirtualProduct %isolation%";"-";"10";"Taxable Goods";"999";"Yes";"-";"-";"MAGETWO-23030";"-";"-";"Out of Stock";"-";"Search";"assertProductSaveMessage, assertProductForm, assertProductSkuAutoGenerated, assertProductSearchableBySku" -"VirtualProduct %isolation%";"virtual_sku_%isolation%";"10";"-";"-";"Yes";"category_%isolation%";"MAGETWO-23055";"-";"-";"-";"-";"-";"Catalog";"assertProductSaveMessage, assertProductForm, assertProductVisibleInCategory" -"VirtualProduct %isolation%";"virtual_sku_%isolation%";"9000";"-";"-";"Yes";"-";"MAGETWO-23055";"-";"-";"-";"-";"options-suite";"-";"assertProductSaveMessage, assertProductSearchableBySku, assertProductPage, assertProductGroupedPriceOnProductPage, assertProductCustomOptionsOnProductPage" -"VirtualProduct %isolation%";"virtual_sku_%isolation%";"10";"-";"999";"Yes";"-";"-";"MAGETWO-23030";"-";"No";"In Stock";"-";"-";"assertProductSaveMessage, assertProductPage, assertProductSpecialPriceOnProductPage, assertProductInStock" -"VirtualProduct %isolation%";"virtual_sku_%isolation%";"9000";"-";"999";"Yes";"-";"-";"-";"default";"-";"Out of Stock";"-";"-";"assertProductSaveMessage, assertProductPage, assertProductTierPriceOnProductPage, assertProductOutOfStock" +"product/data/name";"product/data/sku";"product/data/price/value";"product/data/tax_class_id/dataSet";"product/data/quantity_and_stock_status/qty";"product/data/is_virtual";"product/data/category";"product/data/group_price/preset";"product/data/price/preset";"product/data/tier_price/preset";"product/data/inventory_manage_stock";"product/data/quantity_and_stock_status/is_in_stock";"product/data/custom_options/preset";"product/data/custom_options/import_products";"product/data/visibility";"constraint" +"VirtualProduct %isolation%";"virtual_sku_%isolation%";"10";"-";"-";"Yes";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid" +"VirtualProduct %isolation%";"virtual_sku_%isolation%";"10";"None";"999";"Yes";"category_%isolation%";"-";"-";"MAGETWO-23002";"Yes";"In Stock";"-";"-";"Catalog, Search";"assertProductSaveMessage, assertProductVisibleInCategory, assertProductForm, assertProductSearchableBySku" +"VirtualProduct %isolation%";"-";"10";"Taxable Goods";"999";"Yes";"-";"-";"MAGETWO-23030";"-";"-";"Out of Stock";"-";"-";"Search";"assertProductSaveMessage, assertProductForm, assertProductSkuAutoGenerated, assertProductSearchableBySku" +"VirtualProduct %isolation%";"virtual_sku_%isolation%";"10";"-";"-";"Yes";"category_%isolation%";"MAGETWO-23055";"-";"-";"-";"-";"-";"-";"Catalog";"assertProductSaveMessage, assertProductForm, assertProductVisibleInCategory" +"VirtualProduct %isolation%";"virtual_sku_%isolation%";"9000";"-";"-";"Yes";"-";"MAGETWO-23055";"-";"-";"-";"-";"options-suite";"catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option";"-";"assertProductSaveMessage, assertProductSearchableBySku, assertProductPage, assertProductGroupedPriceOnProductPage, assertProductCustomOptionsOnProductPage" +"VirtualProduct %isolation%";"virtual_sku_%isolation%";"10";"-";"999";"Yes";"-";"-";"MAGETWO-23030";"-";"No";"In Stock";"-";"-";"-";"assertProductSaveMessage, assertProductPage, assertProductSpecialPriceOnProductPage, assertProductInStock" +"VirtualProduct %isolation%";"virtual_sku_%isolation%";"9000";"-";"999";"Yes";"-";"-";"-";"default";"-";"Out of Stock";"-";"-";"-";"assertProductSaveMessage, assertProductPage, assertProductTierPriceOnProductPage, assertProductOutOfStock" diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableProductForm.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableProductForm.php index c52f8616801..217490e3c10 100755 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableProductForm.php @@ -24,10 +24,7 @@ namespace Magento\Downloadable\Test\Constraint; -use Mtf\Fixture\FixtureInterface; use Magento\Catalog\Test\Constraint\AssertProductForm; -use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; -use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; /** * Class AssertDownloadableProductForm @@ -41,43 +38,4 @@ class AssertDownloadableProductForm extends AssertProductForm * @var array */ protected $sortFields = ['downloadable_links/downloadable/link::sort_order']; - - /** - * Constraint severeness - * - * @var string - */ - protected $severeness = 'low'; - - /** - * Assert form data equals fixture data - * - * @param FixtureInterface $product - * @param CatalogProductIndex $productGrid - * @param CatalogProductEdit $productPage - * @return void - */ - public function processAssert( - FixtureInterface $product, - CatalogProductIndex $productGrid, - CatalogProductEdit $productPage - ) { - $filter = ['sku' => $product->getData('sku')]; - $productGrid->open()->getProductGrid()->searchAndOpen($filter); - - $fieldsFixture = $this->prepareFixtureData($product->getData(), $this->sortFields); - $fieldsForm = $this->prepareFormData($productPage->getForm()->getData($product), $this->sortFields); - $error = $this->verifyData($fieldsFixture, $fieldsForm); - \PHPUnit_Framework_Assert::assertEmpty($error, $error); - } - - /** - * Text of Visible in product form assert - * - * @return string - */ - public function toString() - { - return 'Form data equal the fixture data.'; - } } diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest/testCreateDownloadableProduct.csv b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest/testCreateDownloadableProduct.csv index 59d2c37991d..1a84344a633 100755 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest/testCreateDownloadableProduct.csv +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest/testCreateDownloadableProduct.csv @@ -1,15 +1,15 @@ -product/data/name;product/data/sku;product/data/price/value;product/data/tax_class_id/dataSet;product/data/quantity_and_stock_status/qty;product/data/quantity_and_stock_status/is_in_stock;product/data/is_virtual;product/data/category;product/data/description;product/data/short_description;product/data/stock_data/manage_stock;product/data/stock_data/qty;product/data/stock_data/use_config_min_qty;product/data/stock_data/min_qty;product/data/downloadable_sample/preset;product/data/downloadable_links/preset;product/data/custom_options/preset;product/data/special_price;product/data/group_price/preset;product/data/tier_price/preset;constraint -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;100;Taxable Goods;1;In Stock;Yes;Default Category;-;-;-;-;-;-;-;default;-;-;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductVisibleInCategory, assertProductPage, assertProductInStock -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;1;Taxable Goods;10;In Stock;Yes;category %isolation%;-;-;-;-;-;-;default;default;-;-;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductVisibleInCategory, assertDownloadableSamplesData, assertDownloadableLinksData -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;33;Taxable Goods;10;In Stock;Yes;category %isolation%;-;-;-;-;-;-;-;default;default;-;-;-;assertProductSaveMessage, assertDownloadableProductForm, assertProductCustomOptionsOnProductPage, assertProductVisibleInCategory, assertProductPage, assertDownloadableLinksData -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;55;Taxable Goods;10;In Stock;Yes;-;-;-;-;-;-;-;with_three_samples;with_three_links;two_options;-;-;-;assertProductSaveMessage, assertProductCustomOptionsOnProductPage, assertProductInGrid, assertDownloadableProductForm, assertProductVisibleInCategory, assertProductPage, assertDownloadableLinksData, assertProductInStock, assertProductSearchableBySku -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;100;Taxable Goods;50;Out of Stock;Yes;Default Category;-;-;-;-;-;-;-;default;-;-;-;-;assertProductSaveMessage, assertProductOutOfStock, assertProductInGrid, assertDownloadableProductForm -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;9999;Taxable Goods;-;-;Yes;Default Category;-;-;Yes;123;No;123;-;default;-;-;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductOutOfStock -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;98;None;5;In Stock;Yes;Default Category;This is description for downloadable product;-;-;-;-;-;-;default;-;-;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;57;Taxable Goods;10;In Stock;Yes;category %isolation%;-;This is short description for downloadable product;-;-;-;-;default;with_three_links;default;-;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertProductCustomOptionsOnProductPage, assertDownloadableSamplesData, assertDownloadableLinksData -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;65;Taxable Goods;11;In Stock;Yes;category %isolation%;This is description for downloadable product;This is short description for downloadable product;-;-;-;-;default;with_three_links;default;-;-;-;assertProductSaveMessage, assertProductPage, assertProductInGrid, assertDownloadableProductForm, assertProductCustomOptionsOnProductPage, assertDownloadableSamplesData, assertDownloadableLinksData -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;65;Taxable Goods;11;In Stock;Yes;category %isolation%;-;-;-;-;-;-;default;with_three_links;default;-;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertDownloadableLinksData, assertProductCustomOptionsOnProductPage -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;100;Taxable Goods;-;-;Yes;Default Category;-;-;-;-;-;-;-;default;-;-;-;-;assertProductSaveMessage, assertDownloadableProductForm, assertProductVisibleInCategory, assertProductPage -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;10;Taxable Goods;10;In Stock;Yes;category %isolation%;-;-;-;-;-;-;-;-;-;5;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertProductSpecialPriceOnProductPage -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;365;Taxable Goods;23;In Stock;Yes;category %isolation%;-;-;-;-;-;-;-;-;-;-;default;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertProductGroupedPriceOnProductPage -DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;250;Taxable Goods;65;In Stock;Yes;category %isolation%;-;-;-;-;-;-;-;-;-;-;-;default;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertProductTierPriceOnProductPage \ No newline at end of file +"product/data/name";"product/data/sku";"product/data/price/value";"product/data/tax_class_id/dataSet";"product/data/quantity_and_stock_status/qty";"product/data/quantity_and_stock_status/is_in_stock";"product/data/is_virtual";"product/data/category";"product/data/description";"product/data/short_description";"product/data/stock_data/manage_stock";"product/data/stock_data/qty";"product/data/stock_data/use_config_min_qty";"product/data/stock_data/min_qty";"product/data/downloadable_sample/preset";"product/data/downloadable_links/preset";"product/data/custom_options/preset";"product/data/custom_options/import_products";"product/data/special_price";"product/data/group_price/preset";"product/data/tier_price/preset";"constraint";"issue" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"100";"Taxable Goods";"1";"In Stock";"Yes";"Default Category";"-";"-";"-";"-";"-";"-";"-";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductVisibleInCategory, assertProductPage, assertProductInStock";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"1";"Taxable Goods";"10";"In Stock";"Yes";"category %isolation%";"-";"-";"-";"-";"-";"-";"default";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductVisibleInCategory, assertDownloadableSamplesData, assertDownloadableLinksData";"Bug: MAGETWO-26676" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"33";"Taxable Goods";"10";"In Stock";"Yes";"category %isolation%";"-";"-";"-";"-";"-";"-";"-";"default";"default";"-";"-";"-";"-";"assertProductSaveMessage, assertDownloadableProductForm, assertProductCustomOptionsOnProductPage, assertProductVisibleInCategory, assertProductPage, assertDownloadableLinksData";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"55";"Taxable Goods";"10";"In Stock";"Yes";"-";"-";"-";"-";"-";"-";"-";"with_three_samples";"with_three_links";"two_options";"-";"-";"-";"-";"assertProductSaveMessage, assertProductCustomOptionsOnProductPage, assertProductInGrid, assertDownloadableProductForm, assertProductVisibleInCategory, assertProductPage, assertDownloadableLinksData, assertProductInStock, assertProductSearchableBySku";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"100";"Taxable Goods";"50";"Out of Stock";"Yes";"Default Category";"-";"-";"-";"-";"-";"-";"-";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductOutOfStock, assertProductInGrid, assertDownloadableProductForm";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"9999";"Taxable Goods";"-";"-";"Yes";"Default Category";"-";"-";"Yes";"123";"No";"123";"-";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductOutOfStock";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"98";"None";"5";"In Stock";"Yes";"Default Category";"This is description for downloadable product";"-";"-";"-";"-";"-";"-";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"57";"Taxable Goods";"10";"In Stock";"Yes";"category %isolation%";"-";"This is short description for downloadable product";"-";"-";"-";"-";"default";"with_three_links";"default";"catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertProductCustomOptionsOnProductPage, assertDownloadableSamplesData, assertDownloadableLinksData";"Bug: MAGETWO-26676" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"65";"Taxable Goods";"11";"In Stock";"Yes";"category %isolation%";"This is description for downloadable product";"This is short description for downloadable product";"-";"-";"-";"-";"default";"with_three_links";"default";"-";"-";"-";"-";"assertProductSaveMessage, assertProductPage, assertProductInGrid, assertDownloadableProductForm, assertProductCustomOptionsOnProductPage, assertDownloadableSamplesData, assertDownloadableLinksData";"Bug: MAGETWO-26676" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"65";"Taxable Goods";"11";"In Stock";"Yes";"category %isolation%";"-";"-";"-";"-";"-";"-";"default";"with_three_links";"default";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertDownloadableLinksData, assertProductCustomOptionsOnProductPage";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"100";"Taxable Goods";"-";"-";"Yes";"Default Category";"-";"-";"-";"-";"-";"-";"-";"default";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertDownloadableProductForm, assertProductVisibleInCategory, assertProductPage";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"10";"Taxable Goods";"10";"In Stock";"Yes";"category %isolation%";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"5";"-";"-";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertProductSpecialPriceOnProductPage";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"365";"Taxable Goods";"23";"In Stock";"Yes";"category %isolation%";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"default";"-";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertProductGroupedPriceOnProductPage";"" +"DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"250";"Taxable Goods";"65";"In Stock";"Yes";"category %isolation%";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"default";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertProductTierPriceOnProductPage";"Bug: MAGETWO-26853" diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Grid.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Grid.php index d25a5e0cb5b..1ff86e647f2 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Grid.php @@ -24,24 +24,40 @@ namespace Magento\Newsletter\Test\Block\Adminhtml\Template; -use Magento\Backend\Test\Block\Widget\Grid as AbstractGrid; +use Mtf\Client\Element\Locator; /** * Class Grid * Newsletter templates grid block - * - * @package Magento\Newsletter\Test\Block\Aminhtml\Template */ -class Grid extends AbstractGrid +class Grid extends \Magento\Backend\Test\Block\Widget\Grid { /** * Filters array mapping * - * @var array $filters + * @var array */ protected $filters = [ 'code' => [ - 'selector' => '[data-ui-id="widget-grid-column-filter-text-1-filter-code"]' + 'selector' => 'input[name="code"]' ] ]; + + /** + * Locator for "Action" + * + * @var string + */ + protected $action = '.action-select'; + + /** + * Action for newsletter template + * + * @param string $action + * @return void + */ + public function performAction($action) + { + $this->_rootElement->find($this->action, Locator::SELECTOR_CSS, 'select')->setValue($action); + } } diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php new file mode 100644 index 00000000000..726517308e8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php @@ -0,0 +1,76 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Newsletter\Test\Block\Adminhtml\Template; + +use Mtf\Block\Block; +use Mtf\Client\Browser; +use Mtf\Client\Element; +use Mtf\Block\BlockFactory; +use Mtf\Client\Element\Locator; + +/** + * Class Preview + * Newsletter template preview + */ +class Preview extends Block +{ + /** + * Browser + * + * @var Browser + */ + protected $browser; + + /** + * IFrame locator + * + * @var string + */ + protected $iFrame = '#preview_iframe'; + + /** + * Constructor + * + * @param Element $element + * @param BlockFactory $blockFactory + * @param Browser $browser + */ + public function __construct(Element $element, BlockFactory $blockFactory, Browser $browser) + { + $this->browser = $browser; + parent::__construct($element, $blockFactory); + } + + /** + * Get page content text + * + * @return string + */ + public function getPageContent() + { + $this->browser->switchToFrame(new Locator($this->iFrame)); + return $this->_rootElement->getText(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterPreview.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterPreview.php new file mode 100644 index 00000000000..9689e2d6b91 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterPreview.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Newsletter\Test\Constraint; + +use Mtf\Client\Browser; +use Mtf\Constraint\AbstractConstraint; +use Magento\Newsletter\Test\Fixture\Template; +use Magento\Newsletter\Test\Page\Adminhtml\TemplatePreview; + +/** + * Class AssertNewsletterPreview + * Assert that newsletter preview opened in new window and template content correct + */ +class AssertNewsletterPreview extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that newsletter preview opened in new window and template content correct + * + * @param Browser $browser + * @param TemplatePreview $templatePreview + * @param Template $newsletter + * @return void + */ + public function processAssert(Browser $browser, TemplatePreview $templatePreview, Template $newsletter) + { + $browser->selectWindow(); + $content = $templatePreview->getContent()->getPageContent(); + $browser->closeWindow(); + \PHPUnit_Framework_Assert::assertEquals( + $content, + $newsletter->getText(), + 'Template content not correct information.' + ); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Newsletter preview opened in new window and has valid content.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterQueue.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterQueue.php new file mode 100644 index 00000000000..323867028a3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterQueue.php @@ -0,0 +1,73 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Newsletter\Test\Constraint; + +use Mtf\Constraint\AbstractAssertForm; +use Magento\Newsletter\Test\Fixture\Template; +use Magento\Newsletter\Test\Page\Adminhtml\TemplateQueue; + +/** + * Class AssertNewsletterQueue + * Assert that "Edit Queue" page opened and subject, sender name, sender email and template content correct + */ +class AssertNewsletterQueue extends AbstractAssertForm +{ + /** + * Skipped fields for verify data + * + * @var array + */ + protected $skippedFields = ['code']; + + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that "Edit Queue" page opened and subject, sender name, sender email and template content correct + * + * @param TemplateQueue $templateQueue + * @param Template $newsletter + * @return void + */ + public function processAssert(TemplateQueue $templateQueue, Template $newsletter) + { + $dataDiff = $this->verifyData($newsletter->getData(), $templateQueue->getEditForm()->getData($newsletter)); + \PHPUnit_Framework_Assert::assertEmpty($dataDiff, $dataDiff); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Edit Queue content equals to passed from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Fixture/Template.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Fixture/Template.php index 8d6b2e95eb6..4c106dbe34c 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Fixture/Template.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Fixture/Template.php @@ -28,11 +28,20 @@ use Mtf\Fixture\InjectableFixture; /** * Class Template - * - * @package Magento\Newsletter\Test\Fixture + * Template fixture */ class Template extends InjectableFixture { + /** + * @var string + */ + protected $repositoryClass = 'Magento\Newsletter\Test\Repository\Template'; + + /** + * @var string + */ + protected $handlerInterface = 'Magento\Newsletter\Test\Handler\Template\TemplateInterface'; + protected $defaultDataSet = [ 'code' => 'TemplateName%isolation%', 'subject' => 'TemplateSubject%isolation%', diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Fixture/Template.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Fixture/Template.xml index 8cbfa452add..2e867e6a491 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Fixture/Template.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Fixture/Template.xml @@ -115,4 +115,6 @@ <input/> </modified_at> </fields> + <repository_class>Magento\Newsletter\Test\Repository\Template</repository_class> + <handler_interface>Magento\Newsletter\Test\Handler\Newsletter\TemplateInterface</handler_interface> </fixture> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Handler/Template/Curl.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Handler/Template/Curl.php new file mode 100644 index 00000000000..f0dcdb4db21 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Handler/Template/Curl.php @@ -0,0 +1,65 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Newsletter\Test\Handler\Template; + +use Mtf\System\Config; +use Mtf\Fixture\FixtureInterface; +use Mtf\Util\Protocol\CurlInterface; +use Mtf\Util\Protocol\CurlTransport; +use Mtf\Handler\Curl as AbstractCurl; +use Mtf\Util\Protocol\CurlTransport\BackendDecorator; + +/** + * Class Curl + * Creation Newsletter Template + */ +class Curl extends AbstractCurl implements TemplateInterface +{ + /** + * URL for newsletter template + * + * @var string + */ + protected $url = 'newsletter/template/save/'; + + /** + * @param FixtureInterface $fixture [optional] + * @throws \Exception + * @return mixed|void + */ + public function persist(FixtureInterface $fixture = null) + { + $url = $_ENV['app_backend_url'] . $this->url; + $data = $this->replaceMappingData($fixture->getData()); + $curl = new BackendDecorator(new CurlTransport(), new Config()); + $curl->write(CurlInterface::POST, $url, '1.0', [], $data); + $response = $curl->read(); + + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception("Newsletter template creation by curl was not successful! Response: $response"); + } + $curl->close(); + } +} diff --git a/app/code/Magento/Checkout/Block/Total/Tax.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Handler/Template/TemplateInterface.php similarity index 77% rename from app/code/Magento/Checkout/Block/Total/Tax.php rename to dev/tests/functional/tests/app/Magento/Newsletter/Test/Handler/Template/TemplateInterface.php index 678a3b30ab8..953b67a499e 100644 --- a/app/code/Magento/Checkout/Block/Total/Tax.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Handler/Template/TemplateInterface.php @@ -21,17 +21,15 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Checkout\Block\Total; + +namespace Magento\Newsletter\Test\Handler\Template; + +use Mtf\Handler\HandlerInterface; /** - * Tax Total Row Renderer - * - * @author Magento Core Team <core@magentocommerce.com> + * Interface TemplateInterface */ -class Tax extends \Magento\Checkout\Block\Total\DefaultTotal +interface TemplateInterface extends HandlerInterface { - /** - * @var string - */ - protected $_template = 'total/tax.phtml'; + // } diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.php new file mode 100644 index 00000000000..8ec4c4de0eb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Newsletter\Test\Page\Adminhtml; + +use Mtf\Page\BackendPage; + +/** + * Class TemplatePreview + * TemplatePreview page + */ +class TemplatePreview extends BackendPage +{ + const MCA = 'newsletter/template/preview'; + + protected $_blocks = [ + 'content' => [ + 'name' => 'content', + 'class' => 'Magento\Newsletter\Test\Block\Adminhtml\Template\Preview', + 'locator' => 'body', + 'strategy' => 'css selector', + ], + ]; + + /** + * @return \Magento\Newsletter\Test\Block\Adminhtml\Template\Preview + */ + public function getContent() + { + return $this->getBlockInstance('content'); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.xml new file mode 100644 index 00000000000..c60ff1c8025 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="newsletter/template/preview" > + <block> + <name>content</name> + <class>Magento\Newsletter\Test\Block\Adminhtml\Template\Preview</class> + <locator>body</locator> + <strategy>css selector</strategy> + </block> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.php new file mode 100644 index 00000000000..81897ec14f9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.php @@ -0,0 +1,81 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Newsletter\Test\Page\Adminhtml; + +use Mtf\Page\BackendPage; + +/** + * Class TemplateQueue + * TemplateQueue page + */ +class TemplateQueue extends BackendPage +{ + const MCA = 'newsletter/queue/edit'; + + protected $_blocks = [ + 'formPageActions' => [ + 'name' => 'formPageActions', + 'class' => 'Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions', + 'locator' => '.page-main-actions', + 'strategy' => 'css selector', + ], + 'editForm' => [ + 'name' => 'editForm', + 'class' => 'Magento\Backend\Test\Block\Widget\Form', + 'locator' => '#queue_edit_form', + 'strategy' => 'css selector', + ], + 'messagesBlock' => [ + 'name' => 'messagesBlock', + 'class' => 'Magento\Core\Test\Block\Messages', + 'locator' => '#messages', + 'strategy' => 'css selector', + ], + ]; + + /** + * @return \Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions + */ + public function getFormPageActions() + { + return $this->getBlockInstance('formPageActions'); + } + + /** + * @return \Magento\Backend\Test\Block\Widget\Form + */ + public function getEditForm() + { + return $this->getBlockInstance('editForm'); + } + + /** + * @return \Magento\Core\Test\Block\Messages + */ + public function getMessagesBlock() + { + return $this->getBlockInstance('messagesBlock'); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml new file mode 100644 index 00000000000..996113f1aa1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="newsletter/queue/edit" > + <block> + <name>formPageActions</name> + <class>Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </block> + <block> + <name>editForm</name> + <class>Magento\Backend\Test\Block\Widget\Form</class> + <locator>#queue_edit_form</locator> + <strategy>css selector</strategy> + </block> + <block> + <name>messagesBlock</name> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </block> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Repository/Template.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Repository/Template.php new file mode 100644 index 00000000000..b6966630cfd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Repository/Template.php @@ -0,0 +1,51 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Newsletter\Test\Repository; + +use Mtf\Repository\AbstractRepository; + +/** + * Class UrlRewrite + * Data for creation url rewrite + */ +class Template extends AbstractRepository +{ + /** + * @param array $defaultConfig + * @param array $defaultData + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function __construct(array $defaultConfig = [], array $defaultData = []) + { + $this->_data['default'] = [ + 'code' => 'Newsletter Template %isolation%', + 'subject' => 'Newsletter Subject %isolation%', + 'sender_name' => 'Sender Name %isolation%', + 'sender_email' => 'support%isolation%@example.com', + 'text' => 'Template Content %isolation%' + ]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php new file mode 100644 index 00000000000..65f3373f5cf --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php @@ -0,0 +1,85 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Newsletter\Test\TestCase; + +use Mtf\TestCase\Injectable; +use Magento\Newsletter\Test\Fixture\Template; +use Magento\Newsletter\Test\Page\Adminhtml\TemplateIndex; + +/** + * Test Creation for Action for Newsletter Template (Preview and Queue) + * + * Test Flow: + * Preconditions: + * 1. Create newsletter + * + * Steps: + * 1. Open Backend + * 2. Go to Marketing > Newsletter Template + * 3. Find created template in grid + * 4. Select action in action dropdown for created template according to dataSet + * 5. Perform all assertions + * + * @group Newsletters_(MX) + * @ZephyrId MAGETWO-27043 + */ +class ActionNewsletterTemplateEntityTest extends Injectable +{ + /** + * Page with newsletter template grid + * + * @var TemplateIndex + */ + protected $templateIndex; + + /** + * Inject newsletter page + * + * @param TemplateIndex $templateIndex + * @return void + */ + public function __inject(TemplateIndex $templateIndex) + { + $this->templateIndex = $templateIndex; + } + + /** + * Action for Newsletter Template + * + * @param Template $newsletter + * @param string $action + * @return void + */ + public function test(Template $newsletter, $action) + { + // Preconditions + $newsletter->persist(); + + // Steps + $this->templateIndex->open(); + $this->templateIndex->getNewsletterTemplateGrid()->search(['code' => $newsletter->getCode()]); + $this->templateIndex->getNewsletterTemplateGrid()->performAction($action); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest/test.csv new file mode 100644 index 00000000000..54ade718a78 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest/test.csv @@ -0,0 +1,3 @@ +"newsletter/dataSet";"action";"constraint" +"default";"Preview";"assertNewsletterPreview" +"default";"Queue Newsletter";"assertNewsletterQueue" diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/curl/di.xml new file mode 100644 index 00000000000..e0786a9dd5c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/curl/di.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <preference for="\Magento\Newsletter\Test\Handler\Template\TemplateInterface" type="\Magento\Newsletter\Test\Handler\Template\Curl" /> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/constraint.xml index 9321ac60842..54d7d533719 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/constraint.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/constraint.xml @@ -30,6 +30,12 @@ <assertNewsletterInGrid module="Magento_Newsletter"> <severeness>low</severeness> </assertNewsletterInGrid> + <assertNewsletterPreview module="Magento_Newsletter"> + <severeness>low</severeness> + </assertNewsletterPreview> + <assertNewsletterQueue module="Magento_Newsletter"> + <severeness>low</severeness> + </assertNewsletterQueue> <assertCustomerIsSubscribedToNewsletter module="Magento_Newsletter"> <severeness>low</severeness> <require> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/page.xml index a18cb41d5d1..648e5c7dbec 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/page.xml @@ -39,4 +39,14 @@ <area>adminhtml</area> <class>Magento\Newsletter\Test\Page\Adminhtml\SubscriberIndex</class> </subscriberIndex> + <newsletterQueue> + <mca>newsletter/queue/edit</mca> + <area>adminhtml</area> + <class>Magento\Newsletter\Test\Page\Adminhtml\TemplateQueue</class> + </newsletterQueue> + <newsletterPreview> + <mca>newsletter/template/preview</mca> + <area>adminhtml</area> + <class>Magento\Newsletter\Test\Page\Adminhtml\TemplatePreview</class> + </newsletterPreview> </page> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Product/Lowstock/Grid.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Product/Lowstock/Grid.php new file mode 100644 index 00000000000..a4b8176c90d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Product/Lowstock/Grid.php @@ -0,0 +1,43 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Block\Adminhtml\Product\Lowstock; + +/** + * Class Grid + * Low Stock Report grid + */ +class Grid extends \Magento\Backend\Test\Block\Widget\Grid +{ + /** + * Filters array mapping + * + * @var array + */ + protected $filters = [ + 'name' => [ + 'selector' => 'input[name="name"]', + ], + ]; +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/SearchTermsGrid.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/SearchTermsGrid.php new file mode 100644 index 00000000000..75e30e36aa9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/SearchTermsGrid.php @@ -0,0 +1,56 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Block\Adminhtml; + +/** + * Class SearchTermsGrid + * Search Terms report Grid + */ +class SearchTermsGrid extends \Magento\Backend\Test\Block\Widget\Grid +{ + /** + * Filters array mapping + * + * @var array + */ + protected $filters = [ + 'query_text' => [ + 'selector' => 'input[name="query_text"]' + ], + 'num_results' => [ + 'selector' => 'input[name="num_results[from]"]' + ], + 'popularity' => [ + 'selector' => 'input[name="popularity[from]"]' + ], + ]; + + /** + * Locator value for link in action column + * + * @var string + */ + protected $editLink = 'td[class*=col-query]'; +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertLowStockProductInGrid.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertLowStockProductInGrid.php new file mode 100644 index 00000000000..0fb1f7e61f6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertLowStockProductInGrid.php @@ -0,0 +1,69 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Constraint; + +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Reports\Test\Page\Adminhtml\ProductLowStock; +use Mtf\Constraint\AbstractConstraint; + +/** + * Class AssertLowStockProductInGrid + * Assert that product with Low Stock is present in Low Stock grid + */ +class AssertLowStockProductInGrid extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that product with Low Stock is present in Low Stock grid + * + * @param CatalogProductSimple $product + * @param ProductLowStock $productLowStock + * @return void + */ + public function processAssert(CatalogProductSimple $product, ProductLowStock $productLowStock) + { + $productLowStock->open(); + \PHPUnit_Framework_Assert::assertTrue( + $productLowStock->getLowStockGrid()->isRowVisible(['name' => $product->getName()]), + 'Product with Low Stock is absent in Low Stock grid.' + ); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Product with Low Stock is present in Low Stock grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSearchTermReportForm.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSearchTermReportForm.php new file mode 100644 index 00000000000..efe147637d6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSearchTermReportForm.php @@ -0,0 +1,83 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Constraint; + +use Mtf\Constraint\AbstractAssertForm; +use Magento\Reports\Test\Page\Adminhtml\SearchIndex; +use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchEdit; + +/** + * Class AssertSearchTermReportForm + * Assert that Search Term Report form data equals to passed from dataSet + */ +class AssertSearchTermReportForm extends AbstractAssertForm +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that Search Term Report form data equals to passed from dataSet + * + * @param CatalogSearchEdit $catalogSearchEdit + * @param SearchIndex $searchIndex + * @param string $productName + * @param int $countProducts + * @param int $countSearch + * @return void + */ + public function processAssert( + CatalogSearchEdit $catalogSearchEdit, + SearchIndex $searchIndex, + $productName, + $countProducts, + $countSearch + ) { + $filter = [ + 'query_text' => $productName, + 'num_results' => $countProducts, + 'popularity' => $countSearch, + ]; + $searchIndex->open(); + $searchIndex->getSearchGrid()->searchAndOpen($filter); + + $dataDiff = $this->verifyData($filter, $catalogSearchEdit->getForm()->getData()); + + \PHPUnit_Framework_Assert::assertEmpty($dataDiff, $dataDiff); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Search Term Report form data equals to passed from dataSet.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSearchTermsInGrid.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSearchTermsInGrid.php new file mode 100644 index 00000000000..944d48e7814 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSearchTermsInGrid.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Reports\Test\Page\Adminhtml\SearchIndex; + +/** + * Class AssertSearchTermsInGrid + * Assert that Search Terms report in Search Terms grid + */ +class AssertSearchTermsInGrid extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that Search Terms report in grid + * + * @param SearchIndex $searchIndex + * @param string $productName + * @param int $countProducts + * @param int $countSearch + * @return void + */ + public function processAssert(SearchIndex $searchIndex, $productName, $countProducts, $countSearch) + { + $filter = [ + 'query_text' => $productName, + 'num_results' => $countProducts, + 'popularity' => $countSearch, + ]; + \PHPUnit_Framework_Assert::assertTrue( + $searchIndex->getSearchGrid()->isRowVisible($filter), + 'Search terms report is absent in Search Terms grid.' + ); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Search terms report is present in Search Terms grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.php new file mode 100644 index 00000000000..a92866f0d5d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Page\Adminhtml; + +use Mtf\Page\BackendPage; + +/** + * Class ProductLowStock + * Product Low Stock page + */ +class ProductLowStock extends BackendPage +{ + const MCA = 'reports/report_product/lowstock'; + + protected $_blocks = [ + 'lowStockGrid' => [ + 'name' => 'lowStockGrid', + 'class' => 'Magento\Reports\Test\Block\Adminhtml\Product\Lowstock\Grid', + 'locator' => '#gridLowstock', + 'strategy' => 'css selector', + ], + ]; + + /** + * @return \Magento\Reports\Test\Block\Adminhtml\Product\Lowstock\Grid + */ + public function getLowStockGrid() + { + return $this->getBlockInstance('lowStockGrid'); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.xml new file mode 100644 index 00000000000..117a4f2281e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="reports/report_product/lowstock" > + <block> + <name>lowStockGrid</name> + <class>Magento\Reports\Test\Block\Adminhtml\Product\Lowstock\Grid</class> + <locator>#gridLowstock</locator> + <strategy>css selector</strategy> + </block> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.php new file mode 100644 index 00000000000..435c5582e7d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Page\Adminhtml; + +use Mtf\Page\BackendPage; + +/** + * Class SearchIndex + * Search report page + */ +class SearchIndex extends BackendPage +{ + const MCA = 'reports/index/search'; + + protected $_blocks = [ + 'searchGrid' => [ + 'name' => 'searchGrid', + 'class' => 'Magento\Reports\Test\Block\Adminhtml\SearchTermsGrid', + 'locator' => '#searchReportGrid', + 'strategy' => 'css selector', + ], + ]; + + /** + * @return \Magento\Reports\Test\Block\Adminhtml\SearchTermsGrid + */ + public function getSearchGrid() + { + return $this->getBlockInstance('searchGrid'); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.xml new file mode 100644 index 00000000000..fa1dbc9ce66 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="reports/index/search" > + <block> + <name>searchGrid</name> + <class>Magento\Reports\Test\Block\Adminhtml\SearchTermsGrid</class> + <locator>#searchReportGrid</locator> + <strategy>css selector</strategy> + </block> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest.php new file mode 100644 index 00000000000..00521643b59 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest.php @@ -0,0 +1,58 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\TestCase; + +use Mtf\TestCase\Injectable; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; + +/** + * Test Creation for LowStockProductsReportEntityTest + * + * Test Flow: + * Preconditions: + * 1. Product is created. + * + * Steps: + * 1. Login to backend. + * 2. Open Reports > Low Stock. + * 3. Perform appropriate assertions. + * + * @group Reports_(MX) + * @ZephyrId MAGETWO-27193 + */ +class LowStockProductsReportEntityTest extends Injectable +{ + /** + * Create product + * + * @param CatalogProductSimple $product + * @return void + */ + public function test(CatalogProductSimple $product) + { + // Preconditions + $product->persist(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest/test.csv new file mode 100644 index 00000000000..3546336dec8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest/test.csv @@ -0,0 +1,2 @@ +"product/dataSet";"constraint" +"low_stock_product";"assertLowStockProductInGrid" diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest.php new file mode 100644 index 00000000000..5be39cf1135 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest.php @@ -0,0 +1,137 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\TestCase; + +use Mtf\TestCase\Injectable; +use Mtf\Fixture\FixtureFactory; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Reports\Test\Page\Adminhtml\SearchIndex; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; + +/** + * Test Creation for SearchTermsReportEntity + * + * Test Flow: + * Preconditions: + * 1. Products is created. + * + * Steps: + * 1. Search products in frontend. + * 2. Login to backend. + * 3. Navigate to: Reports > Search Terms. + * 4. Perform appropriate assertions. + * + * @group Search_Terms_(MX) + * @ZephyrId MAGETWO-27106 + */ +class SearchTermsReportEntityTest extends Injectable +{ + /** + * Index page + * + * @var CmsIndex + */ + protected $cmsIndex; + + /** + * Search Index page + * + * @var SearchIndex + */ + protected $searchIndex; + + /** + * FixtureFactory + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Inject pages + * + * @param CmsIndex $cmsIndex + * @param SearchIndex $searchIndex + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __inject(CmsIndex $cmsIndex, SearchIndex $searchIndex, FixtureFactory $fixtureFactory) + { + $this->cmsIndex = $cmsIndex; + $this->searchIndex = $searchIndex; + $this->fixtureFactory = $fixtureFactory; + } + + /** + * Search Terms Report + * + * @param CatalogProductSimple $product + * @param int $countProducts + * @param int $countSearch + * @return array + */ + public function test(CatalogProductSimple $product, $countProducts, $countSearch) + { + $this->markTestIncomplete('MAGETWO-27150, MAGETWO-27151'); + // Preconditions + $productName = $this->createProducts($product, $countProducts); + + // Steps + $this->cmsIndex->open(); + $this->searchProducts($productName, $countSearch); + $this->searchIndex->open(); + + return ['productName' => $productName]; + } + + /** + * Create products + * + * @param CatalogProductSimple $product + * @param int $countProduct + * @return string + */ + protected function createProducts(CatalogProductSimple $product, $countProduct) + { + for ($i = 0; $i < $countProduct; $i++) { + $product->persist(); + } + return $product->getName(); + } + + /** + * Search products + * + * @param string $productName + * @param int $countSearch + * @return void + */ + protected function searchProducts($productName, $countSearch) + { + for ($i = 0; $i < $countSearch; $i++) { + $this->cmsIndex->getSearchBlock()->search($productName); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest/test.csv new file mode 100644 index 00000000000..20bf7a1572c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest/test.csv @@ -0,0 +1,3 @@ +"product/dataSet";"countProducts";"countSearch";"constraint" +"100_dollar_product";"1";"2";"assertSearchTermsInGrid, assertSearchTermReportForm" +"100_dollar_product";"3";"1";"assertSearchTermsInGrid, assertSearchTermReportForm" \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/constraint.xml new file mode 100644 index 00000000000..8145a448500 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/constraint.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<constraint> + <assertSearchTermsInGrid module="Magento_Reports"> + <severeness>low</severeness> + </assertSearchTermsInGrid> + <assertSearchTermReportForm module="Magento_Reports"> + <severeness>low</severeness> + </assertSearchTermReportForm> + <assertLowStockProductInGrid module="Magento_Reports"> + <severeness>low</severeness> + </assertLowStockProductInGrid> +</constraint> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/page.xml new file mode 100644 index 00000000000..54b687f5737 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/page.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page> + <searchIndex> + <mca>reports/index/search</mca> + <area>adminhtml</area> + <class>Magento\Reports\Test\Page\Adminhtml\SearchIndex</class> + </searchIndex> + <productLowStock> + <mca>reports/report_product/lowstock</mca> + <area>adminhtml</area> + <class>Magento\Reports\Test\Page\Adminhtml\ProductLowStock</class> + </productLowStock> +</page> diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php index be0119f6899..6459c5e26ce 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php @@ -76,7 +76,7 @@ class AuthTest extends \Magento\TestFramework\TestCase\AbstractController /** * Check not logged state - * @covers \Magento\Backend\Controller\Adminhtml\Auth::loginAction + * @covers \Magento\Backend\Controller\Adminhtml\Auth\Login::execute */ public function testNotLoggedLoginAction() { @@ -90,7 +90,7 @@ class AuthTest extends \Magento\TestFramework\TestCase\AbstractController /** * Check logged state - * @covers \Magento\Backend\Controller\Adminhtml\Auth::loginAction + * @covers \Magento\Backend\Controller\Adminhtml\Auth\Login::execute * @magentoDbIsolation enabled */ public function testLoggedLoginAction() @@ -138,7 +138,7 @@ class AuthTest extends \Magento\TestFramework\TestCase\AbstractController } /** - * @covers \Magento\Backend\Controller\Adminhtml\Auth::logoutAction + * @covers \Magento\Backend\Controller\Adminhtml\Auth\Logout::execute * @magentoDbIsolation enabled */ public function testLogoutAction() @@ -156,8 +156,7 @@ class AuthTest extends \Magento\TestFramework\TestCase\AbstractController } /** - * @covers \Magento\Backend\Controller\Adminhtml\Auth::deniedJsonAction - * @covers \Magento\Backend\Controller\Adminhtml\Auth::_getDeniedJson + * @covers \Magento\Backend\Controller\Adminhtml\Auth\DeniedJson::execute * @magentoDbIsolation enabled */ public function testDeniedJsonAction() @@ -176,8 +175,7 @@ class AuthTest extends \Magento\TestFramework\TestCase\AbstractController } /** - * @covers \Magento\Backend\Controller\Adminhtml\Auth::deniedIframeAction - * @covers \Magento\Backend\Controller\Adminhtml\Auth::_getDeniedIframe + * @covers \Magento\Backend\Controller\Adminhtml\Auth\DeniedIframe::execute * @magentoDbIsolation enabled */ public function testDeniedIframeAction() diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/IndexTest.php index 28945c26a96..303eb719ec1 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/IndexTest.php @@ -30,7 +30,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller { /** * Check not logged state - * @covers \Magento\Backend\Controller\Adminhtml\Index::indexAction + * @covers \Magento\Backend\Controller\Adminhtml\Index\Index::execute */ public function testNotLoggedIndexAction() { @@ -45,7 +45,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller /** * Check logged state - * @covers \Magento\Backend\Controller\Adminhtml\Index::indexAction + * @covers \Magento\Backend\Controller\Adminhtml\Index\Index::execute * @magentoDbIsolation enabled */ public function testLoggedIndexAction() @@ -55,7 +55,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller } /** - * @covers \Magento\Backend\Controller\Adminhtml\Index::globalSearchAction + * @covers \Magento\Backend\Controller\Adminhtml\Index\GlobalSearch::execute */ public function testGlobalSearchAction() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php index 99b99a25af2..46541126f30 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php @@ -29,7 +29,7 @@ namespace Magento\Catalog\Controller\Adminhtml\Product\Action; class AttributeTest extends \Magento\Backend\Utility\Controller { /** - * @covers \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute::saveAction + * @covers \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute\Save::execute * * @magentoDataFixture Magento/Catalog/_files/product_simple.php */ @@ -65,7 +65,7 @@ class AttributeTest extends \Magento\Backend\Utility\Controller /** - * @covers \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute::validateAction + * @covers \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute\Validate::execute * * @dataProvider validateActionDataProvider * diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php index 7da4381e764..7ccf67c76c4 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php @@ -23,18 +23,77 @@ */ namespace Magento\Catalog\Helper; +use Magento\Tax\Model\ClassModel; +use Magento\Tax\Service\V1\TaxRuleFixtureFactory; +use Magento\Store\Model\ScopeInterface; +use Magento\Tax\Model\Config; + class DataTest extends \PHPUnit_Framework_TestCase { /** + * Tax helper + * * @var \Magento\Catalog\Helper\Data */ - protected $_helper; + private $helper; + + /** + * Object Manager + * + * @var \Magento\Framework\ObjectManager + */ + private $objectManager; + + /** + * Array of default tax classes ids + * + * Key is class name + * + * @var int[] + */ + private $taxClasses; + + /** + * Array of default tax rates ids. + * + * Key is rate percentage as string. + * + * @var int[] + */ + private $taxRates; + + /** + * Array of default tax rules ids. + * + * Key is rule code. + * + * @var int[] + */ + private $taxRules; + + /** + * Helps in creating required tax rules. + * + * @var TaxRuleFixtureFactory + */ + private $taxRuleFixtureFactory; + + /** + * @var \Magento\Framework\App\MutableScopeConfig + */ + private $scopeConfig; protected function setUp() { - $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Catalog\Helper\Data' - ); + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->helper = $this->objectManager->get('Magento\Catalog\Helper\Data'); + $this->taxRuleFixtureFactory = new TaxRuleFixtureFactory(); + $this->scopeConfig = $this->objectManager->get('Magento\Framework\App\MutableScopeConfig'); + } + + protected function tearDown() + { + $this->tearDownDefaultRules(); } /** @@ -51,7 +110,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Framework\Registry')->register('current_category', $category); try { - $path = $this->_helper->getBreadcrumbPath(); + $path = $this->helper->getBreadcrumbPath(); $this->assertInternalType('array', $path); $this->assertEquals(array('category3', 'category4', 'category5'), array_keys($path)); $this->assertArrayHasKey('label', $path['category3']); @@ -72,7 +131,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Framework\Registry')->register('current_category', $category); try { - $this->assertSame($category, $this->_helper->getCategory()); + $this->assertSame($category, $this->helper->getCategory()); $objectManager->get('Magento\Framework\Registry')->unregister('current_category'); } catch (\Exception $e) { $objectManager->get('Magento\Framework\Registry')->unregister('current_category'); @@ -89,7 +148,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Framework\Registry')->register('current_product', $product); try { - $this->assertSame($product, $this->_helper->getProduct()); + $this->assertSame($product, $this->helper->getProduct()); $objectManager->get('Magento\Framework\Registry')->unregister('current_product'); } catch (\Exception $e) { $objectManager->get('Magento\Framework\Registry')->unregister('current_product'); @@ -100,17 +159,17 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testSplitSku() { $sku = 'one-two-three'; - $this->assertEquals(array('on', 'e-', 'tw', 'o-', 'th', 're', 'e'), $this->_helper->splitSku($sku, 2)); + $this->assertEquals(array('on', 'e-', 'tw', 'o-', 'th', 're', 'e'), $this->helper->splitSku($sku, 2)); } public function testGetAttributeHiddenFields() { - $this->assertEquals(array(), $this->_helper->getAttributeHiddenFields()); + $this->assertEquals(array(), $this->helper->getAttributeHiddenFields()); /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Framework\Registry')->register('attribute_type_hidden_fields', 'test'); try { - $this->assertEquals('test', $this->_helper->getAttributeHiddenFields()); + $this->assertEquals('test', $this->helper->getAttributeHiddenFields()); $objectManager->get('Magento\Framework\Registry')->unregister('attribute_type_hidden_fields'); } catch (\Exception $e) { $objectManager->get('Magento\Framework\Registry')->unregister('attribute_type_hidden_fields'); @@ -120,8 +179,8 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetPriceScopeDefault() { - // $this->assertEquals(\Magento\Store\Model\Store::PRICE_SCOPE_GLOBAL, $this->_helper->getPriceScope()); - $this->assertNull($this->_helper->getPriceScope()); + // $this->assertEquals(\Magento\Store\Model\Store::PRICE_SCOPE_GLOBAL, $this->helper->getPriceScope()); + $this->assertNull($this->helper->getPriceScope()); } /** @@ -129,12 +188,12 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetPriceScope() { - $this->assertEquals(\Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE, $this->_helper->getPriceScope()); + $this->assertEquals(\Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE, $this->helper->getPriceScope()); } public function testIsPriceGlobalDefault() { - $this->assertTrue($this->_helper->isPriceGlobal()); + $this->assertTrue($this->helper->isPriceGlobal()); } /** @@ -142,12 +201,12 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testIsPriceGlobal() { - $this->assertFalse($this->_helper->isPriceGlobal()); + $this->assertFalse($this->helper->isPriceGlobal()); } public function testShouldSaveUrlRewritesHistoryDefault() { - $this->assertTrue($this->_helper->shouldSaveUrlRewritesHistory()); + $this->assertTrue($this->helper->shouldSaveUrlRewritesHistory()); } /** @@ -155,12 +214,12 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testShouldSaveUrlRewritesHistory() { - $this->assertFalse($this->_helper->shouldSaveUrlRewritesHistory()); + $this->assertFalse($this->helper->shouldSaveUrlRewritesHistory()); } public function testIsUsingStaticUrlsAllowedDefault() { - $this->assertFalse($this->_helper->isUsingStaticUrlsAllowed()); + $this->assertFalse($this->helper->isUsingStaticUrlsAllowed()); } /** @@ -170,18 +229,18 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testIsUsingStaticUrlsAllowed() { - $this->assertTrue($this->_helper->isUsingStaticUrlsAllowed()); - $this->_helper->setStoreId( + $this->assertTrue($this->helper->isUsingStaticUrlsAllowed()); + $this->helper->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ); - $this->assertTrue($this->_helper->isUsingStaticUrlsAllowed()); + $this->assertTrue($this->helper->isUsingStaticUrlsAllowed()); } public function testIsUrlDirectivesParsingAllowedDefault() { - $this->assertTrue($this->_helper->isUrlDirectivesParsingAllowed()); + $this->assertTrue($this->helper->isUrlDirectivesParsingAllowed()); } /** @@ -191,17 +250,280 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testIsUrlDirectivesParsingAllowed() { - $this->assertFalse($this->_helper->isUrlDirectivesParsingAllowed()); - $this->_helper->setStoreId( + $this->assertFalse($this->helper->isUrlDirectivesParsingAllowed()); + $this->helper->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ); - $this->assertFalse($this->_helper->isUrlDirectivesParsingAllowed()); + $this->assertFalse($this->helper->isUrlDirectivesParsingAllowed()); } public function testGetPageTemplateProcessor() { - $this->assertInstanceOf('Magento\Framework\Filter\Template', $this->_helper->getPageTemplateProcessor()); + $this->assertInstanceOf('Magento\Framework\Filter\Template', $this->helper->getPageTemplateProcessor()); + } + + /** + * @param \Magento\Framework\Object $input + * @param float $expectOutputPrice + * @param string[] $configs + * @param string $productClassName + * + * @magentoDataFixture Magento/Catalog/_files/products.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDbIsolation enabled + * @dataProvider getTaxPriceDataProvider + */ + public function testGetTaxPrice( + $input, + $expectOutputPrice, + $configs = [], + $productClassName = 'DefaultProductClass' + ) { + $this->setUpDefaultRules(); + $fixtureProductId = 1; + /** @var \Magento\Catalog\Model\Product $product */ + $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load($fixtureProductId); + $product->setTaxClassId($this->taxClasses[$productClassName]); + $shippingAddress = $this->getCustomerAddress(); + $billingAddress = $shippingAddress; + foreach ($configs as $config) { + $this->scopeConfig->setValue($config['path'], $config['value'], ScopeInterface::SCOPE_STORE, 'default'); + } + + $price = $this->helper->getTaxPrice( + $product, + $input->getPrice(), + $input->getIncludingTax(), + $shippingAddress, + $billingAddress, + $this->taxClasses['DefaultCustomerClass'], + $input->getStore(), + $input->getPriceIncludesTax(), + $input->getRoundPrice() + ); + $this->assertEquals($expectOutputPrice, $price); + } + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function getTaxPriceDataProvider() + { + return [ + 'price is 0' => [ + (new \Magento\Framework\Object())->setPrice(0), + 0 + ], + 'no price conversion, round' => [ + (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + '3.26' + ], + 'no price conversion, no round' => [ + (new \Magento\Framework\Object())->setPrice(3.256), + '3.256' + ], + 'price conversion, display including tax, round' => [ + (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + '3.5', + [ + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + 'value' => '0', + ], + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + 'value' => Config::DISPLAY_TYPE_INCLUDING_TAX, + ], + ] + ], + 'price conversion, display including tax, no round' => [ + (new \Magento\Framework\Object())->setPrice(3.256), + '3.5', // rounding issue: old code expects 3.5002 + [ + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + 'value' => '0', + ], + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + 'value' => Config::DISPLAY_TYPE_INCLUDING_TAX, + ], + ] + ], + 'price conversion, display including tax, high rate product tax class, cross boarder trade, round' => [ + (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + '3.98', // rounding issue: old code expects 3.97 + [ + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + 'value' => '0', + ], + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + 'value' => Config::DISPLAY_TYPE_INCLUDING_TAX, + ], + [ + 'path' => Config::CONFIG_XML_PATH_CROSS_BORDER_TRADE_ENABLED, + 'value' => '1', + ], + ], + 'HigherProductClass', + ], + 'price include tax, display including tax, round' => [ + (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + '3.26', + [ + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + 'value' => '1', + ], + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + 'value' => Config::DISPLAY_TYPE_INCLUDING_TAX, + ], + ] + ], + 'price include tax, display excluding tax, round' => [ + (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + '3.03', + [ + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + 'value' => '1', + ], + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + 'value' => Config::DISPLAY_TYPE_EXCLUDING_TAX, + ], + ] + ], + 'price include tax, display excluding tax, request including tax, round' => [ + (new \Magento\Framework\Object())->setPrice(3.256) + ->setRoundPrice(true) + ->setIncludingTax(true), + '3.26', + [ + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + 'value' => '1', + ], + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + 'value' => Config::DISPLAY_TYPE_EXCLUDING_TAX, + ], + ] + ], + 'price include tax, display excluding tax, high rate product tax class, round' => [ + (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + '2.67', + [ + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + 'value' => '1', + ], + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + 'value' => Config::DISPLAY_TYPE_EXCLUDING_TAX, + ], + ], + 'HigherProductClass', + ], + 'price include tax, display excluding tax, high rate product tax class, cross boarder trade, round' => [ + (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + '2.67', + [ + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + 'value' => '1', + ], + [ + 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + 'value' => Config::DISPLAY_TYPE_EXCLUDING_TAX, + ], + [ + 'path' => Config::CONFIG_XML_PATH_CROSS_BORDER_TRADE_ENABLED, + 'value' => '1', + ], + ], + 'HigherProductClass', + ], + ]; + } + + /** + * Helper function that sets up some default rules + */ + private function setUpDefaultRules() + { + $this->taxClasses = $this->taxRuleFixtureFactory->createTaxClasses([ + ['name' => 'DefaultCustomerClass', 'type' => ClassModel::TAX_CLASS_TYPE_CUSTOMER], + ['name' => 'DefaultProductClass', 'type' => ClassModel::TAX_CLASS_TYPE_PRODUCT], + ['name' => 'HigherProductClass', 'type' => ClassModel::TAX_CLASS_TYPE_PRODUCT], + ]); + + $this->taxRates = $this->taxRuleFixtureFactory->createTaxRates([ + ['percentage' => 7.5, 'country' => 'US', 'region' => 42], + ['percentage' => 7.5, 'country' => 'US', 'region' => 12], // Default store rate + ]); + + $higherRates = $this->taxRuleFixtureFactory->createTaxRates([ + ['percentage' => 22, 'country' => 'US', 'region' => 42], + ['percentage' => 10, 'country' => 'US', 'region' => 12], // Default store rate + ]); + + $this->taxRules = $this->taxRuleFixtureFactory->createTaxRules([ + [ + 'code' => 'Default Rule', + 'customer_tax_class_ids' => [$this->taxClasses['DefaultCustomerClass'], 3], + 'product_tax_class_ids' => [$this->taxClasses['DefaultProductClass']], + 'tax_rate_ids' => array_values($this->taxRates), + 'sort_order' => 0, + 'priority' => 0, + ], + [ + 'code' => 'Higher Rate Rule', + 'customer_tax_class_ids' => [$this->taxClasses['DefaultCustomerClass'], 3], + 'product_tax_class_ids' => [$this->taxClasses['HigherProductClass']], + 'tax_rate_ids' => array_values($higherRates), + 'sort_order' => 0, + 'priority' => 0, + ], + ]); + + // For cleanup + $this->taxRates = array_merge($this->taxRates, $higherRates); + } + + /** + * Get fixture customer address + * + * @return \Magento\Customer\Model\Address + */ + private function getCustomerAddress() + { + $fixtureCustomerId = 1; + $customerAddress = $this->objectManager->create('Magento\Customer\Model\Address')->load($fixtureCustomerId); + /** Set data which corresponds tax class fixture */ + $customerAddress->setCountryId('US')->setRegionId(42)->save(); + return $customerAddress; + } + + /** + * Helper function that tears down some default rules + */ + private function tearDownDefaultRules() + { + if ($this->taxRules) { + $this->taxRuleFixtureFactory->deleteTaxRules(array_values($this->taxRules)); + } + if ($this->taxRates) { + $this->taxRuleFixtureFactory->deleteTaxRates(array_values($this->taxRates)); + } + if ($this->taxClasses) { + $this->taxRuleFixtureFactory->deleteTaxClasses(array_values($this->taxClasses)); + } } } diff --git a/dev/tests/integration/testsuite/Magento/Tax/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Tax/Helper/DataTest.php index bafb54e5c3c..a60008ed37d 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Helper/DataTest.php @@ -23,11 +23,6 @@ */ namespace Magento\Tax\Helper; -use Magento\Tax\Model\ClassModel; -use Magento\Tax\Service\V1\TaxRuleFixtureFactory; -use Magento\Store\Model\ScopeInterface; -use Magento\Tax\Model\Config; - class DataTest extends \PHPUnit_Framework_TestCase { /** @@ -44,55 +39,11 @@ class DataTest extends \PHPUnit_Framework_TestCase */ private $objectManager; - /** - * Array of default tax classes ids - * - * Key is class name - * - * @var int[] - */ - private $taxClasses; - - /** - * Array of default tax rates ids. - * - * Key is rate percentage as string. - * - * @var int[] - */ - private $taxRates; - - /** - * Array of default tax rules ids. - * - * Key is rule code. - * - * @var int[] - */ - private $taxRules; - - /** - * Helps in creating required tax rules. - * - * @var TaxRuleFixtureFactory - */ - private $taxRuleFixtureFactory; - - /** @var \Magento\Framework\App\MutableScopeConfig */ - private $scopeConfig; - public function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $helper \Magento\Tax\Helper\Data */ $this->helper = $this->objectManager->get('Magento\Tax\Helper\Data'); - $this->taxRuleFixtureFactory = new TaxRuleFixtureFactory(); - $this->scopeConfig = $this->objectManager->get('Magento\Framework\App\MutableScopeConfig'); - } - - protected function tearDown() - { - $this->tearDownDefaultRules(); } /** @@ -110,263 +61,4 @@ class DataTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(1, $this->helper->getDefaultProductTaxClass()); } - - /** - * @param \Magento\Framework\Object $input - * @param float $expectOutputPrice - * @param string[] $configs - * @param string $productClassName - * - * @magentoDataFixture Magento/Catalog/_files/products.php - * @magentoDataFixture Magento/Customer/_files/customer.php - * @magentoDataFixture Magento/Customer/_files/customer_address.php - * @magentoDbIsolation enabled - * @dataProvider getPriceDataProvider - */ - public function testGetPrice($input, $expectOutputPrice, $configs = [], $productClassName = 'DefaultProductClass') - { - $this->setUpDefaultRules(); - $fixtureProductId = 1; - /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load($fixtureProductId); - $product->setTaxClassId($this->taxClasses[$productClassName]); - $shippingAddress = $this->getCustomerAddress(); - $billingAddress = $shippingAddress; - foreach ($configs as $config) { - $this->scopeConfig->setValue($config['path'], $config['value'], ScopeInterface::SCOPE_STORE, 'default'); - } - - $price = $this->helper->getPrice( - $product, - $input->getPrice(), - $input->getIncludingTax(), - $shippingAddress, - $billingAddress, - $this->taxClasses['DefaultCustomerClass'], - $input->getStore(), - $input->getPriceIncludesTax(), - $input->getRoundPrice() - ); - $this->assertEquals($expectOutputPrice, $price); - } - - /** - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function getPriceDataProvider() - { - return [ - 'price is 0' => [ - (new \Magento\Framework\Object())->setPrice(0), - 0 - ], - 'no price conversion, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), - '3.26' - ], - 'no price conversion, no round' => [ - (new \Magento\Framework\Object())->setPrice(3.256), - '3.256' - ], - 'price conversion, display including tax, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), - '3.5', - [ - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, - 'value' => '0', - ], - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, - 'value' => Config::DISPLAY_TYPE_INCLUDING_TAX, - ], - ] - ], - 'price conversion, display including tax, no round' => [ - (new \Magento\Framework\Object())->setPrice(3.256), - '3.5', // rounding issue: old code expects 3.5002 - [ - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, - 'value' => '0', - ], - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, - 'value' => Config::DISPLAY_TYPE_INCLUDING_TAX, - ], - ] - ], - 'price conversion, display including tax, high rate product tax class, cross boarder trade, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), - '3.98', // rounding issue: old code expects 3.97 - [ - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, - 'value' => '0', - ], - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, - 'value' => Config::DISPLAY_TYPE_INCLUDING_TAX, - ], - [ - 'path' => Config::CONFIG_XML_PATH_CROSS_BORDER_TRADE_ENABLED, - 'value' => '1', - ], - ], - 'HigherProductClass', - ], - 'price include tax, display including tax, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), - '3.26', - [ - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, - 'value' => '1', - ], - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, - 'value' => Config::DISPLAY_TYPE_INCLUDING_TAX, - ], - ] - ], - 'price include tax, display excluding tax, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), - '3.03', - [ - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, - 'value' => '1', - ], - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, - 'value' => Config::DISPLAY_TYPE_EXCLUDING_TAX, - ], - ] - ], - 'price include tax, display excluding tax, request including tax, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256) - ->setRoundPrice(true) - ->setIncludingTax(true), - '3.26', - [ - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, - 'value' => '1', - ], - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, - 'value' => Config::DISPLAY_TYPE_EXCLUDING_TAX, - ], - ] - ], - 'price include tax, display excluding tax, high rate product tax class, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), - '2.67', - [ - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, - 'value' => '1', - ], - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, - 'value' => Config::DISPLAY_TYPE_EXCLUDING_TAX, - ], - ], - 'HigherProductClass', - ], - 'price include tax, display excluding tax, high rate product tax class, cross boarder trade, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), - '2.67', - [ - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, - 'value' => '1', - ], - [ - 'path' => Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, - 'value' => Config::DISPLAY_TYPE_EXCLUDING_TAX, - ], - [ - 'path' => Config::CONFIG_XML_PATH_CROSS_BORDER_TRADE_ENABLED, - 'value' => '1', - ], - ], - 'HigherProductClass', - ], - ]; - } - - /** - * Helper function that sets up some default rules - */ - private function setUpDefaultRules() - { - $this->taxClasses = $this->taxRuleFixtureFactory->createTaxClasses([ - ['name' => 'DefaultCustomerClass', 'type' => ClassModel::TAX_CLASS_TYPE_CUSTOMER], - ['name' => 'DefaultProductClass', 'type' => ClassModel::TAX_CLASS_TYPE_PRODUCT], - ['name' => 'HigherProductClass', 'type' => ClassModel::TAX_CLASS_TYPE_PRODUCT], - ]); - - $this->taxRates = $this->taxRuleFixtureFactory->createTaxRates([ - ['percentage' => 7.5, 'country' => 'US', 'region' => 42], - ['percentage' => 7.5, 'country' => 'US', 'region' => 12], // Default store rate - ]); - - $higherRates = $this->taxRuleFixtureFactory->createTaxRates([ - ['percentage' => 22, 'country' => 'US', 'region' => 42], - ['percentage' => 10, 'country' => 'US', 'region' => 12], // Default store rate - ]); - - $this->taxRules = $this->taxRuleFixtureFactory->createTaxRules([ - [ - 'code' => 'Default Rule', - 'customer_tax_class_ids' => [$this->taxClasses['DefaultCustomerClass'], 3], - 'product_tax_class_ids' => [$this->taxClasses['DefaultProductClass']], - 'tax_rate_ids' => array_values($this->taxRates), - 'sort_order' => 0, - 'priority' => 0, - ], - [ - 'code' => 'Higher Rate Rule', - 'customer_tax_class_ids' => [$this->taxClasses['DefaultCustomerClass'], 3], - 'product_tax_class_ids' => [$this->taxClasses['HigherProductClass']], - 'tax_rate_ids' => array_values($higherRates), - 'sort_order' => 0, - 'priority' => 0, - ], - ]); - - // For cleanup - $this->taxRates = array_merge($this->taxRates, $higherRates); - } - - /** - * Helper function that tears down some default rules - */ - private function tearDownDefaultRules() - { - if ($this->taxRules) { - $this->taxRuleFixtureFactory->deleteTaxRules(array_values($this->taxRules)); - } - if ($this->taxRates) { - $this->taxRuleFixtureFactory->deleteTaxRates(array_values($this->taxRates)); - } - if ($this->taxClasses) { - $this->taxRuleFixtureFactory->deleteTaxClasses(array_values($this->taxClasses)); - } - } - - /** - * Get fixture customer address - * - * @return \Magento\Customer\Model\Address - */ - private function getCustomerAddress() - { - $fixtureCustomerId = 1; - $customerAddress = $this->objectManager->create('Magento\Customer\Model\Address')->load($fixtureCustomerId); - /** Set data which corresponds tax class fixture */ - $customerAddress->setCountryId('US')->setRegionId(42)->save(); - return $customerAddress; - } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php index b81f07eba90..c2d49fb844e 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php @@ -127,6 +127,8 @@ class StaticFilesTest extends \PHPUnit_Framework_TestCase return 'Magento/backend'; case 'install': return 'Magento/basic'; + case 'doc': + return 'Magento/blank'; default: throw new \LogicException('Unable to determine theme path'); } diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php index ce0c856e232..f61c085906b 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php @@ -32,7 +32,7 @@ class AuthTest extends \Magento\Backend\Utility\Controller { /** * Test form existence - * @covers \Magento\User\Controller\Adminhtml\Auth::forgotpasswordAction + * @covers \Magento\User\Controller\Adminhtml\Auth\Forgotpassword::execute */ public function testFormForgotpasswordAction() { @@ -44,7 +44,7 @@ class AuthTest extends \Magento\Backend\Utility\Controller /** * Test redirection to startup page after success password recovering posting * - * @covers \Magento\User\Controller\Adminhtml\Auth::forgotpasswordAction + * @covers \Magento\User\Controller\Adminhtml\Auth\Forgotpassword::execute */ public function testForgotpasswordAction() { @@ -62,8 +62,7 @@ class AuthTest extends \Magento\Backend\Utility\Controller /** * Test reset password action * - * @covers \Magento\User\Controller\Adminhtml\Auth::resetPasswordAction - * @covers \Magento\User\Controller\Adminhtml\Auth::_validateResetPasswordLinkToken + * @covers \Magento\User\Controller\Adminhtml\Auth\ResetPassword::execute * @magentoDataFixture Magento/User/_files/dummy_user.php */ public function testResetPasswordAction() @@ -91,8 +90,7 @@ class AuthTest extends \Magento\Backend\Utility\Controller } /** - * @covers \Magento\User\Controller\Adminhtml\Auth::resetPasswordAction - * @covers \Magento\User\Controller\Adminhtml\Auth::_validateResetPasswordLinkToken + * @covers \Magento\User\Controller\Adminhtml\Auth\ResetPassword::execute */ public function testResetPasswordActionWithDummyToken() { @@ -107,8 +105,7 @@ class AuthTest extends \Magento\Backend\Utility\Controller /** * @dataProvider resetPasswordDataProvider - * @covers \Magento\User\Controller\Adminhtml\Auth::resetPasswordPostAction - * @covers \Magento\User\Controller\Adminhtml\Auth::_validateResetPasswordLinkToken + * @covers \Magento\User\Controller\Adminhtml\Auth\ResetPassword::execute * @magentoDataFixture Magento/User/_files/dummy_user.php */ public function testResetPasswordPostAction($password, $passwordConfirmation, $isPasswordChanged) @@ -180,8 +177,7 @@ class AuthTest extends \Magento\Backend\Utility\Controller } /** - * @covers \Magento\User\Controller\Adminhtml\Auth::resetPasswordPostAction - * @covers \Magento\User\Controller\Adminhtml\Auth::_validateResetPasswordLinkToken + * @covers \Magento\User\Controller\Adminhtml\Auth\ResetPassword::execute * @magentoDataFixture Magento/User/_files/dummy_user.php */ public function testResetPasswordPostActionWithDummyToken() @@ -202,8 +198,7 @@ class AuthTest extends \Magento\Backend\Utility\Controller } /** - * @covers \Magento\User\Controller\Adminhtml\Auth::resetPasswordPostAction - * @covers \Magento\User\Controller\Adminhtml\Auth::_validateResetPasswordLinkToken + * @covers \Magento\User\Controller\Adminhtml\Auth\ResetPassword::execute * @magentoDataFixture Magento/User/_files/dummy_user.php */ public function testResetPasswordPostActionWithInvalidPassword() diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/RoleTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/RoleTest.php index f6f57d4d4ba..b2ec0cea90a 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/RoleTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/RoleTest.php @@ -45,7 +45,7 @@ class RoleTest extends \Magento\Backend\Utility\Controller } /** - * @covers \Magento\User\Controller\Adminhtml\User\Role::editrolegridAction + * @covers \Magento\User\Controller\Adminhtml\User\Role\Editrolegrid::execute */ public function testEditrolegridAction() { @@ -56,7 +56,7 @@ class RoleTest extends \Magento\Backend\Utility\Controller } /** - * @covers \Magento\User\Controller\Adminhtml\User\Role::roleGridAction + * @covers \Magento\User\Controller\Adminhtml\User\Role\RoleGrid::execute */ public function testRoleGridAction() { diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php index dc15afc0a12..16b3a626b3f 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php @@ -53,7 +53,7 @@ class PriceTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $taxHelperMock; + protected $catalogHelperMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -78,7 +78,7 @@ class PriceTest extends \PHPUnit_Framework_TestCase $this->localeDateMock = $this->getMock('\Magento\Framework\Stdlib\DateTime\TimezoneInterface'); $this->customerSessionMock = $this->getMock('\Magento\Customer\Model\Session', array(), array(), '', false); $this->eventManagerMock = $this->getMock('\Magento\Framework\Event\ManagerInterface'); - $this->taxHelperMock = $this->getMock('\Magento\Tax\Helper\Data', array(), array(), '', false); + $this->catalogHelperMock = $this->getMock('\Magento\Catalog\Helper\Data', array(), array(), '', false); $this->storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->model = new \Magento\Bundle\Model\Product\Price( @@ -87,7 +87,7 @@ class PriceTest extends \PHPUnit_Framework_TestCase $this->localeDateMock, $this->customerSessionMock, $this->eventManagerMock, - $this->taxHelperMock + $this->catalogHelperMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php new file mode 100644 index 00000000000..c144c696fd8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php @@ -0,0 +1,258 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute; + +/** + * @SuppressWarnings(PHPMD.TooManyFields) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class SaveTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute\Save */ + protected $object; + /** @var \Magento\Catalog\Helper\Product\Edit\Action\Attribute|\PHPUnit_Framework_MockObject_MockObject */ + protected $attributeHelper; + /** @var \Magento\CatalogInventory\Service\V1\Data\StockItemBuilder|\PHPUnit_Framework_MockObject_MockObject */ + protected $stockItemBuilder; + /** @var \Magento\CatalogInventory\Model\Indexer\Stock\Processor|\PHPUnit_Framework_MockObject_MockObject */ + protected $stockIndexerProcessor; + + /** @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject */ + protected $context; + /** @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $request; + /** @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject */ + protected $response; + /** @var \Magento\Framework\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ + protected $objectManager; + /** @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $eventManager; + /** @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $url; + /** @var \Magento\Framework\App\Response\RedirectInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $redirect; + /** @var \Magento\Framework\App\ActionFlag|\PHPUnit_Framework_MockObject_MockObject */ + protected $actionFlag; + /** @var \Magento\Framework\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $view; + /** @var \Magento\Framework\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $messageManager; + /** @var \Magento\Backend\Model\Session|\PHPUnit_Framework_MockObject_MockObject */ + protected $session; + /** @var \Magento\Framework\AuthorizationInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $authorization; + /** @var \Magento\Backend\Model\Auth|\PHPUnit_Framework_MockObject_MockObject */ + protected $auth; + /** @var \Magento\Backend\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ + protected $helper; + /** @var \Magento\Backend\Model\UrlInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $backendUrl; + /** @var \Magento\Core\App\Action\FormKeyValidator|\PHPUnit_Framework_MockObject_MockObject */ + protected $formKeyValidator; + /** @var \Magento\Framework\App\Action\Title|\PHPUnit_Framework_MockObject_MockObject */ + protected $title; + /** @var \Magento\Framework\Locale\ResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $localeResolver; + + /** @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ + protected $product; + /** @var \Magento\CatalogInventory\Service\V1\StockItemService|\PHPUnit_Framework_MockObject_MockObject */ + protected $stockItemService; + /** @var \Magento\CatalogInventory\Service\V1\Data\StockItem|\PHPUnit_Framework_MockObject_MockObject */ + protected $stockItem; + /** @var \Magento\CatalogInventory\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ + protected $inventoryHelper; + + protected function setUp() + { + $this->prepareContext(); + + $this->attributeHelper = $this->getMock( + 'Magento\Catalog\Helper\Product\Edit\Action\Attribute', + ['getProductIds', 'getSelectedStoreId'], + [], + '', + false + ); + + $this->stockItemBuilder = $this->getMock( + 'Magento\CatalogInventory\Service\V1\Data\StockItemBuilder', + ['mergeDataObjectWithArray'], + [], + '', + false + ); + + $this->stockIndexerProcessor = $this->getMock( + 'Magento\CatalogInventory\Model\Indexer\Stock\Processor', + ['reindexList'], + [], + '', + false + ); + + $this->object = (new \Magento\TestFramework\Helper\ObjectManager($this))->getObject( + 'Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute\Save', + [ + 'context' => $this->context, + 'attributeHelper' => $this->attributeHelper, + 'stockIndexerProcessor' => $this->stockIndexerProcessor, + 'stockItemBuilder' => $this->stockItemBuilder, + ] + ); + + } + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + protected function prepareContext() + { + $this->request = $this->getMock( + 'Magento\Framework\App\RequestInterface', + ['getParam', 'getModuleName', 'setModuleName', 'getActionName', 'setActionName'], + [], + '', + false + ); + $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false); + $this->objectManager = $this->getMock( + 'Magento\Framework\ObjectManager', + ['configure', 'create', 'get'], + [], + '', + false + ); + $this->eventManager = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false); + $this->url = $this->getMock('Magento\Framework\UrlInterface', [], [], '', false); + $this->redirect = $this->getMock('Magento\Framework\App\Response\RedirectInterface', [], [], '', false); + $this->actionFlag = $this->getMock('Magento\Framework\App\ActionFlag', [], [], '', false); + $this->view = $this->getMock('Magento\Framework\App\ViewInterface', [], [], '', false); + $this->messageManager = $this->getMock('Magento\Framework\Message\ManagerInterface', [], [], '', false); + $this->session = $this->getMock('Magento\Backend\Model\Session', [], [], '', false); + $this->authorization = $this->getMock('Magento\Framework\AuthorizationInterface', [], [], '', false); + $this->auth = $this->getMock('Magento\Backend\Model\Auth', [], [], '', false); + $this->helper = $this->getMock('Magento\Backend\Helper\Data', [], [], '', false); + $this->backendUrl = $this->getMock('Magento\Backend\Model\UrlInterface', [], [], '', false); + $this->formKeyValidator = $this->getMock('Magento\Core\App\Action\FormKeyValidator', [], [], '', false); + $this->title = $this->getMock('Magento\Framework\App\Action\Title', [], [], '', false); + $this->localeResolver = $this->getMock('Magento\Framework\Locale\ResolverInterface', [], [], '', false); + + $this->context = $this->context = $this->getMock( + 'Magento\Backend\App\Action\Context', + [ + 'getRequest', + 'getResponse', + 'getObjectManager', + 'getEventManager', + 'getUrl', + 'getRedirect', + 'getActionFlag', + 'getView', + 'getMessageManager', + 'getSession', + 'getAuthorization', + 'getAuth', + 'getHelper', + 'getBackendUrl', + 'getFormKeyValidator', + 'getTitle', + 'getLocaleResolver', + ], + [], + '', + false + ); + $this->context->expects($this->any())->method('getRequest')->will($this->returnValue($this->request)); + $this->context->expects($this->any())->method('getResponse')->will($this->returnValue($this->response)); + $this->context->expects($this->any())->method('getObjectManager') + ->will($this->returnValue($this->objectManager)); + $this->context->expects($this->any())->method('getEventManager')->will($this->returnValue($this->eventManager)); + $this->context->expects($this->any())->method('getUrl')->will($this->returnValue($this->url)); + $this->context->expects($this->any())->method('getRedirect')->will($this->returnValue($this->redirect)); + $this->context->expects($this->any())->method('getActionFlag')->will($this->returnValue($this->actionFlag)); + $this->context->expects($this->any())->method('getView')->will($this->returnValue($this->view)); + $this->context->expects($this->any())->method('getMessageManager') + ->will($this->returnValue($this->messageManager)); + $this->context->expects($this->any())->method('getSession')->will($this->returnValue($this->session)); + $this->context->expects($this->any())->method('getAuthorization') + ->will($this->returnValue($this->authorization)); + $this->context->expects($this->any())->method('getAuth')->will($this->returnValue($this->auth)); + $this->context->expects($this->any())->method('getHelper')->will($this->returnValue($this->helper)); + $this->context->expects($this->any())->method('getBackendUrl')->will($this->returnValue($this->backendUrl)); + $this->context->expects($this->any())->method('getFormKeyValidator') + ->will($this->returnValue($this->formKeyValidator)); + $this->context->expects($this->any())->method('getTitle')->will($this->returnValue($this->title)); + $this->context->expects($this->any())->method('getLocaleResolver') + ->will($this->returnValue($this->localeResolver)); + + $this->product = $this->getMock( + 'Magento\Catalog\Model\Product', + ['isProductsHasSku', '__wakeup'], + [], + '', + false + ); + $this->stockItemService = $this->getMock( + 'Magento\CatalogInventory\Service\V1\StockItemService', + ['getStockItem', 'saveStockItem'], + [], + '', + false + ); + $this->stockItem = $this->getMock('Magento\CatalogInventory\Service\V1\Data\StockItem', [], [], '', false); + $this->inventoryHelper + = $this->getMock('Magento\CatalogInventory\Helper\Data', ['getConfigItemOptions'], [], '', false); + + $this->objectManager->expects($this->any())->method('create')->will($this->returnValueMap([ + ['Magento\Catalog\Model\Product', [], $this->product], + ['Magento\CatalogInventory\Service\V1\StockItemService', [], $this->stockItemService], + ])); + + $this->objectManager->expects($this->any())->method('get')->will($this->returnValueMap([ + ['Magento\CatalogInventory\Helper\Data', $this->inventoryHelper], + ])); + } + + public function testExecuteThatProductIdsAreObtainedFromAttributeHelper() + { + $this->attributeHelper->expects($this->any())->method('getProductIds')->will($this->returnValue([5])); + $this->attributeHelper->expects($this->any())->method('getSelectedStoreId')->will($this->returnValue([1])); + $this->inventoryHelper->expects($this->any())->method('getConfigItemOptions')->will($this->returnValue([])); + $this->product->expects($this->any())->method('isProductsHasSku')->with([5])->will($this->returnValue(true)); + $this->stockItemService->expects($this->any())->method('getStockItem')->with(5) + ->will($this->returnValue($this->stockItem)); + $this->stockIndexerProcessor->expects($this->any())->method('reindexList')->with([5]); + + $this->request->expects($this->any())->method('getParam')->will($this->returnValueMap([ + ['inventory', [], [7]] + ])); + + $this->messageManager->expects($this->never())->method('addError'); + $this->messageManager->expects($this->never())->method('addException'); + + $this->object->execute(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/ShippingTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/ShippingTest.php new file mode 100644 index 00000000000..d8691787acb --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/ShippingTest.php @@ -0,0 +1,85 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Cart; + +class ShippingTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\TestFramework\Helper\ObjectManager */ + protected $objectManager; + + protected $shippingBlock; + + protected function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + } + + public function testGetShippingPriceHtml() + { + $shippingRateMock = $this->getMockBuilder('\Magento\Sales\Model\Quote\Address\Rate') + ->disableOriginalConstructor() + ->getMock(); + + $shippingPriceHtml = "$3.25 ($3.56 Incl Tax)"; + + $priceBlockMock = $this->getMockBuilder('\Magento\Checkout\Block\Shipping\Price') + ->disableOriginalConstructor() + ->setMethods(['setShippingRate', 'toHtml']) + ->getMock(); + + $priceBlockMock->expects($this->once()) + ->method('setShippingRate') + ->with($shippingRateMock); + + $priceBlockMock->expects($this->once()) + ->method('toHtml') + ->will($this->returnValue($shippingPriceHtml)); + + $layoutMock = $this->getMockBuilder('\Magento\Framework\View\Layout') + ->disableOriginalConstructor() + ->getMock(); + + $layoutMock->expects($this->once()) + ->method('getBlock') + ->with('checkout.shipping.price') + ->will($this->returnValue($priceBlockMock)); + + $contextMock = $this->getMockBuilder('\Magento\Framework\View\Element\Template\Context') + ->disableOriginalConstructor() + ->setMethods(['getLayout']) + ->getMock(); + + $contextMock->expects($this->once()) + ->method('getLayout') + ->will($this->returnValue($layoutMock)); + + /** @var \Magento\Checkout\Block\Cart\Shipping $shippingBlock */ + $shippingBlock = $this->objectManager->getObject( + '\Magento\Checkout\Block\Cart\Shipping', + ['context' => $contextMock] + ); + + $this->assertEquals($shippingPriceHtml, $shippingBlock->getShippingPriceHtml($shippingRateMock)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Sidebar/TotalsTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Sidebar/TotalsTest.php new file mode 100644 index 00000000000..a0965a93edd --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Sidebar/TotalsTest.php @@ -0,0 +1,87 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Cart\Sidebar; + +use Magento\Framework\Object; + +class TotalsTest extends \PHPUnit_Framework_TestCase +{ + const SUBTOTAL = 10; + + /** + * @var \Magento\Checkout\Block\Cart\Sidebar\Totals + */ + protected $totalsObj; + + /** + * @var \Magento\Sales\Model\Quote|\PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + protected function setUp() + { + parent::setUp(); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->quote = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->setMethods(['getTotals', '__wakeup']) + ->getMock(); + + $checkoutSession = $this->getMockBuilder('\Magento\Checkout\Model\Session') + ->disableOriginalConstructor() + ->setMethods(['getQuote', '__wakeup']) + ->getMock(); + + $checkoutSession->expects($this->once()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + + $this->totalsObj = $objectManager->getObject( + '\Magento\Checkout\Block\Cart\Sidebar\Totals', + ['checkoutSession' => $checkoutSession] + ); + } + + public function testGetSubtotal() + { + $subtotal = new Object(['value' => self::SUBTOTAL]); + $totals = ['subtotal' => $subtotal]; + $this->quote->expects($this->once()) + ->method('getTotals') + ->will($this->returnValue($totals)); + + $this->assertEquals(self::SUBTOTAL, $this->totalsObj->getSubtotal()); + } + + public function testGetSubtotalZero() + { + $totals = []; + $this->quote->expects($this->once()) + ->method('getTotals') + ->will($this->returnValue($totals)); + + $this->assertEquals(0, $this->totalsObj->getSubtotal()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php index 7f3b690b39a..8f5c374ee0f 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php @@ -129,4 +129,43 @@ class SidebarTest extends \PHPUnit_Framework_TestCase $block->setData('custom_quote', $quote); $this->assertEquals($product->getIdentities(), $block->getIdentities()); } + + public function testGetTotalsHtml() + { + $totalsHtml = "$134.36"; + $totalsBlockMock = $this->getMockBuilder('\Magento\Checkout\Block\Shipping\Price') + ->disableOriginalConstructor() + ->setMethods(['toHtml']) + ->getMock(); + + $totalsBlockMock->expects($this->once()) + ->method('toHtml') + ->will($this->returnValue($totalsHtml)); + + $layoutMock = $this->getMockBuilder('\Magento\Framework\View\Layout') + ->disableOriginalConstructor() + ->getMock(); + + $layoutMock->expects($this->once()) + ->method('getBlock') + ->with('checkout.cart.minicart.totals') + ->will($this->returnValue($totalsBlockMock)); + + $contextMock = $this->getMockBuilder('\Magento\Framework\View\Element\Template\Context') + ->disableOriginalConstructor() + ->setMethods(['getLayout']) + ->getMock(); + + $contextMock->expects($this->once()) + ->method('getLayout') + ->will($this->returnValue($layoutMock)); + + /** @var \Magento\Checkout\Block\Cart\SideBar $sidebarBlock */ + $sidebarBlock = $this->_objectManager->getObject( + '\Magento\Checkout\Block\Cart\SideBar', + ['context' => $contextMock] + ); + + $this->assertEquals($totalsHtml, $sidebarBlock->getTotalsHtml()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Item/Price/RendererTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Item/Price/RendererTest.php new file mode 100644 index 00000000000..59a461d7081 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Item/Price/RendererTest.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Item\Price; + +use Magento\Checkout\Block\Item\Price\Renderer; + +class RendererTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Renderer + */ + protected $renderer; + + protected function setUp() + { + $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->renderer = $objectManagerHelper->getObject( + 'Magento\Checkout\Block\Item\Price\Renderer' + ); + } + + public function testSetItem() + { + $item = $this->getMockBuilder('Magento\Sales\Model\Quote\Item\AbstractItem') + ->disableOriginalConstructor() + ->getMock(); + + $this->renderer->setItem($item); + $this->assertEquals($item, $this->renderer->getItem()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/AbstractOnepageTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/AbstractOnepageTest.php new file mode 100644 index 00000000000..57d9eea9583 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/AbstractOnepageTest.php @@ -0,0 +1,85 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Onepage; + +class AbstractOnepageTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\TestFramework\Helper\ObjectManager */ + protected $objectManager; + + protected $shippingBlock; + + protected function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + } + + public function testGetShippingPriceHtml() + { + $shippingRateMock = $this->getMockBuilder('\Magento\Sales\Model\Quote\Address\Rate') + ->disableOriginalConstructor() + ->getMock(); + + $shippingPriceHtml = "$3.25 ($3.56 Incl Tax)"; + + $priceBlockMock = $this->getMockBuilder('\Magento\Checkout\Block\Shipping\Price') + ->disableOriginalConstructor() + ->setMethods(['setShippingRate', 'toHtml']) + ->getMock(); + + $priceBlockMock->expects($this->once()) + ->method('setShippingRate') + ->with($shippingRateMock); + + $priceBlockMock->expects($this->once()) + ->method('toHtml') + ->will($this->returnValue($shippingPriceHtml)); + + $layoutMock = $this->getMockBuilder('\Magento\Framework\View\Layout') + ->disableOriginalConstructor() + ->getMock(); + + $layoutMock->expects($this->once()) + ->method('getBlock') + ->with('checkout.shipping.price') + ->will($this->returnValue($priceBlockMock)); + + $contextMock = $this->getMockBuilder('\Magento\Framework\View\Element\Template\Context') + ->disableOriginalConstructor() + ->setMethods(['getLayout']) + ->getMock(); + + $contextMock->expects($this->once()) + ->method('getLayout') + ->will($this->returnValue($layoutMock)); + + /** @var \Magento\Checkout\Block\Onepage\AbstractOnepage $onepage */ + $onepage = $this->objectManager->getObject( + '\Magento\Checkout\Block\Cart\Shipping', + ['context' => $contextMock] + ); + + $this->assertEquals($shippingPriceHtml, $onepage->getShippingPriceHtml($shippingRateMock)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/ProgressTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/ProgressTest.php index 07d4674b5b1..ca4d602ff0e 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/ProgressTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/ProgressTest.php @@ -98,37 +98,17 @@ class ProgressTest extends \PHPUnit_Framework_TestCase } /** - * @param bool $inclTax + * Test getShippingRate method */ - private function _prepareTestGetShippingPrice($inclTax) + public function testGetShippingRate() { $rate = $this->getMock('Magento\Sales\Model\Quote\Address\Rate', ['__wakeup'], [], '', false); - $rate->setPrice(self::SHIPPING_PRICE); $this->shippingAddress->setShippingMethod(self::SHIPPING_METHOD); $this->shippingAddress->expects($this->once()) ->method('getShippingRateByCode') ->with(self::SHIPPING_METHOD) ->will($this->returnValue($rate)); - $this->taxHelper->expects($this->once()) - ->method('getShippingPrice') - ->with(self::SHIPPING_PRICE, $inclTax ? $this->isTrue() : $this->isFalse(), $this->shippingAddress) - ->will($this->returnValue(self::SHIPPING_PRICE_WITH_TAX)); - $this->store->expects($this->once()) - ->method('formatPrice') - ->with(self::SHIPPING_PRICE_WITH_TAX) - ->will($this->returnValue(self::SHIPPING_PRICE_FORMATTED)); - } - - public function testGetShippingPriceInclTax() - { - $this->_prepareTestGetShippingPrice(true); - $this->assertEquals(self::SHIPPING_PRICE_FORMATTED, $this->model->getShippingPriceInclTax()); - } - - public function testGetShippingPriceExclTax() - { - $this->_prepareTestGetShippingPrice(false); - $this->assertEquals(self::SHIPPING_PRICE_FORMATTED, $this->model->getShippingPriceExclTax()); + $this->assertEquals($rate, $this->model->getShippingRate()); } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Shipping/PriceTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Shipping/PriceTest.php new file mode 100644 index 00000000000..f94db86a1ae --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Shipping/PriceTest.php @@ -0,0 +1,101 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Shipping; + +use Magento\Framework\Object; + +class PriceTest extends \PHPUnit_Framework_TestCase +{ + const SUBTOTAL = 10; + + /** + * @var \Magento\Checkout\Block\Shipping\Price + */ + protected $priceObj; + + /** + * @var \Magento\Sales\Model\Quote|\PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + /** + * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject + */ + protected $store; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->store = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['convertPrice', '__wakeup']) + ->getMock(); + + $this->quote = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->setMethods(['getStore', '__wakeup']) + ->getMock(); + + $this->quote->expects($this->once()) + ->method('getStore') + ->will($this->returnValue($this->store)); + + $checkoutSession = $this->getMockBuilder('\Magento\Checkout\Model\Session') + ->disableOriginalConstructor() + ->setMethods(['getQuote', '__wakeup']) + ->getMock(); + + $checkoutSession->expects($this->once()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + + $this->priceObj = $objectManager->getObject( + '\Magento\Checkout\Block\Shipping\Price', + ['checkoutSession' => $checkoutSession] + ); + } + + public function testGetShippingPrice() + { + $shippingPrice = 5; + $convertedPrice = "$5"; + + $shippingRateMock = $this->getMockBuilder('\Magento\Sales\Model\Quote\Address\Rate') + ->disableOriginalConstructor() + ->setMethods(['getPrice', '__wakeup']) + ->getMock(); + $shippingRateMock->expects($this->once()) + ->method('getPrice') + ->will($this->returnValue($shippingPrice)); + + $this->store->expects($this->once()) + ->method('convertPrice') + ->with($shippingPrice, true, true) + ->will($this->returnValue($convertedPrice)); + + $this->priceObj->setShippingRate($shippingRateMock); + $this->assertEquals($convertedPrice, $this->priceObj->getShippingPrice()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php index a2c29e03ce8..d9b847c6c4b 100644 --- a/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php @@ -196,7 +196,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase '', false ); - $taxData = $this->getMock('Magento\Tax\Helper\Data', [], [], '', false); + $catalogData = $this->getMock('Magento\Catalog\Helper\Data', [], [], '', false); $utility = $this->getMock('Magento\SalesRule\Model\Utility', [], [], '', false); /** @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject $validator */ @@ -207,7 +207,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase 'context' => $context, 'registry' => $registry, 'collectionFactory' => $collectionFactory, - 'taxData' => $taxData, + 'catalogData' => $catalogData, 'utility' => $utility, 'rulesApplier' => $rulesApplier ], diff --git a/dev/tests/unit/testsuite/Magento/Tax/Block/Checkout/Cart/Sidebar/TotalsTest.php b/dev/tests/unit/testsuite/Magento/Tax/Block/Checkout/Cart/Sidebar/TotalsTest.php new file mode 100644 index 00000000000..231fae9eb1f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Tax/Block/Checkout/Cart/Sidebar/TotalsTest.php @@ -0,0 +1,220 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Block\Checkout\Cart\Sidebar; + +use Magento\Framework\Object; + +class TotalsTest extends \PHPUnit_Framework_TestCase +{ + const SUBTOTAL_EXCL_TAX = 9.8; + const SUBTOTAL_INCL_TAX = 10.3; + const SUBTOTAL = 10; + + /** + * @var \Magento\Tax\Block\Checkout\Cart\Sidebar\Totals + */ + protected $totalsObj; + + /** + * @var \Magento\Sales\Model\Quote|\PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + /** + * @var \Magento\Tax\Model\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $taxConfig; + + /** + * @var \Magento\Tax\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $taxHelper; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->quote = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->setMethods(['getTotals', '__wakeup']) + ->getMock(); + + $checkoutSession = $this->getMockBuilder('\Magento\Checkout\Model\Session') + ->disableOriginalConstructor() + ->setMethods(['getQuote', '__wakeup']) + ->getMock(); + + $checkoutSession->expects($this->any()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + + $this->taxHelper = $this->getMockBuilder('\Magento\Tax\Helper\Data') + ->disableOriginalConstructor() + ->setMethods([ + 'getIncExcText' + ]) + ->getMock(); + + $this->taxConfig = $this->getMockBuilder('\Magento\Tax\Model\Config') + ->disableOriginalConstructor() + ->setMethods([ + 'displayCartSubtotalInclTax', 'displayCartSubtotalExclTax', 'displayCartSubtotalBoth' + ]) + ->getMock(); + + $this->totalsObj = $objectManager->getObject( + '\Magento\Tax\Block\Checkout\Cart\Sidebar\Totals', + [ + 'checkoutSession' => $checkoutSession, + 'taxHelper' => $this->taxHelper, + 'taxConfig' => $this->taxConfig, + ] + ); + } + + /** + * @dataProvider getSubtotalInclTaxDataProvider + */ + public function testGetSubtotalInclTax($totals, $expectedValue) + { + $this->quote->expects($this->once()) + ->method('getTotals') + ->will($this->returnValue($totals)); + + $this->assertEquals($expectedValue, $this->totalsObj->getSubtotalInclTax()); + } + + public function getSubtotalInclTaxDataProvider() + { + $data = [ + 'incl' => [ + 'totals' => [ + 'subtotal' => new Object( + [ + 'value_incl_tax' => self::SUBTOTAL_INCL_TAX, + 'value' => self::SUBTOTAL, + ] + ), + ], + 'expected' => self::SUBTOTAL_INCL_TAX, + ], + 'no_incl_value' => [ + 'totals' => [ + 'subtotal' => new Object( + [ + 'value' => self::SUBTOTAL, + ] + ), + ], + 'expected' => self::SUBTOTAL, + ], + 'no_subtotal' => [ + 'totals' => [], + 'expected' => 0, + ] + ]; + return $data; + } + + /** + * @dataProvider getSubtotalExclTaxDataProvider + */ + public function testGetSubtotalExclTax($totals, $expectedValue) + { + $this->quote->expects($this->once()) + ->method('getTotals') + ->will($this->returnValue($totals)); + + $this->assertEquals($expectedValue, $this->totalsObj->getSubtotalExclTax()); + } + + public function getSubtotalExclTaxDataProvider() + { + $data = [ + 'excl' => [ + 'totals' => [ + 'subtotal' => new Object( + [ + 'value_excl_tax' => self::SUBTOTAL_EXCL_TAX, + 'value' => self::SUBTOTAL, + ] + ), + ], + 'expected' => self::SUBTOTAL_EXCL_TAX, + ], + 'no_excl_value' => [ + 'totals' => [ + 'subtotal' => new Object( + [ + 'value' => self::SUBTOTAL, + ] + ), + ], + 'expected' => self::SUBTOTAL, + ], + 'no_subtotal' => [ + 'totals' => [], + 'expected' => 0, + ] + ]; + return $data; + } + + public function testGetDisplaySubtotalInclTax() + { + $this->taxConfig->expects($this->once()) + ->method('displayCartSubtotalInclTax'); + + $this->totalsObj->getDisplaySubtotalInclTax(); + } + + public function testGetDisplaySubtotalExclTax() + { + $this->taxConfig->expects($this->once()) + ->method('displayCartSubtotalExclTax'); + + $this->totalsObj->getDisplaySubtotalExclTax(); + } + + public function testGetDisplaySubtotalBoth() + { + $this->taxConfig->expects($this->once()) + ->method('displayCartSubtotalBoth'); + + $this->totalsObj->getDisplaySubtotalBoth(); + } + + public function testGetIncExcTaxLabel() + { + $flag = true; + $text = "Incl. Tax"; + $expected = " (Incl. Tax)"; + $this->taxHelper->expects($this->once()) + ->method('getIncExcText') + ->with($flag) + ->will($this->returnValue($text)); + + $this->assertEquals($expected, $this->totalsObj->getIncExcTaxLabel($flag)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Tax/Block/Checkout/Shipping/PriceTest.php b/dev/tests/unit/testsuite/Magento/Tax/Block/Checkout/Shipping/PriceTest.php new file mode 100644 index 00000000000..56acf3d7be5 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Tax/Block/Checkout/Shipping/PriceTest.php @@ -0,0 +1,167 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Block\Checkout\Shipping; + +use Magento\Framework\Object; + +class PriceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Tax\Block\Checkout\Shipping\Price + */ + protected $priceObj; + + /** + * @var \Magento\Sales\Model\Quote|\PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + /** + * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject + */ + protected $store; + + /** + * @var \Magento\Tax\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $taxHelper; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->store = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['convertPrice', '__wakeup']) + ->getMock(); + + $this->quote = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->setMethods(['getStore', '__wakeup', 'getCustomerTaxClassId']) + ->getMock(); + + $this->quote->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->store)); + + $checkoutSession = $this->getMockBuilder('\Magento\Checkout\Model\Session') + ->disableOriginalConstructor() + ->setMethods(['getQuote', '__wakeup']) + ->getMock(); + + $checkoutSession->expects($this->any()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + + $this->taxHelper = $this->getMockBuilder('\Magento\Tax\Helper\Data') + ->disableOriginalConstructor() + ->setMethods([ + 'getShippingPrice', 'displayShippingPriceIncludingTax', 'displayShippingBothPrices' + ]) + ->getMock(); + + $this->priceObj = $objectManager->getObject( + '\Magento\Tax\Block\Checkout\Shipping\Price', + [ + 'checkoutSession' => $checkoutSession, + 'taxHelper' => $this->taxHelper, + ] + ); + } + + /** + * @param float $shippingPrice + * @return \Magento\Sales\Model\Quote\Address\Rate|\PHPUnit_Framework_MockObject_MockObject + */ + protected function setupShippingRate($shippingPrice) + { + $shippingRateMock = $this->getMockBuilder('\Magento\Sales\Model\Quote\Address\Rate') + ->disableOriginalConstructor() + ->setMethods(['getPrice', '__wakeup']) + ->getMock(); + $shippingRateMock->expects($this->once()) + ->method('getPrice') + ->will($this->returnValue($shippingPrice)); + return $shippingRateMock; + } + + public function testGetShippingPriceExclTax() + { + $shippingPrice = 5; + $shippingPriceExclTax = 4.5; + $convertedPrice = "$4.50"; + + $shippingRateMock = $this->setupShippingRate($shippingPrice); + + $this->taxHelper->expects($this->once()) + ->method('getShippingPrice') + ->will($this->returnValue($shippingPriceExclTax)); + + $this->store->expects($this->once()) + ->method('convertPrice') + ->with($shippingPriceExclTax, true, true) + ->will($this->returnValue($convertedPrice)); + + $this->priceObj->setShippingRate($shippingRateMock); + $this->assertEquals($convertedPrice, $this->priceObj->getShippingPriceExclTax()); + } + + public function testGetShippingPriceInclTax() + { + $shippingPrice = 5; + $shippingPriceInclTax = 5.5; + $convertedPrice = "$5.50"; + + $shippingRateMock = $this->setupShippingRate($shippingPrice); + + $this->taxHelper->expects($this->once()) + ->method('getShippingPrice') + ->will($this->returnValue($shippingPriceInclTax)); + + $this->store->expects($this->once()) + ->method('convertPrice') + ->with($shippingPriceInclTax, true, true) + ->will($this->returnValue($convertedPrice)); + + $this->priceObj->setShippingRate($shippingRateMock); + $this->assertEquals($convertedPrice, $this->priceObj->getShippingPriceExclTax()); + } + + + public function testDisplayShippingPriceInclTax() + { + $this->taxHelper->expects($this->once()) + ->method('displayShippingPriceIncludingTax'); + + $this->priceObj->displayShippingPriceInclTax(); + } + + public function testDisplayShippingBothPrices() + { + $this->taxHelper->expects($this->once()) + ->method('displayShippingBothPrices'); + + $this->priceObj->displayShippingBothPrices(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Tax/Block/Item/Price/RendererTest.php b/dev/tests/unit/testsuite/Magento/Tax/Block/Item/Price/RendererTest.php new file mode 100644 index 00000000000..3557f30c30d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Tax/Block/Item/Price/RendererTest.php @@ -0,0 +1,82 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Block\Item\Price; + +use Magento\Framework\Object; + +class RendererTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Tax\Block\Item\Price\Renderer + */ + protected $renderer; + + /** + * @var \Magento\Tax\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $taxHelper; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->taxHelper = $this->getMockBuilder('\Magento\Tax\Helper\Data') + ->disableOriginalConstructor() + ->setMethods([ + 'displayCartPriceExclTax', 'displayCartBothPrices', 'displayCartPriceInclTax' + ]) + ->getMock(); + + $this->renderer = $objectManager->getObject( + '\Magento\Tax\Block\Item\Price\Renderer', + [ + 'taxHelper' => $this->taxHelper, + ] + ); + } + + public function testDisplayPriceInclTax() + { + $this->taxHelper->expects($this->once()) + ->method('displayCartPriceInclTax'); + + $this->renderer->displayPriceInclTax(); + } + + public function testDisplayPriceExclTax() + { + $this->taxHelper->expects($this->once()) + ->method('displayCartPriceExclTax'); + + $this->renderer->displayPriceExclTax(); + } + + public function testDisplayBothPrices() + { + $this->taxHelper->expects($this->once()) + ->method('displayCartBothPrices'); + + $this->renderer->displayBothPrices(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php b/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php index ed4708b27ca..e51ef07a879 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php @@ -38,6 +38,11 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase */ protected $taxHelper; + /** + * @var \Magento\Catalog\Helper\Data | \PHPUnit_Framework_MockObject_MockObject + */ + protected $catalogHelper; + /** * @var int */ @@ -46,7 +51,8 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->taxHelper = $this->getMock('Magento\Tax\Helper\Data', [], [], '', false); - $this->adjustment = new Adjustment($this->taxHelper, $this->sortOrder); + $this->catalogHelper = $this->getMock('Magento\Catalog\Helper\Data', [], [], '', false); + $this->adjustment = new Adjustment($this->taxHelper, $this->catalogHelper, $this->sortOrder); } public function testGetAdjustmentCode() @@ -115,12 +121,8 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase $this->taxHelper->expects($this->any()) ->method('priceIncludesTax') ->will($this->returnValue($isPriceIncludesTax)); - $this->taxHelper->expects($this->any()) - ->method('getPrice') - ->with($object, $amount) - ->will($this->returnValue($price)); - $this->taxHelper->expects($this->any()) - ->method('getPriceUnrounded') + $this->catalogHelper->expects($this->any()) + ->method('getTaxPrice') ->with($object, $amount) ->will($this->returnValue($price)); @@ -151,12 +153,8 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase $this->taxHelper->expects($this->any()) ->method('priceIncludesTax') ->will($this->returnValue($isPriceIncludesTax)); - $this->taxHelper->expects($this->any()) - ->method('getPrice') - ->with($object, $amount, !$isPriceIncludesTax) - ->will($this->returnValue($price)); - $this->taxHelper->expects($this->any()) - ->method('getPriceUnrounded') + $this->catalogHelper->expects($this->any()) + ->method('getTaxPrice') ->with($object, $amount, !$isPriceIncludesTax) ->will($this->returnValue($price)); diff --git a/dev/tests/unit/testsuite/Magento/Weee/Block/Item/Price/RendererTest.php b/dev/tests/unit/testsuite/Magento/Weee/Block/Item/Price/RendererTest.php new file mode 100644 index 00000000000..2229ad11bcd --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Weee/Block/Item/Price/RendererTest.php @@ -0,0 +1,499 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Weee\Block\Item\Price; + +use Magento\Framework\Object; +use Magento\Weee\Model\Tax as WeeeDisplayConfig; + +class RendererTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Weee\Block\Item\Price\Renderer + */ + protected $renderer; + + /** + * @var \Magento\Weee\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $weeeHelper; + + /** + * @var \Magento\Directory\Model\PriceCurrency|\PHPUnit_Framework_MockObject_MockObject + */ + protected $priceCurrency; + + /** + * @var \Magento\Sales\Model\Quote\Item|\PHPUnit_Framework_MockObject_MockObject + */ + protected $item; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->weeeHelper = $this->getMockBuilder('\Magento\Weee\Helper\Data') + ->disableOriginalConstructor() + ->setMethods([ + 'isEnabled', 'typeOfDisplay', 'getWeeeTaxInclTax', 'getRowWeeeTaxInclTax' + ]) + ->getMock(); + + $this->priceCurrency = $this->getMockBuilder('\Magento\Directory\Model\PriceCurrency') + ->disableOriginalConstructor() + ->setMethods(['format']) + ->getMock(); + + $this->item = $this->getMockBuilder('\Magento\Sales\Model\Quote\Item') + ->disableOriginalConstructor() + ->setMethods([ + '__wakeup', + 'getWeeeTaxAppliedAmount', + 'getPriceInclTax', + 'getRowTotalInclTax', + 'getCalculationPrice', + 'getRowTotal', + 'getWeeeTaxAppliedRowAmount', + ]) + ->getMock(); + + $this->renderer = $objectManager->getObject( + '\Magento\Weee\Block\Item\Price\Renderer', + [ + 'weeeHelper' => $this->weeeHelper, + 'priceCurrency' => $this->priceCurrency, + ] + ); + $this->renderer->setItem($this->item); + } + + /** + * @param bool $isWeeeEnabled + * @param bool #showWeeeDetails + * @param bool $hasWeeeAmount + * @dataProvider testDisplayPriceWithWeeeDetailsDataProvider + */ + public function testDisplayPriceWithWeeeDetails($isWeeeEnabled, $showWeeeDetails, $hasWeeeAmount, $expectedValue) + { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($isWeeeEnabled)); + + $this->weeeHelper->expects($this->any()) + ->method('typeOfDisplay') + ->with([WeeeDisplayConfig::DISPLAY_INCL_DESCR], 'sales', null) + ->will($this->returnValue($showWeeeDetails)); + + $this->item->expects($this->any()) + ->method('getWeeeTaxAppliedAmount') + ->will($this->returnValue($hasWeeeAmount)); + + $this->assertEquals($expectedValue, $this->renderer->displayPriceWithWeeeDetails()); + } + + public function testDisplayPriceWithWeeeDetailsDataProvider() + { + $data = [ + 'weee_disabled_true_true' => [ + 'isWeeeEnabled' => false, + 'showWeeeDetails' => true, + 'hasWeeeAmount' => true, + 'expectedValue' => false, + ], + 'weee_disabled_true_false' => [ + 'isWeeeEnabled' => false, + 'showWeeeDetails' => true, + 'hasWeeeAmount' => false, + 'expectedValue' => false, + ], + 'weee_disabled_false_true' => [ + 'isWeeeEnabled' => false, + 'showWeeeDetails' => false, + 'hasWeeeAmount' => true, + 'expectedValue' => false, + ], + 'weee_disabled_false_false' => [ + 'isWeeeEnabled' => false, + 'showWeeeDetails' => false, + 'hasWeeeAmount' => false, + 'expectedValue' => false, + ], + 'weee_enabled_showdetail_true' => [ + 'isWeeeEnabled' => true, + 'showWeeeDetails' => true, + 'hasWeeeAmount' => true, + 'expectedValue' => true, + ], + 'weee_enabled_showdetail_false' => [ + 'isWeeeEnabled' => true, + 'showWeeeDetails' => true, + 'hasWeeeAmount' => false, + 'expectedValue' => false, + ], + 'weee_enabled_not_showing_detail_true' => [ + 'isWeeeEnabled' => true, + 'showWeeeDetails' => false, + 'hasWeeeAmount' => true, + 'expectedValue' => false, + ], + 'weee_enabled_not_showing_detail_false' => [ + 'isWeeeEnabled' => true, + 'showWeeeDetails' => false, + 'hasWeeeAmount' => false, + 'expectedValue' => false, + ], + ]; + + return $data; + } + + /** + * @param $priceInclTax + * @param $weeeTaxInclTax + * @param $weeeEnabled + * @param $includeWeee + * @param $expectedValue + * @dataProvider testGetDisplayPriceDataProvider + */ + public function testGetUnitDisplayPriceInclTax( + $priceInclTax, + $weeeTaxInclTax, + $weeeEnabled, + $includeWeee, + $expectedValue + ) { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($weeeEnabled)); + + $this->weeeHelper->expects($this->any()) + ->method('getWeeeTaxInclTax') + ->with($this->item) + ->will($this->returnValue($weeeTaxInclTax)); + + $this->item->expects($this->once()) + ->method('getPriceInclTax') + ->will($this->returnValue($priceInclTax)); + + $this->weeeHelper->expects($this->any()) + ->method('typeOfDisplay') + ->with([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'sales') + ->will($this->returnValue($includeWeee)); + + $this->assertEquals($expectedValue, $this->renderer->getUnitDisplayPriceInclTax()); + + } + + /** + * @param $priceExclTax + * @param $weeeTaxExclTax + * @param $weeeEnabled + * @param $includeWeee + * @param $expectedValue + * @dataProvider testGetDisplayPriceDataProvider + */ + public function testGetUnitDisplayPriceExclTax( + $priceExclTax, + $weeeTaxExclTax, + $weeeEnabled, + $includeWeee, + $expectedValue + ) { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($weeeEnabled)); + + $this->item->expects($this->any()) + ->method('getWeeeTaxAppliedAmount') + ->will($this->returnValue($weeeTaxExclTax)); + + $this->item->expects($this->once()) + ->method('getCalculationPrice') + ->will($this->returnValue($priceExclTax)); + + $this->weeeHelper->expects($this->any()) + ->method('typeOfDisplay') + ->with([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'sales') + ->will($this->returnValue($includeWeee)); + + $this->assertEquals($expectedValue, $this->renderer->getUnitDisplayPriceExclTax()); + + } + + /** + * @param $rowTotal + * @param $rowWeeeTaxExclTax + * @param $weeeEnabled + * @param $includeWeee + * @param $expectedValue + * @dataProvider testGetDisplayPriceDataProvider + */ + public function testGetRowDisplayPriceExclTax( + $rowTotal, + $rowWeeeTaxExclTax, + $weeeEnabled, + $includeWeee, + $expectedValue + ) { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($weeeEnabled)); + + $this->item->expects($this->any()) + ->method('getWeeeTaxAppliedRowAmount') + ->will($this->returnValue($rowWeeeTaxExclTax)); + + $this->item->expects($this->once()) + ->method('getRowTotal') + ->will($this->returnValue($rowTotal)); + + $this->weeeHelper->expects($this->any()) + ->method('typeOfDisplay') + ->with([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'sales') + ->will($this->returnValue($includeWeee)); + + $this->assertEquals($expectedValue, $this->renderer->getRowDisplayPriceExclTax()); + + } + + /** + * @param $rowTotalInclTax + * @param $rowWeeeTaxInclTax + * @param $weeeEnabled + * @param $includeWeee + * @param $expectedValue + * @dataProvider testGetDisplayPriceDataProvider + */ + public function testGetRowDisplayPriceInclTax( + $rowTotalInclTax, + $rowWeeeTaxInclTax, + $weeeEnabled, + $includeWeee, + $expectedValue + ) { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($weeeEnabled)); + + $this->weeeHelper->expects($this->any()) + ->method('getRowWeeeTaxInclTax') + ->with($this->item) + ->will($this->returnValue($rowWeeeTaxInclTax)); + + $this->item->expects($this->once()) + ->method('getRowTotalInclTax') + ->will($this->returnValue($rowTotalInclTax)); + + $this->weeeHelper->expects($this->any()) + ->method('typeOfDisplay') + ->with([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'sales') + ->will($this->returnValue($includeWeee)); + + $this->assertEquals($expectedValue, $this->renderer->getRowDisplayPriceInclTax()); + + } + + public function testGetDisplayPriceDataProvider() + { + $data = [ + 'weee_disabled_true' => [ + 'price' => 100, + 'weee' => 10, + 'weee_enabled' => false, + 'include_weee' => true, + 'expected_value' => 100, + ], + 'weee_disabled_false' => [ + 'price' => 100, + 'weee' => 10, + 'weee_enabled' => false, + 'include_weee' => false, + 'expected_value' => 100, + ], + 'weee_enabled_include_weee' =>[ + 'price' => 100, + 'weee' => 10, + 'weee_enabled' => true, + 'include_weee' => true, + 'expected_value' => 110, + ], + 'weee_enabled_not_include_weee' =>[ + 'price' => 100, + 'weee' => 10, + 'weee_enabled' => true, + 'include_weee' => false, + 'expected_value' => 100, + ], + ]; + return $data; + } + + /** + * @param $priceInclTax + * @param $weeeTaxInclTax + * @param $weeeEnabled + * @param $expectedValue + * @dataProvider testGetFinalDisplayPriceDataProvider + */ + public function testGetFinalUnitDisplayPriceInclTax( + $priceInclTax, + $weeeTaxInclTax, + $weeeEnabled, + $expectedValue + ) { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($weeeEnabled)); + + $this->weeeHelper->expects($this->any()) + ->method('getWeeeTaxInclTax') + ->with($this->item) + ->will($this->returnValue($weeeTaxInclTax)); + + $this->item->expects($this->once()) + ->method('getPriceInclTax') + ->will($this->returnValue($priceInclTax)); + + $this->assertEquals($expectedValue, $this->renderer->getFinalUnitDisplayPriceInclTax()); + + } + + /** + * @param $priceExclTax + * @param $weeeTaxExclTax + * @param $weeeEnabled + * @param $expectedValue + * @dataProvider testGetFinalDisplayPriceDataProvider + */ + public function testGetFinalUnitDisplayPriceExclTax( + $priceExclTax, + $weeeTaxExclTax, + $weeeEnabled, + $expectedValue + ) { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($weeeEnabled)); + + $this->item->expects($this->any()) + ->method('getWeeeTaxAppliedAmount') + ->will($this->returnValue($weeeTaxExclTax)); + + $this->item->expects($this->once()) + ->method('getCalculationPrice') + ->will($this->returnValue($priceExclTax)); + + $this->assertEquals($expectedValue, $this->renderer->getFinalUnitDisplayPriceExclTax()); + + } + + /** + * @param $rowTotal + * @param $rowWeeeTaxExclTax + * @param $weeeEnabled + * @param $expectedValue + * @dataProvider testGetFinalDisplayPriceDataProvider + */ + public function testGetFianlRowDisplayPriceExclTax( + $rowTotal, + $rowWeeeTaxExclTax, + $weeeEnabled, + $expectedValue + ) { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($weeeEnabled)); + + $this->item->expects($this->any()) + ->method('getWeeeTaxAppliedRowAmount') + ->will($this->returnValue($rowWeeeTaxExclTax)); + + $this->item->expects($this->once()) + ->method('getRowTotal') + ->will($this->returnValue($rowTotal)); + + $this->assertEquals($expectedValue, $this->renderer->getFinalRowDisplayPriceExclTax()); + + } + + /** + * @param $rowTotalInclTax + * @param $rowWeeeTaxInclTax + * @param $weeeEnabled + * @param $expectedValue + * @dataProvider testGetFinalDisplayPriceDataProvider + */ + public function testGetFinalRowDisplayPriceInclTax( + $rowTotalInclTax, + $rowWeeeTaxInclTax, + $weeeEnabled, + $expectedValue + ) { + $this->weeeHelper->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue($weeeEnabled)); + + $this->weeeHelper->expects($this->any()) + ->method('getRowWeeeTaxInclTax') + ->with($this->item) + ->will($this->returnValue($rowWeeeTaxInclTax)); + + $this->item->expects($this->once()) + ->method('getRowTotalInclTax') + ->will($this->returnValue($rowTotalInclTax)); + + $this->assertEquals($expectedValue, $this->renderer->getFinalRowDisplayPriceInclTax()); + + } + + public function testGetFinalDisplayPriceDataProvider() + { + $data = [ + 'weee_disabled_true' => [ + 'price' => 100, + 'weee' => 10, + 'weee_enabled' => false, + 'expected_value' => 100, + ], + 'weee_enabled_include_weee' =>[ + 'price' => 100, + 'weee' => 10, + 'weee_enabled' => true, + 'expected_value' => 110, + ], + ]; + return $data; + } + + public function testFormatPrice() + { + $price = 10; + $formattedPrice ="$10.00"; + $this->priceCurrency->expects($this->once()) + ->method('format') + ->with($price) + ->will($this->returnValue($formattedPrice)); + + $this->assertEquals($formattedPrice, $this->renderer->formatPrice($price)); + } +} diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php index cf5e5daaa9d..bdb85fda79d 100644 --- a/lib/internal/Magento/Framework/AppInterface.php +++ b/lib/internal/Magento/Framework/AppInterface.php @@ -35,7 +35,7 @@ interface AppInterface /** * Magento version */ - const VERSION = '0.1.0-alpha90'; + const VERSION = '0.1.0-alpha91'; /** * Launch application diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index 56b95e3a753..4e38d9c4816 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -2,7 +2,7 @@ "name": "magento/framework", "description": "N/A", "type": "magento2-library", - "version": "0.1.0-alpha90", + "version": "0.1.0-alpha91", "require": { "php": "~5.4.11|~5.5.0", "ext-spl": "*", -- GitLab