From 6d9aa0588ca6eabf612087b8789b2b549b955b33 Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Fri, 27 Dec 2013 11:09:23 -0800 Subject: [PATCH] 2.0.0.0-dev58 * Fixed bugs: * Security improved for the Login, Update Cart, Add to Compare, Review, and Add entire wishlist actions on the frontend * Removed warnings on category pages when Flat Catalog Category is enabled * Fixed product price displayed in wrong currency after switching currency on the frontend * Fixed the Save & Duplicate action in product creation * Fixed big image scaling in product description * Fixed admin dashboard styling issue * Fixed validation message for the Quantity field on the product page in the backend * Fixed the email template for sharing a Wishlist * Fixed the response of the drop-down menu in the Plushe theme * Fixed the missing Related Banners tab for Catalog Price Rule * Fixed inability to enable the duplicated product * Removed warnings on saving payment method configuration * Fixed gift messages displaying on the Order View page after admin edits * Fixed inability to create a new order status * Fixed the behavior of the Save and Previous and the Previous buttons on the Edit Review page * Fixed inability to delete a website if the number of websites is less or equal to two * Fixed Export on the All Customers page * Fixed inability to add products to the Shopping Cart from the Category page in Internet Explorer * Fixed logo on the backend login page * Fixed visual elements to indicate that Tax details can be expanded on the order creation page in the backend * Fixed the CMS page preview design * Fixed the newsletter template preview design * Fixed the Matched Customers grid design in the Email Reminder Rules * Fixed the theme version validation message displayed when creating a new theme * Fixed performance degradation during installation wizard execution * Fixed cron shell script * Fixed user login on the frontend, when the Redirect Customer to Account Dashboard after Logging option is set to No * Fixed errors in requests to shipping carrier (DHL International) when the shipping address contains letters with diacritic marks * Fixed invalid account creation date * Fixed displaying Product Alert links on product view page when the functionality is disabled * Fixed the absence of some bundle options when configuring a bundle product in the Shopping Cart on the frontend * Fixed the issue which allowed to view and cancel billing agreements belonging to another customer * Fixed the content spoofing vulnerability when Solr was used * Fixed a potential XSS vulnerability in customer login * Fixed RSS feed for categories containing bundle product(s) * Fixed inability to place an order with 3D Secure in Internet Explorer 10 * Fixed inability to place an order with PayPal Payflow Link and PayPal Payments Advanced * Fixed integrity constraint violation in catalog URL rewrites * Fixed the absence of the error when a wrong website code is specified during a website creation * Fixed saving in the backend a new customer address, which contains new customer address attributes configured to be not visible on frontend * Fixed USPS shipping method in the checkout * Fixed placing orders with recurring profile items via PayPal Express Checkout * Fixed email template creation in the backend * Fixed the issue with default billing address being used instead of default shipping address during admin order creation * Fixed inability to choose DB as Media Storage * Fixed PHP issues found during the UI testing of the backend * Fixed shipping label creation for USPS Priority Mail Shipping methods * Fixed the issue which allowed to create customers with duplicate email * Fixed the abstract product block error in the tier price template getter * Fixed system message displaying in the backend * Fixed the "404" error on customer review page * Fixed autocomplete enabled on the admin login page * Fixed the 3D Secure iframe * Fixed the indicators of mandatory fields on the Package Extension page * Fixed product image scaling on the Compare Products page * Fixed product page design for products with the Fixed Product Tax attribute * Removed spaces between parentheses and numbers in the Cart, Wishlist, and Compare Products blocks * Fixed the message displaying the quantity for products found on the Advanced Search page * Fixed incorrect caching of locale settings and URL settings during web installation * Fixed inability to use a newly created store for admin user roles * Fixed absence of the Advanced Search field on the frontend, when the Popular Search Terms functionality is disabled * Fixed incorrect link to downloadable product(s) in the email invoice copy * Fixed customs monetary value in labels/package info for international shipments * Fixed importing for files with blank URL Key field on the store view level * Fixed table rate error message * Fixed frontend login without pre-set cookies * Fixed date resetting to 1 Jan 1970 after saving a design change in the admin panel in case date format is DD/MM/YY * Fixed CAPTCHA on multi-address checkout flow * Fixed view files population tool * GitHub requests: * [#122](https://github.com/magento/magento2/pull/122) -- Added support of federal units of Brazil with 27 states * [#184](https://github.com/magento/magento2/issues/184) -- Removed unused blocks and methods in Magento_Wishlist module * [#390](https://github.com/magento/magento2/pull/390) -- Support of alphanumeric order increment ids by the quote resource model * Themes update: * Responsive design improvements * Improvements in code coverage calculation: * Code coverage calculation approach for unit tests was changed from blacklist to whitelist --- CHANGELOG.md | 83 +++- .../view/adminhtml/layout/default.xml | 32 +- .../view/frontend/directpost/form.phtml | 4 +- .../Magento/Backend/App/AbstractAction.php | 19 - .../System/Config/System/Storage.php | 10 +- .../Controller/Adminhtml/System/Design.php | 29 +- .../Controller/Adminhtml/System/Store.php | 2 +- .../Magento/Backend/Model/Auth/Session.php | 7 + .../Backend/view/adminhtml/admin/login.phtml | 4 +- .../Backend/view/adminhtml/layout/default.xml | 1 + .../system/storage/media/synchronize.phtml | 11 +- .../Product/View/Type/Bundle/Option.php | 18 +- .../mysql4-upgrade-1.6.0.0-1.6.0.0.1.php | 3 + .../view/type/bundle/option/radio.phtml | 2 +- .../view/type/bundle/option/select.phtml | 2 +- .../frontend/rss/catalog/product/price.phtml | 6 +- .../Magento/Captcha/Model/ModelInterface.php | 2 +- app/code/Magento/Captcha/Model/Observer.php | 21 +- .../Adminhtml/Product/Edit/NewCategory.php | 17 +- .../Catalog/Block/Product/AbstractProduct.php | 12 +- .../Controller/Adminhtml/Product/Review.php | 6 +- .../Catalog/Controller/Product/Compare.php | 14 +- .../Catalog/Helper/Product/Compare.php | 13 +- .../Catalog/Model/Layer/Filter/Price.php | 17 +- .../Model/Product/Attribute/Backend/Media.php | 5 +- .../Model/Product/Type/AbstractType.php | 2 +- .../Catalog/Model/Resource/Category/Flat.php | 22 +- app/code/Magento/Catalog/Model/Url.php | 2 +- .../mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php | 3 + .../view/adminhtml/product/product.css | 6 +- .../view/frontend/product/compare/link.phtml | 8 +- .../frontend/product/compare/sidebar.phtml | 5 +- .../frontend/product/view/addtocart.phtml | 2 +- .../frontend/product/view/type/grouped.phtml | 2 +- .../CatalogSearch/Model/Resource/Fulltext.php | 2 +- .../view/frontend/advanced/result.phtml | 8 +- .../view/frontend/layout/default.xml | 2 +- app/code/Magento/Centinel/Model/Service.php | 28 +- .../view/frontend/authentication.phtml | 2 +- app/code/Magento/Checkout/Block/Cart/Link.php | 2 +- .../Checkout/Block/Onepage/Payment.php | 10 + .../Checkout/Block/Onepage/Success.php | 2 +- app/code/Magento/Checkout/Controller/Cart.php | 14 +- app/code/Magento/Checkout/Helper/Data.php | 1 - .../Checkout/view/frontend/cart/form.phtml | 1 + .../cart/item/configure/updatecart.phtml | 2 +- .../view/frontend/cart/item/default.phtml | 2 +- .../view/frontend/cart/minicart.phtml | 4 +- .../Checkout/view/frontend/js/opcheckout.js | 6 +- .../layout/checkout_multishipping.xml | 8 +- .../layout/checkout_onepage_index.xml | 4 +- .../frontend/multishipping/addresses.phtml | 2 +- .../Checkout/view/frontend/onepage.phtml | 2 + .../view/frontend/onepage/login.phtml | 1 + .../adminhtml/extension/custom/authors.phtml | 24 +- .../Core/App/Action/Plugin/Session.php | 2 +- app/code/Magento/Core/Model/App.php | 4 +- .../Core/Model/Config/FileResolver.php | 2 +- app/code/Magento/Core/Model/Design.php | 10 +- app/code/Magento/Core/Model/File/Storage.php | 2 +- app/code/Magento/Core/Model/Layout.php | 2 +- .../Locale/Hierarchy/Config/FileResolver.php | 2 +- .../Core/Model/Resource/File/Storage/File.php | 2 +- .../Magento/Core/Model/Resource/Setup.php | 16 +- app/code/Magento/Core/Model/Store.php | 7 +- .../Magento/Core/Model/Theme/Collection.php | 14 +- app/code/Magento/Core/Model/Website.php | 2 +- .../Customer/Block/Account/Customer.php | 10 +- .../Block/Adminhtml/Edit/Tab/Account.php | 2 +- .../Block/Adminhtml/Edit/Tab/View.php | 2 +- .../Magento/Customer/Controller/Account.php | 4 +- .../Customer/Model/Resource/Customer.php | 2 +- app/code/Magento/Customer/etc/module.xml | 2 +- app/code/Magento/Customer/etc/validation.xml | 1 - .../upgrade-1.6.2.0.4-1.6.2.0.5.php | 39 ++ .../Customer/view/frontend/form/login.phtml | 2 + .../data-upgrade-1.6.0.1-1.6.0.2.php | 59 +++ app/code/Magento/Directory/etc/module.xml | 2 +- .../Sales/Order/Email/Items/Downloadable.php | 10 +- app/code/Magento/Downloadable/etc/di.xml | 5 + .../frontend/checkout/cart/item/default.phtml | 2 +- .../frontend/customer/products/list.phtml | 58 +-- .../Email/Block/Adminhtml/Template/Edit.php | 4 +- .../Model/Template/Config/FileResolver.php | 8 +- .../view/adminhtml/giftoptionsform.phtml | 6 - .../GiftMessage/view/adminhtml/popup.phtml | 2 + .../Adminhtml/Googleshopping/Types.php | 12 +- .../Model/Import/Entity/Product.php | 10 + .../Entity/Product/Type/AbstractType.php | 27 +- .../view/adminhtml/export/form/before.phtml | 15 - app/code/Magento/Install/Model/Installer.php | 15 +- .../Install/Model/Installer/Config.php | 40 +- .../Problem/Grid/Filter/Checkbox.php | 2 +- .../adminhtml/preview/iframeswitcher.phtml | 11 +- .../Payment/view/frontend/form/cc.phtml | 4 +- .../Payment/view/frontend/form/ccsave.phtml | 4 +- app/code/Magento/Paypal/Block/Iframe.php | 2 +- app/code/Magento/Paypal/Model/Cert.php | 3 +- .../ProductAlert/Block/Product/View/Price.php | 14 +- .../ProductAlert/Block/Product/View/Stock.php | 13 +- .../Grid/Column/Renderer/Customer.php | 2 +- .../reports_report_review_customer_grid.xml | 2 +- .../Magento/Review/Block/Adminhtml/Edit.php | 6 +- .../Magento/Review/Controller/Product.php | 20 +- .../Review/view/frontend/customer/list.phtml | 78 ++-- .../Magento/Review/view/frontend/form.phtml | 1 + .../Adminhtml/Order/Status/NewStatus.php | 3 +- .../Sales/Controller/Billing/Agreement.php | 23 +- .../Magento/Sales/Model/Billing/Agreement.php | 4 +- .../Magento/Sales/Model/Quote/Address.php | 61 ++- ...wstatus.xml => sales_order_status_new.xml} | 0 .../adminhtml/order/create/giftmessage.js | 2 +- .../order/create/totals/default.phtml | 2 +- .../order/create/totals/grandtotal.phtml | 6 +- .../order/create/totals/shipping.phtml | 6 +- .../order/create/totals/subtotal.phtml | 6 +- .../adminhtml/order/create/totals/tax.phtml | 2 +- .../adminhtml/order/invoice/view/form.phtml | 13 +- .../adminhtml/order/shipment/packaging.js | 2 +- .../view/adminhtml/order/view/info.phtml | 11 +- .../frontend/billing/agreement/view.phtml | 51 +- .../view/frontend/billing/agreements.phtml | 50 +- .../frontend/order/creditmemo/items.phtml | 50 +- .../Sales/view/frontend/order/history.phtml | 64 +-- .../view/frontend/order/invoice/items.phtml | 46 +- .../Sales/view/frontend/order/items.phtml | 90 ++-- .../Sales/view/frontend/order/recent.phtml | 64 +-- .../view/frontend/order/shipment/items.phtml | 36 +- .../Sendfriend/view/frontend/send.phtml | 25 +- .../Shipping/Model/Carrier/Tablerate.php | 12 +- app/code/Magento/Shipping/Model/Shipping.php | 10 +- .../Shipping/Model/Shipping/Labels.php | 10 +- .../Magento/Shipping/etc/adminhtml/system.xml | 1 + .../Magento/Theme/Model/Wysiwyg/Storage.php | 4 +- .../Theme/view/frontend/layout/default.xml | 2 +- app/code/Magento/Usa/Helper/Data.php | 38 +- .../Usa/Model/Shipping/Carrier/Dhl.php | 4 - .../Shipping/Carrier/Dhl/International.php | 8 - .../Model/Shipping/Carrier/Dhl/Label/Pdf.php | 35 +- .../Shipping/Carrier/Dhl/Label/Pdf/Page.php | 4 +- .../Carrier/Dhl/Label/Pdf/PageBuilder.php | 4 +- .../Usa/Model/Shipping/Carrier/Usps.php | 404 ++++++++++------ .../Shipping/Carrier/Usps/Source/Generic.php | 6 +- app/code/Magento/Usa/etc/config.xml | 4 +- app/code/Magento/Usa/i18n/en_US.csv | 84 +++- .../Weee/view/adminhtml/renderer/tax.phtml | 31 +- .../Widget/Model/Config/FileResolver.php | 8 +- .../Magento/Wishlist/Block/AbstractBlock.php | 67 --- .../Wishlist/Block/Customer/Sidebar.php | 2 +- .../Wishlist/Block/Customer/Wishlist.php | 25 +- app/code/Magento/Wishlist/Block/Link.php | 27 +- .../Controller/AbstractController.php | 25 +- .../Magento/Wishlist/Controller/Index.php | 14 +- .../Magento/Wishlist/Controller/Shared.php | 4 +- app/code/Magento/Wishlist/Helper/Data.php | 2 +- .../view/email/share_notification.html | 2 +- .../view/frontend/item/column/cart.phtml | 2 +- .../Wishlist/view/frontend/layout/default.xml | 2 +- .../{render/item/price.phtml => link.phtml} | 20 +- .../Wishlist/view/frontend/sidebar.phtml | 12 +- .../Magento/Wishlist/view/frontend/view.phtml | 2 +- .../adminhtml/magento_backend/css/styles.css | 270 +++++++++-- .../magento_backend/less/styles/admin.less | 9 + .../magento_backend/less/styles/pages.less | 164 ++++++- .../magento_backend/mui/elements.css | 2 +- .../adminhtml/magento_backend/mui/form.css | 2 +- .../Magento_Customer/layout/default.xml | 4 +- .../frontend/magento_plushe/css/styles.css | 435 +++++++++++------- .../frontend/magento_plushe/i18n/en_US.csv | 4 + .../frontend/magento_plushe/js/matchMedia.js | 12 +- .../magento_plushe/js/navigation-menu.js | 2 +- .../frontend/magento_plushe/js/responsive.js | 43 ++ .../magento_plushe/less/lib/forms.less | 15 +- .../magento_plushe/less/lib/icons.less | 18 + .../magento_plushe/less/lib/snippets.less | 6 +- .../less/responsive/responsive.less | 165 ++++--- .../frontend/magento_plushe/less/styles.less | 202 ++++---- dev/shell/cron.sh | 4 +- .../TestCase/AbstractConfigFiles.php | 5 +- .../Controller/Adminhtml/System/StoreTest.php | 27 ++ .../Controller/Adminhtml/ProductTest.php | 22 + .../Controller/Product/CompareTest.php | 7 +- .../Product/Attribute/Backend/MediaTest.php | 22 +- .../Model/Resource/Category/FlatTest.php | 64 +++ .../Magento/Catalog/Model/UrlTest.php | 7 - .../Magento/Core/Model/DesignTest.php | 1 + .../Magento/Core/Model/View/DesignTest.php | 3 - .../Controller/Adminhtml/IndexTest.php | 2 +- .../Magento/Filesystem/Directory/ReadTest.php | 4 +- .../Adminhtml/GoogleShopping/TypesTest.php | 38 +- .../Magento/Install/Model/InstallerTest.php | 30 +- .../Magento/Sales/Model/Quote/AddressTest.php | 138 ++++++ .../Sales/Model/Resource/QuoteTest.php | 55 +++ .../Sales/_files/order_alphanumeric_id.php | 33 ++ .../Integrity/Modular/DiConfigFilesTest.php | 5 +- .../Modular/EavAttributesConfigFilesTest.php | 7 +- .../Modular/ExportConfigFilesTest.php | 7 +- .../Modular/FieldsetConfigFilesTest.php | 6 +- .../Modular/ImportConfigFilesTest.php | 7 +- .../Modular/IndexerConfigFilesTest.php | 7 +- .../Modular/InstallWizardConfigFilesTest.php | 6 +- .../Modular/PaymentConfigFilesTest.php | 6 +- .../Modular/ProductOptionsConfigFilesTest.php | 7 +- .../Modular/ProductTypesConfigFilesTest.php | 7 +- .../Modular/ResourcesConfigFilesTest.php | 7 +- .../Modular/ThemeConfigFilesTest.php | 6 +- .../Modular/WidgetConfigFilesTest.php | 6 +- .../Magento/Tools/View/GeneratorTest.php | 77 ++++ .../Widget/Model/Config/ReaderTest.php | 2 +- .../Test/Legacy/_files/obsolete_classes.php | 1 + .../Test/Legacy/_files/obsolete_methods.php | 7 +- .../Legacy/_files/obsolete_properties.php | 2 + dev/tests/unit/phpunit.xml.dist | 10 + .../App/Response/Http/FileFactoryTest.php | 24 +- .../Product/View/Type/Bundle/OptionTest.php | 75 +++ .../Magento/Captcha/Model/ObserverTest.php | 119 ++++- .../Magento/Catalog/Model/UrlTest.php | 51 ++ .../Magento/Centinel/Model/ServiceTest.php | 88 +++- .../Checkout/Block/Onepage/PaymentTest.php | 59 +++ .../Magento/Checkout/Helper/DataTest.php | 142 ++++++ .../Core/Model/Config/FileResolverTest.php | 2 +- .../Model/Resource/File/Storage/FileTest.php | 96 ++++ .../Core/Model/Theme/ValidationTest.php | 4 +- .../Magento/Core/Model/WebsiteTest.php | 57 +++ .../Customer/Block/Account/CustomerTest.php | 49 ++ .../Customer/Controller/AccountTest.php | 112 ++++- .../Data/Form/Element/MultiselectTest.php | 10 + .../Magento/Filesystem/Directory/ReadTest.php | 17 - .../Magento/Install/Model/InstallerTest.php | 121 +++++ .../Block/Product/View/PriceTest.php | 145 ++++-- .../Block/Product/View/StockTest.php | 139 ++++-- .../Controller/Billing/AgreementTest.php | 162 +++++++ .../View/Generator/ThemeDeploymentTest.php | 16 +- .../View/Generator/_files/fixture_themes.php | 6 +- .../testsuite/Magento/Usa/Helper/DataTest.php | 92 ++++ .../Carrier/Dhl/Label/Pdf/PageBuilderTest.php | 52 +++ .../Carrier/Usps/Source/GenericTest.php | 77 ++++ .../Usa/Model/Shipping/Carrier/UspsTest.php | 215 +++++++++ .../Carrier/_files/rates_request_data.php | 56 +++ .../_files/return_shipment_request_data.php | 88 ++++ .../_files/success_usps_response_rates.xml | 171 +++++++ .../success_usps_response_return_shipment.xml | 38 ++ .../testsuite/Magento/View/FileSystemTest.php | 33 ++ .../View/Layout/File/Source/BaseTest.php | 17 +- .../Layout/File/Source/Override/ThemeTest.php | 17 +- .../Magento/View/Url/CssResolverTest.php | 112 +++-- .../Magento/View/Url/_files/result.css | 11 +- .../Magento/View/Url/_files/source.css | 11 +- .../unit/testsuite/Magento/View/UrlTest.php | 3 +- .../Magento/Tools/View/Generator/CopyRule.php | 12 +- dev/tools/Magento/Tools/View/generator.php | 41 +- .../App/Config/FileResolver/Primary.php | 3 +- .../ObjectManager/ConfigLoader/Primary.php | 12 +- lib/Magento/App/ObjectManagerFactory.php | 8 +- lib/Magento/App/Response/Http/FileFactory.php | 22 +- .../Data/Form/Element/AbstractElement.php | 14 +- lib/Magento/Filesystem/Directory/Read.php | 42 +- .../Filesystem/Directory/ReadInterface.php | 3 +- lib/Magento/Filesystem/Directory/Write.php | 1 - lib/Magento/Filesystem/Driver/File.php | 49 ++ lib/Magento/Filesystem/DriverInterface.php | 19 + .../Module/Declaration/FileResolver.php | 36 +- lib/Magento/View/Design/Theme/Validator.php | 2 +- lib/Magento/View/FileSystem.php | 31 +- lib/Magento/View/Layout/File/Source/Base.php | 20 +- .../View/Layout/File/Source/Override/Base.php | 21 +- .../Layout/File/Source/Override/Theme.php | 26 +- lib/Magento/View/Layout/File/Source/Theme.php | 17 +- lib/Magento/View/Publisher.php | 13 +- lib/Magento/View/Url.php | 20 +- lib/Magento/View/Url/CssResolver.php | 41 +- pub/lib/mage/deletable-item.js | 7 +- 272 files changed, 5613 insertions(+), 1909 deletions(-) create mode 100644 app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0.4-1.6.2.0.5.php create mode 100644 app/code/Magento/Directory/data/directory_setup/data-upgrade-1.6.0.1-1.6.0.2.php rename app/code/Magento/Sales/view/adminhtml/layout/{sales_order_status_newstatus.xml => sales_order_status_new.xml} (100%) mode change 100644 => 100755 app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php rename app/code/Magento/Wishlist/view/frontend/{render/item/price.phtml => link.phtml} (60%) create mode 100644 app/design/frontend/magento_plushe/i18n/en_US.csv create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Category/FlatTest.php rename app/code/Magento/Wishlist/Block/Render/Item/Price.php => dev/tests/integration/testsuite/Magento/GoogleShopping/Controller/Adminhtml/GoogleShopping/TypesTest.php (51%) create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_alphanumeric_id.php create mode 100644 dev/tests/integration/testsuite/Magento/Tools/View/GeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/OptionTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/UrlTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/PaymentTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/Resource/File/Storage/FileTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/WebsiteTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Customer/Block/Account/CustomerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Install/Model/InstallerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Controller/Billing/AgreementTest.php create mode 100755 dev/tests/unit/testsuite/Magento/Usa/Helper/DataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilderTest.php create mode 100755 dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Usps/Source/GenericTest.php create mode 100755 dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/UspsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/rates_request_data.php create mode 100644 dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/return_shipment_request_data.php create mode 100644 dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/success_usps_response_rates.xml create mode 100644 dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/success_usps_response_return_shipment.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e9863bafdf..27362ec8c65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,84 @@ +2.0.0.0-dev58 +============= +* Fixed bugs: + * Security improved for the Login, Update Cart, Add to Compare, Review, and Add entire wishlist actions on the frontend + * Removed warnings on category pages when Flat Catalog Category is enabled + * Fixed product price displayed in wrong currency after switching currency on the frontend + * Fixed the Save & Duplicate action in product creation + * Fixed big image scaling in product description + * Fixed admin dashboard styling issue + * Fixed validation message for the Quantity field on the product page in the backend + * Fixed the email template for sharing a Wishlist + * Fixed the response of the drop-down menu in the Plushe theme + * Fixed the missing Related Banners tab for Catalog Price Rule + * Fixed inability to enable the duplicated product + * Removed warnings on saving payment method configuration + * Fixed gift messages displaying on the Order View page after admin edits + * Fixed inability to create a new order status + * Fixed the behavior of the Save and Previous and the Previous buttons on the Edit Review page + * Fixed inability to delete a website if the number of websites is less or equal to two + * Fixed Export on the All Customers page + * Fixed inability to add products to the Shopping Cart from the Category page in Internet Explorer + * Fixed logo on the backend login page + * Fixed visual elements to indicate that Tax details can be expanded on the order creation page in the backend + * Fixed the CMS page preview design + * Fixed the newsletter template preview design + * Fixed the Matched Customers grid design in the Email Reminder Rules + * Fixed the theme version validation message displayed when creating a new theme + * Fixed performance degradation during installation wizard execution + * Fixed cron shell script + * Fixed user login on the frontend, when the Redirect Customer to Account Dashboard after Logging option is set to No + * Fixed errors in requests to shipping carrier (DHL International) when the shipping address contains letters with diacritic marks + * Fixed invalid account creation date + * Fixed displaying Product Alert links on product view page when the functionality is disabled + * Fixed the absence of some bundle options when configuring a bundle product in the Shopping Cart on the frontend + * Fixed the issue which allowed to view and cancel billing agreements belonging to another customer + * Fixed the content spoofing vulnerability when Solr was used + * Fixed a potential XSS vulnerability in customer login + * Fixed RSS feed for categories containing bundle product(s) + * Fixed inability to place an order with 3D Secure in Internet Explorer 10 + * Fixed inability to place an order with PayPal Payflow Link and PayPal Payments Advanced + * Fixed integrity constraint violation in catalog URL rewrites + * Fixed the absence of the error when a wrong website code is specified during a website creation + * Fixed saving in the backend a new customer address, which contains new customer address attributes configured to be not visible on frontend + * Fixed USPS shipping method in the checkout + * Fixed placing orders with recurring profile items via PayPal Express Checkout + * Fixed email template creation in the backend + * Fixed the issue with default billing address being used instead of default shipping address during admin order creation + * Fixed inability to choose DB as Media Storage + * Fixed PHP issues found during the UI testing of the backend + * Fixed shipping label creation for USPS Priority Mail Shipping methods + * Fixed the issue which allowed to create customers with duplicate email + * Fixed the abstract product block error in the tier price template getter + * Fixed system message displaying in the backend + * Fixed the "404" error on customer review page + * Fixed autocomplete enabled on the admin login page + * Fixed the 3D Secure iframe + * Fixed the indicators of mandatory fields on the Package Extension page + * Fixed product image scaling on the Compare Products page + * Fixed product page design for products with the Fixed Product Tax attribute + * Removed spaces between parentheses and numbers in the Cart, Wishlist, and Compare Products blocks + * Fixed the message displaying the quantity for products found on the Advanced Search page + * Fixed incorrect caching of locale settings and URL settings during web installation + * Fixed inability to use a newly created store for admin user roles + * Fixed absence of the Advanced Search field on the frontend, when the Popular Search Terms functionality is disabled + * Fixed incorrect link to downloadable product(s) in the email invoice copy + * Fixed customs monetary value in labels/package info for international shipments + * Fixed importing for files with blank URL Key field on the store view level + * Fixed table rate error message + * Fixed frontend login without pre-set cookies + * Fixed date resetting to 1 Jan 1970 after saving a design change in the admin panel in case date format is DD/MM/YY + * Fixed CAPTCHA on multi-address checkout flow + * Fixed view files population tool +* GitHub requests: + * [#122](https://github.com/magento/magento2/pull/122) -- Added support of federal units of Brazil with 27 states + * [#184](https://github.com/magento/magento2/issues/184) -- Removed unused blocks and methods in Magento_Wishlist module + * [#390](https://github.com/magento/magento2/pull/390) -- Support of alphanumeric order increment ids by the quote resource model +* Themes update: + * Responsive design improvements +* Improvements in code coverage calculation: + * Code coverage calculation approach for unit tests was changed from blacklist to whitelist + 2.0.0.0-dev57 ============= * Fixed bugs: @@ -44,7 +125,7 @@ * Session generic wrapper moved to library * Messages functionality moved from the Session model as separate component, message manager interface created * Sid resolver interface created to handle session sid from request - + 2.0.0.0-dev56 ============= * Fixed bugs: diff --git a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml index 6e753a4ffcf..7544c90f6c0 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml +++ b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml @@ -24,32 +24,28 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="root"> - <container name="notifications" as="notifications" label="Notifications" after="header"> - <block class="Magento\AdminNotification\Block\System\Messages" name="system_messages" as="system_messages" before="-" template="Magento_AdminNotification::system/messages.phtml"/> - <block class="Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup" name="unread_system_messages" as="unread_system_messages" after="system_messages" template="Magento_AdminNotification::system/messages/popup.phtml"/> - <block class="Magento\AdminNotification\Block\Window" name="notification_window" as="notification_window" acl="Magento_AdminNotification::show_toolbar" template="notification/window.phtml"/> - </container> - <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminnotification-system-notification-js"> - <arguments> - <argument name="file" xsi:type="string">Magento_AdminNotification::system/notification.js</argument> - </arguments> - </block> - </referenceBlock> - </referenceBlock> + <referenceContainer name="notifications"> + <block class="Magento\AdminNotification\Block\System\Messages" name="system_messages" as="system_messages" before="-" template="Magento_AdminNotification::system/messages.phtml"/> + <block class="Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup" name="unread_system_messages" as="unread_system_messages" after="system_messages" template="Magento_AdminNotification::system/messages/popup.phtml"/> + <block class="Magento\AdminNotification\Block\Window" name="notification_window" as="notification_window" acl="Magento_AdminNotification::show_toolbar" template="notification/window.phtml"/> + </referenceContainer> <referenceBlock name="header"> <block class="Magento\AdminNotification\Block\ToolbarEntry" template="toolbar_entry.phtml" before="-"/> </referenceBlock> <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-core-prototype-magento-css"> + <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminnotification-toolbar-entry-js" after="jquery-jquery-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Core::prototype/magento.css</argument> + <argument name="file" xsi:type="string">Magento_AdminNotification::toolbar_entry.js</argument> </arguments> </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminnotification-toolbar-entry-js"> + <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminnotification-system-notification-js" after="jquery-jquery-js"> <arguments> - <argument name="file" xsi:type="string">Magento_AdminNotification::toolbar_entry.js</argument> + <argument name="file" xsi:type="string">Magento_AdminNotification::system/notification.js</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Css" name="magento-core-prototype-magento-css"> + <arguments> + <argument name="file" xsi:type="string">Magento_Core::prototype/magento.css</argument> </arguments> </block> </referenceBlock> diff --git a/app/code/Magento/Authorizenet/view/frontend/directpost/form.phtml b/app/code/Magento/Authorizenet/view/frontend/directpost/form.phtml index b2d202315fc..4c65ada1da4 100644 --- a/app/code/Magento/Authorizenet/view/frontend/directpost/form.phtml +++ b/app/code/Magento/Authorizenet/view/frontend/directpost/form.phtml @@ -56,7 +56,7 @@ $_orderUrl = $this->helper('Magento\Authorizenet\Helper\Data')->getPlaceOrderFro <div class="field required number"> <label for="<?php echo $_code ?>_cc_number" class="label"><span><?php echo __('Credit Card Number') ?></span></label> <div class="control"> - <input type="text" id="<?php echo $_code ?>_cc_number" data-container="cc-number" name="payment[cc_number]" title="<?php echo __('Credit Card Number') ?>" class="input-text" value="" data-validate='{required:true, "validate-cc-number":"#<?php echo $_code ?>_cc_type", "validate-cc-type":"#<?php echo $_code ?>_cc_type"}' autocomplete="off"/> + <input type="number" id="<?php echo $_code ?>_cc_number" data-container="cc-number" name="payment[cc_number]" title="<?php echo __('Credit Card Number') ?>" class="input-text" value="" data-validate='{required:true, "validate-cc-number":"#<?php echo $_code ?>_cc_type", "validate-cc-type":"#<?php echo $_code ?>_cc_type"}' autocomplete="off"/> </div> </div> <div class="field required date" id="<?php echo $_code ?>_cc_type_exp_div"> @@ -90,7 +90,7 @@ $_orderUrl = $this->helper('Magento\Authorizenet\Helper\Data')->getPlaceOrderFro <div class="field required cvv" id="<?php echo $_code ?>_cc_type_cvv_div"> <label for="<?php echo $_code ?>_cc_cid" class="label"><span><?php echo __('Card Verification Number') ?></span></label> <div class="control"> - <input type="text" title="<?php echo __('Card Verification Number') ?>" data-container="cc-cvv" class="input-text cvv" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" data-validate='{required:true, "validate-cc-cvn":"#<?php echo $_code ?>_cc_type"}' autocomplete="off"/> + <input type="number" title="<?php echo __('Card Verification Number') ?>" data-container="cc-cvv" class="input-text cvv" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" data-validate='{required:true, "validate-cc-cvn":"#<?php echo $_code ?>_cc_type"}' autocomplete="off"/> <div class="note"> <a href="#" id="directpost-cvv-what-is-this" class="action cvv" data-mage-init='{toggleAdvanced: {toggleContainers:"#directpost-tool-tip"}}'><span><?php echo __('What is this?') ?></span></a> </div> diff --git a/app/code/Magento/Backend/App/AbstractAction.php b/app/code/Magento/Backend/App/AbstractAction.php index 3628ae730a2..33a91d89cfc 100644 --- a/app/code/Magento/Backend/App/AbstractAction.php +++ b/app/code/Magento/Backend/App/AbstractAction.php @@ -381,23 +381,4 @@ abstract class AbstractAction extends \Magento\App\Action\Action } return true; } - - /** - * Render specified template - * - * @param string $tplName - * @param array $data parameters required by template - */ - protected function _outTemplate($tplName, $data = array()) - { - $this->_view->getLayout()->initMessages(); - $block = $this->_view->getLayout() - ->createBlock('Magento\Backend\Block\Template')->setTemplate("{$tplName}.phtml"); - foreach ($data as $index => $value) { - $block->assign($index, $value); - } - $html = $block->toHtml(); - $this->_objectManager->get('Magento\Core\Model\Translate')->processResponseBody($html); - $this->getResponse()->setBody($html); - } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php index 327a5432a94..65b03db650f 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php @@ -64,7 +64,9 @@ class Storage extends \Magento\Backend\App\Action { session_write_close(); - if (!isset($_REQUEST['storage'])) { + $requestStorage = $this->getRequest()->getParam('storage'); + $requestConnection = $this->getRequest()->getParam('connection'); + if (!isset($requestStorage)) { return; } @@ -80,9 +82,9 @@ class Storage extends \Magento\Backend\App\Action ->setFlagData(array()) ->save(); - $storage = array('type' => (int) $_REQUEST['storage']); - if (isset($_REQUEST['connection']) && !empty($_REQUEST['connection'])) { - $storage['connection'] = $_REQUEST['connection']; + $storage = array('type' => $requestStorage); + if (isset($requestConnection) && !empty($requestConnection)) { + $storage['connection'] = $requestConnection; } try { diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php index 787ec2188c1..3428a47dac3 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php @@ -35,15 +35,23 @@ class Design extends \Magento\Backend\App\Action */ protected $_coreRegistry = null; + /** + * @var \Magento\Core\Filter\Date + */ + protected $dateFilter; + /** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Core\Model\Registry $coreRegistry + * @param \Magento\Core\Filter\Date $dateFilter */ public function __construct( \Magento\Backend\App\Action\Context $context, - \Magento\Core\Model\Registry $coreRegistry + \Magento\Core\Model\Registry $coreRegistry, + \Magento\Core\Filter\Date $dateFilter ) { $this->_coreRegistry = $coreRegistry; + $this->dateFilter = $dateFilter; parent::__construct($context); } @@ -86,7 +94,9 @@ class Design extends \Magento\Backend\App\Action $this->_coreRegistry->register('design', $design); $this->_addContent($this->_view->getLayout()->createBlock('Magento\Backend\Block\System\Design\Edit')); - $this->_addLeft($this->_view->getLayout()->createBlock('Magento\Backend\Block\System\Design\Edit\Tabs', 'design_tabs')); + $this->_addLeft( + $this->_view->getLayout()->createBlock('Magento\Backend\Block\System\Design\Edit\Tabs', 'design_tabs') + ); $this->_view->renderLayout(); } @@ -95,6 +105,7 @@ class Design extends \Magento\Backend\App\Action { $data = $this->getRequest()->getPost(); if ($data) { + $data['design'] = $this->_filterPostData($data['design']); $id = (int) $this->getRequest()->getParam('id'); $design = $this->_objectManager->create('Magento\Core\Model\Design'); @@ -143,4 +154,18 @@ class Design extends \Magento\Backend\App\Action { return $this->_authorization->isAllowed('Magento_Adminhtml::design'); } + + /** + * Filtering posted data. Converting localized data if needed + * + * @param array + * @return array + */ + protected function _filterPostData($data) + { + $inputFilter = new \Zend_Filter_Input( + array('date_from' => $this->dateFilter, 'date_to' => $this->dateFilter), array(), $data); + $data = $inputFilter->getUnescaped(); + return $data; + } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index fb27a38d8f4..94acf1592ff 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -255,7 +255,7 @@ class Store extends \Magento\Backend\App\Action $this->_redirect('adminhtml/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->messageManager->addMessages($e->getMessages()); + $this->messageManager->addError($e->getMessage()); $this->_getSession()->setPostData($postData); } catch (\Exception $e) { $this->messageManager->addException($e, __('An error occurred while saving. Please review the error log.')); diff --git a/app/code/Magento/Backend/Model/Auth/Session.php b/app/code/Magento/Backend/Model/Auth/Session.php index 9b21e4e7d35..521343315ce 100644 --- a/app/code/Magento/Backend/Model/Auth/Session.php +++ b/app/code/Magento/Backend/Model/Auth/Session.php @@ -29,6 +29,13 @@ namespace Magento\Backend\Model\Auth; /** * Backend Auth session model * + * @method \Magento\User\Model\User|null getUser() + * @method \Magento\Backend\Model\Auth\Session setUser(\Magento\User\Model\User $value) + * @method \Magento\Acl|null getAcl() + * @method \Magento\Backend\Model\Auth\Session setAcl(\Magento\Acl $value) + * @method int getUpdatedAt() + * @method \Magento\Backend\Model\Auth\Session setUpdatedAt(int $value) + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @todo implement solution that keeps is_first_visit flag in session during redirects */ diff --git a/app/code/Magento/Backend/view/adminhtml/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/admin/login.phtml index af9150cbc89..d54559f710f 100644 --- a/app/code/Magento/Backend/view/adminhtml/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/admin/login.phtml @@ -68,7 +68,7 @@ <div id="messages" data-container-for="messages"> <?php echo $this->getLayout()->getMessagesBlock()->getGroupedHtml() ?> </div> - <form method="post" action="" id="login-form"> + <form method="post" action="" id="login-form" autocomplete="off"> <fieldset class="fieldset"> <legend class="legend"><span><?php echo __('Welcome') ?></span></legend><br/> <input name="form_key" type="hidden" value="<?php echo $this->getFormKey() ?>" /> @@ -81,6 +81,8 @@ <div class="field field-password"> <label for="login" class="label"><?php echo __('Password:') ?></label> <div class="control"> + <!-- This is a dummy hidden field to trick firefox from auto filling the password --> + <input type="text" class="input-text no-display" name="dummy" id="dummy" /> <input type="password" id="login" name="login[password]" class="required-entry input-text" value="" placeholder="password" /> </div> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/layout/default.xml b/app/code/Magento/Backend/view/adminhtml/layout/default.xml index 488e6e96e74..506f5802066 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/default.xml @@ -279,6 +279,7 @@ <block class="Magento\Backend\Block\Page\Header" name="header" as="header"> <block class="Magento\Backend\Block\GlobalSearch" as="search" acl="Magento_Adminhtml::global_search"/> </block> + <container name="notifications" as="notifications" label="Notifications"/> <block class="Magento\Backend\Block\Widget\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/> <!--<update handle="formkey"/> this won't work, see the try/catch and a jammed exception in \Magento\Core\Model\Layout::createBlock() --> <block class="Magento\Backend\Block\Admin\Formkey" name="formkey" as="formkey" template="Magento_Backend::admin/formkey.phtml"/> diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/system/storage/media/synchronize.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/system/storage/media/synchronize.phtml index f450da745e7..9bb2c8e64fa 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/system/storage/media/synchronize.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/system/storage/media/synchronize.phtml @@ -32,10 +32,6 @@ jQuery.mage.extend('validation', 'validation', '<?php echo $this->getViewFileUrl('Magento_Backend::system/validation-rules.js'); ?>'); - defaultValues = []; - defaultValues['system_media_storage_configuration_media_storage'] = $('system_media_storage_configuration_media_storage').value; - defaultValues['system_media_storage_configuration_media_database'] = $('system_media_storage_configuration_media_database').value; - allowedStorages = []; addAllowedStorage( $('system_media_storage_configuration_media_storage').value, @@ -45,6 +41,10 @@ <?php $syncStorageParams = $this->getSyncStorageParams() ?> addAllowedStorage(<?php echo $syncStorageParams['storage_type'] ?>, '<?php echo $syncStorageParams['connection_name'] ?>'); + defaultValues = []; + defaultValues['system_media_storage_configuration_media_storage'] = $('system_media_storage_configuration_media_storage').value; + defaultValues['system_media_storage_configuration_media_database'] = $('system_media_storage_configuration_media_database').value; + function getConnectionName(storageType, connection) { if (storageType == 0) { @@ -63,6 +63,8 @@ if (storage != '' && !allowedStorages.include(storage)) { allowedStorages.push(storage); } + $('system_media_storage_configuration_media_storage').value = storageType; + $('system_media_storage_configuration_media_database').value = connection; } function checkButtonState(event) { @@ -77,7 +79,6 @@ $('system_media_storage_configuration_media_storage').value, $('system_media_storage_configuration_media_database').value ); - if (defaultStorage != storage) { enableSyncButton(); } else { 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 0db6c9ec5fe..db4e19690b2 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 @@ -151,7 +151,7 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price /** * Collect selected options * - * @return void + * @return mixed */ protected function _getSelectedOptions() { @@ -183,9 +183,9 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price { $selectedOptions = $this->_getSelectedOptions(); if (is_numeric($selectedOptions)) { - return ($selection->getSelectionId() == $this->_getSelectedOptions()); + return ($selection->getSelectionId() == $selectedOptions); } elseif (is_array($selectedOptions) && !empty($selectedOptions)) { - return in_array($selection->getSelectionId(), $this->_getSelectedOptions()); + return in_array($selection->getSelectionId(), $selectedOptions); } elseif ($selectedOptions == 'None') { return false; } else { @@ -322,4 +322,16 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price return $formated; } + + /** + * Clear selected option when setting new option + * + * @param \Magento\Bundle\Model\Option $option + * @return mixed + */ + public function setOption(\Magento\Bundle\Model\Option $option) + { + $this->_selectedOptions = null; + return parent::setOption($option); + } } diff --git a/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php index 90af8f4d193..fe3c60dca0c 100644 --- a/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php +++ b/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php @@ -24,6 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +$installer = $this; + /** @var $this \Magento\Catalog\Model\Resource\Setup */ $installFile = __DIR__ . '/upgrade-1.6.0.0-1.6.0.0.1.php'; diff --git a/app/code/Magento/Bundle/view/frontend/catalog/product/view/type/bundle/option/radio.phtml b/app/code/Magento/Bundle/view/frontend/catalog/product/view/type/bundle/option/radio.phtml index c808e6c31c4..b7fc1b41984 100644 --- a/app/code/Magento/Bundle/view/frontend/catalog/product/view/type/bundle/option/radio.phtml +++ b/app/code/Magento/Bundle/view/frontend/catalog/product/view/type/bundle/option/radio.phtml @@ -80,7 +80,7 @@ <input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" - type="text" + type="number" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/> </div> diff --git a/app/code/Magento/Bundle/view/frontend/catalog/product/view/type/bundle/option/select.phtml b/app/code/Magento/Bundle/view/frontend/catalog/product/view/type/bundle/option/select.phtml index 52801328c7f..e9e1a9d02c3 100644 --- a/app/code/Magento/Bundle/view/frontend/catalog/product/view/type/bundle/option/select.phtml +++ b/app/code/Magento/Bundle/view/frontend/catalog/product/view/type/bundle/option/select.phtml @@ -62,7 +62,7 @@ <input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" - type="text" + type="number" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/> </div> diff --git a/app/code/Magento/Bundle/view/frontend/rss/catalog/product/price.phtml b/app/code/Magento/Bundle/view/frontend/rss/catalog/product/price.phtml index e8ab7745d80..60c1e8ad997 100644 --- a/app/code/Magento/Bundle/view/frontend/rss/catalog/product/price.phtml +++ b/app/code/Magento/Bundle/view/frontend/rss/catalog/product/price.phtml @@ -32,7 +32,11 @@ ?> <?php $_product = $this->getProduct() ?> -<?php list($_minimalPrice, $_maximalPrice) = $_product->getPriceModel()->getPrices($_product) ?> +<?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; ?> diff --git a/app/code/Magento/Captcha/Model/ModelInterface.php b/app/code/Magento/Captcha/Model/ModelInterface.php index 0c8b5bdd658..d969e5540ee 100644 --- a/app/code/Magento/Captcha/Model/ModelInterface.php +++ b/app/code/Magento/Captcha/Model/ModelInterface.php @@ -42,7 +42,7 @@ interface ModelInterface * * @abstract * @param string $word - * @return void + * @return bool */ public function isCorrect($word); diff --git a/app/code/Magento/Captcha/Model/Observer.php b/app/code/Magento/Captcha/Model/Observer.php index 59105886db4..55b78ec3464 100644 --- a/app/code/Magento/Captcha/Model/Observer.php +++ b/app/code/Magento/Captcha/Model/Observer.php @@ -93,6 +93,11 @@ class Observer */ protected $messageManager; + /** + * @var \Magento\App\Response\RedirectInterface + */ + protected $redirect; + /** * @param Resource\LogFactory $resLogFactory * @param \Magento\Session\SessionManagerInterface $session @@ -104,6 +109,9 @@ class Observer * @param \Magento\App\RequestInterface $request * @param \Magento\App\ActionFlag $actionFlag * @param \Magento\Message\ManagerInterface $messageManager + * @param \Magento\App\Response\RedirectInterface $redirect + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Captcha\Model\Resource\LogFactory $resLogFactory, @@ -115,7 +123,8 @@ class Observer \Magento\Core\Model\Url $urlManager, \Magento\App\RequestInterface $request, \Magento\App\ActionFlag $actionFlag, - \Magento\Message\ManagerInterface $messageManager + \Magento\Message\ManagerInterface $messageManager, + \Magento\App\Response\RedirectInterface $redirect ) { $this->_resLogFactory = $resLogFactory; $this->_session = $session; @@ -127,6 +136,7 @@ class Observer $this->_request = $request; $this->_actionFlag = $actionFlag; $this->messageManager = $messageManager; + $this->redirect = $redirect; } /** @@ -145,7 +155,7 @@ class Observer if (!$captchaModel->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) { $this->messageManager->addError(__('Incorrect CAPTCHA')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); - $controller->getResponse()->setRedirect($this->_urlManager->getUrl('*/*/forgotpassword')); + $this->redirect->redirect($controller->getResponse(), '*/*/forgotpassword'); } } return $this; @@ -161,11 +171,12 @@ class Observer $formId = 'contact_us'; $captcha = $this->_helper->getCaptcha($formId); if ($captcha->isRequired()) { + /** @var \Magento\App\Action\Action $controller */ $controller = $observer->getControllerAction(); if (!$captcha->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) { $this->messageManager->addError(__('Incorrect CAPTCHA.')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); - $controller->getResponse()->setRedirect($this->_urlManager->getUrl('contacts/index/index')); + $this->redirect->redirect($controller->getResponse(), 'contacts/index/index'); } } } @@ -209,12 +220,14 @@ class Observer $formId = 'user_create'; $captchaModel = $this->_helper->getCaptcha($formId); if ($captchaModel->isRequired()) { + /** @var \Magento\App\Action\Action $controller */ $controller = $observer->getControllerAction(); if (!$captchaModel->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) { $this->messageManager->addError(__('Incorrect CAPTCHA')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); $this->_session->setCustomerFormData($controller->getRequest()->getPost()); - $controller->getResponse()->setRedirect($this->_urlManager->getUrl('*/*/create')); + $url = $this->_urlManager->getUrl('*/*/create', array('_nosecret' => true)); + $controller->getResponse()->setRedirect($this->redirect->error($url)); } } return $this; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php index b336778eadc..06eaf262645 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php @@ -43,6 +43,11 @@ class NewCategory extends \Magento\Backend\Block\Widget\Form\Generic */ protected $_jsonEncoder; + /** + * @var \Magento\Catalog\Model\CategoryFactory + */ + protected $_categoryFactory; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder @@ -60,9 +65,9 @@ class NewCategory extends \Magento\Backend\Block\Widget\Form\Generic array $data = array() ) { $this->_jsonEncoder = $jsonEncoder; + $this->_categoryFactory = $categoryFactory; parent::__construct($context, $registry, $formFactory, $data); $this->setUseContainer(true); - $this->_categoryFactory = $categoryFactory; } /** @@ -119,9 +124,13 @@ class NewCategory extends \Magento\Backend\Block\Widget\Form\Generic ->load() ->getItems(); - return count($items) === 2 - ? array($items[2]->getEntityId() => $items[2]->getName()) - : array(); + $result = array(); + if (count($items) === 2) { + $item = array_pop($items); + $result = array($item->getEntityId() => $item->getName()); + } + + return $result; } /** diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 34a53c8ee89..49ae70c1748 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -87,7 +87,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template * @var \Magento\Core\Model\Registry */ protected $_coreRegistry = null; - + /** * Catalog data * @@ -152,7 +152,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template * @param \Magento\Theme\Helper\Layout $layoutHelper * @param \Magento\Catalog\Helper\Image $imageHelper * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -399,6 +399,11 @@ abstract class AbstractProduct extends \Magento\View\Element\Template return $this->getData('product'); } + /** + * Retrieve tier price template + * + * @return string + */ public function getTierPriceTemplate() { if (!$this->hasData('tier_price_template')) { @@ -407,6 +412,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template return $this->getData('tier_price_template'); } + /** * Returns product tier price block html * @@ -421,7 +427,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template return $this->_getPriceBlock($product->getTypeId()) ->setTemplate($this->getTierPriceTemplate()) ->setProduct($product) - ->setInGrouped($this->getProduct()->isGrouped()) + ->setInGrouped($product->isGrouped()) ->toHtml(); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php index dc4f438ecfc..57f017a95aa 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php @@ -169,7 +169,7 @@ class Review extends \Magento\Backend\App\Action $nextId = (int) $this->getRequest()->getParam('next_item'); $url = $this->getUrl($this->getRequest()->getParam('ret') == 'pending' ? '*/*/pending' : '*/*/'); if ($nextId) { - $url = $this->getUrl('adminhtml/*/edit', array('id' => $nextId)); + $url = $this->getUrl('catalog/*/edit', array('id' => $nextId)); } return $this->getResponse()->setRedirect($url); } @@ -186,9 +186,9 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The review has been deleted.')); if( $this->getRequest()->getParam('ret') == 'pending' ) { - $this->getResponse()->setRedirect($this->getUrl('adminhtml/*/pending')); + $this->getResponse()->setRedirect($this->getUrl('catalog/*/pending')); } else { - $this->getResponse()->setRedirect($this->getUrl('adminhtml/*/')); + $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); } return; } catch (\Magento\Core\Exception $e) { diff --git a/app/code/Magento/Catalog/Controller/Product/Compare.php b/app/code/Magento/Catalog/Controller/Product/Compare.php index 13521974c5c..180865bc597 100644 --- a/app/code/Magento/Catalog/Controller/Product/Compare.php +++ b/app/code/Magento/Catalog/Controller/Product/Compare.php @@ -101,6 +101,11 @@ class Compare extends \Magento\App\Action\Action */ protected $_storeManager; + /** + * @var \Magento\Core\App\Action\FormKeyValidator + */ + protected $_formKeyValidator; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Customer\Model\CustomerFactory $customerFactory @@ -123,7 +128,8 @@ class Compare extends \Magento\App\Action\Action \Magento\Log\Model\Visitor $logVisitor, \Magento\Catalog\Model\Product\Compare\ListCompare $catalogProductCompareList, \Magento\Catalog\Model\Session $catalogSession, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\App\Action\FormKeyValidator $formKeyValidator ) { $this->_storeManager = $storeManager; $this->_customerFactory = $customerFactory; @@ -134,6 +140,7 @@ class Compare extends \Magento\App\Action\Action $this->_logVisitor = $logVisitor; $this->_catalogProductCompareList = $catalogProductCompareList; $this->_catalogSession = $catalogSession; + $this->_formKeyValidator = $formKeyValidator; parent::__construct($context); } @@ -168,6 +175,11 @@ class Compare extends \Magento\App\Action\Action */ public function addAction() { + if (!$this->_formKeyValidator->validate($this->getRequest())) { + $this->getResponse()->setRedirect($this->_redirect->getRefererUrl()); + return; + } + $productId = (int)$this->getRequest()->getParam('product'); if ($productId && ($this->_logVisitor->getId() diff --git a/app/code/Magento/Catalog/Helper/Product/Compare.php b/app/code/Magento/Catalog/Helper/Product/Compare.php index e73f82973e7..1c1b1677360 100644 --- a/app/code/Magento/Catalog/Helper/Product/Compare.php +++ b/app/code/Magento/Catalog/Helper/Product/Compare.php @@ -96,6 +96,11 @@ class Compare extends \Magento\Core\Helper\Url */ protected $_itemCollectionFactory; + /** + * @var \Magento\Data\Form\FormKey + */ + protected $_formKey; + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -104,6 +109,7 @@ class Compare extends \Magento\Core\Helper\Url * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Session $catalogSession + * @param \Magento\Data\Form\FormKey $formKey */ public function __construct( \Magento\App\Helper\Context $context, @@ -112,13 +118,15 @@ class Compare extends \Magento\Core\Helper\Url \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, - \Magento\Catalog\Model\Session $catalogSession + \Magento\Catalog\Model\Session $catalogSession, + \Magento\Data\Form\FormKey $formKey ) { $this->_itemCollectionFactory = $itemCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_logVisitor = $logVisitor; $this->_customerSession = $customerSession; $this->_catalogSession = $catalogSession; + $this->_formKey = $formKey; parent::__construct($context, $storeManager); } @@ -152,7 +160,8 @@ class Compare extends \Magento\Core\Helper\Url { return array( 'product' => $product->getId(), - \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl() + \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl(), + 'form_key' => $this->_formKey->getFormKey(), ); } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php index 2a77459993f..fb1ff9e0924 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php @@ -34,9 +34,6 @@ namespace Magento\Catalog\Model\Layer\Filter; -/** - * @SuppressWarnings(PHPMD.LongVariable) - */ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter { /** @@ -79,7 +76,7 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * * @var \Magento\Catalog\Model\Layer\Filter\Price\Algorithm */ - protected $_catalogLayerFilterPriceAlgorithm; + protected $_priceAlgorithm; /** * Customer session @@ -94,7 +91,7 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * @param \Magento\Catalog\Model\Layer $catalogLayer * @param \Magento\Catalog\Model\Resource\Layer\Filter\PriceFactory $filterPriceFactory * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $catalogLayerFilterPriceAlgorithm + * @param \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $priceAlgorithm * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data */ @@ -104,13 +101,13 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Catalog\Model\Resource\Layer\Filter\PriceFactory $filterPriceFactory, \Magento\Customer\Model\Session $customerSession, - \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $catalogLayerFilterPriceAlgorithm, + \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $priceAlgorithm, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_resource = $filterPriceFactory->create(); $this->_customerSession = $customerSession; - $this->_catalogLayerFilterPriceAlgorithm = $catalogLayerFilterPriceAlgorithm; + $this->_priceAlgorithm = $priceAlgorithm; $this->_coreRegistry = $coreRegistry; parent::__construct($filterItemFactory, $storeManager, $catalogLayer, $data); $this->_requestVar = 'price'; @@ -289,7 +286,7 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter ) { return array(); } - $this->_catalogLayerFilterPriceAlgorithm->setPricesModel($this)->setStatistics( + $this->_priceAlgorithm->setPricesModel($this)->setStatistics( $collection->getMinPrice(), $collection->getMaxPrice(), $collection->getPriceStandardDeviation(), @@ -300,11 +297,11 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter if ($appliedInterval[0] == $appliedInterval[1] || $appliedInterval[1] === '0') { return array(); } - $this->_catalogLayerFilterPriceAlgorithm->setLimits($appliedInterval[0], $appliedInterval[1]); + $this->_priceAlgorithm->setLimits($appliedInterval[0], $appliedInterval[1]); } $items = array(); - foreach ($this->_catalogLayerFilterPriceAlgorithm->calculateSeparators() as $separator) { + foreach ($this->_priceAlgorithm->calculateSeparators() as $separator) { $items[] = array( 'label' => $this->_renderRangeLabel($separator['from'], $separator['to']), 'value' => (($separator['from'] == 0) ? '' : $separator['from']) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php index 37aade372f5..01a4cb89aba 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php @@ -199,8 +199,6 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $value['images'] = array(); } - - $clearImages = array(); $newImages = array(); $existImages = array(); @@ -226,7 +224,8 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend continue; } $duplicate[$image['value_id']] = $this->_copyImage($image['file']); - $newImages[$image['file']] = $duplicate[$image['value_id']]; + $image['new_file'] = $duplicate[$image['value_id']]; + $newImages[$image['file']] = $image; } $value['duplicate'] = $duplicate; diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index e61902ac18c..1735a8b6a68 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -506,7 +506,7 @@ abstract class AbstractType try { $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT)->create($path); - } catch (\Magento\Filesystem\Exception $e) { + } catch (\Magento\Filesystem\FilesystemException $e) { throw new \Magento\Core\Exception( __("We can't create writeable directory \"%1\".", $path) ); diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php index 3ebf8306126..6b3bb79d076 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php @@ -1321,17 +1321,17 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource */ public function getParentDesignCategory($category) { - $adapter = $this->_getReadAdapter(); - $levelField = $adapter->quoteIdentifier('level'); - $pathIds = array_reverse($category->getPathIds()); - $select = $adapter->select() - ->from(array('main_table' => $this->getMainStoreTable($category->getStoreId())), '*') - ->where('entity_id IN (?)', $pathIds) - ->where('custom_use_parent_settings = ?', 0) - ->where($levelField . ' != ?', 0) - ->order('level ' . \Magento\DB\Select::SQL_DESC); - $result = $adapter->fetchRow($select); - return $this->_categoryFactory->create()->setData($result); + $pathIds = array_reverse($category->getPathIds()); + $collection = clone $category->getCollection(); + $collection + ->setMainTable($this->getMainStoreTable($category->getStoreId())) + ->addFieldToSelect('*') + ->addFieldToFilter('entity_id', array('in' => $pathIds)) + ->addFieldToFilter('custom_use_parent_settings', array(array('eq' => 0), array('null' => 0))) + ->addFieldToFilter('level', array('neq' => 0)) + ->setOrder('level', 'DESC') + ->load(); + return $collection->getFirstItem(); } /** diff --git a/app/code/Magento/Catalog/Model/Url.php b/app/code/Magento/Catalog/Model/Url.php index e6f87519f2d..34f65d92147 100644 --- a/app/code/Magento/Catalog/Model/Url.php +++ b/app/code/Magento/Catalog/Model/Url.php @@ -1006,7 +1006,7 @@ class Url */ public function generateUniqueIdPath() { - return str_replace('0.', '', str_replace(' ', '_', microtime())); + return str_replace('.', '_', uniqid(mt_rand(), true)); } /** diff --git a/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php b/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php index 8e4e1b6a959..27c6693a624 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php @@ -24,6 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +$installer = $this; + /** @var $this \Magento\Catalog\Model\Resource\Setup */ $installFile = __DIR__ . '/upgrade-1.6.0.0.8-1.6.0.0.9.php'; diff --git a/app/code/Magento/Catalog/view/adminhtml/product/product.css b/app/code/Magento/Catalog/view/adminhtml/product/product.css index 205199fc30f..78acac6b140 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/product.css +++ b/app/code/Magento/Catalog/view/adminhtml/product/product.css @@ -484,14 +484,16 @@ .field-price .control, .field-special_price .control, .field-msrp .control, -.field-weight .control { +.field-weight .control, +.field-quantity_and_stock_status .control { position: relative; } .field-price label.mage-error, .field-special_price label.mage-error, .field-msrp label.mage-error, -.field-weight label.mage-error { +.field-weight label.mage-error, +.field-quantity_and_stock_status label.mage-error { position: absolute; left: 0; top: 30px; diff --git a/app/code/Magento/Catalog/view/frontend/product/compare/link.phtml b/app/code/Magento/Catalog/view/frontend/product/compare/link.phtml index b7c2bed5231..ab3f9371ecd 100644 --- a/app/code/Magento/Catalog/view/frontend/product/compare/link.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/compare/link.phtml @@ -26,13 +26,13 @@ <?php $_helper = $this->helper('Magento\Catalog\Helper\Product\Compare'); $_items = $_helper->getItemCount() > 0 ? $_helper->getItemCollection() : null; +$count = $_helper->getItemCount(); ?> -<?php if($_helper->getItemCount() > 0): ?> +<?php if($count > 0): ?> <li class="item link compare"> <a class="action compare" href="<?php echo $_helper->getListUrl() ?>" title="<?php echo __('Compare Products') ?>"> - <span> - <?php echo __('Compare Products') ?><span class="qty"><?php echo __('%1', $_helper->getItemCount()) ?></span> - </span> + <?php echo __('Compare Products') ?> + <span class="counter qty"><?php echo ($count == 1) ? __('1 item') : __('%1 items',$count) ?></span> </a> </li> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml index bc372936753..49de51cf536 100644 --- a/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml @@ -26,13 +26,14 @@ <?php $_helper = $this->helper('Magento\Catalog\Helper\Product\Compare'); $_items = $_helper->getItemCount() > 0 ? $_helper->getItemCollection() : null; +$count = $_helper->getItemCount(); ?> <div class="block compare"> <div class="title"> <strong> <span class="text"><?php echo __('Compare Products') ?></span> - <?php if($_helper->getItemCount() > 0): ?> - <span class="qty"><?php echo __('%1', $_helper->getItemCount()) ?></span> + <?php if($count > 0): ?> + <span class="counter qty"><?php echo ($count == 1) ? __('1 item') : __('%1 items',$count) ?></span> <?php endif; ?> </strong> </div> diff --git a/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml index 8491717db94..e48841a9e4f 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml @@ -30,7 +30,7 @@ <div class="field qty"> <label class="label" for="qty"><span><?php echo __('Qty') ?></span></label> <div class="control"> - <input type="text" + <input type="number" name="qty" id="qty" maxlength="12" diff --git a/app/code/Magento/Catalog/view/frontend/product/view/type/grouped.phtml b/app/code/Magento/Catalog/view/frontend/product/view/type/grouped.phtml index c8eb7a5bef2..89e0949d6a3 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/type/grouped.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/type/grouped.phtml @@ -75,7 +75,7 @@ <td class="col qty"> <?php if ($_item->isSaleable()) : ?> <div class="control qty"> - <input type="text" name="super_group[<?php echo $_item->getId() ?>]" + <input type="number" name="super_group[<?php echo $_item->getId() ?>]" maxlength="12" value="<?php echo $_item->getQty() * 1 ?>" title="<?php echo __('Qty') ?>" diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php index e98e60c5b01..8b2e34dbec8 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php @@ -391,7 +391,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb if ($storeId === null && $productIds === null) { // Keeping public interface $adapter->update($this->getTable('catalogsearch_query'), array('is_processed' => 0)); - $adapter->truncateTable($this->getTable('catalogsearch_result')); + $adapter->delete($this->getTable('catalogsearch_result')); $this->_eventManager->dispatch('catalogsearch_reset_search_result'); } else { // Optimized deletion only product-related records diff --git a/app/code/Magento/CatalogSearch/view/frontend/advanced/result.phtml b/app/code/Magento/CatalogSearch/view/frontend/advanced/result.phtml index 3938edb1e6d..35fa8b7e7ca 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/advanced/result.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/advanced/result.phtml @@ -22,9 +22,13 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php if($this->getResultCount()): ?> +<?php if($results = $this->getResultCount()): ?> <div class="search found"> - <?php echo __('<strong>%1 item(s)</strong> were found using the following search criteria', $this->getResultCount()); ?> + <?php if ($results == 1) : ?> + <?php echo __('<strong>%1 item</strong> were found using the following search criteria', $results); ?> + <?php else: ?> + <?php echo __('<strong>%1 items</strong> were found using the following search criteria', $results); ?> + <?php endif; ?> </div> <?php else: ?> <div class="message error"> diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml index 6845a1111a9..3e0375e6eac 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml @@ -34,7 +34,7 @@ <argument name="path" xsi:type="string">catalogsearch/term/popular</argument> </arguments> </block> - <block class="Magento\View\Element\Html\Link\Current" ifconfig="catalog/seo/search_terms" name="catalog-search-advanced-link"> + <block class="Magento\View\Element\Html\Link\Current" name="catalog-search-advanced-link"> <arguments> <argument name="label" xsi:type="string">Advanced Search</argument> <argument name="path" xsi:type="string">catalogsearch/advanced</argument> diff --git a/app/code/Magento/Centinel/Model/Service.php b/app/code/Magento/Centinel/Model/Service.php index 16325bc0684..f73402df1e9 100644 --- a/app/code/Magento/Centinel/Model/Service.php +++ b/app/code/Magento/Centinel/Model/Service.php @@ -55,18 +55,11 @@ class Service extends \Magento\Object ); /** - * Is API model configured - * - * @var bool - */ - protected $_isConfigured = false; - - /** - * Validation api model + * Validation api model factory * * @var \Magento\Centinel\Model\Api */ - protected $_api; + protected $_apiFactory; /** * Config @@ -115,7 +108,7 @@ class Service extends \Magento\Object /** * @param \Magento\Centinel\Model\Config $config - * @param \Magento\Centinel\Model\Api $api + * @param \Magento\Centinel\Model\ApiFactory $apiFactory * @param \Magento\UrlInterface $url * @param \Magento\Session\SessionManagerInterface $centinelSession * @param \Magento\Centinel\Model\StateFactory $stateFactory @@ -125,7 +118,7 @@ class Service extends \Magento\Object */ public function __construct( \Magento\Centinel\Model\Config $config, - \Magento\Centinel\Model\Api $api, + \Magento\Centinel\Model\ApiFactory $apiFactory, \Magento\UrlInterface $url, \Magento\Session\SessionManagerInterface $centinelSession, \Magento\Centinel\Model\StateFactory $stateFactory, @@ -134,7 +127,7 @@ class Service extends \Magento\Object array $data = array() ) { $this->_config = $config; - $this->_api = $api; + $this->_apiFactory = $apiFactory; $this->_url = $url; $this->_centinelSession = $centinelSession; $this->_stateFactory = $stateFactory; @@ -195,20 +188,16 @@ class Service extends \Magento\Object */ protected function _getApi() { - if ($this->_isConfigured) { - return $this->_api; - } - $config = $this->_getConfig(); - $this->_api + $api = $this->_apiFactory->create(); + $api ->setProcessorId($config->getProcessorId()) ->setMerchantId($config->getMerchantId()) ->setTransactionPwd($config->getTransactionPwd()) ->setIsTestMode($config->getIsTestMode()) ->setDebugFlag($config->getDebugFlag()) ->setApiEndpointUrl($this->getCustomApiEndpointUrl()); - $this->_isConfigured = true; - return $this->_api; + return $api; } /** @@ -361,7 +350,6 @@ class Service extends \Magento\Object public function reset() { $this->_resetValidationState(); - $this->_api = null; return $this; } diff --git a/app/code/Magento/Centinel/view/frontend/authentication.phtml b/app/code/Magento/Centinel/view/frontend/authentication.phtml index 43ce26d12e9..68ea7051903 100644 --- a/app/code/Magento/Centinel/view/frontend/authentication.phtml +++ b/app/code/Magento/Centinel/view/frontend/authentication.phtml @@ -29,7 +29,7 @@ <h3><?php echo __('Card Verification')?></h3> <p><?php echo __('Please verify the card with the issuer bank:') ?></p> <div class="authentication"> - <iframe id="centinel-authenticate-iframe" frameborder="0" border="0" src="" data-container="iframe"></iframe> + <iframe id="centinel-authenticate-iframe" frameborder="0" border="0" src="" data-container="iframe" width="100%" height="400" title="<?php echo __('Card Verification')?>"></iframe> </div> </div> <?php else:?> diff --git a/app/code/Magento/Checkout/Block/Cart/Link.php b/app/code/Magento/Checkout/Block/Cart/Link.php index e8dfbcdefe9..41e001f12a8 100644 --- a/app/code/Magento/Checkout/Block/Cart/Link.php +++ b/app/code/Magento/Checkout/Block/Cart/Link.php @@ -105,7 +105,7 @@ class Link extends \Magento\View\Element\Html\Link protected function _createLabel($count) { if ($count == 1) { - return __('My Cart (%1 item)', $count); + return __('My Cart (1 item)'); } elseif ($count > 0) { return __('My Cart (%1 items)', $count); } else { diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment.php b/app/code/Magento/Checkout/Block/Onepage/Payment.php index 9b610571400..6c49c96fe56 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Payment.php +++ b/app/code/Magento/Checkout/Block/Onepage/Payment.php @@ -54,4 +54,14 @@ class Payment extends \Magento\Checkout\Block\Onepage\AbstractOnepage { return (float)$this->getQuote()->getBaseGrandTotal(); } + + /** + * Check whether the quote has recurring items + * + * @return bool + */ + public function hasRecurringItems() + { + return $this->getQuote()->hasRecurringItems(); + } } diff --git a/app/code/Magento/Checkout/Block/Onepage/Success.php b/app/code/Magento/Checkout/Block/Onepage/Success.php index c8139e46cc1..10c00be0c73 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Success.php +++ b/app/code/Magento/Checkout/Block/Onepage/Success.php @@ -56,7 +56,7 @@ class Success extends \Magento\View\Element\Template protected $_agreementFactory; /** - * @var \Magento\Sales\Model\Resource\Recurring\Profile\Collection + * @var \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory */ protected $_recurringProfileCollectionFactory; diff --git a/app/code/Magento/Checkout/Controller/Cart.php b/app/code/Magento/Checkout/Controller/Cart.php index b20c725d99c..bbef85ec762 100644 --- a/app/code/Magento/Checkout/Controller/Cart.php +++ b/app/code/Magento/Checkout/Controller/Cart.php @@ -49,22 +49,25 @@ class Cart protected $_storeManager; /** - * @var \Magento\Message\ManagerInterface + * @var \Magento\Core\App\Action\FormKeyValidator */ - protected $messageManager; + protected $_formKeyValidator; /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator */ public function __construct( \Magento\App\Action\Context $context, \Magento\Core\Model\Store\ConfigInterface $storeConfig, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\App\Action\FormKeyValidator $formKeyValidator ) { + $this->_formKeyValidator = $formKeyValidator; $this->_storeConfig = $storeConfig; $this->_checkoutSession = $checkoutSession; $this->_storeManager = $storeManager; @@ -418,6 +421,11 @@ class Cart */ public function updatePostAction() { + if (!$this->_formKeyValidator->validate($this->getRequest())) { + $this->_redirect('*/*/'); + return; + } + $updateAction = (string)$this->getRequest()->getParam('update_cart_action'); switch ($updateAction) { diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 531760bba5f..9ed30be1821 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -208,7 +208,6 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'onepage') { - /* @var $translate \Magento\Core\Model\Translate */ $this->_translator->setTranslateInline(false); /** @var \Magento\Email\Model\Template $mailTemplate */ diff --git a/app/code/Magento/Checkout/view/frontend/cart/form.phtml b/app/code/Magento/Checkout/view/frontend/cart/form.phtml index e139a2d4904..bf96b44470c 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/form.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/form.phtml @@ -28,6 +28,7 @@ <div class="cart table wrapper<?php echo $mergedCells == 2 ? ' detailed' : ''; ?>"> <?php echo $this->getChildHtml('form_before') ?> <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post" id="form-validate" > + <?php echo $this->getBlockHtml('formkey'); ?> <table id="shopping-cart-table" class="cart items data"> <thead> <tr> diff --git a/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml index 1c13b896e14..71990e390b5 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml @@ -31,7 +31,7 @@ <div class="field qty"> <label class="label" for="qty"><span><?php echo __('Qty') ?></span></label> <div class="control"> - <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo __('Qty') ?>" class="input-text qty" data-validate="{required:true,digits:true}"/> + <input type="number" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo __('Qty') ?>" class="input-text qty" data-validate="{required:true,digits:true}"/> </div> </div> <?php endif; ?> diff --git a/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml index faf4f01808d..03148346a55 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml @@ -190,7 +190,7 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite <?php endif; ?> <td class="col qty"> <div class="control qty"> - <input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" type="text" 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> diff --git a/app/code/Magento/Checkout/view/frontend/cart/minicart.phtml b/app/code/Magento/Checkout/view/frontend/cart/minicart.phtml index 6bcc918c8b4..2968b6bd19f 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/minicart.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/minicart.phtml @@ -34,9 +34,7 @@ <?php if (!$this->getIsLinkMode() || !$this->getIsNeedToDisplaySideBar()): ?> <a data-toggle="dropdown" class="action showcart" href="<?php echo $this->getUrl('checkout/cart'); ?>"> <span class="text"><?php echo __('My Cart'); ?></span> - <span class="qty<?php echo ($_cartQty > 0) ? '' : ' empty'; ?>"> - <?php echo $_cartQty ?> - </span> + <span class="counter qty<?php echo ($_cartQty > 0) ? '' : ' empty'; ?>"><?php echo ($_cartQty == 1) ? __('1 item') : __('%1 items',$_cartQty) ?></span> </a> <div data-target="dropdown" class="block minicart<?php echo ($_cartQty > 0) ? '' : ' empty'; ?>"> <button title="<?php echo __('Close'); ?>" type="button" class="action close" data-toggle="dropdown"> diff --git a/app/code/Magento/Checkout/view/frontend/js/opcheckout.js b/app/code/Magento/Checkout/view/frontend/js/opcheckout.js index 501ef6b3c05..2166e022b20 100644 --- a/app/code/Magento/Checkout/view/frontend/js/opcheckout.js +++ b/app/code/Magento/Checkout/view/frontend/js/opcheckout.js @@ -406,7 +406,7 @@ if ($.isNumeric(checkoutPrice)) { this.checkoutPrice = checkoutPrice; } - if (this.checkoutPrice < this.options.minBalance) { + if (this.checkoutPrice < this.options.minBalance && !this.options.hasRecurringItems) { this._disablePaymentMethods(); } else { this._enablePaymentMethods(); @@ -422,7 +422,7 @@ if (data.totalPrice) { data.totalPrice = this.checkoutPrice; } - if (this.checkoutPrice < this.options.minBalance) { + if (this.checkoutPrice < this.options.minBalance && !this.options.hasRecurringItems) { // Add free input field, hide and disable unchecked checkbox payment method and all radio button payment methods this._disablePaymentMethods(); } else { @@ -470,7 +470,7 @@ alert($.mage.__("We can't complete your order because you don't have a payment method available.")); return false; } - if (this.checkoutPrice < this.options.minBalance) { + if (this.checkoutPrice < this.options.minBalance && !this.options.hasRecurringItems) { return true; } else if (methods.filter('input:radio:checked').length) { return true; diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping.xml index 6992a9165dc..47343cd2918 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping.xml @@ -24,12 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Multishipping Checkout" design_abstraction="custom"> - <referenceBlock name="root"> - <action method="setTemplate"> - <argument name="template" xsi:type="string">1column.phtml</argument> - </action> - </referenceBlock> - <referenceContainer name="content"> + <update handle="page_two_columns_left"/> + <referenceContainer name="left"> <block class="Magento\Checkout\Block\Multishipping\State" name="checkout_state" template="multishipping/state.phtml"/> </referenceContainer> </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 79ceb873ba9..871ce71e3d5 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 @@ -24,8 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="page_one_column"/> - <referenceContainer name="content"> + <update handle="page_two_columns_left"/> + <referenceContainer name="left"> <container name="checkout.progress.wrapper" label="Checkout Progress Wrapper" htmlTag="div" htmlId="checkout-progress-wrapper"> <block class="Magento\Checkout\Block\Onepage\Progress" name="checkout.progress" before="-" template="onepage/progress.phtml"/> </container> diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/addresses.phtml b/app/code/Magento/Checkout/view/frontend/multishipping/addresses.phtml index e91a5f250f1..a8af2627430 100644 --- a/app/code/Magento/Checkout/view/frontend/multishipping/addresses.phtml +++ b/app/code/Magento/Checkout/view/frontend/multishipping/addresses.phtml @@ -52,7 +52,7 @@ <td class="col product"><?php echo $this->getItemHtml($_item->getQuoteItem()) ?></td> <td class="col qty"> <div class="control qty"> - <input type="text" name="ship[<?php echo $_index ?>][<?php echo $_item->getQuoteItemId() ?>][qty]" value="<?php echo $this->escapeHtml($_item->getQty()) ?>" size="2" class="input-text qty" data-validate="{number: true}"/> + <input type="number" name="ship[<?php echo $_index ?>][<?php echo $_item->getQuoteItemId() ?>][qty]" value="<?php echo $this->escapeHtml($_item->getQty()) ?>" size="2" class="input-text qty" data-validate="{number: true}"/> </div> </td> <td class="col address"> diff --git a/app/code/Magento/Checkout/view/frontend/onepage.phtml b/app/code/Magento/Checkout/view/frontend/onepage.phtml index de732fa6c42..c10848732f9 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage.phtml @@ -24,6 +24,7 @@ */ ?> <?php +/** @var \Magento\Checkout\Block\Onepage\Payment $_paymentBlock */ $_paymentBlock = $this->getLayout()->getBlock('checkout.onepage.payment'); $_registerParam = $this->getRequest()->getParam('register'); ?> @@ -58,6 +59,7 @@ $_registerParam = $this->getRequest()->getParam('register'); }) .opcheckout({ quoteBaseGrandTotal: <?php echo (float)$_paymentBlock->getQuoteBaseGrandTotal() ?>, + hasRecurringItems: <?php echo $_paymentBlock->hasRecurringItems() ? 'true' : 'false' ?>, progressUrl: '<?php echo $this->getUrl('checkout/onepage/progress') ?>', reviewUrl: '<?php echo $this->getUrl('checkout/onepage/review') ?>', failureUrl: '<?php echo $this->getUrl('checkout/cart') ?>', diff --git a/app/code/Magento/Checkout/view/frontend/onepage/login.phtml b/app/code/Magento/Checkout/view/frontend/onepage/login.phtml index 459243004aa..ca560a15ffd 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage/login.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage/login.phtml @@ -36,6 +36,7 @@ <div class="title"><strong><?php echo __('Login') ?></strong></div> <div class="content"> <form class="form login" id="login-form" action="<?php echo $this->getPostAction() ?>" method="post"> + <?php echo $this->getBlockHtml('formkey'); ?> <fieldset class="fieldset login" data-hasrequired="<?php echo __('* Required Fields') ?>"> <p class="field note"><?php echo __('Already registered?') ?> <?php echo __('Please log in below:') ?></p> <div class="field email required"> diff --git a/app/code/Magento/Connect/view/adminhtml/extension/custom/authors.phtml b/app/code/Magento/Connect/view/adminhtml/extension/custom/authors.phtml index 8c29e53017b..a73f35d9f61 100644 --- a/app/code/Magento/Connect/view/adminhtml/extension/custom/authors.phtml +++ b/app/code/Magento/Connect/view/adminhtml/extension/custom/authors.phtml @@ -28,13 +28,13 @@ var id = 0; var authorTemplate = '<tr>'+ - '<td>'+ + '<td class="col-name">'+ '<input type="text" class="input-text required-entry" name="authors[name][]" id="authors_name_{{id}}" value="{{name}}"/>'+ '</td>'+ - '<td>'+ + '<td class="col-user">'+ '<input type="text" class="input-text required-entry" name="authors[user][]" id="authors_user_{{id}}" value="{{user}}"/>'+ '</td>'+ - '<td>'+ + '<td class="col-email">'+ '<input type="text" class="input-text required-entry validate-email" name="authors[email][]" id="authors_email_{{id}}" value="{{email}}"/>'+ '</td>'+ '<td class="col-delete">'+ @@ -62,12 +62,17 @@ function addAuthor(data) <table class="data-table" cellspacing="0"> <thead> <tr> - <th><?php echo __("Name") ?><span class="required">*</span></th> - <th><?php echo __("User") ?><span class="required">*</span></th> - <th><?php echo __("Email") ?><span class="required">*</span></th> - <th class="col-delete"><?php echo __("Remove") ?><span class="required">*</span></th> + <th class="col-name required"><?php echo __("Name") ?></th> + <th class="col-user required"><?php echo __("User") ?></th> + <th class="col-email required"><?php echo __("Email") ?></th> + <th class="col-delete"><?php echo __("Remove") ?></th> </tr> </thead> + <tfoot> + <tr> + <td colspan="4"><?php echo $this->getAddAuthorButtonHtml() ?></td> + </tr> + </tfoot> <tbody id="authors_container"> <script type="text/javascript"> <?php if (count($this->getAuthors())): ?> @@ -79,11 +84,6 @@ function addAuthor(data) <?php endif;?> </script> </tbody> - <tfoot> - <tr> - <td colspan="4"><?php echo $this->getAddAuthorButtonHtml() ?></td> - </tr> - </tfoot> </table> </div> </fieldset> diff --git a/app/code/Magento/Core/App/Action/Plugin/Session.php b/app/code/Magento/Core/App/Action/Plugin/Session.php index 1801244c661..31d756af8be 100644 --- a/app/code/Magento/Core/App/Action/Plugin/Session.php +++ b/app/code/Magento/Core/App/Action/Plugin/Session.php @@ -147,7 +147,7 @@ class Session */ protected function _forward(\Magento\App\RequestInterface $request) { - $request->initForwared(); + $request->initForward(); $request->setActionName('noCookies'); $request->setControllerName('index'); $request->setModuleName('core'); diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php index 4c45870ff7b..9daf1c3ef3f 100644 --- a/app/code/Magento/Core/Model/App.php +++ b/app/code/Magento/Core/Model/App.php @@ -53,7 +53,7 @@ class App implements \Magento\Core\Model\AppInterface /** * Magento version */ - const VERSION = '2.0.0.0-dev57'; + const VERSION = '2.0.0.0-dev58'; /** @@ -804,7 +804,7 @@ class App implements \Magento\Core\Model\AppInterface 'revision' => '0', 'patch' => '0', 'stability' => 'dev', - 'number' => '57', + 'number' => '58', ); } } diff --git a/app/code/Magento/Core/Model/Config/FileResolver.php b/app/code/Magento/Core/Model/Config/FileResolver.php index ea38c20537b..c553153c886 100644 --- a/app/code/Magento/Core/Model/Config/FileResolver.php +++ b/app/code/Magento/Core/Model/Config/FileResolver.php @@ -64,7 +64,7 @@ class FileResolver implements \Magento\Config\FileResolverInterface $directory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); $iterator = $this->iteratorFactory->create( $directory, - $directory->search('#' . preg_quote($filename) . '$#') + $directory->search('{' . $filename . ',*/' . $filename . '}') ); break; case 'global': diff --git a/app/code/Magento/Core/Model/Design.php b/app/code/Magento/Core/Model/Design.php index e9c9032cbf1..32931ba20de 100644 --- a/app/code/Magento/Core/Model/Design.php +++ b/app/code/Magento/Core/Model/Design.php @@ -74,11 +74,11 @@ class Design extends \Magento\Core\Model\AbstractModel protected $_dateTime; /** - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Core\Model\LocaleInterface $locale + * @param Context $context + * @param Registry $registry + * @param LocaleInterface $locale * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -91,9 +91,9 @@ class Design extends \Magento\Core\Model\AbstractModel \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_locale = $locale; $this->_dateTime = $dateTime; + parent::__construct($context, $registry, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Core/Model/File/Storage.php b/app/code/Magento/Core/Model/File/Storage.php index 3ae3e1f056f..6dc62095d78 100644 --- a/app/code/Magento/Core/Model/File/Storage.php +++ b/app/code/Magento/Core/Model/File/Storage.php @@ -242,7 +242,7 @@ class Storage extends \Magento\Core\Model\AbstractModel 'source' => $sourceModel->getStorageName(), 'destination' => $destinationModel->getStorageName(), 'destination_storage_type' => $storageDest, - 'destination_connection_name' => (string) $destinationModel->getConfigConnectionName(), + 'destination_connection_name' => (string) $destinationModel->getConnectionName(), 'has_errors' => false, 'timeout_reached' => false ); diff --git a/app/code/Magento/Core/Model/Layout.php b/app/code/Magento/Core/Model/Layout.php index d32868c3745..990b6bb55bd 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/app/code/Magento/Core/Model/Layout.php @@ -762,7 +762,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $this->_structure->setAsChild($name, $parentName, $alias); } else { $this->_logger - ->log("Broken reference: the '{$name}' element cannot be added as child to '{$parentName}, " + ->log("Broken reference: the '{$name}' element cannot be added as child to '{$parentName}', " . 'because the latter doesn\'t exist', \Zend_Log::CRIT ); } diff --git a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php index 6ea0555b87f..0101581cff6 100644 --- a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php +++ b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php @@ -58,7 +58,7 @@ class FileResolver implements \Magento\Config\FileResolverInterface if ($this->directoryRead->isExist('locale')) { $result = $this->iteratorFactory->create( $this->directoryRead, - $this->directoryRead->search('#' . preg_quote($filename) . '$#', 'locale') + $this->directoryRead->search('/locale/*/' . $filename) ); } return $result; diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/File.php b/app/code/Magento/Core/Model/Resource/File/Storage/File.php index 1f2963a003d..269430467e5 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/File.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/File.php @@ -75,7 +75,7 @@ class File if ($directoryInstance->isDirectory($path)) { $directories[] = array( 'name' => $itemName, - 'path' => dirname($path) + 'path' => (dirname($path) == '.') ? '/' : dirname($path) ); } else { $files[] = $path; diff --git a/app/code/Magento/Core/Model/Resource/Setup.php b/app/code/Magento/Core/Model/Resource/Setup.php index 4abe5dfd0ce..ad9c06aa49c 100644 --- a/app/code/Magento/Core/Model/Resource/Setup.php +++ b/app/code/Magento/Core/Model/Resource/Setup.php @@ -483,7 +483,7 @@ class Setup implements \Magento\Module\Updater\SetupInterface try { switch ($fileType) { case 'php': - $result = include $fileName; + $result = $this->_includeFile($fileName); break; case 'sql': $sql = $this->modulesDir->readFile($this->modulesDir->getRelativePath($fileName)); @@ -514,6 +514,20 @@ class Setup implements \Magento\Module\Updater\SetupInterface return $version; } + /** + * Include file by path + * This method should perform only file inclusion. + * Implemented to prevent possibility of changing important and used variables + * inside the setup model while installing + * + * @param string $fileName + * @return mixed + */ + protected function _includeFile($fileName) + { + return include $fileName; + } + /** * Get data files for modifications * diff --git a/app/code/Magento/Core/Model/Store.php b/app/code/Magento/Core/Model/Store.php index e84aa810f40..88f37bea363 100644 --- a/app/code/Magento/Core/Model/Store.php +++ b/app/code/Magento/Core/Model/Store.php @@ -837,10 +837,11 @@ class Store extends \Magento\Core\Model\AbstractModel $code = strtoupper($code); if (in_array($code, $this->getAvailableCurrencyCodes())) { $this->_getSession()->setCurrencyCode($code); - if ($code == $this->getDefaultCurrency()) { - $this->_cookie->set(self::COOKIE_CURRENCY, null); + $path = $this->_getSession()->getCookiePath(); + if ($code == $this->getDefaultCurrency()->getCurrencyCode()) { + $this->_cookie->set(self::COOKIE_CURRENCY, null, null, $path); } else { - $this->_cookie->set(self::COOKIE_CURRENCY, $code); + $this->_cookie->set(self::COOKIE_CURRENCY, $code, null, $path); } } return $this; diff --git a/app/code/Magento/Core/Model/Theme/Collection.php b/app/code/Magento/Core/Model/Theme/Collection.php index 7d20d247aaa..27fe4a49601 100644 --- a/app/code/Magento/Core/Model/Theme/Collection.php +++ b/app/code/Magento/Core/Model/Theme/Collection.php @@ -139,19 +139,7 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig $pathsToThemeConfig = array(); foreach ($this->getTargetPatterns() as $directoryPath) { - - $directoryPath = preg_replace_callback('/[\\\\^$.[\\]|()?*+{}\\-\\/]/', function ($matches) { - switch ($matches[0]) { - case '*': - return '.*'; - case '?': - return '.'; - default: - return '\\' . $matches[0]; - } - }, $directoryPath); - - $themeConfigs = $this->_directory->search('#' . $directoryPath . '#'); + $themeConfigs = $this->_directory->search($directoryPath); foreach ($themeConfigs as &$relPathToTheme) { $relPathToTheme = $this->_directory->getAbsolutePath($relPathToTheme); } diff --git a/app/code/Magento/Core/Model/Website.php b/app/code/Magento/Core/Model/Website.php index 0461b18e6ef..10a33a3d95c 100644 --- a/app/code/Magento/Core/Model/Website.php +++ b/app/code/Magento/Core/Model/Website.php @@ -484,7 +484,7 @@ class Website extends \Magento\Core\Model\AbstractModel return false; } if (is_null($this->_isCanDelete)) { - $this->_isCanDelete = ($this->_websiteFactory->create()->getCollection()->getSize() > 2) + $this->_isCanDelete = ($this->_websiteFactory->create()->getCollection()->getSize() > 1) && !$this->getIsDefault(); } return $this->_isCanDelete; diff --git a/app/code/Magento/Customer/Block/Account/Customer.php b/app/code/Magento/Customer/Block/Account/Customer.php index ce7224319d9..b6a6d042bc6 100644 --- a/app/code/Magento/Customer/Block/Account/Customer.php +++ b/app/code/Magento/Customer/Block/Account/Customer.php @@ -33,26 +33,18 @@ class Customer extends \Magento\View\Element\Template */ protected $_customerSession; - /** - * @var \Magento\Customer\Helper\Data - */ - protected $_customerHelper; - /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $session - * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Customer\Model\Session $session, - \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { parent::__construct($context, $data); $this->_customerSession = $session; - $this->_customerHelper = $customerHelper; } /** @@ -71,6 +63,6 @@ class Customer extends \Magento\View\Element\Template */ public function getCustomerName() { - return $this->_customerHelper->getCustomerName(); + return $this->escapeHtml($this->_customerSession->getCustomer()->getName()); } } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php index 045629884cc..f2553f4e9b2 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php @@ -299,7 +299,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic $prefix = $form->getHtmlIdPrefix(); $note = __('Please select a website which contains store view'); - $form->getElement('website_id')->setAfterElementHtml( + $form->getElement('website_id')->setAfterElementJs( '<script type="text/javascript">' . " var {$prefix}_websites = " . $this->_jsonEncoder->encode($websites) . "; diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php index 7725cf55fe3..6b6d2448e53 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php @@ -142,7 +142,7 @@ class View public function getCreateDate() { return $this->formatDate( - $this->getCustomer()->getCreatedAtTimestamp(), + $this->getCustomer()->getCreatedAt(), \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_MEDIUM, true ); diff --git a/app/code/Magento/Customer/Controller/Account.php b/app/code/Magento/Customer/Controller/Account.php index 56088595c44..41fc6f811ea 100644 --- a/app/code/Magento/Customer/Controller/Account.php +++ b/app/code/Magento/Customer/Controller/Account.php @@ -222,7 +222,7 @@ class Account extends \Magento\App\Action\Action */ public function loginPostAction() { - if ($this->_getSession()->isLoggedIn()) { + if ($this->_getSession()->isLoggedIn() || !$this->_formKeyValidator->validate($this->getRequest())) { $this->_redirect('*/*/'); return; } @@ -286,7 +286,7 @@ class Account extends \Magento\App\Action\Action $referer = $this->getRequest()->getParam(\Magento\Customer\Helper\Data::REFERER_QUERY_PARAM_NAME); if ($referer) { $referer = $this->_objectManager->get('Magento\Core\Helper\Data')->urlDecode($referer); - if ($this->_url->isInternal($referer)) { + if ($this->_url->isOwnOriginUrl()) { $this->_getSession()->setBeforeAuthUrl($referer); } } diff --git a/app/code/Magento/Customer/Model/Resource/Customer.php b/app/code/Magento/Customer/Model/Resource/Customer.php index 7d1c1e59d7f..8684eab34df 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer.php +++ b/app/code/Magento/Customer/Model/Resource/Customer.php @@ -139,7 +139,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity $result = $adapter->fetchOne($select, $bind); if ($result) { throw new \Magento\Customer\Exception( - __('Customer with the same email already exists.'), + __('Customer with the same email already exists in associated website.'), \Magento\Customer\Model\Customer::EXCEPTION_EMAIL_EXISTS ); } diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index d4b96f9ba23..7100c412020 100755 --- a/app/code/Magento/Customer/etc/module.xml +++ b/app/code/Magento/Customer/etc/module.xml @@ -24,7 +24,7 @@ */ --> <config> - <module name="Magento_Customer" version="1.6.2.0.3" active="true"> + <module name="Magento_Customer" version="1.6.2.0.5" active="true"> <sequence> <module name="Magento_Eav"/> <module name="Magento_Directory"/> diff --git a/app/code/Magento/Customer/etc/validation.xml b/app/code/Magento/Customer/etc/validation.xml index 4dcdc1c051e..f49e4ff1908 100644 --- a/app/code/Magento/Customer/etc/validation.xml +++ b/app/code/Magento/Customer/etc/validation.xml @@ -48,7 +48,6 @@ <rule name="check_eav"> <entity_constraints> <constraint alias="eav_data_validator" class="Magento\Eav\Model\Validator\Attribute\Data" /> - <constraint alias="eav_backend_validator" class="Magento\Eav\Model\Validator\Attribute\Backend" /> </entity_constraints> </rule> </rules> diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0.4-1.6.2.0.5.php b/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0.4-1.6.2.0.5.php new file mode 100644 index 00000000000..0921df72889 --- /dev/null +++ b/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0.4-1.6.2.0.5.php @@ -0,0 +1,39 @@ +<?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. + * + * @category Magento + * @package Magento_Customer + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** @var $installer \Magento\Customer\Model\Resource\Setup */ +$installer = $this; +$connection = $installer->getConnection(); + +/** + * Add unique index for customer_entity table + */ +$connection->addIndex( + $installer->getTable('customer_entity'), + $installer->getIdxName('customer_entity', array('email', 'website_id')), + array('email', 'website_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE +); \ No newline at end of file diff --git a/app/code/Magento/Customer/view/frontend/form/login.phtml b/app/code/Magento/Customer/view/frontend/form/login.phtml index 407bdd90329..f3426e4eca2 100644 --- a/app/code/Magento/Customer/view/frontend/form/login.phtml +++ b/app/code/Magento/Customer/view/frontend/form/login.phtml @@ -28,12 +28,14 @@ * Customer login form template * * @see \Magento\Customer\Block\Form\Login + * @var $this \Magento\Customer\Block\Form\Login */ ?> <div class="block customer login"> <div class="title"><strong><?php echo __('Registered Customers') ?></strong></div> <div class="content"> <form class="form login" action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form"> + <?php echo $this->getBlockHtml('formkey'); ?> <fieldset class="fieldset login" data-hasrequired="<?php echo __('* Required Fields') ?>"> <p class="field note"><?php echo __('If you have an account with us, log in using your email address.') ?></p> <div class="field email required"> diff --git a/app/code/Magento/Directory/data/directory_setup/data-upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Directory/data/directory_setup/data-upgrade-1.6.0.1-1.6.0.2.php new file mode 100644 index 00000000000..b96cb6c6eb8 --- /dev/null +++ b/app/code/Magento/Directory/data/directory_setup/data-upgrade-1.6.0.1-1.6.0.2.php @@ -0,0 +1,59 @@ +<?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. + * + * @category Magento + * @package Magento_Directory + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * @var \Magento\Directory\Model\Resource\Setup $installer + */ +$installer = $this; + +$data = array( + array('BR', 'AC', 'Acre'), array('BR', 'AL', 'Alagoas'), array('BR', 'AP', 'Amapá'), array('BR', 'AM', 'Amazonas'), + array('BR', 'BA', 'Bahia'), array('BR', 'CE', 'Ceará'), array('BR', 'ES', 'EspÃÂrito Santo'), + array('BR', 'GO', 'Goiás'), array('BR', 'MA', 'Maranhão'), array('BR', 'MT', 'Mato Grosso'), + array('BR', 'MS', 'Mato Grosso do Sul'), array('BR', 'MG', 'Minas Gerais'), array('BR', 'PA', 'Pará'), + array('BR', 'PB', 'ParaÃÂba'), array('BR', 'PR', 'Paraná'), array('BR', 'PE', 'Pernambuco'), + array('BR', 'PI', 'PiauÃÂ'), array('BR', 'RJ', 'Rio de Janeiro'), array('BR', 'RN', 'Rio Grande do Norte'), + array('BR', 'RS', 'Rio Grande do Sul'), array('BR', 'RO', 'Rondônia'), array('BR', 'RR', 'Roraima'), + array('BR', 'SC', 'Santa Catarina'), array('BR', 'SP', 'São Paulo'), array('BR', 'SE', 'Sergipe'), + array('BR', 'TO', 'Tocantins'), array('BR', 'DF', 'Distrito Federal'), +); + +foreach ($data as $row) { + $bind = array( + 'country_id' => $row[0], + 'code' => $row[1], + 'default_name' => $row[2], + ); + $installer->getConnection()->insert($installer->getTable('directory_country_region'), $bind); + $regionId = $installer->getConnection()->lastInsertId($installer->getTable('directory_country_region')); + + $bind = array( + 'locale' => 'en_US', + 'region_id' => $regionId, + 'name' => $row[2] + ); + $installer->getConnection()->insert($installer->getTable('directory_country_region_name'), $bind); +} diff --git a/app/code/Magento/Directory/etc/module.xml b/app/code/Magento/Directory/etc/module.xml index 0eb574bb6b3..9d80b2eb556 100755 --- a/app/code/Magento/Directory/etc/module.xml +++ b/app/code/Magento/Directory/etc/module.xml @@ -24,7 +24,7 @@ */ --> <config> - <module name="Magento_Directory" version="1.6.0.1" active="true"> + <module name="Magento_Directory" version="1.6.0.2" active="true"> <sequence> <module name="Magento_Core"/> </sequence> diff --git a/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php b/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php index 3f26db29f47..d97556aa889 100644 --- a/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php @@ -51,20 +51,28 @@ class Downloadable extends \Magento\Sales\Block\Order\Email\Items\DefaultItems */ protected $_itemsFactory; + /** + * @var \Magento\Core\Model\Url + */ + protected $urlGenerator; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory + * @param \Magento\Core\Model\Url $urlGenerator * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, + \Magento\Core\Model\Url $urlGenerator, array $data = array() ) { $this->_purchasedFactory = $purchasedFactory; $this->_itemsFactory = $itemsFactory; + $this->urlGenerator = $urlGenerator; parent::__construct($context, $data); } @@ -94,7 +102,7 @@ class Downloadable extends \Magento\Sales\Block\Order\Email\Items\DefaultItems public function getPurchasedLinkUrl($item) { - return $this->getUrl('downloadable/download/link', array( + return $this->urlGenerator->getUrl('downloadable/download/link', array( 'id' => $item->getLinkHash(), '_store' => $this->getOrder()->getStore(), '_secure' => true, diff --git a/app/code/Magento/Downloadable/etc/di.xml b/app/code/Magento/Downloadable/etc/di.xml index b441b22d71d..11072f00e28 100644 --- a/app/code/Magento/Downloadable/etc/di.xml +++ b/app/code/Magento/Downloadable/etc/di.xml @@ -41,4 +41,9 @@ </value> </param> </type> + <type name="Magento\Downloadable\Block\Sales\Order\Email\Items\Downloadable"> + <param name="urlGenerator"> + <instance type="Magento\Core\Model\Url\Proxy"/> + </param> + </type> </config> diff --git a/app/code/Magento/Downloadable/view/frontend/checkout/cart/item/default.phtml b/app/code/Magento/Downloadable/view/frontend/checkout/cart/item/default.phtml index cd08fb99f34..6a3ccabaa35 100644 --- a/app/code/Magento/Downloadable/view/frontend/checkout/cart/item/default.phtml +++ b/app/code/Magento/Downloadable/view/frontend/checkout/cart/item/default.phtml @@ -187,7 +187,7 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite <?php endif; ?> <td class="col qty"> <div class="control qty"> - <input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" type="text" 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> diff --git a/app/code/Magento/Downloadable/view/frontend/customer/products/list.phtml b/app/code/Magento/Downloadable/view/frontend/customer/products/list.phtml index c0e12644d00..c64a730f985 100644 --- a/app/code/Magento/Downloadable/view/frontend/customer/products/list.phtml +++ b/app/code/Magento/Downloadable/view/frontend/customer/products/list.phtml @@ -32,34 +32,36 @@ <?php echo $this->getChildHtml('pager'); ?> </div> <?php if(count($_items)): ?> - <table id="my-downloadable-products-table" class="data table downloadable products"> - <thead> - <tr> - <th class="col id"><?php echo __('Order #') ?></th> - <th class="col date"><?php echo __('Date') ?></th> - <th class="col title"><?php echo __('Title') ?></th> - <th class="col status"><?php echo __('Status') ?></th> - <th class="col remaining"><?php echo __('Remaining Downloads') ?></th> - </tr> - </thead> - <tbody> - <?php foreach ($_items as $_item): ?> - <tr> - <td class="col id"> - <a href="<?php echo $this->getOrderViewUrl($_item->getPurchased()->getOrderId()) ?>" title="<?php echo __('View Order') ?>"> - <?php echo $_item->getPurchased()->getOrderIncrementId() ?> - </a> - </td> - <td class="col date"><?php echo $this->formatDate($_item->getPurchased()->getCreatedAt()) ?></td> - <td class="col title"> - <?php echo $this->escapeHtml($_item->getPurchased()->getProductName()) ?> - <a href="<?php echo $this->getDownloadUrl($_item) ?>" title="<?php echo __('Start Download') ?>" <?php echo $this->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo $this->escapeHtml($_item->getLinkTitle()) ?></a> - </td> - <td class="col status"><?php echo __(ucfirst($_item->getStatus())) ?></td> - <td class="col remaining"><?php echo $this->getRemainingDownloads($_item) ?></td> - </tr> - <?php endforeach; ?> - </tbody> - </table> + <div class="wrapper table downloadable products"> + <table id="my-downloadable-products-table" class="data table downloadable products"> + <thead> + <tr> + <th class="col id"><?php echo __('Order #') ?></th> + <th class="col date"><?php echo __('Date') ?></th> + <th class="col title"><?php echo __('Title') ?></th> + <th class="col status"><?php echo __('Status') ?></th> + <th class="col remaining"><?php echo __('Remaining Downloads') ?></th> + </tr> + </thead> + <tbody> + <?php foreach ($_items as $_item): ?> + <tr> + <td class="col id"> + <a href="<?php echo $this->getOrderViewUrl($_item->getPurchased()->getOrderId()) ?>" title="<?php echo __('View Order') ?>"> + <?php echo $_item->getPurchased()->getOrderIncrementId() ?> + </a> + </td> + <td class="col date"><?php echo $this->formatDate($_item->getPurchased()->getCreatedAt()) ?></td> + <td class="col title"> + <?php echo $this->escapeHtml($_item->getPurchased()->getProductName()) ?> - <a href="<?php echo $this->getDownloadUrl($_item) ?>" title="<?php echo __('Start Download') ?>" <?php echo $this->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo $this->escapeHtml($_item->getLinkTitle()) ?></a> + </td> + <td class="col status"><?php echo __(ucfirst($_item->getStatus())) ?></td> + <td class="col remaining"><?php echo $this->getRemainingDownloads($_item) ?></td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + </div> <?php else: ?> <div class="message info empty"><span><?php echo __('You have not purchased any downloadable products yet.'); ?></span></div> <?php endif; ?> diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php index 4452d8b1e32..2f79a46815a 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php @@ -419,12 +419,12 @@ class Edit extends \Magento\Backend\Block\Widget if ($paths) { /** @var $menu \Magento\Backend\Model\Menu */ $menu = $this->_menuConfig->getMenu(); - $item = $menu->get('Magento_Adminhtml::system'); + $item = $menu->get('Magento_Backend::stores'); // create prefix path parts $prefixParts[] = array( 'title' => __($item->getTitle()), ); - $item = $menu->get('Magento_Adminhtml::system_config'); + $item = $menu->get('Magento_Backend::system_config'); $prefixParts[] = array( 'title' => __($item->getTitle()), 'url' => $this->getUrl('adminhtml/system_config/'), diff --git a/app/code/Magento/Email/Model/Template/Config/FileResolver.php b/app/code/Magento/Email/Model/Template/Config/FileResolver.php index 3c1d4b72145..e9cf19ad46a 100644 --- a/app/code/Magento/Email/Model/Template/Config/FileResolver.php +++ b/app/code/Magento/Email/Model/Template/Config/FileResolver.php @@ -45,7 +45,7 @@ class FileResolver implements \Magento\Config\FileResolverInterface \Magento\Filesystem $filesystem, \Magento\Email\Model\Template\Config\FileIteratorFactory $iteratorFactory ) { - $this->directoryRead = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $this->directoryRead = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $this->iteratorFactory = $iteratorFactory; } @@ -55,10 +55,8 @@ class FileResolver implements \Magento\Config\FileResolverInterface public function get($filename, $scope) { $iterator = $this->iteratorFactory->create( - array( - 'directory' => $this->directoryRead, - 'paths' => $this->directoryRead->search('#' . preg_quote($filename) . '$#') - ) + $this->directoryRead, + $this->directoryRead->search('/*/*/etc/' . $filename) ); return $iterator; } diff --git a/app/code/Magento/GiftMessage/view/adminhtml/giftoptionsform.phtml b/app/code/Magento/GiftMessage/view/adminhtml/giftoptionsform.phtml index 4ce4c4d8056..f4092fe212a 100644 --- a/app/code/Magento/GiftMessage/view/adminhtml/giftoptionsform.phtml +++ b/app/code/Magento/GiftMessage/view/adminhtml/giftoptionsform.phtml @@ -46,10 +46,4 @@ </div> </div> </div> - -<script type="text/javascript"> -//<![CDATA[ -var giftMessageSet = new GiftMessageSet(); -//]]> -</script> <?php endif; ?> diff --git a/app/code/Magento/GiftMessage/view/adminhtml/popup.phtml b/app/code/Magento/GiftMessage/view/adminhtml/popup.phtml index 224393a9f4c..4f6cc8df017 100644 --- a/app/code/Magento/GiftMessage/view/adminhtml/popup.phtml +++ b/app/code/Magento/GiftMessage/view/adminhtml/popup.phtml @@ -43,6 +43,8 @@ <script type="text/javascript"> //<![CDATA[ +var giftMessageSet = new GiftMessageSet(); + _giftOptions = new GiftOptionsPopup(); giftOptionsTooltip.setTooltipWindow('giftoptions_tooltip_window','giftoptions_tooltip_window_content'); //]]> diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php index 1721d4eee82..9de6334d67d 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php @@ -60,11 +60,15 @@ class Types extends \Magento\Backend\App\Action */ public function dispatch(RequestInterface $request) { - parent::dispatch($request); - if ($this->_actionFlag->get('', self::FLAG_NO_POST_DISPATCH)) { - return $this->_response; + $response = parent::dispatch($request); + if (!$this->_actionFlag->get('', self::FLAG_NO_POST_DISPATCH)) { + $this->_eventManager->dispatch( + 'controller_action_postdispatch_adminhtml', + array('controller_action' => $this) + ); } - $this->_eventManager->dispatch('controller_action_postdispatch_adminhtml', array('controller_action' => $this)); + return $response; + } /** diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php index e94052612a5..61dfd297404 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php @@ -1033,6 +1033,16 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity 'value' => $storeValue ); } + /* + If the store based values are not provided for a particular store, + we default to the default scope values. + In this case, remove all the existing store based values stored in the table. + */ + $where = $this->_connection->quoteInto('store_id NOT IN (?)', array_keys($storeValues)) . + $this->_connection->quoteInto(' AND attribute_id = ?', $attributeId) . + $this->_connection->quoteInto(' AND entity_id = ?', $productId) . + $this->_connection->quoteInto(' AND entity_type_id = ?', $this->_entityTypeId); + $this->_connection->delete($tableName, $where); } } $this->_connection->insertOnDuplicate($tableName, $tableData, array('value')); diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php index e9dfe7d7b66..3a6e8cca032 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php @@ -259,10 +259,10 @@ abstract class AbstractType * * @param array $rowData * @param int $rowNum - * @param boolean $checkRequiredAttributes OPTIONAL Flag which can disable validation required values. + * @param boolean $isNewProduct OPTIONAL * @return boolean */ - public function isRowValid(array $rowData, $rowNum, $checkRequiredAttributes = true) + public function isRowValid(array $rowData, $rowNum, $isNewProduct = true) { $error = false; $rowScope = $this->_entityModel->getRowScope($rowData); @@ -272,16 +272,19 @@ abstract class AbstractType // check value for non-empty in the case of required attribute? if (isset($rowData[$attrCode]) && strlen($rowData[$attrCode])) { $error |= !$this->_entityModel->isAttributeValid($attrCode, $attrParams, $rowData, $rowNum); - } elseif ( - $this->_isAttributeRequiredCheckNeeded($attrCode) - && $checkRequiredAttributes - && \Magento\ImportExport\Model\Import\Entity\Product::SCOPE_DEFAULT == $rowScope - && $attrParams['is_required'] - ) { - $this->_entityModel->addRowError( - \Magento\ImportExport\Model\Import\Entity\Product::ERROR_VALUE_IS_REQUIRED, $rowNum, $attrCode - ); - $error = true; + } elseif ($this->_isAttributeRequiredCheckNeeded($attrCode) && $attrParams['is_required']) { + // For the default scope - if this is a new product or + // for an old product, if the imported doc has the column present for the attrCode + if (\Magento\ImportExport\Model\Import\Entity\Product::SCOPE_DEFAULT == $rowScope && + ($isNewProduct || array_key_exists($attrCode, $rowData)) + ) { + $this->_entityModel->addRowError( + \Magento\ImportExport\Model\Import\Entity\Product::ERROR_VALUE_IS_REQUIRED, + $rowNum, + $attrCode + ); + $error = true; + } } } } diff --git a/app/code/Magento/ImportExport/view/adminhtml/export/form/before.phtml b/app/code/Magento/ImportExport/view/adminhtml/export/form/before.phtml index 66cfe12cfca..4224354e532 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/export/form/before.phtml +++ b/app/code/Magento/ImportExport/view/adminhtml/export/form/before.phtml @@ -42,7 +42,6 @@ */ modifyFilterGrid: function() { if ($('entity') && $F('entity') && $F('entity') != 'catalog_product') { - if ($F('entity') == 'customer') { $$('col:first-child').each(function(el) { el.show(); }); @@ -52,17 +51,6 @@ $$('td.a-center').each(function(el) { el.show(); }); - } else { - $$('col:first-child').each(function(el) { - el.hide(); - }); - $$('th.no-link:first-child').each(function(el) { - el.hide(); - }); - $$('td.a-center').each(function(el) { - el.hide(); - }); - } } }, @@ -73,9 +61,6 @@ if ($('entity') && $F('entity')) { var url = "<?php echo $this->getUrl('*/*/getFilter') ?>"; var entity = $F('entity'); - if (entity != 'catalog_product') { - entity = 'customer'; - } if (entity != this.previousGridEntity) { this.previousGridEntity = entity; url += ((url.slice(-1) != '/') ? '/' : '') + 'entity/' + entity; diff --git a/app/code/Magento/Install/Model/Installer.php b/app/code/Magento/Install/Model/Installer.php index 36ac343c952..180d6a26b32 100644 --- a/app/code/Magento/Install/Model/Installer.php +++ b/app/code/Magento/Install/Model/Installer.php @@ -479,12 +479,9 @@ class Installer extends \Magento\Object */ public function finish() { - $this->_installerConfig->replaceTmpInstallDate(); - + $this->_setAppInstalled(); $this->_refreshConfig(); - $this->_config->reinit(); - /* Enable all cache types */ foreach (array_keys($this->_cacheTypeList->getTypes()) as $cacheTypeCode) { $this->_cacheState->setEnabled($cacheTypeCode, true); @@ -493,6 +490,16 @@ class Installer extends \Magento\Object return $this; } + /** + * Store install date and set application into installed state + */ + protected function _setAppInstalled() + { + $dateTime = date('r'); + $this->_installerConfig->replaceTmpInstallDate($dateTime); + $this->_appState->setInstallDate($dateTime); + } + /** * Ensure changes in the configuration, if any, take effect */ diff --git a/app/code/Magento/Install/Model/Installer/Config.php b/app/code/Magento/Install/Model/Installer/Config.php index 0486ecc040e..a95f39d3e70 100644 --- a/app/code/Magento/Install/Model/Installer/Config.php +++ b/app/code/Magento/Install/Model/Installer/Config.php @@ -53,6 +53,11 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller */ protected $_filesystem; + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $_pubDirectory; + /** * @var \Magento\Filesystem\Directory\Write */ @@ -88,6 +93,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller $this->_request = $request; $this->_storeManager = $storeManager; $this->_filesystem = $filesystem; + $this->_pubDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::PUB_LIB); $this->_configDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::CONFIG); $this->messageManager = $messageManager; } @@ -198,10 +204,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller protected function _checkUrl($baseUrl) { try { - $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::PUB_LIB); - $files = $directory->search('/.+\.(html?|js|css|gif|jpe?g|png)$/'); - - $staticFile = isset($files[0]) ? $files[0] : null; + $staticFile = $this->_findFirstFileRelativePath('', '/.+\.(html?|js|css|gif|jpe?g|png)$/'); $staticUrl = $baseUrl . $this->_filesystem->getUri(\Magento\Filesystem::PUB_LIB) . '/' . $staticFile; $client = new \Magento\HTTP\ZendClient($staticUrl); $response = $client->request('GET'); @@ -219,6 +222,35 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller } } + /** + * Find a relative path to a first file located in a directory or its descendants + * + * @param string $dir Directory to search for a file within + * @param string $pattern PCRE pattern a file name has to match + * @return string|null + */ + protected function _findFirstFileRelativePath($dir, $pattern = '/.*/') + { + $childDirs = array(); + foreach ($this->_pubDirectory->read($dir) as $itemName) { + $itemPath = $dir . '/' . $itemName; + if ($this->_pubDirectory->isFile($itemPath)) { + if (preg_match($pattern, $itemName)) { + return $itemName; + } + } else { + $childDirs[$itemName] = $itemPath; + } + } + foreach ($childDirs as $dirName => $dirPath) { + $filePath = $this->_findFirstFileRelativePath($dirPath, $pattern); + if ($filePath) { + return $dirName . '/' . $filePath; + } + } + return null; + } + public function replaceTmpInstallDate($date = 'now') { $stamp = strtotime((string) $date); diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Filter/Checkbox.php b/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Filter/Checkbox.php index ade99b2f935..34d7a97babf 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Filter/Checkbox.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Filter/Checkbox.php @@ -36,7 +36,7 @@ namespace Magento\Newsletter\Block\Adminhtml\Problem\Grid\Filter; class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter { - public function getCondition() + public function getCondition() { return array(); } diff --git a/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml b/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml index 945708a62ee..3cb27d1f644 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml @@ -42,7 +42,7 @@ </div> <?php endif;?> </div> - <iframe name="preview_iframe" id="preview_iframe" frameborder="0"></iframe> + <iframe name="preview_iframe" id="preview_iframe" frameborder="0" title="<?php echo __('Preview') ?>" width="100%" onload="iframeSetHeight()"></iframe> <?php echo $this->getChildHtml('preview_form'); ?> </div> @@ -69,6 +69,15 @@ function unBlockPreview() { Event.observe(window, 'load', preview); Event.observe(previewIframe, 'load', unBlockPreview); + +function iframeSetHeight() { + var iFrameID = document.getElementById('preview_iframe'); + if(iFrameID) { + iFrameID.height = ""; + iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px"; + } +} + //]]> </script> </body> diff --git a/app/code/Magento/Payment/view/frontend/form/cc.phtml b/app/code/Magento/Payment/view/frontend/form/cc.phtml index d2cdc7b285f..e5d8b7aa83e 100644 --- a/app/code/Magento/Payment/view/frontend/form/cc.phtml +++ b/app/code/Magento/Payment/view/frontend/form/cc.phtml @@ -40,7 +40,7 @@ <div class="field number required"> <label for="<?php echo $_code ?>_cc_number" class="label"><span><?php echo __('Credit Card Number') ?></span></label> <div class="control"> - <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo __('Credit Card Number') ?>" class="input-text" value="" data-validate='{required:true, "validate-cc-number":"#<?php echo $_code ?>_cc_type", "validate-cc-type":"#<?php echo $_code ?>_cc_type"}'/> + <input type="number" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo __('Credit Card Number') ?>" class="input-text" value="" data-validate='{required:true, "validate-cc-number":"#<?php echo $_code ?>_cc_type", "validate-cc-type":"#<?php echo $_code ?>_cc_type"}'/> </div> </div> <div class="field date required" id="<?php echo $_code ?>_cc_type_exp_div"> @@ -74,7 +74,7 @@ <div class="field cvv required" id="<?php echo $_code ?>_cc_type_cvv_div"> <label for="<?php echo $_code ?>_cc_cid" class="label"><span><?php echo __('Card Verification Number') ?></span></label> <div class="control"> - <input type="text" title="<?php echo __('Card Verification Number') ?>" class="input-text cvv" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" data-validate='{required:true, "validate-cc-cvn":"#<?php echo $_code ?>_cc_type"}' /> + <input type="number" title="<?php echo __('Card Verification Number') ?>" class="input-text cvv" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" data-validate='{required:true, "validate-cc-cvn":"#<?php echo $_code ?>_cc_type"}' /> <div class="note"> <a href="#" class="action cvv" data-mage-init='{toggleAdvanced: {toggleContainers: "#<?php echo $_code ?>_cc_type_cvv_div .tooltip"}}'><span><?php echo __('What is this?') ?></span></a> </div> diff --git a/app/code/Magento/Payment/view/frontend/form/ccsave.phtml b/app/code/Magento/Payment/view/frontend/form/ccsave.phtml index 5019764e241..d48de069c20 100644 --- a/app/code/Magento/Payment/view/frontend/form/ccsave.phtml +++ b/app/code/Magento/Payment/view/frontend/form/ccsave.phtml @@ -46,7 +46,7 @@ <div class="field number required"> <label for="<?php echo $_code ?>_cc_number" class="label"><span><?php echo __('Credit Card Number') ?></span></label> <div class="control"> - <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo __('Credit Card Number') ?>" class="input-text" value="" data-validate='{required:true, "validate-cc-number":"#<?php echo $_code ?>_cc_type", "validate-cc-type":"#<?php echo $_code ?>_cc_type"}'/> + <input type="number" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo __('Credit Card Number') ?>" class="input-text" value="" data-validate='{required:true, "validate-cc-number":"#<?php echo $_code ?>_cc_type", "validate-cc-type":"#<?php echo $_code ?>_cc_type"}'/> </div> </div> <div class="field date required"> @@ -80,7 +80,7 @@ <div class="field cvv required"> <label for="<?php echo $_code ?>_cc_cid" class="label"><span><?php echo __('Card Verification Number') ?></span></label> <div class="control"> - <input type="text" title="<?php echo __('Card Verification Number') ?>" class="input-text cvv" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" data-validate='{required:true, "validate-cc-cvn":"#<?php echo $_code ?>_cc_type"}'/> + <input type="number" title="<?php echo __('Card Verification Number') ?>" class="input-text cvv" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" data-validate='{required:true, "validate-cc-cvn":"#<?php echo $_code ?>_cc_type"}'/> <div class="note"> <a href="#" class="action cvv" data-mage-init='{toggleAdvanced: {toggleContainers:"#ccv-save-tooltip"}}'><span><?php echo __('What is this?') ?></span></a> </div> diff --git a/app/code/Magento/Paypal/Block/Iframe.php b/app/code/Magento/Paypal/Block/Iframe.php index 6b89856b133..559b7fc104d 100644 --- a/app/code/Magento/Paypal/Block/Iframe.php +++ b/app/code/Magento/Paypal/Block/Iframe.php @@ -114,7 +114,7 @@ class Iframe extends \Magento\Payment\Block\Form $templatePath = str_replace('_', '', $paymentCode); $templateFile = "{$templatePath}/iframe.phtml"; - $directory = $this->getDirectory(); + $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $file = $this->_viewFileSystem->getFilename($templateFile, array('module' => 'Magento_Paypal')); if ($directory->isExist($directory->getRelativePath($file))) { $this->setTemplate($templateFile); diff --git a/app/code/Magento/Paypal/Model/Cert.php b/app/code/Magento/Paypal/Model/Cert.php index fd4fa12c8ed..0ac1b5c216f 100644 --- a/app/code/Magento/Paypal/Model/Cert.php +++ b/app/code/Magento/Paypal/Model/Cert.php @@ -134,8 +134,7 @@ class Cert extends \Magento\Core\Model\AbstractModel */ protected function _removeOutdatedCertFile() { - $pattern = sprintf('#cert_%s#' . $this->getWebsiteId()); - + $pattern = sprintf('cert_%s*' . $this->getWebsiteId()); $entries = $this->varDirectory->search($pattern, self::BASEPATH_PAYPAL_CERT); foreach ($entries as $entry) { $this->varDirectory->delete($entry); diff --git a/app/code/Magento/ProductAlert/Block/Product/View/Price.php b/app/code/Magento/ProductAlert/Block/Product/View/Price.php index 8f175d4fbc4..b605b4c86e6 100644 --- a/app/code/Magento/ProductAlert/Block/Product/View/Price.php +++ b/app/code/Magento/ProductAlert/Block/Product/View/Price.php @@ -34,18 +34,18 @@ class Price extends \Magento\ProductAlert\Block\Product\View /** * Prepare price info * - * @return void + * @param string $template + * @return \Magento\View\Element\Template */ - protected function _prepareLayout() + public function setTemplate($template) { - parent::_prepareLayout(); if (!$this->_helper->isPriceAlertAllowed() || !$this->_product || false === $this->_product->getCanShowPrice() ) { - $this->setTemplate(''); - return; + $template = ''; + } else { + $this->setSignupUrl($this->_helper->getSaveUrl('price')); } - $this->setSignupUrl($this->_helper->getSaveUrl('price')); + return parent::setTemplate($template); } - } diff --git a/app/code/Magento/ProductAlert/Block/Product/View/Stock.php b/app/code/Magento/ProductAlert/Block/Product/View/Stock.php index 024770647ef..e08cb0c0701 100644 --- a/app/code/Magento/ProductAlert/Block/Product/View/Stock.php +++ b/app/code/Magento/ProductAlert/Block/Product/View/Stock.php @@ -34,15 +34,16 @@ class Stock extends \Magento\ProductAlert\Block\Product\View /** * Prepare stock info * - * @return void + * @param string $template + * @return \Magento\View\Element\Template */ - protected function _prepareLayout() + public function setTemplate($template) { - parent::_prepareLayout(); if (!$this->_helper->isStockAlertAllowed() || !$this->_product || $this->_product->isAvailable()) { - $this->setTemplate(''); - return; + $template = ''; + } else { + $this->setSignupUrl($this->_helper->getSaveUrl('stock')); } - $this->setSignupUrl($this->_helper->getSaveUrl('stock')); + return parent::setTemplate($template); } } diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php index 6c9243ffc13..c82dd567649 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php @@ -52,7 +52,7 @@ class Customer } return sprintf('<a href="%s">%s</a>', - $this->getUrl('adminhtml/catalog_product_review', array('customerId' => $id)), + $this->getUrl('catalog/product_review/', array('customerId' => $id)), __('Show Reviews') ); } diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml index 99b91464070..254f4fc7961 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml @@ -53,7 +53,7 @@ <argument name="rowUrl" xsi:type="array"> <item name="path" xsi:type="string">catalog/product_review</item> <item name="extraParamsTemplate" xsi:type="array"> - <item name="customerid" xsi:type="string">getCustomerId</item> + <item name="customerId" xsi:type="string">getCustomerId</item> </item> </argument> </arguments> diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit.php b/app/code/Magento/Review/Block/Adminhtml/Edit.php index b2e76e37a57..4320ba58247 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit.php @@ -88,7 +88,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container if ($prevId !== false) { $this->addButton('previous', array( 'label' => __('Previous'), - 'onclick' => 'setLocation(\'' . $this->getUrl('adminhtml/*/*', array('id' => $prevId)) . '\')' + 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('id' => $prevId)) . '\')' ), 3, 10); $this->addButton('save_and_previous', array( @@ -130,7 +130,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container $this->addButton('next', array( 'label' => __('Next'), - 'onclick' => 'setLocation(\'' . $this->getUrl('adminhtml/*/*', array('id' => $nextId)) . '\')' + 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('id' => $nextId)) . '\')' ), 3, 105); } $this->_updateButton('save', 'label', __('Save Review')); @@ -164,7 +164,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container } if ($this->getRequest()->getParam('ret', false) == 'pending') { - $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('adminhtml/*/pending') .'\')' ); + $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('catalog/*/pending') .'\')' ); $this->_updateButton( 'delete', 'onclick', diff --git a/app/code/Magento/Review/Controller/Product.php b/app/code/Magento/Review/Controller/Product.php index 2b58a90907c..d46aa116634 100644 --- a/app/code/Magento/Review/Controller/Product.php +++ b/app/code/Magento/Review/Controller/Product.php @@ -95,6 +95,11 @@ class Product extends \Magento\App\Action\Action */ protected $_storeManager; + /** + * @var \Magento\Core\App\Action\FormKeyValidator + */ + protected $_formKeyValidator; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\Model\Registry $coreRegistry @@ -108,6 +113,7 @@ class Product extends \Magento\App\Action\Action * @param \Magento\Catalog\Model\Design $catalogDesign * @param \Magento\Session\Generic $reviewSession * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator */ public function __construct( \Magento\App\Action\Context $context, @@ -121,7 +127,8 @@ class Product extends \Magento\App\Action\Action \Magento\Core\Model\Session $session, \Magento\Catalog\Model\Design $catalogDesign, \Magento\Session\Generic $reviewSession, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\App\Action\FormKeyValidator $formKeyValidator ) { $this->_storeManager = $storeManager; $this->_coreRegistry = $coreRegistry; @@ -134,6 +141,7 @@ class Product extends \Magento\App\Action\Action $this->_ratingFactory = $ratingFactory; $this->_session = $session; $this->_catalogDesign = $catalogDesign; + $this->_formKeyValidator = $formKeyValidator; parent::__construct($context); } @@ -244,7 +252,10 @@ class Product extends \Magento\App\Action\Action $review = $this->_reviewFactory->create()->load($reviewId); /* @var $review \Magento\Review\Model\Review */ - if (!$review->getId() || !$review->isApproved() || !$review->isAvailableOnStore($this->_storeManager->getStore())) { + if (!$review->getId() + || !$review->isApproved() + || !$review->isAvailableOnStore($this->_storeManager->getStore()) + ) { return false; } @@ -258,6 +269,11 @@ class Product extends \Magento\App\Action\Action */ public function postAction() { + if (!$this->_formKeyValidator->validate($this->getRequest())) { + $this->getResponse()->setRedirect($this->_redirect->getRefererUrl()); + return; + } + $data = $this->_reviewSession->getFormData(true); if ($data) { $rating = array(); diff --git a/app/code/Magento/Review/view/frontend/customer/list.phtml b/app/code/Magento/Review/view/frontend/customer/list.phtml index da49143ec62..fb8a420ceda 100644 --- a/app/code/Magento/Review/view/frontend/customer/list.phtml +++ b/app/code/Magento/Review/view/frontend/customer/list.phtml @@ -27,44 +27,46 @@ <div class="toolbar reviews"> <?php echo $this->getToolbarHtml() ?> </div> - <table class="data table reviews" id="my-reviews-table"> - <thead> - <tr> - <th class="col date"><?php echo __('Created') ?></th> - <th class="col item"><?php echo __('Product Name') ?></th> - <th class="col summary"><?php echo __('Summary') ?></th> - <th class="col description"><?php echo __('Description') ?></th> - <th class="col actions"> </th> - </tr> - </thead> - <tbody> - <?php foreach ($this->getCollection() as $_review): ?> - <tr> - <td class="col date"><?php echo $this->dateFormat($_review->getReviewCreatedAt()); ?></td> - <td class="col item"> - <strong class="product name"> - <a href="<?php echo $this->getProductLink() ?>id/<?php echo $_review->getEntityPkValue() ?>"><?php echo $this->escapeHtml($_review->getName()) ?></a> - </strong> - </td> - <td class="col summary"> - <?php if($_review->getSum()): ?> - <div class="rating"> - <span style="width:<?php echo ( $_review->getSum() / $_review->getCount() ) ?>%;"></span> - </div> - <?php endif; ?> - </td> - <td class="col description"> - <?php echo $this->helper('Magento\Review\Helper\Data')->getDetailHtml($_review->getDetail()) ?> - </td> - <td class="col actions"> - <a href="<?php echo $this->getReviewLink() ?>id/<?php echo $_review->getReviewId() ?>" class="action more"> - <span><?php echo __('View Details') ?></span> - </a> - </td> - </tr> - <?php endforeach; ?> - </tbody> - </table> + <div class="wrapper table reviews"> + <table class="data table reviews" id="my-reviews-table"> + <thead> + <tr> + <th class="col date"><?php echo __('Created') ?></th> + <th class="col item"><?php echo __('Product Name') ?></th> + <th class="col summary"><?php echo __('Summary') ?></th> + <th class="col description"><?php echo __('Description') ?></th> + <th class="col actions"> </th> + </tr> + </thead> + <tbody> + <?php foreach ($this->getCollection() as $_review): ?> + <tr> + <td class="col date"><?php echo $this->dateFormat($_review->getReviewCreatedAt()); ?></td> + <td class="col item"> + <strong class="product name"> + <a href="<?php echo $this->getProductLink() ?>id/<?php echo $_review->getEntityPkValue() ?>"><?php echo $this->escapeHtml($_review->getName()) ?></a> + </strong> + </td> + <td class="col summary"> + <?php if($_review->getSum()): ?> + <div class="rating"> + <span style="width:<?php echo ( $_review->getSum() / $_review->getCount() ) ?>%;"></span> + </div> + <?php endif; ?> + </td> + <td class="col description"> + <?php echo $this->helper('Magento\Review\Helper\Data')->getDetailHtml($_review->getDetail()) ?> + </td> + <td class="col actions"> + <a href="<?php echo $this->getReviewLink() ?>id/<?php echo $_review->getReviewId() ?>" class="action more"> + <span><?php echo __('View Details') ?></span> + </a> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + </div> <div class="toolbar reviews bottom"> <?php echo $this->getToolbarHtml() ?> </div> diff --git a/app/code/Magento/Review/view/frontend/form.phtml b/app/code/Magento/Review/view/frontend/form.phtml index 16724df55f4..06e3514a257 100644 --- a/app/code/Magento/Review/view/frontend/form.phtml +++ b/app/code/Magento/Review/view/frontend/form.phtml @@ -28,6 +28,7 @@ <div class="content"> <?php if ($this->getAllowWriteReviewFlag()): ?> <form action="<?php echo $this->getAction() ?>" method="post" id="review-form"> + <?php echo $this->getBlockHtml('formkey'); ?> <?php echo $this->getChildHtml('form_fields_before')?> <fieldset class="fieldset" data-hasrequired="<?php __('* Required Fields'); ?>"> <legend class="legend"><span><?php echo __("You're reviewing:"); ?></span><strong><?php echo $this->escapeHtml($this->getProductInfo()->getName()) ?></strong></legend><br /> diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus.php index 8d011a64868..4d207c6a031 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus.php @@ -33,7 +33,8 @@ class NewStatus extends \Magento\Backend\Block\Widget\Form\Container { $this->_objectId = 'status'; $this->_controller = 'adminhtml_order_status'; - $this->_mode = 'new'; + $this->_blockGroup = 'Magento_Sales'; + $this->_mode = 'newStatus'; parent::_construct(); $this->_updateButton('save', 'label', __('Save Status')); diff --git a/app/code/Magento/Sales/Controller/Billing/Agreement.php b/app/code/Magento/Sales/Controller/Billing/Agreement.php index aa7b044629e..5cdbc395d97 100644 --- a/app/code/Magento/Sales/Controller/Billing/Agreement.php +++ b/app/code/Magento/Sales/Controller/Billing/Agreement.php @@ -29,7 +29,6 @@ */ namespace Magento\Sales\Controller\Billing; -use Magento\App\Action\NotFoundException; use Magento\App\RequestInterface; class Agreement extends \Magento\App\Action\Action @@ -188,7 +187,10 @@ class Agreement extends \Magento\App\Action\Action public function cancelAction() { $agreement = $this->_initAgreement(); - if ($agreement && $agreement->canCancel()) { + if (!$agreement) { + return; + } + if ($agreement->canCancel()) { try { $agreement->cancel(); $this->messageManager->addNotice( @@ -207,22 +209,25 @@ class Agreement extends \Magento\App\Action\Action /** * Init billing agreement model from request * - * @return \Magento\Sales\Model\Billing\Agreement + * @return \Magento\Sales\Model\Billing\Agreement|bool */ protected function _initAgreement() { $agreementId = $this->getRequest()->getParam('agreement'); if ($agreementId) { + /** @var \Magento\Sales\Model\Billing\Agreement $billingAgreement */ $billingAgreement = $this->_objectManager->create('Magento\Sales\Model\Billing\Agreement') ->load($agreementId); - if (!$billingAgreement->getAgreementId()) { - $this->messageManager->addError(__('Please specify the correct billing agreement ID and try again.')); - $this->_redirect('*/*/'); - return false; + $currentCustomerId = $this->_getSession()->getCustomerId(); + $agreementCustomerId = $billingAgreement->getCustomerId(); + if ($billingAgreement->getId() && $agreementCustomerId == $currentCustomerId) { + $this->_coreRegistry->register('current_billing_agreement', $billingAgreement); + return $billingAgreement; } } - $this->_coreRegistry->register('current_billing_agreement', $billingAgreement); - return $billingAgreement; + $this->messageManager->addError(__('Please specify the correct billing agreement ID and try again.')); + $this->_redirect('*/*/'); + return false; } /** diff --git a/app/code/Magento/Sales/Model/Billing/Agreement.php b/app/code/Magento/Sales/Model/Billing/Agreement.php index 735197093bd..8cca0d6b98a 100644 --- a/app/code/Magento/Sales/Model/Billing/Agreement.php +++ b/app/code/Magento/Sales/Model/Billing/Agreement.php @@ -24,6 +24,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Model\Billing; + /** * Billing Agreement abstract model * @@ -46,8 +48,6 @@ * @method string getAgreementLabel() * @method \Magento\Sales\Model\Billing\Agreement setAgreementLabel(string $value) */ -namespace Magento\Sales\Model\Billing; - class Agreement extends \Magento\Payment\Model\Billing\AbstractAgreement { const STATUS_ACTIVE = 'active'; diff --git a/app/code/Magento/Sales/Model/Quote/Address.php b/app/code/Magento/Sales/Model/Quote/Address.php index 872e7d1d5ac..476688064f3 100644 --- a/app/code/Magento/Sales/Model/Quote/Address.php +++ b/app/code/Magento/Sales/Model/Quote/Address.php @@ -336,27 +336,66 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress protected function _beforeSave() { parent::_beforeSave(); + $this->_populateBeforeSaveData(); + return $this; + } + + /** + * Set the required fields + */ + protected function _populateBeforeSaveData() + { if ($this->getQuote()) { - $quoteId = $this->getQuote()->getId(); - if ($quoteId) { - $this->setQuoteId($quoteId); - } else { - $this->_dataSaveAllowed = false; + $this->_dataSaveAllowed = (bool)$this->getQuote()->getId(); + + if ($this->getQuote()->getId()) { + $this->setQuoteId($this->getQuote()->getId()); } $this->setCustomerId($this->getQuote()->getCustomerId()); + /** * Init customer address id if customer address is assigned */ if ($this->getCustomerAddress()) { $this->setCustomerAddressId($this->getCustomerAddress()->getId()); } + + $this->setSameAsBilling((int)$this->_isSameAsBilling()); } - if ($this->getAddressType() == \Magento\Sales\Model\Quote\Address::TYPE_SHIPPING - && $this->getSameAsBilling() === null - ) { - $this->setSameAsBilling(1); - } - return $this; + } + + /** + * Returns true if shipping address is same as billing + * + * @return bool + */ + protected function _isSameAsBilling() + { + return $this->getAddressType() == \Magento\Sales\Model\Quote\Address::TYPE_SHIPPING + && ($this->_isNotRegisteredCustomer() || $this->_isDefaultShippingNullOrSameAsBillingAddress()); + } + + /** + * Checks if the user is a registered customer + * + * @return bool + */ + protected function _isNotRegisteredCustomer() + { + return !$this->getQuote()->getCustomerId() || $this->getCustomerAddressId() === null; + } + + /** + * Returns true if shipping address is same as billing or it is undefined + * + * @return bool + */ + protected function _isDefaultShippingNullOrSameAsBillingAddress() + { + $customer = $this->getQuote()->getCustomer(); + return !$customer->getDefaultShippingAddress() + || $customer->getDefaultBillingAddress() && $customer->getDefaultShippingAddress() + && $customer->getDefaultBillingAddress()->getId() == $customer->getDefaultShippingAddress()->getId(); } /** diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_newstatus.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_new.xml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_newstatus.xml rename to app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_new.xml diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/giftmessage.js b/app/code/Magento/Sales/view/adminhtml/order/create/giftmessage.js index 03799a9fb7f..20194784923 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/giftmessage.js +++ b/app/code/Magento/Sales/view/adminhtml/order/create/giftmessage.js @@ -244,7 +244,7 @@ GiftMessageSet.prototype = { } }, this); $('gift_options_giftmessage').show(); - } else { + } else if ($('gift_options_giftmessage')) { $('gift_options_giftmessage').hide(); } diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/totals/default.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/totals/default.phtml index 34454da994a..1cda86be4cd 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/totals/default.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/totals/default.phtml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<tr class="<?php echo $this->getTotal()->getCode(); ?>"> +<tr class="<?php echo $this->getTotal()->getCode(); ?> row-totals"> <td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?> <?php echo $this->escapeHtml($this->getTotal()->getTitle()); ?> diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/totals/grandtotal.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/totals/grandtotal.phtml index 64d82936474..87c40cb6bf4 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/totals/grandtotal.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/totals/grandtotal.phtml @@ -29,7 +29,7 @@ */ ?> <?php if ($this->includeTax() && $this->getTotalExclTax()>=0):?> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <strong><?php echo __('Grand Total Excl. Tax')?></strong> </td> @@ -38,7 +38,7 @@ </td> </tr> <?php echo $this->renderTotals('taxes', $this->getColspan()); ?> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <strong><?php echo __('Grand Total Incl. Tax')?></strong> </td> @@ -47,7 +47,7 @@ </td> </tr> <?php else:?> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <strong><?php echo $this->getTotal()->getTitle() ?></strong> </td> diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/totals/shipping.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/totals/shipping.phtml index cc9e7fbd967..49fc7be161f 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/totals/shipping.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/totals/shipping.phtml @@ -29,7 +29,7 @@ */ ?> <?php if ($this->displayBoth()):?> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <?php echo $this->getExcludeTaxLabel() ?> </td> @@ -37,7 +37,7 @@ <?php echo $this->formatPrice($this->getShippingExcludeTax()) ?> </td> </tr> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <?php echo $this->getIncludeTaxLabel() ?> </td> @@ -55,7 +55,7 @@ </td> </tr> <?php else:?> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <?php echo $this->escapeHtml($this->getTotal()->getTitle()) ?> </td> diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/totals/subtotal.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/totals/subtotal.phtml index f3c14a65b90..c0e89a9b703 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/totals/subtotal.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/totals/subtotal.phtml @@ -29,7 +29,7 @@ */ ?> <?php if ($this->displayBoth()):?> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <?php echo __('Subtotal (Excl. Tax)') ?> </td> @@ -37,7 +37,7 @@ <?php echo $this->formatPrice($this->getTotal()->getValueExclTax()) ?> </td> </tr> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <?php echo __('Subtotal (Incl. Tax)') ?> </td> @@ -46,7 +46,7 @@ </td> </tr> <?php else : ?> -<tr> +<tr class="row-totals"> <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <?php echo $this->getTotal()->getTitle() ?> </td> diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/totals/tax.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/totals/tax.phtml index 157b7c3094a..598bbc1e13c 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/totals/tax.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/totals/tax.phtml @@ -55,7 +55,7 @@ <?php endforeach; ?> <?php endif;?> <?php $class="{$this->getTotal()->getCode()} " . ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() ? 'summary-total' : ''); ?> -<tr<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> onclick="expandDetails(this, '.summary-details-<?php echo $taxIter;?>')"<?php endif; ?> class="<?php echo $class;?>"> +<tr<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> onclick="expandDetails(this, '.summary-details-<?php echo $taxIter;?>')"<?php endif; ?> class="<?php echo $class;?> row-totals"> <td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> <div class="summary-collapse"><?php echo $this->getTotal()->getTitle() ?></div> diff --git a/app/code/Magento/Sales/view/adminhtml/order/invoice/view/form.phtml b/app/code/Magento/Sales/view/adminhtml/order/invoice/view/form.phtml index a28086aac85..f229e7fa140 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/invoice/view/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/invoice/view/form.phtml @@ -28,9 +28,12 @@ <?php $_order = $_invoice->getOrder() ?> <?php echo $this->getChildHtml('order_info') ?> +<?php /* opening div is in app\code\Magento\Sales\view\adminhtml\order\view\info.phtml */?> + <?php if (!$_order->getIsVirtual()): ?> -<div class="clearfix"> +<div class="clearfix"> <?php /* if opening div from app\code\Magento\Sales\view\adminhtml\order\view\info.phtml was closed there */?> <?php endif; ?> + <div class="order-payment-method<?php if ($_order->getIsVirtual()): ?> order-payment-method-virtual<?php endif; ?>"> <?php /*Billing Address */ ?> <div class="fieldset-wrapper"> @@ -41,6 +44,7 @@ <div class="order-payment-currency"><?php echo __('The order was placed using %1.', $_order->getOrderCurrencyCode()) ?></div> </div> </div> + <?php if (!$_order->getIsVirtual()): ?> <div class="order-shipping-address"> <?php /*Shipping Address */ ?> @@ -68,20 +72,22 @@ </div> </div> </div> - <?php endif; ?> </div> + <?php endif; ?> + </div> <div class="fieldset-wrapper"> <div class="fieldset-wrapper-title"> <span class="title"><?php echo __('Items Invoiced') ?></span> </div> + <div id="invoice_item_container"> <?php echo $this->getChildHtml('invoice_items') ?> </div> </div> -<div class="clear"> +<div class="clearfix"> <div class="order-comments-history"> <div class="fieldset-wrapper"> <div class="fieldset-wrapper-title"> @@ -92,6 +98,7 @@ </fieldset> </div> </div> + <div class="order-totals"> <div class="fieldset-wrapper" id="history_form"> <div class="fieldset-wrapper-title"> diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js b/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js index 93a447ee8b5..e863c29b5a3 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js +++ b/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js @@ -141,7 +141,7 @@ Packaging.prototype = { height = parseFloat(pack.select('input[name="container_height"]')[0].value); packagesParams[packageId] = { container: pack.select('select[name="package_container"]')[0].value, - customs_value: parseInt(pack.select('input[name="package_customs_value"]')[0].value, 10), + customs_value: parseFloat(pack.select('input[name="package_customs_value"]')[0].value, 10), weight: isNaN(weight) ? '' : weight, length: isNaN(length) ? '' : length, width: isNaN(width) ? '' : width, diff --git a/app/code/Magento/Sales/view/adminhtml/order/view/info.phtml b/app/code/Magento/Sales/view/adminhtml/order/view/info.phtml index ab5b01810f3..06c78a73072 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/view/info.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/view/info.phtml @@ -30,7 +30,11 @@ $orderAdminDate = $this->formatDate($_order->getCreatedAtDate(), 'medium', true); $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true); ?> + +<?php /* the opening and closing divs of these two clearfixes are in app\code\core\Mage\Adminhtml\view\adminhtml\sales\order\invoice\create\form.phtml */?> + <div class="clearfix"> + <div class="order-information"> <?php /* Order Information */?> <div class="fieldset-wrapper"> @@ -107,6 +111,7 @@ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', </table> </div> </div> + <div class="order-account-information"> <?php /* Account Information */?> <div class="fieldset-wrapper"> @@ -144,10 +149,11 @@ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', </table> </div> </div> -<?php /* the opening and closing divs of these two clearfixes are in app\code\core\Mage\Adminhtml\view\adminhtml\sales\order\invoice\create\form.phtml */?> + </div> <div class="clearfix"> + <div class="order-billing-address"> <?php /* Billing Address */?> <div class="fieldset-wrapper"> @@ -160,6 +166,7 @@ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', <address><?php echo $_order->getBillingAddress()->format('html') ?></address> </div> </div> + <?php if (!$this->getOrder()->getIsVirtual()): ?> <div class="order-shipping-address"> <?php /* Shipping Address */ ?> @@ -175,3 +182,5 @@ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', </div> </div> <?php endif; ?> + +<?php /* closing div of this opening div are in app\code\Magento\Sales\view\adminhtml\order\invoice\view\form.phtml */?> diff --git a/app/code/Magento/Sales/view/frontend/billing/agreement/view.phtml b/app/code/Magento/Sales/view/frontend/billing/agreement/view.phtml index f352e60e34c..0cfe03596a6 100644 --- a/app/code/Magento/Sales/view/frontend/billing/agreement/view.phtml +++ b/app/code/Magento/Sales/view/frontend/billing/agreement/view.phtml @@ -35,31 +35,32 @@ </div> <div class="content"> <h2 class="subtitle caption"><?php echo __('Agreement Information') ?></h2> - <table class="data table"> - <thead> - <tr> - <th class="col id"><?php echo __('Reference ID:'); ?></th> - <th class="col status"><?php echo __('Status:'); ?></th> - <th class="col created"><?php echo __('Created:'); ?></th> - <?php if($this->getAgreementUpdatedAt()): ?> - <th class="col updated"><?php echo __('Updated:'); ?></th> - <?php endif; ?> - <th class="col payment"><?php echo __('Payment Method:'); ?></th> - </tr> - </thead> - <tbody> - <tr> - <td class="col id"><?php echo $this->escapeHtml($this->getReferenceId()); ?></td> - <td class="col status"><?php echo $this->getAgreementStatus() ?></td> - <td class="col created"><?php echo $this->escapeHtml($this->getAgreementCreatedAt()) ?></td> - <?php if($this->getAgreementUpdatedAt()): ?> - <td class="col updated"><?php echo $this->escapeHtml($this->getAgreementUpdatedAt()); ?></td> - <?php endif; ?> - <td class="col payment"><?php echo $this->getPaymentMethodTitle() ?></td> - </tr> - </tbody> - </table> - + <div class="wrapper table billing agreements"> + <table class="data table"> + <thead> + <tr> + <th class="col id"><?php echo __('Reference ID:'); ?></th> + <th class="col status"><?php echo __('Status:'); ?></th> + <th class="col created"><?php echo __('Created:'); ?></th> + <?php if($this->getAgreementUpdatedAt()): ?> + <th class="col updated"><?php echo __('Updated:'); ?></th> + <?php endif; ?> + <th class="col payment"><?php echo __('Payment Method:'); ?></th> + </tr> + </thead> + <tbody> + <tr> + <td class="col id"><?php echo $this->escapeHtml($this->getReferenceId()); ?></td> + <td class="col status"><?php echo $this->getAgreementStatus() ?></td> + <td class="col created"><?php echo $this->escapeHtml($this->getAgreementCreatedAt()) ?></td> + <?php if($this->getAgreementUpdatedAt()): ?> + <td class="col updated"><?php echo $this->escapeHtml($this->getAgreementUpdatedAt()); ?></td> + <?php endif; ?> + <td class="col payment"><?php echo $this->getPaymentMethodTitle() ?></td> + </tr> + </tbody> + </table> + </div> <?php $relatedOrders = $this->getRelatedOrders() ?> <?php if(count($relatedOrders) > 0): ?> <?php echo $this->getChildHtml('pager'); ?> diff --git a/app/code/Magento/Sales/view/frontend/billing/agreements.phtml b/app/code/Magento/Sales/view/frontend/billing/agreements.phtml index e2efcb4217b..356935219fb 100644 --- a/app/code/Magento/Sales/view/frontend/billing/agreements.phtml +++ b/app/code/Magento/Sales/view/frontend/billing/agreements.phtml @@ -27,32 +27,34 @@ <?php $billingAgreements = $this->getBillingAgreements(); ?> <?php if (count($billingAgreements) > 0): ?> <?php echo $this->getChildHtml('pager'); ?> - <table id="billing-agreements" class="data table billing agreements"> - <thead> - <tr> - <th class="col id"><?php echo __('Reference ID'); ?></th> - <th class="col status"><?php echo __('Status'); ?></th> - <th class="col created"><?php echo __('Created At'); ?></th> - <th class="col updated"><?php echo __('Updated At'); ?></th> - <th class="col payment"><?php echo __('Payment Method'); ?></th> - <th class="col actions"> </th> - </tr> - </thead> - <tbody> - <?php foreach ($billingAgreements as $item): ?> + <div class="wrapper table billing agreements"> + <table id="billing-agreements" class="data table billing agreements"> + <thead> <tr> - <td class="col id"><?php echo $this->getItemValue($item, 'reference_id') ?></td> - <td class="col status"><?php echo $this->getItemValue($item, 'status') ?></td> - <td class="col created"><?php echo $this->getItemValue($item, 'created_at') ?></td> - <td class="col updated"><?php echo $this->getItemValue($item, 'updated_at') ?></td> - <td class="col payment"><?php echo $this->getItemValue($item, 'payment_method_label') ?></td> - <td class="col actions"> - <a href="<?php echo $this->getItemValue($item, 'edit_url') ?>"><?php echo __('View') ?></a> - </td> + <th class="col id"><?php echo __('Reference ID'); ?></th> + <th class="col status"><?php echo __('Status'); ?></th> + <th class="col created"><?php echo __('Created At'); ?></th> + <th class="col updated"><?php echo __('Updated At'); ?></th> + <th class="col payment"><?php echo __('Payment Method'); ?></th> + <th class="col actions"> </th> </tr> - <?php endforeach; ?> - </tbody> - </table> + </thead> + <tbody> + <?php foreach ($billingAgreements as $item): ?> + <tr> + <td class="col id"><?php echo $this->getItemValue($item, 'reference_id') ?></td> + <td class="col status"><?php echo $this->getItemValue($item, 'status') ?></td> + <td class="col created"><?php echo $this->getItemValue($item, 'created_at') ?></td> + <td class="col updated"><?php echo $this->getItemValue($item, 'updated_at') ?></td> + <td class="col payment"><?php echo $this->getItemValue($item, 'payment_method_label') ?></td> + <td class="col actions"> + <a href="<?php echo $this->getItemValue($item, 'edit_url') ?>"><?php echo __('View') ?></a> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + </div> <?php else: ?> <div class="message info empty"><span><?php echo __('There are no billing agreements yet.') ?></span></div> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/frontend/order/creditmemo/items.phtml b/app/code/Magento/Sales/view/frontend/order/creditmemo/items.phtml index 5c3d8d85590..575e3c0912a 100644 --- a/app/code/Magento/Sales/view/frontend/order/creditmemo/items.phtml +++ b/app/code/Magento/Sales/view/frontend/order/creditmemo/items.phtml @@ -44,29 +44,31 @@ </div> <div class="order subtitle caption"><strong><?php echo __('Items Refunded') ?></strong></div> -<table class="data table order items creditmemo" id="my-refund-table-<?php echo $_creditmemo->getId(); ?>"> - <thead> - <tr> - <th class="col name"><?php echo __('Product Name') ?></th> - <th class="col sku"><?php echo __('SKU') ?></th> - <th class="col price"><?php echo __('Price') ?></th> - <th class="col qty"><?php echo __('Qty') ?></th> - <th class="col subtotal"><?php echo __('Subtotal') ?></th> - <th class="col discount"><?php echo __('Discount Amount') ?></th> - <th class="col total"><?php echo __('Row Total') ?></th> - </tr> - </thead> - <tfoot> - <?php echo $this->getTotalsHtml($_creditmemo);?> - </tfoot> - <?php $_items = $_creditmemo->getAllItems(); ?> - <?php $_count = count($_items) ?> - <?php foreach ($_items as $_item): ?> - <?php if ($_item->getOrderItem()->getParentItem()) continue; ?> - <tbody> - <?php echo $this->getItemHtml($_item) ?> - </tbody> - <?php endforeach; ?> -</table> +<div class="wrapper table order items creditmemo"> + <table class="data table order items creditmemo" id="my-refund-table-<?php echo $_creditmemo->getId(); ?>"> + <thead> + <tr> + <th class="col name"><?php echo __('Product Name') ?></th> + <th class="col sku"><?php echo __('SKU') ?></th> + <th class="col price"><?php echo __('Price') ?></th> + <th class="col qty"><?php echo __('Qty') ?></th> + <th class="col subtotal"><?php echo __('Subtotal') ?></th> + <th class="col discount"><?php echo __('Discount Amount') ?></th> + <th class="col total"><?php echo __('Row Total') ?></th> + </tr> + </thead> + <tfoot> + <?php echo $this->getTotalsHtml($_creditmemo);?> + </tfoot> + <?php $_items = $_creditmemo->getAllItems(); ?> + <?php $_count = count($_items) ?> + <?php foreach ($_items as $_item): ?> + <?php if ($_item->getOrderItem()->getParentItem()) continue; ?> + <tbody> + <?php echo $this->getItemHtml($_item) ?> + </tbody> + <?php endforeach; ?> + </table> +</div> <?php echo $this->getCommentsHtml($_creditmemo)?> <?php endforeach; ?> diff --git a/app/code/Magento/Sales/view/frontend/order/history.phtml b/app/code/Magento/Sales/view/frontend/order/history.phtml index 86ea2fcf963..0160af2e5e7 100644 --- a/app/code/Magento/Sales/view/frontend/order/history.phtml +++ b/app/code/Magento/Sales/view/frontend/order/history.phtml @@ -27,39 +27,41 @@ <?php echo $this->getChildHtml('info');?> <div class="order toolbar"><?php echo $this->getPagerHtml(); ?></div> <?php if($_orders->getSize()): ?> -<table class="data table orders history" id="my-orders-table"> - <thead> - <tr> - <th class="col id"><?php echo __('Order #') ?></th> - <th class="col date"><?php echo __('Date') ?></th> - <th class="col shipping"><?php echo __('Ship To') ?></th> - <th class="col total"><?php echo __('Order Total') ?></th> - <th class="col status"><?php echo __('Status') ?></th> - <th class="col actions"> </th> - </tr> - </thead> - <tbody> - <?php foreach ($_orders as $_order): ?> +<div class="wrapper table orders history"> + <table class="data table orders history" id="my-orders-table"> + <thead> <tr> - <td class="col id"><?php echo $_order->getRealOrderId() ?></td> - <td class="col date"><?php echo $this->formatDate($_order->getCreatedAtStoreDate()) ?></td> - <td class="col shipping"><?php echo $_order->getShippingAddress() ? $this->escapeHtml($_order->getShippingAddress()->getName()) : ' ' ?></td> - <td class="col total"><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></td> - <td class="col status"><em><?php echo $_order->getStatusLabel() ?></em></td> - <td class="col actions"> - <a href="<?php echo $this->getViewUrl($_order) ?>" class="action view"> - <span><?php echo __('View Order') ?></span> - </a> - <?php if ($this->helper('Magento\Sales\Helper\Reorder')->canReorder($_order)) : ?> - <a href="<?php echo $this->getReorderUrl($_order) ?>" class="action order"> - <span><?php echo __('Reorder') ?></span> - </a> - <?php endif ?> - </td> + <th class="col id"><?php echo __('Order #') ?></th> + <th class="col date"><?php echo __('Date') ?></th> + <th class="col shipping"><?php echo __('Ship To') ?></th> + <th class="col total"><?php echo __('Order Total') ?></th> + <th class="col status"><?php echo __('Status') ?></th> + <th class="col actions"> </th> </tr> - <?php endforeach; ?> - </tbody> -</table> + </thead> + <tbody> + <?php foreach ($_orders as $_order): ?> + <tr> + <td class="col id"><?php echo $_order->getRealOrderId() ?></td> + <td class="col date"><?php echo $this->formatDate($_order->getCreatedAtStoreDate()) ?></td> + <td class="col shipping"><?php echo $_order->getShippingAddress() ? $this->escapeHtml($_order->getShippingAddress()->getName()) : ' ' ?></td> + <td class="col total"><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></td> + <td class="col status"><em><?php echo $_order->getStatusLabel() ?></em></td> + <td class="col actions"> + <a href="<?php echo $this->getViewUrl($_order) ?>" class="action view"> + <span><?php echo __('View Order') ?></span> + </a> + <?php if ($this->helper('Magento\Sales\Helper\Reorder')->canReorder($_order)) : ?> + <a href="<?php echo $this->getReorderUrl($_order) ?>" class="action order"> + <span><?php echo __('Reorder') ?></span> + </a> + <?php endif ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> +</div> <div class="order toolbar bottom"><?php echo $this->getPagerHtml(); ?></div> <?php else: ?> <div class="message info empty"><span><?php echo __('You have placed no orders.'); ?></span></div> diff --git a/app/code/Magento/Sales/view/frontend/order/invoice/items.phtml b/app/code/Magento/Sales/view/frontend/order/invoice/items.phtml index b9be6d9379d..f4533843c7c 100644 --- a/app/code/Magento/Sales/view/frontend/order/invoice/items.phtml +++ b/app/code/Magento/Sales/view/frontend/order/invoice/items.phtml @@ -43,27 +43,29 @@ </a> </div> <div class="order subtitle caption"><strong><?php echo __('Items Invoiced') ?></strong></div> -<table class="data table order items invoice" id="my-invoice-table-<?php echo $_invoice->getId(); ?>"> - <thead> - <tr> - <th class="col name"><?php echo __('Product Name') ?></th> - <th class="col sku"><?php echo __('SKU') ?></th> - <th class="col price"><?php echo __('Price') ?></th> - <th class="col qty"><?php echo __('Qty Invoiced') ?></th> - <th class="col subtotal"><?php echo __('Subtotal') ?></th> - </tr> - </thead> - <tfoot> - <?php echo $this->getInvoiceTotalsHtml($_invoice)?> - </tfoot> - <?php $_items = $_invoice->getAllItems(); ?> - <?php $_count = count($_items) ?> - <?php foreach ($_items as $_item): ?> - <?php if ($_item->getOrderItem()->getParentItem()) continue; ?> - <tbody> - <?php echo $this->getItemHtml($_item) ?> - </tbody> - <?php endforeach; ?> -</table> +<div class="wrapper table order items invoice"> + <table class="data table order items invoice" id="my-invoice-table-<?php echo $_invoice->getId(); ?>"> + <thead> + <tr> + <th class="col name"><?php echo __('Product Name') ?></th> + <th class="col sku"><?php echo __('SKU') ?></th> + <th class="col price"><?php echo __('Price') ?></th> + <th class="col qty"><?php echo __('Qty Invoiced') ?></th> + <th class="col subtotal"><?php echo __('Subtotal') ?></th> + </tr> + </thead> + <tfoot> + <?php echo $this->getInvoiceTotalsHtml($_invoice)?> + </tfoot> + <?php $_items = $_invoice->getAllItems(); ?> + <?php $_count = count($_items) ?> + <?php foreach ($_items as $_item): ?> + <?php if ($_item->getOrderItem()->getParentItem()) continue; ?> + <tbody> + <?php echo $this->getItemHtml($_item) ?> + </tbody> + <?php endforeach; ?> + </table> +</div> <?php echo $this->getInvoiceCommentsHtml($_invoice)?> <?php endforeach; ?> diff --git a/app/code/Magento/Sales/view/frontend/order/items.phtml b/app/code/Magento/Sales/view/frontend/order/items.phtml index 0ab62e2dc07..807929dba4a 100644 --- a/app/code/Magento/Sales/view/frontend/order/items.phtml +++ b/app/code/Magento/Sales/view/frontend/order/items.phtml @@ -25,51 +25,53 @@ ?> <?php $_order = $this->getOrder() ?> <?php $_giftMessage; ?> -<table class="data table order items" id="my-orders-table" summary="<?php echo __('Items Ordered') ?>"> - <thead> - <tr> - <th class="col name"><?php echo __('Product Name') ?></th> - <th class="col sku"><?php echo __('SKU') ?></th> - <th class="col price"><?php echo __('Price') ?></th> - <th class="col qty"><?php echo __('Qty') ?></th> - <th class="col subtotal"><?php echo __('Subtotal') ?></th> - </tr> - </thead> - <tfoot> - <?php echo $this->getChildHtml('order_totals') ?> - </tfoot> - <?php $_items = $_order->getItemsCollection(); ?> - <?php $_index = 0; ?> - <?php $_count = $_items->count(); ?> - <?php $_giftMessage = ''?> - <?php foreach ($_items as $_item): ?> - <?php if ($_item->getParentItem()) continue; ?> - <tbody> - <?php echo $this->getItemHtml($_item) ?> - <?php if ($this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?> - <tr id="order-item-gift-message-<?php echo $_item->getId() ?>" role="region" aria-expanded="false" tabindex="-1" style="display:none;"> - <?php $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessageForEntity($_item); ?> - <td class="col message" colspan="7"> - <div class="gift message details"> - <a href="#" - title="<?php echo __('Close') ?>" - aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" - data-item-id="<?php echo $_item->getId()?>" - class="action close"> - <?php echo __('Close') ?> - </a> - <dl class="gift message"> - <dt class="gift sender"><strong class="label"><?php echo __('From:') ?></strong> <?php echo $this->escapeHtml($_giftMessage->getSender()) ?></dt> - <dt class="gift recipient"><strong class="label"><?php echo __('To:') ?></strong> <?php echo $this->escapeHtml($_giftMessage->getRecipient()) ?></dt> - <dd class="message text"><?php echo $this->helper('Magento\GiftMessage\Helper\Message')->getEscapedGiftMessage($_item) ?></dd> - </dl> - </div> - </td> +<div class="wrapper table order items"> + <table class="data table order items" id="my-orders-table" summary="<?php echo __('Items Ordered') ?>"> + <thead> + <tr> + <th class="col name"><?php echo __('Product Name') ?></th> + <th class="col sku"><?php echo __('SKU') ?></th> + <th class="col price"><?php echo __('Price') ?></th> + <th class="col qty"><?php echo __('Qty') ?></th> + <th class="col subtotal"><?php echo __('Subtotal') ?></th> </tr> - <?php endif ?> - </tbody> - <?php endforeach; ?> -</table> + </thead> + <tfoot> + <?php echo $this->getChildHtml('order_totals') ?> + </tfoot> + <?php $_items = $_order->getItemsCollection(); ?> + <?php $_index = 0; ?> + <?php $_count = $_items->count(); ?> + <?php $_giftMessage = ''?> + <?php foreach ($_items as $_item): ?> + <?php if ($_item->getParentItem()) continue; ?> + <tbody> + <?php echo $this->getItemHtml($_item) ?> + <?php if ($this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?> + <tr id="order-item-gift-message-<?php echo $_item->getId() ?>" role="region" aria-expanded="false" tabindex="-1" style="display:none;"> + <?php $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessageForEntity($_item); ?> + <td class="col message" colspan="7"> + <div class="gift message details"> + <a href="#" + title="<?php echo __('Close') ?>" + aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" + data-item-id="<?php echo $_item->getId()?>" + class="action close"> + <?php echo __('Close') ?> + </a> + <dl class="gift message"> + <dt class="gift sender"><strong class="label"><?php echo __('From:') ?></strong> <?php echo $this->escapeHtml($_giftMessage->getSender()) ?></dt> + <dt class="gift recipient"><strong class="label"><?php echo __('To:') ?></strong> <?php echo $this->escapeHtml($_giftMessage->getRecipient()) ?></dt> + <dd class="message text"><?php echo $this->helper('Magento\GiftMessage\Helper\Message')->getEscapedGiftMessage($_item) ?></dd> + </dl> + </div> + </td> + </tr> + <?php endif ?> + </tbody> + <?php endforeach; ?> + </table> +</div> <?php if ($_giftMessage): ?> <script type="text/javascript"> head.js("<?php echo $this->getViewFileUrl('Magento_Sales::gift-message.js')?>", function() { diff --git a/app/code/Magento/Sales/view/frontend/order/recent.phtml b/app/code/Magento/Sales/view/frontend/order/recent.phtml index d6ddd2d8484..d80817a33c2 100644 --- a/app/code/Magento/Sales/view/frontend/order/recent.phtml +++ b/app/code/Magento/Sales/view/frontend/order/recent.phtml @@ -36,39 +36,41 @@ <div class="content"> <?php echo $this->getChildHtml()?> <?php if( sizeof($_orders->getItems()) > 0 ): ?> - <table class="data table orders recent" id="my-orders-table"> - <thead> - <tr> - <th class="col id"><?php echo __('Order #') ?></th> - <th class="col date"><?php echo __('Date') ?></th> - <th class="col shipping"><?php echo __('Ship To') ?></th> - <th class="col total"><?php echo __('Order Total') ?></th> - <th class="col status"><?php echo __('Status') ?></th> - <th class="col actions"> </th> - </tr> - </thead> - <tbody> - <?php foreach ($_orders as $_order): ?> + <div class="wrapper table orders recent"> + <table class="data table orders recent" id="my-orders-table"> + <thead> <tr> - <td class="col id"><?php echo $_order->getRealOrderId() ?></td> - <td class="col date"><?php echo $this->formatDate($_order->getCreatedAtStoreDate()) ?></td> - <td class="col shipping"><?php echo $_order->getShippingAddress() ? $this->escapeHtml($_order->getShippingAddress()->getName()) : ' ' ?></td> - <td class="col total"><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></td> - <td class="col status"><em><?php echo $_order->getStatusLabel() ?></em></td> - <td class="col actions"> - <a href="<?php echo $this->getViewUrl($_order) ?>" class="action view"> - <span><?php echo __('View Order') ?></span> - </a> - <?php if ($this->helper('Magento\Sales\Helper\Reorder')->canReorder($_order)) : ?> - <a href="<?php echo $this->getReorderUrl($_order) ?>" class="action order"> - <span><?php echo __('Reorder') ?></span> - </a> - <?php endif ?> - </td> + <th class="col id"><?php echo __('Order #') ?></th> + <th class="col date"><?php echo __('Date') ?></th> + <th class="col shipping"><?php echo __('Ship To') ?></th> + <th class="col total"><?php echo __('Order Total') ?></th> + <th class="col status"><?php echo __('Status') ?></th> + <th class="col actions"> </th> </tr> - <?php endforeach; ?> - </tbody> - </table> + </thead> + <tbody> + <?php foreach ($_orders as $_order): ?> + <tr> + <td class="col id"><?php echo $_order->getRealOrderId() ?></td> + <td class="col date"><?php echo $this->formatDate($_order->getCreatedAtStoreDate()) ?></td> + <td class="col shipping"><?php echo $_order->getShippingAddress() ? $this->escapeHtml($_order->getShippingAddress()->getName()) : ' ' ?></td> + <td class="col total"><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></td> + <td class="col status"><em><?php echo $_order->getStatusLabel() ?></em></td> + <td class="col actions"> + <a href="<?php echo $this->getViewUrl($_order) ?>" class="action view"> + <span><?php echo __('View Order') ?></span> + </a> + <?php if ($this->helper('Magento\Sales\Helper\Reorder')->canReorder($_order)) : ?> + <a href="<?php echo $this->getReorderUrl($_order) ?>" class="action order"> + <span><?php echo __('Reorder') ?></span> + </a> + <?php endif ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + </div> <?php else: ?> <div class="message info empty"><span><?php echo __('You have placed no orders.'); ?></span></div> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/frontend/order/shipment/items.phtml b/app/code/Magento/Sales/view/frontend/order/shipment/items.phtml index c3a54e80093..c02d6fd809f 100644 --- a/app/code/Magento/Sales/view/frontend/order/shipment/items.phtml +++ b/app/code/Magento/Sales/view/frontend/order/shipment/items.phtml @@ -84,22 +84,24 @@ </table> <?php endif; ?> <div class="order subtitle caption"><strong><?php echo __('Items Shipped') ?></strong></div> -<table class="data table order items shipment" id="my-shipment-table-<?php echo $_shipment->getId(); ?>"> - <thead> - <tr> - <th class="col name"><?php echo __('Product Name') ?></th> - <th class="col sku"><?php echo __('SKU') ?></th> - <th class="col qty"><?php echo __('Qty Shipped') ?></th> - </tr> - </thead> - <?php $_items = $_shipment->getAllItems(); ?> - <?php $_count = count($_items) ?> - <?php foreach ($_items as $_item): ?> - <?php if ($_item->getOrderItem()->getParentItem()) continue; ?> - <tbody> - <?php echo $this->getItemHtml($_item) ?> - </tbody> - <?php endforeach; ?> -</table> +<div class="wrapper table order items shipment"> + <table class="data table order items shipment" id="my-shipment-table-<?php echo $_shipment->getId(); ?>"> + <thead> + <tr> + <th class="col name"><?php echo __('Product Name') ?></th> + <th class="col sku"><?php echo __('SKU') ?></th> + <th class="col qty"><?php echo __('Qty Shipped') ?></th> + </tr> + </thead> + <?php $_items = $_shipment->getAllItems(); ?> + <?php $_count = count($_items) ?> + <?php foreach ($_items as $_item): ?> + <?php if ($_item->getOrderItem()->getParentItem()) continue; ?> + <tbody> + <?php echo $this->getItemHtml($_item) ?> + </tbody> + <?php endforeach; ?> + </table> +</div> <?php echo $this->getCommentsHtml($_shipment)?> <?php endforeach; ?> diff --git a/app/code/Magento/Sendfriend/view/frontend/send.phtml b/app/code/Magento/Sendfriend/view/frontend/send.phtml index 8b8d2af96f9..9cc5b689b8c 100644 --- a/app/code/Magento/Sendfriend/view/frontend/send.phtml +++ b/app/code/Magento/Sendfriend/view/frontend/send.phtml @@ -81,24 +81,29 @@ </div> </fieldset> - <fieldset class="fieldset recipients" id="recipients-options"> + <fieldset class="fieldset recipients"> <?php echo $this->getBlockHtml('formkey')?> <legend class="legend"><span><?php echo __('Recipient:') ?></span></legend><br /> + <div id="recipients-options"></div> + <div class="actions"> + <div class="primary"> + <?php if (1 < $this->getMaxRecipients()): ?> + <button type="button" id="add-recipient-button" class="action add"> + <span><?php echo __('Add Recipient') ?></span></button> + <?php endif; ?> + </div> + </div> + <div id="max-recipient-message" style="display: none;" class="message notice limit"> + <?php if ($this->getMaxRecipients()): ?> + <span><?php echo __('Maximum %1 email addresses allowed.', $this->getMaxRecipients()) ?></span> + <?php endif; ?> + </div> </fieldset> <div class="actions"> <div class="primary"> <button type="submit" class="action submit"<?php if (!$this->canSend()): ?> disabled="disabled"<?php endif ?>> <span><?php echo __('Send Email') ?></span></button> - <div id="max-recipient-message" style="display: none;" class="message notice limit"> - <?php if ($this->getMaxRecipients()): ?> - <span><?php echo __('Maximum %1 email addresses allowed.', $this->getMaxRecipients()) ?></span> - <?php endif; ?> - </div> - <?php if (1 < $this->getMaxRecipients()): ?> - <button type="button" id="add-recipient-button" class="action add"> - <span><?php echo __('Add Recipient') ?></span></button> - <?php endif; ?> </div> <div class="secondary"> <a class="action back" href="#" role="back"><span><?php echo __('Back') ?></span></a> diff --git a/app/code/Magento/Shipping/Model/Carrier/Tablerate.php b/app/code/Magento/Shipping/Model/Carrier/Tablerate.php index 1d85d68a630..afbd940434e 100644 --- a/app/code/Magento/Shipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/Shipping/Model/Carrier/Tablerate.php @@ -45,7 +45,7 @@ class Tablerate /** * @var string */ - protected $_default_condition_name = 'package_weight'; + protected $_defaultConditionName = 'package_weight'; /** * @var array @@ -150,7 +150,7 @@ class Tablerate if (!$request->getConditionName()) { $conditionName = $this->getConfigData('condition_name'); - $request->setConditionName($conditionName ? $conditionName : $this->_default_condition_name); + $request->setConditionName($conditionName ? $conditionName : $this->_defaultConditionName); } // Package weight and qty free shipping @@ -187,6 +187,14 @@ class Tablerate $method->setCost($rate['cost']); $result->append($method); + } else { + /** @var \Magento\Shipping\Model\Rate\Result\Error $error */ + $error = $this->_rateErrorFactory->create(array('data' => array( + 'carrier' => $this->_code, + 'carrier_title' => $this->getConfigData('title'), + 'error_message' => $this->getConfigData('specificerrmsg'), + ))); + $result->append($error); } return $result; diff --git a/app/code/Magento/Shipping/Model/Shipping.php b/app/code/Magento/Shipping/Model/Shipping.php index d88c2d0b6be..f0915339718 100644 --- a/app/code/Magento/Shipping/Model/Shipping.php +++ b/app/code/Magento/Shipping/Model/Shipping.php @@ -90,7 +90,7 @@ class Shipping /** * @var \Magento\Shipping\Model\Rate\RequestFactory */ - protected $_rateRequestFactory; + protected $_shipmentRequestFactory; /** * @var \Magento\Directory\Model\RegionFactory @@ -108,7 +108,7 @@ class Shipping * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Shipping\Model\Carrier\Factory $carrierFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory - * @param \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory + * @param \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Math\Division $mathDivision */ @@ -118,7 +118,7 @@ class Shipping \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Shipping\Model\Carrier\Factory $carrierFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, - \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory, + \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Math\Division $mathDivision ) { @@ -127,7 +127,7 @@ class Shipping $this->_storeManager = $storeManager; $this->_carrierFactory = $carrierFactory; $this->_rateResultFactory = $rateResultFactory; - $this->_rateRequestFactory = $rateRequestFactory; + $this->_shipmentRequestFactory = $shipmentRequestFactory; $this->_regionFactory = $regionFactory; $this->mathDivision = $mathDivision; } @@ -441,7 +441,7 @@ class Shipping public function collectRatesByAddress(\Magento\Object $address, $limitCarrier = null) { /** @var $request \Magento\Shipping\Model\Rate\Request */ - $request = $this->_rateRequestFactory->create(); + $request = $this->_shipmentRequestFactory->create(); $request->setAllItems($address->getAllItems()); $request->setDestCountryId($address->getCountryId()); $request->setDestRegionId($address->getRegionId()); diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index 83da0814851..7c84d72776c 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -48,7 +48,7 @@ class Labels extends \Magento\Shipping\Model\Shipping * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Shipping\Model\Carrier\Factory $carrierFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory - * @param \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory + * @param \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Math\Division $mathDivision * @param \Magento\Backend\Model\Auth\Session $authSession @@ -59,7 +59,7 @@ class Labels extends \Magento\Shipping\Model\Shipping \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Shipping\Model\Carrier\Factory $carrierFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, - \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory, + \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Math\Division $mathDivision, \Magento\Backend\Model\Auth\Session $authSession, @@ -73,7 +73,7 @@ class Labels extends \Magento\Shipping\Model\Shipping $storeManager, $carrierFactory, $rateResultFactory, - $rateRequestFactory, + $shipmentRequestFactory, $regionFactory, $mathDivision ); @@ -107,7 +107,7 @@ class Labels extends \Magento\Shipping\Model\Shipping $originStreet1 = $this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_ADDRESS1, $shipmentStoreId); $originStreet2 = $this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_ADDRESS2, $shipmentStoreId); - $storeInfo = new \Magento\Object($this->_coreStoreConfig->getConfig('general/store_information', $shipmentStoreId)); + $storeInfo = new \Magento\Object((array)$this->_coreStoreConfig->getConfig('general/store_information', $shipmentStoreId)); if (!$admin->getFirstname() || !$admin->getLastname() || !$storeInfo->getName() || !$storeInfo->getPhone() || !$originStreet1 || !$this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId) @@ -120,7 +120,7 @@ class Labels extends \Magento\Shipping\Model\Shipping } /** @var $request \Magento\Shipping\Model\Shipment\Request */ - $request = $this->_request; + $request = $this->_shipmentRequestFactory->create(); $request->setOrderShipment($orderShipment); $request->setShipperContactPersonName($admin->getName()); $request->setShipperContactPersonFirstName($admin->getFirstname()); diff --git a/app/code/Magento/Shipping/etc/adminhtml/system.xml b/app/code/Magento/Shipping/etc/adminhtml/system.xml index 5788ff89421..2e9022e2565 100644 --- a/app/code/Magento/Shipping/etc/adminhtml/system.xml +++ b/app/code/Magento/Shipping/etc/adminhtml/system.xml @@ -206,6 +206,7 @@ </field> <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Show Method if Not Applicable</label> + <frontend_class>shipping-skip-hide</frontend_class> <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> </field> <field id="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php index 93cae322266..290c23d575e 100644 --- a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php +++ b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php @@ -244,7 +244,7 @@ class Storage if (!$this->mediaWriteDirectory->isExist($currentPath)) { throw new \Magento\Core\Exception(__('We cannot find a directory with this name.')); } - $paths = $this->mediaWriteDirectory->search('#.*#', $currentPath); + $paths = $this->mediaWriteDirectory->search('.*', $currentPath); $directories = array(); foreach ($paths as $path) { if ($this->mediaWriteDirectory->isDirectory($path)) { @@ -261,7 +261,7 @@ class Storage */ public function getFilesCollection() { - $paths = $this->mediaWriteDirectory->search('#.*#', $this->_helper->getCurrentPath()); + $paths = $this->mediaWriteDirectory->search('.*', $this->_helper->getCurrentPath()); $files = array(); $requestParams = $this->_helper->getRequestParams(); $storageType = $this->_helper->getStorageType(); diff --git a/app/code/Magento/Theme/view/frontend/layout/default.xml b/app/code/Magento/Theme/view/frontend/layout/default.xml index 916209e43ed..3f4d4d139b9 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default.xml @@ -26,7 +26,7 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <block class="Magento\Theme\Block\Html" name="root" output="1" template="3columns.phtml"> <block class="Magento\Theme\Block\Html\Head" name="head" as="head"> - <block class="Magento\View\Element\Js\Cookie" name="js_cookies" template="Magento_Theme:js/cookie.phtml"/> + <block class="Magento\View\Element\Js\Cookie" name="js_cookies" template="Magento_Theme::js/cookie.phtml"/> </block> <container name="after_body_start" as="after_body_start" label="Page Top"/> <container name="header-container" label="Page Header Container" as="header-container" htmlTag="header" htmlClass="header"> diff --git a/app/code/Magento/Usa/Helper/Data.php b/app/code/Magento/Usa/Helper/Data.php index b4e58f212c9..80451962327 100644 --- a/app/code/Magento/Usa/Helper/Data.php +++ b/app/code/Magento/Usa/Helper/Data.php @@ -127,25 +127,25 @@ class Data extends \Magento\App\Helper\AbstractHelper public function displayGirthValue($shippingMethod) { if (in_array($shippingMethod, array( - 'usps_Priority Mail International', - 'usps_Priority Mail International Small Flat Rate Box', - 'usps_Priority Mail International Medium Flat Rate Box', - 'usps_Priority Mail International Large Flat Rate Box', - 'usps_Priority Mail International Flat Rate Envelope', - 'usps_Express Mail International Flat Rate Envelope', - 'usps_Express Mail Hold For Pickup', - 'usps_Express Mail International', - 'usps_First-Class Mail International Package', - 'usps_First-Class Mail International Parcel', - 'usps_First-Class Mail International Large Envelope', - 'usps_First-Class Mail International', - 'usps_Global Express Guaranteed (GXG)', - 'usps_USPS GXG Envelopes', - 'usps_Global Express Guaranteed Non-Document Non-Rectangular', - 'usps_Media Mail', - 'usps_Parcel Post', - 'usps_Express Mail', - 'usps_Priority Mail' + 'usps_0_FCLE', // First-Class Mail Large Envelope + 'usps_1', // Priority Mail + 'usps_2', // Priority Mail Express Hold For Pickup + 'usps_3', // Priority Mail Express + 'usps_4', // Standard Post + 'usps_6', // Media Mail + 'usps_INT_1', // Priority Mail Express International + 'usps_INT_2', // Priority Mail International + 'usps_INT_4', // Global Express Guaranteed (GXG) + 'usps_INT_7', // Global Express Guaranteed Non-Document Non-Rectangular + 'usps_INT_8', // Priority Mail International Flat Rate Envelope + 'usps_INT_9', // Priority Mail International Medium Flat Rate Box + 'usps_INT_10', // Priority Mail Express International Flat Rate Envelope + 'usps_INT_11', // Priority Mail International Large Flat Rate Box + 'usps_INT_12', // USPS GXG Envelopes + 'usps_INT_14', // First-Class Mail International Large Envelope + 'usps_INT_16', // Priority Mail International Small Flat Rate Box + 'usps_INT_20', // Priority Mail International Small Flat Rate Envelope + 'usps_INT_26', // Priority Mail Express International Flat Rate Boxes ))) { return true; } else { diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php index ee182bdc332..422d5d8371a 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php @@ -849,10 +849,6 @@ class Dhl $priceArr = array(); $errorTitle = 'Unable to retrieve quotes'; - $tr = get_html_translation_table(HTML_ENTITIES); - unset($tr['<'], $tr['>'], $tr['"']); - $response = str_replace(array_keys($tr), array_values($tr), $response); - if (strlen(trim($response)) > 0) { if (strpos(trim($response), '<?xml') === 0) { $xml = simplexml_load_string($response); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php index b621578c4b2..61343c0f734 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php @@ -981,10 +981,6 @@ class International */ protected function _parseResponse($response) { - $htmlTranslationTable = get_html_translation_table(HTML_ENTITIES); - unset($htmlTranslationTable['<'], $htmlTranslationTable['>'], $htmlTranslationTable['"']); - $response = str_replace(array_keys($htmlTranslationTable), array_values($htmlTranslationTable), $response); - $responseError = __('The response is in wrong format.'); if (strlen(trim($response)) > 0) { @@ -1704,10 +1700,6 @@ class International $errorTitle = __('Unable to retrieve tracking'); $resultArr = array(); - $htmlTranslationTable = get_html_translation_table(HTML_ENTITIES); - unset($htmlTranslationTable['<'], $htmlTranslationTable['>'], $htmlTranslationTable['"']); - $response = str_replace(array_keys($htmlTranslationTable), array_values($htmlTranslationTable), $response); - if (strlen(trim($response)) > 0) { $xml = simplexml_load_string($response); if (!is_object($xml)) { diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php index e8b32be7a26..6276400969f 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php @@ -49,15 +49,32 @@ class Pdf */ protected $_request; + /** + * @var Pdf\PageBuilder + */ + protected $_pageBuilder; + + /** + * @var Pdf\PageFactory + */ + protected $_pageFactory; + /** * Dhl International Label Creation Class constructor * * @param array $arguments + * @param Pdf\PageBuilder $pageBuilder + * @param Pdf\PageFactory $pageFactory */ - public function __construct(array $arguments) - { - $this->_info = $arguments['info']; + public function __construct( + array $arguments, + \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\PageBuilder $pageBuilder, + \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\PageFactory $pageFactory + ) { + $this->_info = $arguments['info']; $this->_request = $arguments['request']; + $this->_pageBuilder = $pageBuilder; + $this->_pageFactory = $pageFactory; } /** @@ -69,14 +86,10 @@ class Pdf { $pdf = new \Zend_Pdf(); - $pdfBuilder = new \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\PageBuilder(); - - $template = new \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\Page(\Zend_Pdf_Page::SIZE_A4_LANDSCAPE); - $pdfBuilder->setPage($template) + $template = $this->_pageFactory->create(array('param1' => \Zend_Pdf_Page::SIZE_A4_LANDSCAPE)); + $this->_pageBuilder->setPage($template) ->addProductName((string)$this->_info->ProductShortName) ->addProductContentCode((string)$this->_info->ProductContentCode) - //->addUnitId({unitId}) - //->addReferenceData({referenceData}) ->addSenderInfo($this->_info->Shipper) ->addOriginInfo((string)$this->_info->OriginServiceArea->ServiceAreaCode) ->addReceiveInfo($this->_info->Consignee) @@ -101,8 +114,8 @@ class Pdf $packages = array_values($this->_request->getPackages()); $i = 0; foreach ($this->_info->Pieces->Piece as $piece) { - $page = new \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\Page($template); - $pdfBuilder->setPage($page) + $page = $this->_pageFactory->create(array('param1' => $template)); + $this->_pageBuilder->setPage($page) ->addPieceNumber((int)$piece->PieceNumber, (int)$this->_info->Piece) ->addContentInfo($packages[$i]) ->addPieceIdBarcode( diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php index b1a6ee177fc..e4e03435c96 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php @@ -115,7 +115,7 @@ class Page extends \Zend_Pdf_Page * @throws \Zend_Pdf_Exception * @return \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\Page */ - public function drawText($text, $x, $y, $charEncoding = '', $align = self::ALIGN_LEFT) + public function drawText($text, $x, $y, $charEncoding = 'UTF-8', $align = self::ALIGN_LEFT) { $left = null; switch ($align) { @@ -156,7 +156,7 @@ class Page extends \Zend_Pdf_Page $y = $this->drawLines(array_filter($subLines), $x, $y, $maxWidth, $align); continue; } - $this->drawText($line, $x, $y, null, $align); + $this->drawText($line, $x, $y, 'UTF-8', $align); $y -= ceil($this->getFontSize()); } return $y; diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php index 37694a8ad23..c394c71a3a7 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php @@ -408,7 +408,7 @@ class PageBuilder if (!strlen($code)) { throw new \InvalidArgumentException(__('Destination facility code is empty')); } - $this->_page->drawText($code, $this->_x(144), $this->_y(186), null, + $this->_page->drawText($code, $this->_x(144), $this->_y(186), 'UTF-8', \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\Page::ALIGN_CENTER ); @@ -559,7 +559,7 @@ class PageBuilder { $this->_page->saveGS(); - if(!strlen($number) || !strlen($barCode)) { + if (!strlen($number) || !strlen($barCode)) { throw new \InvalidArgumentException(__('Waybill barcode information is missing')); } $image = new \Zend_Pdf_Resource_Image_Png("data://image/png;base64," . $barCode); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php old mode 100644 new mode 100755 index 7ee88457929..a37656e60fb --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php @@ -135,6 +135,11 @@ class Usps */ protected $_productCollFactory; + /** + * @var \Zend_Http_ClientFactory + */ + protected $_httpClientFactory; + /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory @@ -151,6 +156,7 @@ class Usps * @param \Magento\Directory\Helper\Data $directoryData * @param \Magento\Usa\Helper\Data $usaData * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Zend_Http_ClientFactory $httpClientFactory * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -171,11 +177,12 @@ class Usps \Magento\Directory\Helper\Data $directoryData, \Magento\Usa\Helper\Data $usaData, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Zend_Http_ClientFactory $httpClientFactory, array $data = array() ) { $this->_usaData = $usaData; $this->_productCollFactory = $productCollFactory; - $this->_xmlElFactory = $xmlElFactory; + $this->_httpClientFactory = $httpClientFactory; parent::__construct( $coreStoreConfig, $rateErrorFactory, @@ -407,7 +414,7 @@ class Usps $service = $r->getService(); } if ($r->getContainer() == 'FLAT RATE BOX' || $r->getContainer() == 'FLAT RATE ENVELOPE') { - $service = 'PRIORITY'; + $service = 'Priority'; } $package->addChild('Service', $service); @@ -478,7 +485,7 @@ class Usps if (!$url) { $url = $this->_defaultGatewayUrl; } - $client = new \Zend_Http_Client(); + $client = $this->_httpClientFactory->create(); $client->setUri($url); $client->setConfig(array('maxredirects'=>0, 'timeout'=>30)); $client->setParameterGet('API', $api); @@ -494,6 +501,7 @@ class Usps } $this->_debug($debugData); } + return $this->_parseXmlResponse($responseBody); } @@ -506,6 +514,7 @@ class Usps */ protected function _parseXmlResponse($response) { + $r = $this->_rawRequest; $costArr = array(); $priceArr = array(); if (strlen(trim($response)) > 0) { @@ -517,39 +526,27 @@ class Usps $response ); } - $xml = simplexml_load_string($response); if (is_object($xml)) { - if (is_object($xml->Number) && is_object($xml->Description) && (string)$xml->Description!='') { - $errorTitle = (string)$xml->Description; - } elseif (is_object($xml->Package) - && is_object($xml->Package->Error) - && is_object($xml->Package->Error->Description) - && (string)$xml->Package->Error->Description!='' - ) { - $errorTitle = (string)$xml->Package->Error->Description; - } else { - $errorTitle = 'Sorry, something went wrong. Please try again or contact us and we\'ll try to help.'; - } - $r = $this->_rawRequest; - $allowedMethods = explode(",", $this->getConfigData('allowed_methods')); - $allMethods = $this->getCode('method'); - $newMethod = false; + $allowedMethods = explode(',', $this->getConfigData('allowed_methods')); + $serviceCodeToActualNameMap = array(); + /** + * US Rates + */ if ($this->_isUSCountry($r->getDestCountryId())) { if (is_object($xml->Package) && is_object($xml->Package->Postage)) { foreach ($xml->Package->Postage as $postage) { $serviceName = $this->_filterServiceName((string)$postage->MailService); - $postage->MailService = $serviceName; - if (in_array($serviceName, $allowedMethods)) { - $costArr[$serviceName] = (string)$postage->Rate; - $priceArr[$serviceName] = $this->getMethodPrice( + $_serviceCode = $this->getCode('method_to_code', $serviceName); + $serviceCode = $_serviceCode ? $_serviceCode : (string)$postage->attributes()->CLASSID; + $serviceCodeToActualNameMap[$serviceCode] = $serviceName; + if (in_array($serviceCode, $allowedMethods)) { + $costArr[$serviceCode] = (string)$postage->Rate; + $priceArr[$serviceCode] = $this->getMethodPrice( (string)$postage->Rate, - $serviceName + $serviceCode ); - } elseif (!in_array($serviceName, $allMethods)) { - $allMethods[] = $serviceName; - $newMethod = true; } } asort($priceArr); @@ -561,24 +558,20 @@ class Usps if (is_object($xml->Package) && is_object($xml->Package->Service)) { foreach ($xml->Package->Service as $service) { $serviceName = $this->_filterServiceName((string)$service->SvcDescription); - $service->SvcDescription = $serviceName; - if (in_array($serviceName, $allowedMethods)) { - $costArr[$serviceName] = (string)$service->Postage; - $priceArr[$serviceName] = $this->getMethodPrice( + $serviceCode = 'INT_' . (string)$service->attributes()->ID; + $serviceCodeToActualNameMap[$serviceCode] = $serviceName; + if (in_array($serviceCode, $allowedMethods)) { + $costArr[$serviceCode] = (string)$service->Postage; + $priceArr[$serviceCode] = $this->getMethodPrice( (string)$service->Postage, - $serviceName + $serviceCode ); - } elseif (!in_array($serviceName, $allMethods)) { - $allMethods[] = $serviceName; - $newMethod = true; } } asort($priceArr); } } } - } else { - $errorTitle = 'Response is in the wrong format'; } } @@ -595,7 +588,11 @@ class Usps $rate->setCarrier('usps'); $rate->setCarrierTitle($this->getConfigData('title')); $rate->setMethod($method); - $rate->setMethodTitle($method); + $rate->setMethodTitle( + isset($serviceCodeToActualNameMap[$method]) + ? $serviceCodeToActualNameMap[$method] + : $this->getCode('method', $method) + ); $rate->setCost($costArr[$method]); $rate->setPrice($price); $result->append($rate); @@ -615,59 +612,171 @@ class Usps public function getCode($type, $code='') { $codes = array( + 'method' => array( + '0_FCLE' => __('First-Class Mail Large Envelope'), + '0_FCL' => __('First-Class Mail Letter'), + '0_FCP' => __('First-Class Mail Parcel'), + '0_FCPC' => __('First-Class Mail Postcards'), + '1' => __('Priority Mail'), + '2' => __('Priority Mail Express Hold For Pickup'), + '3' => __('Priority Mail Express'), + '4' => __('Standard Post'), + '6' => __('Media Mail'), + '7' => __('Library Mail'), + '13' => __('Priority Mail Express Flat Rate Envelope'), + '15' => __('First-Class Mail Large Postcards'), + '16' => __('Priority Mail Flat Rate Envelope'), + '17' => __('Priority Mail Medium Flat Rate Box'), + '22' => __('Priority Mail Large Flat Rate Box'), + '23' => __('Priority Mail Express Sunday/Holiday Delivery'), + '25' => __('Priority Mail Express Sunday/Holiday Delivery Flat Rate Envelope'), + '27' => __('Priority Mail Express Flat Rate Envelope Hold For Pickup'), + '28' => __('Priority Mail Small Flat Rate Box'), + '29' => __('Priority Mail Padded Flat Rate Envelope'), + '30' => __('Priority Mail Express Legal Flat Rate Envelope'), + '31' => __('Priority Mail Express Legal Flat Rate Envelope Hold For Pickup'), + '32' => __('Priority Mail Express Sunday/Holiday Delivery Legal Flat Rate Envelope'), + '33' => __('Priority Mail Hold For Pickup'), + '34' => __('Priority Mail Large Flat Rate Box Hold For Pickup'), + '35' => __('Priority Mail Medium Flat Rate Box Hold For Pickup'), + '36' => __('Priority Mail Small Flat Rate Box Hold For Pickup'), + '37' => __('Priority Mail Flat Rate Envelope Hold For Pickup'), + '38' => __('Priority Mail Gift Card Flat Rate Envelope'), + '39' => __('Priority Mail Gift Card Flat Rate Envelope Hold For Pickup'), + '40' => __('Priority Mail Window Flat Rate Envelope'), + '41' => __('Priority Mail Window Flat Rate Envelope Hold For Pickup'), + '42' => __('Priority Mail Small Flat Rate Envelope'), + '43' => __('Priority Mail Small Flat Rate Envelope Hold For Pickup'), + '44' => __('Priority Mail Legal Flat Rate Envelope'), + '45' => __('Priority Mail Legal Flat Rate Envelope Hold For Pickup'), + '46' => __('Priority Mail Padded Flat Rate Envelope Hold For Pickup'), + '47' => __('Priority Mail Regional Rate Box A'), + '48' => __('Priority Mail Regional Rate Box A Hold For Pickup'), + '49' => __('Priority Mail Regional Rate Box B'), + '50' => __('Priority Mail Regional Rate Box B Hold For Pickup'), + '53' => __('First-Class Package Service Hold For Pickup'), + '55' => __('Priority Mail Express Flat Rate Boxes'), + '56' => __('Priority Mail Express Flat Rate Boxes Hold For Pickup'), + '57' => __('Priority Mail Express Sunday/Holiday Delivery Flat Rate Boxes'), + '58' => __('Priority Mail Regional Rate Box C'), + '59' => __('Priority Mail Regional Rate Box C Hold For Pickup'), + '61' => __('First-Class Package Service'), + '62' => __('Priority Mail Express Padded Flat Rate Envelope'), + '63' => __('Priority Mail Express Padded Flat Rate Envelope Hold For Pickup'), + '64' => __('Priority Mail Express Sunday/Holiday Delivery Padded Flat Rate Envelope'), + 'INT_1' => __('Priority Mail Express International'), + 'INT_2' => __('Priority Mail International'), + 'INT_4' => __('Global Express Guaranteed (GXG)'), + 'INT_5' => __('Global Express Guaranteed Document'), + 'INT_6' => __('Global Express Guaranteed Non-Document Rectangular'), + 'INT_7' => __('Global Express Guaranteed Non-Document Non-Rectangular'), + 'INT_8' => __('Priority Mail International Flat Rate Envelope'), + 'INT_9' => __('Priority Mail International Medium Flat Rate Box'), + 'INT_10' => __('Priority Mail Express International Flat Rate Envelope'), + 'INT_11' => __('Priority Mail International Large Flat Rate Box'), + 'INT_12' => __('USPS GXG Envelopes'), + 'INT_13' => __('First-Class Mail International Letter'), + 'INT_14' => __('First-Class Mail International Large Envelope'), + 'INT_15' => __('First-Class Package International Service'), + 'INT_16' => __('Priority Mail International Small Flat Rate Box'), + 'INT_17' => __('Priority Mail Express International Legal Flat Rate Envelope'), + 'INT_18' => __('Priority Mail International Gift Card Flat Rate Envelope'), + 'INT_19' => __('Priority Mail International Window Flat Rate Envelope'), + 'INT_20' => __('Priority Mail International Small Flat Rate Envelope'), + 'INT_21' => __('First-Class Mail International Postcard'), + 'INT_22' => __('Priority Mail International Legal Flat Rate Envelope'), + 'INT_23' => __('Priority Mail International Padded Flat Rate Envelope'), + 'INT_24' => __('Priority Mail International DVD Flat Rate priced box'), + 'INT_25' => __('Priority Mail International Large Video Flat Rate priced box'), + 'INT_26' => __('Priority Mail Express International Flat Rate Boxes'), + 'INT_27' => __('Priority Mail Express International Padded Flat Rate Envelope'), + ), - 'service'=>array( - 'FIRST CLASS' => __('First-Class'), - 'PRIORITY' => __('Priority Mail'), - 'EXPRESS' => __('Express Mail'), - 'BPM' => __('Bound Printed Matter'), - 'PARCEL' => __('Parcel Post'), - 'MEDIA' => __('Media Mail'), - 'LIBRARY' => __('Library'), + 'service_to_code' => array( + '0_FCLE' => 'First Class', + '0_FCL' => 'First Class', + '0_FCP' => 'First Class', + '0_FCPC' => 'First Class', + '1' => 'Priority', + '2' => 'Priority Express', + '3' => 'Priority Express', + '4' => 'Standard Post', + '6' => 'Media', + '7' => 'Library', + '13' => 'Priority Express', + '15' => 'First Class', + '16' => 'Priority', + '17' => 'Priority', + '22' => 'Priority', + '23' => 'Priority Express', + '25' => 'Priority Express', + '27' => 'Priority Express', + '28' => 'Priority', + '29' => 'Priority', + '30' => 'Priority Express', + '31' => 'Priority Express', + '32' => 'Priority Express', + '33' => 'Priority', + '34' => 'Priority', + '35' => 'Priority', + '36' => 'Priority', + '37' => 'Priority', + '38' => 'Priority', + '39' => 'Priority', + '40' => 'Priority', + '41' => 'Priority', + '42' => 'Priority', + '43' => 'Priority', + '44' => 'Priority', + '45' => 'Priority', + '46' => 'Priority', + '47' => 'Priority', + '48' => 'Priority', + '49' => 'Priority', + '50' => 'Priority', + '53' => 'First Class', + '55' => 'Priority Express', + '56' => 'Priority Express', + '57' => 'Priority Express', + '58' => 'Priority', + '59' => 'Priority', + '61' => 'First Class', + '62' => 'Priority Express', + '63' => 'Priority Express', + '64' => 'Priority Express', + 'INT_1' => 'Priority Express', + 'INT_2' => 'Priority', + 'INT_4' => 'Priority Express', + 'INT_5' => 'Priority Express', + 'INT_6' => 'Priority Express', + 'INT_7' => 'Priority Express', + 'INT_8' => 'Priority', + 'INT_9' => 'Priority', + 'INT_10' => 'Priority Express', + 'INT_11' => 'Priority', + 'INT_12' => 'Priority Express', + 'INT_13' => 'First Class', + 'INT_14' => 'First Class', + 'INT_15' => 'First Class', + 'INT_16' => 'Priority', + 'INT_17' => 'Priority', + 'INT_18' => 'Priority', + 'INT_19' => 'Priority', + 'INT_20' => 'Priority', + 'INT_21' => 'First Class', + 'INT_22' => 'Priority', + 'INT_23' => 'Priority', + 'INT_24' => 'Priority', + 'INT_25' => 'Priority', + 'INT_26' => 'Priority Express', + 'INT_27' => 'Priority Express', ), - 'service_to_code'=>array( - 'First-Class' => 'FIRST CLASS', - 'First-Class Mail International Large Envelope' => 'FIRST CLASS', - 'First-Class Mail International Letter' => 'FIRST CLASS', - 'First-Class Mail International Package' => 'FIRST CLASS', - 'First-Class Mail International Parcel' => 'FIRST CLASS', - 'First-Class Mail' => 'FIRST CLASS', - 'First-Class Mail Flat' => 'FIRST CLASS', - 'First-Class Mail Large Envelope' => 'FIRST CLASS', - 'First-Class Mail International' => 'FIRST CLASS', - 'First-Class Mail Letter' => 'FIRST CLASS', - 'First-Class Mail Parcel' => 'FIRST CLASS', - 'First-Class Mail Package' => 'FIRST CLASS', - 'Parcel Post' => 'PARCEL', - 'Bound Printed Matter' => 'BPM', - 'Media Mail' => 'MEDIA', - 'Library Mail' => 'LIBRARY', - 'Express Mail' => 'EXPRESS', - 'Express Mail PO to PO' => 'EXPRESS', - 'Express Mail Flat Rate Envelope' => 'EXPRESS', - 'Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee' => 'EXPRESS', - 'Express Mail Sunday/Holiday Guarantee' => 'EXPRESS', - 'Express Mail Flat Rate Envelope Hold For Pickup' => 'EXPRESS', - 'Express Mail Hold For Pickup' => 'EXPRESS', - 'Global Express Guaranteed (GXG)' => 'EXPRESS', - 'Global Express Guaranteed Non-Document Rectangular' => 'EXPRESS', - 'Global Express Guaranteed Non-Document Non-Rectangular' => 'EXPRESS', - 'USPS GXG Envelopes' => 'EXPRESS', - 'Express Mail International' => 'EXPRESS', - 'Express Mail International Flat Rate Envelope' => 'EXPRESS', - 'Priority Mail' => 'PRIORITY', - 'Priority Mail Small Flat Rate Box' => 'PRIORITY', - 'Priority Mail Medium Flat Rate Box' => 'PRIORITY', - 'Priority Mail Large Flat Rate Box' => 'PRIORITY', - 'Priority Mail Flat Rate Box' => 'PRIORITY', - 'Priority Mail Flat Rate Envelope' => 'PRIORITY', - 'Priority Mail International' => 'PRIORITY', - 'Priority Mail International Flat Rate Envelope' => 'PRIORITY', - 'Priority Mail International Small Flat Rate Box' => 'PRIORITY', - 'Priority Mail International Medium Flat Rate Box' => 'PRIORITY', - 'Priority Mail International Large Flat Rate Box' => 'PRIORITY', - 'Priority Mail International Flat Rate Box' => 'PRIORITY' + // Added because USPS has different services but with same CLASSID value, which is "0" + 'method_to_code' => array( + 'First-Class Mail Large Envelope' => '0_FCLE', + 'First-Class Mail Letter' => '0_FCL', + 'First-Class Mail Parcel' => '0_FCP', ), 'first_class_mail_type'=>array( @@ -690,33 +799,49 @@ class Usps 'filters' => array( 'within_us' => array( 'method' => array( - 'Express Mail Flat Rate Envelope', - 'Express Mail Flat Rate Envelope Hold For Pickup', + 'Priority Mail Express Flat Rate Envelope', + 'Priority Mail Express Flat Rate Envelope Hold For Pickup', 'Priority Mail Flat Rate Envelope', 'Priority Mail Large Flat Rate Box', 'Priority Mail Medium Flat Rate Box', 'Priority Mail Small Flat Rate Box', - 'Express Mail', + 'Priority Mail Express Hold For Pickup', + 'Priority Mail Express', 'Priority Mail', - 'Parcel Post', + 'Priority Mail Hold For Pickup', + 'Priority Mail Large Flat Rate Box Hold For Pickup', + 'Priority Mail Medium Flat Rate Box Hold For Pickup', + 'Priority Mail Small Flat Rate Box Hold For Pickup', + 'Priority Mail Flat Rate Envelope Hold For Pickup', + 'Priority Mail Small Flat Rate Envelope', + 'Priority Mail Small Flat Rate Envelope Hold For Pickup', + 'First-Class Package Service Hold For Pickup', + 'Priority Mail Express Flat Rate Boxes', + 'Priority Mail Express Flat Rate Boxes Hold For Pickup', + 'Standard Post', 'Media Mail', 'First-Class Mail Large Envelope', + 'Priority Mail Express Sunday/Holiday Delivery', + 'Priority Mail Express Sunday/Holiday Delivery Flat Rate Envelope', + 'Priority Mail Express Sunday/Holiday Delivery Flat Rate Boxes', ) ), 'from_us' => array( 'method' => array( - 'Express Mail International Flat Rate Envelope', + 'Priority Mail Express International Flat Rate Envelope', 'Priority Mail International Flat Rate Envelope', 'Priority Mail International Large Flat Rate Box', 'Priority Mail International Medium Flat Rate Box', 'Priority Mail International Small Flat Rate Box', + 'Priority Mail International Small Flat Rate Envelope', + 'Priority Mail Express International Flat Rate Boxes', 'Global Express Guaranteed (GXG)', 'USPS GXG Envelopes', - 'Express Mail International', + 'Priority Mail Express International', 'Priority Mail International', - 'First-Class Mail International Package', + 'First-Class Mail International Letter', 'First-Class Mail International Large Envelope', - 'First-Class Mail International Parcel', + 'First-Class Package International Service', ) ) ) @@ -729,6 +854,11 @@ class Usps 'Priority Mail Large Flat Rate Box', 'Priority Mail Medium Flat Rate Box', 'Priority Mail Small Flat Rate Box', + 'Priority Mail International Large Flat Rate Box', + 'Priority Mail International Medium Flat Rate Box', + 'Priority Mail International Small Flat Rate Box', + 'Priority Mail Express Sunday/Holiday Delivery Flat Rate Boxes', + ) ), 'from_us' => array( @@ -736,6 +866,8 @@ class Usps 'Priority Mail International Large Flat Rate Box', 'Priority Mail International Medium Flat Rate Box', 'Priority Mail International Small Flat Rate Box', + 'Priority Mail International DVD Flat Rate priced box', + 'Priority Mail International Large Video Flat Rate priced box' ) ) ) @@ -745,15 +877,29 @@ class Usps 'filters' => array( 'within_us' => array( 'method' => array( - 'Express Mail Flat Rate Envelope', - 'Express Mail Flat Rate Envelope Hold For Pickup', 'Priority Mail Flat Rate Envelope', + 'Priority Mail Express Flat Rate Envelope', + 'Priority Mail Express Flat Rate Envelope Hold For Pickup', + 'Priority Mail Flat Rate Envelope', + 'First-Class Mail Large Envelope', + 'Priority Mail Flat Rate Envelope Hold For Pickup', + 'Priority Mail Small Flat Rate Envelope', + 'Priority Mail Small Flat Rate Envelope Hold For Pickup', + 'Priority Mail Express Sunday/Holiday Delivery Flat Rate Envelope', + 'Priority Mail Express Padded Flat Rate Envelope' ) ), 'from_us' => array( 'method' => array( - 'Express Mail International Flat Rate Envelope', + 'Priority Mail Express International Flat Rate Envelope', 'Priority Mail International Flat Rate Envelope', + 'First-Class Mail International Large Envelope', + 'Priority Mail International Small Flat Rate Envelope', + 'Priority Mail Express International Legal Flat Rate Envelope', + 'Priority Mail International Gift Card Flat Rate Envelope', + 'Priority Mail International Window Flat Rate Envelope', + 'Priority Mail International Legal Flat Rate Envelope', + 'Priority Mail Express International Padded Flat Rate Envelope', ) ) ) @@ -763,19 +909,20 @@ class Usps 'filters' => array( 'within_us' => array( 'method' => array( - 'Express Mail', + 'Priority Mail Express', 'Priority Mail', - 'Parcel Post', + 'Standard Post', 'Media Mail', + 'Library Mail', + 'First-Class Package Service' ) ), 'from_us' => array( 'method' => array( 'USPS GXG Envelopes', - 'Express Mail International', + 'Priority Mail Express International', 'Priority Mail International', - 'First-Class Mail International Package', - 'First-Class Mail International Parcel', + 'First-Class Package International Service', ) ) ) @@ -785,20 +932,19 @@ class Usps 'filters' => array( 'within_us' => array( 'method' => array( - 'Express Mail', + 'Priority Mail Express', 'Priority Mail', - 'Parcel Post', + 'Standard Post', 'Media Mail', + 'Library Mail', ) ), 'from_us' => array( 'method' => array( 'Global Express Guaranteed (GXG)', - 'USPS GXG Envelopes', - 'Express Mail International', + 'Priority Mail Express International', 'Priority Mail International', - 'First-Class Mail International Package', - 'First-Class Mail International Parcel', + 'First-Class Package International Service', ) ) ) @@ -821,13 +967,6 @@ class Usps ), ); - $methods = $this->getConfigData('methods'); - if (!empty($methods)) { - $codes['method'] = explode(",", $methods); - } else { - $codes['method'] = array(); - } - if (!isset($codes[$type])) { return false; } elseif (''===$code) { @@ -903,7 +1042,7 @@ class Usps if (!$url) { $url = $this->_defaultGatewayUrl; } - $client = new \Zend_Http_Client(); + $client = $this->_httpClientFactory->create(); $client->setUri($url); $client->setConfig(array('maxredirects'=>0, 'timeout'=>30)); $client->setParameterGet('API', $api); @@ -1016,7 +1155,7 @@ class Usps $allowed = explode(',', $this->getConfigData('allowed_methods')); $arr = array(); foreach ($allowed as $k) { - $arr[$k] = $k; + $arr[$k] = $this->getCode('method', $k); } return $arr; } @@ -1357,18 +1496,23 @@ class Usps { switch ($serviceType) { case 'PRIORITY': + case 'Priority': $serviceType = 'Priority'; break; case 'FIRST CLASS': + case 'First Class': $serviceType = 'First Class'; break; - case 'PARCEL': - $serviceType = 'Parcel Post'; + case 'STANDARD': + case 'Standard Post': + $serviceType = 'Standard Post'; break; case 'MEDIA': + case 'Media': $serviceType = 'Media Mail'; break; case 'LIBRARY': + case 'Library': $serviceType = 'Library Mail'; break; default: @@ -1515,11 +1659,12 @@ class Usps array('data' => '<?xml version = "1.0" encoding = "UTF-8"?><wrap/>') ); $method = ''; - if (stripos($shippingMethod, 'Priority') !== false) { + $service = $this->getCode('service_to_code', $shippingMethod); + if ($service == 'Priority') { $method = 'Priority'; $rootNode = 'PriorityMailIntlRequest'; $xml = $xmlWrap->addChild($rootNode); - } else if (stripos($shippingMethod, 'First-Class') !== false) { + } else if ($service == 'First Class') { $method = 'FirstClass'; $rootNode = 'FirstClassMailIntlRequest'; $xml = $xmlWrap->addChild($rootNode); @@ -1554,7 +1699,8 @@ class Usps } $xml->addChild('FromCustomsReference', 'Order #' . $referenceData); } - $xml->addChild('ToName', $request->getRecipientContactPersonName()); + $xml->addChild('ToFirstName', $request->getRecipientContactPersonFirstName()); + $xml->addChild('ToLastName', $request->getRecipientContactPersonLastName()); $xml->addChild('ToFirm', $request->getRecipientContactCompanyName()); $xml->addChild('ToAddress1', $request->getRecipientAddressStreet1()); $xml->addChild('ToAddress2', $request->getRecipientAddressStreet2()); @@ -1692,7 +1838,7 @@ class Usps $service = $this->getCode('service_to_code', $request->getShippingMethod()); $recipientUSCountry = $this->_isUSCountry($request->getRecipientAddressCountryCode()); - if ($recipientUSCountry && $service == 'EXPRESS') { + if ($recipientUSCountry && $service == 'Priority Express') { $requestXml = $this->_formUsExpressShipmentRequest($request); $api = 'ExpressMailLabel'; } else if ($recipientUSCountry) { @@ -1702,10 +1848,10 @@ class Usps } else { $api = 'SignatureConfirmationCertifyV3'; } - } else if ($service == 'FIRST CLASS') { + } else if ($service == 'First Class') { $requestXml = $this->_formIntlShipmentRequest($request); $api = 'FirstClassMailIntl'; - } else if ($service == 'PRIORITY') { + } else if ($service == 'Priority') { $requestXml = $this->_formIntlShipmentRequest($request); $api = 'PriorityMailIntl'; } else { @@ -1718,7 +1864,7 @@ class Usps if (!$url) { $url = $this->_defaultGatewayUrl; } - $client = new \Zend_Http_Client(); + $client = $this->_httpClientFactory->create(); $client->setUri($url); $client->setConfig(array('maxredirects'=>0, 'timeout'=>30)); $client->setParameterGet('API', $api); @@ -1735,7 +1881,7 @@ class Usps $this->_debug($debugData); $result->setErrors($debugData['result']['error']); } else { - if ($recipientUSCountry && $service == 'EXPRESS') { + if ($recipientUSCountry && $service == 'Priority Express') { $labelContent = base64_decode((string) $response->EMLabel); $trackingNumber = (string) $response->EMConfirmationNumber; } else if ($recipientUSCountry) { diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps/Source/Generic.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps/Source/Generic.php index 57b9351cd39..9fe45fceb3e 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps/Source/Generic.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps/Source/Generic.php @@ -55,8 +55,10 @@ class Generic implements \Magento\Core\Model\Option\ArrayInterface { $configData = $this->_shippingUsps->getCode($this->_code); $arr = array(); - foreach ($configData as $code => $title) { - $arr[] = array('value' => $code, 'label' => $title); + if ($configData) { + foreach ($configData as $code => $title) { + $arr[] = array('value' => $code, 'label' => __($title)); + } } return $arr; } diff --git a/app/code/Magento/Usa/etc/config.xml b/app/code/Magento/Usa/etc/config.xml index cd9e50b11a3..41ca00b43e4 100644 --- a/app/code/Magento/Usa/etc/config.xml +++ b/app/code/Magento/Usa/etc/config.xml @@ -117,7 +117,7 @@ <usps> <active>0</active> <sallowspecific>0</sallowspecific> - <allowed_methods>Bound Printed Matter,Express Mail,Express Mail Flat Rate Envelope,Express Mail Flat Rate Envelope Hold For Pickup,Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee,Express Mail Hold For Pickup,Express Mail International,Express Mail International Flat Rate Envelope,Express Mail PO to PO,Express Mail Sunday/Holiday Guarantee,First-Class Mail International Large Envelope,First-Class Mail International Letter,First-Class Mail International Package,First-Class Mail International Parcel,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel,First-Class Mail Package,Global Express Guaranteed (GXG),Global Express Guaranteed Non-Document Non-Rectangular,Global Express Guaranteed Non-Document Rectangular,Library Mail,Media Mail,Parcel Post,Priority Mail,Priority Mail Small Flat Rate Box,Priority Mail Medium Flat Rate Box,Priority Mail Large Flat Rate Box,Priority Mail Flat Rate Box,Priority Mail Flat Rate Envelope,Priority Mail International,Priority Mail International Flat Rate Box,Priority Mail International Flat Rate Envelope,Priority Mail International Small Flat Rate Box,Priority Mail International Medium Flat Rate Box,Priority Mail International Large Flat Rate Box,USPS GXG Envelopes</allowed_methods> + <allowed_methods>0_FCLE,0_FCL,0_FCP,1,2,3,4,6,7,13,16,17,22,23,25,27,28,33,34,35,36,37,42,43,53,55,56,57,61,INT_1,INT_2,INT_4,INT_6,INT_7,INT_8,INT_9,INT_10,INT_11,INT_12,INT_13,INT_14,INT_15,INT_16,INT_20,INT_26</allowed_methods> <container>VARIABLE</container> <cutoff_cost /> <free_method /> @@ -126,7 +126,7 @@ <shipment_requesttype>0</shipment_requesttype> <handling /> <machinable>true</machinable> - <methods>Bound Printed Matter,Express Mail,Express Mail Flat Rate Envelope,Express Mail Flat Rate Envelope Hold For Pickup,Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee,Express Mail Hold For Pickup,Express Mail International,Express Mail International Flat Rate Envelope,Express Mail PO to PO,Express Mail Sunday/Holiday Guarantee,First-Class Mail International Large Envelope,First-Class Mail International Letters,First-Class Mail International Package,First-Class Mail International Parcel,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel,First-Class Mail Package,Global Express Guaranteed (GXG),Global Express Guaranteed Non-Document Non-Rectangular,Global Express Guaranteed Non-Document Rectangular,Library Mail,Media Mail,Parcel Post,Priority Mail,Priority Mail Small Flat Rate Box,Priority Mail Medium Flat Rate Box,Priority Mail Large Flat Rate Box,Priority Mail Flat Rate Box,Priority Mail Flat Rate Envelope,Priority Mail International,Priority Mail International Flat Rate Box,Priority Mail International Flat Rate Envelope,Priority Mail International Small Flat Rate Box,Priority Mail International Medium Flat Rate Box,Priority Mail International Large Flat Rate Box,USPS GXG Envelopes</methods> + <methods></methods> <model>Magento\Usa\Model\Shipping\Carrier\Usps</model> <size>REGULAR</size> <title>United States Postal Service</title> diff --git a/app/code/Magento/Usa/i18n/en_US.csv b/app/code/Magento/Usa/i18n/en_US.csv index 42ab0b679b3..85c6c163a17 100644 --- a/app/code/Magento/Usa/i18n/en_US.csv +++ b/app/code/Magento/Usa/i18n/en_US.csv @@ -44,6 +44,7 @@ "Customer services","Customer services" "DHL","DHL" "DHL (Deprecated)","DHL (Deprecated)" +"DHL service is not available at %s date","DHL service is not available at %s date" "Debug","Debug" "Default Package Height","Default Package Height" "Default Package Length","Default Package Length" @@ -96,6 +97,17 @@ "FedEx Tube","FedEx Tube" "First Overnight","First Overnight" "First-Class","First-Class" +"First-Class Mail International Large Envelope","First-Class Mail International Large Envelope" +"First-Class Mail International Letter","First-Class Mail International Letter" +"First-Class Mail International Postcard","First-Class Mail International Postcard" +"First-Class Mail Large Envelope","First-Class Mail Large Envelope" +"First-Class Mail Large Postcards","First-Class Mail Large Postcards" +"First-Class Mail Letter","First-Class Mail Letter" +"First-Class Mail Parcel","First-Class Mail Parcel" +"First-Class Mail Postcards","First-Class Mail Postcards" +"First-Class Package International Service","First-Class Package International Service" +"First-Class Package Service","First-Class Package Service" +"First-Class Package Service Hold For Pickup","First-Class Package Service Hold For Pickup" "Flat","Flat" "Flat-Rate Box","Flat-Rate Box" "Flat-Rate Envelope","Flat-Rate Envelope" @@ -107,6 +119,10 @@ "Gateway XML URL","Gateway XML URL" "Gift","Gift" "Girth","Girth" +"Global Express Guaranteed (GXG)","Global Express Guaranteed (GXG)" +"Global Express Guaranteed Document","Global Express Guaranteed Document" +"Global Express Guaranteed Non-Document Non-Rectangular","Global Express Guaranteed Non-Document Non-Rectangular" +"Global Express Guaranteed Non-Document Rectangular","Global Express Guaranteed Non-Document Rectangular" "Globalmail business","Globalmail business" "Ground","Ground" "Ground Commercial","Ground Commercial" @@ -136,6 +152,7 @@ "Length","Length" "Letter","Letter" "Library","Library" +"Library Mail","Library Mail" "Live","Live" "Machinable","Machinable" "Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)","Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)" @@ -164,6 +181,7 @@ "None","None" "Not Required","Not Required" "Order","Order" +"Order #%s","Order #%s" "Origin of the Shipment","Origin of the Shipment" "Origin serviceAreaCode is missing","Origin serviceAreaCode is missing" "Other","Other" @@ -171,6 +189,7 @@ "PAK","PAK" "Package","Package" "Package Description","Package Description" +"Package content is missing","Package content is missing" "Packages Request Type","Packages Request Type" "Packaging","Packaging" "Pallet","Pallet" @@ -181,13 +200,72 @@ "Piece Id barcode is missing","Piece Id barcode is missing" "Piece number information is missing","Piece number information is missing" "Please make sure to use only digits here. No dashes are allowed.","Please make sure to use only digits here. No dashes are allowed." +"Please, specify origin country","Please, specify origin country" "Pounds","Pounds" "Priority Mail","Priority Mail" +"Priority Mail Express","Priority Mail Express" +"Priority Mail Express Flat Rate Boxes","Priority Mail Express Flat Rate Boxes" +"Priority Mail Express Flat Rate Boxes Hold For Pickup","Priority Mail Express Flat Rate Boxes Hold For Pickup" +"Priority Mail Express Flat Rate Envelope","Priority Mail Express Flat Rate Envelope" +"Priority Mail Express Flat Rate Envelope Hold For Pickup","Priority Mail Express Flat Rate Envelope Hold For Pickup" +"Priority Mail Express Hold For Pickup","Priority Mail Express Hold For Pickup" +"Priority Mail Express International","Priority Mail Express International" +"Priority Mail Express International Flat Rate Boxes","Priority Mail Express International Flat Rate Boxes" +"Priority Mail Express International Flat Rate Envelope","Priority Mail Express International Flat Rate Envelope" +"Priority Mail Express International Legal Flat Rate Envelope","Priority Mail Express International Legal Flat Rate Envelope" +"Priority Mail Express International Padded Flat Rate Envelope","Priority Mail Express International Padded Flat Rate Envelope" +"Priority Mail Express Legal Flat Rate Envelope","Priority Mail Express Legal Flat Rate Envelope" +"Priority Mail Express Legal Flat Rate Envelope Hold For Pickup","Priority Mail Express Legal Flat Rate Envelope Hold For Pickup" +"Priority Mail Express Padded Flat Rate Envelope","Priority Mail Express Padded Flat Rate Envelope" +"Priority Mail Express Padded Flat Rate Envelope Hold For Pickup","Priority Mail Express Padded Flat Rate Envelope Hold For Pickup" +"Priority Mail Express Sunday/Holiday Delivery","Priority Mail Express Sunday/Holiday Delivery" +"Priority Mail Express Sunday/Holiday Delivery Flat Rate Boxes","Priority Mail Express Sunday/Holiday Delivery Flat Rate Boxes" +"Priority Mail Express Sunday/Holiday Delivery Flat Rate Envelope","Priority Mail Express Sunday/Holiday Delivery Flat Rate Envelope" +"Priority Mail Express Sunday/Holiday Delivery Legal Flat Rate Envelope","Priority Mail Express Sunday/Holiday Delivery Legal Flat Rate Envelope" +"Priority Mail Express Sunday/Holiday Delivery Padded Flat Rate Envelope","Priority Mail Express Sunday/Holiday Delivery Padded Flat Rate Envelope" +"Priority Mail Flat Rate Envelope","Priority Mail Flat Rate Envelope" +"Priority Mail Flat Rate Envelope Hold For Pickup","Priority Mail Flat Rate Envelope Hold For Pickup" +"Priority Mail Gift Card Flat Rate Envelope","Priority Mail Gift Card Flat Rate Envelope" +"Priority Mail Gift Card Flat Rate Envelope Hold For Pickup","Priority Mail Gift Card Flat Rate Envelope Hold For Pickup" +"Priority Mail Hold For Pickup","Priority Mail Hold For Pickup" +"Priority Mail International","Priority Mail International" +"Priority Mail International DVD Flat Rate priced box","Priority Mail International DVD Flat Rate priced box" +"Priority Mail International Flat Rate Envelope","Priority Mail International Flat Rate Envelope" +"Priority Mail International Gift Card Flat Rate Envelope","Priority Mail International Gift Card Flat Rate Envelope" +"Priority Mail International Large Flat Rate Box","Priority Mail International Large Flat Rate Box" +"Priority Mail International Large Video Flat Rate priced box","Priority Mail International Large Video Flat Rate priced box" +"Priority Mail International Legal Flat Rate Envelope","Priority Mail International Legal Flat Rate Envelope" +"Priority Mail International Medium Flat Rate Box","Priority Mail International Medium Flat Rate Box" +"Priority Mail International Padded Flat Rate Envelope","Priority Mail International Padded Flat Rate Envelope" +"Priority Mail International Small Flat Rate Box","Priority Mail International Small Flat Rate Box" +"Priority Mail International Small Flat Rate Envelope","Priority Mail International Small Flat Rate Envelope" +"Priority Mail International Window Flat Rate Envelope","Priority Mail International Window Flat Rate Envelope" +"Priority Mail Large Flat Rate Box","Priority Mail Large Flat Rate Box" +"Priority Mail Large Flat Rate Box Hold For Pickup","Priority Mail Large Flat Rate Box Hold For Pickup" +"Priority Mail Legal Flat Rate Envelope","Priority Mail Legal Flat Rate Envelope" +"Priority Mail Legal Flat Rate Envelope Hold For Pickup","Priority Mail Legal Flat Rate Envelope Hold For Pickup" +"Priority Mail Medium Flat Rate Box","Priority Mail Medium Flat Rate Box" +"Priority Mail Medium Flat Rate Box Hold For Pickup","Priority Mail Medium Flat Rate Box Hold For Pickup" +"Priority Mail Padded Flat Rate Envelope","Priority Mail Padded Flat Rate Envelope" +"Priority Mail Padded Flat Rate Envelope Hold For Pickup","Priority Mail Padded Flat Rate Envelope Hold For Pickup" +"Priority Mail Regional Rate Box A","Priority Mail Regional Rate Box A" +"Priority Mail Regional Rate Box A Hold For Pickup","Priority Mail Regional Rate Box A Hold For Pickup" +"Priority Mail Regional Rate Box B","Priority Mail Regional Rate Box B" +"Priority Mail Regional Rate Box B Hold For Pickup","Priority Mail Regional Rate Box B Hold For Pickup" +"Priority Mail Regional Rate Box C","Priority Mail Regional Rate Box C" +"Priority Mail Regional Rate Box C Hold For Pickup","Priority Mail Regional Rate Box C Hold For Pickup" +"Priority Mail Small Flat Rate Box","Priority Mail Small Flat Rate Box" +"Priority Mail Small Flat Rate Box Hold For Pickup","Priority Mail Small Flat Rate Box Hold For Pickup" +"Priority Mail Small Flat Rate Envelope","Priority Mail Small Flat Rate Envelope" +"Priority Mail Small Flat Rate Envelope Hold For Pickup","Priority Mail Small Flat Rate Envelope Hold For Pickup" +"Priority Mail Window Flat Rate Envelope","Priority Mail Window Flat Rate Envelope" +"Priority Mail Window Flat Rate Envelope Hold For Pickup","Priority Mail Window Flat Rate Envelope Hold For Pickup" "Priority Overnight","Priority Overnight" "Product content code is invalid","Product content code is invalid" "Product name is missing","Product name is missing" "Receiver","Receiver" "Rectangular","Rectangular" +"Reference code is missing","Reference code is missing" "Regular","Regular" "Regular Pickup","Regular Pickup" "Request Courier","Request Courier" @@ -219,6 +297,8 @@ "Shipment is not available.","Shipment is not available." "Shipment picked up","Shipment picked up" "Shipper Number","Shipper Number" +"Shipping Accept XML URL","Shipping Accept XML URL" +"Shipping Confirm XML URL","Shipping Confirm XML URL" "Shipping Key","Shipping Key" "Shipping Key (International)","Shipping Key (International)" "Show Method if Not Applicable","Show Method if Not Applicable" @@ -230,6 +310,7 @@ "Specific","Specific" "Sprintline","Sprintline" "Standard Overnight","Standard Overnight" +"Standard Post","Standard Post" "Station","Station" "Subtotal","Subtotal" "Subtotal With Discount","Subtotal With Discount" @@ -273,6 +354,7 @@ "UPS Worldwide Express PlusSM","UPS Worldwide Express PlusSM" "UPS Worldwide Saver","UPS Worldwide Saver" "USPS","USPS" +"USPS GXG Envelopes","USPS GXG Envelopes" "Unable to retrieve tracking","Unable to retrieve tracking" "United Parcel Service","United Parcel Service" "United Parcel Service XML","United Parcel Service XML" @@ -296,4 +378,4 @@ "Your Packaging","Your Packaging" "Zero shipping charge for '%s'","Zero shipping charge for '%s'" "cm","cm" -"inch","inch" +"inch","inch" \ No newline at end of file diff --git a/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml index 9295580d39d..ca0ae9530bb 100644 --- a/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml +++ b/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml @@ -37,25 +37,26 @@ <div class="control"> <table class="data-table" cellspacing="0"> <thead> - <tr class="headings"> - <th <?php if (!$this->isMultiWebsites()): ?>style="display:none"<?php endif; ?>><?php echo __('Website') ?></th> - <th><?php echo __('Country/State') ?><span class="required">*</span></th> - <th><?php echo __('Tax') ?><span class="required">*</span></th> - <th><?php echo __('Action') ?></th> - </tr> + <tr> + <th class="col-website" <?php if (!$this->isMultiWebsites()): ?>style="display: none;"<?php endif; ?>><?php echo __('Website'); ?></th> + <th class="col-country required"><?php echo __('Country/State'); ?></th> + <th class="col-tax required"><?php echo __('Tax'); ?></th> + <th class="col-action"><?php echo __('Action'); ?></th> + </tr> </thead> - <tbody data-role="fpt-item-container"> - </tbody> <tfoot> - <tr> - <td colspan="4"><?php echo $this->getAddButtonHtml() ?></td> - </tr> + <tr> + <td colspan="4"><?php echo $this->getAddButtonHtml(); ?></td> + </tr> </tfoot> + <tbody data-role="fpt-item-container" class="fpt-item-container"> + </tbody> </table> </div> + <script data-role="row-template" type="text/x-jquery-tmpl"> <tr id="<?php echo $this->getElement()->getHtmlId() ?>_weee_tax_row_${index}" data-role="fpt-item-row"> - <td <?php if (!$this->isMultiWebsites()): ?>style="display: none"<?php endif; ?>> + <td class="col-website" <?php if (!$this->isMultiWebsites()): ?>style="display: none"<?php endif; ?>> <select name="<?php echo $this->getElement()->getName() ?>[${index}][website_id]" class="<?php echo $this->getElement()->getClass() ?> website required-entry" data-role="select-website"> <?php foreach ($this->getWebsites() as $_websiteId => $_info): ?> @@ -63,7 +64,7 @@ <?php endforeach ?> </select> </td> - <td> + <td class="col-country"> <select id="<?php echo $this->getElement()->getName() ?>_weee_tax_row_${index}_country" name="<?php echo $this->getElement()->getName() ?>[${index}][country]" class="<?php echo $this->getElement()->getClass() ?> country required-entry" data-role="select-country"> @@ -77,12 +78,12 @@ <option value="0">*</option> </select> </td> - <td> + <td class="col-tax"> <input name="<?php echo $this->getElement()->getName() ?>[${index}][price]" class="<?php echo $this->getElement()->getClass() ?> required-entry validate-greater-than-zero" type="text" value="${value}"/> </td> - <td> + <td class="col-action"> <input name="<?php echo $this->getElement()->getName() ?>[${index}][delete]" class="delete" type="hidden" value="" data-role="delete-fpt-item"/> <?php echo $this->getChildHtml('delete_button') ?> </td> diff --git a/app/code/Magento/Widget/Model/Config/FileResolver.php b/app/code/Magento/Widget/Model/Config/FileResolver.php index 7852d8ece98..d426dc192e4 100644 --- a/app/code/Magento/Widget/Model/Config/FileResolver.php +++ b/app/code/Magento/Widget/Model/Config/FileResolver.php @@ -58,7 +58,7 @@ class FileResolver implements \Magento\Config\FileResolverInterface \Magento\Filesystem $filesystem, \Magento\Module\Dir\Reader $moduleReader, \Magento\Config\FileIteratorFactory $iteratorFactory - ){ + ) { $this->themesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::THEMES); $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $this->iteratorFactory = $iteratorFactory; @@ -75,8 +75,10 @@ class FileResolver implements \Magento\Config\FileResolverInterface $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; case 'design': - $fileList = $this->themesDirectory->search('#/' . preg_quote($filename) . '$#'); - $iterator = $this->iteratorFactory->create($this->themesDirectory, $fileList); + $iterator = $this->iteratorFactory->create( + $this->themesDirectory, + $this->themesDirectory->search('/*/*/etc/' . $filename) + ); break; default: $iterator = $this->iteratorFactory->create($this->themesDirectory, array());; diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php index ea5b305365b..167057741a7 100644 --- a/app/code/Magento/Wishlist/Block/AbstractBlock.php +++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php @@ -50,20 +50,6 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd */ protected $_wishlist; - /** - * List of block settings to render prices for different product types - * - * @var array - */ - protected $_itemPriceBlockTypes = array(); - - /** - * List of block instances to render prices for different product types - * - * @var array - */ - protected $_cachedItemPriceBlocks = array(); - /** * @var \Magento\Customer\Model\Session */ @@ -126,20 +112,6 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd ); } - /** - * Internal constructor, that is called from real constructor - * - */ - protected function _construct() - { - parent::_construct(); - $this->addItemPriceBlockType( - 'default', - 'Magento\Wishlist\Block\Render\Item\Price', - 'render/item/price.phtml' - ); - } - /** * Retrieve Wishlist Data Helper * @@ -368,45 +340,6 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd return $this->getWishlistItemsCount() > 0; } - /** - * Adds special block to render price for item with specific product type - * - * @param string $type - * @param string $block - * @param string $template - */ - public function addItemPriceBlockType($type, $block = '', $template = '') - { - if ($type) { - $this->_itemPriceBlockTypes[$type] = array( - 'block' => $block, - 'template' => $template - ); - } - } - - /** - * Returns block to render item with some product type - * - * @param string $productType - * @return \Magento\View\Element\Template - */ - protected function _getItemPriceBlock($productType) - { - if (!isset($this->_itemPriceBlockTypes[$productType])) { - $productType = 'default'; - } - - if (!isset($this->_cachedItemPriceBlocks[$productType])) { - $blockType = $this->_itemPriceBlockTypes[$productType]['block']; - $template = $this->_itemPriceBlockTypes[$productType]['template']; - $block = $this->getLayout()->createBlock($blockType) - ->setTemplate($template); - $this->_cachedItemPriceBlocks[$productType] = $block; - } - return $this->_cachedItemPriceBlocks[$productType]; - } - /** * Returns product price block html * Overwrites parent price html return to be ready to show configured, partially configured and diff --git a/app/code/Magento/Wishlist/Block/Customer/Sidebar.php b/app/code/Magento/Wishlist/Block/Customer/Sidebar.php index 3c5c9dad6bd..93d0f991be5 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Sidebar.php +++ b/app/code/Magento/Wishlist/Block/Customer/Sidebar.php @@ -43,7 +43,7 @@ class Sidebar extends \Magento\Wishlist\Block\AbstractBlock */ public function getTitle() { - return __('My Wish List <small>(%1)</small>', $this->getItemCount()); + return __('My Wish List'); } /** diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php index 8d318c965be..1ce35f1dce8 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php @@ -41,6 +41,11 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock */ protected $_helperPool; + /** + * @var \Magento\Data\Form\FormKey + */ + protected $_formKey; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Model\Config $catalogConfig @@ -56,8 +61,9 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool + * @param \Magento\Data\Form\FormKey $formKey * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -75,8 +81,10 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, + \Magento\Data\Form\FormKey $formKey, array $data = array() ) { + $this->_formKey = $formKey; $this->_helperPool = $helperPool; parent::__construct( $context, @@ -235,4 +243,19 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $qty = $this->getQty($item); return $qty ? $qty : 1; } + + /** + * Get add all to cart url + * @return string + */ + public function getAddAllToCartUrl() + { + return $this->getUrl( + '*/*/allcart', + array( + 'wishlist_id' => $this->getWishlistInstance()->getId(), + 'form_key' => $this->_formKey->getFormKey(), + ) + ); + } } diff --git a/app/code/Magento/Wishlist/Block/Link.php b/app/code/Magento/Wishlist/Block/Link.php index defd33a1ffe..acb9e1880a7 100644 --- a/app/code/Magento/Wishlist/Block/Link.php +++ b/app/code/Magento/Wishlist/Block/Link.php @@ -29,6 +29,13 @@ namespace Magento\Wishlist\Block; class Link extends \Magento\View\Element\Html\Link { + /** + * Template name + * + * @var string + */ + protected $_template = 'Magento_Wishlist::link.phtml'; + /** * @var \Magento\Wishlist\Helper\Data */ @@ -72,7 +79,7 @@ class Link extends \Magento\View\Element\Html\Link */ public function getLabel() { - return $this->_createLabel($this->_getItemCount()); + return __('My Wish List'); } /** @@ -80,7 +87,15 @@ class Link extends \Magento\View\Element\Html\Link */ public function getTitle() { - return $this->_createLabel($this->_getItemCount()); + return $this->getLabel(); + } + + /** + * @return string + */ + public function getCounter() + { + return $this->_createCounter($this->_getItemCount()); } /** @@ -99,14 +114,14 @@ class Link extends \Magento\View\Element\Html\Link * @param int $count * @return string */ - protected function _createLabel($count) + protected function _createCounter($count) { if ($count > 1) { - return __('My Wish List (%1 items)', $count); + return __('%1 items', $count); } else if ($count == 1) { - return __('My Wish List (%1 item)', $count); + return __('1 item'); } else { - return __('My Wish List'); + return; } } } diff --git a/app/code/Magento/Wishlist/Controller/AbstractController.php b/app/code/Magento/Wishlist/Controller/AbstractController.php index 371e4398ec7..2fdddfe6359 100644 --- a/app/code/Magento/Wishlist/Controller/AbstractController.php +++ b/app/code/Magento/Wishlist/Controller/AbstractController.php @@ -34,6 +34,8 @@ */ namespace Magento\Wishlist\Controller; +use Magento\App\Action\Context; + abstract class AbstractController extends \Magento\App\Action\Action { /** @@ -42,6 +44,23 @@ abstract class AbstractController extends \Magento\App\Action\Action */ protected $_localFilter = null; + /** + * @var \Magento\Core\App\Action\FormKeyValidator + */ + protected $_formKeyValidator; + + /** + * @param Context $context + * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator + */ + public function __construct( + \Magento\App\Action\Context $context, + \Magento\Core\App\Action\FormKeyValidator $formKeyValidator + ) { + $this->_formKeyValidator = $formKeyValidator; + parent::__construct($context); + } + /** * Processes localized qty (entered by user at frontend) into internal php format * @@ -71,10 +90,14 @@ abstract class AbstractController extends \Magento\App\Action\Action /** * Add all items from wishlist to shopping cart - * */ public function allcartAction() { + if (!$this->_formKeyValidator->validate($this->getRequest())) { + $this->_forward('noroute'); + return ; + } + $wishlist = $this->_getWishlist(); if (!$wishlist) { $this->_forward('noroute'); diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index dd3eff6aef3..d6adf8cac50 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -65,30 +65,24 @@ class Index */ protected $_coreRegistry; - /** - * @var \Magento\Core\App\Action\FormKeyValidator - */ - protected $_formKeyValidator; - /** * @param \Magento\App\Action\Context $context + * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\App\Response\Http\FileFactory $fileResponseFactory - * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator */ public function __construct( \Magento\App\Action\Context $context, + \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, \Magento\Core\Model\Registry $coreRegistry, \Magento\Wishlist\Model\Config $wishlistConfig, - \Magento\App\Response\Http\FileFactory $fileResponseFactory, - \Magento\Core\App\Action\FormKeyValidator $formKeyValidator + \Magento\App\Response\Http\FileFactory $fileResponseFactory ) { $this->_coreRegistry = $coreRegistry; $this->_wishlistConfig = $wishlistConfig; $this->_fileResponseFactory = $fileResponseFactory; - $this->_formKeyValidator = $formKeyValidator; - parent::__construct($context); + parent::__construct($context, $formKeyValidator); } /** diff --git a/app/code/Magento/Wishlist/Controller/Shared.php b/app/code/Magento/Wishlist/Controller/Shared.php index f1827de7b0b..24f6fb30fc4 100644 --- a/app/code/Magento/Wishlist/Controller/Shared.php +++ b/app/code/Magento/Wishlist/Controller/Shared.php @@ -45,14 +45,16 @@ class Shared extends \Magento\Wishlist\Controller\AbstractController /** * @param \Magento\App\Action\Context $context + * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator * @param \Magento\Core\Model\Registry $coreRegistry */ public function __construct( \Magento\App\Action\Context $context, + \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, \Magento\Core\Model\Registry $coreRegistry ) { $this->_coreRegistry = $coreRegistry; - parent::__construct($context); + parent::__construct($context, $formKeyValidator); } /** diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 7b23d60ddc7..b1ed0f58dfe 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -398,7 +398,7 @@ class Data extends \Magento\App\Helper\AbstractHelper } /** - * Retrieve URL for adding item to shoping cart from shared wishlist + * Retrieve URL for adding item to shopping cart from shared wishlist * * @param string|\Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item * @return string diff --git a/app/code/Magento/Wishlist/view/email/share_notification.html b/app/code/Magento/Wishlist/view/email/share_notification.html index 399b85755c2..386e494b723 100644 --- a/app/code/Magento/Wishlist/view/email/share_notification.html +++ b/app/code/Magento/Wishlist/view/email/share_notification.html @@ -29,7 +29,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">{{var message}}</p> {{var items}} <br/> - {{depend salable}}<p style="font-size:12px; line-height:16px; margin:0 0 8px 0;"><strong><a href="{{var addAllLink}}" style="color:#1E7EC8;">Add all items to shopping cart</a></strong> |{{/depend}} <strong><a href="{{var viewOnSiteLink}}" style="color:#1E7EC8;">View all wishlist items</a></strong></p> + <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">{{depend salable}}<strong><a href="{{var addAllLink}}" style="color:#1E7EC8;">Add all items to shopping cart</a></strong> |{{/depend}} <strong><a href="{{var viewOnSiteLink}}" style="color:#1E7EC8;">View all wishlist items</a></strong></p> </td> </tr> <tr> diff --git a/app/code/Magento/Wishlist/view/frontend/item/column/cart.phtml b/app/code/Magento/Wishlist/view/frontend/item/column/cart.phtml index 52a7d61f4c4..bddec992a91 100644 --- a/app/code/Magento/Wishlist/view/frontend/item/column/cart.phtml +++ b/app/code/Magento/Wishlist/view/frontend/item/column/cart.phtml @@ -34,7 +34,7 @@ $options = $this->getChildBlock('customer.wishlist.item.options') <?php echo $this->getPriceHtml($product, empty($options));?> <div class="box tocart"> <?php if ($item->canHaveQty() && $item->getProduct()->isVisibleInSiteVisibility()): ?> - <input type="text" class="input-text qty" data-validate="{required:true,'validate-greater-than-zero':true}" + <input type="number" class="input-text qty" data-validate="{required:true,'validate-greater-than-zero':true}" name="qty[<?php echo $item->getId() ?>]" value="<?php echo $this->getAddToCartQty($item) * 1 ?>"> <?php endif; ?> <?php if ($product->isSaleable()): ?> diff --git a/app/code/Magento/Wishlist/view/frontend/layout/default.xml b/app/code/Magento/Wishlist/view/frontend/layout/default.xml index c84c1ec70ab..0c642530fc1 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/default.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/default.xml @@ -28,6 +28,6 @@ <block class="Magento\Wishlist\Block\Link" name="wish-list-link" after="my-account-link"/> </referenceBlock> <referenceContainer name="right"> - <block class="Magento\Wishlist\Block\Customer\Sidebar" name="wishlist_sidebar" as="wishlist" after="cart_sidebar" template="sidebar.phtml"/> + <block class="Magento\Wishlist\Block\Customer\Sidebar" name="wishlist_sidebar" as="wishlist" template="Magento_Wishlist::sidebar.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Wishlist/view/frontend/render/item/price.phtml b/app/code/Magento/Wishlist/view/frontend/link.phtml similarity index 60% rename from app/code/Magento/Wishlist/view/frontend/render/item/price.phtml rename to app/code/Magento/Wishlist/view/frontend/link.phtml index fba1c3b9b93..3b0ef5962b6 100644 --- a/app/code/Magento/Wishlist/view/frontend/render/item/price.phtml +++ b/app/code/Magento/Wishlist/view/frontend/link.phtml @@ -19,21 +19,13 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package base_default * @copyright Copyright (c) 2013 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\Wishlist\Block\Customer\Wishlist_Render_Item_Price */ +/* @var $this \Magento\Wishlist\Block\Link */ ?> - -<?php echo $this->getCleanProductPriceHtml(); ?> - -<?php /* @var $product \Magento\Catalog\Model\Product */ ?> -<?php $product = $this->getProduct(); ?> -<?php $finalPrice = $product->getFinalPrice(1); ?> -<?php if ($product->canConfigure()): ?> - <p class="configured-price"> - <span class="price-label"><?php echo __('Configured Price:') ?></span> - <span class="price"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($finalPrice, true, false); ?></span> - </p> -<?php endif; ?> +<li class="link wishlist"> + <a <?php echo $this->getLinkAttributes() ?>><?php echo $this->escapeHtml($this->getLabel())?> + <?php echo ($this->getCounter()) ? '<span class="counter qty">' . $this->escapeHtml($this->getCounter()) . '</span>' : ''; ?> + </a> +</li> diff --git a/app/code/Magento/Wishlist/view/frontend/sidebar.phtml b/app/code/Magento/Wishlist/view/frontend/sidebar.phtml index 426803cf14f..8490da6877b 100644 --- a/app/code/Magento/Wishlist/view/frontend/sidebar.phtml +++ b/app/code/Magento/Wishlist/view/frontend/sidebar.phtml @@ -24,12 +24,18 @@ */ /* @var $this \Magento\Wishlist\Block\Customer\Sidebar */ ?> - +<?php +$count = $this->getItemCount(); +?> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> <?php $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Image');?> <div class="block wishlist"> <div class="title"> - <strong><?php echo $this->getTitle(); ?></strong> + <strong><?php echo $this->getTitle(); ?> + <?php if($count > 0): ?> + <span class="counter qty"><?php echo ($count == 1) ? __('1 item') : __('%1 items',$count) ?></span> + <?php endif; ?> + </strong> </div> <div class="content"> <strong class="subtitle"><?php echo __('Last Added Items') ?></strong> @@ -65,7 +71,7 @@ <a class="action details" href="<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getListUrl() ?>"><span><?php echo __('Go to Wish List') ?></span></a> </div> <?php else: ?> - <p class="empty"><?php echo __('You have no items in your wish list.') ?></p> + <p class="message info empty"><?php echo __('You have no items in your wish list.') ?></p> <?php endif ?> </div> </div> diff --git a/app/code/Magento/Wishlist/view/frontend/view.phtml b/app/code/Magento/Wishlist/view/frontend/view.phtml index e564596675f..3a5d7320251 100644 --- a/app/code/Magento/Wishlist/view/frontend/view.phtml +++ b/app/code/Magento/Wishlist/view/frontend/view.phtml @@ -75,7 +75,7 @@ infoList: false, addToCartUrl: '<?php echo $this->getItemAddToCartUrl('%item%');?>' , confirmRemoveMessage: '<?php echo __('Are you sure you want to remove this product from your wishlist?') ?>', - addAllToCartUrl : '<?php echo $this->getUrl('*/*/allcart', array('wishlist_id' => $this->getWishlistInstance()->getId())) ?>', + addAllToCartUrl : '<?php echo $this->getAddAllToCartUrl(); ?>', commentString : '' }); }); diff --git a/app/design/adminhtml/magento_backend/css/styles.css b/app/design/adminhtml/magento_backend/css/styles.css index faccd991c81..24122c17831 100644 --- a/app/design/adminhtml/magento_backend/css/styles.css +++ b/app/design/adminhtml/magento_backend/css/styles.css @@ -172,9 +172,11 @@ button.primary, .catalog-product-new .actions-split > .action-toggle.primary, .catalog-product-edit .actions-split > .action-toggle.primary, .catalog-product-index .actions-split > .action-toggle.primary, +.adminhtml-integration-new .actions-split > .action-toggle.primary, .catalog-product-new .actions-split.btn-round .action-default.primary, .catalog-product-edit .actions-split.btn-round .action-default.primary, -.catalog-product-index .actions-split.btn-round .action-default.primary { +.catalog-product-index .actions-split.btn-round .action-default.primary, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary { font: 14px/19px 'Open Sans', sans-serif; font-weight: 500; background: #f2ebde; @@ -367,6 +369,9 @@ button.primary:active, .catalog-product-index .actions-split > .action-toggle.primary:hover, .catalog-product-index .actions-split > .action-toggle.primary:focus, .catalog-product-index .actions-split > .action-toggle.primary:active, +.adminhtml-integration-new .actions-split > .action-toggle.primary:hover, +.adminhtml-integration-new .actions-split > .action-toggle.primary:focus, +.adminhtml-integration-new .actions-split > .action-toggle.primary:active, .catalog-product-new .actions-split.btn-round .action-default.primary:hover, .catalog-product-new .actions-split.btn-round .action-default.primary:focus, .catalog-product-new .actions-split.btn-round .action-default.primary:active, @@ -375,7 +380,10 @@ button.primary:active, .catalog-product-edit .actions-split.btn-round .action-default.primary:active, .catalog-product-index .actions-split.btn-round .action-default.primary:hover, .catalog-product-index .actions-split.btn-round .action-default.primary:focus, -.catalog-product-index .actions-split.btn-round .action-default.primary:active { +.catalog-product-index .actions-split.btn-round .action-default.primary:active, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:hover, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:focus, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:active { background: #cac3b4; color: #676056; } @@ -437,9 +445,11 @@ button.primary:active, .catalog-product-new .actions-split > .action-toggle.primary:active, .catalog-product-edit .actions-split > .action-toggle.primary:active, .catalog-product-index .actions-split > .action-toggle.primary:active, +.adminhtml-integration-new .actions-split > .action-toggle.primary:active, .catalog-product-new .actions-split.btn-round .action-default.primary:active, .catalog-product-edit .actions-split.btn-round .action-default.primary:active, -.catalog-product-index .actions-split.btn-round .action-default.primary:active { +.catalog-product-index .actions-split.btn-round .action-default.primary:active, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:active { border: 1px solid #989287; } .DefaultButton:visited, @@ -500,9 +510,11 @@ button.primary:visited, .catalog-product-new .actions-split > .action-toggle.primary:visited, .catalog-product-edit .actions-split > .action-toggle.primary:visited, .catalog-product-index .actions-split > .action-toggle.primary:visited, +.adminhtml-integration-new .actions-split > .action-toggle.primary:visited, .catalog-product-new .actions-split.btn-round .action-default.primary:visited, .catalog-product-edit .actions-split.btn-round .action-default.primary:visited, -.catalog-product-index .actions-split.btn-round .action-default.primary:visited { +.catalog-product-index .actions-split.btn-round .action-default.primary:visited, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:visited { color: #676056; } .DefaultButton[disabled], @@ -621,12 +633,16 @@ button.primary.disabled, .catalog-product-edit .actions-split > .action-toggle.primary.disabled, .catalog-product-index .actions-split > .action-toggle.primary[disabled], .catalog-product-index .actions-split > .action-toggle.primary.disabled, +.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled], +.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled, .catalog-product-new .actions-split.btn-round .action-default.primary[disabled], .catalog-product-new .actions-split.btn-round .action-default.primary.disabled, .catalog-product-edit .actions-split.btn-round .action-default.primary[disabled], .catalog-product-edit .actions-split.btn-round .action-default.primary.disabled, .catalog-product-index .actions-split.btn-round .action-default.primary[disabled], -.catalog-product-index .actions-split.btn-round .action-default.primary.disabled { +.catalog-product-index .actions-split.btn-round .action-default.primary.disabled, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled], +.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled { cursor: not-allowed; opacity: 0.5; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); @@ -863,6 +879,10 @@ button.primary.disabled:active, .catalog-product-index .actions-split > .action-toggle.primary.disabled:hover, .catalog-product-index .actions-split > .action-toggle.primary[disabled]:active, .catalog-product-index .actions-split > .action-toggle.primary.disabled:active, +.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled]:hover, +.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled:hover, +.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled]:active, +.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled:active, .catalog-product-new .actions-split.btn-round .action-default.primary[disabled]:hover, .catalog-product-new .actions-split.btn-round .action-default.primary.disabled:hover, .catalog-product-new .actions-split.btn-round .action-default.primary[disabled]:active, @@ -874,7 +894,11 @@ button.primary.disabled:active, .catalog-product-index .actions-split.btn-round .action-default.primary[disabled]:hover, .catalog-product-index .actions-split.btn-round .action-default.primary.disabled:hover, .catalog-product-index .actions-split.btn-round .action-default.primary[disabled]:active, -.catalog-product-index .actions-split.btn-round .action-default.primary.disabled:active { +.catalog-product-index .actions-split.btn-round .action-default.primary.disabled:active, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled]:hover, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled:hover, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled]:active, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled:active { color: #676056; background: #f2ebde; border: 1px solid #ada89e; @@ -930,9 +954,11 @@ button.primary, .catalog-product-new .actions-split > .action-toggle.primary, .catalog-product-edit .actions-split > .action-toggle.primary, .catalog-product-index .actions-split > .action-toggle.primary, +.adminhtml-integration-new .actions-split > .action-toggle.primary, .catalog-product-new .actions-split.btn-round .action-default.primary, .catalog-product-edit .actions-split.btn-round .action-default.primary, .catalog-product-index .actions-split.btn-round .action-default.primary, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary, .PrimaryAddButton, .PrimarySplitButton > .action-toggle.primary, input[type=button].primary, @@ -983,9 +1009,11 @@ button.primary, .catalog-product-new .actions-split > .action-toggle.primary, .catalog-product-edit .actions-split > .action-toggle.primary, .catalog-product-index .actions-split > .action-toggle.primary, +.adminhtml-integration-new .actions-split > .action-toggle.primary, .catalog-product-new .actions-split.btn-round .action-default.primary, .catalog-product-edit .actions-split.btn-round .action-default.primary, -.catalog-product-index .actions-split.btn-round .action-default.primary { +.catalog-product-index .actions-split.btn-round .action-default.primary, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary { color: #fff; background: #007dbd; border: 1px solid #0574ad; @@ -1092,12 +1120,16 @@ button.primary:hover, .catalog-product-edit .actions-split > .action-toggle.primary:hover, .catalog-product-index .actions-split > .action-toggle.primary:focus, .catalog-product-index .actions-split > .action-toggle.primary:hover, +.adminhtml-integration-new .actions-split > .action-toggle.primary:focus, +.adminhtml-integration-new .actions-split > .action-toggle.primary:hover, .catalog-product-new .actions-split.btn-round .action-default.primary:focus, .catalog-product-new .actions-split.btn-round .action-default.primary:hover, .catalog-product-edit .actions-split.btn-round .action-default.primary:focus, .catalog-product-edit .actions-split.btn-round .action-default.primary:hover, .catalog-product-index .actions-split.btn-round .action-default.primary:focus, -.catalog-product-index .actions-split.btn-round .action-default.primary:hover { +.catalog-product-index .actions-split.btn-round .action-default.primary:hover, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:focus, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:hover { color: #fff; background: #026294; border: 1px solid #026294; @@ -1153,9 +1185,11 @@ button.primary:active, .catalog-product-new .actions-split > .action-toggle.primary:active, .catalog-product-edit .actions-split > .action-toggle.primary:active, .catalog-product-index .actions-split > .action-toggle.primary:active, +.adminhtml-integration-new .actions-split > .action-toggle.primary:active, .catalog-product-new .actions-split.btn-round .action-default.primary:active, .catalog-product-edit .actions-split.btn-round .action-default.primary:active, -.catalog-product-index .actions-split.btn-round .action-default.primary:active { +.catalog-product-index .actions-split.btn-round .action-default.primary:active, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:active { color: #fff; background: #026294; border: 1px solid #004c74; @@ -1211,9 +1245,11 @@ button.primary:visited, .catalog-product-new .actions-split > .action-toggle.primary:visited, .catalog-product-edit .actions-split > .action-toggle.primary:visited, .catalog-product-index .actions-split > .action-toggle.primary:visited, +.adminhtml-integration-new .actions-split > .action-toggle.primary:visited, .catalog-product-new .actions-split.btn-round .action-default.primary:visited, .catalog-product-edit .actions-split.btn-round .action-default.primary:visited, -.catalog-product-index .actions-split.btn-round .action-default.primary:visited { +.catalog-product-index .actions-split.btn-round .action-default.primary:visited, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:visited { color: #fff; } .PrimaryButton[disabled]:hover, @@ -1420,6 +1456,10 @@ button.primary.disabled:active, .catalog-product-index .actions-split > .action-toggle.primary.disabled:hover, .catalog-product-index .actions-split > .action-toggle.primary[disabled]:active, .catalog-product-index .actions-split > .action-toggle.primary.disabled:active, +.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled]:hover, +.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled:hover, +.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled]:active, +.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled:active, .catalog-product-new .actions-split.btn-round .action-default.primary[disabled]:hover, .catalog-product-new .actions-split.btn-round .action-default.primary.disabled:hover, .catalog-product-new .actions-split.btn-round .action-default.primary[disabled]:active, @@ -1431,7 +1471,11 @@ button.primary.disabled:active, .catalog-product-index .actions-split.btn-round .action-default.primary[disabled]:hover, .catalog-product-index .actions-split.btn-round .action-default.primary.disabled:hover, .catalog-product-index .actions-split.btn-round .action-default.primary[disabled]:active, -.catalog-product-index .actions-split.btn-round .action-default.primary.disabled:active { +.catalog-product-index .actions-split.btn-round .action-default.primary.disabled:active, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled]:hover, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled:hover, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled]:active, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled:active { color: #fff; background: #007dbd; border: 1px solid #0574ad; @@ -1479,6 +1523,7 @@ button.primary.disabled:active, .catalog-product-new .actions-split.btn-round .action-default.primary, .catalog-product-edit .actions-split.btn-round .action-default.primary, .catalog-product-index .actions-split.btn-round .action-default.primary, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary, .PrimarySplitButton.btn-round .action-default.primary, .sales-order-index .page-actions .add, .adminhtml-rma-index .page-actions .add, @@ -1520,7 +1565,8 @@ button.primary.disabled:active, .catalog-product-set-index .page-actions .add, .catalog-product-new .actions-split.btn-round .action-default.primary, .catalog-product-edit .actions-split.btn-round .action-default.primary, -.catalog-product-index .actions-split.btn-round .action-default.primary { +.catalog-product-index .actions-split.btn-round .action-default.primary, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary { width: 36px; height: 31px; overflow: hidden; @@ -1570,7 +1616,8 @@ button.primary.disabled:active, .catalog-product-set-index .page-actions .add:focus, .catalog-product-new .actions-split.btn-round .action-default.primary:focus, .catalog-product-edit .actions-split.btn-round .action-default.primary:focus, -.catalog-product-index .actions-split.btn-round .action-default.primary:focus { +.catalog-product-index .actions-split.btn-round .action-default.primary:focus, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:focus { outline: none; } .PrimaryAddButton > span, @@ -1615,7 +1662,8 @@ button.primary.disabled:active, .catalog-product-set-index .page-actions .add > span, .catalog-product-new .actions-split.btn-round .action-default.primary > span, .catalog-product-edit .actions-split.btn-round .action-default.primary > span, -.catalog-product-index .actions-split.btn-round .action-default.primary > span { +.catalog-product-index .actions-split.btn-round .action-default.primary > span, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary > span { text-indent: -999em; display: block; width: 34px; @@ -1663,7 +1711,8 @@ button.primary.disabled:active, .catalog-product-set-index .page-actions .add > span:before, .catalog-product-new .actions-split.btn-round .action-default.primary > span:before, .catalog-product-edit .actions-split.btn-round .action-default.primary > span:before, -.catalog-product-index .actions-split.btn-round .action-default.primary > span:before { +.catalog-product-index .actions-split.btn-round .action-default.primary > span:before, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary > span:before { text-indent: 0; font-family: 'MUI-Icons'; font-weight: normal; @@ -1722,43 +1771,51 @@ button.primary.disabled:active, .eq-ie9 .catalog-product-set-index .page-actions .add > span:before, .eq-ie9 .catalog-product-new .actions-split.btn-round .action-default.primary > span:before, .eq-ie9 .catalog-product-edit .actions-split.btn-round .action-default.primary > span:before, -.eq-ie9 .catalog-product-index .actions-split.btn-round .action-default.primary > span:before { +.eq-ie9 .catalog-product-index .actions-split.btn-round .action-default.primary > span:before, +.eq-ie9 .adminhtml-integration-new .actions-split.btn-round .action-default.primary > span:before { line-height: 31px; } .PrimarySplitButton.btn-round .action-default.primary, .catalog-product-new .actions-split.btn-round .action-default.primary, .catalog-product-edit .actions-split.btn-round .action-default.primary, .catalog-product-index .actions-split.btn-round .action-default.primary, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary, .catalog-product-new .actions-split.btn-round .action-default.primary, .catalog-product-edit .actions-split.btn-round .action-default.primary, -.catalog-product-index .actions-split.btn-round .action-default.primary { +.catalog-product-index .actions-split.btn-round .action-default.primary, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary { border-radius: 2px 0 0 2px; } .PrimarySplitButton.btn-round .action-default.primary:focus, .catalog-product-new .actions-split.btn-round .action-default.primary:focus, .catalog-product-edit .actions-split.btn-round .action-default.primary:focus, -.catalog-product-index .actions-split.btn-round .action-default.primary:focus { +.catalog-product-index .actions-split.btn-round .action-default.primary:focus, +.adminhtml-integration-new .actions-split.btn-round .action-default.primary:focus { outline: none; } .PrimarySplitButton > .action-default.primary, .catalog-product-new .actions-split > .action-default.primary, .catalog-product-edit .actions-split > .action-default.primary, -.catalog-product-index .actions-split > .action-default.primary { +.catalog-product-index .actions-split > .action-default.primary, +.adminhtml-integration-new .actions-split > .action-default.primary { border-radius: 2px 0 0 2px; } .PrimarySplitButton > .action-default.primary:focus, .catalog-product-new .actions-split > .action-default.primary:focus, .catalog-product-edit .actions-split > .action-default.primary:focus, -.catalog-product-index .actions-split > .action-default.primary:focus { +.catalog-product-index .actions-split > .action-default.primary:focus, +.adminhtml-integration-new .actions-split > .action-default.primary:focus { outline: none; } .PrimarySplitButton > .action-toggle.primary, .catalog-product-new .actions-split > .action-toggle.primary, .catalog-product-edit .actions-split > .action-toggle.primary, .catalog-product-index .actions-split > .action-toggle.primary, +.adminhtml-integration-new .actions-split > .action-toggle.primary, .catalog-product-new .actions-split > .action-toggle.primary, .catalog-product-edit .actions-split > .action-toggle.primary, -.catalog-product-index .actions-split > .action-toggle.primary { +.catalog-product-index .actions-split > .action-toggle.primary, +.adminhtml-integration-new .actions-split > .action-toggle.primary { overflow: hidden; z-index: 1; padding: 0; @@ -1775,19 +1832,22 @@ button.primary.disabled:active, .PrimarySplitButton > .action-toggle.primary:focus, .catalog-product-new .actions-split > .action-toggle.primary:focus, .catalog-product-edit .actions-split > .action-toggle.primary:focus, -.catalog-product-index .actions-split > .action-toggle.primary:focus { +.catalog-product-index .actions-split > .action-toggle.primary:focus, +.adminhtml-integration-new .actions-split > .action-toggle.primary:focus { outline: none; } .PrimarySplitButton > .action-toggle.primary:before, .catalog-product-new .actions-split > .action-toggle.primary:before, .catalog-product-edit .actions-split > .action-toggle.primary:before, -.catalog-product-index .actions-split > .action-toggle.primary:before { +.catalog-product-index .actions-split > .action-toggle.primary:before, +.adminhtml-integration-new .actions-split > .action-toggle.primary:before { text-align: center; } .PrimarySplitButton .dropdown-menu, .catalog-product-new .actions-split .dropdown-menu, .catalog-product-edit .actions-split .dropdown-menu, -.catalog-product-index .actions-split .dropdown-menu { +.catalog-product-index .actions-split .dropdown-menu, +.adminhtml-integration-new .actions-split .dropdown-menu { left: 0; right: auto; z-index: 1; @@ -1795,7 +1855,8 @@ button.primary.disabled:active, .PrimarySplitButton .dropdown-menu > li > .item, .catalog-product-new .actions-split .dropdown-menu > li > .item, .catalog-product-edit .actions-split .dropdown-menu > li > .item, -.catalog-product-index .actions-split .dropdown-menu > li > .item { +.catalog-product-index .actions-split .dropdown-menu > li > .item, +.adminhtml-integration-new .actions-split .dropdown-menu > li > .item { padding: 9px 10px 10px; } .PrimarySplitButton.active > .action-toggle.primary, @@ -1805,7 +1866,9 @@ button.primary.disabled:active, .catalog-product-edit .actions-split.active > .action-toggle.primary, .catalog-product-edit .actions-split.active > .action-toggle.primary:hover, .catalog-product-index .actions-split.active > .action-toggle.primary, -.catalog-product-index .actions-split.active > .action-toggle.primary:hover { +.catalog-product-index .actions-split.active > .action-toggle.primary:hover, +.adminhtml-integration-new .actions-split.active > .action-toggle.primary, +.adminhtml-integration-new .actions-split.active > .action-toggle.primary:hover { background: #026294; border: 1px solid #004c74; } @@ -5858,6 +5921,7 @@ tr.dynamic-grid input.input-text { #up_sell_product_grid table.data th > span, #related_product_grid table.data th > span, #productGrid_table th > span, +#customerGrid_table th > span, #setGrid_table th > span, #attributeGrid_table th > span, .custom-options .data-table th > span, @@ -6933,6 +6997,12 @@ table .col-draggable .draggable-handle { display: inline-block; float: none; } +.fpt-item-container select { + width: 100%; +} +.fpt-item-container select:first-child { + margin-bottom: 8px; +} .clearfix:before, .clearfix:after, [class$="-layout"]:after, @@ -8675,9 +8745,6 @@ table .col-draggable .draggable-handle { /* Dashboard -------------------------------------- */ -.dashboard-inner { - border: 1px solid #ccc; -} .adminhtml-dashboard-index .col-2-left-layout, .adminhtml-dashboard-index .col-1-layout { min-width: 0; @@ -8686,9 +8753,33 @@ table .col-draggable .draggable-handle { width: 38%; padding: 1%; } +.adminhtml-dashboard-index .side-col .entry-edit { + padding: 10px 15px 10px 10px; + margin-bottom: 5px; +} +.adminhtml-dashboard-index .side-col .entry-edit .entry-edit-head { + margin-bottom: 20px; +} +.adminhtml-dashboard-index .side-col .entry-edit .entry-edit-head h4 { + margin: 0; +} +.adminhtml-dashboard-index .side-col .entry-edit fieldset { + padding: 0; + border: 0; +} +.adminhtml-dashboard-index .side-col .entry-edit fieldset .grid { + padding-bottom: 0; +} .adminhtml-dashboard-index .col-2-left-layout .main-col { min-width: 0; width: 60%; + padding: 16px 30px 30px; +} +.adminhtml-dashboard-index .col-2-left-layout .main-col .store-switcher-alt { + margin-bottom: 15px; +} +.adminhtml-dashboard-index .col-2-left-layout .main-col .store-switcher-alt > strong { + padding-left: 0; } .dashboard-container { border-radius: 0; @@ -8696,9 +8787,6 @@ table .col-draggable .draggable-handle { .dashboard-container.col-2-left-layout:before { left: 40%; } -.dashboard-container .dashboard-inner { - padding: 20px; -} .dashboard-inner .tabs-horiz > li a { padding-left: 14px; padding-right: 14px; @@ -8964,26 +9052,31 @@ table .col-draggable .draggable-handle { } .sales-order-create-index thead .col-entity_id, .sales-order-create-index .col-entity_id, -.sales-order-create-index .col-qty { +.sales-order-create-index .col-qty, +.checkout-index-index .col-qty { width: 50px; } -.sales-order-create-index .col-in_products { +.sales-order-create-index .col-in_products, +.checkout-index-index .col-in_products { text-align: center; } .sales-order-create-index .col-sku, -.sales-order-create-index .col-remove { +.sales-order-create-index .col-remove, +.checkout-index-index .col-remove { width: 120px; } .sales-order-create-index .col-price { width: 70px; } -.sales-order-create-index .order-search-items .col-name { +.sales-order-create-index .order-search-items .col-name, +.checkout-index-index #source_products_table .col-name { width: 50%; } .sales-order-create-index .order-items.fieldset-wrapper .fieldset-wrapper-title, .sales-order-create-index .order-search-items.fieldset-wrapper .fieldset-wrapper-title, .sales-order-create-index .order-additional-area.fieldset-wrapper .fieldset-wrapper-title, -.sales-order-create-index .order-errors .fieldset-wrapper-title { +.sales-order-create-index .order-errors .fieldset-wrapper-title, +.checkout-index-index .checkout-errors .fieldset-wrapper-title { border-bottom: 0; margin: 0; } @@ -8994,7 +9087,8 @@ table .col-draggable .draggable-handle { .sales-order-create-index .order-items.fieldset-wrapper .title, .sales-order-create-index .order-additional-area.fieldset-wrapper .title, .sales-order-create-index .order-search-items.fieldset-wrapper .title, -.sales-order-create-index .order-errors .title { +.sales-order-create-index .order-errors .title, +.checkout-index-index .checkout-errors .title { border-bottom: 1px solid #ededed; float: none; margin: 0 0 18px; @@ -9002,7 +9096,8 @@ table .col-draggable .draggable-handle { } .sales-order-create-index .order-items.fieldset-wrapper .actions, .sales-order-create-index .order-search-items.fieldset-wrapper .actions, -.sales-order-create-index #order-errors .actions { +.sales-order-create-index #order-errors .actions, +.checkout-index-index .checkout-errors .fieldset-wrapper-title .actions { float: none; border: 1px solid #c0bbaf; border-bottom: 0; @@ -9019,7 +9114,8 @@ table .col-draggable .draggable-handle { padding: 0 8px; position: relative; } -.sales-order-create-index #order-data .fieldset-wrapper .actions .action-add { +.sales-order-create-index #order-data .fieldset-wrapper .actions .action-add, +.checkout-index-index .checkout-errors .fieldset-wrapper-title .actions .action-add { margin: 7px 8px 8px 0; } .sales-order-create-index .order-additional-area.fieldset-wrapper .actions { @@ -9027,8 +9123,9 @@ table .col-draggable .draggable-handle { margin: 0 0 8px; padding: 0; } -.sales-order-create-index #order-data .fieldset-wrapper .actions .action-delete { - margin: 11px 0 0; +.sales-order-create-index #order-data .fieldset-wrapper .actions .action-delete, +.checkout-index-index .checkout-errors .fieldset-wrapper-title .actions .action-delete { + margin: 13px 0 0; } .sales-order-create-index .ui-dialog .downloadable.information .link .label { margin-left: 0; @@ -9051,6 +9148,47 @@ table .col-draggable .draggable-handle { margin: 0 0 0 10px; width: 60px; } +.tax.summary-total .summary-collapse { + cursor: pointer; + display: inline-block; +} +.tax.summary-total .summary-collapse:before { + content: "\e02d"; + color: #816063; + background: #f2ebde; + display: inline-block; + text-indent: 0; + font-size: 16px; + width: 16px; + height: 16px; + line-height: 16px; + overflow: hidden; + font-family: 'MUI-Icons'; + border: 1px solid #ada89e; + font-style: normal; + vertical-align: top; + margin-right: 7px; + font-weight: normal; + speak: none; + -webkit-font-smoothing: antialiased; + border-radius: 2px; +} +.tax.summary-total .summary-collapse:hover:before { + background: #cac3b4; +} +.tax.summary-total.show-details .summary-collapse:before { + content: "\e03a"; +} +tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) td, +tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) ~ tr.row-totals:nth-child(even) td, +tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) ~ tr.row-totals:nth-child(even) td { + background: #fbfaf6; +} +tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) ~ tr.row-totals:nth-child(odd) td, +tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) ~ tr.row-totals:nth-child(odd) td, +tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) td { + background: #fff; +} /* ----------------------------------- */ #order-data .page-actions { padding-top: 0; @@ -9936,9 +10074,56 @@ table.items-to-invoice tbody tr:hover td { .adminhtml-system-currencysymbol-index td.col-currency .label { margin-top: 5px; } +/* + Categories +-------------------------------------- */ +.category-content .form-inline.permissions-custom-options .messages li { + margin-top: 0; +} +.category-content .form-inline.permissions-custom-options .data-table { + margin-bottom: 25px; +} +/* + Marketing - Email Reminders +-------------------------------------- */ +.lt-1280 .adminhtml-reminder-edit #customerGrid .grid .filter .range div.date { + min-width: 0; +} +/* + Customers - Manage Shopping Cart +-------------------------------------- */ +.checkout-index-index .products-search { + margin-top: 35px; +} +.checkout-index-index .products-search > .actions { + text-align: right; + margin: 10px 0; +} +.checkout-index-index .shopping-cart-items > .actions { + margin-bottom: 15px; +} +.checkout-index-index .shopping-cart-items .box-left, +.checkout-index-index .shopping-cart-items .box.right { + width: 49%; +} +.checkout-index-index .shopping-cart-items .box-left fieldset, +.checkout-index-index .shopping-cart-items .box.right fieldset { + border-radius: 5px; +} +.checkout-index-index .shopping-cart-items .box-left { + float: left; +} +.checkout-index-index .shopping-cart-items .box.right { + float: right; +} +.checkout-index-index .grid table .action-configure { + float: right; +} /* Clearfix -------------------------------------- */ +.shopping-cart-items:before, +.shopping-cart-items:after, .image-panel:before, .image-panel:after, .images:before, @@ -9950,6 +10135,7 @@ table.items-to-invoice tbody tr:hover td { content: ""; display: table; } +.shopping-cart-items:after, .image-panel:after, .images:after, .tax-rate-popup .field:after, diff --git a/app/design/adminhtml/magento_backend/less/styles/admin.less b/app/design/adminhtml/magento_backend/less/styles/admin.less index a3ae1bf4600..654177fa9ef 100644 --- a/app/design/adminhtml/magento_backend/less/styles/admin.less +++ b/app/design/adminhtml/magento_backend/less/styles/admin.less @@ -4602,6 +4602,7 @@ tr.dynamic-grid input.input-text { #up_sell_product_grid table.data th > span, #related_product_grid table.data th > span, #productGrid_table th > span, +#customerGrid_table th > span, #setGrid_table th > span, #attributeGrid_table th > span, .custom-options .data-table th > span, @@ -5771,6 +5772,14 @@ button, float: none; } +.fpt-item-container select { + width: 100%; + + &:first-child { + margin-bottom: 8px; + } +} + // Clearfix .clearfix:before, .clearfix:after, diff --git a/app/design/adminhtml/magento_backend/less/styles/pages.less b/app/design/adminhtml/magento_backend/less/styles/pages.less index b3df16f4cff..17e5ef24e45 100644 --- a/app/design/adminhtml/magento_backend/less/styles/pages.less +++ b/app/design/adminhtml/magento_backend/less/styles/pages.less @@ -1146,10 +1146,6 @@ /* Dashboard -------------------------------------- */ -.dashboard-inner { - border: 1px solid #ccc; -} - .adminhtml-dashboard-index .col-2-left-layout, .adminhtml-dashboard-index .col-1-layout { min-width: 0; @@ -1158,11 +1154,35 @@ .adminhtml-dashboard-index .side-col { width: 38%; padding: 1%; + .entry-edit { + padding: 10px 15px 10px 10px; + margin-bottom: 5px; + .entry-edit-head { + h4 { + margin: 0; + } + margin-bottom: 20px; + } + fieldset { + padding: 0; + border: 0; + .grid { + padding-bottom: 0; + } + } + } } .adminhtml-dashboard-index .col-2-left-layout .main-col { min-width: 0; width: 60%; + padding: 16px 30px 30px; + .store-switcher-alt { + margin-bottom: 15px; + > strong { + padding-left: 0; + } + } } .dashboard-container { @@ -1173,10 +1193,6 @@ left: 40%; } -.dashboard-container .dashboard-inner { - padding: 20px; -} - .dashboard-inner .tabs-horiz > li a { padding-left: 14px; padding-right: 14px; @@ -1485,16 +1501,19 @@ .sales-order-create-index thead .col-entity_id, .sales-order-create-index .col-entity_id, -.sales-order-create-index .col-qty { +.sales-order-create-index .col-qty, +.checkout-index-index .col-qty { width: 50px; } -.sales-order-create-index .col-in_products { +.sales-order-create-index .col-in_products, +.checkout-index-index .col-in_products { text-align: center; } .sales-order-create-index .col-sku, -.sales-order-create-index .col-remove { +.sales-order-create-index .col-remove, +.checkout-index-index .col-remove { width: 120px; } @@ -1502,14 +1521,16 @@ width: 70px; } -.sales-order-create-index .order-search-items .col-name { +.sales-order-create-index .order-search-items .col-name, +.checkout-index-index #source_products_table .col-name { width: 50%; } .sales-order-create-index .order-items.fieldset-wrapper .fieldset-wrapper-title, .sales-order-create-index .order-search-items.fieldset-wrapper .fieldset-wrapper-title, .sales-order-create-index .order-additional-area.fieldset-wrapper .fieldset-wrapper-title, -.sales-order-create-index .order-errors .fieldset-wrapper-title { +.sales-order-create-index .order-errors .fieldset-wrapper-title, +.checkout-index-index .checkout-errors .fieldset-wrapper-title { border-bottom: 0; margin: 0; } @@ -1522,7 +1543,8 @@ .sales-order-create-index .order-items.fieldset-wrapper .title, .sales-order-create-index .order-additional-area.fieldset-wrapper .title, .sales-order-create-index .order-search-items.fieldset-wrapper .title, -.sales-order-create-index .order-errors .title { +.sales-order-create-index .order-errors .title, +.checkout-index-index .checkout-errors .title { border-bottom: 1px solid #ededed; float: none; margin: 0 0 18px; @@ -1531,7 +1553,8 @@ .sales-order-create-index .order-items.fieldset-wrapper .actions, .sales-order-create-index .order-search-items.fieldset-wrapper .actions, -.sales-order-create-index #order-errors .actions { +.sales-order-create-index #order-errors .actions, +.checkout-index-index .checkout-errors .fieldset-wrapper-title .actions { float: none; border: 1px solid #c0bbaf; border-bottom: 0; @@ -1549,7 +1572,8 @@ position: relative; } -.sales-order-create-index #order-data .fieldset-wrapper .actions .action-add { +.sales-order-create-index #order-data .fieldset-wrapper .actions .action-add, +.checkout-index-index .checkout-errors .fieldset-wrapper-title .actions .action-add { margin: 7px 8px 8px 0; } @@ -1559,8 +1583,9 @@ padding: 0; } -.sales-order-create-index #order-data .fieldset-wrapper .actions .action-delete { - margin: 11px 0 0; +.sales-order-create-index #order-data .fieldset-wrapper .actions .action-delete, +.checkout-index-index .checkout-errors .fieldset-wrapper-title .actions .action-delete { + margin: 13px 0 0; } .sales-order-create-index { @@ -1596,6 +1621,51 @@ } } +.tax.summary-total .summary-collapse { + cursor: pointer; + display: inline-block; + &:before { + @iconsize: 16px; + content: "\e02d"; + color: #816063; + background: #f2ebde; + display: inline-block; + text-indent: 0; + font-size: @iconsize; + width:@iconsize; + height:@iconsize; + line-height: @iconsize; + overflow: hidden; + font-family: 'MUI-Icons'; + border:1px solid #ada89e; + font-style: normal; + vertical-align: top; + margin-right:7px; + font-weight: normal; + speak: none; + -webkit-font-smoothing: antialiased; + border-radius: 2px; + } + &:hover:before { + background: #cac3b4; + } +} +.tax.summary-total.show-details .summary-collapse:before { + content: "\e03a"; +} + +tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) td, +tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) ~ tr.row-totals:nth-child(even) td, +tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) ~ tr.row-totals:nth-child(even) td { + background: #fbfaf6; +} + +tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) ~ tr.row-totals:nth-child(odd) td, +tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) ~ tr.row-totals:nth-child(odd) td, +tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) td { + background: #fff; +} + /* ----------------------------------- */ #order-data .page-actions { @@ -2660,9 +2730,66 @@ table.items-to-invoice tbody tr:hover td { margin-top: 5px; } +/* + Categories +-------------------------------------- */ +.category-content .form-inline.permissions-custom-options { + .messages { + li { + margin-top: 0; + } + } + .data-table { + margin-bottom: 25px; + } +} + +/* + Marketing - Email Reminders +-------------------------------------- */ +.lt-1280 .adminhtml-reminder-edit #customerGrid .grid .filter .range div.date { + min-width: 0; +} + +/* + Customers - Manage Shopping Cart +-------------------------------------- */ +.checkout-index-index { + .products-search { + margin-top: 35px; + > .actions { + text-align: right; + margin: 10px 0; + } + } + .shopping-cart-items { + > .actions { + margin-bottom: 15px; + } + .box-left, + .box.right { + width: 49%; + fieldset { + border-radius: 5px; + } + } + .box-left { + float: left; + } + .box.right { + float: right; + } + } + .grid table .action-configure { + float: right; + } +} + /* Clearfix -------------------------------------- */ +.shopping-cart-items:before, +.shopping-cart-items:after, .image-panel:before, .image-panel:after, .images:before, @@ -2675,6 +2802,7 @@ table.items-to-invoice tbody tr:hover td { display: table; } +.shopping-cart-items:after, .image-panel:after, .images:after, .tax-rate-popup .field:after, diff --git a/app/design/adminhtml/magento_backend/mui/elements.css b/app/design/adminhtml/magento_backend/mui/elements.css index 225b684757b..6e7f1fa3813 100644 --- a/app/design/adminhtml/magento_backend/mui/elements.css +++ b/app/design/adminhtml/magento_backend/mui/elements.css @@ -92,7 +92,7 @@ padding: 4px 8px; border-radius: 3px; background: #000; - background: rgba(0, 0, 0, .8); + background: rgba(49, 48, 43, .8); color: #fff; text-shadow: none; z-index: 20; diff --git a/app/design/adminhtml/magento_backend/mui/form.css b/app/design/adminhtml/magento_backend/mui/form.css index 1bd9394ab5b..589511327ef 100644 --- a/app/design/adminhtml/magento_backend/mui/form.css +++ b/app/design/adminhtml/magento_backend/mui/form.css @@ -518,4 +518,4 @@ span.required { .form-actions:after, .clearfix:after { clear: both; -} \ No newline at end of file +} diff --git a/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml b/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml index f4023d945d8..563acc6a891 100644 --- a/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml +++ b/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml @@ -25,13 +25,13 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="header.links"> - <block class="Magento\Customer\Block\Account\Customer" name="customer" template="account/customer.phtml" /> + <block class="Magento\Customer\Block\Account\Customer" name="customer" template="account/customer.phtml" before="-" /> + <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login"/> <block class="Magento\Customer\Block\Account\RegisterLink" after="authorization-link-login" name="register-link"> <arguments> <argument name="label" xsi:type="string">Register</argument> </arguments> </block> - <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login"/> </referenceBlock> <move element="register-link" destination="header.links"/> <move element="top.links" destination="customer"/> diff --git a/app/design/frontend/magento_plushe/css/styles.css b/app/design/frontend/magento_plushe/css/styles.css index 019d1f28a4a..da78f58a7e6 100644 --- a/app/design/frontend/magento_plushe/css/styles.css +++ b/app/design/frontend/magento_plushe/css/styles.css @@ -420,6 +420,25 @@ hr { background: #f8f8f8; padding: 30px; } +.visuallyHidden { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} +.visuallyHidden.focusable:active, +.visuallyHidden.focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + width: auto; +} .primary.action, .action.myPrimary, input[type="submit"], @@ -483,8 +502,8 @@ input[type="button"], .form.search.advanced .actions .action, .form.orders.search .actions .action, .form.contact .actions .action, -.data.table.wishlist + .actions .primary .action.share, -.data.table.wishlist + .actions .primary .action.update, +.wrapper.table + .actions .primary .action.share, +.wrapper.table + .actions .primary .action.update, .recurring.order.details > .actions .primary .action, .form.send.confirmation .action.send, .action.myPrimary, @@ -549,8 +568,8 @@ input[type="button"], .form.search.advanced .actions .action, .form.orders.search .actions .action, .form.contact .actions .action, -.data.table.wishlist + .actions .primary .action.share, -.data.table.wishlist + .actions .primary .action.update, +.wrapper.table + .actions .primary .action.share, +.wrapper.table + .actions .primary .action.update, .recurring.order.details > .actions .primary .action, .form.send.confirmation .action.send { background-color: #da370a; @@ -745,12 +764,12 @@ input[type="button"]:hover, .form.contact .actions .action:focus, .form.contact .actions .action:active, .form.contact .actions .action:hover, -.data.table.wishlist + .actions .primary .action.share:focus, -.data.table.wishlist + .actions .primary .action.share:active, -.data.table.wishlist + .actions .primary .action.share:hover, -.data.table.wishlist + .actions .primary .action.update:focus, -.data.table.wishlist + .actions .primary .action.update:active, -.data.table.wishlist + .actions .primary .action.update:hover, +.wrapper.table + .actions .primary .action.share:focus, +.wrapper.table + .actions .primary .action.share:active, +.wrapper.table + .actions .primary .action.share:hover, +.wrapper.table + .actions .primary .action.update:focus, +.wrapper.table + .actions .primary .action.update:active, +.wrapper.table + .actions .primary .action.update:hover, .recurring.order.details > .actions .primary .action:focus, .recurring.order.details > .actions .primary .action:active, .recurring.order.details > .actions .primary .action:hover, @@ -771,7 +790,7 @@ input[type="reset"], .data.comparison .cell.remove .action.delete, .sidebar .minilist.products.items .action.tocart, .find.orders .action.submit, -.form.send.friend .actions > .primary .action.add, +.form.send.friend .fieldset.recipients .actions .action.add, .paypal.review.view .actions .action.update, .shipping-tracking-popup .action.close, .action.mySecondary, @@ -785,7 +804,7 @@ input[type="reset"], .data.comparison .cell.remove .action.delete, .sidebar .minilist.products.items .action.tocart, .find.orders .action.submit, -.form.send.friend .actions > .primary .action.add, +.form.send.friend .fieldset.recipients .actions .action.add, .paypal.review.view .actions .action.update, .shipping-tracking-popup .action.close { background-color: #c2c2c2; @@ -827,9 +846,9 @@ input[type="reset"]:hover, .find.orders .action.submit:focus, .find.orders .action.submit:active, .find.orders .action.submit:hover, -.form.send.friend .actions > .primary .action.add:focus, -.form.send.friend .actions > .primary .action.add:active, -.form.send.friend .actions > .primary .action.add:hover, +.form.send.friend .fieldset.recipients .actions .action.add:focus, +.form.send.friend .fieldset.recipients .actions .action.add:active, +.form.send.friend .fieldset.recipients .actions .action.add:hover, .paypal.review.view .actions .action.update:focus, .paypal.review.view .actions .action.update:active, .paypal.review.view .actions .action.update:hover, @@ -938,13 +957,13 @@ input[type="reset"], .form.password.reset .action.add, .form.paypal.review .action.add, .form.send.confirmation .action.add, -.form.send.friend .actions > .primary .action.add, +.form.send.friend .fieldset.recipients .actions .action.add, .form.search.advanced .actions .action, .form.orders.search .actions .action, .form.contact .actions .action, .paypal.review.view .actions .action.update, -.data.table.wishlist + .actions .primary .action.share, -.data.table.wishlist + .actions .primary .action.update, +.wrapper.table + .actions .primary .action.share, +.wrapper.table + .actions .primary .action.update, .shipping-tracking-popup .action.close, .recurring.order.details > .actions .primary .action, .form.send.confirmation .action.send { @@ -1195,7 +1214,8 @@ input[type="tel"], input[type="url"], input[type="email"], input[type="datetime"], -input[type="password"] { +input[type="password"], +input[type="number"] { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; @@ -1218,7 +1238,8 @@ input[type="tel"]:focus, input[type="url"]:focus, input[type="email"]:focus, input[type="datetime"]:focus, -input[type="password"]:focus { +input[type="password"]:focus, +input[type="number"]:focus { border-color: #999999; } .control input[type="text"], @@ -1227,7 +1248,8 @@ input[type="password"]:focus { .control input[type="url"], .control input[type="email"], .control input[type="datetime"], -.control input[type="password"] { +.control input[type="password"], +.control input[type="number"] { width: 100%; } input[type="text"]:disabled, @@ -1236,7 +1258,8 @@ input[type="tel"]:disabled, input[type="url"]:disabled, input[type="email"]:disabled, input[type="datetime"]:disabled, -input[type="password"]:disabled { +input[type="password"]:disabled, +input[type="number"]:disabled { opacity: 0.5; } input[type="text"]::-webkit-input-placeholder, @@ -1245,7 +1268,8 @@ input[type="tel"]::-webkit-input-placeholder, input[type="url"]::-webkit-input-placeholder, input[type="email"]::-webkit-input-placeholder, input[type="datetime"]::-webkit-input-placeholder, -input[type="password"]::-webkit-input-placeholder { +input[type="password"]::-webkit-input-placeholder, +input[type="number"]::-webkit-input-placeholder { line-height: 1.333; } input[type="text"]:-ms-input-placeholder, @@ -1254,7 +1278,8 @@ input[type="tel"]:-ms-input-placeholder, input[type="url"]:-ms-input-placeholder, input[type="email"]:-ms-input-placeholder, input[type="datetime"]:-ms-input-placeholder, -input[type="password"]:-ms-input-placeholder { +input[type="password"]:-ms-input-placeholder, +input[type="number"]:-ms-input-placeholder { line-height: 1.333; } .eq-ie8 input[type="text"], @@ -1263,9 +1288,15 @@ input[type="password"]:-ms-input-placeholder { .eq-ie8 input[type="url"], .eq-ie8 input[type="email"], .eq-ie8 input[type="datetime"], -.eq-ie8 input[type="password"] { +.eq-ie8 input[type="password"], +.eq-ie8 input[type="number"] { padding-top: 8px; } +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} select { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -1329,7 +1360,8 @@ textarea:disabled { .fieldset input[type="url"].valid, .fieldset input[type="email"].valid, .fieldset input[type="datetime"].valid, -.fieldset input[type="password"].valid { +.fieldset input[type="password"].valid, +.fieldset input[type="number"].valid { border-color: #42b649 !important; } .fieldset textarea.mage-error, @@ -1340,7 +1372,8 @@ textarea:disabled { .fieldset input[type="url"].mage-error, .fieldset input[type="email"].mage-error, .fieldset input[type="datetime"].mage-error, -.fieldset input[type="password"].mage-error { +.fieldset input[type="password"].mage-error, +.fieldset input[type="number"].mage-error { border-color: #da370a !important; } .fieldset div.mage-error[generated] { @@ -4472,6 +4505,7 @@ body { border-radius: 0 0 5px 5px; overflow: hidden; z-index: 5; + display: none; } .block.search .search.autocomplete ul { padding: 0; @@ -4559,10 +4593,20 @@ body { font-weight: 200; font-size: 20px; } +.column.main .block > .title .qty.counter, +.sidebar .block > .title .qty.counter { + font-size: 16px; +} .column.main .block.filter .item, .sidebar .block.filter .item { margin-bottom: 10px; } +.qty.counter:before { + content: "("; +} +.qty.counter:after { + content: ")"; +} .sidebar .block > .title strong { font-size: 18px; } @@ -5222,10 +5266,6 @@ body { Magento_Checkout One page -------------------------------------- */ -.block.progress.onepage { - float: left; - width: 200px; -} .block.progress.onepage .content > dt { font-size: 16px; font-weight: 400; @@ -5273,10 +5313,6 @@ body { .order.details .block.order .payment.method .data.table td { padding: 5px; } -.opc.wrapper { - float: right; - width: 725px; -} .opc.wrapper > .opc { padding: 0; margin: 0; @@ -5720,8 +5756,6 @@ body { margin: 0; list-style-type: none; list-style-image: none; - float: left; - width: 200px; } .multicheckout.progress li { font-size: 16px; @@ -5731,19 +5765,6 @@ body { .multicheckout.progress li.active { font-weight: bold; } -.multicheckout.progress + .form.address.edit { - float: right; - width: 725px; -} -.multicheckout.form.address, -.multicheckout.form.billing, -.multicheckout.form.shipping, -.multicheckout.form.overview, -.multicheckout.success, -.multicheckout.change.billing { - float: right; - width: 725px; -} .multicheckout .title { *zoom: 1; margin: 0 0 30px; @@ -6012,11 +6033,6 @@ body { .multicheckout.form.address .control.address select { max-width: 450px; } -.checkout-multishipping-address-newshipping .form.address.edit, -.checkout-multishipping-address-editshipping .form.address.edit { - float: right; - width: 725px; -} .block.gift.message { margin: 30px 0 0; } @@ -7193,6 +7209,10 @@ body { text-align: center; padding: 0 4px; } +.action.showcart .qty:before, +.action.showcart .qty:after { + content: ""; +} .action.showcart .qty.empty { display: none; } @@ -7560,6 +7580,10 @@ span.widget.link { .data.comparison .cell.attribute { font-size: 12px; } +.data.comparison .cell.attribute img { + max-width: 100%; + height: auto; +} .data.comparison td:last-child { border-right: 1px solid #e5e5e5; } @@ -7899,11 +7923,15 @@ span.widget.link { .sidebar .minilist.products.items .item.product { margin: 0 0 20px; padding: 0; - position: relative; width: 100%; + position: relative; + z-index: 1; } .sidebar .minilist.products.items .item.product .product.actions { visibility: hidden; + -webkit-transition: visibility 0.01s ease-in-out 0.1s; + -moz-transition: visibility 0.01s ease-in-out 0.1s; + transition: visibility 0.01s ease-in-out 0.1s; } .sidebar .minilist.products.items .item.product:hover .product.actions { visibility: visible; @@ -7920,7 +7948,11 @@ span.widget.link { overflow: hidden; } .sidebar .minilist.products.items .actions { - bottom: 0; + /* */ + +} +.sidebar .minilist.products.items .primary { + bottom: -10px; left: 0; position: absolute; } @@ -7928,6 +7960,12 @@ span.widget.link { padding: 5px 11px; display: inline-block; } +.sidebar .minilist.products.items .secondary { + position: absolute; + left: 100%; + margin-left: -5px; + top: 0; +} .block.widget.photos { margin: 0 0 30px; } @@ -8430,6 +8468,10 @@ span.widget.link { margin-bottom: 20px; } .products.wrapper.grid .products.list .item.product { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; float: left; width: 16.666666666666664%; margin-right: 0%; @@ -9070,6 +9112,10 @@ span.widget.link { .product.attibute.sku .type:after { content: '#'; } +.product.attibute.description img { + max-width: 100%; + height: auto; +} @media only screen and (max-width: 99999px) { .product.data { float: left; @@ -10758,22 +10804,17 @@ img[align="right"] { padding-right: 20px; float: left; } -.form.send.friend .fieldset.recipients .fields .action.delete { +.form.send.friend .fieldset.recipients .action.delete { position: absolute; right: 0; top: 50%; } -.form.send.friend .actions > .primary { - float: right; - text-align: right; -} -.form.send.friend .actions > .primary .action.submit { - float: right; - margin-left: 10px; -} -.form.send.friend .actions > .primary .limit { +.form.send.friend .fieldset.recipients .actions { + width: 100%; margin: 0; - display: inline-block; +} +.form.send.friend .fieldset.recipients .actions .primary { + float: left; } .form.address.edit .field.company, .form.edit.account .field.password.current, @@ -11193,61 +11234,69 @@ img[align="right"] { .data.table.reviews .product.name { margin: 0; } +/* + Wishlist sidebar +-------------------------------------- */ +.block.wishlist .subtitle { + display: block; + font-weight: 600; + margin: 0 0 15px; +} /* My Account -> My Wishlist -------------------------------------- */ -.data.table.wishlist { +.wrapper.table .data.table.wishlist { margin-bottom: 15px; } -.data.table.wishlist thead th { +.wrapper.table .data.table.wishlist thead th { padding-top: 0; padding-bottom: 10px; text-align: left; font-weight: 400; font-size: 16px; } -.data.table.wishlist td, -.data.table.wishlist th { +.wrapper.table .data.table.wishlist td, +.wrapper.table .data.table.wishlist th { padding: 16px 10px 10px; vertical-align: top; } -.data.table.wishlist td:first-child, -.data.table.wishlist th:first-child { +.wrapper.table .data.table.wishlist td:first-child, +.wrapper.table .data.table.wishlist th:first-child { padding-left: 20px; } -.data.table.wishlist td:last-child, -.data.table.wishlist th:last-child { +.wrapper.table .data.table.wishlist td:last-child, +.wrapper.table .data.table.wishlist th:last-child { padding-right: 20px; } -.data.table.wishlist tbody tr:nth-child(even) { +.wrapper.table .data.table.wishlist tbody tr:nth-child(even) { background: #f8f8f8; } -.data.table.wishlist textarea { +.wrapper.table .data.table.wishlist textarea { width: 100%; } -.data.table.wishlist .box.tocart .qty { +.wrapper.table .data.table.wishlist .box.tocart .qty { width: 50px; } -.data.table.wishlist + .actions .primary { - margin-bottom: 15px; -} -.data.table.wishlist + .actions .primary .action.share, -.data.table.wishlist + .actions .primary .action.update { - padding: 5px 11px; -} -.data.table.wishlist + .actions .primary .action.update { - margin-left: 5px; -} -.data.table.wishlist .col.photo { +.wrapper.table .data.table.wishlist .col.photo { width: 100px; } -.data.table.wishlist .col.actions { +.wrapper.table .data.table.wishlist .col.actions { width: 200px; } -.data.table.wishlist .col.actions .price-excluding-tax, -.data.table.wishlist .col.actions .price-including-tax { +.wrapper.table .data.table.wishlist .col.actions .price-excluding-tax, +.wrapper.table .data.table.wishlist .col.actions .price-including-tax { display: block; } +.wrapper.table + .actions .primary { + margin-bottom: 15px; +} +.wrapper.table + .actions .primary .action.share, +.wrapper.table + .actions .primary .action.update { + padding: 5px 11px; +} +.wrapper.table + .actions .primary .action.update { + margin-left: 5px; +} /* Page -> Advanced Search -------------------------------------- */ @@ -11904,6 +11953,20 @@ img[align="right"] { } /* Smartphones (portrait) ----------- */ @media only screen and (max-width: 640px) { + .scrollTable .wrapper.table, + .sales-order-history .wrapper.table, + .review-customer-index .wrapper.table, + .sales-order-view .wrapper.table, + .sales-order-invoice .wrapper.table, + .sales-order-shipment .wrapper.table, + .sales-order-creditmemo .wrapper.table, + .checkout-onepage-index .order-review .wrapper.table, + .downloadable-customer-products .wrapper.table, + .form.wishlist.items .wrapper.table, + .block.dashboard.orders .wrapper.table, + .block.billing.agreements .wrapper.table { + overflow-x: auto; + } html { height: 100%; } @@ -12423,9 +12486,6 @@ img[align="right"] { float: none; margin-bottom: 30px; } - .footer .block.newsletter input[type="text"] { - height: 33px; - } .footer .links { width: 45%; margin: 0 5% 0 0; @@ -12549,6 +12609,7 @@ img[align="right"] { max-width: 100%; } .cart.main.actions { + text-align: center; *zoom: 1; } .cart.main.actions:before, @@ -12559,8 +12620,7 @@ img[align="right"] { .cart.main.actions:after { clear: both; } - .cart.main.actions .action.update, - .cart.main.actions .action.continue { + .cart.main.actions .action.update { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; @@ -12578,9 +12638,9 @@ img[align="right"] { border: none; background-color: #c2c2c2; color: #ffffff; + margin-top: 15px; } - .cart.main.actions .action.update span, - .cart.main.actions .action.continue span { + .cart.main.actions .action.update span { font-size: 18px; } .cart.main.actions .action.continue { @@ -12930,7 +12990,6 @@ img[align="right"] { font-size: 16px; } .opc.wrapper .order-review .review.table.wrapper { - overflow-x: scroll; margin-bottom: 10px; } .opc.wrapper .order-review .order.review.data th, @@ -13555,15 +13614,8 @@ img[align="right"] { width: 100%; margin-left: 0; } - .form.send.friend .actions > .primary { - float: none; - } - .form.send.friend .actions > .primary .action.submit { + .form.send.friend .fieldset.recipients .actions .primary { float: none; - margin-left: 0; - } - .form.send.friend .actions > .primary .action.add { - margin-top: 10px; } /* * Mage_Customer @@ -13576,38 +13628,77 @@ img[align="right"] { float: none; } .col2-left-layout.account .column.left { + border-top: 4px solid #e5e5e5; display: block; width: 100%; float: none; margin-top: 20px; + padding-top: 20px; } + .accountActions .primary, + .accountActions .secondary, .account .column.main .my-account .actions .primary, - .account .column.main .block .actions .primary, - .account .column.main .form .actions .primary, .account .column.main .my-account .actions .secondary, + .account .column.main .block .actions .primary, .account .column.main .block .actions .secondary, - .account .column.main .form .actions .secondary { + .account .column.main .form .actions .primary, + .account .column.main .form .actions .secondary, + .account .column.main > .actions .primary, + .account .column.main > .actions .secondary { float: none; } + .accountActions .primary .action, + .account .column.main .my-account .actions .primary .action, + .account .column.main .block .actions .primary .action, + .account .column.main .form .actions .primary .action, + .account .column.main > .actions .primary .action { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + display: block; + margin: 0 auto 15px; + padding: 10px; + width: 100%; + max-width: 100%; + line-height: 1; + float: none; + text-align: center; + text-decoration: none; + text-transform: uppercase; + border: none; + background-color: #da370a; + color: #ffffff; + } + .accountActions .primary .action span, + .account .column.main .my-account .actions .primary .action span, + .account .column.main .block .actions .primary .action span, + .account .column.main .form .actions .primary .action span, + .account .column.main > .actions .primary .action span { + font-size: 18px; + } + .accountActions .secondary, .account .column.main .my-account .actions .secondary, .account .column.main .block .actions .secondary, - .account .column.main .form .actions .secondary { + .account .column.main .form .actions .secondary, + .account .column.main > .actions .secondary { margin-bottom: 15px; } + .accountActions .secondary .action.back, .account .column.main .my-account .actions .secondary .action.back, .account .column.main .block .actions .secondary .action.back, - .account .column.main .form .actions .secondary .action.back { + .account .column.main .form .actions .secondary .action.back, + .account .column.main > .actions .secondary .action.back { display: block; float: none; - text-align: left; + text-align: center; } .account > .block, .account .my-account > .block { margin-bottom: 20px; } .billing-agreements > .actions, - .recurring-profiles .buttons-set, - .newsletter.manage > .actions { + .recurring-profiles .buttons-set { text-align: center; margin-bottom: 20px; } @@ -13666,9 +13757,6 @@ img[align="right"] { .block.dashboard .recent.orders .col.shipping { display: none; } - .block.dashboard.orders { - overflow-x: scroll; - } .block.dashboard:not(.welcome):not(.orders) .content { padding: 20px; margin: 0 -20px; @@ -13711,7 +13799,26 @@ img[align="right"] { width: 100%; } .form.newsletter .action.save { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + display: block; + margin: 0 auto 15px; + padding: 10px; width: 100%; + max-width: 100%; + line-height: 1; + float: none; + text-align: center; + text-decoration: none; + text-transform: uppercase; + border: none; + background-color: #da370a; + color: #ffffff; + } + .form.newsletter .action.save span { + font-size: 18px; } .account .column.main .tags.items.cloud .item { font-size: 18px; @@ -13736,59 +13843,22 @@ img[align="right"] { padding-top: 7px; padding-bottom: 6px; } - /* - My Account -> Downloadable products - -------------------------------------- */ - .downloadable-customer-products .column.main { - overflow-x: scroll; - } - /* - My Account -> My Reviews - -------------------------------------- */ - .review-customer-index .column.main { - overflow-x: scroll; - } /* My Account -> Wishlist -------------------------------------- */ - .account .form.wishlist.items .wishlist.table.wrapper { - overflow-x: scroll; + .account .form.wishlist.items .data.table.wishlist { + margin-bottom: 0; } - .account .form.wishlist.items .wishlist.table.wrapper thead { + .account .form.wishlist.items .data.table.wishlist thead { display: none; } - .account .form.wishlist.items .wishlist.table.wrapper textarea { + .account .form.wishlist.items .data.table.wishlist textarea { width: 15em; } - .account .form.wishlist.items .actions .primary .action { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; - display: block; - margin: 0 auto 15px; - padding: 10px; - width: 100%; - max-width: 100%; - line-height: 1; - float: none; - text-align: center; - text-decoration: none; - text-transform: uppercase; - border: none; - background-color: #da370a; - color: #ffffff; - } - .account .form.wishlist.items .actions .primary .action span { - font-size: 18px; - } /* * My Account -> My orders * ----------------------------------------------------------------------------- */ - .sales-order-history .column.main { - overflow-x: scroll; - } .order.details .order.toolbar { clear: both; float: none; @@ -13842,8 +13912,11 @@ img[align="right"] { .order.details > .actions { margin-bottom: 20px; } - .order.details.items { - overflow-x: scroll; + .order.details .wrapper.table { + margin-bottom: 45px; + } + .order.details .wrapper.table .data.table.order { + margin-bottom: 0; } .widget.static.block { margin-bottom: 15px; @@ -13907,20 +13980,20 @@ img[align="right"] { .product.photo .notice { display: none; } - .product.info.main .page.title.product { + .product.info.additional .page.title.product { margin-bottom: 10px; } + .product.info.additional .stock { + margin: 15px 0; + } + .product.info.main.responsive .page.title, + .product.info.main.responsive .stock:not(.alert) { + display: none; + } .product.info.main .price-box { border: none !important; margin: 0; } - .product.info.main .stock { - clear: right; - float: right; - } - .product.info.main .stock.alert { - float: none; - } .product.info.main .prices.tier { clear: both; } @@ -14021,6 +14094,20 @@ img[align="right"] { width: 100%; clear: both; } + .catalog-product-view .column.main { + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + } + .catalog-product-view .column.main .product.info.additional, + .catalog-product-view .column.main .product.media { + -webkit-order: -1; + -ms-flex-order: -1; + order: -1; + } .product.media .img.photo.container { height: auto !important; width: auto !important; @@ -14282,7 +14369,8 @@ img[align="right"] { margin: 0 0 10px; } input[type="password"], - input[type="text"] { + input[type="text"], + input[type="number"] { font-size: 18px; } .fieldset > .field > .label { @@ -14517,8 +14605,7 @@ img[align="right"] { font-size: 18px; } /* - Magento_Catalog - Compare + Magento_Catalog Compare -------------------------------------- */ .catalog-product-compare-index .action.print { margin: -20px 0 20px; diff --git a/app/design/frontend/magento_plushe/i18n/en_US.csv b/app/design/frontend/magento_plushe/i18n/en_US.csv new file mode 100644 index 00000000000..062b8524da1 --- /dev/null +++ b/app/design/frontend/magento_plushe/i18n/en_US.csv @@ -0,0 +1,4 @@ +"%1 items","%1" +"1 item","1" +"My Cart (1 item)","My Cart (1)" +"My Cart (%1 items)","My Cart (%1)" diff --git a/app/design/frontend/magento_plushe/js/matchMedia.js b/app/design/frontend/magento_plushe/js/matchMedia.js index 68ee4e2b813..8960bf12efa 100644 --- a/app/design/frontend/magento_plushe/js/matchMedia.js +++ b/app/design/frontend/magento_plushe/js/matchMedia.js @@ -58,19 +58,19 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) { /*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */ (function(){ // monkeypatch unsupported addListener/removeListener with polling - if( !window.matchMedia( "" ).addListener ){ + if( !window.matchMedia( "all" ).addListener ){ var oldMM = window.matchMedia; - + window.matchMedia = function( q ){ var ret = oldMM( q ), listeners = [], - last = false, + last = ret.matches, timer, check = function(){ var list = oldMM( q ), unmatchToMatch = list.matches && !last, matchToUnmatch = !list.matches && last; - + //fire callbacks only if transitioning to or from matched state if( unmatchToMatch || matchToUnmatch ){ for( var i =0, il = listeners.length; i< il; i++ ){ @@ -97,7 +97,7 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) { clearInterval( timer ); } }; - + return ret; }; } @@ -105,7 +105,7 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) { var mediaCheck = function( options ) { var mq, - matchMedia = (window.matchMedia !== undefined & window.matchMedia('').addListener !== undefined); + matchMedia = (window.matchMedia !== undefined & window.matchMedia("all").addListener !== undefined); mqChange = function( mq, options ) { if ( mq.matches ) { diff --git a/app/design/frontend/magento_plushe/js/navigation-menu.js b/app/design/frontend/magento_plushe/js/navigation-menu.js index 20856c3df59..fa8f9b08040 100644 --- a/app/design/frontend/magento_plushe/js/navigation-menu.js +++ b/app/design/frontend/magento_plushe/js/navigation-menu.js @@ -33,7 +33,7 @@ topLevelHoverClass: 'hover', expandedTopLevel: '.more', hoverInTimeout: 300, - hoverOutTimeout: 2000, + hoverOutTimeout: 500, submenuAnimationSpeed: 200, collapsable: true, collapsableDropdownTemplate: diff --git a/app/design/frontend/magento_plushe/js/responsive.js b/app/design/frontend/magento_plushe/js/responsive.js index a85048b0ce3..c216bd60f99 100644 --- a/app/design/frontend/magento_plushe/js/responsive.js +++ b/app/design/frontend/magento_plushe/js/responsive.js @@ -55,12 +55,55 @@ $('#checkout-progress-wrapper .content').toggle(); }); + (function() { + var productInfoMain = $('.product.info.main'), + productInfoAdditional = $("#product-info-additional"); + + if(!productInfoAdditional.length) { + + var productTitle = productInfoMain.find(".page.title.product").clone(), + productStock = productInfoMain.find(".stock:not(.alert)").clone(); + + productInfoAdditional = $("<div/>", { + id: "product-info-additional", + addClass: "product info additional" + }); + + $('.catalog-product-view .column.main') + .prepend(productInfoAdditional); + + productInfoAdditional + .append(productTitle) + .append(productStock); + + } else { + productInfoAdditional.removeClass("hidden"); + } + + productInfoMain.addClass("responsive"); + + })(); + + }, // Switch to Desktop Version exit: function() { // minicart $('.action.showcart').removeClass('is-disabled'); + + (function() { + + var productInfoMain = $('.product.info.main'), + productInfoAdditional = $("#product-info-additional"); + + if(productInfoAdditional.length) { + productInfoAdditional.addClass("hidden"); + productInfoMain.removeClass("responsive"); + } + + })(); + } }); }); diff --git a/app/design/frontend/magento_plushe/less/lib/forms.less b/app/design/frontend/magento_plushe/less/lib/forms.less index 18723a86f7b..76db35196a8 100644 --- a/app/design/frontend/magento_plushe/less/lib/forms.less +++ b/app/design/frontend/magento_plushe/less/lib/forms.less @@ -461,7 +461,8 @@ input[type="tel"], input[type="url"], input[type="email"], input[type="datetime"], -input[type="password"] { +input[type="password"], +input[type="number"] { .inputText(); } @@ -474,6 +475,12 @@ input[type="reset"] { &:extend(.secondary.action all); } +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} + select { .controlStyling(); padding: 5px 10px 4px; @@ -539,7 +546,8 @@ textarea { input[type="url"].valid, input[type="email"].valid, input[type="datetime"].valid, - input[type="password"].valid { + input[type="password"].valid, + input[type="number"].valid { border-color: @validHilight !important; } // Validation error @@ -551,7 +559,8 @@ textarea { input[type="url"].mage-error, input[type="email"].mage-error, input[type="datetime"].mage-error, - input[type="password"].mage-error { + input[type="password"].mage-error, + input[type="number"].mage-error { border-color: @nonValidHilight !important; } div.mage-error[generated] { diff --git a/app/design/frontend/magento_plushe/less/lib/icons.less b/app/design/frontend/magento_plushe/less/lib/icons.less index 6fde9816210..e0777cffb0a 100644 --- a/app/design/frontend/magento_plushe/less/lib/icons.less +++ b/app/design/frontend/magento_plushe/less/lib/icons.less @@ -203,3 +203,21 @@ margin: 0; } } + +.iconShowText() { + text-indent: 0; + line-height:inherit; + height:inherit; +} + +.iconRemove(@position: 'after') when (@position = 'after') { + &:after { + display: none; + } +} + +.iconRemove(@position: 'after') when (@position = 'before') { + &:before { + display: none; + } +} diff --git a/app/design/frontend/magento_plushe/less/lib/snippets.less b/app/design/frontend/magento_plushe/less/lib/snippets.less index 65ff1c139ac..354f4c8910c 100644 --- a/app/design/frontend/magento_plushe/less/lib/snippets.less +++ b/app/design/frontend/magento_plushe/less/lib/snippets.less @@ -139,4 +139,8 @@ .box-sizing(); background: @primary1; padding: 30px; -} \ No newline at end of file +} + +.visuallyHidden { + .visually-hidden() +} diff --git a/app/design/frontend/magento_plushe/less/responsive/responsive.less b/app/design/frontend/magento_plushe/less/responsive/responsive.less index 71a7681111f..d6c5bfa2321 100644 --- a/app/design/frontend/magento_plushe/less/responsive/responsive.less +++ b/app/design/frontend/magento_plushe/less/responsive/responsive.less @@ -120,6 +120,12 @@ /* Smartphones (portrait) ----------- */ @media only screen and (max-width : @breakPoint1) { + .scrollTable { + .wrapper.table { + overflow-x: auto; + } + } + html { height: 100%; } @@ -544,9 +550,6 @@ and (max-width : @breakPoint1) { width: 100%; float: none; margin-bottom: 30px; - input[type="text"] { - height: 33px; - } } .links { width: 45%; @@ -670,11 +673,12 @@ and (max-width : @breakPoint1) { .cart { // Main actions &.main.actions { + text-align: center; .clearfix(); .action { - &.update, - &.continue { + &.update { .mobileSecondaryAction(); + margin-top: 15px; } &.continue { position: relative; @@ -1079,7 +1083,6 @@ and (max-width : @breakPoint1) { .order-review { font-size: 16px; .review.table.wrapper { - overflow-x: scroll; margin-bottom: 10px; } .order.review.data { @@ -1526,14 +1529,9 @@ Multishipping } .form.send.friend { - .actions > .primary { - .action.submit { - float: none; - margin-left: 0; - } - float: none; - .action.add { - margin-top: 10px; + .fieldset.recipients { + .actions .primary { + float: none; } } } @@ -1550,10 +1548,46 @@ Multishipping float: none; } .column.left { + border-top: 4px solid @primary2; display: block; width: 100%; float: none; margin-top: 20px; + padding-top: 20px; + } + } + + .sales-order-history, + .review-customer-index, + .sales-order-view, + .sales-order-invoice, + .sales-order-shipment, + .sales-order-creditmemo, + .checkout-onepage-index .order-review, + .downloadable-customer-products, + .form.wishlist.items, + .block.dashboard.orders, + .block.billing.agreements { + &:extend(.scrollTable all); + } + + .accountActions { + .primary, + .secondary { + float: none; + } + .primary { + .action { + .mobilePrimaryAction(); + } + } + .secondary { + margin-bottom: 15px; + .action.back { + display: block; + float: none; + text-align: center; + } } } @@ -1563,20 +1597,12 @@ Multishipping .block, .form { .actions { - .primary, - .secondary { - float: none; - } - .secondary { - margin-bottom: 15px; - .action.back { - display: block; - float: none; - text-align: left; - } - } + &:extend(.accountActions all); } } + > .actions { + &:extend(.accountActions all); + } } > .block, .my-account > .block { @@ -1585,8 +1611,7 @@ Multishipping } .billing-agreements > .actions, - .recurring-profiles .buttons-set, - .newsletter.manage > .actions { + .recurring-profiles .buttons-set { text-align: center; margin-bottom: 20px; } @@ -1640,9 +1665,6 @@ Multishipping display: none; } } - &.orders { - overflow-x: scroll; - } } .block.dashboard:not(.welcome):not(.orders) { @@ -1694,7 +1716,7 @@ Multishipping .form.newsletter { .action.save { - width: 100%; + .mobilePrimaryAction(); } } @@ -1721,31 +1743,15 @@ Multishipping } } } - /* - My Account -> Downloadable products - -------------------------------------- */ - .downloadable-customer-products { - .column.main { - overflow-x: scroll; - } - } - /* - My Account -> My Reviews - -------------------------------------- */ - .review-customer-index { - .column.main { - overflow-x: scroll; - } - } /* My Account -> Wishlist -------------------------------------- */ .account { .form.wishlist.items { - .wishlist.table.wrapper { - overflow-x: scroll; + .data.table.wishlist { + margin-bottom: 0; thead { display: none; } @@ -1753,13 +1759,6 @@ Multishipping width: 15em; } } - .actions { - .primary { - .action { - .mobilePrimaryAction(); - } - } - } } } @@ -1767,11 +1766,7 @@ Multishipping * My Account -> My orders * ----------------------------------------------------------------------------- */ - .sales-order-history { - .column.main { - overflow-x: scroll; - } - } + .order.details { .order.toolbar { @@ -1832,8 +1827,11 @@ Multishipping > .actions { margin-bottom: 20px; } - &.items { - overflow-x: scroll; + .wrapper.table { + margin-bottom: 45px; + .data.table.order { + margin-bottom: 0; + } } } @@ -1913,21 +1911,26 @@ Multishipping display: none; } - .product.info.main { + .product.info.additional { .page.title.product { margin-bottom: 10px; } + .stock { + margin: 15px 0; + } + } + + .product.info.main { + &.responsive { + .page.title, + .stock:not(.alert) { + display: none; + } + } .price-box { border: none !important; margin: 0; } - .stock { - clear: right; - float: right; - &.alert { - float: none; - } - } .prices.tier { clear: both; } @@ -2006,6 +2009,21 @@ Multishipping } } + .catalog-product-view .column.main { + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + .product.info.additional, + .product.media { + -webkit-order: -1; + -ms-flex-order: -1; + order: -1; + } + } + .product.media { .img.photo.container { height: auto !important; @@ -2235,7 +2253,8 @@ Multishipping } input[type="password"], - input[type="text"] { + input[type="text"], + input[type="number"] { font-size: 18px; } diff --git a/app/design/frontend/magento_plushe/less/styles.less b/app/design/frontend/magento_plushe/less/styles.less index 50038db2cb4..5ff2d454130 100644 --- a/app/design/frontend/magento_plushe/less/styles.less +++ b/app/design/frontend/magento_plushe/less/styles.less @@ -276,6 +276,7 @@ body { border-radius: 0 0 5px 5px; overflow: hidden; z-index: 5; + display: none; ul { .resetList(); li { @@ -361,6 +362,9 @@ body { font-weight: @baseFontWeightLighter; font-size: 20px; } + .qty.counter { + font-size: 16px; + } } &.filter { .item { @@ -369,6 +373,15 @@ body { } } +.qty.counter { + &:before { + content: "("; + } + &:after { + content: ")"; + } +} + .sidebar .block > .title strong { font-size: 18px; } @@ -830,8 +843,6 @@ body { One page -------------------------------------- */ .block.progress.onepage { - float: left; - width: 200px; .content > dt { font-size: @baseFontSizeBigger; font-weight: @baseFontWeight; @@ -883,8 +894,6 @@ body { .opc.wrapper { - float: right; - width: 725px; > .opc { .resetList(); .section { @@ -1276,8 +1285,6 @@ body { .multicheckout { &.progress { .resetList(); - float: left; - width: 200px; li { font-size: 16px; font-weight: 400; @@ -1286,19 +1293,6 @@ body { font-weight: bold; } } - + .form.address.edit { - float: right; - width: 725px; - } - } - &.form.address, - &.form.billing, - &.form.shipping, - &.form.overview, - &.success, - &.change.billing { - float: right; - width: 725px; } .title { .clearfix(); @@ -1581,14 +1575,6 @@ body { } } -.checkout-multishipping-address-newshipping, -.checkout-multishipping-address-editshipping { - .form.address.edit { - float: right; - width: 725px; - } -} - .block.gift.message { margin: 30px 0 0; .title { @@ -2629,6 +2615,10 @@ body { min-height: @height; text-align: center; padding: 0 4px; + &:before, + &:after { + content: ""; + } } .qty.empty { display: none; @@ -2970,6 +2960,10 @@ span.widget.link { } .cell.attribute { font-size: @baseFontSizeMiddle; + img { + max-width: 100%; + height: auto; + } } td:last-child { border-right: 1px solid @primary2; @@ -3264,12 +3258,15 @@ span.widget.link { width: 100%; .product.actions { visibility: hidden; + .transition( visibility .01s ease-in-out 0.1s ); } &:hover { .product.actions { visibility: visible; } } + position: relative; + z-index: 1; } .product.details { overflow: hidden; @@ -3283,7 +3280,10 @@ span.widget.link { overflow: hidden; } .actions { - bottom: 0; +/* */ + } + .primary { + bottom: -10px; left: 0; position: absolute; } @@ -3292,6 +3292,12 @@ span.widget.link { padding: 5px 11px; display: inline-block; } + .secondary { + position: absolute; + left:100%; + margin-left: -5px; + top:0; + } } // Images only template @@ -3723,6 +3729,7 @@ span.widget.link { .products.wrapper.grid .products.list { .item.product { + .box-sizing(); @total-columns: 10; .column(2); display: inline-block; @@ -4110,6 +4117,13 @@ span.widget.link { } } +.product.attibute.description { + img { + max-width: 100%; + height: auto; + } +} + @media only screen and (max-width : 99999px) { .product.data { @@ -4733,26 +4747,21 @@ img[align="right"] { padding-right: 20px; float: left; } - .action.delete { - position: absolute; - right: 0; - top: 50%; - } - } - } - .actions > .primary { - .action.submit { - float: right; - margin-left: 10px; } - float: right; - text-align: right; - .action.add { - &:extend(.secondary.action all); + .action.delete { + position: absolute; + right: 0; + top: 50%; } - .limit { + .actions { + width: 100%; margin: 0; - display: inline-block; + .action.add { + &:extend(.secondary.action all); + } + .primary { + float: left; + } } } } @@ -5161,51 +5170,74 @@ img[align="right"] { } } +/* + Wishlist sidebar +-------------------------------------- */ +.block.wishlist { + .subtitle { + display: block; + font-weight: 600; + margin: 0 0 15px; + } +} + /* My Account -> My Wishlist -------------------------------------- */ -.data.table.wishlist { - @optionsBg: rgba(0, 0, 0, .8); - @optionsColor: #fff; +.wrapper.table { + .data.table.wishlist { + @optionsBg: rgba(0, 0, 0, .8); + @optionsColor: #fff; - margin-bottom: 15px; + margin-bottom: 15px; - thead th { - padding-top: 0; - padding-bottom: 10px; - text-align: left; - font-weight: @baseFontWeight; - font-size: @baseFontSizeBigger; - } + thead th { + padding-top: 0; + padding-bottom: 10px; + text-align: left; + font-weight: @baseFontWeight; + font-size: @baseFontSizeBigger; + } - td, - th { - padding: 16px 10px 10px; - vertical-align: top; - } + td, + th { + padding: 16px 10px 10px; + vertical-align: top; + } - td:first-child, - th:first-child { - padding-left: 20px; - } + td:first-child, + th:first-child { + padding-left: 20px; + } - td:last-child, - th:last-child { - padding-right: 20px; - } + td:last-child, + th:last-child { + padding-right: 20px; + } - tbody tr:nth-child(even) { - background: @primary1; - } + tbody tr:nth-child(even) { + background: @primary1; + } - textarea { - width: 100%; - } + textarea { + width: 100%; + } - .box.tocart .qty { - width: 50px; - } + .box.tocart .qty { + width: 50px; + } + .col.photo { + width: 100px; + } + .col.actions { + width: 200px; + .price-excluding-tax, + .price-including-tax { + display: block; + } + } + } & + .actions { .primary { margin-bottom: 15px; @@ -5219,19 +5251,7 @@ img[align="right"] { } } } - - .col.photo { - width: 100px; - } - .col.actions { - width: 200px; - .price-excluding-tax, - .price-including-tax { - display: block; - } - } } - /* Page -> Advanced Search -------------------------------------- */ @@ -5801,4 +5821,4 @@ img[align="right"] { } } -@import "/responsive/responsive.less"; +@import "responsive/responsive.less"; diff --git a/dev/shell/cron.sh b/dev/shell/cron.sh index fc0c4480995..66f43721dcf 100755 --- a/dev/shell/cron.sh +++ b/dev/shell/cron.sh @@ -3,13 +3,13 @@ if [ ! "$1" = "" ] ; then CRONSCRIPT=$1 else -CRONSCRIPT=../../pub/cron.php +CRONSCRIPT=pub/cron.php fi PHP_BIN=`which php` # absolute path to magento installation -INSTALLDIR=`echo $0 | sed 's/cron\.sh//g'`"../" +INSTALLDIR=`echo $0 | sed 's/cron\.sh//g'`"../../" # prepend the intallation path if not given an absolute path if [ "$INSTALLDIR" != "" -a "`expr index $CRONSCRIPT /`" != "1" ];then diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php index 06722a03bd1..b06248e2abf 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php @@ -129,6 +129,7 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase public function xmlConfigFileProvider() { $fileList = $this->getXmlConfigFiles(); + $result = array(); foreach ($fileList as $fileContent) { $result[] = array($fileContent); } @@ -146,7 +147,7 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase $directory = $objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::MODULES); return $objectManager->get('\Magento\Config\FileIteratorFactory')->create( $directory, - $directory->search($this->_getConfigFilePathRegex()) + $directory->search($this->_getConfigFilePathGlob()) ); } @@ -164,7 +165,7 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase * * @return string */ - protected abstract function _getConfigFilePathRegex(); + protected abstract function _getConfigFilePathGlob(); /** * Returns a path to the per file XSD file, relative to the modules directory. diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/StoreTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/StoreTest.php index cad3f014200..8e4daa006b8 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/StoreTest.php @@ -43,4 +43,31 @@ class StoreTest extends \Magento\Backend\Utility\Controller $this->assertSelectCount('#add_group.disabled', 0, $response); $this->assertSelectCount('#add_store.disabled', 0, $response); } + + public function testSaveActionWithExistCode() + { + /** @var $formKey \Magento\Data\Form\FormKey */ + $formKey = $this->_objectManager->get('Magento\Data\Form\FormKey'); + $post = array( + 'form_key' => $formKey->getFormKey(), + 'website' => array( + 'name' => 'base', + 'code' => 'base', + 'sort_order' => '', + 'is_default' => '', + 'website_id' => '', + ), + 'store_type' => 'website', + 'store_action' => 'add' + ); + $this->getRequest()->setServer(array('REQUEST_METHOD' => 'POST')); + $this->getRequest()->setPost($post); + $this->dispatch('backend/admin/system_store/save'); + //Check that errors was generated and set to session + $this->assertSessionMessages( + $this->contains("Website with the same code already exists."), + \Magento\Message\MessageInterface::TYPE_ERROR, + 'Magento\Message\ManagerInterface' + ); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php index ec0fbae625c..d07e8af35e9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php @@ -149,4 +149,26 @@ class ProductTest extends \Magento\Backend\Utility\Controller $this->assertSelectCount('#save-split-button-duplicate-button', 1, $body, '"Save & Duplicate" button isn\'t present on Edit Product page'); } + + /** + * Assure that no DDL operations, like table truncation, are executed in transaction during search results reset. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + */ + public function testMassStatusAction() + { + $this->dispatch( + '/backend/catalog/product/massStatus/store/0/?product=1&massaction_prepare_key=product&status=0' + ); + /** @var $objectManager \Magento\TestFramework\ObjectManager */ + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $processCollection \Magento\Index\Model\Resource\Process\Collection */ + $processCollection = $objectManager->get('Magento\Index\Model\Resource\Process\Collection'); + $processCollection = $processCollection->addEventsStats()->addFilter('indexer_code', 'catalogsearch_fulltext'); + $process = $processCollection->getLastItem(); + /** @var $eventCollection \Magento\Index\Model\Resource\Event\Collection */ + $eventCollection = $objectManager->get('Magento\Index\Model\Resource\Event\Collection'); + $eventCollection->addProcessFilter($process); + $this->assertNull($eventCollection->getLastItem()->getData('process_event_status')); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php index 141461b1ac6..d46090ecb2c 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php @@ -35,11 +35,14 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController public function testAddAction() { $this->_requireVisitorWithNoProducts(); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Data\Form\FormKey $formKey */ + $formKey = $objectManager->get('Magento\Data\Form\FormKey'); - $this->dispatch('catalog/product_compare/add/product/1?nocookie=1'); + $this->dispatch('catalog/product_compare/add/product/1/form_key/' . $formKey->getFormKey() . '?nocookie=1'); /** @var $messageManager \Magento\Message\Manager */ - $messageManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Message\Manager'); + $messageManager = $objectManager->get('Magento\Message\Manager'); $this->assertInstanceOf('Magento\Message\Success', $messageManager->getMessages()->getLastAddedMessage()); $this->assertContains('Simple Product 1 Name', (string)$messageManager->getMessages()->getLastAddedMessage()->getText()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php index 93e876159f1..ea2a717c36a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php @@ -127,28 +127,36 @@ class MediaTest extends \PHPUnit_Framework_TestCase */ public function testBeforeSave() { + $fileName = 'magento_image.jpg'; + $fileLabel = 'Magento image'; /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); $product->setData('media_gallery', array('images' => array( - 'image' => array('file' => 'magento_image.jpg'), + 'image' => array( + 'file' => $fileName, + 'label' => $fileLabel, + ), ))); - + $product->setData('image', $fileName); $this->_model->beforeSave($product); $this->assertStringStartsWith('./magento_image', $product->getData('media_gallery/images/image/new_file')); + $this->assertEquals($fileLabel, $product->getData('image_label')); $product->setIsDuplicate(true); $product->setData('media_gallery', array('images' => array( - 'image' => array( - 'value_id' => '100', - 'file' => 'magento_image.jpg' - ) + 'image' => array( + 'value_id' => '100', + 'file' => $fileName, + 'label' => $fileLabel, + ), ))); $this->_model->beforeSave($product); $this->assertStringStartsWith('./magento_image', $product->getData('media_gallery/duplicate/100')); + $this->assertEquals($fileLabel, $product->getData('image_label')); /* affect of beforeSave */ - $this->assertNotEquals('magento_image.jpg', $this->_model->getRenamedImage('magento_image.jpg')); + $this->assertNotEquals($fileName, $this->_model->getRenamedImage($fileName)); $this->assertEquals('test.jpg', $this->_model->getRenamedImage('test.jpg')); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Category/FlatTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Category/FlatTest.php new file mode 100644 index 00000000000..e7bdd53de92 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Category/FlatTest.php @@ -0,0 +1,64 @@ +<?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) 2013 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\Model\Resource\Category; + +class FlatTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Resource\Category\Flat + */ + protected $model; + + /** + * @var \Magento\TestFramework\ObjectManager + */ + protected $objectManager; + + protected function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->model = $this->objectManager->create('Magento\Catalog\Model\Resource\Category\Flat'); + } + + /** + * @magentoConfigFixture current_store catalog/frontend/flat_catalog_category 1 + */ + public function testGetParentDesignCategory() + { + $category = $this->objectManager->create('Magento\Catalog\Model\Category'); + $category->setId(3) + ->setName('Category 1') + ->setParentId(2) + ->setPath('1/2/3') + ->setLevel(2) + ->setAvailableSortBy('name') + ->setDefaultSortBy('name') + ->setIsActive(true) + ->setPosition(1) + ->save(); + $designCategory = $this->model->getParentDesignCategory($category); + $this->assertInstanceOf('\Magento\Catalog\Model\Category', $designCategory, 'Invalid type for category'); + $this->assertContains($designCategory->getId(), array(1, 2, 3), 'Incorrect data for parent design category'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php index d3d8adf92c1..c4f2f4ddfeb 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php @@ -230,11 +230,4 @@ class UrlTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($result, $this->_model->generatePath($type, $product, $category, $parentPath)); } - - public function testGenerateUniqueIdPath() - { - $path = $this->_model->generateUniqueIdPath(); - $this->assertNotEmpty($path); - $this->assertContains('_', $path); - } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php index 9581464cae3..459820b6483 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php @@ -128,6 +128,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase $cacheId = 'design_change_' . md5($storeId . $date); + /** @var \Magento\Core\Model\Design $design */ $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Design'); $design->loadChange($storeId, $date); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php index 3a2482b1846..57fe2b4d918 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php @@ -202,10 +202,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase { return array( array('::no_scope.ext'), - array('./file.ext'), array('../file.ext'), - array('dir/./file.ext'), - array('dir/../file.ext'), ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 369d5b286a0..1b81624d3f6 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -303,7 +303,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller * Check that error message is set */ $this->assertSessionMessages( - $this->equalTo(array('Customer with the same email already exists.')), + $this->equalTo(array('Customer with the same email already exists in associated website.')), \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertEquals($post, \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php index 841c9c2d62e..d8419a2b582 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php @@ -115,8 +115,8 @@ class ReadTest extends \PHPUnit_Framework_TestCase public function searchProvider() { return array( - array('foo', '/bar/', array('bar/baz/file_one.txt', 'bar/file_two.txt')), - array('foo', '/\.txt/', array('bar/baz/file_one.txt', 'bar/file_two.txt', 'file_three.txt')), + array('foo', 'bar/*', array('bar/file_two.txt', 'bar/baz')), + array('foo', '/*/*.txt', array('bar/file_two.txt')), array('foo', '/notfound/', array()) ); } diff --git a/app/code/Magento/Wishlist/Block/Render/Item/Price.php b/dev/tests/integration/testsuite/Magento/GoogleShopping/Controller/Adminhtml/GoogleShopping/TypesTest.php similarity index 51% rename from app/code/Magento/Wishlist/Block/Render/Item/Price.php rename to dev/tests/integration/testsuite/Magento/GoogleShopping/Controller/Adminhtml/GoogleShopping/TypesTest.php index 44d494bff43..d28fc6ebc92 100644 --- a/app/code/Magento/Wishlist/Block/Render/Item/Price.php +++ b/dev/tests/integration/testsuite/Magento/GoogleShopping/Controller/Adminhtml/GoogleShopping/TypesTest.php @@ -19,41 +19,23 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Wishlist + * @package Magento_GoogleShopping + * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\GoogleShopping\Controller\Adminhtml\GoogleShopping; + /** - * Wishlist block for rendering price of item with product - * - * @category Magento - * @package Magento_Wishlist - * @author Magento Core Team <core@magentocommerce.com> + * @magentoAppArea adminhtml */ -namespace Magento\Wishlist\Block\Render\Item; - -class Price extends \Magento\View\Element\Template +class TypesTest extends \Magento\Backend\Utility\Controller { - /** - * Returns html for rendering non-configured product - */ - public function getCleanProductPriceHtml() + public function testIndexAction() { - $renderer = $this->getCleanRenderer(); - if (!$renderer) { - return ''; - } - - $product = $this->getProduct(); - if ($product->canConfigure()) { - $product = clone $product; - $product->setCustomOptions(array()); - } - - return $renderer->setProduct($product) - ->setDisplayMinimalPrice($this->getDisplayMinimalPrice()) - ->setIdSuffix($this->getIdSuffix()) - ->toHtml(); + $this->dispatch('backend/admin/googleshopping_types/index/'); + $body = $this->getResponse()->getBody(); + $this->assertSelectCount('[data-role="row"]', 1, $body, 'Grid with row exists'); } } diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php index 6b728079bc0..74f1028b59c 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php @@ -192,15 +192,37 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $configFile = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/etc/local.xml'; copy($configFile, self::$_tmpConfigFile); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** + * @var $cache \Magento\App\Cache + */ + $cache = $objectManager->create('Magento\App\Cache'); + /** + * @var $appState \Magento\App\State + */ + $appState = $objectManager->get('Magento\App\State'); + + $cache->save('testValue', 'testName'); + $this->assertEquals('testValue', $cache->load('testName')); + + //to test it works - set state to uninstalled + $appState->setInstallDate(null); + $this->assertFalse($appState->isInstalled()); + $this->_getModel(true)->finish(); + $this->assertFalse($cache->load('testName'), 'Cache was not cleaned'); + $this->assertTrue( + $appState->isInstalled(), + 'In-memory application installation state was not changed right after finishing installation phase' + ); + /** @var $cacheState \Magento\App\Cache\StateInterface */ - $cacheState = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\App\Cache\StateInterface'); + $cacheState = $objectManager->create('Magento\App\Cache\StateInterface'); /** @var \Magento\App\Cache\TypeListInterface $cacheTypeList */ - $cacheTypeList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\App\Cache\TypeListInterface'); + $cacheTypeList = $objectManager->create('Magento\App\Cache\TypeListInterface'); $types = array_keys($cacheTypeList->getTypes()); foreach ($types as $type) { $this->assertTrue( diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php new file mode 100644 index 00000000000..d4a1238fd04 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php @@ -0,0 +1,138 @@ +<?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. + * + * @category Magento + * @package Magento_Sales + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Model\Quote; + +/** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php + * @magentoDataFixture Magento/Sales/_files/quote.php + */ +class AddressTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Sales\Model\Quote $quote */ + protected $_quote; + + /** @var \Magento\Customer\Model\Customer $customer */ + protected $_customer; + + /** + * Initialize quote and customer fixtures + */ + public function setUp() + { + $this->_quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Quote'); + $this->_quote->load('test01', 'reserved_order_id'); + $this->_quote->setIsMultiShipping('0'); + + /** @var \Magento\Customer\Model\Customer $customer */ + $this->_customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Customer'); + $this->_customer->load(1); + } + + /** + * same_as_billing must be equal 0 if billing address is being saved + */ + public function testSameAsBillingForBillingAddress() + { + $this->_quote->setCustomer($this->_customer); + $this->_quote->getBillingAddress() + ->setSameAsBilling(0) + ->setCustomerAddress($this->_customer->getDefaultBillingAddress()) + ->save(); + $this->assertEquals(0, $this->_quote->getBillingAddress()->getSameAsBilling()); + } + + /** + * same_as_billing must be equal 1 if customer is guest + */ + public function testSameAsBillingWhenCustomerIsGuest() + { + $shippingAddress = $this->_quote->getShippingAddress(); + $shippingAddress->setSameAsBilling(0); + $shippingAddress->save(); + $this->assertEquals(1, $shippingAddress->getSameAsBilling()); + } + + /** + * same_as_billing must be equal 1 if quote address has no customer address + */ + public function testSameAsBillingWhenQuoteAddressHasNoCustomerAddress() + { + $this->_quote->setCustomer($this->_customer); + $this->_quote->getShippingAddress() + ->setSameAsBilling(0) + ->setCustomerAddress(null) + ->save(); + $this->assertEquals(1, $this->_quote->getShippingAddress()->getSameAsBilling()); + } + + /** + * same_as_billing must be equal 1 if customer registered and he has no default shipping address + */ + public function testSameAsBillingWhenCustomerHasNoDefaultShippingAddress() + { + $this->_customer->setDefaultShipping(-1); + $this->_quote->setCustomer($this->_customer); + $this->_setCustomerAddressAndSave(); + $this->assertEquals(1, $this->_quote->getShippingAddress()->getSameAsBilling()); + } + + /** + * same_as_billing must be equal 1 if customer has the same billing and shipping address + */ + public function testSameAsBillingWhenCustomerHasBillingSameShipping() + { + $this->_quote->setCustomer($this->_customer); + $this->_setCustomerAddressAndSave(); + $this->assertEquals(1, $this->_quote->getShippingAddress()->getSameAsBilling()); + } + + /** + * same_as_billing must be equal 0 if customer has default shipping address that differs from default billing + */ + public function testSameAsBillingWhenCustomerHasDefaultShippingAddress() + { + $this->_customer->setDefaultShipping(2); + $this->_quote->setCustomer($this->_customer); + $this->_setCustomerAddressAndSave(); + $this->assertEquals(0, $this->_quote->getShippingAddress()->getSameAsBilling()); + } + + /** + * Assign customer address to quote address and save quote address + */ + protected function _setCustomerAddressAndSave() + { + $this->_quote->getShippingAddress() + ->setSameAsBilling(0) + ->setCustomerAddress($this->_customer->getDefaultBillingAddress()) + ->save(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php new file mode 100644 index 00000000000..2fed9c08284 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php @@ -0,0 +1,55 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Model\Resource; + +class QuoteTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Resource\Quote + */ + protected $_resourceModel; + + protected function setUp() + { + $this->_resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Resource\Quote'); + } + + /** + * @magentoDataFixture Magento/Sales/_files/order.php + */ + public function testIsOrderIncrementIdUsedNumericIncrementId() + { + $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('100000001')); + } + + /** + * @magentoDataFixture Magento/Sales/_files/order_alphanumeric_id.php + */ + public function testIsOrderIncrementIdUsedAlphanumericIncrementId() + { + $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('M00000001')); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_alphanumeric_id.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_alphanumeric_id.php new file mode 100644 index 00000000000..e9cbba385d8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_alphanumeric_id.php @@ -0,0 +1,33 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +require __DIR__ . '/../../../Magento/Sales/_files/order.php'; + +/** @var \Magento\Sales\Model\Order $order */ +$order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Order'); + +$order->loadByIncrementId('100000001'); +$order->setIncrementId('M00000001'); +$order->save(); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php index d6fd0d1d095..e397986fdbb 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php @@ -51,7 +51,10 @@ class DiConfigFilesTest extends \PHPUnit_Framework_TestCase $filesystem = $objectManager->get('Magento\Filesystem'); $configDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); - self::$_primaryFiles = $fileIteratorFactory->create($configDirectory, $configDirectory->search('#di\.xml$#')); + self::$_primaryFiles = $fileIteratorFactory->create( + $configDirectory, + $configDirectory->search('{*/di.xml,di.xml}') + ); //init module global configs /** @var $modulesReader \Magento\Module\Dir\Reader */ $modulesReader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php index 3dc4174285b..c860d0065ce 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php @@ -35,9 +35,12 @@ class EavAttributesConfigFilesTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $filesystem \Magento\Filesystem */ $filesystem = $objectManager->get('Magento\Filesystem'); - $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); - $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/eav_attributes\.xml$#')); + $xmlFiles = $fileIteratorFactory->create( + $modulesDirectory, + $modulesDirectory->search('/*/*/etc/{*/eav_attributes.xml,eav_attributes.xml}') + ); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated') diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php index c69b7e8c546..a00d31eb257 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php @@ -35,9 +35,12 @@ class ExportConfigFilesTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $filesystem \Magento\Filesystem */ $filesystem = $objectManager->get('Magento\Filesystem'); - $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); - $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/export\.xml$#')); + $xmlFiles = $fileIteratorFactory->create( + $modulesDirectory, + $modulesDirectory->search('/*/*/etc/{*/export.xml,export.xml}') + ); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated') diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php index fd95efa3183..799ad2983e2 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php @@ -40,13 +40,13 @@ class FieldsetConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractCo /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is regex + * Format is glob, so * is allowed. * * @return string */ - protected function _getConfigFilePathRegex() + protected function _getConfigFilePathGlob() { - return '#/etc/fieldset\.xml$#'; + return '/*/*/etc/fieldset.xml'; } /** diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php index f7042a0a2eb..9380b21b401 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php @@ -35,9 +35,12 @@ class ImportConfigFilesTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $filesystem \Magento\Filesystem */ $filesystem = $objectManager->get('Magento\Filesystem'); - $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); - $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/import\.xml$#')); + $xmlFiles = $fileIteratorFactory->create( + $modulesDirectory, + $modulesDirectory->search('/*/*/etc/{*/import.xml,import.xml}') + ); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated') diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php index c77b6457430..0470c519e8d 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php @@ -35,9 +35,12 @@ class IndexerConfigFilesTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $filesystem \Magento\Filesystem */ $filesystem = $objectManager->get('Magento\Filesystem'); - $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); - $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/indexers\.xml$#')); + $xmlFiles = $fileIteratorFactory->create( + $modulesDirectory, + $modulesDirectory->search('/*/*/etc/{*/indexers.xml,indexers.xml}') + ); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated') diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/InstallWizardConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/InstallWizardConfigFilesTest.php index 4b317efa2e1..465ba3f48f5 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/InstallWizardConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/InstallWizardConfigFilesTest.php @@ -41,13 +41,13 @@ class InstallWizardConfigFilesTest /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is regex + * Format is glob, so * is allowed. * * @return string */ - protected function _getConfigFilePathRegex() + protected function _getConfigFilePathGlob() { - return '#/etc/install_wizard\.xml$#'; + return '/*/*/etc/install_wizard.xml'; } /** diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/PaymentConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/PaymentConfigFilesTest.php index bae2e239233..5a505308199 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/PaymentConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/PaymentConfigFilesTest.php @@ -40,13 +40,13 @@ class PaymentConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractCon /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is regex + * Format is glob, so * is allowed. * * @return string */ - protected function _getConfigFilePathRegex() + protected function _getConfigFilePathGlob() { - return '#/etc/payment\.xml$#'; + return '/*/*/etc/payment.xml'; } /** diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php index 7723f24484d..1ab725fb1b0 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php @@ -36,9 +36,12 @@ class ProductOptionsConfigFilesTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $filesystem \Magento\Filesystem */ $filesystem = $objectManager->get('Magento\Filesystem'); - $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); - $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/product_options\.xml$#')); + $xmlFiles = $fileIteratorFactory->create( + $modulesDirectory, + $modulesDirectory->search('/*/*/etc/{*/product_options.xml,product_options.xml}') + ); $fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles)); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php index 21799175fd7..2bcd355a8f1 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php @@ -35,9 +35,12 @@ class ProductTypesConfigFilesTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $filesystem \Magento\Filesystem */ $filesystem = $objectManager->get('Magento\Filesystem'); - $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); - $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/product_types\.xml$#')); + $xmlFiles = $fileIteratorFactory->create( + $modulesDirectory, + $modulesDirectory->search('/*/*/etc/{*/product_types.xml,product_types.xml}') + ); $fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles)); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php index 06ddb67b5bc..ce5c5e3cf91 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php @@ -35,9 +35,12 @@ class ResourcesConfigFilesTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $filesystem \Magento\Filesystem */ $filesystem = $objectManager->get('Magento\Filesystem'); - $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); - $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/resources\.xml$#')); + $xmlFiles = $fileIteratorFactory->create( + $modulesDirectory, + $modulesDirectory->search('/*/*/etc/{*/resources.xml,resources.xml}') + ); $fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles)); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ThemeConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ThemeConfigFilesTest.php index 13e34e3ad8e..b06bf189bfa 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ThemeConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ThemeConfigFilesTest.php @@ -40,13 +40,13 @@ class ThemeConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractConfi /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is regex + * Format is glob, so * is allowed. * * @return string */ - protected function _getConfigFilePathRegex() + protected function _getConfigFilePathGlob() { - return '#/etc/page_layouts\.xml$#'; + return '/*/*/etc/page_layouts.xml'; } /** diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/WidgetConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/WidgetConfigFilesTest.php index 1123fc1aea1..0921acd7e95 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/WidgetConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/WidgetConfigFilesTest.php @@ -40,13 +40,13 @@ class WidgetConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractConf /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is regex + * Format is glob, so * is allowed. * * @return string */ - protected function _getConfigFilePathRegex() + protected function _getConfigFilePathGlob() { - return '#/etc/widget\.xml$#'; + return '/*/*/etc/widget.xml'; } /** diff --git a/dev/tests/integration/testsuite/Magento/Tools/View/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Tools/View/GeneratorTest.php new file mode 100644 index 00000000000..a6ec0a6bf0a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Tools/View/GeneratorTest.php @@ -0,0 +1,77 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Tools\View; + +class GeneratorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Shell + */ + protected $shell; + + /** + * @var \Magento\Filesystem\Driver\File + */ + protected $filesystem; + + /** + * Temporary destination directory + * + * @var string + */ + protected $tmpDir; + + protected function setUp() + { + $this->tmpDir = BP . '/var/static'; + $this->shell = new \Magento\Shell(); + $this->filesystem = new \Magento\Filesystem\Driver\File(); + if (!$this->filesystem->isExists($this->tmpDir)) { + $this->filesystem->createDirectory($this->tmpDir, 0777); + } + } + + protected function tearDown() + { + if ($this->filesystem->isExists($this->tmpDir)) { + $this->filesystem->deleteDirectory($this->tmpDir); + } + } + + /** + * Test view generator + */ + public function testViewGenerator() + { + try { + $this->shell->execute( + 'php -f %s -- --source %s --destination %s', + array(BP . '/dev/tools/Magento/Tools/View/generator.php', BP . '/app/design', $this->tmpDir) + ); + } catch (\Magento\Exception $exception) { + $this->fail($exception->getPrevious()->getMessage()); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php index f62cd9b088f..9285de4ddaa 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php @@ -45,7 +45,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); $dirPath = ltrim(str_replace($this->directoryList->getRoot(), '', str_replace('\\', '/', __DIR__)) . '/_files', '/'); - $this->directoryList->addDirectory(\Magento\Filesystem::MODULES, array('path' => $dirPath)); + $this->directoryList->addDirectory(\Magento\Filesystem::MODULES, array('path' => $dirPath . '/code')); $this->directoryList->addDirectory(\Magento\Filesystem::CONFIG, array('path' => $dirPath)); $this->directoryList->addDirectory(\Magento\Filesystem::ROOT, array('path' => $dirPath)); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index fa6250f03df..84737f9866a 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -845,6 +845,7 @@ return array( . ' and \Magento\Catalog\Block\Product\View\BaseImage classes' ), array('Magento\Wishlist\Block\Links', 'Magento\Wishlist\Block\Link'), + array('Magento\Wishlist\Block\Render\Item\Price'), array('Mage_Adminhtml_Block_Api_Tab_Userroles'), array('Mage_Adminhtml_Block_Api_Tab_Roleinfo'), array('Mage_Adminhtml_Block_Api_Tab_Rolesusers'), diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index bbd7719d4c1..23140b3c70b 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -93,6 +93,7 @@ return array( array('_getIdAttributes', 'Magento\ObjectManager\Config\Reader\Dom'), array('_getInitialXml', 'Magento\ObjectManager\Config\Reader\Dom'), array('_getInputHtml', 'Magento\ImportExport\Block\Adminhtml\Export\Filter'), + array('_getItemPriceBlock', 'Magento\Wishlist\Block\AbstractBlock'), array('_getLabelForStore', 'Magento\Catalog\Model\Resource\Eav\Attribute'), array('_getMultiSelectHtml', 'Magento\ImportExport\Block\Adminhtml\Export\Filter'), array('_getNumberFromToHtml', 'Magento\ImportExport\Block\Adminhtml\Export\Filter'), @@ -145,6 +146,7 @@ return array( array('_needSubtractTax'), array('_needToAddDummy'), array('_needToAddDummyForShipment'), + array('_outTemplate', 'Magento\Backend\App\AbstractAction'), array('_parseDescription', 'Magento\Sales\Model\Order\Pdf\Items\AbstractItems'), array('_parsePackageTheme', 'Magento\Widget\Model\Widget\Instance'), array('_parseXmlTrackingResponse', 'Magento\Usa\Model\Shipping\Carrier\Fedex'), @@ -191,6 +193,7 @@ return array( array('addCustomersToAlertQueueAction'), array('addCustomerToSegments'), array('addHandle', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), + array('addItemPriceBlockType'), array('addItemRender', 'Magento\Sales\Block\Adminhtml\Items\AbstractItems'), array('addItemRender', 'Magento\Checkout\Block\Cart\AbstractCart'), array('addItemRender', 'Magento\Sales\Block\Items\AbstractItems'), @@ -450,8 +453,8 @@ return array( array('getParentProductIds', 'Magento\Catalog\Model\Resource\Product'), array('getPostMaxSize', 'Magento\Backend\Block\Media\Uploader', 'Magento_File_Size::getPostMaxSize()'), array('getPriceFormatted', 'Magento\Customer\Block\Adminhtml\Edit\Tab\View\Sales'), - array('getPrices', 'Magento\Bundle\Model\Product\Price'), - array('getPricesDependingOnTax', 'Magento\Bundle\Model\Product\Price'), + array('getPrices', 'Magento\Bundle\Model\Product\Price', 'getTotalPrices()'), + array('getPricesDependingOnTax', 'Magento\Bundle\Model\Product\Price', 'getTotalPrices()'), array('getPrintUrl', 'Magento\Checkout\Block\Onepage\Success'), array('getPrintUrl', 'Magento\Sales\Block\Order\Info'), array('getProduct', 'Magento\Catalog\Model\Product\Type\AbstractType'), diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index be771b19467..19e85986d60 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -33,6 +33,7 @@ return array( array('_appMode', 'Magento\App\ObjectManager\ConfigLoader'), array('_baseDirCache', 'Magento\Core\Model\Config'), array('_cacheConf'), + array('_cachedItemPriceBlocks'), array('_canUseLocalModules'), array('_checkedProductsQty', 'Magento\CatalogInventory\Model\Observer'), array('_children', 'Magento\Core\Block\AbstractBlock'), @@ -62,6 +63,7 @@ return array( array('_isAnonymous'), array('_isFirstTimeProcessRun', 'Magento\SalesRule\Model\Validator'), array('_isRuntimeValidated', 'Magento\ObjectManager\Config\Reader\Dom'), + array('_itemPriceBlockTypes'), array('_loadDefault', 'Magento\Core\Model\Resource\Store\Collection'), array('_loadDefault', 'Magento\Core\Model\Resource\Store\Group\Collection'), array('_loadDefault', 'Magento\Core\Model\Resource\Website\Collection'), diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index 3ce287e215c..d8d3cb220be 100755 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -36,6 +36,16 @@ <listeners> <listener class="Magento\TestFramework\Listener\GarbageCleanup" file="framework/Magento/TestFramework/Listener/GarbageCleanup.php"/> </listeners> + <filter> + <whitelist addUncoveredFilesFromWhiteList="true"> + <directory suffix=".php">../../../app/code/Magento</directory> + <directory suffix=".php">../../../lib/Magento</directory> + <exclude> + <directory suffix=".php">../../../app/code/Magento/*/sql</directory> + <directory suffix=".php">../../../app/code/Magento/*/data</directory> + </exclude> + </whitelist> + </filter> <logging> <!--coverage_html_placeholder <log type="coverage-html" target="{{coverage_dir}}/test-reports/coverage" charset="UTF-8" yui="true" highlight="true"/> diff --git a/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php b/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php index b6eeb1c75f9..f079bda1d83 100644 --- a/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php @@ -40,16 +40,28 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase */ protected $_responseMock; + /** + * @var \Magento\Filesystem\Directory\WriteInterface + */ + protected $_dirMock; + protected function setUp() { $this->_fileSystemMock = $this->getMock( - 'Magento\Filesystem', array('getFileSize', 'isFile'), array(), '', false + 'Magento\Filesystem', array('getDirectoryWrite'), array(), '', false ); - $this->_fileSystemMock->expects($this->any())->method('getFileSize') - ->withAnyParameters()->will($this->returnValue(0)); + $this->_dirMock = $this->getMockBuilder('\Magento\Filesystem\Directory\Write') + ->disableOriginalConstructor() + ->getMock(); + + $this->_fileSystemMock->expects($this->any())->method('getDirectoryWrite') + ->withAnyParameters()->will($this->returnValue($this->_dirMock)); + + $this->_fileSystemMock->expects($this->any())->method('isFile') ->withAnyParameters()->will($this->returnValue(0)); - $this->_responseMock = $this->getMock('Magento\App\Response\Http', array('setHeader'), array(), '', false); + $this->_responseMock = + $this->getMock('Magento\App\Response\Http', array('setHeader', 'sendHeaders'), array(), '', false); $this->_responseMock->expects($this->any())->method('setHeader') ->will($this->returnValue($this->_responseMock)); $this->_model = new \Magento\App\Response\Http\FileFactory( @@ -77,9 +89,7 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase 'type' => 'filename', 'value' => $file ); - $this->_fileSystemMock->expects($this->any()) - ->method('stat') - ->will($this->returnValue(array('size' => 'string'))); + $this->_model->create('fileName', $content); } } diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/OptionTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/OptionTest.php new file mode 100644 index 00000000000..20eefb8b777 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/OptionTest.php @@ -0,0 +1,75 @@ +<?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) 2013 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\Block\Catalog\Product\View\Type\Bundle; + +class OptionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option + */ + protected $_block; + + protected function setUp() + { + $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->_block = + $objectManagerHelper->getObject('\Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option'); + + $product = $this->getMock( + '\Magento\Catalog\Model\Product', array('hasPreconfiguredValues', 'getPreconfiguredValues', '__wakeup'), + array(), '', false + ); + $product->expects($this->atLeastOnce())->method('hasPreconfiguredValues')->will($this->returnValue(true)); + $product->expects($this->atLeastOnce()) + ->method('getPreconfiguredValues') + ->will($this->returnValue(new \Magento\Object(array('bundle_option' => array(15 => 315, 16 => 316))))); + + $this->_block->setData('product', $product); + } + + public function testSetOption() + { + $option = $this->getMock('\Magento\Bundle\Model\Option', array(), array(), '', false); + $option->expects($this->any())->method('getId')->will($this->returnValue(15)); + + $otherOption = $this->getMock('\Magento\Bundle\Model\Option', array(), array(), '', false); + $otherOption->expects($this->any())->method('getId')->will($this->returnValue(16)); + + $selection = $this->getMock( + '\Magento\Catalog\Model\Product', array('getSelectionId', '__wakeup'), array(), '', false + ); + $selection->expects($this->atLeastOnce())->method('getSelectionId')->will($this->returnValue(315)); + + $this->assertSame($this->_block, $this->_block->setOption($option)); + $this->assertTrue($this->_block->isSelected($selection)); + + $this->_block->setOption($otherOption); + $this->assertFalse( + $this->_block->isSelected($selection), + 'Selected value should change after new option is set' + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php index 6b8fbfc86fc..e0c75115507 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php @@ -93,6 +93,11 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ protected $_messageManager; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $redirect; + protected function setUp() { $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); @@ -110,6 +115,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_urlManager = $this->getMock('Magento\Core\Model\Url', array(), array(), '', false); $this->_actionFlag = $this->getMock('Magento\App\ActionFlag', array(), array(), '', false); $this->_messageManager = $this->getMock('\Magento\Message\ManagerInterface', array(), array(), '', false); + $this->redirect = $this->getMock('\Magento\App\Response\RedirectInterface', array(), array(), '', false); $this->_observer = $this->_objectManager->getObject( 'Magento\Captcha\Model\Observer', array( @@ -121,7 +127,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase 'helper' => $this->_helper, 'urlManager' => $this->_urlManager, 'actionFlag' => $this->_actionFlag, - 'messageManager' => $this->_messageManager + 'messageManager' => $this->_messageManager, + 'redirect' => $this->redirect, ) ); @@ -166,22 +173,21 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $redirectRoutePath = 'contacts/index/index'; $redirectUrl = 'http://magento.com/contacts/'; - $this->_urlManager->expects($this->once()) - ->method('getUrl') - ->with($redirectRoutePath, null) - ->will($this->returnValue($redirectUrl)); - - $controller = $this->getMock('Magento\App\Action\Action', array(), array(), '', false); $request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $response = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); - $request->expects($this->any())->method('getPost')->with(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE, - null) + $request->expects($this->any()) + ->method('getPost') + ->with(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE, null) ->will($this->returnValue(array( $formId => $captchaValue, ))); - $response->expects($this->once()) - ->method('setRedirect') - ->with($redirectUrl, 302); + + $this->redirect->expects($this->once()) + ->method('redirect') + ->with($response, $redirectRoutePath, array()) + ->will($this->returnValue($redirectUrl)); + + $controller = $this->getMock('Magento\App\Action\Action', array(), array(), '', false); $controller->expects($this->any())->method('getRequest')->will($this->returnValue($request)); $controller->expects($this->any())->method('getResponse')->will($this->returnValue($response)); $this->_captcha->expects($this->any())->method('isRequired')->will($this->returnValue(true)); @@ -210,6 +216,95 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_observer->checkContactUsForm(new \Magento\Event\Observer()); } + public function testCheckForgotpasswordRedirects() + { + $formId = 'user_forgotpassword'; + $captchaValue = 'some-value'; + $warningMessage = 'Incorrect CAPTCHA'; + $redirectRoutePath = '*/*/forgotpassword'; + $redirectUrl = 'http://magento.com/customer/account/forgotpassword/'; + + $request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $response = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); + $request->expects($this->any()) + ->method('getPost') + ->with(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE, null) + ->will($this->returnValue(array( + $formId => $captchaValue, + ))); + + $this->redirect->expects($this->once()) + ->method('redirect') + ->with($response, $redirectRoutePath, array()) + ->will($this->returnValue($redirectUrl)); + + $controller = $this->getMock('Magento\App\Action\Action', array(), array(), '', false); + $controller->expects($this->any())->method('getRequest')->will($this->returnValue($request)); + $controller->expects($this->any())->method('getResponse')->will($this->returnValue($response)); + $this->_captcha->expects($this->any())->method('isRequired')->will($this->returnValue(true)); + $this->_captcha->expects($this->once()) + ->method('isCorrect') + ->with($captchaValue) + ->will($this->returnValue(false)); + $this->_helper->expects($this->any())->method('getCaptcha') + ->with($formId) + ->will($this->returnValue($this->_captcha)); + $this->_messageManager->expects($this->once())->method('addError')->with($warningMessage); + $this->_actionFlag->expects($this->once())->method('set') + ->with('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); + + $this->_observer->checkForgotpassword(new \Magento\Event\Observer(array('controller_action' => $controller))); + } + + public function testCheckUserCreateRedirectsError() + { + $formId = 'user_create'; + $captchaValue = 'some-value'; + $warningMessage = 'Incorrect CAPTCHA'; + $redirectRoutePath = '*/*/create'; + $redirectUrl = 'http://magento.com/customer/account/create/'; + + $request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $request->expects($this->at(0)) + ->method('getPost') + ->with(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE, null) + ->will($this->returnValue(array( + $formId => $captchaValue, + ))); + + $response = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); + $response->expects($this->once()) + ->method('setRedirect') + ->with($redirectUrl); + + $this->_urlManager->expects($this->once()) + ->method('getUrl') + ->with($redirectRoutePath, array('_nosecret' => true)) + ->will($this->returnValue($redirectUrl)); + + $this->redirect->expects($this->once()) + ->method('error') + ->with($redirectUrl) + ->will($this->returnValue($redirectUrl)); + + $controller = $this->getMock('Magento\App\Action\Action', array(), array(), '', false); + $controller->expects($this->any())->method('getRequest')->will($this->returnValue($request)); + $controller->expects($this->any())->method('getResponse')->will($this->returnValue($response)); + $this->_captcha->expects($this->any())->method('isRequired')->will($this->returnValue(true)); + $this->_captcha->expects($this->once()) + ->method('isCorrect') + ->with($captchaValue) + ->will($this->returnValue(false)); + $this->_helper->expects($this->any())->method('getCaptcha') + ->with($formId) + ->will($this->returnValue($this->_captcha)); + $this->_messageManager->expects($this->once())->method('addError')->with($warningMessage); + $this->_actionFlag->expects($this->once())->method('set') + ->with('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); + + $this->_observer->checkUserCreate(new \Magento\Event\Observer(array('controller_action' => $controller))); + } + /** * Get stub for resource model * @return \Magento\Captcha\Model\Resource\Log diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/UrlTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/UrlTest.php new file mode 100644 index 00000000000..93b16e6250a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/UrlTest.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) 2013 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\Model; + +class UrlTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Url + */ + protected $_model; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + protected function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_model = $this->_objectManager->getObject('Magento\Catalog\Model\Url'); + } + + public function testGenerateUniqueIdPath() + { + $path = $this->_model->generateUniqueIdPath(); + $this->assertNotContains('.', $path); + $this->assertContains('_', $path); + $this->assertNotEquals($path, $this->_model->generateUniqueIdPath()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Centinel/Model/ServiceTest.php b/dev/tests/unit/testsuite/Magento/Centinel/Model/ServiceTest.php index 218a78ad7f6..ae5501205f5 100644 --- a/dev/tests/unit/testsuite/Magento/Centinel/Model/ServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Centinel/Model/ServiceTest.php @@ -35,18 +35,100 @@ class ServiceTest extends \PHPUnit_Framework_TestCase */ public function testGetAuthenticationStartUrl() { - $url = $this->getMock('Magento\Core\Model\Url', array('getUrl'), array(), '', false); + $url = $this->getMock('Magento\Core\Model\Url', ['getUrl'], [], '', false); $url->expects($this->once()) ->method('getUrl') ->with($this->equalTo('url_prefix/authenticationstart')) ->will($this->returnValue('some value')); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var Service $model */ + /** @var \Magento\Centinel\Model\Service $model */ $model = $helper->getObject( 'Magento\Centinel\Model\Service', - array('url' => $url, 'urlPrefix' => 'url_prefix/') + ['url' => $url, 'urlPrefix' => 'url_prefix/'] ); $this->assertEquals('some value', $model->getAuthenticationStartUrl()); } + + public function testLookup() + { + $centinelSession = $this->getMock('Magento\Session\SessionManager', ['setData', 'getData'], [], '', false); + $centinelSession->expects($this->once()) + ->method('setData') + ->with([]); + $centinelSession->expects($this->once()) + ->method('getData') + ->will($this->returnValue('cardType')); + + $api = $this->getMock( + 'Magento\Centinel\Model\Api', + ['setProcessorId', 'setMerchantId', 'setTransactionPwd', 'setIsTestMode', 'setDebugFlag', 'callLookup'], + [], + '', + false + ); + $api->expects($this->once())->method('setProcessorId')->will($this->returnValue($api)); + $api->expects($this->once())->method('setMerchantId')->will($this->returnValue($api)); + $api->expects($this->once())->method('setTransactionPwd')->will($this->returnValue($api)); + $api->expects($this->once())->method('setIsTestMode')->will($this->returnValue($api)); + $api->expects($this->once())->method('setDebugFlag')->will($this->returnValue($api)); + $api->expects($this->once())->method('callLookup')->will($this->returnValue('result')); + $apiFactory = $this->getMock('Magento\Centinel\Model\ApiFactory', ['create'], [], '', false); + $apiFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($api)); + + $state = $this->getMock( + '\Magento\Centinel\Model\State', + ['setDataStorage', 'setCardType', 'setChecksum', 'setIsModeStrict', 'setLookupResult'], + [], + '', + false + ); + $state->expects($this->any()) + ->method('setDataStorage') + ->with($centinelSession) + ->will($this->returnValue($state)); + $state->expects($this->once()) + ->method('setCardType') + ->with('cardType') + ->will($this->returnValue($state)); + $state->expects($this->once()) + ->method('setChecksum') + ->will($this->returnValue($state)); + $state->expects($this->once()) + ->method('setLookupResult') + ->with('result'); + $stateFactory = $this->getMock( + '\Magento\Centinel\Model\StateFactory', ['createState'], [], '', false); + $stateFactory->expects($this->any()) + ->method('createState') + ->with('cardType') + ->will($this->returnValue($state)); + + $config = $this->getMock( + '\Magento\Centinel\Model\Config', + ['setStore', 'getProcessorId', 'getMerchantId', 'getTransactionPwd', 'getIsTestMode', 'getDebugFlag'], + [], + '', + false + ); + $config->expects($this->once())->method('setStore')->will($this->returnValue($config)); + + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + /** @var \Magento\Centinel\Model\Service $model */ + $model = $helper->getObject( + 'Magento\Centinel\Model\Service', + [ + 'apiFactory' => $apiFactory, + 'centinelSession' => $centinelSession, + 'stateFactory' => $stateFactory, + 'config' => $config + ] + ); + + $data = new \Magento\Object(['card_type' => 'cardType']); + + $model->lookup($data); + } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/PaymentTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/PaymentTest.php new file mode 100644 index 00000000000..0aaaa51b625 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/PaymentTest.php @@ -0,0 +1,59 @@ +<?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) 2013 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 PaymentTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param mixed $hasRecurringItems + * @dataProvider hasRecurringItemsDataProvider + */ + public function testHasRecurringItems($hasRecurringItems) + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $quote = $this->getMock('Magento\Sales\Model\Quote', array( + 'hasRecurringItems', + '__wakeup' + ), array(), '', false); + $quote->expects($this->once())->method('hasRecurringItems')->will($this->returnValue($hasRecurringItems)); + $checkoutSession = $this->getMock('Magento\Checkout\Model\Session', array( + 'getQuote', + 'setStepData' + ), array(), '', false); + $checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quote)); + /** @var \Magento\Checkout\Block\Onepage\Payment $model */ + $model = $helper->getObject('Magento\Checkout\Block\Onepage\Payment', array( + 'resourceSession' => $checkoutSession + )); + $this->assertEquals($hasRecurringItems, $model->hasRecurringItems()); + } + + public function hasRecurringItemsDataProvider() + { + return array( + array(false), + array(true), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php new file mode 100644 index 00000000000..d307d715595 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php @@ -0,0 +1,142 @@ +<?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) 2013 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\Helper; + +class DataTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Data + */ + private $_helper; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $_emailTemplate; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $_translator; + + protected function setUp() + { + $this->_translator = $this->getMock('Magento\Core\Model\Translate', array(), array(), '', false); + $context = $this->getMock('\Magento\App\Helper\Context', array(), array(), '', false); + $context->expects($this->any())->method('getTranslator')->will($this->returnValue($this->_translator)); + + $storeConfig = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); + $storeConfig->expects($this->any())->method('getConfig')->will($this->returnValueMap(array( + array('checkout/payment_failed/template', 8, 'fixture_email_template_payment_failed'), + array('checkout/payment_failed/receiver', 8, 'sysadmin'), + array('trans_email/ident_sysadmin/email', 8, 'sysadmin@example.com'), + array('trans_email/ident_sysadmin/name', 8, 'System Administrator'), + array('checkout/payment_failed/identity', 8, 'noreply@example.com'), + array('carriers/ground/title', null, 'Ground Shipping'), + array('payment/fixture-payment-method/title', null, 'Check Money Order'), + ))); + + $storeManager = $this->getMock('\Magento\Core\Model\StoreManagerInterface', array(), array(), '', false); + + $checkoutSession = $this->getMock('\Magento\Checkout\Model\Session', array(), array(), '', false); + + $locale = $this->getMock('\Magento\Core\Model\LocaleInterface', array(), array(), '', false); + $locale->expects($this->any())->method('date')->will($this->returnValue('Oct 02, 2013')); + + $collectionFactory = $this->getMock( + '\Magento\Checkout\Model\Resource\Agreement\CollectionFactory', array(), array(), '', false + ); + + $this->_emailTemplate = $this->getMock('\Magento\Email\Model\Template', array(), array(), '', false); + $emailTplFactory = $this->getMock( + '\Magento\Email\Model\TemplateFactory', array('create'), array(), '', false + ); + $emailTplFactory->expects($this->once())->method('create')->will($this->returnValue($this->_emailTemplate)); + + $this->_helper = new Data( + $context, $storeConfig, $storeManager, $checkoutSession, + $locale, $collectionFactory, $emailTplFactory + ); + } + + public function testSendPaymentFailedEmail() + { + $shippingAddress = new \Magento\Object(array('shipping_method' => 'ground_transportation')); + $billingAddress = new \Magento\Object(array('street' => 'Fixture St')); + + $this->_emailTemplate + ->expects($this->once()) + ->method('setDesignConfig') + ->with(array('area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, 'store' => 8)) + ->will($this->returnSelf()) + ; + $this->_emailTemplate->expects($this->once())->method('sendTransactional')->with( + 'fixture_email_template_payment_failed', + 'noreply@example.com', + 'sysadmin@example.com', + 'System Administrator', + $this->identicalTo(array( + 'reason' => 'test message', + 'checkoutType' => 'onepage', + 'dateAndTime' => 'Oct 02, 2013', + 'customer' => 'John Doe', + 'customerEmail' => 'john.doe@example.com', + 'billingAddress' => $billingAddress, + 'shippingAddress' => $shippingAddress, + 'shippingMethod' => 'Ground Shipping', + 'paymentMethod' => 'Check Money Order', + 'items' => "Product One x 2 USD 10<br />\nProduct Two x 3 USD 60<br />\n", + 'total' => 'USD 70', + )) + ); + + $this->_translator->expects($this->at(0))->method('setTranslateInline')->with(false); + $this->_translator->expects($this->at(1))->method('setTranslateInline')->with(true); + + $productOne = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); + $productOne->expects($this->once())->method('getName')->will($this->returnValue('Product One')); + $productOne->expects($this->once())->method('getFinalPrice')->with(2)->will($this->returnValue(10)); + + $productTwo = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); + $productTwo->expects($this->once())->method('getName')->will($this->returnValue('Product Two')); + $productTwo->expects($this->once())->method('getFinalPrice')->with(3)->will($this->returnValue(60)); + + $quote = new \Magento\Object(array( + 'store_id' => 8, + 'store_currency_code' => 'USD', + 'grand_total' => 70, + 'customer_firstname' => 'John', + 'customer_lastname' => 'Doe', + 'customer_email' => 'john.doe@example.com', + 'billing_address' => $billingAddress, + 'shipping_address' => $shippingAddress, + 'payment' => new \Magento\Object(array('method' => 'fixture-payment-method')), + 'all_visible_items' => array( + new \Magento\Object(array('product' => $productOne, 'qty' => 2)), + new \Magento\Object(array('product' => $productTwo, 'qty' => 3)), + ), + )); + $this->assertSame($this->_helper, $this->_helper->sendPaymentFailedEmail($quote, 'test message')); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php index 476b5660f2f..7a0c4a9cf8a 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php @@ -95,7 +95,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase ); $directory->expects($this->once()) ->method('search') - ->with('#' . preg_quote($filename) . '$#') + ->with(sprintf('{%1$s,*/%1$s}', $filename)) ->will($this->returnValue($fileList)); $this->filesystem->expects($this->once()) ->method('getDirectoryRead') diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/File/Storage/FileTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/File/Storage/FileTest.php new file mode 100644 index 00000000000..8d4867f6031 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/File/Storage/FileTest.php @@ -0,0 +1,96 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\Model\Resource\File\Storage; + +/** + * Class FileTest + */ +class FileTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Core\Model\File\Storage\File + */ + protected $_model; + + /** + * @var \Magento\Core\Helper\File\Media + */ + protected $_loggerMock; + + /** + * @var \Magento\Filesystem + */ + protected $_filesystemMock; + + /** + * @var \Magento\Filesystem\Directory\Read + */ + protected $_directoryReadMock; + + protected function setUp() + { + $this->_loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $this->_directoryReadMock = + $this->getMock('Magento\Filesystem\Directory\Read', array('isDirectory', 'read'), array(), '', false); + $this->_directoryReadMock + ->expects($this->any()) + ->method('isDirectory') + ->will($this->returnValue(true)); + $this->_directoryReadMock + ->expects($this->any()) + ->method('read') + ->with('pub') + ->will($this->returnValue(array( + 'media/customer', + 'media/downloadable', + 'media/theme', + 'media/theme_customization', + 'media') + )); + $this->_filesystemMock + ->expects($this->any()) + ->method('getDirectoryRead') + ->with('media') + ->will($this->returnValue($this->_directoryReadMock)); + $this->_model = new \Magento\Core\Model\Resource\File\Storage\File( + $this->_filesystemMock, + $this->_loggerMock + ); + } + + public function testGetStorageData() + { + $directories = array( + array('name' => 'customer', 'path' => 'media'), + array('name' => 'downloadable', 'path' => 'media'), + array('name' => 'theme', 'path' => 'media'), + array('name' => 'theme_customization', 'path' => 'media'), + array('name' => 'media', 'path' => '/'), + ); + $expected = array('files' => array(), 'directories' => $directories); + $actual = $this->_model->getStorageData('pub'); + $this->assertEquals($expected, $actual); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ValidationTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ValidationTest.php index f8b1b0e5046..87bb746eb99 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ValidationTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ValidationTest.php @@ -91,7 +91,7 @@ class ValidationTest extends \PHPUnit_Framework_TestCase array( 'name' => 'available', 'class' => 'Zend_Validate_Regex', 'break' => true, 'options' => array('pattern' => '/(\d+\.\d+\.\d+\.\d+(\-[a-zA-Z0-9]+)?)|\*/'), - 'message' => 'Theme version has not compatible format' + 'message' => 'Theme version has not compatible format.' ) ); @@ -144,7 +144,7 @@ class ValidationTest extends \PHPUnit_Framework_TestCase { return array( 'theme_code' => array('Theme code has not compatible format'), - 'theme_version' => array('Theme version has not compatible format') + 'theme_version' => array('Theme version has not compatible format.') ); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/WebsiteTest.php new file mode 100644 index 00000000000..825dd911b89 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/WebsiteTest.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Core\Model; + +class WebsiteTest extends \PHPUnit_Framework_TestCase +{ + public function testIsCanDelete() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $websiteCollection = $this->getMock( + 'Magento\Core\Model\Resource\Website\Collection', array('getSize'), array(), '', false + ); + $websiteCollection->expects($this->any()) + ->method('getSize') + ->will($this->returnValue(2)); + + $websiteFactory = $this->getMock( + 'Magento\Core\Model\WebsiteFactory', array('create', 'getCollection', '__wakeup'), array(), '', false + ); + $websiteFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($websiteFactory)); + $websiteFactory->expects($this->any()) + ->method('getCollection') + ->will($this->returnValue($websiteCollection)); + + /** @var \Magento\Core\Model\Website $websiteModel */ + $websiteModel = $objectManager->getObject( + 'Magento\Core\Model\Website', array('websiteFactory' => $websiteFactory) + ); + $websiteModel->setId(2); + $this->assertTrue($websiteModel->isCanDelete()); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/CustomerTest.php new file mode 100644 index 00000000000..d1d2addedc8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/CustomerTest.php @@ -0,0 +1,49 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Customer\Block\Account; + +class CustomerTest extends \PHPUnit_Framework_TestCase +{ + public function testGetCustomerName() + { + $customer = $this->getMock('Magento\Customer\Model\Customer', array(), array(), '', false); + $customer->expects($this->once())->method('getName')->will($this->returnValue('John Doe')); + + $escapedName = new \stdClass(); + $escaper = $this->getMock('Magento\Escaper', array(), array(), '', false); + $escaper + ->expects($this->once())->method('escapeHtml')->with('John Doe')->will($this->returnValue($escapedName)); + + $context = $this->getMock('Magento\View\Element\Template\Context', array(), array(), '', false); + $context->expects($this->once())->method('getEscaper')->will($this->returnValue($escaper)); + + $session = $this->getMock('Magento\Customer\Model\Session', array(), array(), '', false); + $session->expects($this->once())->method('getCustomer')->will($this->returnValue($customer)); + + $block = new \Magento\Customer\Block\Account\Customer($context, $session); + + $this->assertSame($escapedName, $block->getCustomerName()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Customer/Controller/AccountTest.php b/dev/tests/unit/testsuite/Magento/Customer/Controller/AccountTest.php index fc5a04597ad..7d6125cc7e4 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Controller/AccountTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Controller/AccountTest.php @@ -32,12 +32,42 @@ namespace Magento\Customer\Controller; class AccountTest extends \PHPUnit_Framework_TestCase { + /** + * @var \Magento\Customer\Controller\Account + */ + protected $object; + + /** + * @var \Magento\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $request; + + /** + * @var \Magento\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $response; + + /** + * @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject + */ + protected $customerSession; + + /** + * @var \Magento\UrlInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $url; + + /** + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManager; + /** * List of actions that are allowed for not authorized users * * @var array */ - protected $_openActions = array( + protected $openActions = array( 'create', 'login', 'logoutsuccess', @@ -52,31 +82,49 @@ class AccountTest extends \PHPUnit_Framework_TestCase 'loginpost' ); - /** - * @var \Magento\Customer\Controller\Account - */ - protected $_model; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_objectManagerMock; + protected $_formKeyValidator; protected function setUp() { - $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $arguments = array( - 'urlFactory' => $this->getMock('Magento\Core\Model\UrlFactory', array(), array(), '', false), - 'customerFactory' => $this->getMock('Magento\Customer\Model\CustomerFactory', array(), array(), '', false), - 'formFactory' => $this->getMock('Magento\Customer\Model\FormFactory', array(), array(), '', false), - 'addressFactory' => $this->getMock('Magento\Customer\Model\AddressFactory', array(), array(), '', false), + $this->request = $this->getMock( + 'Magento\App\RequestInterface', + ['isPost', 'getModuleName', 'setModuleName', 'getActionName', 'setActionName', 'getParam'], + [], + '', + false ); - $constructArguments = $objectManagerHelper->getConstructArguments( - 'Magento\Customer\Controller\Account', - $arguments + $this->response = $this->getMock( + 'Magento\App\ResponseInterface', + ['setRedirect', 'sendResponse'], + [], + '', + false ); - $this->_model = $objectManagerHelper->getObject('Magento\Customer\Controller\Account', $constructArguments); + $this->customerSession = $this->getMock( + '\Magento\Customer\Model\Session', + ['isLoggedIn', 'getLastCustomerId', 'getBeforeAuthUrl', 'setBeforeAuthUrl'], + [], + '', + false + ); + $this->url = $this->getMockForAbstractClass('\Magento\UrlInterface'); + $this->objectManager = $this->getMock('\Magento\ObjectManager\ObjectManager', ['get'], [], '', false); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_formKeyValidator = $this->getMock( + 'Magento\Core\App\Action\FormKeyValidator', array(), array(), '', false + ); + $this->object = $objectManager->getObject('Magento\Customer\Controller\Account', [ + 'request' => $this->request, + 'response' => $this->response, + 'customerSession' => $this->customerSession, + 'url' => $this->url, + 'objectManager' => $this->objectManager, + 'formKeyValidator' => $this->_formKeyValidator, + '' + ]); } /** @@ -84,10 +132,32 @@ class AccountTest extends \PHPUnit_Framework_TestCase */ public function testGetAllowedActions() { - $this->assertAttributeEquals($this->_openActions, '_openActions', $this->_model); - + $this->assertAttributeEquals($this->openActions, '_openActions', $this->object); + /** + * @TODO: [TD] Protected methods must be tested via public. Eliminate _getAllowedActions method and write test + * for dispatch method using this property instead. + */ $method = new \ReflectionMethod('Magento\Customer\Controller\Account', '_getAllowedActions'); $method->setAccessible(true); - $this->assertEquals($this->_openActions, $method->invoke($this->_model)); + $this->assertEquals($this->openActions, $method->invoke($this->object)); + } + + public function testLoginPostActionWhenRefererSetBeforeAuthUrl() + { + $this->_formKeyValidator->expects($this->once())->method('validate')->will($this->returnValue(true)); + $this->objectManager->expects($this->any())->method('get') + ->will($this->returnValueMap([ + ['Magento\Customer\Helper\Data', new \Magento\Object(['account_url' => 1])], + ['Magento\Core\Model\Store\Config', new \Magento\Object(['config_flag' => 1])], + ['Magento\Core\Helper\Data', $this->getMock('Magento\Core\Helper\Data', [], [], '', false)], + ])); + $this->customerSession->expects($this->at(0))->method('isLoggedIn')->with()->will($this->returnValue(0)); + $this->customerSession->expects($this->at(4))->method('isLoggedIn')->with()->will($this->returnValue(1)); + $this->request->expects($this->once())->method('getParam') + ->with(\Magento\Customer\Helper\Data::REFERER_QUERY_PARAM_NAME) + ->will($this->returnValue('referer')); + $this->url->expects($this->once())->method('isOwnOriginUrl')->with(); + + $this->object->loginPostAction(); } } diff --git a/dev/tests/unit/testsuite/Magento/Data/Form/Element/MultiselectTest.php b/dev/tests/unit/testsuite/Magento/Data/Form/Element/MultiselectTest.php index d1babd9d527..22504f1e6e0 100644 --- a/dev/tests/unit/testsuite/Magento/Data/Form/Element/MultiselectTest.php +++ b/dev/tests/unit/testsuite/Magento/Data/Form/Element/MultiselectTest.php @@ -53,4 +53,14 @@ class MultiselectTest extends \PHPUnit_Framework_TestCase $elementHtml = $this->_model->getElementHtml(); $this->assertContains('<input type="hidden"', $elementHtml); } + + /** + * Verify that js element is added + */ + public function testGetAfterElementJs() + { + $this->_model->setAfterElementJs('<script language="text/javascript">var website = "website1";</script>'); + $elementHtml = $this->_model->getAfterElementJs(); + $this->assertContains('var website = "website1";', $elementHtml); + } } diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/Directory/ReadTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/Directory/ReadTest.php index b87ab89b179..7fd5dc85e32 100644 --- a/dev/tests/unit/testsuite/Magento/Filesystem/Directory/ReadTest.php +++ b/dev/tests/unit/testsuite/Magento/Filesystem/Directory/ReadTest.php @@ -78,26 +78,9 @@ class ReadTest extends \PHPUnit_Framework_TestCase public function testStat() { - $this->driver->expects($this->once()) - ->method('isExists') - ->will($this->returnValue(true)); $this->driver->expects($this->once()) ->method('stat') ->will($this->returnValue(array('some-stat-data'))); $this->assertEquals(array('some-stat-data'), $this->read->stat('correct-path')); } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - */ - public function testAssertExist() - { - $this->driver->expects($this->once()) - ->method('isExists') - ->will($this->returnValue(false)); - $this->read->stat('wrong-path'); - } - - - } diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/InstallerTest.php b/dev/tests/unit/testsuite/Magento/Install/Model/InstallerTest.php new file mode 100644 index 00000000000..f6b685f4e02 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Install/Model/InstallerTest.php @@ -0,0 +1,121 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Install\Model; + +class InstallerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Install\Model\Installer + */ + protected $_model; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + /** + * Application chache model + * + * @var \Magento\App\CacheInterface + */ + protected $_cache; + + /** + * Application config model + * + * @var \Magento\Core\Model\ConfigInterface + */ + protected $_config; + + /** + * @var \Magento\App\Cache\StateInterface + */ + protected $_cacheState; + + /** + * @var \Magento\App\State + */ + protected $_appState; + + /** + * @var \Magento\App\Cache\TypeListInterface + */ + protected $_cacheTypeList; + + /** + * @var \Magento\Install\Model\Installer\Config + */ + protected $_installerConfig; + + /** + * Set up before test + */ + public function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_cache = $this->getMock('\Magento\App\CacheInterface', array(), array(), '', false); + $this->_config = $this->getMock('\Magento\Core\Model\ConfigInterface', array(), array(), '', false); + $this->_cacheState = $this->getMock('\Magento\App\Cache\StateInterface', array(), array(), '', false); + $this->_cacheTypeList = $this->getMock('\Magento\App\Cache\TypeListInterface', array(), array(), '', false); + $this->_appState = $this->getMock('\Magento\App\State', array(), array(), '', false); + $this->_installerConfig = + $this->getMock('\Magento\Install\Model\Installer\Config', array(), array(), '', false); + + $this->_model = $this->_objectManager->getObject( + 'Magento\Install\Model\Installer', + array( + 'cache' => $this->_cache, + 'config' => $this->_config, + 'cacheState' => $this->_cacheState, + 'cacheTypeList' => $this->_cacheTypeList, + 'appState' => $this->_appState, + 'installerConfig' => $this->_installerConfig, + ) + ); + } + + public function testFinish() + { + $cacheTypeListArray = array('one', 'two'); + + $this->_cache->expects($this->once())->method('clean'); + + $this->_config->expects($this->once())->method('reinit'); + + $this->_cacheState->expects($this->once())->method('persist'); + $this->_cacheState->expects($this->exactly(count($cacheTypeListArray)))->method('setEnabled'); + + $this->_cacheTypeList->expects($this->once())->method('getTypes') + ->will($this->returnValue($cacheTypeListArray)); + + $this->_appState->expects($this->once())->method('setInstallDate')->with($this->greaterThanOrEqual(date('r'))); + + $this->_installerConfig->expects($this->once())->method('replaceTmpInstallDate') + ->with($this->greaterThanOrEqual(date('r'))); + + $this->assertSame($this->_model, $this->_model->finish()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php index e7a3582960d..8c12e0b27dc 100644 --- a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php +++ b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php @@ -32,62 +32,129 @@ namespace Magento\ProductAlert\Block\Product\View; class PriceTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\TestFramework\Helper\ObjectManager + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Helper\Data */ - protected $_objectManager; + protected $_helper; - protected function setUp() - { - $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - } + /** + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product + */ + protected $_product; - public function testPrepareLayoutUrlIsSet() - { - $helper = $this->getMockBuilder('Magento\ProductAlert\Helper\Data') - ->disableOriginalConstructor() - ->setMethods(array('isPriceAlertAllowed', 'getSaveUrl')) - ->getMock(); - $helper->expects($this->once())->method('isPriceAlertAllowed')->will($this->returnValue(true)); - $helper->expects($this->once())->method('getSaveUrl')->with('price')->will($this->returnValue('http://url')); + /** + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Registry + */ + protected $_registry; - $product = $this->getMockBuilder('Magento\Catalog\Model\Product') - ->disableOriginalConstructor() - ->setMethods(array('getCanShowPrice', 'getId', '__wakeup')) - ->getMock(); - $product->expects($this->once())->method('getId')->will($this->returnValue(1)); - $product->expects($this->once())->method('getCanShowPrice')->will($this->returnValue(true)); + /** + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Block\Product\View\Price + */ + protected $_block; - $registry = $this->getMockBuilder('Magento\Core\Model\Registry') + /** + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Layout + */ + protected $_layout; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_helper = $this->getMock( + 'Magento\ProductAlert\Helper\Data', array('isPriceAlertAllowed', 'getSaveUrl'), array(), '', false + ); + $this->_product = $this->getMock( + 'Magento\Catalog\Model\Product', array('getCanShowPrice', 'getId', '__wakeup'), array(), '', false + ); + $this->_product->expects($this->any())->method('getId')->will($this->returnValue(1)); + $this->_registry = $this->getMockBuilder('Magento\Core\Model\Registry') ->disableOriginalConstructor() ->setMethods(array('registry')) ->getMock(); - $registry->expects($this->once()) - ->method('registry') - ->with('current_product') - ->will($this->returnValue($product)); - - $block = $this->_objectManager->getObject( + $this->_block = $objectManager->getObject( 'Magento\ProductAlert\Block\Product\View\Price', array( - 'helper' => $helper, - 'registry' => $registry, + 'helper' => $this->_helper, + 'registry' => $this->_registry, ) ); + $this->_layout = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + } - $layout = $this->getMockBuilder('Magento\Core\Model\Layout') - ->disableOriginalConstructor() - ->getMock(); + public function testSetTemplatePriceAlertAllowed() + { + $this->_helper->expects($this->once())->method('isPriceAlertAllowed')->will($this->returnValue(true)); + $this->_helper + ->expects($this->once()) + ->method('getSaveUrl') + ->with('price') + ->will($this->returnValue('http://url')) + ; + + $this->_product->expects($this->once())->method('getCanShowPrice')->will($this->returnValue(true)); - $block->setTemplate('path/to/template.phtml'); - $block->setLayout($layout); + $this->_registry->expects($this->once()) + ->method('registry') + ->with('current_product') + ->will($this->returnValue($this->_product)); - $this->assertEquals('path/to/template.phtml', $block->getTemplate()); - $this->assertEquals('http://url', $block->getSignupUrl()); + $this->_block->setLayout($this->_layout); + $this->_block->setTemplate('path/to/template.phtml'); + + $this->assertEquals('path/to/template.phtml', $this->_block->getTemplate()); + $this->assertEquals('http://url', $this->_block->getSignupUrl()); } - public function testPrepareLayoutTemplateReseted() + /** + * @param bool $priceAllowed + * @param bool $showProductPrice + * + * @dataProvider setTemplatePriceAlertNotAllowedDataProvider + */ + public function testSetTemplatePriceAlertNotAllowed($priceAllowed, $showProductPrice) { - $block = $this->_objectManager->getObject('Magento\ProductAlert\Block\Product\View\Price'); - $this->assertEquals('', $block->getTemplate()); + $this->_helper->expects($this->once())->method('isPriceAlertAllowed')->will($this->returnValue($priceAllowed)); + $this->_helper->expects($this->never())->method('getSaveUrl'); + + $this->_product->expects($this->any())->method('getCanShowPrice')->will($this->returnValue($showProductPrice)); + + $this->_registry->expects($this->once()) + ->method('registry') + ->with('current_product') + ->will($this->returnValue($this->_product)); + + $this->_block->setLayout($this->_layout); + $this->_block->setTemplate('path/to/template.phtml'); + + $this->assertEquals('', $this->_block->getTemplate()); + $this->assertNull($this->_block->getSignupUrl()); + } + + /** + * @return array + */ + public function setTemplatePriceAlertNotAllowedDataProvider() + { + return array( + 'price alert is not allowed' => array(false, true), + 'no product price' => array(true, false), + 'price alert is not allowed and no product price' => array(false, false), + ); + } + + public function testSetTemplateNoProduct() + { + $this->_helper->expects($this->once())->method('isPriceAlertAllowed')->will($this->returnValue(true)); + $this->_helper->expects($this->never())->method('getSaveUrl'); + + $this->_registry->expects($this->once()) + ->method('registry') + ->with('current_product') + ->will($this->returnValue(null)); + + $this->_block->setLayout($this->_layout); + $this->_block->setTemplate('path/to/template.phtml'); + + $this->assertEquals('', $this->_block->getTemplate()); + $this->assertNull($this->_block->getSignupUrl()); } } diff --git a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php index 8711f02aa72..264c710940a 100644 --- a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php +++ b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php @@ -32,65 +32,126 @@ namespace Magento\ProductAlert\Block\Product\View; class StockTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\TestFramework\Helper\ObjectManager + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Helper\Data */ - protected $_objectManager; + protected $_helper; + + /** + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product + */ + protected $_product; + + /** + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Registry + */ + protected $_registry; + + /** + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Block\Product\View\Stock + */ + protected $_block; + + /** + * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Layout + */ + protected $_layout; protected function setUp() { - $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_helper = $this->getMock( + 'Magento\ProductAlert\Helper\Data', array('isStockAlertAllowed', 'getSaveUrl'), array(), '', false + ); + $this->_product = $this->getMock( + 'Magento\Catalog\Model\Product', array('isAvailable', 'getId', '__wakeup'), array(), '', false + ); + $this->_product->expects($this->any())->method('getId')->will($this->returnValue(1)); + $this->_registry = $this->getMockBuilder('Magento\Core\Model\Registry') + ->disableOriginalConstructor() + ->setMethods(array('registry')) + ->getMock(); + $this->_block = $objectManager->getObject( + 'Magento\ProductAlert\Block\Product\View\Stock', + array( + 'helper' => $this->_helper, + 'registry' => $this->_registry, + ) + ); + $this->_layout = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); } - public function testPrepareLayoutUrlIsSet() + public function testSetTemplateStockUrlAllowed() { - $helper = $this->getMockBuilder('Magento\ProductAlert\Helper\Data') - ->disableOriginalConstructor() - ->setMethods(array('isStockAlertAllowed', 'getSaveUrl')) - ->getMock(); - $helper->expects($this->once())->method('isStockAlertAllowed')->will($this->returnValue(true)); - $helper->expects($this->once()) + $this->_helper->expects($this->once())->method('isStockAlertAllowed')->will($this->returnValue(true)); + $this->_helper->expects($this->once()) ->method('getSaveUrl') ->with('stock') ->will($this->returnValue('http://url')); - $product = $this->getMockBuilder('Magento\Catalog\Model\Product') - ->disableOriginalConstructor() - ->setMethods(array('isAvailable', 'getId', '__wakeup')) - ->getMock(); - $product->expects($this->once())->method('getId')->will($this->returnValue(1)); - $product->expects($this->once())->method('isAvailable')->will($this->returnValue(false)); + $this->_product->expects($this->once())->method('isAvailable')->will($this->returnValue(false)); - $registry = $this->getMockBuilder('Magento\Core\Model\Registry') - ->disableOriginalConstructor() - ->setMethods(array('registry')) - ->getMock(); - $registry->expects($this->once()) + $this->_registry->expects($this->once()) ->method('registry') ->with('current_product') - ->will($this->returnValue($product)); + ->will($this->returnValue($this->_product)); - $block = $this->_objectManager->getObject( - 'Magento\ProductAlert\Block\Product\View\Stock', - array( - 'helper' => $helper, - 'registry' => $registry, - ) - ); + $this->_block->setLayout($this->_layout); + $this->_block->setTemplate('path/to/template.phtml'); - $layout = $this->getMockBuilder('Magento\Core\Model\Layout') - ->disableOriginalConstructor() - ->getMock(); + $this->assertEquals('path/to/template.phtml', $this->_block->getTemplate()); + $this->assertEquals('http://url', $this->_block->getSignupUrl()); + } + + /** + * @param bool $stockAlertAllowed + * @param bool $productAvailable + * @dataProvider setTemplateStockUrlNotAllowedDataProvider + */ + public function testSetTemplateStockUrlNotAllowed($stockAlertAllowed, $productAvailable) + { + $this->_helper + ->expects($this->once()) + ->method('isStockAlertAllowed') + ->will($this->returnValue($stockAlertAllowed)); + $this->_helper->expects($this->never())->method('getSaveUrl'); - $block->setTemplate('path/to/template.phtml'); - $block->setLayout($layout); + $this->_product->expects($this->any())->method('isAvailable')->will($this->returnValue($productAvailable)); - $this->assertEquals('path/to/template.phtml', $block->getTemplate()); - $this->assertEquals('http://url', $block->getSignupUrl()); + $this->_registry->expects($this->once()) + ->method('registry') + ->with('current_product') + ->will($this->returnValue($this->_product)); + + $this->_block->setLayout($this->_layout); + $this->_block->setTemplate('path/to/template.phtml'); + + $this->assertEquals('', $this->_block->getTemplate()); + $this->assertNull($this->_block->getSignupUrl()); } - public function testPrepareLayoutTemplateReseted() + public function setTemplateStockUrlNotAllowedDataProvider() { - $block = $this->_objectManager->getObject('Magento\ProductAlert\Block\Product\View\Stock'); - $this->assertEquals('', $block->getTemplate()); + return array( + 'stock alert not allowed' => array(false, false), + 'product is available (no alert)' => array(true, true), + 'stock alert not allowed and product is available' => array(false, true), + ); + } + + public function testSetTemplateNoProduct() + { + $this->_helper->expects($this->once())->method('isStockAlertAllowed')->will($this->returnValue(true)); + $this->_helper->expects($this->never())->method('getSaveUrl'); + + $this->_registry->expects($this->once()) + ->method('registry') + ->with('current_product') + ->will($this->returnValue(null)); + + $this->_block->setLayout($this->_layout); + $this->_block->setTemplate('path/to/template.phtml'); + + $this->assertEquals('', $this->_block->getTemplate()); + $this->assertNull($this->_block->getSignupUrl()); } } diff --git a/dev/tests/unit/testsuite/Magento/Sales/Controller/Billing/AgreementTest.php b/dev/tests/unit/testsuite/Magento/Sales/Controller/Billing/AgreementTest.php new file mode 100644 index 00000000000..ff3c6aeb7da --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Controller/Billing/AgreementTest.php @@ -0,0 +1,162 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Controller\Billing; + +class AgreementTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Controller\Billing\Agreement + */ + protected $_controller; + + /** + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_objectManager; + + /** + * @var \Magento\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_request; + + /** + * @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_registry; + + /** + * @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_session; + + /** + * @var \Magento\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_messageManager; + + /** + * @var \Magento\Sales\Model\Billing\Agreement|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_agreement; + + protected function setUp() + { + $this->_session = $this->getMock('Magento\Customer\Model\Session', array(), array(), '', false); + + $this->_agreement = $this->getMock( + 'Magento\Sales\Model\Billing\Agreement', + array('load', 'getId', 'getCustomerId', 'getReferenceId', 'canCancel', 'cancel', '__wakeup'), + array(), '', false + ); + $this->_agreement->expects($this->once())->method('load')->with(15)->will($this->returnSelf()); + $this->_agreement->expects($this->once())->method('getId')->will($this->returnValue(15)); + $this->_agreement->expects($this->once())->method('getCustomerId')->will($this->returnValue(871)); + + $this->_objectManager = $this->getMock('Magento\ObjectManager'); + $this->_objectManager->expects($this->atLeastOnce())->method('get')->will($this->returnValueMap(array( + array('Magento\Customer\Model\Session', $this->_session), + ))); + $this->_objectManager + ->expects($this->once()) + ->method('create') + ->with('Magento\Sales\Model\Billing\Agreement') + ->will($this->returnValue($this->_agreement)) + ; + + $this->_request = $this->getMock('Magento\App\RequestInterface'); + $this->_request->expects($this->once())->method('getParam')->with('agreement')->will($this->returnValue(15)); + + $response = $this->getMock('Magento\App\ResponseInterface'); + + $redirect = $this->getMock('Magento\App\Response\RedirectInterface'); + + $this->_messageManager = $this->getMock('Magento\Message\ManagerInterface'); + + $context = $this->getMock('Magento\App\Action\Context', array(), array(), '', false); + $context->expects($this->any())->method('getObjectManager')->will($this->returnValue($this->_objectManager)); + $context->expects($this->any())->method('getRequest')->will($this->returnValue($this->_request)); + $context->expects($this->any())->method('getResponse')->will($this->returnValue($response)); + $context->expects($this->any())->method('getRedirect')->will($this->returnValue($redirect)); + $context->expects($this->any())->method('getMessageManager')->will($this->returnValue($this->_messageManager)); + + $this->_registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + + $title = $this->getMock('Magento\App\Action\Title', array(), array(), '', false); + + $this->_controller = new \Magento\Sales\Controller\Billing\Agreement($context, $this->_registry, $title); + } + + public function testCancelActionSuccess() + { + $this->_agreement->expects($this->once())->method('getReferenceId')->will($this->returnValue('r15')); + $this->_agreement->expects($this->once())->method('canCancel')->will($this->returnValue(true)); + $this->_agreement->expects($this->once())->method('cancel'); + + $noticeMessage = 'The billing agreement "r15" has been canceled.'; + $this->_session->expects($this->once())->method('getCustomerId')->will($this->returnValue(871)); + $this->_messageManager->expects($this->once())->method('addNotice')->with($noticeMessage); + $this->_messageManager->expects($this->never())->method('addError'); + + $this->_registry + ->expects($this->once()) + ->method('register') + ->with('current_billing_agreement', $this->identicalTo($this->_agreement)) + ; + + $this->_controller->cancelAction(); + } + + public function testCancelActionAgreementDoesNotBelongToCustomer() + { + $this->_agreement->expects($this->never())->method('canCancel'); + $this->_agreement->expects($this->never())->method('cancel'); + + $errorMessage = 'Please specify the correct billing agreement ID and try again.'; + $this->_session->expects($this->once())->method('getCustomerId')->will($this->returnValue(938)); + $this->_messageManager->expects($this->once())->method('addError')->with($errorMessage); + + $this->_registry->expects($this->never())->method('register'); + + $this->_controller->cancelAction(); + } + + public function testCancelActionAgreementStatusDoesNotAllowToCancel() + { + $this->_agreement->expects($this->once())->method('canCancel')->will($this->returnValue(false)); + $this->_agreement->expects($this->never())->method('cancel'); + + $this->_session->expects($this->once())->method('getCustomerId')->will($this->returnValue(871)); + $this->_messageManager->expects($this->never())->method('addNotice'); + $this->_messageManager->expects($this->never())->method('addError'); + + $this->_registry + ->expects($this->once()) + ->method('register') + ->with('current_billing_agreement', $this->identicalTo($this->_agreement)) + ; + + $this->_controller->cancelAction(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/ThemeDeploymentTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/ThemeDeploymentTest.php index 6b997f46553..e7e8486512e 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/ThemeDeploymentTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/ThemeDeploymentTest.php @@ -58,9 +58,14 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase $this->filesystem->expects($this->any()) ->method('getPath') ->with(\Magento\Filesystem::ROOT) - ->will($this->returnValue(BP)); + ->will($this->returnValue(str_replace('\\', '/', BP))); - $this->_cssUrlResolver = new \Magento\View\Url\CssResolver($this->filesystem); + $viewFilesystem = $this->getMock('Magento\View\Filesystem', array('normalizePath'), array(), '', false); + $viewFilesystem->expects($this->any()) + ->method('normalizePath') + ->will($this->returnArgument(0)); + + $this->_cssUrlResolver = new \Magento\View\Url\CssResolver($this->filesystem, $viewFilesystem); $this->_tmpDir = TESTS_TEMP_DIR . '/tool_theme_deployment'; $this->filesystemAdapter = new \Magento\Filesystem\Driver\File(); @@ -108,7 +113,7 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase $conflictPermitted, $conflictForbidden, 'Conflicts: the following extensions are added both to permitted and forbidden lists: ' . - 'conflict1, conflict2', + 'conflict1, conflict2', ), ); } @@ -119,11 +124,6 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase $forbidden = __DIR__ . '/_files/ThemeDeployment/run/forbidden.php'; $fixture = include __DIR__ . '/_files/ThemeDeployment/run/fixture.php'; - $this->filesystem->expects($this->any()) - ->method('getPath') - ->with(\Magento\Filesystem::ROOT) - ->will($this->returnValue(BP)); - $object = new \Magento\Tools\View\Generator\ThemeDeployment($this->_cssUrlResolver, $this->_tmpDir, $permitted, $forbidden); $object->run($fixture['copyRules']); diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/_files/fixture_themes.php b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/_files/fixture_themes.php index 213cc8694a9..771eafd00a3 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/_files/fixture_themes.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/_files/fixture_themes.php @@ -60,7 +60,7 @@ return array( ), 'filesystem_glob_map' => array( array( - '#.*_.*#', '/base/dir/area_one/fixture/theme_one/', + '*_*', '/base/dir/area_one/fixture/theme_one/', array('/base/dir/area_one/fixture/theme_one/Magento_Core'), ), ), @@ -103,7 +103,7 @@ return array( ), 'filesystem_glob_map' => array( array( - '#.*_.*#', '/base/dir/area_one/fixture/theme_two/', + '*_*', '/base/dir/area_one/fixture/theme_two/', array( '/base/dir/area_one/fixture/theme_two/Fixture_ModuleOne', '/base/dir/area_one/fixture/theme_two/Fixture_ModuleTwo', @@ -160,7 +160,7 @@ return array( ), 'filesystem_glob_map' => array( array( - '#.*_.*#', '/base/dir/area_two/fixture/theme_three/', + '*_*', '/base/dir/area_two/fixture/theme_three/', array(), ), ), diff --git a/dev/tests/unit/testsuite/Magento/Usa/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Usa/Helper/DataTest.php new file mode 100755 index 00000000000..498312d7e0c --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Usa/Helper/DataTest.php @@ -0,0 +1,92 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Usa\Helper; + + +class DataTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Usa\Helper\Data + */ + protected $_helperData; + + /** + * + */ + protected function setUp() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $arguments = array( + 'context' => $this->getMock('Magento\App\Helper\Context', array(), array(), '', false), + 'locale' => $this->getMock('Magento\Core\Model\Locale', array(), array(), '', false) + ); + + $this->_helperData = $helper->getObject('Magento\Usa\Helper\Data', $arguments); + } + + /** + * @covers \Magento\Usa\Helper\Data::displayGirthValue + * @dataProvider shippingMethodDataProvider + */ + public function testDisplayGirthValue($shippingMethod) + { + $this->assertTrue($this->_helperData->displayGirthValue($shippingMethod)); + } + + /** + * @covers \Magento\Usa\Helper\Data::displayGirthValue + */ + public function testDisplayGirthValueFalse() + { + $this->assertFalse($this->_helperData->displayGirthValue('test_shipping_method')); + } + + /** + * @return array shipping method name + */ + public function shippingMethodDataProvider() + { + return array( + array('usps_0_FCLE'), // First-Class Mail Large Envelope + array('usps_1'), // Priority Mail + array('usps_2'), // Priority Mail Express Hold For Pickup + array('usps_3'), // Priority Mail Express + array('usps_4'), // Standard Post + array('usps_6'), // Media Mail + array('usps_INT_1'), // Priority Mail Express International + array('usps_INT_2'), // Priority Mail International + array('usps_INT_4'), // Global Express Guaranteed (GXG) + array('usps_INT_7'), // Global Express Guaranteed Non-Document Non-Rectangular + array('usps_INT_8'), // Priority Mail International Flat Rate Envelope + array('usps_INT_9'), // Priority Mail International Medium Flat Rate Box + array('usps_INT_10'), // Priority Mail Express International Flat Rate Envelope + array('usps_INT_11'), // Priority Mail International Large Flat Rate Box + array('usps_INT_12'), // USPS GXG Envelopes + array('usps_INT_14'), // First-Class Mail International Large Envelope + array('usps_INT_16'), // Priority Mail International Small Flat Rate Box + array('usps_INT_20'), // Priority Mail International Small Flat Rate Envelope + array('usps_INT_26'), // Priority Mail Express International Flat Rate Boxes + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilderTest.php b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilderTest.php new file mode 100644 index 00000000000..b72c4fc0a9d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilderTest.php @@ -0,0 +1,52 @@ +<?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. + * + * @category Magento + * @package Magento + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf; + +class PageBuilderTest extends \PHPUnit_Framework_TestCase +{ + public function testAddDestinationFacilityCodewithUtf8() + { + $page = $this->getMockBuilder('\Zend_Pdf_Page') + ->disableOriginalConstructor() + ->getMock(); + $page->expects($this->once()) + ->method('drawText') + ->with( + $this->equalTo('Nürnberg-Österreich-Zürich'), + $this->anything(), + $this->anything(), + $this->equalTo('UTF-8') + ); + + $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + /** @var \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\PageBuilder $pageBuilder */ + $pageBuilder = $objectManagerHelper->getObject('\Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\PageBuilder'); + $pageBuilder->setPage($page); + $pageBuilder->addDestinationFacilityCode('Nürnberg', 'Österreich', 'Zürich'); + } +} + \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Usps/Source/GenericTest.php b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Usps/Source/GenericTest.php new file mode 100755 index 00000000000..bc6899c7746 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Usps/Source/GenericTest.php @@ -0,0 +1,77 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Usa\Model\Shipping\Carrier\Usps\Source; + +class GenericTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Usa\Model\Shipping\Carrier\Usps\Source\Generic + */ + protected $_generic; + + /** + * @var \Magento\Usa\Model\Shipping\Carrier\Usps + */ + protected $_uspsModel; + + public function setUp() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_uspsModel = $this->getMockBuilder('Magento\Usa\Model\Shipping\Carrier\Usps') + ->setMethods(array('getCode')) + ->disableOriginalConstructor() + ->getMock(); + + $this->_generic = $helper->getObject( + 'Magento\Usa\Model\Shipping\Carrier\Usps\Source\Generic', + array('shippingUsps' => $this->_uspsModel) + ); + } + + /** + * @dataProvider getCodeDataProvider + * @param $expected array + * @param $options Magento\Usa\Model\Shipping\Carrier\Usps::getCode result + */ + public function testToOptionArray($expected, $options) + { + $this->_uspsModel->expects($this->any()) + ->method('getCode') + ->will($this->returnValue($options)); + + $this->assertEquals($expected, $this->_generic->toOptionArray()); + } + + /** + * @return array expected result and return of Magento\Usa\Model\Shipping\Carrier\Usps::getCode + */ + public function getCodeDataProvider() + { + return array( + array(array(array('value' => 'Val', 'label' => 'Label')), array('Val' => 'Label')), + array(array(), false) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/UspsTest.php b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/UspsTest.php new file mode 100755 index 00000000000..9c7fa299abc --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/UspsTest.php @@ -0,0 +1,215 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Usa\Model\Shipping\Carrier; + +class UspsTest extends \PHPUnit_Framework_TestCase +{ + + /** + * @var \Magento\Usa\Model\Shipping\Carrier\Usps + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_httpResponse; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_helper; + + public function setUp() + { + $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $coreStoreConfig = $this->getMockBuilder('\Magento\Core\Model\Store\Config') + ->setMethods(array('getConfigFlag', 'getConfig')) + ->disableOriginalConstructor() + ->getMock(); + $coreStoreConfig->expects($this->any()) + ->method('getConfigFlag') + ->will($this->returnValue(true)); + $coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnCallback(array($this, 'coreStoreConfigGetConfig'))); + + // xml element factory + $xmlElFactory = $this->getMockBuilder('\Magento\Usa\Model\Simplexml\ElementFactory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $xmlElFactory->expects($this->any()) + ->method('create') + ->will( + $this->returnCallback( + function ($data) { + $oM = new \Magento\TestFramework\Helper\ObjectManager($this); + return $oM->getObject('\Magento\Usa\Model\Simplexml\Element', array('data' => $data['data'])); + } + ) + ); + + // rate factory + $rateFactory = $this->getMockBuilder('\Magento\Shipping\Model\Rate\ResultFactory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $rateResult = $this->getMockBuilder('\Magento\Shipping\Model\Rate\Result') + ->disableOriginalConstructor() + ->setMethods(null) + ->getMock(); + $rateFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($rateResult)); + + // rate method factory + $rateMethodFactory = $this->getMockBuilder('\Magento\Shipping\Model\Rate\Result\MethodFactory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $rateMethod = $this->getMockBuilder('Magento\Shipping\Model\Rate\Result\Method') + ->disableOriginalConstructor() + ->setMethods(array('setPrice')) + ->getMock(); + $rateMethod->expects($this->any()) + ->method('setPrice') + ->will($this->returnSelf()); + + $rateMethodFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($rateMethod)); + + // http client + $this->_httpResponse = $this->getMockBuilder('\Zend_Http_Response') + ->disableOriginalConstructor() + ->setMethods(array('getBody')) + ->getMock(); + + $httpClient = $this->getMockBuilder('\Zend_Http_Client') + ->disableOriginalConstructor() + ->setMethods(array('request')) + ->getMock(); + $httpClient->expects($this->any()) + ->method('request') + ->will($this->returnValue($this->_httpResponse)); + + $httpClientFactory = $this->getMockBuilder('\Zend_Http_ClientFactory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $httpClientFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($httpClient)); + + $data = array( + 'id' => 'usps', + 'store' => '1' + ); + + $arguments = array( + 'coreStoreConfig' => $coreStoreConfig, + 'xmlElFactory' => $xmlElFactory, + 'rateFactory' => $rateFactory, + 'rateMethodFactory' => $rateMethodFactory, + 'httpClientFactory' => $httpClientFactory, + 'data' => $data + ); + + $this->_model = $this->_helper->getObject('\Magento\Usa\Model\Shipping\Carrier\Usps', $arguments); + } + + /** + * @dataProvider codeDataProvider + */ + public function testGetCodeArray($code) + { + $this->assertNotEmpty($this->_model->getCode($code)); + } + + public function testGetCodeBool() + { + $this->assertFalse($this->_model->getCode('test_code')); + } + + public function testCollectRates() + { + $this->_httpResponse->expects($this->any()) + ->method('getBody') + ->will($this->returnValue(file_get_contents(__DIR__ . '/_files/success_usps_response_rates.xml'))); + // for setRequest + $request_params = include __DIR__ . '/_files/rates_request_data.php'; + $request = $this->_helper->getObject('Magento\Shipping\Model\Rate\Request', $request_params); + + $this->assertNotEmpty($this->_model->collectRates($request)->getAllRates()); + } + + public function testReturnOfShipment() + { + $this->_httpResponse->expects($this->any()) + ->method('getBody') + ->will( + $this->returnValue( + file_get_contents(__DIR__ . '/_files/success_usps_response_return_shipment.xml') + ) + ); + $request_params = include __DIR__ . '/_files/return_shipment_request_data.php'; + $request = $this->_helper->getObject('Magento\Shipping\Model\Shipment\ReturnShipment', $request_params); + $this->assertNotEmpty($this->_model->returnOfShipment($request)->getInfo()[0]['tracking_number']); + + } + + /** + * Callback function, emulates getConfig function + * @param $path + * @return null|string + */ + public function coreStoreConfigGetConfig($path) + { + switch ($path) { + case 'carriers/usps/allowed_methods': + return '0_FCLE,0_FCL,0_FCP,1,2,3,4,6,7,13,16,17,22,23,25,27,28,33,34,35,36,37,42,43,53,' + . '55,56,57,61,INT_1,INT_2,INT_4,INT_6,INT_7,INT_8,INT_9,INT_10,INT_11,INT_12,INT_13,INT_14,' + . 'INT_15,INT_16,INT_20,INT_26'; + default: + return null; + } + } + + /** + * @return array + */ + public function codeDataProvider() + { + return array( + array('container'), + array('machinable'), + array('method'), + array('size') + ); + } + +} diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/rates_request_data.php b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/rates_request_data.php new file mode 100644 index 00000000000..52663ad4363 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/rates_request_data.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +return array( + 'data' => array( + 'dest_country_id' => 'US', + 'dest_region_id' => '12', + 'dest_region_code' => 'CA', + 'dest_street' => 'main st1', + 'dest_city' => 'Los Angeles', + 'dest_postcode' => '90032', + 'package_value' => '5', + 'package_value_with_discount' => '5', + 'package_weight' => '5', + 'package_qty' => '1', + 'package_physical_value' => '5', + 'free_method_weight' => '5', + 'store_id' => '1', + 'website_id' => '1', + 'free_shipping' => '0', + 'limit_carrier' => 'null', + 'base_subtotal_incl_tax' => '5', + 'orig_country_id' => 'US', + 'country_id' => 'US', + 'region_id' => '12', + 'city'=> 'Culver City', + 'postcode' => '90034', + 'usps_userid' => '213MAGEN6752', + 'usps_container' => 'VARIABLE', + 'usps_size' => 'REGULAR', + 'girth' => null, + 'height' => null, + 'length' => null, + 'width' => null, + ) +); \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/return_shipment_request_data.php b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/return_shipment_request_data.php new file mode 100644 index 00000000000..706fbd94a74 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/return_shipment_request_data.php @@ -0,0 +1,88 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +return array( + 'data' => array( + 'shipper_contact_person_name' => 'testO', + 'shipper_contact_person_first_name' => 'test ', + 'shipper_contact_person_last_name' => 'O', + 'shipper_contact_company_name' => 'testO', + 'shipper_contact_phone_number' => '23424', + 'shipper_email' => 'test@domain.ru', + 'shipper_address_street' => 'mainst1', + 'shipper_address_street1' => 'mainst1', + 'shipper_address_street2' => '', + 'shipper_address_city' => 'Los Angeles', + 'shipper_address_state_or_province_code' => 'CA', + 'shipper_address_postal_code' => '90032', + 'shipper_address_country_code' => 'US', + 'recipient_contact_person_name' => 'DK', + 'recipient_contact_person_first_name' => 'D', + 'recipient_contact_person_last_name' => 'K', + 'recipient_contact_company_name' => 'wsdfsdf', + 'recipient_contact_phone_number' => '234324', + 'recipient_email' => '', + 'recipient_address_street' => '43514 Christy Street', + 'recipient_address_street1' => '43514 Christy Street', + 'recipient_address_street2' => '43514 Christy Street', + 'recipient_address_city' => 'Fremont', + 'recipient_address_state_or_province_code' => 'CA', + 'recipient_address_region_code' => 'CA', + 'recipient_address_postal_code' => '94538', + 'recipient_address_country_code' => 'US', + 'shipping_method' => '6', + 'package_weight' => '5', + 'base_currency_code' => 'USD', + 'store_id' => '1', + 'reference_data' => '#100000001 P', + 'packages' => array( + 1 => array( + 'params' => array( + 'container' => '', + 'weight' => 5, + 'custom_value' => '', + 'length' => '', + 'width' => '', + 'height' => '', + 'weight_units' => 'POUND', + 'dimension_units' => 'INCH', + 'content_type' => '', + 'content_type_other' => '', + 'delivery_confirmation' => 'True' + ), + 'items' => array( + '2' => array( + 'qty' => '1', + 'customs_value' => '5', + 'price' => '5.0000', + 'name' => 'prod1', + 'weight' => '5.0000', + 'product_id' => '1', + 'order_item_id' => 2 + ) + ) + ) + ), + 'order_shipment' => null + ) +); \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/success_usps_response_rates.xml b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/success_usps_response_rates.xml new file mode 100644 index 00000000000..28593bbb920 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/success_usps_response_rates.xml @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<RateV4Response> + <Package ID="0"> + <ZipOrigination>90034</ZipOrigination> + <ZipDestination>90032</ZipDestination> + <Pounds>5</Pounds> + <Ounces>0</Ounces> + <Size>REGULAR</Size> + <Machinable>TRUE</Machinable> + <Zone>1</Zone> + <Postage CLASSID="3"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt;</MailService> + <Rate>24.85</Rate> + </Postage> + <Postage CLASSID="2"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Hold For Pickup</MailService> + <Rate>24.85</Rate> + </Postage> + <Postage CLASSID="23"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Sunday/Holiday Delivery</MailService> + <Rate>37.35</Rate> + </Postage> + <Postage CLASSID="55"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Flat Rate Boxes</MailService> + <Rate>39.95</Rate> + </Postage> + <Postage CLASSID="56"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Flat Rate Boxes Hold For Pickup</MailService> + <Rate>39.95</Rate> + </Postage> + <Postage CLASSID="57"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Sunday/Holiday Delivery Flat Rate Boxes</MailService> + <Rate>52.45</Rate> + </Postage> + <Postage CLASSID="13"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Flat Rate Envelope</MailService> + <Rate>19.95</Rate> + </Postage> + <Postage CLASSID="27"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Flat Rate Envelope Hold For Pickup</MailService> + <Rate>19.95</Rate> + </Postage> + <Postage CLASSID="25"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Sunday/Holiday Delivery Flat Rate Envelope</MailService> + <Rate>32.45</Rate> + </Postage> + <Postage CLASSID="30"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Legal Flat Rate Envelope</MailService> + <Rate>19.95</Rate> + </Postage> + <Postage CLASSID="31"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Legal Flat Rate Envelope Hold For Pickup</MailService> + <Rate>19.95</Rate> + </Postage> + <Postage CLASSID="32"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Sunday/Holiday Delivery Legal Flat Rate Envelope</MailService> + <Rate>32.45</Rate> + </Postage> + <Postage CLASSID="62"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Padded Flat Rate Envelope</MailService> + <Rate>19.95</Rate> + </Postage> + <Postage CLASSID="63"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Padded Flat Rate Envelope Hold For Pickup</MailService> + <Rate>19.95</Rate> + </Postage> + <Postage CLASSID="64"> + <MailService>Priority Mail Express 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Sunday/Holiday Delivery Padded Flat Rate Envelope</MailService> + <Rate>32.45</Rate> + </Postage> + <Postage CLASSID="1"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt;</MailService> + <Rate>8.85</Rate> + </Postage> + <Postage CLASSID="22"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Large Flat Rate Box</MailService> + <Rate>16.85</Rate> + </Postage> + <Postage CLASSID="17"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Medium Flat Rate Box</MailService> + <Rate>12.35</Rate> + </Postage> + <Postage CLASSID="28"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Small Flat Rate Box</MailService> + <Rate>5.80</Rate> + </Postage> + <Postage CLASSID="16"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Flat Rate Envelope</MailService> + <Rate>5.60</Rate> + </Postage> + <Postage CLASSID="44"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Legal Flat Rate Envelope</MailService> + <Rate>5.75</Rate> + </Postage> + <Postage CLASSID="29"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Padded Flat Rate Envelope</MailService> + <Rate>5.95</Rate> + </Postage> + <Postage CLASSID="38"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Gift Card Flat Rate Envelope</MailService> + <Rate>5.60</Rate> + </Postage> + <Postage CLASSID="42"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Small Flat Rate Envelope</MailService> + <Rate>5.60</Rate> + </Postage> + <Postage CLASSID="40"> + <MailService>Priority Mail 1-Day&lt;sup&gt;&#8482;&lt;/sup&gt; + Window Flat Rate Envelope</MailService> + <Rate>5.60</Rate> + </Postage> + <Postage CLASSID="4"> + <MailService>Standard Post&lt;sup&gt;&#174;&lt;/sup&gt;</MailService> + <Rate>8.85</Rate> + </Postage> + <Postage CLASSID="6"> + <MailService>Media Mail&lt;sup&gt;&#174;&lt;/sup&gt;</MailService> + <Rate>4.33</Rate> + </Postage> + <Postage CLASSID="7"> + <MailService>Library Mail</MailService> + <Rate>4.12</Rate> + </Postage> + </Package> +</RateV4Response> \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/success_usps_response_return_shipment.xml b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/success_usps_response_return_shipment.xml new file mode 100644 index 00000000000..d4ed264a289 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/_files/success_usps_response_return_shipment.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<SigConfirmCertifyV3.0Response> + <SignatureConfirmationNumber>420945389449301699320000105074</SignatureConfirmationNumber> + <SignatureConfirmationLabel>JVBERi0xLjINCjUgMCBvYmoNCjw8DQovVHlwZSAvWE9iamVjdA0KL1N1YnR</SignatureConfirmationLabel> + <ToName>D K</ToName> + <ToFirm>ASDAS</ToFirm> + <ToAddress1>43514 Christy Street</ToAddress1> + <ToAddress2>43514 CHRISTY ST</ToAddress2> + <ToCity>FREMONT</ToCity> + <ToState>CA</ToState> + <ToZip5>94538</ToZip5> + <ToZip4>3294</ToZip4> + <Postnet>94538329414</Postnet> +</SigConfirmCertifyV3.0Response> \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/View/FileSystemTest.php b/dev/tests/unit/testsuite/Magento/View/FileSystemTest.php index 6c51e6e7c97..f80b39a8fc0 100644 --- a/dev/tests/unit/testsuite/Magento/View/FileSystemTest.php +++ b/dev/tests/unit/testsuite/Magento/View/FileSystemTest.php @@ -145,4 +145,37 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase $actual = $this->_model->getViewFile($file, $params); $this->assertEquals($expected, $actual); } + + /** + * @param string $path + * @param string $expectedResult + * @dataProvider normalizePathDataProvider + */ + public function testNormalizePath($path, $expectedResult) + { + $result = $this->_model->normalizePath($path); + $this->assertEquals($expectedResult, $result); + } + + public function normalizePathDataProvider() + { + return array( + 'standard path' => array( + '/dir/somedir/somefile.ext', + '/dir/somedir/somefile.ext' + ), + 'one dot path' => array( + '/dir/somedir/./somefile.ext', + '/dir/somedir/somefile.ext', + ), + 'two dots path' => array( + '/dir/somedir/../somefile.ext', + '/dir/somefile.ext', + ), + 'two times two dots path' => array( + '/dir/../somedir/../somefile.ext', + '/somefile.ext', + ), + ); + } } diff --git a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/BaseTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/BaseTest.php index acb19c9e375..5b2a3ccc406 100644 --- a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/BaseTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/BaseTest.php @@ -49,15 +49,23 @@ class BaseTest extends \PHPUnit_Framework_TestCase { $this->directory = $this->getMock( 'Magento\Filesystem\Directory\Read', - array('getAbsolutePath', 'search'), array(), '', false + array(), + array(), + '', + false ); $filesystem = $this->getMock( - 'Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false + 'Magento\Filesystem', + array('getDirectoryRead', '__wakeup'), + array(), + '', + false ); $filesystem->expects($this->once()) ->method('getDirectoryRead') ->with(\Magento\Filesystem::MODULES) ->will($this->returnValue($this->directory)); + $this->fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); $this->model = new Base($filesystem, $this->fileFactory); } @@ -99,8 +107,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase ->expects($this->at($key)) ->method('create') ->with(sprintf($handlePath, $file['module'], $file['handle']), $moduleName) - ->will($this->returnValue($checkResult[$key])) - ; + ->will($this->returnValue($checkResult[$key])); } $this->assertSame($checkResult, $this->model->getFiles($theme, $filePath)); @@ -122,7 +129,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase ), array( array( - array('handle' => 'preset/4', 'module' => 'Fourth'), + array('handle' => 'preset/4', 'module' => 'Four'), ), 'preset/4', ), diff --git a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/ThemeTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/ThemeTest.php index ca1eb089307..2636d6b90f4 100644 --- a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/ThemeTest.php @@ -44,12 +44,14 @@ class ThemeTest extends \PHPUnit_Framework_TestCase protected function setUp() { $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); - $this->_directory = $this->getMock('Magento\Filesystem\Directory\Read', array('search'), array(), '', false); + $this->_directory = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); + $this->_directory->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)); $filesystem->expects($this->any())->method('getDirectoryRead') - ->with(\Magento\Filesystem::THEMES) + ->with($this->equalTo(\Magento\Filesystem::THEMES)) ->will($this->returnValue($this->_directory)); - $this->_fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); $this->_model = new \Magento\View\Layout\File\Source\Override\Theme( $filesystem, $this->_fileFactory @@ -73,9 +75,8 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $filePathTwo = 'design/area/theme_path/Module_Two/layout/override/theme/grand_parent_theme/2.xml'; $this->_directory->expects($this->once()) ->method('search') - ->with('~area\/theme_path\/[\S]+_[\S]+\/layout\/override\/theme\/[\S]+\/[\S]+\.xml~') - ->will($this->returnValue(array($filePathOne, $filePathTwo))) - ; + ->with($this->equalTo('area/theme_path/*_*/layout/override/theme/*/*.xml')) + ->will($this->returnValue(array($filePathOne, $filePathTwo))); $fileOne = new \Magento\View\Layout\File('1.xml', 'Module_One', $parentTheme); $fileTwo = new \Magento\View\Layout\File('2.xml', 'Module_Two', $grandparentTheme); @@ -107,7 +108,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $filePathOne = 'design/area/theme_path/Module_Two/layout/override/theme/grand_parent_theme/preset/3.xml'; $this->_directory->expects($this->once()) ->method('search') - ->with('~area\/theme_path\/[\S]+_[\S]+\/layout\/override\/theme\/[\S]+\/preset\/3\.xml~') + ->with('area/theme_path/*_*/layout/override/theme/*/preset/3.xml') ->will($this->returnValue(array($filePathOne))) ; @@ -138,7 +139,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $this->_directory->expects($this->once()) ->method('search') - ->with('~area\/theme_path\/[\S]+_[\S]+\/layout\/override\/theme\/[\S]+\/[\S]+\.xml~') + ->with('area/theme_path/*_*/layout/override/theme/*/*.xml') ->will($this->returnValue(array($filePath))); $this->_model->getFiles($theme); diff --git a/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php b/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php index b2c506258bb..e0a921ccd34 100644 --- a/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php @@ -38,7 +38,76 @@ class CssResolverTest extends \PHPUnit_Framework_TestCase ->method('getPath') ->with(\Magento\Filesystem::ROOT) ->will($this->returnValue('/base_dir/')); - $this->object = new CssResolver($filesystem); + $viewFilesystem = $this->getMock('Magento\View\Filesystem', array('normalizePath'), array(), '', false); + $viewFilesystem->expects($this->any()) + ->method('normalizePath') + ->will($this->returnValueMap(array( + array( + '/does/not/matter.css', + '/does/not/matter.css' + ), + array( + '/base_dir/pub/assets/new/location/any_new_name.css', + '/base_dir/pub/assets/new/location/any_new_name.css' + ), + array( + '/base_dir\pub/assets\new/location/any_new_name.css', + '/base_dir\pub/assets\new/location/any_new_name.css' + ), + array( + '/base_dir/pub/assets/referenced/di/any_new_name.css', + '/base_dir/pub/assets/referenced/di/any_new_name.css' + ), + array( + '/base_dir/pub/any_new_name.css', + '/base_dir/pub/any_new_name.css' + ), + array( + '/not/base_dir/pub/new/file.css', + '/not/base_dir/pub/new/file.css' + ), + array( + '/base_dir/pub/css/file.css', + '/base_dir/pub/css/file.css' + ), + array( + '/not/base_dir/pub/css/file.css', + '/not/base_dir/pub/css/file.css' + ), + array( + '/base_dir/pub/new/file.css', + '/base_dir/pub/new/file.css' + ), + array( + '/base_dir/pub/assets/referenced/dir/../images/h2.gif', + '/base_dir/pub/assets/referenced/images/h2.gif' + ), + array( + '/base_dir/pub/assets/referenced/dir/Magento_Theme::favicon.ico', + '/base_dir/pub/assets/referenced/dir/Magento_Theme::favicon.ico' + ), + array( + '/base_dir/pub/assets/referenced/dir/original.css', + '/base_dir/pub/assets/referenced/dir/original.css' + ), + array( + '/base_dir/pub/assets/referenced/dir/body.gif', + '/base_dir/pub/assets/referenced/dir/body.gif' + ), + array( + '/base_dir/pub/dir/body.gif', + '/base_dir/pub/dir/body.gif' + ), + array( + '/base_dir/pub/css/body.gif', + '/base_dir/pub/css/body.gif' + ), + array( + '/not/base_dir/pub/css/body.gif', + '/not/base_dir/pub/css/body.gif' + ) + ))); + $this->object = new CssResolver($filesystem, $viewFilesystem); } /** @@ -61,12 +130,6 @@ class CssResolverTest extends \PHPUnit_Framework_TestCase $callback = function ($relativeUrl) { return '/base_dir/pub/assets/referenced/dir/' . $relativeUrl; }; - $callbackWindows = function ($relativeUrl) { - return '/base_dir/pub\assets/referenced\dir/' . $relativeUrl; - }; - $callbackByOrigPath = function ($relativeUrl, $originalPath) { - return dirname($originalPath) . '/' . $relativeUrl; - }; $object = new \Magento\Object(array('resolved_path' => array('body.gif' => '/base_dir/pub/dir/body.gif'))); $objectCallback = array($object, 'getResolvedPath'); @@ -89,27 +152,6 @@ class CssResolverTest extends \PHPUnit_Framework_TestCase $callback, $result, ), - 'back slashes in referenced name' => array( - $source, - '/does/not/matter.css', - '/base_dir/pub/assets/new/location/any_new_name.css', - $callbackWindows, - $result, - ), - 'same directory' => array( - $source, - '/does/not/matter.css', - '/base_dir/pub/assets/referenced/dir/any_new_name.css', - $callback, - $source, - ), - 'directory with superset name' => array( - 'body {background: url(body.gif);}', - '/base_dir/pub/assets/referenced/dir/original.css', - '/base_dir/pub/assets/referenced/dirname/any_new_name.css', - null, - 'body {background: url(../dir/body.gif);}', - ), 'directory with subset name' => array( 'body {background: url(body.gif);}', '/base_dir/pub/assets/referenced/dir/original.css', @@ -124,20 +166,6 @@ class CssResolverTest extends \PHPUnit_Framework_TestCase $objectCallback, 'body {background: url(dir/body.gif);}', ), - 'default resolution without a callback' => array( - 'body {background: url(../body.gif);}', - '/base_dir/pub/original/subdir/original_name.css', - '/base_dir/pub/new/subdir/any_new_name.css', - null, - 'body {background: url(../../original/body.gif);}', - ), - 'callback must receive original path' => array( - 'body {background: url(../body.gif);}', - '/base_dir/pub/original/subdir/original_name.css', - '/base_dir/pub/new/subdir/any_new_name.css', - $callbackByOrigPath, - 'body {background: url(../../original/body.gif);}', - ), ); } diff --git a/dev/tests/unit/testsuite/Magento/View/Url/_files/result.css b/dev/tests/unit/testsuite/Magento/View/Url/_files/result.css index 83bdd9999df..14714dc844d 100644 --- a/dev/tests/unit/testsuite/Magento/View/Url/_files/result.css +++ b/dev/tests/unit/testsuite/Magento/View/Url/_files/result.css @@ -20,16 +20,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -@import url(../../referenced/recursive.css); -@import url("../../referenced/dir/deep/recursive.css"); -body {background: url(../../referenced/dir/body.gif);} -p {background: url(../../referenced/dir/1.gif?param);} -h1 {background: url('../../referenced/h1.gif#param');} h2 {background: url(../../referenced/images/h2.gif?test);} +h2 {background: url(../../referenced/images/h2.gif?test);} a {background: url(data:image/png;)} - -ul {background: url(/absolute.gif);} -ol {background: url(http://example.com/absolute.gif);} li {background: url("https://example.com/absolute.gif");} - -ol.valid {background: url(../../referenced/dir/Namespace_Module::absolute_valid_module.gif)} /* theme file modular */ ol.favicon {background: url(../../referenced/dir/Magento_Theme::favicon.ico)} /* base file */ diff --git a/dev/tests/unit/testsuite/Magento/View/Url/_files/source.css b/dev/tests/unit/testsuite/Magento/View/Url/_files/source.css index 37ef8fe8170..103ced3a7f2 100644 --- a/dev/tests/unit/testsuite/Magento/View/Url/_files/source.css +++ b/dev/tests/unit/testsuite/Magento/View/Url/_files/source.css @@ -20,16 +20,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -@import url(../recursive.css); -@import url("deep/recursive.css"); -body {background: url(body.gif);} -p {background: url(1.gif?param);} -h1 {background: url('../h1.gif#param');} h2 {background: url(../images/h2.gif?test);} +h2 {background: url(../images/h2.gif?test);} a {background: url(data:image/png;)} - -ul {background: url(/absolute.gif);} -ol {background: url(http://example.com/absolute.gif);} li {background: url("https://example.com/absolute.gif");} - -ol.valid {background: url(Namespace_Module::absolute_valid_module.gif)} /* theme file modular */ ol.favicon {background: url(Magento_Theme::favicon.ico)} /* base file */ diff --git a/dev/tests/unit/testsuite/Magento/View/UrlTest.php b/dev/tests/unit/testsuite/Magento/View/UrlTest.php index 974bb50f1ba..21ec47249c0 100644 --- a/dev/tests/unit/testsuite/Magento/View/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/View/UrlTest.php @@ -94,6 +94,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase $dFManager = $this->getMock('Magento\View\DeployedFilesManager', array(), array(), '', false ); + $viewFilesystem = $this->getMock('Magento\View\Filesystem', array(), array(), '', false); // 8. Get default fake url map $urlMap = array('fake' => array('key' => "some_key", 'value' => "some_value")); @@ -101,7 +102,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase // Create model to be tested /** @var $model \Magento\View\Url|\PHPUnit_Framework_MockObject_MockObject */ $model = new \Magento\View\Url( - $filesystem, $urlBuilder, $urlConfig, $viewService, $publisher, $dFManager, $urlMap + $filesystem, $urlBuilder, $urlConfig, $viewService, $publisher, $dFManager, $viewFilesystem, $urlMap ); // Test diff --git a/dev/tools/Magento/Tools/View/Generator/CopyRule.php b/dev/tools/Magento/Tools/View/Generator/CopyRule.php index 9f65333cab0..968bfa52562 100644 --- a/dev/tools/Magento/Tools/View/Generator/CopyRule.php +++ b/dev/tools/Magento/Tools/View/Generator/CopyRule.php @@ -151,18 +151,8 @@ class CopyRule $firstPlaceholderPos = strpos($dirPattern, '*'); $patternBaseDir = substr($dirPattern, 0, $firstPlaceholderPos); $patternTrailing = substr($dirPattern, $firstPlaceholderPos); - $patternTrailing = preg_replace_callback('/[\\\\^$.[\\]|()?*+{}\\-\\/]/', function ($matches) { - switch ($matches[0]) { - case '*': - return '.*'; - case '?': - return '.'; - default: - return '\\'.$matches[0]; - } - }, $patternTrailing, -1); - $paths = $directoryHandler->search('#' . $patternTrailing . '#', $patternBaseDir); + $paths = $directoryHandler->search($patternTrailing, $patternBaseDir); } else { // pattern is already a valid path containing no placeholders $paths = array($dirPattern); diff --git a/dev/tools/Magento/Tools/View/generator.php b/dev/tools/Magento/Tools/View/generator.php index 24fdedbefd0..5f5a9918623 100644 --- a/dev/tools/Magento/Tools/View/generator.php +++ b/dev/tools/Magento/Tools/View/generator.php @@ -62,32 +62,29 @@ if (isset($options['help'])) { $logger->log('Deploying...', \Zend_Log::INFO); try { - $objectManager = new \Magento\ObjectManager\ObjectManager(); - $entityFactory = new Magento\Core\Model\EntityFactory($objectManager); - $filesystem = $entityFactory->create('Magento\Filesystem', array( - 'directoryList' => new \Magento\Filesystem\DirectoryList(BP) - )); - $config = new \Magento\Tools\View\Generator\Config($filesystem, $options); - $fileIteratorFactory = new \Magento\Config\FileIteratorFactory(); - $themes = new \Magento\Core\Model\Theme\Collection($entityFactory, $filesystem, $fileIteratorFactory); - $themes->setItemObjectClass('\Magento\Tools\View\Generator\ThemeLight'); - $themes->addDefaultPattern('*'); - $fallbackFactory = new \Magento\View\Design\Fallback\Factory($filesystem); - $generator = new \Magento\Tools\View\Generator\CopyRule($filesystem, $themes, - $fallbackFactory->createViewFileRule()); + $objectManagerFactory = new \Magento\App\ObjectManagerFactory(); + $objectManager = $objectManagerFactory->create(BP, $_SERVER); + + $config = $objectManager->create('Magento\Tools\View\Generator\Config', array('cmdOptions' => $options)); + $themes = $objectManager->create('Magento\Core\Model\Theme\Collection'); + $themes->setItemObjectClass('Magento\Tools\View\Generator\ThemeLight'); + $themes->addDefaultPattern('*'); + $fallbackFactory = $objectManager->create('Magento\View\Design\Fallback\Factory'); + $generator = $objectManager->create('Magento\Tools\View\Generator\CopyRule', array( + 'themes' => $themes, + 'fallbackRule' => $fallbackFactory->createViewFileRule() + )); $copyRules = $generator->getCopyRules(); - $cssUrlResolver = new \Magento\View\Url\CssResolver($filesystem); - $deployment = new \Magento\Tools\View\Generator\ThemeDeployment( - $cssUrlResolver, - $config->getDestinationDir(), - __DIR__ . '/config/permitted.php', - __DIR__ . '/config/forbidden.php', - $config->isDryRun() - ); + $deployment = $objectManager->create('Magento\Tools\View\Generator\ThemeDeployment', array( + 'destinationHomeDir' => $config->getDestinationDir(), + 'configPermitted' => __DIR__ . '/config/permitted.php', + 'configForbidden' => __DIR__ . '/config/forbidden.php', + 'isDryRun' => $config->isDryRun() + )); $deployment->run($copyRules); } catch (\Exception $e) { $logger->log('Error: ' . $e->getMessage(), \Zend_Log::ERR); exit(1); } -$logger->log('Completed successfully.', \Zend_Log::INFO); +$logger->log('Completed successfully.', \Zend_Log::INFO); \ No newline at end of file diff --git a/lib/Magento/App/Config/FileResolver/Primary.php b/lib/Magento/App/Config/FileResolver/Primary.php index 1c8d7520ed8..72f588eae92 100644 --- a/lib/Magento/App/Config/FileResolver/Primary.php +++ b/lib/Magento/App/Config/FileResolver/Primary.php @@ -65,7 +65,8 @@ class Primary implements \Magento\Config\FileResolverInterface public function get($filename, $scope) { return $this->iteratorFactory->create( - $this->configDirectory, $this->configDirectory->search('#' . preg_quote($filename) . '$#') + $this->configDirectory, + $this->configDirectory->search('{*' . $filename . ',*/*' . $filename . '}') ); } } diff --git a/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php b/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php index 503f1d890be..d29bb043e4b 100644 --- a/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php +++ b/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php @@ -19,7 +19,7 @@ * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -35,19 +35,19 @@ class Primary protected $_appMode; /** - * @var string + * @var \Magento\Filesystem\DirectoryList */ - protected $_configDirectoryPath; + protected $_directoryList; /** * @param string $configDirectoryPath * @param string $appMode */ public function __construct( - $configDirectoryPath, + \Magento\Filesystem\DirectoryList $directoryList, $appMode = \Magento\App\State::MODE_DEFAULT ) { - $this->_configDirectoryPath = $configDirectoryPath; + $this->_directoryList = $directoryList; $this->_appMode = $appMode; } @@ -61,7 +61,7 @@ class Primary $reader = new \Magento\ObjectManager\Config\Reader\Dom( new \Magento\App\Config\FileResolver\Primary( new \Magento\Filesystem( - new \Magento\Filesystem\DirectoryList($this->_configDirectoryPath), + $this->_directoryList, new \Magento\Filesystem\Directory\ReadFactory(), new \Magento\Filesystem\Directory\WriteFactory() ), diff --git a/lib/Magento/App/ObjectManagerFactory.php b/lib/Magento/App/ObjectManagerFactory.php index 9f8b89a4690..6478a4d7ed1 100644 --- a/lib/Magento/App/ObjectManagerFactory.php +++ b/lib/Magento/App/ObjectManagerFactory.php @@ -97,7 +97,7 @@ class ObjectManagerFactory $diConfig = new $configClass($relations, $definitions); $appMode = $options->get(State::PARAM_MODE, State::MODE_DEFAULT); - $configData = $this->_loadPrimaryConfig($directories->getDir(\Magento\Filesystem::ROOT), $appMode); + $configData = $this->_loadPrimaryConfig($directories, $appMode); if ($configData) { $diConfig->extend($configData); @@ -153,15 +153,15 @@ class ObjectManagerFactory /** * Load primary config data * - * @param string $configDirectoryPath + * @param \Magento\Filesystem\DirectoryList $directoryList * @param string $appMode * @return array * @throws \Magento\BootstrapException */ - protected function _loadPrimaryConfig($configDirectoryPath, $appMode) + protected function _loadPrimaryConfig($directoryList, $appMode) { $configData = null; - $primaryLoader = new \Magento\App\ObjectManager\ConfigLoader\Primary($configDirectoryPath, $appMode); + $primaryLoader = new \Magento\App\ObjectManager\ConfigLoader\Primary($directoryList, $appMode); try { $configData = $primaryLoader->load(); } catch (\Exception $e) { diff --git a/lib/Magento/App/Response/Http/FileFactory.php b/lib/Magento/App/Response/Http/FileFactory.php index 480bb31a43c..d96c1456f80 100644 --- a/lib/Magento/App/Response/Http/FileFactory.php +++ b/lib/Magento/App/Response/Http/FileFactory.php @@ -67,7 +67,7 @@ class FileFactory */ public function create($fileName, $content, $contentType = 'application/octet-stream', $contentLength = null) { - $filesystem = $this->_filesystem; + $dir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); $isFile = false; $file = null; if (is_array($content)) { @@ -77,7 +77,7 @@ class FileFactory if ($content['type'] == 'filename') { $isFile = true; $file = $content['value']; - $contentLength = $filesystem->getFileSize($file); + $contentLength = $dir->stat($file)['size']; } } @@ -91,24 +91,22 @@ class FileFactory if (!is_null($content)) { if ($isFile) { - $this->_response->clearBody(); - $this->_response->sendHeaders(); - - if (!$filesystem->isFile($file)) { + if (!$dir->isFile($file)) { throw new \Exception(__('File not found')); } - $stream = $filesystem->fileOpen($file, 'r'); - while ($buffer = $filesystem->fileRead($stream, 1024)) { - print $buffer; + $this->_response->sendHeaders(); + $stream = $dir->openFile($file, 'r'); + while (!$stream->eof()) { + echo $stream->read(1024); } + $stream->close(); flush(); - $filesystem->fileClose($stream); if (!empty($content['rm'])) { - $filesystem->deleteFile($file); + $dir->delete($file); } - exit(0); } else { + $this->_response->clearBody(); $this->_response->setBody($content); } } diff --git a/lib/Magento/Data/Form/Element/AbstractElement.php b/lib/Magento/Data/Form/Element/AbstractElement.php index 550dfc94847..8141d5225f3 100644 --- a/lib/Magento/Data/Form/Element/AbstractElement.php +++ b/lib/Magento/Data/Form/Element/AbstractElement.php @@ -236,14 +236,17 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm public function getElementHtml() { $html = ''; - if ($this->getBeforeElementHtml()) { + if ($this->getBeforeElementHtml() && $this->getBeforeElementHtml() != '') { $html .= '<label class="addbefore" for="' . $this->getHtmlId() . '">' . $this->getBeforeElementHtml() . '</label>'; } $html .= '<input id="' . $this->getHtmlId() . '" name="' . $this->getName() . '" ' . $this->_getUiId() . ' value="' . $this->getEscapedValue() . '" ' . $this->serialize($this->getHtmlAttributes()) . '/>'; - if ($this->getAfterElementHtml()) { - $html.= '<label class="addafter" for="' . $this->getHtmlId() . '">' . $this->getAfterElementHtml() . '</label>'; + if ($this->getAfterElementJs() && $this->getAfterElementJs() != '') { + $html .= $this->getAfterElementJs(); + } + if ($this->getAfterElementHtml() && $this->getAfterElementHtml() != '') { + $html .= '<label class="addafter" for="' . $this->getHtmlId() . '">' . $this->getAfterElementHtml() . '</label>'; } return $html; } @@ -258,6 +261,11 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm return $this->getData('after_element_html'); } + public function getAfterElementJs() + { + return $this->getData('after_element_js'); + } + /** * Render HTML for element's label * diff --git a/lib/Magento/Filesystem/Directory/Read.php b/lib/Magento/Filesystem/Directory/Read.php index debaafdec96..7ac8447a837 100644 --- a/lib/Magento/Filesystem/Directory/Read.php +++ b/lib/Magento/Filesystem/Directory/Read.php @@ -114,21 +114,6 @@ class Read implements ReadInterface { return $this->driver->getRelativePath($this->path, $path); } - /** - * Validate of path existence - * - * @param string $path - * @return bool - * @throws \Magento\Filesystem\FilesystemException - */ - protected function assertExist($path) - { - $absolutePath = $this->driver->getAbsolutePath($this->path, $path); - if ($this->driver->isExists($absolutePath) === false) { - throw new FilesystemException(sprintf('The path "%s" doesn\'t exist', $absolutePath)); - } - return true; - } /** * Retrieve list of all entities in given path @@ -138,16 +123,11 @@ class Read implements ReadInterface */ public function read($path = null) { - $this->assertExist($path); - - $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; - $iterator = new \FilesystemIterator($this->driver->getAbsolutePath($this->path, $path), $flags); + $files = $this->driver->readDirectory($this->driver->getAbsolutePath($this->path, $path)); $result = array(); - /** @var \FilesystemIterator $file */ - foreach ($iterator as $file) { - $result[] = $this->getRelativePath($file->getPathname()); + foreach ($files as $file) { + $result[] = $this->getRelativePath($file); } - sort($result); return $result; } @@ -160,26 +140,17 @@ class Read implements ReadInterface */ public function search($pattern, $path = null) { - clearstatcache(); if ($path) { $absolutePath = $this->driver->getAbsolutePath($this->path, $this->getRelativePath($path)); } else { $absolutePath = $this->path; } - $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; - $iterator = new \RegexIterator( - new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($absolutePath, $flags), \RecursiveIteratorIterator::CHILD_FIRST - ), - $pattern - ); + $files = $this->driver->search($pattern, $absolutePath); $result = array(); - /** @var \FilesystemIterator $file */ - foreach ($iterator as $file) { - $result[] = $this->getRelativePath($file->getPathname()); + foreach ($files as $file) { + $result[] = $this->getRelativePath($file); } - sort($result); return $result; } @@ -204,7 +175,6 @@ class Read implements ReadInterface */ public function stat($path) { - $this->assertExist($path); return $this->driver->stat($this->driver->getAbsolutePath($this->path, $path)); } diff --git a/lib/Magento/Filesystem/Directory/ReadInterface.php b/lib/Magento/Filesystem/Directory/ReadInterface.php index 893f137718c..81aa6e68000 100644 --- a/lib/Magento/Filesystem/Directory/ReadInterface.php +++ b/lib/Magento/Filesystem/Directory/ReadInterface.php @@ -53,9 +53,10 @@ interface ReadInterface * Search all entries for given regex pattern * * @param string $pattern + * @param string $path [optional] * @return array */ - public function search($pattern); + public function search($pattern, $path = null); /** * Check a file or directory exists diff --git a/lib/Magento/Filesystem/Directory/Write.php b/lib/Magento/Filesystem/Directory/Write.php index bd176cd29bf..77055cbcae5 100644 --- a/lib/Magento/Filesystem/Directory/Write.php +++ b/lib/Magento/Filesystem/Directory/Write.php @@ -210,7 +210,6 @@ class Write extends Read implements WriteInterface */ public function changePermissions($path, $permissions) { - $this->assertExist($path); $absolutePath = $this->driver->getAbsolutePath($this->path, $path); return $this->driver->changePermissions($absolutePath, $permissions); } diff --git a/lib/Magento/Filesystem/Driver/File.php b/lib/Magento/Filesystem/Driver/File.php index a112896d8e5..e9ac61e0dee 100644 --- a/lib/Magento/Filesystem/Driver/File.php +++ b/lib/Magento/Filesystem/Driver/File.php @@ -222,6 +222,55 @@ class File implements \Magento\Filesystem\DriverInterface return $result; } + /** + * Read directory + * + * @param string $path + * @return array + * @throws FilesystemException + */ + public function readDirectory($path) + { + try { + $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; + $iterator = new \FilesystemIterator($path, $flags); + $result = array(); + /** @var \FilesystemIterator $file */ + foreach ($iterator as $file) { + $result[] = $file->getPathname(); + } + sort($result); + return $result; + } catch (\Exception $e) { + throw new FilesystemException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Search paths by given regex + * + * @param string $pattern + * @param string $path + * @return array + * @throws FilesystemException + */ + public function search($pattern, $path) + { + clearstatcache(); + $globPattern = rtrim($path, '/') . '/' . ltrim($pattern, '/'); + $result = @glob($globPattern, GLOB_BRACE); + if ($result === false) { + throw new FilesystemException( + sprintf('The "%s" pattern cannot be processed in "%s" path %s', + $pattern, + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** * Renames a file or directory * diff --git a/lib/Magento/Filesystem/DriverInterface.php b/lib/Magento/Filesystem/DriverInterface.php index b594c25cadd..35c6b91932c 100644 --- a/lib/Magento/Filesystem/DriverInterface.php +++ b/lib/Magento/Filesystem/DriverInterface.php @@ -113,6 +113,25 @@ interface DriverInterface */ public function createDirectory($path, $permissions); + /** + * Read directory + * + * @param string $path + * @return array + * @throws FilesystemException + */ + public function readDirectory($path); + + /** + * Search paths by given regex + * + * @param string $pattern + * @param string $path + * @return array + * @throws FilesystemException + */ + public function search($pattern, $path); + /** * Renames a file or directory * diff --git a/lib/Magento/Module/Declaration/FileResolver.php b/lib/Magento/Module/Declaration/FileResolver.php index f3342b586d2..4d6071db046 100644 --- a/lib/Magento/Module/Declaration/FileResolver.php +++ b/lib/Magento/Module/Declaration/FileResolver.php @@ -32,21 +32,21 @@ class FileResolver implements \Magento\Config\FileResolverInterface * * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $directoryReadModule; + protected $modulesDirectory; /** * Config directory with read access * * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $directoryReadConfig; + protected $configDirectory; /** * Root directory with read access * * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $directoryReadRoot; + protected $rootDirectory; /** * File iterator factory @@ -64,9 +64,9 @@ class FileResolver implements \Magento\Config\FileResolverInterface \Magento\Config\FileIteratorFactory $iteratorFactory ) { $this->iteratorFactory = $iteratorFactory; - $this->directoryReadModules = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); - $this->directoryReadConfig = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); - $this->directoryReadRoot = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $this->configDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); } /** @@ -75,28 +75,26 @@ class FileResolver implements \Magento\Config\FileResolverInterface */ public function get($filename, $scope) { - $appCodeDir = $this->directoryReadRoot->getRelativePath( - $this->directoryReadModules->getAbsolutePath() - ); - $configDir = $this->directoryReadRoot->getRelativePath( - $this->directoryReadConfig->getAbsolutePath() - ); - $moduleFileList = $this->directoryReadRoot->search('#.*?/module.xml$#', $appCodeDir); + $moduleDir = $this->modulesDirectory->getAbsolutePath(); + $configDir = $this->configDirectory->getAbsolutePath(); - $mageScopePath = $appCodeDir . '/Magento/'; + $mageScopePath = $moduleDir . '/Magento'; $output = array( 'base' => array(), 'mage' => array(), 'custom' => array(), ); - foreach ($moduleFileList as $file) { + $files = glob($moduleDir . '*/*/etc/module.xml'); + foreach ($files as $file) { $scope = strpos($file, $mageScopePath) === 0 ? 'mage' : 'custom'; - $output[$scope][] = $file; + $output[$scope][] = $this->rootDirectory->getRelativePath($file); + } + $files = glob($configDir . '*/module.xml'); + foreach ($files as $file) { + $output['base'][] = $this->rootDirectory->getRelativePath($file); } - $output['base'] = $this->directoryReadRoot->search('#/module.xml$#', $configDir); - return $this->iteratorFactory->create( - $this->directoryReadRoot, + $this->rootDirectory, array_merge($output['mage'], $output['custom'], $output['base']) ); } diff --git a/lib/Magento/View/Design/Theme/Validator.php b/lib/Magento/View/Design/Theme/Validator.php index a731c9ace95..05ff1d576f4 100644 --- a/lib/Magento/View/Design/Theme/Validator.php +++ b/lib/Magento/View/Design/Theme/Validator.php @@ -68,7 +68,7 @@ class Validator 'message' => __('Field can\'t be empty')), array('name' => 'available', 'class' => 'Zend_Validate_Regex', 'break' => true, 'options' => array('pattern' => '/^(\d+\.\d+\.\d+\.\d+(\-[a-zA-Z0-9]+)?)$|^\*$/'), - 'message' => __('Theme version has not compatible format')) + 'message' => __('Theme version has not compatible format.')) ); $this->addDataValidators('theme_version', $versionValidators); diff --git a/lib/Magento/View/FileSystem.php b/lib/Magento/View/FileSystem.php index 091e4ddb22e..da898555385 100644 --- a/lib/Magento/View/FileSystem.php +++ b/lib/Magento/View/FileSystem.php @@ -62,7 +62,7 @@ class FileSystem */ public function getFilename($fileId, array $params = array()) { - $filePath = $this->_viewService->extractScope($fileId, $params); + $filePath = $this->_viewService->extractScope($this->normalizePath($fileId), $params); $this->_viewService->updateDesignParams($params); return $this->_resolutionPool->getFileStrategy(!empty($params['skipProxy'])) ->getFile($params['area'], $params['themeModel'], $filePath, $params['module']); @@ -92,7 +92,7 @@ class FileSystem */ public function getViewFile($fileId, array $params = array()) { - $filePath = $this->_viewService->extractScope($fileId, $params); + $filePath = $this->_viewService->extractScope($this->normalizePath($fileId), $params); $this->_viewService->updateDesignParams($params); $skipProxy = isset($params['skipProxy']) && $params['skipProxy']; return $this->_resolutionPool->getViewStrategy($skipProxy)->getViewFile($params['area'], @@ -113,7 +113,7 @@ class FileSystem $strategy = $this->_resolutionPool->getViewStrategy($skipProxy); if ($strategy instanceof \Magento\View\Design\FileResolution\Strategy\View\NotifiableInterface) { /** @var $strategy \Magento\View\Design\FileResolution\Strategy\View\NotifiableInterface */ - $filePath = $this->_viewService->extractScope($fileId, $params); + $filePath = $this->_viewService->extractScope($this->normalizePath($fileId), $params); $this->_viewService->updateDesignParams($params); $strategy->setViewFilePathToMap( $params['area'], $params['themeModel'], $params['locale'], $params['module'], $filePath, $targetPath @@ -122,4 +122,29 @@ class FileSystem return $this; } + + /** + * Remove unmeaning path chunks from path + * + * @param string $path + * @return string + */ + public function normalizePath($path) + { + $parts = explode('/', $path); + $result = array(); + + foreach ($parts as $part) { + if ('..' === $part) { + if (!count($result) || ($result[count($result) - 1] == '..')) { + $result[] = $part; + } else { + array_pop($result); + } + } else if ('.' !== $part) { + $result[] = $part; + } + } + return implode('/', $result); + } } diff --git a/lib/Magento/View/Layout/File/Source/Base.php b/lib/Magento/View/Layout/File/Source/Base.php index ed9c7c6c1c1..10512fe978c 100644 --- a/lib/Magento/View/Layout/File/Source/Base.php +++ b/lib/Magento/View/Layout/File/Source/Base.php @@ -68,22 +68,12 @@ class Base implements SourceInterface { $namespace = $module = '*'; $area = $theme->getArea(); - $patternForSearch = str_replace( - array('/', '\*'), - array('\/', '[\S]+'), - preg_quote("~{$namespace}/{$module}/view/{$area}/layout/{$filePath}.xml~") - ); - $files = $this->modulesDirectory->search($patternForSearch); - foreach ($files as $key => $file) { - $files[$key] = $this->modulesDirectory->getAbsolutePath($file); - } - $pattern = "#(?<namespace>[^/]+)/(?<module>[^/]+)/view/" - . preg_quote($area) - . "/layout/" - . preg_quote(rtrim($filePath, '*')) - . "[^/]*\.xml$#i"; + $files = $this->modulesDirectory->search("$namespace/$module/view/{$area}/layout/{$filePath}.xml"); $result = array(); - foreach ($files as $filename) { + $filePath = strtr(preg_quote($filePath), array('\*' => '[^/]+')); + $pattern = "#(?<namespace>[^/]+)/(?<module>[^/]+)/view/{$area}/layout/" . $filePath . "\.xml$#i"; + foreach ($files as $file) { + $filename = $this->modulesDirectory->getAbsolutePath($file); if (!preg_match($pattern, $filename, $matches)) { continue; } diff --git a/lib/Magento/View/Layout/File/Source/Override/Base.php b/lib/Magento/View/Layout/File/Source/Override/Base.php index dc1a22ea967..c5d8db3c84d 100644 --- a/lib/Magento/View/Layout/File/Source/Override/Base.php +++ b/lib/Magento/View/Layout/File/Source/Override/Base.php @@ -68,21 +68,14 @@ class Base implements SourceInterface { $namespace = $module = '*'; $themePath = $theme->getFullPath(); - $patternForSearch = str_replace( - array('/', '\*'), - array('\/', '[\S]+'), - preg_quote("~{$themePath}/{$namespace}_{$module}/layout/override/base/{$filePath}.xml~") - ); - $files = $this->themesDirectory - ->search($patternForSearch); - foreach ($files as $key => $file) { - $files[$key] = $this->themesDirectory->getAbsolutePath($file); - } + $searchPattern = "{$themePath}/{$namespace}_{$module}/layout/override/base/{$filePath}.xml"; + $files = $this->themesDirectory->search($searchPattern); $result = array(); - $pattern = "#/(?<moduleName>[^/]+)/layout/override/base/" - . preg_quote(rtrim($filePath, '*')) - . "[^/]*\.xml$#i"; - foreach ($files as $filename) { + $pattern = "#(?<moduleName>[^/]+)/layout/override/base/" + . strtr(preg_quote($filePath), array('\*' => '[^/]+')) + . "\.xml$#i"; + foreach ($files as $file) { + $filename = $this->themesDirectory->getAbsolutePath($file); if (!preg_match($pattern, $filename, $matches)) { continue; } diff --git a/lib/Magento/View/Layout/File/Source/Override/Theme.php b/lib/Magento/View/Layout/File/Source/Override/Theme.php index 57dd6c02002..fe09cb1985c 100644 --- a/lib/Magento/View/Layout/File/Source/Override/Theme.php +++ b/lib/Magento/View/Layout/File/Source/Override/Theme.php @@ -27,6 +27,7 @@ namespace Magento\View\Layout\File\Source\Override; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; use Magento\Filesystem; +use Magento\Filesystem\Directory\ReadInterface; use Magento\View\Layout\File\Factory; use Magento\Exception; @@ -36,9 +37,9 @@ use Magento\Exception; class Theme implements SourceInterface { /** - * @var Filesystem + * @var ReadInterface */ - private $filesystem; + protected $themesDirectory; /** * @var Factory @@ -53,7 +54,7 @@ class Theme implements SourceInterface Filesystem $filesystem, Factory $fileFactory ) { - $this->filesystem = $filesystem; + $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES); $this->fileFactory = $fileFactory; } @@ -69,13 +70,8 @@ class Theme implements SourceInterface { $namespace = $module = '*'; $themePath = $theme->getFullPath(); - $patternForSearch = str_replace( - array('/', '\*'), - array('\/', '[\S]+'), - preg_quote("~{$themePath}/{$namespace}_{$module}/layout/override/theme/*/{$filePath}.xml~") - ); - - $files = $this->filesystem->getDirectoryRead(Filesystem::THEMES)->search($patternForSearch); + $searchPattern = "{$themePath}/{$namespace}_{$module}/layout/override/theme/*/{$filePath}.xml"; + $files = $this->themesDirectory->search($searchPattern); if (empty($files)) { return array(); @@ -86,12 +82,12 @@ class Theme implements SourceInterface while ($currentTheme = $currentTheme->getParentTheme()) { $themes[$currentTheme->getCode()] = $currentTheme; } - $result = array(); - $pattern = "#(?<module>[^/]+)/layout/override/theme/(?<themeName>[^/]+)/" - . preg_quote(rtrim($filePath, '*')) - . "[^/]*\.xml$#i"; - foreach ($files as $filename) { + $pattern = "#/(?<module>[^/]+)/layout/override/theme/(?<themeName>[^/]+)/" + . strtr(preg_quote($filePath), array('\*' => '[^/]+')) + . "\.xml$#i"; + foreach ($files as $file) { + $filename = $this->themesDirectory->getAbsolutePath($file); if (!preg_match($pattern, $filename, $matches)) { continue; } diff --git a/lib/Magento/View/Layout/File/Source/Theme.php b/lib/Magento/View/Layout/File/Source/Theme.php index 2190eef60bc..463152efb22 100644 --- a/lib/Magento/View/Layout/File/Source/Theme.php +++ b/lib/Magento/View/Layout/File/Source/Theme.php @@ -68,20 +68,11 @@ class Theme implements SourceInterface { $namespace = $module = '*'; $themePath = $theme->getFullPath(); - $patternForSearch = str_replace( - array('/', '\*'), - array('\/', '[\S]+'), - preg_quote("~{$themePath}/{$namespace}_{$module}/layout/{$filePath}.xml~") - ); - $files = $this->themesDirectory->search($patternForSearch); - foreach ($files as $key => $file) { - $files[$key] = $this->themesDirectory->getAbsolutePath($file); - } + $files = $this->themesDirectory->search("{$themePath}/{$namespace}_{$module}/layout/{$filePath}.xml"); $result = array(); - $pattern = "#" . preg_quote($themePath) . "/(?<moduleName>[^/]+)/layout/" - . preg_quote(rtrim($filePath, '*')) - . "[^/]*\.xml$#i"; - foreach ($files as $filename) { + $pattern = "#/(?<moduleName>[^/]+)/layout/" . strtr(preg_quote($filePath), array('\*' => '[^/]+')) . "\.xml$#i"; + foreach ($files as $file) { + $filename = $this->themesDirectory->getAbsolutePath($file); if (!preg_match($pattern, $filename, $matches)) { continue; } diff --git a/lib/Magento/View/Publisher.php b/lib/Magento/View/Publisher.php index f19884542be..9cc5c3eb0fa 100644 --- a/lib/Magento/View/Publisher.php +++ b/lib/Magento/View/Publisher.php @@ -188,6 +188,8 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface */ protected function _publishFile($filePath, $params, $sourcePath) { + $filePath = $this->_viewFileSystem->normalizePath($filePath); + $sourcePath = $this->_viewFileSystem->normalizePath($sourcePath); $targetPath = $this->_buildPublishedFilePath($filePath, $params, $sourcePath); /* Validate whether file needs to be published */ @@ -271,7 +273,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface } return ($this->_viewService->getAppMode() == \Magento\App\State::MODE_DEVELOPER) - && $this->_getExtension($filePath) == self::CONTENT_TYPE_CSS; + && $this->_getExtension($filePath) == self::CONTENT_TYPE_CSS; } /** @@ -354,7 +356,12 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface return $relatedPathPublic; }; try { - $content = $this->_cssUrlResolver->replaceCssRelativeUrls($content, $sourcePath, $publicPath, $callback); + $content = $this->_cssUrlResolver->replaceCssRelativeUrls( + $content, + $this->_viewFileSystem->normalizePath($sourcePath), + $this->_viewFileSystem->normalizePath($publicPath), + $callback + ); } catch (\Magento\Exception $e) { $this->_logger->logException($e); } @@ -384,7 +391,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface protected function _getRelatedViewFile($fileId, $parentFilePath, $parentFileName, &$params) { if (strpos($fileId, \Magento\View\Service::SCOPE_SEPARATOR)) { - $filePath = $this->_viewService->extractScope($fileId, $params); + $filePath = $this->_viewService->extractScope($this->_viewFileSystem->normalizePath($fileId), $params); } else { /* Check if module file overridden on theme level based on _module property and file path */ $themesPath = $this->_filesystem->getPath(\Magento\Filesystem::THEMES); diff --git a/lib/Magento/View/Url.php b/lib/Magento/View/Url.php index 8eb2fd1edc1..89de152d2f9 100644 --- a/lib/Magento/View/Url.php +++ b/lib/Magento/View/Url.php @@ -71,6 +71,11 @@ class Url */ protected $_fileUrlMap; + /** + * @var \Magento\View\FileSystem + */ + protected $_viewFileSystem; + /** * @param \Magento\Filesystem $filesystem * @param \Magento\UrlInterface $urlBuilder @@ -78,6 +83,7 @@ class Url * @param Service $viewService * @param Publisher $publisher * @param DeployedFilesManager $deployedFileManager + * @param \Magento\View\FileSystem $viewFileSystem, * @param array $fileUrlMap */ public function __construct( @@ -87,6 +93,7 @@ class Url \Magento\View\Service $viewService, \Magento\View\Publisher $publisher, \Magento\View\DeployedFilesManager $deployedFileManager, + \Magento\View\FileSystem $viewFileSystem, array $fileUrlMap = array() ) { $this->_filesystem = $filesystem; @@ -95,6 +102,7 @@ class Url $this->_viewService = $viewService; $this->_publisher = $publisher; $this->_deployedFileManager = $deployedFileManager; + $this->_viewFileSystem = $viewFileSystem; $this->_fileUrlMap = $fileUrlMap; } @@ -129,7 +137,7 @@ class Url public function getViewFilePublicPath($fileId, array $params = array()) { $this->_viewService->updateDesignParams($params); - $filePath = $this->_viewService->extractScope($fileId, $params); + $filePath = $this->_viewService->extractScope($this->_viewFileSystem->normalizePath($fileId), $params); $publicFilePath = $this->_getFilesManager()->getPublicFilePath($filePath, $params); @@ -152,11 +160,11 @@ class Url if (strpos($publicFilePath, $dir) === 0) { $relativePath = ltrim(substr($publicFilePath, strlen($dir)), '\\/'); $url = $this->_urlBuilder->getBaseUrl( - array( - '_type' => $urlMap['key'], - '_secure' => $isSecure - ) - ) . $relativePath; + array( + '_type' => $urlMap['key'], + '_secure' => $isSecure + ) + ) . $relativePath; if ($this->_isStaticFilesSigned() && $this->_viewService->isViewFileOperationAllowed()) { $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); diff --git a/lib/Magento/View/Url/CssResolver.php b/lib/Magento/View/Url/CssResolver.php index 8729b563d74..2f665b96ca6 100644 --- a/lib/Magento/View/Url/CssResolver.php +++ b/lib/Magento/View/Url/CssResolver.php @@ -40,13 +40,21 @@ class CssResolver */ protected $filesystem; + /** + * @var \Magento\View\FileSystem + */ + protected $viewFileSystem; + /** * @param \Magento\Filesystem $filesystem + * @param \Magento\View\FileSystem $viewFileSystem */ public function __construct( - \Magento\Filesystem $filesystem + \Magento\Filesystem $filesystem, + \Magento\View\FileSystem $viewFileSystem ) { $this->filesystem = $filesystem; + $this->viewFileSystem = $viewFileSystem; } /** @@ -62,6 +70,8 @@ class CssResolver */ public function replaceCssRelativeUrls($cssContent, $originalPath, $newPath, $cbRelUrlToPublicPath = null) { + $originalPath = $this->viewFileSystem->normalizePath($originalPath); + $newPath = $this->viewFileSystem->normalizePath($newPath); $relativeUrls = $this->_extractCssRelativeUrls($cssContent); foreach ($relativeUrls as $urlNotation => $originalRelativeUrl) { if ($cbRelUrlToPublicPath) { @@ -69,9 +79,9 @@ class CssResolver } else { $filePath = dirname($originalPath) . '/' . $originalRelativeUrl; } - $filePath = $this->_normalizePath(str_replace('\\', '/', $filePath)); + $filePath = $this->viewFileSystem->normalizePath(str_replace('\\', '/', $filePath)); $relativePath = $this->_getFileRelativePath( - $this->_normalizePath(str_replace('\\', '/', $newPath)), $filePath + str_replace('\\', '/', $newPath), $filePath ); $urlNotationNew = str_replace($originalRelativeUrl, $relativePath, $urlNotation); $cssContent = str_replace($urlNotation, $urlNotationNew, $cssContent); @@ -79,31 +89,6 @@ class CssResolver return $cssContent; } - /** - * Remove unmeaning path chunks from path - * - * @param string $path - * @return string - */ - protected function _normalizePath($path) - { - $parts = explode('/', $path); - $result = array(); - - foreach ($parts as $part) { - if ('..' === $part) { - if (!count($result) || ($result[count($result) - 1] == '..')) { - $result[] = $part; - } else { - array_pop($result); - } - } else if ('.' !== $part) { - $result[] = $part; - } - } - return implode('/', $result); - } - /** * Extract non-absolute URLs from a CSS content * diff --git a/pub/lib/mage/deletable-item.js b/pub/lib/mage/deletable-item.js index 3f45b77e1b2..5e8bd091e42 100644 --- a/pub/lib/mage/deletable-item.js +++ b/pub/lib/mage/deletable-item.js @@ -31,7 +31,8 @@ $.widget('mage.deletableItem', { options: { deleteEvent: 'click', - deleteSelector: '[data-role="delete"]' + deleteSelector: '[data-role="delete"]', + hiddenClass: 'hidden' }, /** @@ -77,7 +78,7 @@ * @private */ _onHideDelete: function () { - this.element.find(this.options.deleteSelector).hide(); + this.element.find(this.options.deleteSelector).addClass(this.options.hiddenClass); }, /** @@ -85,7 +86,7 @@ * @private */ _onShowDelete: function () { - this.element.find(this.options.deleteSelector).show(); + this.element.find(this.options.deleteSelector).removeClass(this.options.hiddenClass); } }); })(jQuery); \ No newline at end of file -- GitLab