From 873d38c884fb56411c4ac3bb46a9d4343e4545fe Mon Sep 17 00:00:00 2001 From: mage2-team Date: Fri, 26 Sep 2014 10:30:20 -0700 Subject: [PATCH] 0.1.0-alpha97 * Various improvements: * Implemented a general way of using RSS module * Created a cron job in the Customer module for cleaning the customer_visitor table * Added a warning message to the Use HTTP Only option in the Admin panel * Implemented the Grid component in the Magento UI Library * Reimplemented the URL Rewrites functionality in the new UrlRedirect module * Framework improvements: * Added the ability to install Magento 2 using CLI * Aggregated Magento installation and upgrade into one tool * Refactored CustomerService REST WebApi to be more RESTful * Increased unit and integration test coverage * Moved page asset management to page configuration API, and eliminated the \Magento\Theme\Block\Html\Head block * Eliminated the Root, Html and Title blocks * Themes update: * Removed widgets from the default Magento installation * Fixed bugs: * Fixed an issue with wishlist creation for non-registered customer * Fixed an issue with Google Mapping where Condition did not show correct value * Fixed an issue where there were too many notifications for admin user by default * Fixed a Daylight Savings Time calculation error * Fixed an issue where default cookie path and lifetime were not validated prior to saving * Fixed an issue where current admin password was not required for resetting admin password * Fixed an issue where custom customer attribute or customer address attribute was not accessible when custom_attribute is used as the attribute code * Fixed an issue where integration entity could not be deleted after being searched in grid * Fixed an issue where invalid parameter value was shown in SOAP * Fixed an issue where exception was thrown for Array to String conversion in SOAP * Fixed an issue where exception was thrown due to invalid argument supplied for foreach() statement in REST * Fixed an issue where admin tax notifications did not appear correctly in the System Messages dialog box * Fixed an issue where tax details were missing when viewing order in the Admin panel * Fixed an issue where styles for the storefront store selector were absent * Fixed an issue where customer got 404 page when switching store views on the product page of a product with different URL keys in different store views * Fixed an issue where the Add To Cart button in the MAP pop-up did not work for configurable and bundle products * Fixed an issue where for specifying options for configurable product was absent after adding a product from the MAP pop-up * Fixed an issue where a fatal error was thrown after selecting shipping method on PayPal Express Checkout * Fixed an issue with sending invoice email * Fixed an issue where integration tests failed with a fatal error * Fixed an issue where credit memo entry was not created after performing a refund for an order * Fixed an issue where categories layout for widgets did not work * Fixed an issue where opening a page restricted by ACL lead to blank page instead of the Access Denied page * Fixed an issue where a blank page was displayed instead of the using the Advanced Search result * Fixed an issue where the "Please wait" spinner was absent on Ajax requests for order creation in the Admin panel * Fixed an issue with the main navigation menu location on the page * Modularity: * Implemented the automatic applying of the MAP policy * Indexers: * Eliminated the old Magento_Index module * Search library * Added wildcards filter * Eliminated unused queries and filters * Added IN to Term filter * Moved the "value" attribute from to for the Match query * Refactored the usage of negation * Implemented Request Builder * CatalogSearch adapter * Pluginized adding attribute to search index * Merged base declaration with searchable attributes * Added the following Setup CLI tools in the setup folder * Deployment Configuration Tool * Schema Setup and Update Tool * DB Data Update Tool * Admin User Setup Tool * User Configuration Tool * Installation Tool * Update Tool * GitHub requests: * [#615] (https://github.com/magento/magento2/issues/615) -- Use info as object in checkout_cart_update_items_before * [#659] (https://github.com/magento/magento2/issues/659) -- Recently viewed products sidebar issue * [#660] (https://github.com/magento/magento2/issues/660) -- RSS global setting * [#663] (https://github.com/magento/magento2/issues/663) -- session.save_path not valid * [#445] (https://github.com/magento/magento2/issues/445) -- use of registry in Magento\Tax\Helper\Data * [#646] (https://github.com/magento/magento2/issues/646) -- Fixed flat category indexer bug * [#643] (https://github.com/magento/magento2/issues/643) -- Configurable Products Performance * [#640] (https://github.com/magento/magento2/issues/640) -- [Insight] Files should not be executable * [#667] (https://github.com/magento/magento2/pull/667) -- Tiny improvement on render() method in Column/Renderer/Concat * [#288] (https://github.com/magento/magento2/issues/288) -- Add Cell Phone to Customer Address Form * [#607] (https://github.com/magento/magento2/issues/607) -- sitemap.xml filename is not variable * [#633] (https://github.com/magento/magento2/pull/633) -- Fixed Typo ($_attribite -> $_attribute) * [#634] (https://github.com/magento/magento2/issues/634) -- README.md contains broken link to X.commerce Agreement * [#569] (https://github.com/magento/magento2/issues/569) -- ObjectManager's Factory should be replaceable depending on service * [#654] (https://github.com/magento/magento2/issues/654) -- Demo notice overlapping * Functional tests: * Abandoned carts report * Adding products from wishlist to cart * Create invoice for offline payment methods * Delete products from shopping cart * Delete widget * Global search * Order count report * Order total report --- CHANGELOG.md | 94 +- CONTRIBUTOR_LICENSE_AGREEMENT.html | 131 + README.md | 2 +- .../Magento/AdminNotification/Helper/Data.php | 114 - .../Model/Config/Source/Frequency.php | 2 +- .../Magento/AdminNotification/Model/Feed.php | 28 +- .../Model/System/Message.php | 3 + .../Magento/AdminNotification/composer.json | 11 +- .../Magento/AdminNotification/etc/module.xml | 1 - .../view/adminhtml/layout/default.xml | 10 +- app/code/Magento/Authorization/composer.json | 6 +- app/code/Magento/Authorizenet/composer.json | 18 +- .../Magento/Backend/Block/Media/Uploader.php | 9 +- app/code/Magento/Backend/Block/Page.php | 15 +- app/code/Magento/Backend/Block/Page/Head.php | 113 - .../Block/Page/RequireJs.php} | 39 +- .../Block/System/Account/Edit/Form.php | 23 +- .../Backend/Block/Template/Context.php | 10 +- app/code/Magento/Backend/Block/Urlrewrite.php | 96 - .../Urlrewrite/Catalog/Category/Edit.php | 137 - .../Urlrewrite/Catalog/Category/Tree.php | 196 - .../Block/Urlrewrite/Catalog/Edit/Form.php | 239 - .../Block/Urlrewrite/Catalog/Product/Edit.php | 239 - .../Block/Urlrewrite/Catalog/Product/Grid.php | 88 - .../Block/Urlrewrite/Cms/Page/Edit.php | 136 - .../Block/Urlrewrite/Cms/Page/Edit/Form.php | 175 - .../Block/Urlrewrite/Cms/Page/Grid.php | 113 - .../Magento/Backend/Block/Urlrewrite/Edit.php | 300 - .../Backend/Block/Urlrewrite/Edit/Form.php | 417 -- .../Backend/Block/Urlrewrite/Selector.php | 100 - .../Magento/Backend/Block/Widget/Context.php | 8 + .../Magento/Backend/Block/Widget/Grid.php | 49 - .../Block/Widget/Grid/Column/Filter/Date.php | 11 - .../Grid/Column/Renderer/AbstractRenderer.php | 26 +- .../Widget/Grid/Column/Renderer/Concat.php | 20 +- .../Adminhtml/System/Account/Save.php | 21 +- .../Adminhtml/System/Design/Edit.php | 1 - .../Controller/Adminhtml/Urlrewrite/Save.php | 262 - .../Model/Config/Backend/Cookie/Domain.php | 74 + .../Model/Config/Backend/Cookie/Lifetime.php | 73 + .../Model/Config/Backend/Cookie/Path.php | 72 + .../Backend/Currency/AbstractCurrency.php | 6 +- .../{ => Model/Session}/AdminConfig.php | 18 +- app/code/Magento/Backend/composer.json | 37 +- app/code/Magento/Backend/etc/adminhtml/di.xml | 6 +- .../Magento/Backend/etc/adminhtml/system.xml | 7 +- app/code/Magento/Backend/etc/config.xml | 7 - app/code/Magento/Backend/etc/module.xml | 3 +- app/code/Magento/Backend/i18n/de_DE.csv | 4 +- app/code/Magento/Backend/i18n/en_US.csv | 4 +- app/code/Magento/Backend/i18n/es_ES.csv | 4 +- app/code/Magento/Backend/i18n/fr_FR.csv | 4 +- app/code/Magento/Backend/i18n/nl_NL.csv | 4 +- app/code/Magento/Backend/i18n/pt_BR.csv | 4 +- app/code/Magento/Backend/i18n/zh_CN.csv | 4 +- .../adminhtml/layout/adminhtml_denied.xml | 2 +- .../layout/adminhtml_system_config_edit.xml | 1 - .../layout/adminhtml_urlrewrite_index.xml | 136 - .../Backend/view/adminhtml/layout/default.xml | 181 +- .../Backend/view/adminhtml/layout/editor.xml | 25 +- .../view/adminhtml/templates/admin/page.phtml | 77 + .../adminhtml/templates/admin/popup.phtml | 79 - .../view/adminhtml/templates/page/head.phtml | 68 - .../templates/page/js/head_scripts.phtml | 35 + .../templates/page/js/require_js.phtml | 37 + .../templates/urlrewrite/selector.phtml | 45 - .../adminhtml/templates/widget/grid.phtml | 8 +- .../templates/widget/grid/extended.phtml | 7 +- .../Controller/Adminhtml/Index/Rollback.php | 2 +- app/code/Magento/Backup/Helper/Data.php | 25 +- app/code/Magento/Backup/composer.json | 13 +- app/code/Magento/Backup/etc/module.xml | 1 - .../Catalog/Product/Edit/Tab/Attributes.php | 35 - .../Catalog/Product/View/Type/Bundle.php | 11 +- .../Magento/Bundle/Model/Product/Type.php | 56 - app/code/Magento/Bundle/composer.json | 31 +- app/code/Magento/Bundle/etc/di.xml | 1 - app/code/Magento/Bundle/etc/module.xml | 1 - .../layout/catalog_product_bundle.xml | 10 +- .../templates/product/price/final_price.phtml | 4 +- .../catalog_product_view_type_bundle.xml | 8 +- app/code/Magento/Captcha/composer.json | 14 +- .../layout/checkout_onepage_index.xml | 1 - .../Block/Adminhtml/Category/Edit/Form.php | 8 - .../Adminhtml/Category/Tab/Attributes.php | 59 - .../Block/Adminhtml/Category/Tab/General.php | 143 - .../Adminhtml/Product/Edit/Tab/Attributes.php | 53 - .../Block/Adminhtml/Product/Edit/Tabs.php | 1 - .../Catalog/Block/Adminhtml/Product/Grid.php | 7 +- .../Adminhtml/Product/Helper/Form/Price.php | 2 +- .../Catalog/Block/Adminhtml/Rss/Grid/Link.php | 97 + .../Block/Adminhtml/Rss/NotifyStock.php | 116 + .../Magento/Catalog/Block/Breadcrumbs.php | 4 +- .../Catalog/Block/Category/Rss/Link.php | 104 + .../Magento/Catalog/Block/Category/View.php | 71 +- .../Catalog/Block/Product/AbstractProduct.php | 12 +- .../Block/Product/Compare/ListCompare.php | 12 +- .../Magento/Catalog/Block/Product/Context.php | 10 +- .../Magento/Catalog/Block/Product/Gallery.php | 5 +- .../Block/Product/ProductList/Crosssell.php | 7 - .../Block/Product/ProductList/Related.php | 7 - .../Block/Product/ProductList/Upsell.php | 7 - .../Magento/Catalog/Block/Product/View.php | 64 +- .../Block/Product/View/Options/Type/Date.php | 11 - .../Magento/Catalog/Block/Rss/Category.php | 266 + .../Catalog/Block/Rss/Product/NewProducts.php | 218 + .../Catalog/Block/Rss/Product/Special.php | 267 + .../Magento/Catalog/Block/Widget/Link.php | 75 +- .../Controller/Adminhtml/Category/Edit.php | 1 - .../Controller/Adminhtml/Category/Save.php | 9 +- .../Product/Action/Attribute/Save.php | 3 +- .../Controller/Adminhtml/Product/Edit.php | 2 - .../Product/Initialization/Helper.php | 7 - .../Adminhtml/Product/NewAction.php | 2 - .../Controller/Adminhtml/Product/Set/Edit.php | 2 - .../Controller/Adminhtml/Search/Edit.php | 2 - .../Catalog/Controller/Category/View.php | 10 +- app/code/Magento/Catalog/Helper/Catalog.php | 23 - app/code/Magento/Catalog/Helper/Category.php | 56 - app/code/Magento/Catalog/Helper/Data.php | 245 +- app/code/Magento/Catalog/Helper/Product.php | 31 - .../Magento/Catalog/Helper/Product/View.php | 8 +- app/code/Magento/Catalog/Model/Category.php | 133 +- .../Product/Price/Plugin/CustomerGroup.php | 20 +- .../Magento/Catalog/Model/Indexer/Url.php | 302 - app/code/Magento/Catalog/Model/Observer.php | 22 +- app/code/Magento/Catalog/Model/Product.php | 42 +- .../Magento/Catalog/Model/Product/Action.php | 22 - .../Model/Product/Attribute/Backend/Msrp.php | 78 - .../Product/Attribute/Backend/Urlkey.php | 53 - .../Attribute/Source/Msrp/Type/Enabled.php | 128 - .../Magento/Catalog/Model/Product/Copier.php | 16 +- .../Model/Product/Type/AbstractType.php | 21 +- .../Catalog/Model/Product/Type/Price.php | 0 .../Magento/Catalog/Model/Product/Url.php | 77 +- .../Model/Resource/Category/Collection.php | 18 +- .../Catalog/Model/Resource/Category/Flat.php | 37 +- .../Resource/Category/Flat/Collection.php | 21 +- .../Product/Attribute/Backend/Urlkey.php | 83 - .../Resource/Product/Attribute/Collection.php | 2 - .../Model/Resource/Product/Collection.php | 51 +- .../Product/Indexer/AbstractIndexer.php | 2 +- .../Model/Resource/Product/Indexer/Eav.php | 233 - .../Product/Indexer/Price/DefaultPrice.php | 10 - .../Product/Indexer/Price/PriceInterface.php | 8 - .../Magento/Catalog/Model/Resource/Setup.php | 51 +- .../Magento/Catalog/Model/Resource/Url.php | 833 +-- .../Magento/Catalog/Model/Rss/Category.php | 96 + .../Catalog/Model/Rss/Product/NewProducts.php | 119 + .../Catalog/Model/Rss/Product/NotifyStock.php | 98 + .../Catalog/Model/Rss/Product/Special.php | 89 + .../Backend/Catalog/Url/Rewrite/Suffix.php | 123 +- app/code/Magento/Catalog/Model/Url.php | 1045 ---- app/code/Magento/Catalog/Pricing/Render.php | 1 - .../Pricing/Render/ConfiguredPriceBox.php | 2 +- .../Catalog/Pricing/Render/FinalPriceBox.php | 9 +- .../Catalog/Pricing/Render/PriceBox.php | 1 - .../Service/V1/Product/TierPriceService.php | 3 +- app/code/Magento/Catalog/composer.json | 48 +- .../data-upgrade-1.6.0.0.20-1.6.0.0.21.php | 1 - .../data-upgrade-1.6.0.0.23-1.6.0.0.24.php | 14 - .../data-upgrade-1.6.0.0.28-1.6.0.0.29.php} | 28 +- .../data-upgrade-1.6.0.0.3-1.6.0.0.4.php | 54 - .../data-upgrade-1.6.0.0.5-1.6.0.0.6.php | 4 - app/code/Magento/Catalog/etc/acl.xml | 5 - app/code/Magento/Catalog/etc/adminhtml/di.xml | 7 + .../Magento/Catalog/etc/adminhtml/menu.xml | 1 - .../Magento/Catalog/etc/adminhtml/system.xml | 58 +- .../Catalog/etc/catalog_attributes.xml | 2 - app/code/Magento/Catalog/etc/config.xml | 9 - app/code/Magento/Catalog/etc/di.xml | 15 +- .../Magento/Catalog/etc/eav_attributes.xml | 3 - app/code/Magento/Catalog/etc/module.xml | 7 +- app/code/Magento/Catalog/i18n/de_DE.csv | 14 +- app/code/Magento/Catalog/i18n/en_US.csv | 14 +- app/code/Magento/Catalog/i18n/es_ES.csv | 14 +- app/code/Magento/Catalog/i18n/fr_FR.csv | 14 +- app/code/Magento/Catalog/i18n/nl_NL.csv | 14 +- app/code/Magento/Catalog/i18n/pt_BR.csv | 14 +- app/code/Magento/Catalog/i18n/zh_CN.csv | 14 +- .../sql/catalog_setup/install-1.6.0.0.0.php | 38 - .../layout/catalog_category_edit.xml | 17 +- .../layout/catalog_product_index.xml | 5 + .../adminhtml/layout/catalog_product_new.xml | 28 +- .../catalog/category/edit/form.phtml | 84 +- .../templates/catalog/category/tree.phtml | 75 +- .../templates/catalog/product/edit.phtml | 2 +- .../adminhtml/templates/rss/grid/link.phtml | 29 + .../base/layout/catalog_product_prices.xml | 4 - .../product/price/amount/default.phtml | 14 +- .../product/price/configured_price.phtml | 2 +- .../templates/product/price/final_price.phtml | 21 +- .../templates/product/price/tier_prices.phtml | 9 +- .../frontend/layout/catalog_category_view.xml | 4 +- .../layout/catalog_product_compare_index.xml | 1 - .../frontend/layout/catalog_product_view.xml | 14 +- .../Catalog/view/frontend/layout/default.xml | 4 +- .../frontend/templates/category/rss.phtml} | 4 +- .../view/frontend/web/js/price-option.js | 3 + .../Magento/CatalogImportExport/composer.json | 20 +- .../Magento/CatalogInventory/composer.json | 20 +- app/code/Magento/CatalogInventory/etc/di.xml | 1 - app/code/Magento/CatalogRule/Model/Rule.php | 8 - app/code/Magento/CatalogRule/composer.json | 17 +- app/code/Magento/CatalogRule/etc/module.xml | 1 - .../catalog_rule_promo_catalog_edit.xml | 8 - .../Magento/CatalogSearch/Block/Result.php | 3 +- .../Model/Indexer/Fulltext/Action/Full.php | 9 + .../Model/Search/ReaderPlugin.php | 60 + .../Model/Search/RequestGenerator.php | 163 + app/code/Magento/CatalogSearch/composer.json | 22 +- app/code/Magento/CatalogSearch/etc/di.xml | 3 + .../CatalogSearch/etc/search_request.xml | 44 +- .../layout/catalogsearch_advanced_index.xml | 8 +- .../layout/catalogsearch_advanced_result.xml | 8 +- .../layout/catalogsearch_result_index.xml | 8 +- .../layout/catalogsearch_term_popular.xml | 8 +- .../Block/UrlKeyRenderer.php} | 32 +- .../Magento/CatalogUrlRewrite/Helper/Data.php | 277 - .../Category/CanonicalUrlRewriteGenerator.php | 69 + .../Category/ChildrenCategoriesProvider.php | 63 + .../Category/ChildrenUrlRewriteGenerator.php | 69 + .../CurrentUrlRewritesRegenerator.php | 144 + .../Model/Category/Observer.php | 206 +- .../Model/Category/Plugin/Category/Move.php | 64 + .../Model/Category/Plugin/Category/Remove.php | 107 + .../Model/Category/Plugin/Storage.php | 130 + .../Model/Category/Plugin/Store/Group.php | 165 + .../Model/Category/Plugin/Store/View.php | 171 + .../Model/Category/Product.php} | 15 +- .../Model/CategoryUrlPathGenerator.php | 156 + .../Model/CategoryUrlRewriteGenerator.php | 132 + .../Model/ObjectRegistry.php} | 50 +- .../Product/CanonicalUrlRewriteGenerator.php | 69 + .../Product/CategoriesUrlRewriteGenerator.php | 74 + .../Product/CurrentUrlRewritesRegenerator.php | 179 + .../Model/Product/Observer.php | 66 +- .../Model/Product/Plugin/Import.php | 105 + .../Model/ProductUrlPathGenerator.php | 138 + .../Model/ProductUrlRewriteGenerator.php | 180 + .../Model/Resource/Category/Product.php | 84 + .../Resource/Category/ProductCollection.php | 31 + .../Model/Storage/DbStorage.php | 54 + .../CategorySaveRewritesHistorySetter.php} | 27 +- .../Observer/CategoryUrlPathAutogenerator.php | 54 + .../Observer/ProductUrlKeyAutogenerator.php | 53 + .../Adminhtml/Category/Tab/Attributes.php | 57 + .../Product/Edit/Tab/Attributes.php} | 32 +- .../Product/Initialization/Helper.php} | 45 +- .../Service/V1/AbstractUrlGenerator.php | 40 - .../Service/V1/CategoryUrlGenerator.php | 213 - .../Service/V1/ProductUrlGenerator.php | 254 - .../V1/ProductUrlGeneratorInterface.php | 45 - .../Service/V1/StoreViewService.php | 78 + .../Magento/CatalogUrlRewrite/composer.json | 15 +- .../data-install-1.0.0.0.php | 76 + .../CatalogUrlRewrite/etc/adminhtml/di.xml | 29 +- .../etc/adminhtml/events.xml | 19 +- .../etc/adminhtml/system.xml | 52 + .../etc/catalog_attributes.xml | 33 + .../{Index => CatalogUrlRewrite}/etc/di.xml | 13 +- .../etc/eav_attributes.xml} | 8 +- .../etc/install}/di.xml | 18 +- .../CatalogUrlRewrite/etc/install/events.xml | 42 + .../Magento/CatalogUrlRewrite/etc/module.xml | 10 +- .../install-1.0.0.0.php} | 66 +- app/code/Magento/Centinel/composer.json | 14 +- app/code/Magento/Checkout/Block/Cart.php | 4 +- .../Checkout/Block/Cart/AbstractCart.php | 23 - .../Magento/Checkout/Block/Cart/Coupon.php | 4 +- .../Magento/Checkout/Block/Cart/Shipping.php | 4 +- .../Magento/Checkout/Block/Cart/Sidebar.php | 4 +- .../Magento/Checkout/Block/Cart/Totals.php | 4 +- .../Magento/Checkout/Block/Shipping/Price.php | 4 +- .../Magento/Checkout/Block/Total/Nominal.php | 4 +- .../Checkout/Controller/Cart/Index.php | 2 +- .../Magento/Checkout/Controller/Onepage.php | 0 .../Checkout/Controller/Onepage/Index.php | 2 +- app/code/Magento/Checkout/Model/Cart.php | 11 +- app/code/Magento/Checkout/composer.json | 35 +- app/code/Magento/Checkout/etc/module.xml | 1 + .../frontend/layout/checkout_cart_index.xml | 4 +- .../Checkout/view/frontend/layout/default.xml | 3 + .../templates/cart/item/default.phtml | 27 +- .../templates/cart/item/price/sidebar.phtml | 8 +- .../frontend/templates/cart/minicart.phtml | 14 +- .../frontend/templates/cart/shipping.phtml | 2 +- .../templates/cart/sidebar/default.phtml | 89 +- .../frontend/templates/cart/subtotal.phtml | 31 + .../view/frontend/templates/cart/totals.phtml | 4 - .../frontend/templates/item/price/row.phtml | 4 +- .../frontend/templates/item/price/unit.phtml | 4 +- .../frontend/templates/onepage/billing.phtml | 2 +- .../templates/onepage/review/info.phtml | 16 +- .../templates/onepage/review/item.phtml | 42 +- .../review/item/price/row_excl_tax.phtml | 2 +- .../review/item/price/row_incl_tax.phtml | 2 +- .../review/item/price/unit_excl_tax.phtml | 2 +- .../review/item/price/unit_incl_tax.phtml | 2 +- .../templates/onepage/review/totals.phtml | 2 +- .../frontend/templates/onepage/shipping.phtml | 2 +- .../Magento/CheckoutAgreements/composer.json | 10 +- .../Cms/Block/Adminhtml/Block/Edit/Form.php | 13 - .../Block/Adminhtml/Page/Edit/Tab/Content.php | 13 - app/code/Magento/Cms/Block/Page.php | 10 +- .../Adminhtml/AbstractMassDelete.php | 161 + .../Controller/Adminhtml/Block/MassDelete.php | 52 + .../Controller/Adminhtml/Page/MassDelete.php | 52 + .../Cms/Controller/Adminhtml/Page/Save.php | 12 +- app/code/Magento/Cms/Model/Page.php | 1 + app/code/Magento/Cms/Model/Resource/Page.php | 46 +- .../Model/Resource/Page/Grid/Collection.php | 88 + .../Cms/Ui/DataProvider/Block/Row/Actions.php | 68 + .../Ui/DataProvider/Page/Options/IsActive.php | 66 + .../DataProvider/Page/Options/PageLayout.php} | 47 +- .../Cms/Ui/DataProvider/Page/Row/Actions.php | 87 + app/code/Magento/Cms/composer.json | 19 +- app/code/Magento/Cms/etc/module.xml | 2 +- .../view/adminhtml/layout/cms_block_edit.xml | 18 +- .../view/adminhtml/layout/cms_block_index.xml | 81 +- .../adminhtml/layout/cms_block_listing.xml | 148 + .../view/adminhtml/layout/cms_page_edit.xml | 16 +- .../view/adminhtml/layout/cms_page_index.xml | 2 +- .../adminhtml/layout/cms_page_listing.xml | 150 + .../layout/cms_wysiwyg_images_index.xml | 1 - .../Model/CmsPageUrlPathGenerator.php} | 46 +- .../CmsPageUrlRewriteGenerator.php} | 54 +- .../Magento/CmsUrlRewrite/Model/Observer.php | 36 +- .../Plugin/Cms/Model/Resource/Page.php | 59 + app/code/Magento/CmsUrlRewrite/composer.json | 7 +- .../CmsUrlRewrite/etc/adminhtml/di.xml | 4 +- app/code/Magento/CmsUrlRewrite/etc/module.xml | 5 +- .../ConfigurableImportExport/composer.json | 14 +- .../Model/Product/Type/Configurable.php | 14 +- .../Configurable/Attribute/Collection.php | 189 +- .../Configurable/Attribute/Price/Data.php} | 49 +- .../Magento/ConfigurableProduct/composer.json | 29 +- .../data-install-1.0.0.0.php | 3 - .../ConfigurableProduct/etc/module.xml | 1 - .../install-1.0.0.0.php | 0 .../layout/catalog_product_configurable.xml | 10 +- .../adminhtml/layout/catalog_product_new.xml | 10 +- ...catalog_product_view_type_configurable.xml | 8 +- app/code/Magento/Contact/composer.json | 12 +- .../Contact/view/email/submitted_form.html | 2 +- .../frontend/layout/contact_index_index.xml | 8 +- .../view/frontend/templates/form.phtml | 15 +- app/code/Magento/Core/Helper/Data.php | 12 +- .../Core/Helper/File/Storage/Database.php | 3 +- app/code/Magento/Core/Helper/Url.php | 17 +- .../Core/Model/PageLayout/Config/Builder.php | 2 +- app/code/Magento/Core/composer.json | 16 +- app/code/Magento/Core/etc/body.xsd | 40 + app/code/Magento/Core/etc/di.xml | 5 +- app/code/Magento/Core/etc/head.xsd | 67 + .../indexers_merged.xsd => Core/etc/html.xsd} | 27 +- app/code/Magento/Core/etc/layouts.xsd | 44 + app/code/Magento/Core/etc/page.xsd | 29 +- app/code/Magento/Cron/composer.json | 8 +- .../Model/System/Currencysymbol.php | 40 +- app/code/Magento/CurrencySymbol/composer.json | 14 +- .../Magento/Customer/Block/Address/Book.php | 3 +- .../Magento/Customer/Block/Address/Edit.php | 4 +- app/code/Magento/Customer/Block/Form/Edit.php | 0 .../Magento/Customer/Block/Form/Login.php | 2 +- .../Magento/Customer/Block/Form/Register.php | 5 +- .../Customer/Controller/Account/Edit.php | 2 +- .../Customer/Controller/Account/EditPost.php | 2 +- .../Customer/Controller/Account/Index.php | 2 +- .../Controller/Adminhtml/Group/Save.php | 6 +- .../Adminhtml/Index/MassAssignGroup.php | 2 +- .../Controller/Adminhtml/Index/Save.php | 2 +- app/code/Magento/Customer/Helper/Address.php | 37 +- .../Model/Address/AbstractAddress.php | 2 +- app/code/Magento/Customer/Model/Group.php | 20 - .../Magento/Customer/Model/GroupRegistry.php | 2 +- .../Magento/Customer/Model/Resource/Setup.php | 2 +- app/code/Magento/Customer/Model/Session.php | 0 .../Service/V1/AddressMetadataService.php | 11 +- .../Service/V1/CustomerAccountService.php | 65 +- .../V1/CustomerAccountServiceInterface.php | 45 +- .../V1/CustomerAddressServiceInterface.php | 12 +- .../Service/V1/CustomerGroupService.php | 59 +- .../V1/CustomerGroupServiceInterface.php | 27 +- .../Service/V1/CustomerMetadataService.php | 11 +- .../Data/Eav/AttributeMetadataConverter.php | 14 +- .../Customer/Service/V1/Data/Eav/Option.php | 14 +- .../Service/V1/Data/Eav/OptionBuilder.php | 12 + app/code/Magento/Customer/composer.json | 37 +- app/code/Magento/Customer/etc/module.xml | 1 - app/code/Magento/Customer/etc/webapi.xml | 197 +- .../view/frontend/layout/customer_account.xml | 8 +- .../layout/customer_account_confirmation.xml | 8 +- .../customer_account_createpassword.xml | 8 +- .../customer_account_forgotpassword.xml | 8 +- .../frontend/templates/address/edit.phtml | 4 +- .../view/frontend/templates/form/edit.phtml | 0 .../frontend/templates/form/register.phtml | 4 +- .../CustomerImportExport/composer.json | 16 +- .../Controller/Varien/Router/Standard.php | 20 +- .../Magento/DesignEditor/Model/Observer.php | 42 +- app/code/Magento/DesignEditor/composer.json | 15 +- app/code/Magento/DesignEditor/etc/module.xml | 1 - ...nhtml_system_design_editor_files_index.xml | 1 - ...tml_system_design_editor_firstentrance.xml | 16 +- .../adminhtml_system_design_editor_index.xml | 16 +- .../adminhtml_system_design_editor_launch.xml | 100 +- .../view/adminhtml/templates/editor.phtml | 26 +- app/code/Magento/Dhl/composer.json | 22 +- .../Model/Config/Source/Country/Full.php | 3 + app/code/Magento/Directory/composer.json | 10 +- .../Catalog/Product/Edit/Tab/Downloadable.php | 7 +- .../Controller/Customer/Products.php | 5 +- app/code/Magento/Downloadable/composer.json | 33 +- .../data-upgrade-1.6.0.0.0-1.6.0.0.1.php | 53 - app/code/Magento/Downloadable/etc/module.xml | 1 + ...catalog_product_view_type_downloadable.xml | 4 +- .../templates/catalog/product/links.phtml | 10 +- .../templates/catalog/product/samples.phtml | 8 +- .../checkout/cart/item/default.phtml | 21 +- .../invoice/items/renderer/downloadable.phtml | 2 +- .../view/frontend/web/downloadable.js | 17 + .../Eav/Model/Attribute/Data/AbstractData.php | 8 +- .../Model/Entity/Attribute/Source/Table.php | 24 +- app/code/Magento/Eav/composer.json | 12 +- .../Block/Adminhtml/Template/Edit/Form.php | 20 +- app/code/Magento/Email/composer.json | 13 +- app/code/Magento/Email/etc/module.xml | 1 - .../layout/adminhtml_email_template_edit.xml | 10 +- app/code/Magento/Fedex/composer.json | 18 +- app/code/Magento/GiftMessage/composer.json | 23 +- app/code/Magento/GiftMessage/etc/module.xml | 1 - .../adminhtml/layout/sales_order_view.xml | 10 +- app/code/Magento/GoogleAdwords/composer.json | 8 +- .../Magento/GoogleAnalytics/composer.json | 8 +- .../Magento/GoogleOptimizer/composer.json | 14 +- .../frontend/layout/catalog_category_view.xml | 4 +- .../frontend/layout/catalog_product_view.xml | 4 +- .../view/frontend/layout/cms_page_view.xml | 4 +- .../Model/Attribute/Condition.php | 1 + app/code/Magento/GoogleShopping/composer.json | 21 +- .../GoogleShopping/etc/adminhtml/events.xml | 2 +- .../Magento/GoogleShopping/etc/module.xml | 1 - .../adminhtml_googleshopping_items_index.xml | 14 +- .../view/frontend/layout/cms_index_index.xml | 4 +- .../Magento/GroupedImportExport/composer.json | 14 +- .../Model/Product/Type/Grouped.php | 21 + app/code/Magento/GroupedProduct/composer.json | 24 +- .../Magento/GroupedProduct/etc/module.xml | 2 +- .../layout/catalog_product_grouped.xml | 10 +- .../view/adminhtml/web/js/grouped-product.js | 3 +- .../templates/product/price/final_price.phtml | 2 +- app/code/Magento/ImportExport/composer.json | 14 +- app/code/Magento/Index/App/Indexer.php | 108 - app/code/Magento/Index/App/Shell.php | 88 - .../Magento/Index/Block/Adminhtml/Process.php | 39 - .../Index/Block/Adminhtml/Process/Edit.php | 106 - .../Block/Adminhtml/Process/Edit/Tab/Main.php | 131 - .../Index/Block/Adminhtml/Process/Grid.php | 326 - .../Index/Controller/Adminhtml/Process.php | 92 - .../Controller/Adminhtml/Process/Edit.php | 52 - .../Adminhtml/Process/MassChangeMode.php | 61 - .../Adminhtml/Process/MassReindex.php | 60 - .../Adminhtml/Process/ReindexProcess.php | 56 - .../Controller/Adminhtml/Process/Save.php | 57 - app/code/Magento/Index/Model/Event.php | 384 -- .../Magento/Index/Model/EventRepository.php | 68 - app/code/Magento/Index/Model/Indexer.php | 339 -- .../Index/Model/Indexer/AbstractIndexer.php | 181 - .../Magento/Index/Model/Indexer/Config.php | 72 - .../Index/Model/Indexer/Config/Converter.php | 61 - .../Model/Indexer/Config/SchemaLocator.php | 72 - .../Magento/Index/Model/IndexerInterface.php | 100 - app/code/Magento/Index/Model/Lock/Storage.php | 83 - app/code/Magento/Index/Model/Observer.php | 154 - app/code/Magento/Index/Model/Process.php | 634 -- app/code/Magento/Index/Model/Process/File.php | 134 - .../Magento/Index/Model/Resource/Event.php | 135 - .../Index/Model/Resource/Event/Collection.php | 136 - .../Magento/Index/Model/Resource/Process.php | 180 - .../Model/Resource/Process/Collection.php | 72 - .../Magento/Index/Model/Resource/Setup.php | 106 - app/code/Magento/Index/Model/Shell.php | 268 - .../Model/System/Message/IndexOutdated.php | 128 - app/code/Magento/Index/etc/events.xml | 48 - app/code/Magento/Index/etc/indexers.xsd | 97 - app/code/Magento/Index/i18n/de_DE.csv | 42 - app/code/Magento/Index/i18n/en_US.csv | 42 - app/code/Magento/Index/i18n/es_ES.csv | 42 - app/code/Magento/Index/i18n/fr_FR.csv | 42 - app/code/Magento/Index/i18n/nl_NL.csv | 42 - app/code/Magento/Index/i18n/pt_BR.csv | 42 - app/code/Magento/Index/i18n/zh_CN.csv | 42 - .../Index/sql/index_setup/install-1.6.0.0.php | 189 - .../layout/adminhtml_process_edit.xml | 38 - app/code/Magento/Indexer/App/Indexer.php | 5 - .../Indexer/Block/Backend/Container.php | 2 +- .../Adminhtml/Indexer/ListAction.php | 2 +- .../Model/Resource/AbstractResource.php | 2 +- app/code/Magento/Indexer/composer.json | 8 +- app/code/Magento/Indexer/etc/acl.xml | 2 +- .../Magento/Indexer/etc/adminhtml/menu.xml | 2 +- app/code/Magento/Indexer/i18n/de_DE.csv | 4 +- app/code/Magento/Indexer/i18n/en_US.csv | 4 +- app/code/Magento/Indexer/i18n/es_ES.csv | 4 +- app/code/Magento/Indexer/i18n/fr_FR.csv | 4 +- app/code/Magento/Indexer/i18n/nl_NL.csv | 4 +- app/code/Magento/Indexer/i18n/pt_BR.csv | 4 +- app/code/Magento/Indexer/i18n/zh_CN.csv | 4 +- app/code/Magento/Install/composer.json | 14 +- .../Install/view/adminhtml/layout/default.xml | 10 +- .../Install/view/install/templates/page.phtml | 5 - app/code/Magento/Integration/composer.json | 17 +- app/code/Magento/Integration/etc/module.xml | 1 - .../layout/adminhtml_integration_index.xml | 10 +- .../layout/adminhtml_integration_new.xml | 12 +- .../integration/popup_container.phtml | 4 +- .../Magento/LayeredNavigation/composer.json | 8 +- .../{page_one_column.xml => 1column.xml} | 0 ...two_columns_left.xml => 2columns-left.xml} | 0 ...o_columns_right.xml => 2columns-right.xml} | 0 .../{page_three_columns.xml => 3columns.xml} | 0 .../catalog_category_view_type_layered.xml | 8 +- .../layout/catalogsearch_advanced_result.xml | 2 +- app/code/Magento/Log/composer.json | 14 +- ...ine_index.xml => visitor_online_index.xml} | 0 .../Adminhtml/Product/Helper/Form/Type.php | 76 + .../Product/Helper/Form/Type/Price.php | 66 + .../Widget/Link.php => Msrp/Block/Popup.php} | 49 +- .../Block/Total.php} | 53 +- app/code/Magento/Msrp/Helper/Data.php | 180 + app/code/Magento/Msrp/Model/Config.php | 150 + .../code/Magento/Msrp/Model/Msrp.php | 51 +- .../Frontend/Quote/SetCanApplyMsrp.php | 20 +- .../Model/Product/Attribute/Source}/Type.php | 17 +- .../Product/Attribute/Source}/Type/Price.php | 37 +- .../Magento/Msrp/Model/Product/Options.php | 93 + .../Model/Quote/Address/Total.php} | 27 +- .../Catalog/Product/Edit/Tab/Attributes.php | 65 + .../Pricing/Price/MsrpPrice.php | 43 +- .../Pricing/Price/MsrpPriceInterface.php | 6 +- app/code/Magento/Msrp/composer.json | 29 + .../data/msrp_setup/data-install-1.0.0.0.php} | 55 +- app/code/Magento/Msrp/etc/adminhtml/di.xml | 30 + .../Magento/Msrp/etc/adminhtml/system.xml | 51 + .../Magento/Msrp/etc/catalog_attributes.xml | 7 +- app/code/Magento/Msrp/etc/config.xml | 37 + app/code/Magento/Msrp/etc/di.xml | 64 + app/code/Magento/Msrp/etc/frontend/events.xml | 30 + .../{UrlRedirect => Msrp}/etc/module.xml | 14 +- app/code/Magento/Msrp/etc/sales.xml | 32 + .../base/layout/catalog_product_prices.xml | 39 + .../base/templates/product/price/msrp.phtml} | 34 +- .../view/base/web/js/msrp.js | 35 +- .../frontend/layout/catalog_category_view.xml | 6 +- .../layout/catalog_product_compare_index.xml | 28 + .../frontend/layout/catalog_product_view.xml | 39 + ...atalog_product_view_type_downloadable.xml} | 9 +- .../layout/catalogsearch_advanced_result.xml | 2 +- .../layout/catalogsearch_result_index.xml | 2 +- .../frontend/layout/checkout_cart_index.xml} | 15 +- .../layout/checkout_onepage_failure.xml | 2 +- .../layout/checkout_onepage_success.xml | 2 +- .../Msrp/view/frontend/layout/default.xml | 34 + .../view/frontend/layout/msrp_popup.xml} | 2 +- .../frontend/layout/review_product_list.xml | 4 +- ...ist_index_configure_type_downloadable.xml} | 6 +- .../frontend/layout/wishlist_index_index.xml | 4 +- .../frontend/layout/wishlist_search_view.xml | 4 +- .../frontend/layout/wishlist_shared_index.xml | 4 +- .../frontend/templates/cart/subtotal.phtml | 19 +- .../view/frontend/templates/cart/totals.phtml | 27 + .../view/frontend/templates}/popup.phtml | 19 +- .../render/item/price_msrp_item.phtml | 2 +- .../render/item/price_msrp_rss.phtml | 2 +- .../Block/Checkout/Address/Select.php | 4 +- .../Block/Checkout/Addresses.php | 5 +- .../Multishipping/Block/Checkout/Billing.php | 5 +- .../Multishipping/Block/Checkout/Overview.php | 7 +- .../Multishipping/Block/Checkout/Shipping.php | 4 +- .../Multishipping/Controller/Checkout.php | 0 .../Checkout/Address/EditAddress.php | 7 +- .../Checkout/Address/EditBilling.php | 6 +- .../Checkout/Address/EditShipping.php | 6 +- .../Checkout/Address/NewBilling.php | 6 +- .../Checkout/Address/NewShipping.php | 6 +- app/code/Magento/Multishipping/composer.json | 20 +- .../templates/checkout/overview.phtml | 50 +- .../templates/checkout/overview/item.phtml | 60 +- .../templates/checkout/shipping.phtml | 76 +- .../Newsletter/Block/Adminhtml/Queue/Edit.php | 13 - .../Block/Adminhtml/Template/Edit.php | 8 +- .../Newsletter/Controller/Manage/Index.php | 2 +- .../Newsletter/Controller/Manage/Save.php | 2 +- .../Model/Plugin/CustomerPlugin.php | 4 +- .../Newsletter/Model/Resource/Queue.php | 2 +- app/code/Magento/Newsletter/composer.json | 23 +- app/code/Magento/Newsletter/etc/module.xml | 1 - .../layout/newsletter_queue_edit.xml | 16 +- .../layout/newsletter_queue_preview.xml | 20 +- .../layout/newsletter_template_edit.xml | 16 +- .../layout/newsletter_template_preview.xml | 20 +- .../templates/preview/iframeswitcher.phtml | 11 - .../Magento/OfflinePayments/composer.json | 6 +- .../Magento/OfflineShipping/composer.json | 20 +- app/code/Magento/Ogone/composer.json | 12 +- .../App/FrontController/BuiltinPlugin.php | 0 .../App/FrontController/VarnishPlugin.php | 0 app/code/Magento/PageCache/composer.json | 8 +- .../view/frontend/layout/default.xml | 3 +- .../PayPalRecurringPayment/composer.json | 16 +- app/code/Magento/Payment/composer.json | 14 +- .../AbstractExpress/SaveShippingMethod.php | 2 +- app/code/Magento/Paypal/composer.json | 30 +- .../layout/adminhtml_system_config_edit.xml | 10 +- .../view/frontend/layout/customer_account.xml | 8 +- .../layout/paypal_payflowexpress_review.xml | 4 +- .../templates/billing/agreement/view.phtml | 158 +- .../templates/billing/agreements.phtml | 2 +- .../frontend/templates/express/review.phtml | 95 +- .../templates/express/review/details.phtml | 24 +- .../express/review/shipping/method.phtml | 2 +- app/code/Magento/Persistent/composer.json | 16 +- app/code/Magento/ProductAlert/composer.json | 12 +- .../Controller/RecurringPayment.php | 2 +- .../Magento/RecurringPayment/composer.json | 26 +- .../layout/sales_recurringpayment_index.xml | 8 +- app/code/Magento/Reports/composer.json | 36 +- .../Reports/view/frontend/layout/default.xml | 4 - .../RequireJs/Block/Html/Head/Config.php | 22 +- app/code/Magento/RequireJs/composer.json | 5 +- app/code/Magento/RequireJs/etc/module.xml | 6 +- .../Magento/Review/Block/Adminhtml/Grid.php | 5 +- .../Magento/Review/Block/Adminhtml/Rss.php | 123 + .../Review/Block/Adminhtml/Rss/Grid/Link.php | 98 + .../Magento/Review/Block/Product/View.php | 1 + .../Adminhtml/Product/NewAction.php | 2 - .../Review/Controller/Customer/Index.php | 2 +- .../Review/Controller/Customer/View.php | 2 +- app/code/Magento/Review/Model/Rss.php | 71 + app/code/Magento/Review/composer.json | 22 +- app/code/Magento/Review/etc/adminhtml/di.xml | 7 + .../adminhtml/layout/review_product_index.xml | 32 + .../adminhtml/templates/rss/grid/link.phtml | 29 + .../Rss/App/Action/Plugin/Authentication.php | 44 +- .../Rss/Block/Catalog/AbstractCatalog.php | 103 - .../Magento/Rss/Block/Catalog/Category.php | 238 - .../Magento/Rss/Block/Catalog/NewCatalog.php | 236 - .../Magento/Rss/Block/Catalog/NotifyStock.php | 159 - app/code/Magento/Rss/Block/Catalog/Review.php | 139 - .../Magento/Rss/Block/Catalog/Salesrule.php | 141 - .../Magento/Rss/Block/Catalog/Special.php | 277 - app/code/Magento/Rss/Block/Feeds.php | 103 + app/code/Magento/Rss/Block/ListBlock.php | 252 - app/code/Magento/Rss/Block/Order/NewOrder.php | 138 - app/code/Magento/Rss/Block/Order/Status.php | 131 - .../Magento/Rss/Controller/Adminhtml/Feed.php | 65 + .../{Catalog/Review.php => Feed/Index.php} | 35 +- .../Controller/Adminhtml/Order/NewAction.php | 40 - .../Rss/Controller/{Catalog.php => Feed.php} | 65 +- .../Notifystock.php => Feed/Index.php} | 35 +- app/code/Magento/Rss/Controller/Index.php | 22 +- app/code/Magento/Rss/Helper/Order.php | 133 - app/code/Magento/Rss/Model/Rss.php | 74 +- app/code/Magento/Rss/Model/RssManager.php | 90 + app/code/Magento/Rss/Model/UrlBuilder.php | 68 + app/code/Magento/Rss/composer.json | 15 +- app/code/Magento/Rss/etc/adminhtml/system.xml | 26 - .../etc/adminhtml/menu.xml => Rss/etc/di.xml} | 7 +- app/code/Magento/Rss/etc/module.xml | 13 - .../Rss/view/frontend/layout/default.xml | 5 +- .../frontend/layout/rss_catalog_category.xml | 36 - .../view/frontend/layout/rss_catalog_new.xml | 37 - .../view/frontend/layout/rss_index_index.xml | 2 +- .../Rss/view/frontend/templates/feeds.phtml | 49 + .../Rss/view/frontend/templates/list.phtml | 66 - app/code/Magento/Rule/composer.json | 12 +- .../Block/Adminhtml}/Order/Details.php | 6 +- .../Block/Adminhtml/Order/Totals/Tax.php | 26 +- .../Block/Adminhtml/Rss/Order/Grid/Link.php} | 64 +- .../Magento/Sales/Block/Order/Creditmemo.php | 5 +- .../Magento/Sales/Block/Order/History.php | 8 - app/code/Magento/Sales/Block/Order/Info.php | 4 +- .../Sales/Block/Order/Info/Buttons/Rss.php | 120 + .../Magento/Sales/Block/Order/Invoice.php | 5 +- .../Block/Order/PrintOrder/Creditmemo.php | 4 +- .../Sales/Block/Order/PrintOrder/Invoice.php | 5 +- .../Sales/Block/Order/PrintOrder/Shipment.php | 5 +- .../Sales/Block/Order/PrintShipment.php | 4 +- app/code/Magento/Sales/Block/Order/View.php | 5 +- .../Invoice/AbstractInvoice/Email.php | 2 +- .../Magento/Sales/Controller/Guest/Form.php | 2 +- .../Sales/Controller/Order/History.php | 2 +- .../Sales/Model/Order/Address/Validator.php | 2 +- .../OrderRepository/Plugin/Authorization.php | 76 + .../Sales/Model/Resource/Order/Address.php | 2 +- .../Sales/Model/Resource/Order/Creditmemo.php | 23 +- .../Model/Resource/Order/Rss/OrderStatus.php} | 18 +- .../Sales/Model/Resource/Order/Shipment.php | 21 +- app/code/Magento/Sales/Model/Rss/NewOrder.php | 171 + .../Magento/Sales/Model/Rss/OrderStatus.php | 237 + .../Magento/Sales/Model/Service/Quote.php | 2 +- .../Sales/Service/V1/Data/OrderPayment.php | 2 +- app/code/Magento/Sales/composer.json | 44 +- .../{Index => Sales}/etc/adminhtml/di.xml | 6 +- .../Magento/Sales/etc/adminhtml/system.xml | 9 + .../Magento/Sales/etc/catalog_attributes.xml | 3 - app/code/Magento/Sales/etc/di.xml | 7 + .../Magento/Sales/etc/frontend/events.xml | 3 - app/code/Magento/Sales/etc/sales.xml | 1 - app/code/Magento/Sales/etc/webapi_rest/di.xml | 3 + app/code/Magento/Sales/etc/webapi_soap/di.xml | 3 + .../Sales/sql/sales_setup/install-1.6.0.0.php | 4 +- .../layout/sales_order_create_index.xml | 18 +- .../layout/sales_order_grid_block.xml | 3 + .../adminhtml/layout/sales_order_view.xml | 12 +- .../adminhtml}/templates/order/details.phtml | 0 .../templates/rss/order/grid/link.phtml | 29 + .../layout/sales_guest_creditmemo.xml | 3 + .../frontend/layout/sales_guest_invoice.xml | 3 + .../frontend/layout/sales_guest_shipment.xml | 3 + .../view/frontend/layout/sales_guest_view.xml | 7 +- .../layout/sales_order_creditmemo.xml | 3 + .../frontend/layout/sales_order_invoice.xml | 3 + .../frontend/layout/sales_order_shipment.xml | 3 + .../view/frontend/layout/sales_order_view.xml | 3 + .../frontend/templates/items/price/row.phtml | 2 +- .../frontend/templates/items/price/unit.phtml | 2 +- .../templates/order/info/buttons/rss.phtml | 31 + .../order/items/renderer/default.phtml | 1 - .../Magento/SalesRule/Block/Rss/Discounts.php | 191 + .../Magento/SalesRule/Model/Rss/Discounts.php | 69 + app/code/Magento/SalesRule/composer.json | 34 +- .../SalesRule/etc/adminhtml/system.xml | 8 + app/code/Magento/SalesRule/etc/di.xml | 7 + .../layout/sales_rule_promo_quote_edit.xml | 8 - app/code/Magento/Sendfriend/composer.json | 14 +- .../Magento/Shipping/Block/Order/Shipment.php | 5 +- app/code/Magento/Shipping/composer.json | 26 +- .../Sitemap/Block/Adminhtml/Edit/Form.php | 2 +- .../Controller/Adminhtml/Sitemap/Save.php | 7 +- app/code/Magento/Sitemap/Helper/Data.php | 45 +- .../Model/Resource/Catalog/Category.php | 30 +- .../Model/Resource/Catalog/Product.php | 22 +- app/code/Magento/Sitemap/composer.json | 17 +- app/code/Magento/Sitemap/etc/config.xml | 7 + app/code/Magento/Sitemap/etc/module.xml | 1 + .../Magento/Store/Block/Store/Switcher.php | 11 +- app/code/Magento/Store/Block/Switcher.php | 9 +- app/code/Magento/Store/Model/Store.php | 30 +- .../code/Magento/Store/Ui/DataType/Store.php | 10 +- app/code/Magento/Store/composer.json | 10 +- app/code/Magento/Store/etc/module.xml | 2 +- .../view/base/layout/ui_components.xml} | 13 +- .../view/base}/requirejs-config.js | 9 +- .../view/base/web/js/listing/filter/store.js | 108 + .../view/base/web/templates/filter/store.html | 13 + .../base/web/templates/filter/store/item.html | 9 + .../frontend/templates/switch/stores.phtml | 18 +- .../Block/Checkout/Cart/Sidebar/Totals.php | 4 +- .../Magento/Tax/Block/Checkout/Discount.php | 4 +- .../Magento/Tax/Block/Checkout/Grandtotal.php | 4 +- .../Magento/Tax/Block/Checkout/Shipping.php | 4 +- .../Tax/Block/Checkout/Shipping/Price.php | 13 +- .../Magento/Tax/Block/Checkout/Subtotal.php | 4 +- app/code/Magento/Tax/Helper/Data.php | 129 +- .../Model/System/Message/Notifications.php | 15 +- .../Magento/Tax/Pricing/Render/Adjustment.php | 21 +- app/code/Magento/Tax/composer.json | 29 +- app/code/Magento/Tax/etc/module.xml | 1 - .../view/adminhtml/layout/tax_rule_edit.xml | 22 +- .../base/layout/catalog_product_prices.xml | 10 - .../base/templates/pricing/adjustment.phtml | 9 +- .../templates/pricing/adjustment/bundle.phtml | 8 +- .../pricing/adjustment/downloadable.phtml | 42 - .../checkout/cart/item/price/sidebar.phtml | 31 +- .../checkout/cart/minicart/totals.phtml | 17 +- .../templates/checkout/shipping/price.phtml | 14 +- .../frontend/templates/item/price/row.phtml | 8 +- .../item/price/total_after_discount.phtml | 2 +- .../frontend/templates/item/price/unit.phtml | 8 +- .../Magento/TaxImportExport/composer.json | 12 +- app/code/Magento/Theme/Block/Html.php | 258 - app/code/Magento/Theme/Block/Html/Head.php | 479 -- app/code/Magento/Theme/Block/Html/Title.php | 40 +- .../Magento/Theme/Model/Favicon/Favicon.php | 127 + app/code/Magento/Theme/composer.json | 16 +- app/code/Magento/Theme/etc/module.xml | 2 +- .../view/adminhtml/layout/admin-1column.xml | 15 +- .../adminhtml/layout/admin-2columns-left.xml | 17 +- .../adminhtml_system_design_theme_edit.xml | 40 +- ...html_system_design_wysiwyg_files_index.xml | 1 - .../view/adminhtml/templates/empty.phtml | 39 - .../Magento/Theme/view/base/layout/empty.xml | 8 +- .../Theme/view/base/templates/root.phtml | 21 +- .../Theme/view/frontend/layout/1column.xml | 4 +- .../Theme/view/frontend/layout/default.xml | 33 +- .../frontend/layout/default_head_blocks.xml | 44 +- .../Theme/view/frontend/layout/print.xml | 47 - .../view/frontend/templates/html/head.phtml | 43 - .../frontend/templates/js/require_js.phtml | 32 + .../Theme/view/frontend/templates/popup.phtml | 50 - .../Theme/view/frontend/templates/print.phtml | 59 - app/code/Magento/Translation/Block/Js.php | 18 +- app/code/Magento/Translation/composer.json | 10 +- .../view/base/templates/translate.phtml | 32 + app/code/Magento/Ui/AbstractView.php | 293 + app/code/Magento/Ui/Configuration.php | 127 + app/code/Magento/Ui/ConfigurationStorage.php | 294 + .../ContentType/Builders/ConfigJson.php} | 30 +- .../Builders/ConfigStorageJson.php | 70 + .../Ui/ContentType/ContentTypeFactory.php | 90 + .../Ui/ContentType/ContentTypeInterface.php | 41 + app/code/Magento/Ui/ContentType/Html.php | 79 + app/code/Magento/Ui/ContentType/Json.php | 71 + app/code/Magento/Ui/ContentType/Xml.php | 120 + app/code/Magento/Ui/Context/DataProvider.php | 40 + .../code/Magento/Ui/Control/Action.php | 18 +- app/code/Magento/Ui/Control/ActionPool.php | 148 + .../Ui/Control/ActionPoolInterface.php | 60 + app/code/Magento/Ui/Control/Button.php | 141 + app/code/Magento/Ui/Control/Container.php | 73 + .../Magento/Ui/Control/ControlInterface.php | 34 + app/code/Magento/Ui/Control/Item.php | 34 + app/code/Magento/Ui/Control/Link.php | 34 + .../Controller/Adminhtml/Listing/Ajax.php} | 63 +- .../Magento/Ui/DataProvider/Options/Store.php | 110 + .../DataProvider/OptionsFactory.php} | 60 +- .../DataProvider/OptionsInterface.php} | 13 +- .../Magento/Ui/DataProvider/Row/Store.php | 97 + .../DataProvider/RowInterface.php} | 18 +- app/code/Magento/Ui/DataProvider/RowPool.php | 74 + .../DataType/AbstractDataType.php} | 24 +- app/code/Magento/Ui/DataType/Boolean.php | 32 + .../Magento/Ui/DataType/DataTypeInterface.php | 47 + app/code/Magento/Ui/DataType/Date.php | 32 + app/code/Magento/Ui/DataType/Media.php | 32 + app/code/Magento/Ui/DataType/Number.php | 32 + app/code/Magento/Ui/DataType/Password.php | 32 + app/code/Magento/Ui/DataType/Text.php | 32 + .../Filter/FilterInterface.php} | 16 +- app/code/Magento/Ui/Filter/FilterPool.php | 86 + app/code/Magento/Ui/Filter/Type/Date.php | 172 + .../Script.php => Ui/Filter/Type/Input.php} | 22 +- .../Urlkey.php => Ui/Filter/Type/Range.php} | 41 +- .../Css.php => Ui/Filter/Type/Select.php} | 22 +- .../Filter/Type/Store.php} | 20 +- app/code/Magento/Ui/Filter/View.php | 122 + app/code/Magento/Ui/FilterPool/View.php | 197 + .../Form/Field.php} | 29 +- .../FormElement/AbstractFormElement.php} | 43 +- app/code/Magento/Ui/FormElement/Checkbox.php | 32 + .../Ui/FormElement/ElementInterface.php | 52 + .../FormElement/Input.php} | 15 +- .../FormElement/Radio.php} | 14 +- .../Special.php => Ui/FormElement/Range.php} | 14 +- app/code/Magento/Ui/FormElement/Select.php | 32 + app/code/Magento/Ui/FormElement/Textarea.php | 32 + app/code/Magento/Ui/Listing/View.php | 271 + .../Ui/ListingContainer/Massaction/View.php | 74 + app/code/Magento/Ui/Paging/View.php | 82 + app/code/Magento/Ui/Search/View.php | 34 + app/code/Magento/Ui/Sorting/View.php | 84 + app/code/Magento/{Index => Ui}/composer.json | 12 +- .../etc/adminhtml/routes.xml | 4 +- app/code/Magento/Ui/etc/di.xml | 35 + app/code/Magento/{Index => Ui}/etc/module.xml | 10 +- .../Magento/Ui/view/base/layout/default.xml | 34 + .../Ui/view/base/layout/ui_components.xml | 134 + .../Magento/Ui/view/base/requirejs-config.js | 32 + .../view/base/templates/context/default.phtml | 30 + .../templates/control/action/default.phtml | 30 + .../templates/control/button/default.phtml | 34 + .../templates/data_type/boolean/default.phtml | 30 + .../templates/data_type/date/default.phtml | 30 + .../templates/data_type/media/default.phtml | 30 + .../templates/data_type/number/default.phtml | 30 + .../data_type/password/default.phtml | 30 + .../templates/data_type/text/default.phtml | 30 + .../view/base/templates/filter/content.phtml | 38 + .../view/base/templates/filter/default.phtml} | 18 +- .../templates/filter/type/date/content.phtml | 52 + .../templates/filter/type/date/label.phtml | 30 + .../templates/filter/type/input/content.phtml | 37 + .../templates/filter/type/input/label.phtml | 30 + .../templates/filter/type/range/content.phtml | 52 + .../templates/filter/type/range/label.phtml | 30 + .../filter/type/select/content.phtml | 38 + .../templates/filter/type/select/label.phtml | 30 + .../base/templates/filter_pool/active.phtml | 30 + .../base/templates/filter_pool/default.phtml | 72 + .../form_element/checkbox/content.phtml | 30 + .../form_element/checkbox/label.phtml | 30 + .../form_element/input/content.phtml | 29 + .../templates/form_element/input/label.phtml | 30 + .../form_element/radio/content.phtml | 28 + .../templates/form_element/radio/label.phtml | 30 + .../form_element/range/content.phtml} | 36 +- .../templates/form_element/range/label.phtml | 30 + .../form_element/select/content.phtml | 51 + .../templates/form_element/select/label.phtml | 30 + .../form_element/textarea/content.phtml | 28 + .../form_element/textarea/label.phtml | 30 + .../view/base/templates/label/default.phtml | 30 + .../templates/listing/horizontal_grid.phtml | 80 + .../listingcontainer/massaction/default.phtml | 36 + .../massaction/page_actions.phtml | 35 + .../view/base/templates/paging/default.phtml | 65 + .../view/base/templates/sorting/default.phtml | 34 + .../Magento/Ui/view/base/web/js/lib/class.js | 76 + .../Ui/view/base/web/js/lib/component.js | 77 + .../Magento/Ui/view/base/web/js/lib/events.js | 91 + .../Ui/view/base/web/js/lib/ko/bind/date.js | 47 + .../base/web/js/lib/ko/bind/datepicker.js | 74 + .../base/web/js/lib/ko/bind/outer_click.js | 51 + .../Ui/view/base/web/js/lib/ko/bind/scope.js | 103 + .../web/js/lib/ko/bind/stop_propagation.js | 42 + .../Ui/view/base/web/js/lib/ko/initialize.js | 39 + .../Ui/view/base/web/js/lib/ko/scope.js | 107 + .../base/web/js/lib/ko/template/engine.js | 120 + .../js/lib/ko/template/observable_source.js | 56 + .../Magento/Ui/view/base/web/js/lib/loader.js | 101 + .../Ui/view/base/web/js/lib/mixins/loader.js | 49 + .../view/base/web/js/lib/registry/events.js | 124 + .../view/base/web/js/lib/registry/registry.js | 138 + .../view/base/web/js/lib/registry/storage.js | 88 + .../base/web/js/lib/renderer/overrides.js | 110 + .../view/base/web/js/lib/renderer/renderer.js | 290 + .../Ui/view/base/web/js/lib/spinner.js | 39 + .../Ui/view/base/web/js/lib/storage/index.js | 39 + .../Ui/view/base/web/js/lib/storage/meta.js | 204 + .../view/base/web/js/lib/storage/storage.js | 92 + .../Magento/Ui/view/base/web/js/lib/utils.js | 96 + .../Ui/view/base/web/js/listing/filter.js | 297 + .../base/web/js/listing/filter/abstract.js | 45 + .../view/base/web/js/listing/filter/date.js | 29 + .../base/web/js/listing/filter/filters.js | 39 + .../view/base/web/js/listing/filter/input.js | 81 + .../view/base/web/js/listing/filter/range.js | 107 + .../view/base/web/js/listing/filter/select.js | 100 + .../Ui/view/base/web/js/listing/grid.js | 240 + .../Ui/view/base/web/js/listing/massaction.js | 422 ++ .../Ui/view/base/web/js/listing/paging.js | 209 + .../Ui/view/base/web/js/listing/sorting.js | 154 + .../web/js/listing/utils/data_provider.js | 131 + .../base/web/js/listing/utils/provider.js | 64 + .../web/js/listing/utils/request_builder.js | 159 + .../Ui/view/base/web/js/listing/utils/rest.js | 103 + .../Ui/view/base/web/templates/filter.html | 60 + .../web/templates/filter/filter_date.html | 45 + .../web/templates/filter/filter_input.html | 32 + .../web/templates/filter/filter_range.html} | 40 +- .../web/templates/filter/filter_select.html | 32 + .../view/base/web/templates/listing/grid.html | 54 + .../templates/listing/grid/cell/actions.html | 34 + .../web/templates/listing/grid/cell/date.html | 27 + .../templates/listing/grid/cell/store.html | 27 + .../web/templates/listing/grid/cell/text.html | 32 + .../listing/grid/extender/selectable.html | 56 + .../listing/grid/extender/sortable.html | 43 + .../view/base/web/templates/massaction.html | 36 + .../view/base/web/templates/pageactions.html} | 39 +- .../view/base/web/templates/pagination.html | 50 + app/code/Magento/Ups/composer.json | 18 +- .../Controller/Adminhtml/UrlRedirect.php | 468 -- .../Magento/UrlRedirect/Controller/Router.php | 94 - .../Magento/UrlRedirect/Helper/UrlRewrite.php | 95 - .../Model/Resource/UrlRedirect.php | 77 - .../Magento/UrlRedirect/Model/Storage/Db.php | 104 - .../UrlRedirect/Service/V1/Data/Filter.php | 138 - .../UrlRedirect/Service/V1/UrlManager.php | 127 - .../Service/V1/UrlMatcherInterface.php | 67 - app/code/Magento/UrlRedirect/composer.json | 24 - app/code/Magento/UrlRedirect/i18n/de_DE.csv | 57 - app/code/Magento/UrlRedirect/i18n/en_US.csv | 62 - app/code/Magento/UrlRedirect/i18n/es_ES.csv | 57 - app/code/Magento/UrlRedirect/i18n/fr_FR.csv | 57 - app/code/Magento/UrlRedirect/i18n/nl_NL.csv | 57 - app/code/Magento/UrlRedirect/i18n/pt_BR.csv | 57 - app/code/Magento/UrlRedirect/i18n/zh_CN.csv | 57 - .../sql/urlredirect_setup/install-1.0.0.0.php | 109 - .../UrlRewrite/App/Request/RewriteService.php | 75 - .../Block/Catalog/Category/Edit.php | 20 +- .../Block/Catalog/Category/Tree.php | 12 +- .../Block/Catalog/Edit/Form.php | 70 +- .../Block/Catalog/Product/Edit.php | 36 +- .../Block/Catalog/Product/Grid.php | 12 +- .../Block/Cms/Page/Edit.php | 20 +- .../Block/Cms/Page/Edit/Form.php | 43 +- .../Block/Cms/Page/Grid.php | 2 +- .../Block/Edit.php | 37 +- .../Block/Edit/Form.php | 33 +- .../Block/GridContainer.php | 13 +- .../Block/Link.php | 2 +- .../Block/Selector.php | 6 +- .../Controller/Adminhtml/Url/Rewrite.php} | 50 +- .../Adminhtml/Url/Rewrite}/CategoriesJson.php | 8 +- .../Adminhtml/Url/Rewrite}/CmsPageGrid.php | 6 +- .../Adminhtml/Url/Rewrite}/Delete.php | 4 +- .../Adminhtml/Url/Rewrite}/Edit.php | 32 +- .../Adminhtml/Url/Rewrite}/Index.php | 8 +- .../Adminhtml/Url/Rewrite}/ProductGrid.php | 6 +- .../Controller/Adminhtml/Url/Rewrite/Save.php | 193 + .../Magento/UrlRewrite/Controller/Router.php | 137 + .../Magento/UrlRewrite/Helper/UrlRewrite.php | 32 +- .../UrlRewrite/Model/OptionProvider.php | 36 +- .../UrlRewrite/Model/Resource/UrlRewrite.php | 99 +- .../Model/Resource/UrlRewrite/Collection.php | 119 - .../Model/Resource/UrlRewriteCollection.php} | 12 +- .../Model/Storage/AbstractStorage.php | 60 +- .../UrlRewrite/Model/Storage/DbStorage.php | 165 + .../Model/Storage/DuplicateEntryException.php | 28 + .../UrlRewrite/Model/StorageInterface.php | 28 + .../UrlRewrite/Model/UrlFinderInterface.php | 46 + .../Model/UrlPersistInterface.php} | 28 +- .../Magento/UrlRewrite/Model/UrlRewrite.php | 314 +- .../Model/UrlRewrite/OptionProvider.php | 77 - .../Service/V1/Data/UrlRewrite.php | 46 +- .../Service/V1/Data/UrlRewriteBuilder.php | 45 +- app/code/Magento/UrlRewrite/composer.json | 14 +- .../etc => UrlRewrite/etc/adminhtml}/acl.xml | 4 +- .../etc/adminhtml/menu.xml | 4 +- .../etc/adminhtml/routes.xml | 2 +- .../etc/config.xml | 0 .../{UrlRedirect => UrlRewrite}/etc/di.xml | 6 +- .../Magento/UrlRewrite/etc/frontend/di.xml | 12 +- app/code/Magento/UrlRewrite/etc/module.xml | 10 +- app/code/Magento/UrlRewrite/i18n/de_DE.csv | 54 +- app/code/Magento/UrlRewrite/i18n/en_US.csv | 59 +- app/code/Magento/UrlRewrite/i18n/es_ES.csv | 54 +- app/code/Magento/UrlRewrite/i18n/fr_FR.csv | 54 +- app/code/Magento/UrlRewrite/i18n/nl_NL.csv | 54 +- app/code/Magento/UrlRewrite/i18n/pt_BR.csv | 54 +- app/code/Magento/UrlRewrite/i18n/zh_CN.csv | 54 +- .../sql/urlrewrite_setup/install-1.0.0.0.php | 77 +- .../layout/adminhtml_url_rewrite_index.xml} | 21 +- .../view/adminhtml/templates/categories.phtml | 2 +- .../view/adminhtml/templates}/edit.phtml | 5 +- .../view/adminhtml/templates/selector.phtml | 10 +- .../Magento/User/Block/User/Edit/Tab/Main.php | 44 +- .../Adminhtml/User/Role/EditRole.php | 1 - .../User/Controller/Adminhtml/User/Save.php | 17 +- app/code/Magento/User/Model/User.php | 33 +- app/code/Magento/User/composer.json | 14 +- app/code/Magento/Usps/composer.json | 18 +- .../Controller/ServiceArgsSerializer.php | 1 + .../Controller/Soap/Request/Handler.php | 3 - .../Config/ClassReflector/TypeProcessor.php | 14 +- .../Magento/Webapi/Model/Config/Converter.php | 14 +- app/code/Magento/Webapi/composer.json | 16 +- .../Weee/Pricing/Render/Adjustment.php | 15 +- app/code/Magento/Weee/composer.json | 24 +- .../base/templates/pricing/adjustment.phtml | 19 +- .../Weee/view/frontend/layout/default.xml | 4 +- .../checkout/cart/item/price/sidebar.phtml | 85 +- .../review/item/price/row_excl_tax.phtml | 18 +- .../review/item/price/row_incl_tax.phtml | 16 +- .../review/item/price/unit_excl_tax.phtml | 16 +- .../review/item/price/unit_incl_tax.phtml | 18 +- .../frontend/templates/item/price/row.phtml | 30 +- .../frontend/templates/item/price/unit.phtml | 35 +- .../Magento/Widget/Model/Widget/Instance.php | 2 +- app/code/Magento/Widget/composer.json | 15 +- app/code/Magento/Widget/etc/module.xml | 1 - .../layout/adminhtml_widget_instance_edit.xml | 25 +- .../Wishlist/Block/Customer/Sharing.php | 5 +- .../Wishlist/Block/Customer/Wishlist.php | 5 +- app/code/Magento/Wishlist/Block/Rss.php | 231 - .../Email/Rss.php => Rss/EmailLink.php} | 8 +- app/code/Magento/Wishlist/Block/Rss/Link.php | 102 + .../Magento/Wishlist/Block/Share/Wishlist.php | 6 +- .../Magento/Wishlist/Controller/Index/Rss.php | 108 - .../Wishlist/Controller/Index/Send.php | 2 +- .../Wishlist/Controller/WishlistProvider.php | 8 +- app/code/Magento/Wishlist/Helper/Data.php | 6 - app/code/Magento/Wishlist/Model/Observer.php | 2 +- .../Magento/Wishlist/Model/Rss/Wishlist.php | 277 + app/code/Magento/Wishlist/composer.json | 32 +- app/code/Magento/Wishlist/etc/di.xml | 6 +- .../wishlist_index_configure_type_bundle.xml | 8 +- ...list_index_configure_type_configurable.xml | 8 +- ...list_index_configure_type_downloadable.xml | 1 - .../frontend/layout/wishlist_index_index.xml | 1 + .../frontend/layout/wishlist_index_rss.xml | 30 - .../{email/rss.phtml => rss/email.phtml} | 7 +- .../frontend/templates/rss/wishlist.phtml} | 10 +- .../view/frontend/templates/view.phtml | 6 +- .../Magento_Backend/layout/default.xml | 80 +- .../Magento_Ui/web/css/source/module.less | 431 ++ .../adminhtml/Magento/backend/composer.json | 4 +- .../adminhtml/Magento/backend/theme.xml | 2 +- .../Magento/backend/web/css/pages.less | 60 +- .../Magento/backend/web/css/source/table.less | 2 +- .../backend/web/less/styles/debug.less | 2 +- .../backend/web/less/styles/pages.less | 2 +- .../Magento_Bundle/web/css/source/module.less | 10 +- .../web/css/source/listings.less | 93 +- .../web/css/source/module.less | 97 +- .../web/css/source/toolbar.less | 4 +- .../web/css/source/widgets.less | 4 +- .../web/css/source/module.less | 8 +- .../layout/checkout_cart_index.xml | 2 +- .../Magento_Checkout/web/css/source/cart.less | 26 +- .../web/css/source/minicart.less | 89 +- .../web/css/source/module.less | 38 +- .../Magento_Cms/web/css/source/widgets.less | 2 +- .../layout/customer_account.xml | 10 +- .../web/css/source/module.less | 119 +- .../web/css/source/module.less | 24 + .../web/css/source/module.less | 17 +- .../web/css/source/module.less | 4 +- .../web/css/source/module.less | 24 +- .../web/css/source/module.less | 5 +- .../Magento_Paypal/web/css/source/module.less | 136 +- .../Magento_Review/web/css/source/module.less | 4 +- .../Magento_Sales/web/css/source/module.less | 46 +- .../web/css/source/module.less | 4 +- .../layout/default_head_blocks.xml | 10 +- .../css/source/collapsible_navigation.less | 104 + .../Magento_Theme/web/css/source/module.less | 23 +- .../Magento_Weee/web/css/source/module.less | 39 + .../web/css/source/module.less | 13 +- .../frontend/Magento/blank/composer.json | 4 +- app/design/frontend/Magento/blank/theme.xml | 2 +- .../blank/web/css/source/abstract.less | 168 +- .../blank/web/css/source/actions-toolbar.less | 4 +- .../Magento/blank/web/css/source/forms.less | 4 +- .../Magento/blank/web/css/source/layout.less | 45 +- .../Magento/blank/web/css/source/price.less | 45 +- .../frontend/Magento/plushe/composer.json | 6 +- app/design/frontend/Magento/plushe/theme.xml | 2 +- app/design/install/Magento/basic/theme.xml | 2 +- app/etc/di.xml | 25 +- app/i18n/magento/de_de/composer.json | 4 +- app/i18n/magento/en_us/composer.json | 4 +- app/i18n/magento/es_es/composer.json | 4 +- app/i18n/magento/fr_fr/composer.json | 4 +- app/i18n/magento/nl_nl/composer.json | 4 +- app/i18n/magento/pt_br/composer.json | 4 +- app/i18n/magento/zh_cn/composer.json | 4 +- composer.json | 9 +- dev/shell/indexer.php | 4 +- dev/shell/newindexer.php | 35 - dev/shell/run_data_fixtures.php | 3 +- dev/shell/run_schema_updater.php | 3 +- .../Selenium/Element/ConditionsElement.php | 1 + .../Selenium/Element/GlobalSearchElement.php | 138 + dev/tests/functional/phpunit.xml.dist | 6 +- .../Backend/Test/Block/Page/Header.php | 33 + .../Backend/Test/Block/Widget/Grid.php | 11 + .../AssertGlobalSearchCustomerName.php | 71 + .../AssertGlobalSearchNoRecordsFound.php | 72 + .../Constraint/AssertGlobalSearchOrderId.php | 71 + .../AssertGlobalSearchProductName.php | 76 + .../Backend/Test/Fixture/GlobalSearch.php | 49 + .../Backend/Test/Fixture/GlobalSearch.xml | 35 + .../Test/Fixture/GlobalSearch/Query.php} | 96 +- .../Test/TestCase/GlobalSearchEntityTest.php | 82 + .../TestCase/GlobalSearchEntityTest/test.csv | 6 + .../Magento/Backend/Test/etc/constraint.xml | 39 + .../app/Magento/Backend/Test/etc/fixture.xml | 31 + .../Test/Block/Catalog/Product/View.php | 4 +- .../AssertTierPriceOnBundleProductPage.php | 4 +- .../Bundle/Test/Fixture/BundleProduct.php | 13 - .../Bundle/Test/Fixture/BundleProduct.xml | 7 - .../Fixture/BundleProduct/CheckoutData.php | 5 +- .../Bundle/Test/Repository/BundleProduct.php | 6 +- ...CartFromCustomerWishlistOnFrontendTest.php | 51 + .../test.csv | 3 + .../Test/Block/Product/ListProduct.php | 10 +- .../Catalog/Test/Block/Product/Price.php | 8 +- .../Catalog/Test/Block/Product/View.php | 26 +- .../AssertProductTierPriceOnProductPage.php | 4 +- .../Catalog/Test/Fixture/Cart/Item.php | 4 + .../Catalog/Test/Fixture/CatalogCategory.php | 11 + .../Catalog/Test/Fixture/CatalogCategory.xml | 5 + .../Test/Fixture/CatalogProductSimple.php | 19 +- .../Test/Fixture/CatalogProductSimple.xml | 13 +- .../CatalogProductSimple/CheckoutData.php | 21 +- .../Test/Fixture/CatalogProductVirtual.php | 19 +- .../Test/Fixture/CatalogProductVirtual.xml | 13 +- .../CatalogProductVirtual/CheckoutData.php | 5 + .../Magento/Catalog/Test/Fixture/Product.php | 2 +- .../Test/Handler/CatalogCategory/Curl.php | 4 + .../CatalogProductAttributeIndex.xml | 2 +- .../Adminhtml/CatalogProductAttributeNew.xml | 2 +- .../Test/Repository/CatalogCategory.php | 9 + .../Repository/CatalogProductAttribute.php | 41 + .../Test/Repository/CatalogProductSimple.php | 44 +- .../Test/Repository/CatalogProductVirtual.php | 18 - .../Catalog/Test/Repository/SimpleProduct.php | 6 - .../TestCase/Category/AssignProductTest.php | 5 - .../Test/Page/AdvancedResult.xml | 4 +- .../app/Magento/Checkout/Test/Block/Cart.php | 2 +- .../Test/Block/Cart/AbstractCartItem.php | 4 +- .../Test/Block/Cart/CartEmpty.php} | 35 +- .../Checkout/Test/Block/Cart/CartItem.php | 34 + .../Test/Constraint/AssertCartIsEmpty.php | 87 + .../AssertProductQtyInMiniShoppingCart.php | 43 +- .../Checkout/Test/Page/CheckoutCart.xml | 5 + .../TestStep/AddProductsToTheCartStep.php | 2 +- .../Magento/Checkout/Test/etc/constraint.xml | 3 + .../app/Magento/Cms/Test/Page/CmsIndex.xml | 7 +- ...tConfigurableProductInItemsOrderedGrid.php | 2 +- .../AssertProductAttributeIsConfigurable.php | 4 +- .../Fixture/ConfigurableProductInjectable.php | 13 - .../Fixture/ConfigurableProductInjectable.xml | 7 - .../ConfigurableAttributesData.php | 107 +- .../Test/Repository/ConfigurableProduct.php | 6 - .../ConfigurableProductInjectable.php | 36 + ...CartFromCustomerWishlistOnFrontendTest.php | 51 + .../test.csv | 2 + .../Test/etc/constraint.xml | 3 + .../app/Magento/Core/Test/Block/Messages.php | 18 + .../Constraint/AssertCustomVariableInPage.php | 16 +- .../UpdateCustomVariableEntityTest.php | 2 +- .../Test/Repository/CustomerInjectable.php | 1 - .../TestStep/LoginCustomerOnFrontendStep.php | 97 + .../Test/Block/Catalog/Product/View.php | 2 +- .../Test/Block/Catalog/Product/View/Links.php | 2 +- .../Block/Catalog/Product/View/Samples.php | 4 +- .../AssertDownloadableSamplesData.php | 4 +- .../Fixture/DownloadableProductInjectable.php | 13 - .../Fixture/DownloadableProductInjectable.xml | 7 - ...CartFromCustomerWishlistOnFrontendTest.php | 51 + .../test.csv | 2 + .../testCreateDownloadableProduct.csv | 2 +- .../Test/Block/Checkout/Cart/CartItem.php | 14 + ...CartFromCustomerWishlistOnFrontendTest.php | 39 +- .../test.csv | 2 + .../Magento/Index/Test/Page/ProcessList.php | 89 - .../Viewed/Filter.php => AbstractFilter.php} | 65 +- .../Adminhtml/Customer/Counts/Filter.php | 18 +- .../Adminhtml/Customer/Counts/Filter.xml | 38 + .../Block/Adminhtml/Customer/Counts/Grid.php | 20 +- .../Adminhtml/Customer/Totals/Filter.php | 42 + .../Adminhtml/Customer/Totals/Filter.xml | 38 + .../Block/Adminhtml/Customer/Totals/Grid.php | 102 + .../Products}/Viewed/Action.php | 2 +- .../Review/Products/Viewed/Filter.php | 36 + .../Products}/Viewed/Filter.xml | 0 .../Products}/Viewed/ProductGrid.php | 15 +- .../Block/Adminhtml/Sales/Coupons/Filter.php | 40 +- .../Adminhtml/Shopcart/Abandoned/Grid.php | 60 + ...bstractAssertCustomerOrderReportResult.php | 74 + .../AssertAbandonedCartCustomerInfoResult.php | 89 + .../AssertCustomerOrderCountReportResult.php | 75 + .../AssertCustomerOrderTotalReportResult.php | 75 + .../Test/Page/Adminhtml/AbandonedCarts.xml | 34 + .../Test/Page/Adminhtml/Bestsellers.xml | 49 - .../Page/Adminhtml/CustomerOrdersReport.xml | 39 + .../Page/Adminhtml/CustomerTotalsReport.xml | 39 + .../Test/Page/Adminhtml/ProductReportView.xml | 6 +- .../AbandonedCartsReportEntityTest.php | 170 + .../AbandonedCartsReportEntityTest/test.csv | 3 + .../BestsellerProductsReportEntityTest.php | 89 - .../test.csv | 4 - .../CustomersOrderCountReportEntityTest.php | 101 + .../test.csv | 4 + .../CustomersOrderTotalReportEntityTest.php | 101 + .../test.csv | 4 + .../TestCase/SearchTermsReportEntityTest.php | 2 +- .../ViewedProductsReportEntityTest/test.csv | 4 +- .../Magento/Reports/Test/etc/constraint.xml | 11 +- .../app/Magento/Reports/Test/etc/page.xml | 20 +- .../app/Magento/Store/Test/Block/Switcher.php | 5 + .../Magento/Store/Test/Handler/Store/Curl.php | 13 +- .../Store/Test/Handler/StoreGroup/Curl.php | 21 +- .../Store/Test/Handler/Website/Curl.php | 17 +- .../Test/TestCase/CreateStoreEntityTest.php | 4 +- .../TestCase/CreateStoreEntityTest/test.csv | 8 +- .../Test/TestCase/UpdateStoreEntityTest.php | 1 + .../TestCase/UpdateStoreEntityTest/test.csv | 4 +- .../UpdateStoreGroupEntityTest/test.csv | 4 +- .../Test/Block/Adminhtml/Rule/Edit/Form.php | 1 + .../Magento/Theme/Test/Block/Html/Footer.php | 5 +- .../Block/Adminhtml/Catalog/Category/Grid.php | 2 +- .../Adminhtml/Catalog/Edit/UrlRewriteForm.xml | 18 +- .../Test/Block/Adminhtml/Cms/Page/Grid.php | 4 +- .../Test/Block/Adminhtml/Selector.php | 4 +- .../AssertUrlRewriteCategoryRedirect.php | 2 +- .../AssertUrlRewriteDeletedMessage.php | 6 +- .../Constraint/AssertUrlRewriteInGrid.php | 12 +- .../Constraint/AssertUrlRewriteNotInGrid.php | 12 +- .../AssertUrlRewriteSaveMessage.php | 6 +- .../UrlRewrite/Test/Fixture/UrlRewrite.php | 21 +- .../UrlRewrite/Test/Fixture/UrlRewrite.xml | 17 +- .../Test/Fixture/UrlRewriteCategory.php | 10 + .../Test/Handler/UrlRewrite/Curl.php | 10 +- ...{UrlrewriteEdit.xml => UrlRewriteEdit.xml} | 4 +- ...rlrewriteIndex.xml => UrlRewriteIndex.xml} | 2 +- .../UrlRewrite/Test/Repository/UrlRewrite.php | 8 +- .../Test/Repository/UrlRewriteCategory.php | 3 +- .../Test/Repository/UrlRewriteProduct.php | 2 +- .../UrlRewrite/Test/TestCase/CategoryTest.php | 13 +- .../CreateCategoryRewriteEntityTest.php | 16 +- .../testCreateCategoryRewrite.csv | 2 +- .../CreateCustomUrlRewriteEntityTest.php | 18 +- .../CreateCustomUrlRewriteEntityTest/test.csv | 2 +- .../CreateProductUrlRewriteEntityTest.php | 16 +- .../testProductUrlRewrite.csv | 4 +- .../DeleteCategoryUrlRewriteEntityTest.php | 24 +- .../testDeleteCategoryUrlRewrite.csv | 2 +- .../DeleteCustomUrlRewriteEntityTest.php | 14 +- .../DeleteProductUrlRewriteEntityTest.php | 22 +- .../UrlRewrite/Test/TestCase/ProductTest.php | 10 +- .../UpdateCategoryUrlRewriteEntityTest.php | 22 +- .../test.csv | 4 +- .../UpdateCustomUrlRewriteEntityTest.php | 14 +- .../UpdateCustomUrlRewriteEntityTest/test.csv | 2 +- .../UpdateProductUrlRewriteEntityTest.php | 20 +- .../testUpdateProductUrlRewrite.csv | 2 +- .../UrlRewrite/Test/etc/constraint.xml | 4 +- .../Magento/UrlRewrite/Test/etc/fixture.xml | 4 +- .../app/Magento/UrlRewrite/Test/etc/page.xml | 16 +- .../Test/Block/Adminhtml/User/UserForm.xml | 1 + .../Magento/User/Test/Fixture/AdminUser.php | 7 + .../app/Magento/User/Test/Fixture/User.php | 52 + .../app/Magento/User/Test/Fixture/User.xml | 4 + .../app/Magento/User/Test/Repository/User.php | 13 +- .../CreateAdminUserEntityTest/test.csv | 14 +- .../testUpdateAdminUser.csv | 8 +- .../testUpdateAdminUserRolesEntity.csv | 6 +- .../Test/Block/Customer/Wishlist/Items.php | 19 +- .../Block/Customer/Wishlist/Items/Product.php | 40 +- .../Block/Customer/Wishlist/Items/Product.xml | 35 + ...p => AssertProductsIsAbsentInWishlist.php} | 24 +- .../Test/Constraint/AssertWishlistIsEmpty.php | 73 + ...CartFromCustomerWishlistOnFrontendTest.php | 230 + .../test.csv | 4 + ...oductFromCustomerWishlistOnBackendTest.php | 3 +- .../test.csv | 4 +- .../Magento/Wishlist/Test/etc/constraint.xml | 7 +- .../framework/tests/unit/phpunit.xml.dist | 6 +- dev/tests/integration/phpunit.xml.dist | 6 +- .../Magento/Backend/App/RouterTest.php | 2 +- .../Magento/Backend/Block/Page/HeadTest.php | 42 - .../Adminhtml/System/AccountTest.php | 5 + ...{UrlrewriteTest.php => UrlRewriteTest.php} | 6 +- .../Backend/{ => Cookie}/DomainTest.php | 15 +- .../Config/Backend/Cookie/LifetimeTest.php | 45 + .../Model/Config/Backend/Cookie/PathTest.php | 45 + .../Backend/Model/Session/AdminConfigTest.php | 68 + .../Catalog/Block/Product/AbstractTest.php | 19 +- .../Catalog/Block/Product/ViewTest.php | 18 +- .../Catalog/Controller/CategoryTest.php | 6 +- .../Magento/Catalog/Helper/CategoryTest.php | 45 - .../Magento/Catalog/Helper/DataTest.php | 13 - .../Catalog/Helper/Product/ViewTest.php | 2 +- .../Magento/Catalog/Helper/ProductTest.php | 8 +- .../Magento/Catalog/Model/CategoryTest.php | 7 - .../Catalog/Model/CategoryTreeTest.php | 8 +- .../Model/Indexer/Category/ProductTest.php | 2 + .../Magento/Catalog/Model/Product/UrlTest.php | 26 +- .../Catalog/Model/ProductExternalTest.php | 11 +- .../Model/Resource/_files/url_rewrites.php | 6 +- .../Magento/Catalog/Model/UrlTest.php | 218 - .../Catalog/_files/category_backend.php | 26 + .../_files/category_backend_rollback.php | 38 + .../Catalog/_files/multiple_products.php | 6 +- .../Magento/Catalog/_files/url_rewrites.php | 2 +- .../Import/Product/Type/AbstractTest.php | 16 +- .../CatalogUrlRewrite/_files/categories.php | 84 + .../_files/product_simple.php | 28 + .../testsuite/Magento/Cms/Model/PageTest.php | 24 +- .../Controller/Adminhtml/ProductTest.php | 3 - .../layout_test_handle_sample.xml | 28 +- .../Magento/Core/_files/url_rewrite.php | 47 - .../Model/System/CurrencysymbolTest.php | 108 + .../Controller/Adminhtml/IndexTest.php | 2 +- .../Service/V1/AddressMetadataServiceTest.php | 27 + .../Service/V1/CustomerAccountServiceTest.php | 22 +- .../Service/V1/CustomerGroupServiceTest.php | 21 +- .../V1/CustomerMetadataServiceTest.php | 46 + ..._user_defined_address_custom_attribute.php | 71 + ...ttribute_user_defined_custom_attribute.php | 68 + .../Customer/_files/customer_group.php | 2 +- .../DesignEditor/Model/ObserverTest.php | 14 +- .../Magento/Directory/Model/ObserverTest.php | 111 + .../Search/Adapter/Mysql/AdapterTest.php | 303 +- .../Adapter/Mysql/Builder/Query/MatchTest.php | 35 +- .../Search/Request/Config/ConverterTest.php | 2 - .../Framework/Search/_files/products.php | 10 +- .../Framework/Search/_files/requests.xml | 204 +- .../Search/_files/search_request.xml | 6 +- .../Search/_files/search_request_config.php | 5 +- .../Validator/CookieDomainValidatorTest.php | 58 + .../Validator/CookieLifetimeValidatorTest.php | 58 + .../Validator/CookiePathValidatorTest.php} | 40 +- .../Magento/Framework/Session/ConfigTest.php | 193 +- .../ValidatorFactoryTest.php} | 38 +- .../Framework/View/Layout/ElementTest.php | 14 +- .../View/Layout/_files/_layout_update.xml | 35 +- .../Magento/Framework/View/Utility/Layout.php | 27 +- .../layout_test_handle_sample.xml | 28 +- .../Magento/Index/Model/Process/FileTest.php | 186 - .../Magento/Index/Model/ProcessTest.php | 175 - .../Magento/Index/Model/ShellTest.php | 107 - .../Newsletter/Model/Plugin/PluginTest.php | 2 +- .../_files/recurring_payment.php | 4 +- .../Magento/Rss/Controller/CatalogTest.php | 182 - .../Magento/Rss/Controller/OrderTest.php | 89 - .../Report/Filter/Form/CouponTest.php | 3 - .../Tax/Model/Sales/Total/Quote/SetupUtil.php | 2 +- .../Tax/Model/TaxClass/Type/CustomerTest.php | 2 +- .../Modular/IndexerConfigFilesTest.php | 72 +- .../Modular/NewIndexerConfigFilesTest.php | 74 - .../Integrity/Modular/TemplateFilesTest.php | 3 +- .../Test/Integrity/StaticFilesTest.php | 6 +- .../Magento/Theme/Block/Html/HeadTest.php | 191 - .../Magento/Theme/Block/HtmlTest.php | 116 - .../Block}/Catalog/Category/EditTest.php | 71 +- .../Block}/Catalog/Category/TreeTest.php | 18 +- .../Block}/Catalog/Edit/FormTest.php | 66 +- .../Block}/Catalog/Product/EditTest.php | 81 +- .../Block}/Catalog/Product/GridTest.php | 8 +- .../Block}/Cms/Page/Edit/FormTest.php | 20 +- .../Block}/Cms/Page/EditTest.php | 71 +- .../Block}/Cms/Page/GridTest.php | 12 +- .../Block}/Edit/FormTest.php | 45 +- .../Block}/EditTest.php | 23 +- .../UrlRewrite/Helper/UrlRewriteTest.php | 90 - .../UrlRewrite/Model/UrlRewriteTest.php | 307 - .../User/Block/User/Edit/Tab/MainTest.php | 9 +- .../User/Controller/Adminhtml/UserTest.php | 37 +- .../Webapi/Model/Config/_files/webapi.php | 32 +- .../testsuite/Magento/Weee/Model/TaxTest.php | 2 +- .../Magento/Wishlist/Block/RssTest.php | 107 - .../Magento/Wishlist/Controller/IndexTest.php | 23 - .../testsuite/lib/ko/datepicker/datepicker.js | 51 + .../js/testsuite/lib/ko/datepicker/index.html | 37 +- .../Magento/TestFramework/Application.php | 4 - .../framework/tests/unit/phpunit.xml.dist | 6 +- .../Magento/Test/ApplicationTest.php | 20 +- .../Fixture/Complex/ComplexGeneratorTest.php | 5 - .../Fixture/Complex/PatternTest.php | 5 - .../ImportExport/Fixture/GeneratorTest.php | 5 - .../Magento/TestFramework/Utility/Classes.php | 2 +- .../framework/tests/unit/phpunit.xml.dist | 6 +- dev/tests/static/phpunit-all.xml.dist | 6 +- dev/tests/static/phpunit.xml.dist | 6 +- .../Test/Integrity/Di/CompilerTest.php | 28 +- .../Test/Integrity/Layout/HandlesTest.php | 21 + .../Test/Integrity/Library/DependencyTest.php | 62 +- .../Integrity/Library/_files/blacklist.txt | 1 + .../Magento/Framework/Search/ConfigTest.php | 3 - .../Search/_files/invalid_partial.xml | 41 +- .../Magento/Framework/Search/_files/valid.xml | 80 +- .../Framework/Search/_files/valid_partial.xml | 6 +- .../Magento/Test/Integrity/Xml/SchemaTest.php | 56 +- .../Integrity/_files/blacklist/composer.txt | 1 + .../Integrity/_files/blacklist/namespace.txt | 3 - .../_files/dependency_test/tables_ce.php | 6 - .../Test/Legacy/_files/obsolete_classes.php | 34 +- .../Legacy/_files/obsolete_config_nodes.php | 3 +- .../Test/Legacy/_files/obsolete_constants.php | 11 +- .../Test/Legacy/_files/obsolete_methods.php | 18 +- .../Legacy/_files/obsolete_properties.php | 3 - .../Test/Php/_files/blacklist/common.txt | 4 +- .../Php/_files/phpcpd/blacklist/common.txt | 6 +- .../Test/Php/_files/whitelist/common.txt | 23 +- dev/tests/unit/filename | 0 dev/tests/unit/filename.csv | 0 dev/tests/unit/filename.invalid_type | 0 .../framework/Magento/Test/BaseTestCase.php | 63 + .../framework/tests/unit/phpunit.xml.dist | 6 +- dev/tests/unit/phpunit.xml.dist | 9 +- .../AdminNotification/Model/FeedTest.php | 179 + .../Magento/Backend/Block/UrlrewriteTest.php | 109 - .../Grid/Column/Renderer/ConcatTest.php | 76 + .../Magento/Backend/Block/Widget/GridTest.php | 87 - .../Adminhtml/Dashboard/TunnelTest.php | 12 +- .../Adminhtml/System/Account/SaveTest.php | 6 +- .../Backend/{ => Cookie}/DomainTest.php | 51 +- .../Config/Backend/Cookie/LifetimeTest.php | 119 + .../Model/Config/Backend/Cookie/PathTest.php | 113 + .../{ => Model/Session}/AdminConfigTest.php | 54 +- .../Widget/Grid/Row/UrlGeneratorTest.php | 3 +- .../Magento/Backup/Helper/DataTest.php | 28 - .../Block/Adminhtml/Rss/Grid/LinkTest.php | 78 + .../Block/Adminhtml/Rss/NotifyStockTest.php | 133 + .../Catalog/Block/Category/Rss/LinkTest.php | 143 + .../Catalog/Block/Category/ViewTest.php | 8 +- .../Catalog/Block/Rss/CategoryTest.php | 268 + .../Block/Rss/Product/NewProductsTest.php | 204 + .../Catalog/Block/Rss/Product/SpecialTest.php | 246 + .../Magento/Catalog/Block/Widget/LinkTest.php | 196 + .../Product/Initialization/HelperTest.php | 17 - .../Magento/Catalog/Model/CategoryTest.php | 42 +- .../Price/Plugin/CustomerGroupTest.php | 9 +- .../Magento/Catalog/Model/ObserverTest.php | 196 + .../Catalog/Model/Product/ActionTest.php | 23 +- .../Product/Attribute/Backend/UrlkeyTest.php | 93 - .../Source/Msrp/Type/EnabledTest.php | 69 - .../Catalog/Model/Product/CopierTest.php | 12 +- .../Magento/Catalog/Model/Product/UrlTest.php | 97 +- .../Catalog/Model/Rss/CategoryTest.php | 186 + .../Model/Rss/Product/NewProductsTest.php | 117 + .../Model/Rss/Product/NotifyStockTest.php | 118 + .../Catalog/Model/Rss/Product/SpecialTest.php | 103 + .../Magento/Catalog/Model/UrlTest.php | 313 - .../Pricing/Render/FinalPriceBoxTest.php | 11 +- .../V1/Product/TierPriceServiceTest.php | 21 - .../Catalog/_files/eav_attributes_data.php | 468 -- .../Indexer/Fulltext/Action/FullTest.php | 135 + .../Model/Search/ReaderPluginTest.php | 63 + .../Model/Search/RequestGeneratorTest.php | 135 + .../CanonicalUrlRewriteGeneratorTest.php | 94 + .../ChildrenCategoriesProviderTest.php | 90 + .../ChildrenUrlRewriteGeneratorTest.php | 99 + .../CurrentUrlRewritesRegeneratorTest.php | 298 + .../Model/CategoryUrlPathGeneratorTest.php | 264 + .../Model/CategoryUrlRewriteGeneratorTest.php | 116 + .../Model/ObjectRegistryTest.php | 70 + .../CanonicalUrlRewriteGeneratorTest.php | 103 + .../CategoriesUrlRewriteGeneratorTest.php | 121 + .../CurrentUrlRewritesRegeneratorTest.php | 337 ++ .../Model/ProductUrlPathGeneratorTest.php | 181 + .../Model/ProductUrlRewriteGeneratorTest.php | 210 + .../categoryUrlRewritesDataProvider.php | 116 + .../Service/V1/StoreViewServiceTest.php | 129 + .../Checkout/Controller/Onepage/IndexTest.php | 17 +- .../Magento/Checkout/Model/CartTest.php | 40 +- .../Service/V1/Cart/ReadServiceTest.php | 21 +- .../Magento/Cms/Model/Page/UrlrewriteTest.php | 87 - .../Configurable/Attribute/Price/DataTest.php | 43 + .../Magento/Core/App/Router/BaseTest.php | 277 + .../Core/App/Router/NoRouteHandlerTest.php | 121 + .../Core/Controller/Index/IndexTest.php | 33 +- .../Core/Controller/Index/NoCookiesTest.php | 162 + .../Core/Controller/Index/NotFoundTest.php | 56 + .../Magento/Core/Helper/DataTest.php | 253 +- .../Magento/Core/Helper/File/MediaTest.php | 172 + .../Core/Helper/File/Storage/DatabaseTest.php | 503 ++ .../Magento/Core/Helper/File/StorageTest.php | 195 + .../testsuite/Magento/Core/Helper/UrlTest.php | 218 + .../Magento/Core/Model/App/EmulationTest.php | 209 + .../Magento/Core/Model/Asset/ConfigTest.php | 101 + .../Asset/Plugin/CleanMergedJsCssTest.php | 89 + .../Model/Address/AbstractAddressTest.php | 2 +- .../Customer/Model/GroupRegistryTest.php | 4 +- .../Service/V1/CustomerAccountServiceTest.php | 35 +- .../V1/CustomerMetadataServiceTest.php | 6 + .../Controller/Varien/Router/StandardTest.php | 39 +- .../Model/Config/Source/AllRegionTest.php | 238 + .../Magento/Directory/Model/ObserverTest.php | 143 + .../Entity/Attribute/Source/TableTest.php | 165 +- .../Framework/App/Action/ActionTest.php | 18 +- .../Magento/Framework/App/BootstrapTest.php | 2 +- .../Magento/Framework/App/FactoryStub.php | 55 + .../Framework/App/MaintenanceModeTest.php | 58 +- .../App/ObjectManagerFactoryTest.php | 68 + .../Magento/Framework/App/ViewTest.php | 118 +- .../App/_files/app/etc/di.xml} | 7 +- .../Framework/Code/NameBuilderTest.php | 4 +- .../Magento/Framework/Config/DataTest.php | 76 + .../Search/Adapter/Mysql/AdapterTest.php | 9 +- .../Adapter/Mysql/Builder/Query/MatchTest.php | 12 +- .../Adapter/Mysql/ConditionManagerTest.php | 173 + .../Search/Adapter/Mysql/DimensionsTest.php | 52 +- .../Mysql/Filter/Builder/RangeTest.php | 93 +- .../Adapter/Mysql/Filter/Builder/TermTest.php | 74 +- .../Mysql/Filter/Builder/WildcardTest.php | 120 + .../Adapter/Mysql/Filter/BuilderTest.php | 192 +- .../Search/Adapter/Mysql/MapperTest.php | 5 +- .../Framework/Search/Request/BinderTest.php | 74 + .../Framework/Search/Request/BuilderTest.php | 231 + .../Framework/Search/Request/CleanerTest.php | 260 + .../Framework/Search/Request/MapperTest.php | 90 + .../Framework/Search/RequestFactoryTest.php | 167 - .../Magento/Framework/Session/ConfigTest.php | 349 +- .../Stdlib/DateTime/DateTimeTest.php | 30 +- .../Stdlib/DateTime/TimezoneTest.php | 8 +- .../Framework/ValidatorFactoryTest.php | 67 + .../View/Page/Config/GeneratorTest.php | 134 + .../Framework/View/Page/Config/ReaderTest.php | 115 + .../View/Page/Config/RendererTest.php | 386 ++ .../View/Page/Config/StructureTest.php | 131 + .../View/Page/Config/_files/template_body.xml | 10 +- .../View/Page/Config/_files/template_head.xml | 36 + .../View/Page/Config/_files/template_html.xml | 10 +- .../Framework/View/PageLayout/ConfigTest.php | 84 + .../View/PageLayout/_files/layouts_one.xml | 12 +- .../View/PageLayout/_files/layouts_two.xml | 12 +- .../Framework/View/Result/PageTest.php | 294 + .../Model/Attribute/ConditionTest.php | 131 + .../Magento/Index/App/IndexerTest.php | 101 - .../testsuite/Magento/Index/App/ShellTest.php | 82 - .../Magento/Index/Model/Config/XsdTest.php | 115 - .../Config/_files/invalidIndexersXmlArray.php | 79 - .../_files/invalidIndexersXmlMergedArray.php | 32 - .../Config/_files/valid_indexers_merged.xml | 31 - .../Index/Model/EventRepositoryTest.php | 92 - .../Model/Indexer/Config/ConverterTest.php | 50 - .../Indexer/Config/SchemaLocatorTest.php | 73 - .../Index/Model/Indexer/ConfigTest.php | 97 - .../Magento/Index/Model/Lock/StorageTest.php | 100 - .../Index/Model/Process/FileFactoryTest.php | 64 - .../Magento/Index/Model/ProcessTest.php | 200 - .../Magento/Indexer/App/ShellTest.php | 2 +- .../Frontend/Quote/SetCanApplyMsrpTest.php | 112 + .../Attribute/Source}/Type/PriceTest.php | 6 +- .../Pricing/Price/MsrpPriceTest.php | 22 +- .../RequireJs/Block/Html/Head/ConfigTest.php | 37 +- .../Block/Adminhtml/Rss/Grid/LinkTest.php | 78 + .../Review/Block/Adminhtml/RssTest.php | 161 + .../Magento/Review/Model/RssTest.php | 98 + .../Rss/Block/Catalog/AbstractCatalogTest.php | 70 - .../Rss/Block/Catalog/CategoryTest.php | 146 - .../Rss/Block/Catalog/NewCatalogTest.php | 148 - .../Magento/Rss/Block/Catalog/ReviewTest.php | 149 - .../Magento/Rss/Block/Catalog/SpecialTest.php | 270 - .../testsuite/Magento/Rss/Block/FeedsTest.php | 87 + .../Rss/Block/Order/Info/Buttons/RssTest.php | 75 - .../Controller/Adminhtml/Feed/IndexTest.php | 125 + .../Magento/Rss/Controller/Feed/IndexTest.php | 120 + .../Magento/Rss/Model/RssManagerTest.php | 80 + .../testsuite/Magento/Rss/Model/RssTest.php | 91 +- .../Magento/Rss/Model/UrlBuilderTest.php | 85 + .../Block/Adminhtml/Order/Totals/TaxTest.php | 121 +- .../Adminhtml/Rss/Order/Grid/LinkTest.php | 99 + .../Magento/Sales/Block/Order/HistoryTest.php | 11 +- .../Block/Order/Info/Buttons/RssTest.php | 120 + .../Invoice/AbstractInvoice/EmailTest.php | 228 + .../Magento/Sales/Model/Rss/NewOrderTest.php | 189 + .../Sales/Model/Rss/OrderStatusTest.php | 198 + .../SalesRule/Block/Rss/DiscountsTest.php | 254 + .../SalesRule/Model/Rss/DiscountsTest.php | 96 + .../Magento/Sitemap/Helper/DataTest.php | 66 + .../Magento/Store/Block/SwitchTest.php | 77 - .../Magento/Store/Block/SwitcherTest.php | 95 + .../Magento/Store/Model/StoreTest.php | 16 +- .../testsuite/Magento/Tax/Helper/DataTest.php | 96 +- .../Tax/Pricing/Render/AdjustmentTest.php | 48 +- .../Magento/Theme/Block/Html/Head/CssTest.php | 73 - .../Theme/Block/Html/Head/LinkTest.php | 73 - .../Theme/Block/Html/Head/ScriptTest.php | 73 - .../Magento/Theme/Block/Html/HeadTest.php | 137 - .../ContentType/Builders/ConfigJsonTest.php | 52 + .../Builders/ConfigStorageJsonTest.php | 108 + .../Ui/ContentType/ContentTypeFactoryTest.php | 102 + .../Magento/Ui/ContentType/HtmlTest.php | 102 + .../ListingContainer/Massaction/ViewTest.php | 167 + .../testsuite/Magento/Ui/Paging/ViewTest.php | 145 + .../testsuite/Magento/Ui/Sorting/ViewTest.php | 206 + .../UrlRedirect/Model/OptionProviderTest.php | 37 - .../App/Request/RewriteServiceTest.php | 93 - .../UrlRewrite/Controller/RouterTest.php | 194 + .../UrlRewrite/Helper/UrlRewriteTest.php | 79 +- .../Resource/UrlRewriteCollectionTest.php | 167 + .../Model/Storage/AbstractStorageTest.php | 152 + .../Model/Storage/DbStorageTest.php | 324 + .../Model/UrlRewrite/OptionProviderTest.php | 43 - .../Model/UrlRewrite/TypeProviderTest.php | 39 - .../UrlRewrite/Model/UrlRewriteTest.php | 103 - .../testsuite/Magento/User/Model/UserTest.php | 87 +- .../Webapi/Model/Config/_files/webapi.php | 29 +- .../Weee/Pricing/Render/AdjustmentTest.php | 52 +- .../Magento/Wishlist/Block/Rss/LinkTest.php | 101 + .../Controller/WishlistProviderTest.php | 211 + .../Magento/Wishlist/Helper/DataTest.php | 103 +- .../Magento/Wishlist/Model/ObserverTest.php | 25 +- .../Rss/WishlistTest.php} | 235 +- .../Migration/Acl/log/AclXPathToAclId.log | 2 +- .../Tools/Migration/Acl/log/MenuIdToAclId.log | 2 +- .../factory_table_names/replace_ce.php | 2 - .../Magento/Framework/App/Action/Action.php | 7 +- .../Magento/Framework/App/Action/Context.php | 2 + .../Magento/Framework/App/ActionFactory.php | 2 - .../Framework/App/ObjectManagerFactory.php | 6 +- .../App/Rss/DataProviderInterface.php | 62 + .../Framework/App/Rss/RssManagerInterface.php | 23 +- .../Magento/Framework/App/Rss/UrlBuilder.php | 19 +- .../Framework/App/Rss/UrlBuilderInterface.php | 18 +- lib/internal/Magento/Framework/App/State.php | 10 + lib/internal/Magento/Framework/App/View.php | 13 +- .../Magento/Framework/AppInterface.php | 2 +- .../Magento/Framework/Config/Data.php | 56 +- .../Magento/Framework/Event/etc/events.xsd | 2 +- .../Framework/Search/AbstractKeyValuePair.php | 2 +- .../Search/Adapter/Mysql/ConditionManager.php | 85 + .../Search/Adapter/Mysql/Dimensions.php | 36 +- .../Search/Adapter/Mysql/Filter/Builder.php | 133 +- .../Mysql/Filter/Builder/FilterInterface.php | 10 +- .../Adapter/Mysql/Filter/Builder/Range.php | 109 +- .../Adapter/Mysql/Filter/Builder/Term.php | 48 +- .../Adapter/Mysql/Filter/Builder/Wildcard.php | 65 + .../Adapter/Mysql/Filter/BuilderInterface.php | 3 +- .../Framework/Search/Adapter/Mysql/Mapper.php | 64 +- .../Adapter/Mysql/Query/Builder/Match.php | 27 +- .../Mysql/Query/Builder/QueryInterface.php | 4 +- .../Framework/Search/Request/Binder.php | 96 + .../Builder.php} | 154 +- .../Framework/Search/Request/Cleaner.php | 206 + .../Framework/Search/Request/Config.php | 9 +- .../Request/Config/FilesystemReader.php | 26 +- .../Framework/Search/Request/Filter/Term.php | 38 +- .../Search/Request/Filter/Wildcard.php | 46 +- .../Search/Request/FilterInterface.php | 2 + .../Framework/Search/Request/Mapper.php | 120 +- .../Framework/Search/Request/Query/Match.php | 25 +- .../Magento/Framework/Search/etc/requests.xsd | 3 +- .../Magento/Framework/Session/Config.php | 111 +- .../Validator/CookieDomainValidator.php | 28 +- .../Validator/CookieLifetimeValidator.php | 45 + .../Config/Validator/CookiePathValidator.php | 19 +- .../Framework/Session/SessionManager.php | 2 +- .../Framework/Stdlib/DateTime/DateTime.php | 2 +- .../Framework/Stdlib/DateTime/Timezone.php | 2 +- .../Magento/Framework/ValidatorFactory.php | 14 +- .../Magento/Framework/View/Asset/Source.php | 2 +- .../Design/FileResolution/Fallback/File.php | 2 +- .../Framework/View/Element/Template.php | 7 + .../View/Element/Template/Context.php | 18 +- .../UiComponent/ConfigBuilderInterface.php | 14 +- .../Element/UiComponent/ConfigFactory.php | 48 +- .../Element/UiComponent/ConfigInterface.php | 70 + .../ConfigStorageBuilderInterface.php | 39 + .../UiComponent/ConfigStorageInterface.php | 175 + .../View/Element/UiComponent/Context.php | 230 + .../View/Element/UiComponentFactory.php | 215 + .../View/Element/UiComponentInterface.php | 92 + .../Magento/Framework/View/FileSystem.php | 2 +- .../Magento/Framework/View/Layout.php | 141 +- .../Magento/Framework/View/Layout/Element.php | 5 + .../Magento/Framework/View/Page/Config.php | 412 +- .../Framework/View/Page/Config/Generator.php | 190 + .../Framework/View/Page/Config/Reader.php | 181 + .../Framework/View/Page/Config/Renderer.php | 377 ++ .../Framework/View/Page/Config/Structure.php | 216 + .../Framework/View/Page/FaviconInterface.php | 40 + .../Framework/View/PageLayout/Config.php | 1 + .../Magento/Framework/View/Result/Layout.php | 4 +- .../Magento/Framework/View/Result/Page.php | 52 +- lib/internal/Magento/Framework/composer.json | 2 +- lib/web/app-config.js | 9 +- lib/web/css/source/lib/variables.less | 10 +- lib/web/date-format-normalizer.js | 62 + lib/web/jquery/autocomplete/autocomplete.css | 5 + .../autocomplete/jquery.autocomplete.js | 915 +++ .../css/bootstrap-carousel.css | 151 - .../jquery.bootstrap-carousel.js | 290 - .../jquery.bootstrap-transition.js | 60 - lib/web/ko/ko.js | 5299 +++++++++++++++++ lib/web/mage/apply/main.js | 133 + lib/web/mage/apply/registry.js | 99 + lib/web/mage/backend/bootstrap.js | 5 +- lib/web/mage/bootstrap.js | 5 +- lib/web/mage/components.js | 2 +- lib/web/mage/dropdown.js | 1 - lib/web/moment.js | 6 + lib/web/requirejs/text.js | 390 ++ lib/web/underscore.js | 1146 ++-- setup/composer.json | 11 +- setup/config/application.config.php | 10 +- setup/module/Magento/Config/Module.php | 17 +- setup/module/Magento/Config/phpunit.xml.dist | 10 +- setup/module/Magento/Config/src/Config.php | 1 - setup/module/Magento/Config/src/Dom.php | 386 -- .../Config/src/Dom/NodePathMatcher.php | 58 - .../Magento/Config/src/Reader/Filesystem.php | 10 +- setup/module/Magento/Filesystem/Module.php | 19 +- setup/module/Magento/Framework/Module.php | 44 - .../Framework/src/DB/ExpressionConverter.php | 102 - .../Magento/Framework/src/Math/Random.php | 84 - setup/module/Magento/Locale/Module.php | 44 - setup/module/Magento/Module/Module.php | 58 - .../Magento/Module/config/di.config.php | 36 - .../Magento/Module/config/module.config.php | 25 - .../Magento/Module/src/Setup/Config.php | 192 - setup/module/Magento/Setup/Module.php | 35 +- .../module/Magento/Setup/config/di.config.php | 7 + .../Magento/Setup/config/router.config.php | 5 +- setup/module/Magento/Setup/phpunit.xml.dist | 8 +- .../src/Controller/ConsoleController.php | 406 ++ .../Controller/Data/DatabaseController.php | 20 +- .../Data/FilePermissionsController.php | 13 +- .../Install/ClearProgressController.php | 34 +- .../Controller/Install/ProgressController.php | 26 +- .../Controller/Install/StartController.php | 271 +- .../DB/Adapter/AdapterInterface.php | 32 +- .../src/Framework}/DB/Adapter/Pdo/Mysql.php | 74 +- .../src/Framework}/DB/Ddl/Table.php | 4 +- .../src/Framework}/DB/Ddl/Trigger.php | 2 +- .../Magento/Setup/src/Model/AdminAccount.php | 53 +- .../Setup/src/Model/AdminAccountFactory.php | 41 +- .../Magento/Setup/src/Model/ConsoleLogger.php | 83 + .../Magento/Setup/src/Model/DatabaseCheck.php | 2 +- .../Setup/src/Model/FilePermissions.php | 12 + .../Magento/Setup/src/Model/Installer.php | 321 + .../Setup/src/Model/InstallerFactory.php | 61 + .../src/Model/LoggerInterface.php} | 44 +- .../Setup/src/Model/UserConfigurationData.php | 133 + .../src/Model/{Logger.php => WebLogger.php} | 75 +- .../src/Module}/Converter/Dom.php | 2 +- .../src/Module}/Dependency/Manager.php | 2 +- .../Module}/Dependency/ManagerInterface.php | 2 +- .../{Module/src => Setup/src/Module}/Dir.php | 6 +- .../src => Setup/src/Module}/FileResolver.php | 2 +- .../src => Setup/src/Module}/ModuleList.php | 4 +- .../src/Module}/ModuleListInterface.php | 2 +- .../src/Module}/Reader/Filesystem.php | 14 +- .../src/Module}/Resource/Resource.php | 16 +- .../src/Module}/ResourceInterface.php | 2 +- .../src/Module}/SchemaLocator.php | 2 +- .../src => Setup/src/Module}/Setup.php | 362 +- .../Magento/Setup/src/Module/Setup/Config.php | 251 + .../Setup/src/Module/Setup/ConfigFactory.php | 55 + .../src/Module}/Setup/Connection/Adapter.php | 15 +- .../Setup/Connection/AdapterInterface.php | 4 +- .../src/Module}/Setup/FileResolver.php | 71 +- .../src => Setup/src/Module}/SetupFactory.php | 84 +- .../Magento/Setup/src/Module/SetupModule.php | 269 + .../src/Module}/Updater/SetupInterface.php | 15 +- setup/pub/magento/setup/install.js | 11 +- setup/pub/magento/setup/web-configuration.js | 8 +- 1816 files changed, 63493 insertions(+), 37399 deletions(-) create mode 100644 CONTRIBUTOR_LICENSE_AGREEMENT.html delete mode 100644 app/code/Magento/AdminNotification/Helper/Data.php delete mode 100644 app/code/Magento/Backend/Block/Page/Head.php rename app/code/Magento/{Catalog/Block/Product/Widget/Link.php => Backend/Block/Page/RequireJs.php} (64%) delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Edit.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Edit.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Grid.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Grid.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Edit.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php delete mode 100644 app/code/Magento/Backend/Block/Urlrewrite/Selector.php delete mode 100644 app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite/Save.php create mode 100644 app/code/Magento/Backend/Model/Config/Backend/Cookie/Domain.php create mode 100644 app/code/Magento/Backend/Model/Config/Backend/Cookie/Lifetime.php create mode 100644 app/code/Magento/Backend/Model/Config/Backend/Cookie/Path.php rename app/code/Magento/Backend/{ => Model/Session}/AdminConfig.php (90%) delete mode 100644 app/code/Magento/Backend/view/adminhtml/layout/adminhtml_urlrewrite_index.xml create mode 100644 app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml delete mode 100644 app/code/Magento/Backend/view/adminhtml/templates/admin/popup.phtml delete mode 100644 app/code/Magento/Backend/view/adminhtml/templates/page/head.phtml create mode 100644 app/code/Magento/Backend/view/adminhtml/templates/page/js/head_scripts.phtml create mode 100644 app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml delete mode 100644 app/code/Magento/Backend/view/adminhtml/templates/urlrewrite/selector.phtml delete mode 100644 app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/General.php create mode 100644 app/code/Magento/Catalog/Block/Adminhtml/Rss/Grid/Link.php create mode 100644 app/code/Magento/Catalog/Block/Adminhtml/Rss/NotifyStock.php create mode 100644 app/code/Magento/Catalog/Block/Category/Rss/Link.php create mode 100644 app/code/Magento/Catalog/Block/Rss/Category.php create mode 100644 app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php create mode 100644 app/code/Magento/Catalog/Block/Rss/Product/Special.php delete mode 100644 app/code/Magento/Catalog/Model/Indexer/Url.php delete mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/Backend/Msrp.php delete mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/Backend/Urlkey.php delete mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type/Enabled.php mode change 100755 => 100644 app/code/Magento/Catalog/Model/Product/Type/Price.php delete mode 100644 app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php delete mode 100644 app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php create mode 100644 app/code/Magento/Catalog/Model/Rss/Category.php create mode 100644 app/code/Magento/Catalog/Model/Rss/Product/NewProducts.php create mode 100644 app/code/Magento/Catalog/Model/Rss/Product/NotifyStock.php create mode 100644 app/code/Magento/Catalog/Model/Rss/Product/Special.php delete mode 100644 app/code/Magento/Catalog/Model/Url.php rename app/code/Magento/{Rss/Controller/Index/Nofeed.php => Catalog/data/catalog_setup/data-upgrade-1.6.0.0.28-1.6.0.0.29.php} (58%) delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.3-1.6.0.0.4.php create mode 100644 app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml rename app/code/Magento/{Rss/view/frontend/templates/category/link.phtml => Catalog/view/frontend/templates/category/rss.phtml} (82%) create mode 100644 app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php create mode 100644 app/code/Magento/CatalogSearch/Model/Search/RequestGenerator.php rename app/code/Magento/{Catalog/Block/Adminhtml/Form/Renderer/Attribute/Urlkey.php => CatalogUrlRewrite/Block/UrlKeyRenderer.php} (79%) delete mode 100644 app/code/Magento/CatalogUrlRewrite/Helper/Data.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenCategoriesProvider.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenUrlRewriteGenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Remove.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Storage.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php rename app/code/Magento/{Cms/Model/Resource/Page/Urlrewrite.php => CatalogUrlRewrite/Model/Category/Product.php} (77%) create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php rename app/code/Magento/{UrlRewrite/Model/UrlRewrite/TypeProvider.php => CatalogUrlRewrite/Model/ObjectRegistry.php} (57%) create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Product/Plugin/Import.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Resource/Category/Product.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Resource/Category/ProductCollection.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Model/Storage/DbStorage.php rename app/code/Magento/{Index/Controller/Adminhtml/Process/ListAction.php => CatalogUrlRewrite/Observer/CategorySaveRewritesHistorySetter.php} (58%) create mode 100644 app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Observer/ProductUrlKeyAutogenerator.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Block/Adminhtml/Category/Tab/Attributes.php rename app/code/Magento/{Catalog/Block/Adminhtml/Product/Helper/Form/Msrp/Price.php => CatalogUrlRewrite/Plugin/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php} (53%) rename app/code/Magento/{UrlRewrite/App/FrontController/Plugin/UrlRewrite.php => CatalogUrlRewrite/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php} (55%) delete mode 100644 app/code/Magento/CatalogUrlRewrite/Service/V1/AbstractUrlGenerator.php delete mode 100644 app/code/Magento/CatalogUrlRewrite/Service/V1/CategoryUrlGenerator.php delete mode 100644 app/code/Magento/CatalogUrlRewrite/Service/V1/ProductUrlGenerator.php delete mode 100644 app/code/Magento/CatalogUrlRewrite/Service/V1/ProductUrlGeneratorInterface.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Service/V1/StoreViewService.php create mode 100644 app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/data-install-1.0.0.0.php create mode 100644 app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml create mode 100644 app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml rename app/code/Magento/{Index => CatalogUrlRewrite}/etc/di.xml (70%) rename app/code/Magento/{Catalog/etc/indexers.xml => CatalogUrlRewrite/etc/eav_attributes.xml} (82%) rename app/code/Magento/{UrlRedirect/etc/frontend => CatalogUrlRewrite/etc/install}/di.xml (68%) create mode 100644 app/code/Magento/CatalogUrlRewrite/etc/install/events.xml rename app/code/Magento/{Cms/sql/cms_setup/upgrade-1.6.0.1-1.6.0.2.php => CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-1.0.0.0.php} (56%) mode change 100755 => 100644 app/code/Magento/Checkout/Controller/Onepage.php create mode 100644 app/code/Magento/Checkout/view/frontend/templates/cart/subtotal.phtml create mode 100644 app/code/Magento/Cms/Controller/Adminhtml/AbstractMassDelete.php create mode 100644 app/code/Magento/Cms/Controller/Adminhtml/Block/MassDelete.php create mode 100644 app/code/Magento/Cms/Controller/Adminhtml/Page/MassDelete.php create mode 100644 app/code/Magento/Cms/Model/Resource/Page/Grid/Collection.php create mode 100644 app/code/Magento/Cms/Ui/DataProvider/Block/Row/Actions.php create mode 100644 app/code/Magento/Cms/Ui/DataProvider/Page/Options/IsActive.php rename app/code/Magento/{UrlRedirect/Service/V1/Data/Converter.php => Cms/Ui/DataProvider/Page/Options/PageLayout.php} (53%) create mode 100644 app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php create mode 100644 app/code/Magento/Cms/view/adminhtml/layout/cms_block_listing.xml create mode 100644 app/code/Magento/Cms/view/adminhtml/layout/cms_page_listing.xml rename app/code/Magento/{Cms/Model/Page/Urlrewrite.php => CmsUrlRewrite/Model/CmsPageUrlPathGenerator.php} (59%) rename app/code/Magento/CmsUrlRewrite/{Service/V1/CmsPageUrlGenerator.php => Model/CmsPageUrlRewriteGenerator.php} (64%) create mode 100644 app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/Resource/Page.php rename app/code/Magento/{UrlRedirect/Model/StorageInterface.php => ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Price/Data.php} (51%) rename app/code/Magento/ConfigurableProduct/sql/{configurable_setup => configurableproduct_setup}/install-1.0.0.0.php (100%) create mode 100644 app/code/Magento/Core/etc/body.xsd create mode 100644 app/code/Magento/Core/etc/head.xsd rename app/code/Magento/{Index/etc/indexers_merged.xsd => Core/etc/html.xsd} (60%) mode change 100755 => 100644 app/code/Magento/Customer/Block/Form/Edit.php mode change 100755 => 100644 app/code/Magento/Customer/Helper/Address.php mode change 100755 => 100644 app/code/Magento/Customer/Model/Session.php mode change 100755 => 100644 app/code/Magento/Customer/view/frontend/templates/form/edit.phtml delete mode 100644 app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php delete mode 100644 app/code/Magento/Index/App/Indexer.php delete mode 100644 app/code/Magento/Index/App/Shell.php delete mode 100644 app/code/Magento/Index/Block/Adminhtml/Process.php delete mode 100644 app/code/Magento/Index/Block/Adminhtml/Process/Edit.php delete mode 100644 app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tab/Main.php delete mode 100644 app/code/Magento/Index/Block/Adminhtml/Process/Grid.php delete mode 100644 app/code/Magento/Index/Controller/Adminhtml/Process.php delete mode 100644 app/code/Magento/Index/Controller/Adminhtml/Process/Edit.php delete mode 100644 app/code/Magento/Index/Controller/Adminhtml/Process/MassChangeMode.php delete mode 100644 app/code/Magento/Index/Controller/Adminhtml/Process/MassReindex.php delete mode 100644 app/code/Magento/Index/Controller/Adminhtml/Process/ReindexProcess.php delete mode 100644 app/code/Magento/Index/Controller/Adminhtml/Process/Save.php delete mode 100644 app/code/Magento/Index/Model/Event.php delete mode 100644 app/code/Magento/Index/Model/EventRepository.php delete mode 100644 app/code/Magento/Index/Model/Indexer.php delete mode 100644 app/code/Magento/Index/Model/Indexer/AbstractIndexer.php delete mode 100644 app/code/Magento/Index/Model/Indexer/Config.php delete mode 100644 app/code/Magento/Index/Model/Indexer/Config/Converter.php delete mode 100644 app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php delete mode 100644 app/code/Magento/Index/Model/IndexerInterface.php delete mode 100644 app/code/Magento/Index/Model/Lock/Storage.php delete mode 100644 app/code/Magento/Index/Model/Observer.php delete mode 100644 app/code/Magento/Index/Model/Process.php delete mode 100644 app/code/Magento/Index/Model/Process/File.php delete mode 100644 app/code/Magento/Index/Model/Resource/Event.php delete mode 100644 app/code/Magento/Index/Model/Resource/Event/Collection.php delete mode 100644 app/code/Magento/Index/Model/Resource/Process.php delete mode 100644 app/code/Magento/Index/Model/Resource/Process/Collection.php delete mode 100644 app/code/Magento/Index/Model/Resource/Setup.php delete mode 100644 app/code/Magento/Index/Model/Shell.php delete mode 100644 app/code/Magento/Index/Model/System/Message/IndexOutdated.php delete mode 100644 app/code/Magento/Index/etc/events.xml delete mode 100644 app/code/Magento/Index/etc/indexers.xsd delete mode 100644 app/code/Magento/Index/i18n/de_DE.csv delete mode 100644 app/code/Magento/Index/i18n/en_US.csv delete mode 100644 app/code/Magento/Index/i18n/es_ES.csv delete mode 100644 app/code/Magento/Index/i18n/fr_FR.csv delete mode 100644 app/code/Magento/Index/i18n/nl_NL.csv delete mode 100644 app/code/Magento/Index/i18n/pt_BR.csv delete mode 100644 app/code/Magento/Index/i18n/zh_CN.csv delete mode 100644 app/code/Magento/Index/sql/index_setup/install-1.6.0.0.php delete mode 100644 app/code/Magento/Index/view/adminhtml/layout/adminhtml_process_edit.xml rename app/code/Magento/{Index => Indexer}/Model/Resource/AbstractResource.php (99%) rename app/code/Magento/LayeredNavigation/view/frontend/layout/{page_one_column.xml => 1column.xml} (100%) rename app/code/Magento/LayeredNavigation/view/frontend/layout/{page_two_columns_left.xml => 2columns-left.xml} (100%) rename app/code/Magento/LayeredNavigation/view/frontend/layout/{page_two_columns_right.xml => 2columns-right.xml} (100%) rename app/code/Magento/LayeredNavigation/view/frontend/layout/{page_three_columns.xml => 3columns.xml} (100%) rename app/code/Magento/Log/view/adminhtml/layout/{customer_online_index.xml => visitor_online_index.xml} (100%) create mode 100644 app/code/Magento/Msrp/Block/Adminhtml/Product/Helper/Form/Type.php create mode 100644 app/code/Magento/Msrp/Block/Adminhtml/Product/Helper/Form/Type/Price.php rename app/code/Magento/{Catalog/Block/Category/Widget/Link.php => Msrp/Block/Popup.php} (60%) rename app/code/Magento/{Rss/Block/AbstractBlock.php => Msrp/Block/Total.php} (54%) create mode 100644 app/code/Magento/Msrp/Helper/Data.php create mode 100644 app/code/Magento/Msrp/Model/Config.php rename setup/module/Magento/Config/src/Dom/NodeMergingConfig.php => app/code/Magento/Msrp/Model/Msrp.php (50%) rename app/code/Magento/{Sales => Msrp}/Model/Observer/Frontend/Quote/SetCanApplyMsrp.php (81%) rename app/code/Magento/{Catalog/Model/Product/Attribute/Source/Msrp => Msrp/Model/Product/Attribute/Source}/Type.php (81%) rename app/code/Magento/{Catalog/Model/Product/Attribute/Source/Msrp => Msrp/Model/Product/Attribute/Source}/Type/Price.php (71%) create mode 100644 app/code/Magento/Msrp/Model/Product/Options.php rename app/code/Magento/{Sales/Model/Quote/Address/Total/Msrp.php => Msrp/Model/Quote/Address/Total.php} (68%) create mode 100644 app/code/Magento/Msrp/Plugin/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php rename app/code/Magento/{Catalog => Msrp}/Pricing/Price/MsrpPrice.php (67%) rename app/code/Magento/{Catalog => Msrp}/Pricing/Price/MsrpPriceInterface.php (92%) create mode 100644 app/code/Magento/Msrp/composer.json rename app/code/Magento/{Catalog/data/catalog_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php => Msrp/data/msrp_setup/data-install-1.0.0.0.php} (67%) create mode 100644 app/code/Magento/Msrp/etc/adminhtml/di.xml create mode 100644 app/code/Magento/Msrp/etc/adminhtml/system.xml rename dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/_files/indexers.xml => app/code/Magento/Msrp/etc/catalog_attributes.xml (82%) create mode 100644 app/code/Magento/Msrp/etc/config.xml create mode 100644 app/code/Magento/Msrp/etc/di.xml create mode 100644 app/code/Magento/Msrp/etc/frontend/events.xml rename app/code/Magento/{UrlRedirect => Msrp}/etc/module.xml (72%) create mode 100644 app/code/Magento/Msrp/etc/sales.xml create mode 100644 app/code/Magento/Msrp/view/base/layout/catalog_product_prices.xml rename app/code/Magento/{Catalog/view/base/templates/product/price/msrp_price.phtml => Msrp/view/base/templates/product/price/msrp.phtml} (72%) rename app/code/Magento/{Catalog => Msrp}/view/base/web/js/msrp.js (75%) rename app/code/Magento/{Rss => Msrp}/view/frontend/layout/catalog_category_view.xml (75%) create mode 100644 app/code/Magento/Msrp/view/frontend/layout/catalog_product_compare_index.xml create mode 100644 app/code/Magento/Msrp/view/frontend/layout/catalog_product_view.xml rename app/code/Magento/{Rss/view/adminhtml/layout/sales_order_grid_block.xml => Msrp/view/frontend/layout/catalog_product_view_type_downloadable.xml} (75%) rename app/code/Magento/{Catalog => Msrp}/view/frontend/layout/catalogsearch_advanced_result.xml (96%) rename app/code/Magento/{Catalog => Msrp}/view/frontend/layout/catalogsearch_result_index.xml (96%) rename app/code/Magento/{Rss/view/frontend/layout/rss_catalog_special.xml => Msrp/view/frontend/layout/checkout_cart_index.xml} (64%) rename app/code/Magento/{Catalog => Msrp}/view/frontend/layout/checkout_onepage_failure.xml (96%) rename app/code/Magento/{Catalog => Msrp}/view/frontend/layout/checkout_onepage_success.xml (96%) create mode 100644 app/code/Magento/Msrp/view/frontend/layout/default.xml rename app/code/Magento/{Catalog/view/frontend/layout/MAP_popup.xml => Msrp/view/frontend/layout/msrp_popup.xml} (90%) rename app/code/Magento/{Catalog => Msrp}/view/frontend/layout/review_product_list.xml (92%) rename app/code/Magento/{Catalog/view/frontend/layout/checkout_cart_index.xml => Msrp/view/frontend/layout/wishlist_index_configure_type_downloadable.xml} (84%) rename app/code/Magento/{Catalog => Msrp}/view/frontend/layout/wishlist_index_index.xml (92%) rename app/code/Magento/{Catalog => Msrp}/view/frontend/layout/wishlist_search_view.xml (92%) rename app/code/Magento/{Catalog => Msrp}/view/frontend/layout/wishlist_shared_index.xml (92%) rename lib/web/requirejs-config.js => app/code/Magento/Msrp/view/frontend/templates/cart/subtotal.phtml (82%) create mode 100644 app/code/Magento/Msrp/view/frontend/templates/cart/totals.phtml rename app/code/Magento/{Catalog/view/frontend/templates/msrp => Msrp/view/frontend/templates}/popup.phtml (84%) rename app/code/Magento/{Wishlist => Msrp}/view/frontend/templates/render/item/price_msrp_item.phtml (99%) rename app/code/Magento/{Wishlist => Msrp}/view/frontend/templates/render/item/price_msrp_rss.phtml (92%) mode change 100755 => 100644 app/code/Magento/Multishipping/Controller/Checkout.php mode change 100755 => 100644 app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php mode change 100755 => 100644 app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php create mode 100644 app/code/Magento/Review/Block/Adminhtml/Rss.php create mode 100644 app/code/Magento/Review/Block/Adminhtml/Rss/Grid/Link.php create mode 100644 app/code/Magento/Review/Model/Rss.php create mode 100644 app/code/Magento/Review/view/adminhtml/layout/review_product_index.xml create mode 100644 app/code/Magento/Review/view/adminhtml/templates/rss/grid/link.phtml delete mode 100644 app/code/Magento/Rss/Block/Catalog/AbstractCatalog.php delete mode 100644 app/code/Magento/Rss/Block/Catalog/Category.php delete mode 100644 app/code/Magento/Rss/Block/Catalog/NewCatalog.php delete mode 100644 app/code/Magento/Rss/Block/Catalog/NotifyStock.php delete mode 100644 app/code/Magento/Rss/Block/Catalog/Review.php delete mode 100644 app/code/Magento/Rss/Block/Catalog/Salesrule.php delete mode 100644 app/code/Magento/Rss/Block/Catalog/Special.php create mode 100644 app/code/Magento/Rss/Block/Feeds.php delete mode 100644 app/code/Magento/Rss/Block/ListBlock.php delete mode 100644 app/code/Magento/Rss/Block/Order/NewOrder.php delete mode 100644 app/code/Magento/Rss/Block/Order/Status.php create mode 100644 app/code/Magento/Rss/Controller/Adminhtml/Feed.php rename app/code/Magento/Rss/Controller/Adminhtml/{Catalog/Review.php => Feed/Index.php} (52%) delete mode 100644 app/code/Magento/Rss/Controller/Adminhtml/Order/NewAction.php rename app/code/Magento/Rss/Controller/{Catalog.php => Feed.php} (55%) rename app/code/Magento/Rss/Controller/{Adminhtml/Catalog/Notifystock.php => Feed/Index.php} (53%) delete mode 100644 app/code/Magento/Rss/Helper/Order.php create mode 100644 app/code/Magento/Rss/Model/RssManager.php create mode 100644 app/code/Magento/Rss/Model/UrlBuilder.php rename app/code/Magento/{Index/etc/adminhtml/menu.xml => Rss/etc/di.xml} (76%) delete mode 100644 app/code/Magento/Rss/view/frontend/layout/rss_catalog_category.xml delete mode 100644 app/code/Magento/Rss/view/frontend/layout/rss_catalog_new.xml create mode 100644 app/code/Magento/Rss/view/frontend/templates/feeds.phtml delete mode 100644 app/code/Magento/Rss/view/frontend/templates/list.phtml rename app/code/Magento/{Rss/Block => Sales/Block/Adminhtml}/Order/Details.php (89%) rename app/code/Magento/{Rss/Block/Order/Info/Buttons/Rss.php => Sales/Block/Adminhtml/Rss/Order/Grid/Link.php} (57%) create mode 100644 app/code/Magento/Sales/Block/Order/Info/Buttons/Rss.php create mode 100644 app/code/Magento/Sales/Model/OrderRepository/Plugin/Authorization.php rename app/code/Magento/{Rss/Model/Resource/Order.php => Sales/Model/Resource/Order/Rss/OrderStatus.php} (84%) create mode 100644 app/code/Magento/Sales/Model/Rss/NewOrder.php create mode 100644 app/code/Magento/Sales/Model/Rss/OrderStatus.php mode change 100755 => 100644 app/code/Magento/Sales/Model/Service/Quote.php rename app/code/Magento/{Index => Sales}/etc/adminhtml/di.xml (84%) rename app/code/Magento/{Rss/view/frontend => Sales/view/adminhtml}/templates/order/details.phtml (100%) create mode 100644 app/code/Magento/Sales/view/adminhtml/templates/rss/order/grid/link.phtml create mode 100644 app/code/Magento/Sales/view/frontend/templates/order/info/buttons/rss.phtml create mode 100644 app/code/Magento/SalesRule/Block/Rss/Discounts.php create mode 100644 app/code/Magento/SalesRule/Model/Rss/Discounts.php rename setup/module/Magento/Config/src/Dom/ValidationException.php => app/code/Magento/Store/Ui/DataType/Store.php (84%) rename app/code/Magento/{Rss/view/frontend/layout/rss_catalog_salesrule.xml => Store/view/base/layout/ui_components.xml} (69%) rename app/code/Magento/{ConfigurableProduct/view/frontend => Store/view/base}/requirejs-config.js (86%) create mode 100644 app/code/Magento/Store/view/base/web/js/listing/filter/store.js create mode 100644 app/code/Magento/Store/view/base/web/templates/filter/store.html create mode 100644 app/code/Magento/Store/view/base/web/templates/filter/store/item.html delete mode 100644 app/code/Magento/Tax/view/base/templates/pricing/adjustment/downloadable.phtml delete mode 100644 app/code/Magento/Theme/Block/Html.php delete mode 100644 app/code/Magento/Theme/Block/Html/Head.php create mode 100644 app/code/Magento/Theme/Model/Favicon/Favicon.php delete mode 100644 app/code/Magento/Theme/view/adminhtml/templates/empty.phtml delete mode 100644 app/code/Magento/Theme/view/frontend/layout/print.xml delete mode 100644 app/code/Magento/Theme/view/frontend/templates/html/head.phtml create mode 100644 app/code/Magento/Theme/view/frontend/templates/js/require_js.phtml delete mode 100644 app/code/Magento/Theme/view/frontend/templates/popup.phtml delete mode 100644 app/code/Magento/Theme/view/frontend/templates/print.phtml create mode 100644 app/code/Magento/Translation/view/base/templates/translate.phtml create mode 100644 app/code/Magento/Ui/AbstractView.php create mode 100644 app/code/Magento/Ui/Configuration.php create mode 100644 app/code/Magento/Ui/ConfigurationStorage.php rename app/code/Magento/{Index/Block/Adminhtml/Process/Grid/Massaction.php => Ui/ContentType/Builders/ConfigJson.php} (62%) create mode 100644 app/code/Magento/Ui/ContentType/Builders/ConfigStorageJson.php create mode 100644 app/code/Magento/Ui/ContentType/ContentTypeFactory.php create mode 100644 app/code/Magento/Ui/ContentType/ContentTypeInterface.php create mode 100644 app/code/Magento/Ui/ContentType/Html.php create mode 100644 app/code/Magento/Ui/ContentType/Json.php create mode 100644 app/code/Magento/Ui/ContentType/Xml.php create mode 100644 app/code/Magento/Ui/Context/DataProvider.php rename dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/_files/indexers.php => app/code/Magento/Ui/Control/Action.php (81%) create mode 100644 app/code/Magento/Ui/Control/ActionPool.php create mode 100644 app/code/Magento/Ui/Control/ActionPoolInterface.php create mode 100644 app/code/Magento/Ui/Control/Button.php create mode 100644 app/code/Magento/Ui/Control/Container.php create mode 100644 app/code/Magento/Ui/Control/ControlInterface.php create mode 100644 app/code/Magento/Ui/Control/Item.php create mode 100644 app/code/Magento/Ui/Control/Link.php rename app/code/Magento/{Rss/Controller/Order/Status.php => Ui/Controller/Adminhtml/Listing/Ajax.php} (50%) create mode 100644 app/code/Magento/Ui/DataProvider/Options/Store.php rename app/code/Magento/{UrlRedirect/Model/OptionProvider.php => Ui/DataProvider/OptionsFactory.php} (52%) rename app/code/Magento/{Theme/Block/Html/Head/AssetBlockInterface.php => Ui/DataProvider/OptionsInterface.php} (81%) create mode 100644 app/code/Magento/Ui/DataProvider/Row/Store.php rename app/code/Magento/{Rss/Controller/Catalog/Salesrule.php => Ui/DataProvider/RowInterface.php} (81%) create mode 100644 app/code/Magento/Ui/DataProvider/RowPool.php rename app/code/Magento/{Theme/Block/Html/Head/Link.php => Ui/DataType/AbstractDataType.php} (68%) create mode 100644 app/code/Magento/Ui/DataType/Boolean.php create mode 100644 app/code/Magento/Ui/DataType/DataTypeInterface.php create mode 100644 app/code/Magento/Ui/DataType/Date.php create mode 100644 app/code/Magento/Ui/DataType/Media.php create mode 100644 app/code/Magento/Ui/DataType/Number.php create mode 100644 app/code/Magento/Ui/DataType/Password.php create mode 100644 app/code/Magento/Ui/DataType/Text.php rename app/code/Magento/{UrlRedirect/Service/V1/UrlSaveInterface.php => Ui/Filter/FilterInterface.php} (77%) create mode 100644 app/code/Magento/Ui/Filter/FilterPool.php create mode 100644 app/code/Magento/Ui/Filter/Type/Date.php rename app/code/Magento/{Theme/Block/Html/Head/Script.php => Ui/Filter/Type/Input.php} (69%) rename app/code/Magento/{Catalog/Model/Category/Attribute/Backend/Urlkey.php => Ui/Filter/Type/Range.php} (56%) rename app/code/Magento/{Theme/Block/Html/Head/Css.php => Ui/Filter/Type/Select.php} (70%) rename app/code/Magento/{Index/App/Shell/ErrorHandler.php => Ui/Filter/Type/Store.php} (76%) create mode 100644 app/code/Magento/Ui/Filter/View.php create mode 100644 app/code/Magento/Ui/FilterPool/View.php rename app/code/Magento/{Customer/Model/Resource/Form/Attribute/CollectionFactory.php => Ui/Form/Field.php} (62%) rename app/code/Magento/{Index/Model/Process/FileFactory.php => Ui/FormElement/AbstractFormElement.php} (58%) create mode 100644 app/code/Magento/Ui/FormElement/Checkbox.php create mode 100644 app/code/Magento/Ui/FormElement/ElementInterface.php rename app/code/Magento/{Index/Controller/Adminhtml/Process/ReindexAll.php => Ui/FormElement/Input.php} (79%) rename app/code/Magento/{Rss/Controller/Catalog/NewAction.php => Ui/FormElement/Radio.php} (83%) rename app/code/Magento/{Rss/Controller/Catalog/Special.php => Ui/FormElement/Range.php} (83%) create mode 100644 app/code/Magento/Ui/FormElement/Select.php create mode 100644 app/code/Magento/Ui/FormElement/Textarea.php create mode 100644 app/code/Magento/Ui/Listing/View.php create mode 100644 app/code/Magento/Ui/ListingContainer/Massaction/View.php create mode 100644 app/code/Magento/Ui/Paging/View.php create mode 100644 app/code/Magento/Ui/Search/View.php create mode 100644 app/code/Magento/Ui/Sorting/View.php rename app/code/Magento/{Index => Ui}/composer.json (51%) rename app/code/Magento/{UrlRedirect => Ui}/etc/adminhtml/routes.xml (91%) create mode 100644 app/code/Magento/Ui/etc/di.xml rename app/code/Magento/{Index => Ui}/etc/module.xml (88%) create mode 100644 app/code/Magento/Ui/view/base/layout/default.xml create mode 100644 app/code/Magento/Ui/view/base/layout/ui_components.xml create mode 100644 app/code/Magento/Ui/view/base/requirejs-config.js create mode 100644 app/code/Magento/Ui/view/base/templates/context/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/control/action/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/control/button/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/data_type/boolean/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/data_type/date/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/data_type/media/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/data_type/number/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/data_type/password/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/data_type/text/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter/content.phtml rename app/code/Magento/{UrlRedirect/view/adminhtml/templates/edit.phtml => Ui/view/base/templates/filter/default.phtml} (71%) create mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/date/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/date/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/input/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/input/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/range/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/range/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/select/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/select/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter_pool/active.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/filter_pool/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/checkbox/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/checkbox/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/input/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/input/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/radio/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/radio/label.phtml rename app/code/Magento/{Backend/view/adminhtml/templates/urlrewrite/categories.phtml => Ui/view/base/templates/form_element/range/content.phtml} (54%) create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/range/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/select/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/select/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/textarea/content.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form_element/textarea/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/label/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/listing/horizontal_grid.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/listingcontainer/massaction/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/listingcontainer/massaction/page_actions.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/paging/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/sorting/default.phtml create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/class.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/component.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/events.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/bind/date.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/bind/datepicker.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/bind/outer_click.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/bind/scope.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/bind/stop_propagation.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/initialize.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/scope.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/template/engine.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/template/observable_source.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/loader.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/mixins/loader.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/registry/events.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/registry/registry.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/registry/storage.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/renderer/overrides.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/renderer/renderer.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/spinner.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/storage/index.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/storage/meta.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/storage/storage.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/utils.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/filter.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/filter/abstract.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/filter/date.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/filter/filters.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/filter/input.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/filter/range.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/filter/select.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/grid.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/massaction.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/paging.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/sorting.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/utils/data_provider.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/utils/provider.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/utils/request_builder.js create mode 100644 app/code/Magento/Ui/view/base/web/js/listing/utils/rest.js create mode 100644 app/code/Magento/Ui/view/base/web/templates/filter.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/filter/filter_date.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/filter/filter_input.html rename app/code/Magento/{Reports/view/frontend/templates/product_compared.phtml => Ui/view/base/web/templates/filter/filter_range.html} (50%) create mode 100644 app/code/Magento/Ui/view/base/web/templates/filter/filter_select.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/listing/grid.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/listing/grid/cell/actions.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/listing/grid/cell/date.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/listing/grid/cell/store.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/listing/grid/cell/text.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/listing/grid/extender/selectable.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/listing/grid/extender/sortable.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/massaction.html rename app/code/Magento/{Reports/view/frontend/templates/product_viewed.phtml => Ui/view/base/web/templates/pageactions.html} (52%) create mode 100644 app/code/Magento/Ui/view/base/web/templates/pagination.html delete mode 100644 app/code/Magento/UrlRedirect/Controller/Adminhtml/UrlRedirect.php delete mode 100644 app/code/Magento/UrlRedirect/Controller/Router.php delete mode 100644 app/code/Magento/UrlRedirect/Helper/UrlRewrite.php delete mode 100644 app/code/Magento/UrlRedirect/Model/Resource/UrlRedirect.php delete mode 100644 app/code/Magento/UrlRedirect/Model/Storage/Db.php delete mode 100644 app/code/Magento/UrlRedirect/Service/V1/Data/Filter.php delete mode 100644 app/code/Magento/UrlRedirect/Service/V1/UrlManager.php delete mode 100644 app/code/Magento/UrlRedirect/Service/V1/UrlMatcherInterface.php delete mode 100644 app/code/Magento/UrlRedirect/composer.json delete mode 100644 app/code/Magento/UrlRedirect/i18n/de_DE.csv delete mode 100644 app/code/Magento/UrlRedirect/i18n/en_US.csv delete mode 100644 app/code/Magento/UrlRedirect/i18n/es_ES.csv delete mode 100644 app/code/Magento/UrlRedirect/i18n/fr_FR.csv delete mode 100644 app/code/Magento/UrlRedirect/i18n/nl_NL.csv delete mode 100644 app/code/Magento/UrlRedirect/i18n/pt_BR.csv delete mode 100644 app/code/Magento/UrlRedirect/i18n/zh_CN.csv delete mode 100644 app/code/Magento/UrlRedirect/sql/urlredirect_setup/install-1.0.0.0.php delete mode 100644 app/code/Magento/UrlRewrite/App/Request/RewriteService.php rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Catalog/Category/Edit.php (83%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Catalog/Category/Tree.php (95%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Catalog/Edit/Form.php (72%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Catalog/Product/Edit.php (83%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Catalog/Product/Grid.php (88%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Cms/Page/Edit.php (83%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Cms/Page/Edit/Form.php (75%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Cms/Page/Grid.php (98%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Edit.php (87%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Edit/Form.php (91%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/GridContainer.php (88%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Link.php (97%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Block/Selector.php (94%) rename app/code/Magento/{Backend/Controller/Adminhtml/Urlrewrite.php => UrlRewrite/Controller/Adminhtml/Url/Rewrite.php} (71%) rename app/code/Magento/{Backend/Controller/Adminhtml/Urlrewrite => UrlRewrite/Controller/Adminhtml/Url/Rewrite}/CategoriesJson.php (83%) rename app/code/Magento/{Backend/Controller/Adminhtml/Urlrewrite => UrlRewrite/Controller/Adminhtml/Url/Rewrite}/CmsPageGrid.php (81%) rename app/code/Magento/{Backend/Controller/Adminhtml/Urlrewrite => UrlRewrite/Controller/Adminhtml/Url/Rewrite}/Delete.php (92%) rename app/code/Magento/{Backend/Controller/Adminhtml/Urlrewrite => UrlRewrite/Controller/Adminhtml/Url/Rewrite}/Edit.php (80%) rename app/code/Magento/{Backend/Controller/Adminhtml/Urlrewrite => UrlRewrite/Controller/Adminhtml/Url/Rewrite}/Index.php (81%) rename app/code/Magento/{Backend/Controller/Adminhtml/Urlrewrite => UrlRewrite/Controller/Adminhtml/Url/Rewrite}/ProductGrid.php (81%) create mode 100644 app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php create mode 100644 app/code/Magento/UrlRewrite/Controller/Router.php rename dev/tests/integration/testsuite/Magento/Backend/AdminConfigTest.php => app/code/Magento/UrlRewrite/Model/OptionProvider.php (64%) delete mode 100644 app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite/Collection.php rename app/code/Magento/{UrlRedirect/Model/Resource/UrlRedirect/Collection.php => UrlRewrite/Model/Resource/UrlRewriteCollection.php} (86%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Model/Storage/AbstractStorage.php (57%) create mode 100644 app/code/Magento/UrlRewrite/Model/Storage/DbStorage.php create mode 100644 app/code/Magento/UrlRewrite/Model/Storage/DuplicateEntryException.php create mode 100644 app/code/Magento/UrlRewrite/Model/StorageInterface.php create mode 100644 app/code/Magento/UrlRewrite/Model/UrlFinderInterface.php rename app/code/Magento/{UrlRedirect/Model/UrlRedirect.php => UrlRewrite/Model/UrlPersistInterface.php} (66%) delete mode 100644 app/code/Magento/UrlRewrite/Model/UrlRewrite/OptionProvider.php rename app/code/Magento/{UrlRedirect => UrlRewrite}/Service/V1/Data/UrlRewrite.php (74%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/Service/V1/Data/UrlRewriteBuilder.php (70%) rename app/code/Magento/{UrlRedirect/etc => UrlRewrite/etc/adminhtml}/acl.xml (86%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/etc/adminhtml/menu.xml (85%) rename app/code/Magento/{Index => UrlRewrite}/etc/adminhtml/routes.xml (94%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/etc/config.xml (100%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/etc/di.xml (75%) rename app/code/Magento/{UrlRedirect/view/adminhtml/layout/adminhtml_urlredirect_index.xml => UrlRewrite/view/adminhtml/layout/adminhtml_url_rewrite_index.xml} (90%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/view/adminhtml/templates/categories.phtml (96%) rename app/code/Magento/{Backend/view/adminhtml/templates/urlrewrite => UrlRewrite/view/adminhtml/templates}/edit.phtml (94%) rename app/code/Magento/{UrlRedirect => UrlRewrite}/view/adminhtml/templates/selector.phtml (76%) delete mode 100644 app/code/Magento/Wishlist/Block/Rss.php rename app/code/Magento/Wishlist/Block/{Share/Email/Rss.php => Rss/EmailLink.php} (82%) create mode 100644 app/code/Magento/Wishlist/Block/Rss/Link.php delete mode 100644 app/code/Magento/Wishlist/Controller/Index/Rss.php create mode 100644 app/code/Magento/Wishlist/Model/Rss/Wishlist.php delete mode 100644 app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_rss.xml rename app/code/Magento/Wishlist/view/frontend/templates/{email/rss.phtml => rss/email.phtml} (75%) rename app/code/Magento/{Rss/view/frontend/templates/order/info/buttons/rss.phtml => Wishlist/view/frontend/templates/rss/wishlist.phtml} (74%) create mode 100644 app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module.less create mode 100644 app/design/frontend/Magento/blank/Magento_Theme/web/css/source/collapsible_navigation.less create mode 100644 app/design/frontend/Magento/blank/Magento_Weee/web/css/source/module.less delete mode 100644 dev/shell/newindexer.php create mode 100644 dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/GlobalSearchElement.php create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertGlobalSearchCustomerName.php create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertGlobalSearchNoRecordsFound.php create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertGlobalSearchOrderId.php create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertGlobalSearchProductName.php create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/GlobalSearch.php create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/GlobalSearch.xml rename dev/tests/functional/tests/app/Magento/{UrlRewrite/Test/Fixture/UrlRewrite/IdPath.php => Backend/Test/Fixture/GlobalSearch/Query.php} (52%) create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/etc/constraint.xml create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/etc/fixture.xml create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/AddBundleProductToCartFromCustomerWishlistOnFrontendTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/AddBundleProductToCartFromCustomerWishlistOnFrontendTest/test.csv rename dev/tests/functional/tests/app/Magento/{Index/Test/Block/Adminhtml/Process/Index.php => Checkout/Test/Block/Cart/CartEmpty.php} (63%) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertCartIsEmpty.php create mode 100644 dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/AddConfigurableProductToCartFromCustomerWishlistOnFrontendTest.php create mode 100644 dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/AddConfigurableProductToCartFromCustomerWishlistOnFrontendTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php create mode 100644 dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/AddDownloadableProductToCartFromCustomerWishlistOnFrontendTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/AddDownloadableProductToCartFromCustomerWishlistOnFrontendTest/test.csv rename app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Msrp/Enabled.php => dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/AddGroupedProductToCartFromCustomerWishlistOnFrontendTest.php (57%) create mode 100644 dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/AddGroupedProductToCartFromCustomerWishlistOnFrontendTest/test.csv delete mode 100644 dev/tests/functional/tests/app/Magento/Index/Test/Page/ProcessList.php rename dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/{Product/Viewed/Filter.php => AbstractFilter.php} (52%) rename app/code/Magento/CatalogUrlRewrite/Service/V1/CategoryUrlGeneratorInterface.php => dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Customer/Counts/Filter.php (74%) create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Customer/Counts/Filter.xml rename app/code/Magento/Rss/Controller/Catalog/Category.php => dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Customer/Counts/Grid.php (80%) create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Customer/Totals/Filter.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Customer/Totals/Filter.xml create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Customer/Totals/Grid.php rename dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/{Product => Review/Products}/Viewed/Action.php (95%) create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Review/Products/Viewed/Filter.php rename dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/{Product => Review/Products}/Viewed/Filter.xml (100%) rename dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/{Product => Review/Products}/Viewed/ProductGrid.php (80%) create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Shopcart/Abandoned/Grid.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AbstractAssertCustomerOrderReportResult.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertAbandonedCartCustomerInfoResult.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertCustomerOrderCountReportResult.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertCustomerOrderTotalReportResult.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/AbandonedCarts.xml delete mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/Bestsellers.xml create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/CustomerOrdersReport.xml create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/CustomerTotalsReport.xml create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest/test.csv delete mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/BestsellerProductsReportEntityTest.php delete mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/BestsellerProductsReportEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderTotalReportEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderTotalReportEntityTest/test.csv rename dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/{UrlrewriteEdit.xml => UrlRewriteEdit.xml} (94%) rename dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/{UrlrewriteIndex.xml => UrlRewriteIndex.xml} (96%) rename app/code/Magento/Index/Model/Indexer/Factory.php => dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php (60%) create mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.xml rename dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/{AssertProductIsAbsentInWishlist.php => AssertProductsIsAbsentInWishlist.php} (80%) create mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertWishlistIsEmpty.php create mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest/test.csv delete mode 100644 dev/tests/integration/testsuite/Magento/Backend/Block/Page/HeadTest.php rename dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/{UrlrewriteTest.php => UrlRewriteTest.php} (92%) rename dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/{ => Cookie}/DomainTest.php (81%) create mode 100644 dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Cookie/LifetimeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Cookie/PathTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Backend/Model/Session/AdminConfigTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_backend.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_backend_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_simple.php delete mode 100644 dev/tests/integration/testsuite/Magento/Core/_files/url_rewrite.php create mode 100644 dev/tests/integration/testsuite/Magento/CurrencySymbol/Model/System/CurrencysymbolTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address_custom_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_custom_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Directory/Model/ObserverTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieDomainValidatorTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieLifetimeValidatorTest.php rename dev/tests/integration/testsuite/Magento/{Rss/Controller/IndexTest.php => Framework/Session/Config/Validator/CookiePathValidatorTest.php} (50%) rename dev/tests/integration/testsuite/Magento/{Rss/Block/Order/StatusTest.php => Framework/ValidatorFactoryTest.php} (57%) delete mode 100644 dev/tests/integration/testsuite/Magento/Index/Model/Process/FileTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Index/Model/ProcessTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Index/Model/ShellTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Rss/Controller/OrderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/NewIndexerConfigFilesTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Theme/Block/Html/HeadTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Theme/Block/HtmlTest.php rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Catalog/Category/EditTest.php (83%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Catalog/Category/TreeTest.php (82%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Catalog/Edit/FormTest.php (79%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Catalog/Product/EditTest.php (86%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Catalog/Product/GridTest.php (89%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Cms/Page/Edit/FormTest.php (86%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Cms/Page/EditTest.php (83%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Cms/Page/GridTest.php (87%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/Edit/FormTest.php (84%) rename dev/tests/integration/testsuite/Magento/{Backend/Block/Urlrewrite => UrlRewrite/Block}/EditTest.php (89%) delete mode 100644 dev/tests/integration/testsuite/Magento/UrlRewrite/Helper/UrlRewriteTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/UrlRewrite/Model/UrlRewriteTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Wishlist/Block/RssTest.php create mode 100644 dev/tests/js/testsuite/lib/ko/datepicker/datepicker.js rename app/code/Magento/Index/etc/acl.xml => dev/tests/js/testsuite/lib/ko/datepicker/index.html (57%) create mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/composer.txt create mode 100644 dev/tests/unit/filename create mode 100644 dev/tests/unit/filename.csv create mode 100644 dev/tests/unit/filename.invalid_type create mode 100644 dev/tests/unit/framework/Magento/Test/BaseTestCase.php create mode 100644 dev/tests/unit/testsuite/Magento/AdminNotification/Model/FeedTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Backend/Block/UrlrewriteTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/ConcatTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php rename dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/{ => Cookie}/DomainTest.php (65%) create mode 100644 dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/Cookie/LifetimeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/Cookie/PathTest.php rename dev/tests/unit/testsuite/Magento/Backend/{ => Model/Session}/AdminConfigTest.php (60%) create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Rss/Grid/LinkTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Rss/NotifyStockTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Category/Rss/LinkTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Rss/CategoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Rss/Product/NewProductsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Rss/Product/SpecialTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/ObserverTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/UrlkeyTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type/EnabledTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Rss/CategoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Rss/Product/NewProductsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Rss/Product/NotifyStockTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Rss/Product/SpecialTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/UrlTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/_files/eav_attributes_data.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/FullTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Search/ReaderPluginTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Search/RequestGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/Category/ChildrenCategoriesProviderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/Category/ChildrenUrlRewriteGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/ObjectRegistryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/ProductUrlPathGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Model/_files/categoryUrlRewritesDataProvider.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogUrlRewrite/Service/V1/StoreViewServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Cms/Model/Page/UrlrewriteTest.php create mode 100644 dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Price/DataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/App/Router/BaseTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/App/Router/NoRouteHandlerTest.php rename app/code/Magento/Backend/Block/Urlrewrite/Link.php => dev/tests/unit/testsuite/Magento/Core/Controller/Index/IndexTest.php (62%) create mode 100644 dev/tests/unit/testsuite/Magento/Core/Controller/Index/NoCookiesTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Controller/Index/NotFoundTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Helper/File/MediaTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Helper/File/Storage/DatabaseTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Helper/File/StorageTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Helper/UrlTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/App/EmulationTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/Asset/ConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/Asset/Plugin/CleanMergedJsCssTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Directory/Model/Config/Source/AllRegionTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Directory/Model/ObserverTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/FactoryStub.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/ObjectManagerFactoryTest.php rename dev/tests/unit/testsuite/Magento/{Index/Model/Config/_files/valid_indexers.xml => Framework/App/_files/app/etc/di.xml} (81%) create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Config/DataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Search/Adapter/Mysql/ConditionManagerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Search/Adapter/Mysql/Filter/Builder/WildcardTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Search/Request/BinderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Search/Request/BuilderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Search/Request/CleanerTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Search/RequestFactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/ValidatorFactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/View/Page/Config/GeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/View/Page/Config/ReaderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/View/Page/Config/RendererTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/View/Page/Config/StructureTest.php rename app/code/Magento/Rss/view/adminhtml/layout/rss_order_new.xml => dev/tests/unit/testsuite/Magento/Framework/View/Page/Config/_files/template_body.xml (77%) create mode 100644 dev/tests/unit/testsuite/Magento/Framework/View/Page/Config/_files/template_head.xml rename app/code/Magento/Rss/view/frontend/layout/rss_order_status.xml => dev/tests/unit/testsuite/Magento/Framework/View/Page/Config/_files/template_html.xml (77%) create mode 100644 dev/tests/unit/testsuite/Magento/Framework/View/PageLayout/ConfigTest.php rename app/code/Magento/Rss/view/adminhtml/layout/rss_catalog_notifystock.xml => dev/tests/unit/testsuite/Magento/Framework/View/PageLayout/_files/layouts_one.xml (73%) rename app/code/Magento/Rss/view/adminhtml/layout/rss_catalog_review.xml => dev/tests/unit/testsuite/Magento/Framework/View/PageLayout/_files/layouts_two.xml (73%) create mode 100644 dev/tests/unit/testsuite/Magento/Framework/View/Result/PageTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GoogleShopping/Model/Attribute/ConditionTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/App/ShellTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Config/XsdTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Config/_files/invalidIndexersXmlArray.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Config/_files/invalidIndexersXmlMergedArray.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Config/_files/valid_indexers_merged.xml delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/EventRepositoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/ConverterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Indexer/ConfigTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Lock/StorageTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/Process/FileFactoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Msrp/Model/Observer/Frontend/Quote/SetCanApplyMsrpTest.php rename dev/tests/unit/testsuite/Magento/{Catalog/Model/Product/Attribute/Source/Msrp => Msrp/Model/Product/Attribute/Source}/Type/PriceTest.php (90%) rename dev/tests/unit/testsuite/Magento/{Catalog => Msrp}/Pricing/Price/MsrpPriceTest.php (89%) create mode 100644 dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/Rss/Grid/LinkTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/RssTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Review/Model/RssTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/AbstractCatalogTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/CategoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/NewCatalogTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/ReviewTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/SpecialTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Rss/Block/FeedsTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Rss/Block/Order/Info/Buttons/RssTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Rss/Controller/Adminhtml/Feed/IndexTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Rss/Controller/Feed/IndexTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Rss/Model/RssManagerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Rss/Model/UrlBuilderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Rss/Order/Grid/LinkTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Block/Order/Info/Buttons/RssTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/EmailTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Rss/NewOrderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Rss/OrderStatusTest.php create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Block/Rss/DiscountsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/Rss/DiscountsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sitemap/Helper/DataTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Store/Block/SwitchTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Store/Block/SwitcherTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Theme/Block/Html/Head/CssTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Theme/Block/Html/Head/LinkTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Theme/Block/Html/Head/ScriptTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeadTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/ContentType/Builders/ConfigJsonTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/ContentType/Builders/ConfigStorageJsonTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/ContentType/ContentTypeFactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/ContentType/HtmlTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/ListingContainer/Massaction/ViewTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Paging/ViewTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Sorting/ViewTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/UrlRedirect/Model/OptionProviderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/UrlRewrite/App/Request/RewriteServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php create mode 100644 dev/tests/unit/testsuite/Magento/UrlRewrite/Model/Resource/UrlRewriteCollectionTest.php create mode 100644 dev/tests/unit/testsuite/Magento/UrlRewrite/Model/Storage/AbstractStorageTest.php create mode 100644 dev/tests/unit/testsuite/Magento/UrlRewrite/Model/Storage/DbStorageTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/UrlRewrite/Model/UrlRewrite/OptionProviderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/UrlRewrite/Model/UrlRewrite/TypeProviderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/UrlRewrite/Model/UrlRewriteTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Wishlist/Block/Rss/LinkTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Wishlist/Controller/WishlistProviderTest.php rename dev/tests/unit/testsuite/Magento/Wishlist/{Block/RssTest.php => Model/Rss/WishlistTest.php} (56%) create mode 100644 lib/internal/Magento/Framework/App/Rss/DataProviderInterface.php rename app/code/Magento/Index/Model/Indexer/ConfigInterface.php => lib/internal/Magento/Framework/App/Rss/RssManagerInterface.php (73%) rename app/code/Magento/Catalog/Model/Config/Backend/Seo/Product.php => lib/internal/Magento/Framework/App/Rss/UrlBuilder.php (77%) rename app/code/Magento/Index/Controller/Adminhtml/Process/ReindexEvents.php => lib/internal/Magento/Framework/App/Rss/UrlBuilderInterface.php (78%) create mode 100644 lib/internal/Magento/Framework/Search/Adapter/Mysql/ConditionManager.php create mode 100644 lib/internal/Magento/Framework/Search/Adapter/Mysql/Filter/Builder/Wildcard.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Binder.php rename lib/internal/Magento/Framework/Search/{RequestFactory.php => Request/Builder.php} (52%) create mode 100644 lib/internal/Magento/Framework/Search/Request/Cleaner.php rename app/code/Magento/Index/Model/Indexer/Config/Reader.php => lib/internal/Magento/Framework/Search/Request/Config/FilesystemReader.php (70%) rename app/code/Magento/Index/Block/Adminhtml/Process/Edit/Form.php => lib/internal/Magento/Framework/Search/Request/Filter/Wildcard.php (57%) rename app/code/Magento/Backend/Model/Config/Backend/Domain.php => lib/internal/Magento/Framework/Session/Config/Validator/CookieDomainValidator.php (65%) create mode 100644 lib/internal/Magento/Framework/Session/Config/Validator/CookieLifetimeValidator.php rename app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tabs.php => lib/internal/Magento/Framework/Session/Config/Validator/CookiePathValidator.php (71%) rename app/code/Magento/CmsUrlRewrite/Service/V1/CmsPageUrlGeneratorInterface.php => lib/internal/Magento/Framework/View/Element/UiComponent/ConfigBuilderInterface.php (76%) rename app/code/Magento/Theme/Block/Html/Body.php => lib/internal/Magento/Framework/View/Element/UiComponent/ConfigFactory.php (55%) create mode 100644 lib/internal/Magento/Framework/View/Element/UiComponent/ConfigInterface.php create mode 100644 lib/internal/Magento/Framework/View/Element/UiComponent/ConfigStorageBuilderInterface.php create mode 100644 lib/internal/Magento/Framework/View/Element/UiComponent/ConfigStorageInterface.php create mode 100644 lib/internal/Magento/Framework/View/Element/UiComponent/Context.php create mode 100644 lib/internal/Magento/Framework/View/Element/UiComponentFactory.php create mode 100644 lib/internal/Magento/Framework/View/Element/UiComponentInterface.php create mode 100644 lib/internal/Magento/Framework/View/Page/Config/Generator.php create mode 100644 lib/internal/Magento/Framework/View/Page/Config/Reader.php create mode 100644 lib/internal/Magento/Framework/View/Page/Config/Renderer.php create mode 100644 lib/internal/Magento/Framework/View/Page/Config/Structure.php create mode 100644 lib/internal/Magento/Framework/View/Page/FaviconInterface.php create mode 100644 lib/web/date-format-normalizer.js create mode 100644 lib/web/jquery/autocomplete/autocomplete.css create mode 100644 lib/web/jquery/autocomplete/jquery.autocomplete.js delete mode 100644 lib/web/jquery/bootstrap-carousel/css/bootstrap-carousel.css delete mode 100644 lib/web/jquery/bootstrap-carousel/jquery.bootstrap-carousel.js delete mode 100644 lib/web/jquery/bootstrap-carousel/jquery.bootstrap-transition.js create mode 100644 lib/web/ko/ko.js create mode 100644 lib/web/mage/apply/main.js create mode 100644 lib/web/mage/apply/registry.js create mode 100644 lib/web/moment.js create mode 100644 lib/web/requirejs/text.js delete mode 100644 setup/module/Magento/Config/src/Dom.php delete mode 100644 setup/module/Magento/Config/src/Dom/NodePathMatcher.php delete mode 100644 setup/module/Magento/Framework/Module.php delete mode 100644 setup/module/Magento/Framework/src/DB/ExpressionConverter.php delete mode 100644 setup/module/Magento/Framework/src/Math/Random.php delete mode 100644 setup/module/Magento/Locale/Module.php delete mode 100644 setup/module/Magento/Module/Module.php delete mode 100644 setup/module/Magento/Module/config/di.config.php delete mode 100644 setup/module/Magento/Module/config/module.config.php delete mode 100644 setup/module/Magento/Module/src/Setup/Config.php create mode 100644 setup/module/Magento/Setup/src/Controller/ConsoleController.php rename dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/UrlTest.php => setup/module/Magento/Setup/src/Controller/Install/ClearProgressController.php (60%) rename setup/module/Magento/{Framework/src => Setup/src/Framework}/DB/Adapter/AdapterInterface.php (94%) rename setup/module/Magento/{Framework/src => Setup/src/Framework}/DB/Adapter/Pdo/Mysql.php (98%) rename setup/module/Magento/{Framework/src => Setup/src/Framework}/DB/Ddl/Table.php (99%) rename setup/module/Magento/{Framework/src => Setup/src/Framework}/DB/Ddl/Trigger.php (99%) create mode 100644 setup/module/Magento/Setup/src/Model/ConsoleLogger.php create mode 100644 setup/module/Magento/Setup/src/Model/Installer.php create mode 100644 setup/module/Magento/Setup/src/Model/InstallerFactory.php rename setup/module/Magento/{Composer/Module.php => Setup/src/Model/LoggerInterface.php} (62%) create mode 100644 setup/module/Magento/Setup/src/Model/UserConfigurationData.php rename setup/module/Magento/Setup/src/Model/{Logger.php => WebLogger.php} (59%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Converter/Dom.php (99%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Dependency/Manager.php (99%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Dependency/ManagerInterface.php (97%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Dir.php (96%) rename setup/module/Magento/{Module/src => Setup/src/Module}/FileResolver.php (99%) rename setup/module/Magento/{Module/src => Setup/src/Module}/ModuleList.php (95%) rename setup/module/Magento/{Module/src => Setup/src/Module}/ModuleListInterface.php (97%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Reader/Filesystem.php (93%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Resource/Resource.php (91%) rename setup/module/Magento/{Module/src => Setup/src/Module}/ResourceInterface.php (97%) rename setup/module/Magento/{Module/src => Setup/src/Module}/SchemaLocator.php (98%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Setup.php (50%) create mode 100644 setup/module/Magento/Setup/src/Module/Setup/Config.php create mode 100644 setup/module/Magento/Setup/src/Module/Setup/ConfigFactory.php rename setup/module/Magento/{Module/src => Setup/src/Module}/Setup/Connection/Adapter.php (70%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Setup/Connection/AdapterInterface.php (89%) rename setup/module/Magento/{Module/src => Setup/src/Module}/Setup/FileResolver.php (64%) rename setup/module/Magento/{Module/src => Setup/src/Module}/SetupFactory.php (52%) create mode 100644 setup/module/Magento/Setup/src/Module/SetupModule.php rename setup/module/Magento/{Module/src => Setup/src/Module}/Updater/SetupInterface.php (82%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f687b47a22250..1538aca81b9ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,102 @@ +0.1.0-alpha97 +============= + * Various improvements: + * Implemented a general way of using RSS module + * Created a cron job in the Customer module for cleaning the customer_visitor table + * Added a warning message to the Use HTTP Only option in the Admin panel + * Implemented the Grid component in the Magento UI Library + * Reimplemented the URL Rewrites functionality in the new UrlRedirect module + * Framework improvements: + * Added the ability to install Magento 2 using CLI + * Aggregated Magento installation and upgrade into one tool + * Refactored CustomerService REST WebApi to be more RESTful + * Increased unit and integration test coverage + * Moved page asset management to page configuration API, and eliminated the \Magento\Theme\Block\Html\Head block + * Eliminated the Root, Html and Title blocks + * Themes update: + * Removed widgets from the default Magento installation + * Fixed bugs: + * Fixed an issue with wishlist creation for non-registered customer + * Fixed an issue with Google Mapping where Condition did not show correct value + * Fixed an issue where there were too many notifications for admin user by default + * Fixed a Daylight Savings Time calculation error + * Fixed an issue where default cookie path and lifetime were not validated prior to saving + * Fixed an issue where current admin password was not required for resetting admin password + * Fixed an issue where custom customer attribute or customer address attribute was not accessible when ‘custom_attribute’ is used as the attribute code + * Fixed an issue where integration entity could not be deleted after being searched in grid + * Fixed an issue where invalid parameter value was shown in SOAP + * Fixed an issue where exception was thrown for Array to String conversion in SOAP + * Fixed an issue where exception was thrown due to invalid argument supplied for foreach() statement in REST + * Fixed an issue where admin tax notifications did not appear correctly in the System Messages dialog box + * Fixed an issue where tax details were missing when viewing order in the Admin panel + * Fixed an issue where styles for the storefront store selector were absent + * Fixed an issue where customer got 404 page when switching store views on the product page of a product with different URL keys in different store views + * Fixed an issue where the Add To Cart button in the MAP pop-up did not work for configurable and bundle products + * Fixed an issue where for specifying options for configurable product was absent after adding a product from the MAP pop-up + * Fixed an issue where a fatal error was thrown after selecting shipping method on PayPal Express Checkout + * Fixed an issue with sending invoice email + * Fixed an issue where integration tests failed with a fatal error + * Fixed an issue where credit memo entry was not created after performing a refund for an order + * Fixed an issue where categories layout for widgets did not work + * Fixed an issue where opening a page restricted by ACL lead to blank page instead of the Access Denied page + * Fixed an issue where a blank page was displayed instead of the using the Advanced Search result + * Fixed an issue where the "Please wait" spinner was absent on Ajax requests for order creation in the Admin panel + * Fixed an issue with the main navigation menu location on the page + * Modularity: + * Implemented the automatic applying of the MAP policy + * Indexers: + * Eliminated the old Magento_Index module + * Search library + * Added wildcards filter + * Eliminated unused queries and filters + * Added IN to Term filter + * Moved the "value" attribute from to for the Match query + * Refactored the usage of negation + * Implemented Request Builder + * CatalogSearch adapter + * Pluginized adding attribute to search index + * Merged base declaration with searchable attributes + * Added the following “Setup CLI tools” in the setup folder + * Deployment Configuration Tool + * Schema Setup and Update Tool + * DB Data Update Tool + * Admin User Setup Tool + * User Configuration Tool + * Installation Tool + * Update Tool + * GitHub requests: + * [#615] (https://github.com/magento/magento2/issues/615) -- Use info as object in checkout_cart_update_items_before + * [#659] (https://github.com/magento/magento2/issues/659) -- Recently viewed products sidebar issue + * [#660] (https://github.com/magento/magento2/issues/660) -- RSS global setting + * [#663] (https://github.com/magento/magento2/issues/663) -- session.save_path not valid + * [#445] (https://github.com/magento/magento2/issues/445) -- use of registry in Magento\Tax\Helper\Data + * [#646] (https://github.com/magento/magento2/issues/646) -- Fixed flat category indexer bug + * [#643] (https://github.com/magento/magento2/issues/643) -- Configurable Products Performance + * [#640] (https://github.com/magento/magento2/issues/640) -- [Insight] Files should not be executable + * [#667] (https://github.com/magento/magento2/pull/667) -- Tiny improvement on render() method in Column/Renderer/Concat + * [#288] (https://github.com/magento/magento2/issues/288) -- Add Cell Phone to Customer Address Form + * [#607] (https://github.com/magento/magento2/issues/607) -- sitemap.xml filename is not variable + * [#633] (https://github.com/magento/magento2/pull/633) -- Fixed Typo ($_attribite -> $_attribute) + * [#634] (https://github.com/magento/magento2/issues/634) -- README.md contains broken link to X.commerce Agreement + * [#569] (https://github.com/magento/magento2/issues/569) -- ObjectManager's Factory should be replaceable depending on service + * [#654] (https://github.com/magento/magento2/issues/654) -- Demo notice overlapping + * Functional tests: + * Abandoned carts report + * Adding products from wishlist to cart + * Create invoice for offline payment methods + * Delete products from shopping cart + * Delete widget + * Global search + * Order count report + * Order total report + 0.1.0-alpha96 ============= * Framework improvements: * Increased unit tests code coverage for Magento_Persistent, Magento_GiftMessage, Magento_Checkout modules * Modularity: * Removed module dependency on the Weee module - * Fixed Bugs: + * Fixed bugs: * Fixed an issue in composer installation where Magento/Framework marshaling did not work * Fixed an issue where shipping tax was included twice in tax details * Renamed the getDistinct method in Tax Model diff --git a/CONTRIBUTOR_LICENSE_AGREEMENT.html b/CONTRIBUTOR_LICENSE_AGREEMENT.html new file mode 100644 index 0000000000000..58281b8e8aeab --- /dev/null +++ b/CONTRIBUTOR_LICENSE_AGREEMENT.html @@ -0,0 +1,131 @@ + + + + CONTRIBUTOR LICENSE AGREEMENT + + + +
+

+ CONTRIBUTOR LICENSE AGREEMENT +

+

+ This Contributor License Agreement ("Agreement") is made and entered into as of _______________, 20__ (the "Effective Date"), by and between X.commerce, Inc. dba Magento, Inc., a Delaware corporation with its principal place of business at 10441 Jefferson Blvd., Suite 200, Culver City, CA 90232 ("Magento", "we", "us", or "our"), and ______________________________, a _______________ with its principal place of business at _______________________________________ ("Contributor", "you" or "your", and collectively with Magento, the "Parties"). +

+
    +
  1. Definitions: +
      +
    1. + "Contribution" means any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Magento for inclusion in, or documentation of, any of the products or services owned or managed by Magento (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication provided to Magento or its representatives, including, but not limited to, communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Magento for the purpose of discussing, modifying, revising, and improving the Work, including identification of errors and/or issues and the remedy thereof. +
    2. +
    3. + "Contributor", "you", or "your" means the copyright owner or legal entity authorized by the copyright owner that is entering into this Agreement. +
    4. +
    5. + "Contributor Affiliate" means any past, present or future subsidiary, parent company, sister company, or other corporation, firm, business, partnership, joint venture or entity that controls, is controlled by, or is under common control of Contributor or any of its subsidiaries. +
    6. +
    7. + "Control" means (i) the power, direct or indirect, to cause the direction or management of an entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares of an entity, or (iii) beneficial ownership of an entity. +
    8. +
    9. + "Magento Affiliate" means any past, present or future subsidiary, parent company, sister company, or other corporation, firm, business, partnership, joint venture or entity that controls, is controlled by, or is under common control of Magento or any of its subsidiaries. +
    10. +
    +
  2. +
  3. License Grants: +
      +
    1. Grant of Copyright License. Subject to the terms and conditions of this Agreement, Contributor and Contributor Affiliates hereby grant to Magento, Magento Affiliates and all third party recipients of software, services, and all other information distributed by Magento as part of any Magento project, product or service a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Contributions and such derivative works.
    2. +
    3. Grant of Patent License. Subject to the terms and conditions of this Agreement, Contributor and Contributor Affiliates hereby grant to Magento, Magento Affiliates, and all third party recipients of software, services, and information distributed by Magento as part of any Magento project, product or service a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Contributions, where such license applies only to those patent claims licensable by Contributor that are necessarily infringed by Contributions alone or by combination with software and/or information related to any Magento project, product or service.
    4. +
    5. Grant to Magento and Magento Affiliates. The rights conferred in this Agreement on Magento shall automatically and immediately extend to any entity that later becomes a Magento Affiliate or a part of Magento.
    6. +
    7. Contributions. Contributor agrees to the terms and conditions of this Agreement for present and future Contributions, which Contributor submits to Magento. Except for the licenses granted herein, Contributor reserves all right, title, and interest in and to Contributor Contributions.
    8. +
    +
  4. +
  5. + Representations: +
      +
    1. Original Work. Contributor represents that each Contribution is Contributor’s own original creation and that Contributor is the copyright owner or legal entity authorized by the copyright owner of all Contributions.
    2. +
    3. Ownership and Authority. Contributor represents that it is legally entitled to grant the licenses above and that the Contributions do not include any third party copyrights, patents, trade secrets, licenses, or other restrictions ("Third Party IP"), and that Contributor will not declare any dependencies on any open source projects, proprietary software or Third Party IP, unless Contributor has made a Complete Disclosure prior to or at the time of the Contribution submission.
    4. +
    5. Complete Disclosure. If applicable, Contributor represents that each and every Contribution submission includes complete details of any third-party license or other restrictions associated with any part of the Contribution.
    6. +
    7. Support. Contributor is not expected to provide support for Contributions, except to the extent Contributor desires to provide support. Contributor may provide support for free, for a fee, or not at all.
    8. +
    9. Notification of any Change. You agree to notify Magento if any of the facts, circumstances or representations made herein are or become inaccurate in any respect.
    10. +
    +
  6. +
  7. + General: +
      +
    1. Waiver. Contributor waives all other claims of any nature, including express contract, implied-in-fact contract, or quasi-contract, arising out of any disclosure of the Contributions to Magento. As such, Magento is under no obligation to use or implement the Contributions in any respect.
    2. +
    3. Competitive or Similar Materials. In no event shall Magento or Magento Affiliates be precluded from discussing, reviewing, developing for itself, having developed, or developing for third parties, materials which are competitive with those set forth in the Contributions irrespective of their similarity to the information in the Contributions, so long as Magento complies with the terms of this Agreement.
    4. +
    5. Term. This Agreement shall remain in effect for a period of five (5) years from the Effective Date or until termination in writing by either party is delivered to the other party.
    6. +
    7. Governing Law. This Agreement will be construed as if both parties jointly wrote it, governed by California law except for its conflicts of laws principles, and any cause of action arising under or relating to this Agreement must be brought exclusively in a court in Santa Clara County, California.
    8. +
    9. Survival. Upon termination or expiration of this Agreement, all terms of the Agreement, including the license grants, shall remain in full force and effect, except that Contributor will no longer make submissions to Magento.
    10. +
    +
  8. +
+

IN WITNESS WHEREOF, the Parties have caused this Agreement to be executed by their duly authorized representatives as of the Effective Date.

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Magento, Inc.Contributor
+
By:
By:
Name:
Name:
Title:
Title:
+
+ + \ No newline at end of file diff --git a/README.md b/README.md index 2b7d837ea1746..8bde29485195d 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,4 @@ All Submissions you make to Magento, an eBay Inc. company (“Magento”) throug 1. You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission”) you submit through GitHub. 2. Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. -3. You agree to the X.commerce Agreement found here: https://www.x.com/developers/x.commerce/x.commerce-user-agreement. +3. You agree to the X.commerce Agreement found here: http://magento.com/legal/terms. diff --git a/app/code/Magento/AdminNotification/Helper/Data.php b/app/code/Magento/AdminNotification/Helper/Data.php deleted file mode 100644 index 8df06e5b1b123..0000000000000 --- a/app/code/Magento/AdminNotification/Helper/Data.php +++ /dev/null @@ -1,114 +0,0 @@ - - */ -class Data extends \Magento\Framework\App\Helper\AbstractHelper -{ - const XML_PATH_POPUP_URL = 'system/adminnotification/popup_url'; - - /** - * Widget Popup Notification Object URL - * - * @var string - */ - protected $_popupUrl; - - /** - * Is readable Popup Notification Object flag - * - * @var bool - */ - protected $_popupReadable; - - /** - * Last Notice object - * - * @var \Magento\AdminNotification\Model\Inbox - */ - protected $_latestNotice; - - /** - * Count of unread notes by type - * - * @var array - */ - protected $_unreadNoticeCounts; - - /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_scopeConfig; - - /** - * @var \Magento\AdminNotification\Model\InboxFactory - */ - protected $_inboxFactory; - - /** - * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory - */ - public function __construct( - \Magento\Framework\App\Helper\Context $context, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\AdminNotification\Model\InboxFactory $inboxFactory - ) { - parent::__construct($context); - $this->_scopeConfig = $scopeConfig; - $this->_inboxFactory = $inboxFactory; - } - - /** - * Retrieve latest notice model - * - * @return \Magento\AdminNotification\Model\Inbox - */ - public function getLatestNotice() - { - if (is_null($this->_latestNotice)) { - $this->_latestNotice = $this->_inboxFactory->create()->loadLatestNotice(); - } - return $this->_latestNotice; - } - - /** - * Retrieve count of unread notes by type - * - * @param int $severity - * @return int - */ - public function getUnreadNoticeCount($severity) - { - if (is_null($this->_unreadNoticeCounts)) { - $this->_unreadNoticeCounts = $this->_inboxFactory->create()->getNoticeStatus(); - } - return isset($this->_unreadNoticeCounts[$severity]) ? $this->_unreadNoticeCounts[$severity] : 0; - } -} diff --git a/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php b/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php index 40f8554f5b1d9..0a92bac8ff183 100644 --- a/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php +++ b/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php @@ -26,7 +26,7 @@ /** * AdminNotification update frequency source * - * @author Magento Core Team + * @codeCoverageIgnore */ class Frequency implements \Magento\Framework\Option\ArrayInterface { diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index c1fba9cb65324..57ff524528fea 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -55,6 +55,11 @@ class Feed extends \Magento\Framework\Model\AbstractModel */ protected $_inboxFactory; + /** + * @var \Magento\Framework\HTTP\Adapter\CurlFactory + */ + protected $curlFactory; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -62,6 +67,7 @@ class Feed extends \Magento\Framework\Model\AbstractModel * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection + * @param \Magento\Framework\HTTP\Adapter\curlFactory $curlFactory * @param array $data */ public function __construct( @@ -69,6 +75,7 @@ public function __construct( \Magento\Framework\Registry $registry, \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, + \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -76,6 +83,7 @@ public function __construct( parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_backendConfig = $backendConfig; $this->_inboxFactory = $inboxFactory; + $this->curlFactory = $curlFactory; } /** @@ -116,15 +124,19 @@ public function checkUpdate() $feedXml = $this->getFeedData(); + $installDate = $this->_appState->getInstallDate(); + if ($feedXml && $feedXml->channel && $feedXml->channel->item) { foreach ($feedXml->channel->item as $item) { - $feedData[] = array( - 'severity' => (int)$item->severity, - 'date_added' => $this->getDate((string)$item->pubDate), - 'title' => (string)$item->title, - 'description' => (string)$item->description, - 'url' => (string)$item->link - ); + if ($installDate <= strtotime((string)$item->pubDate)) { + $feedData[] = array( + 'severity' => (int)$item->severity, + 'date_added' => $this->getDate((string)$item->pubDate), + 'title' => (string)$item->title, + 'description' => (string)$item->description, + 'url' => (string)$item->link + ); + } } if ($feedData) { @@ -185,7 +197,7 @@ public function setLastUpdate() */ public function getFeedData() { - $curl = new \Magento\Framework\HTTP\Adapter\Curl(); + $curl = $this->curlFactory->create(); $curl->setConfig(array('timeout' => 2)); $curl->write(\Zend_Http_Client::GET, $this->getFeedUrl(), '1.0'); $data = $curl->read(); diff --git a/app/code/Magento/AdminNotification/Model/System/Message.php b/app/code/Magento/AdminNotification/Model/System/Message.php index 4701404784803..650e26e407d44 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message.php +++ b/app/code/Magento/AdminNotification/Model/System/Message.php @@ -23,6 +23,9 @@ */ namespace Magento\AdminNotification\Model\System; +/** + * @codeCoverageIgnore + */ class Message extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\Notification\MessageInterface { /** diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index ea51992822d72..946ca70e54cbf 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -3,16 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/AdminNotification/etc/module.xml b/app/code/Magento/AdminNotification/etc/module.xml index e767d17381c06..68a4115f67c14 100644 --- a/app/code/Magento/AdminNotification/etc/module.xml +++ b/app/code/Magento/AdminNotification/etc/module.xml @@ -33,7 +33,6 @@ - diff --git a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml index 09d661912c1b2..be68c170e83a3 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml +++ b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml @@ -32,11 +32,7 @@ - - - - Magento_Core::prototype/magento.css - - - + + + diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index 9cf98d75bdd47..e4b92a7168f7e 100644 --- a/app/code/Magento/Authorization/composer.json +++ b/app/code/Magento/Authorization/composer.json @@ -3,12 +3,12 @@ "description": "Authorization module provides access to Magento ACL functionality.", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json index 4c698ea9a021e..a29aeab87e229 100644 --- a/app/code/Magento/Authorizenet/composer.json +++ b/app/code/Magento/Authorizenet/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-centinel": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-centinel": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 50e29c074266d..c14435b8afd38 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -102,14 +102,7 @@ public function getFileSizeService() */ protected function _prepareLayout() { - $head = $this->getLayout()->getBlock('head'); - if ($head) { - $head->addChild( - 'jquery-fileUploader-css-jquery-fileupload-ui-css', - 'Magento\Theme\Block\Html\Head\Css', - array('file' => 'jquery/fileUploader/css/jquery.fileupload-ui.css') - ); - } + $this->pageConfig->addPageAsset('jquery/fileUploader/css/jquery.fileupload-ui.css'); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Backend/Block/Page.php b/app/code/Magento/Backend/Block/Page.php index 2dbd390a0652f..870bb4180aa41 100644 --- a/app/code/Magento/Backend/Block/Page.php +++ b/app/code/Magento/Backend/Block/Page.php @@ -59,7 +59,7 @@ protected function _construct() { parent::_construct(); - $this->addBodyClass($this->_request->getFullActionName('-')); + $this->pageConfig->addBodyClass($this->_request->getFullActionName('-')); } /** @@ -75,19 +75,6 @@ public function getLang() return $this->getData('lang'); } - /** - * Add CSS class to page body tag - * - * @param string $className - * @return $this - */ - public function addBodyClass($className) - { - $className = preg_replace('#[^a-z0-9]+#', '-', strtolower($className)); - $this->setBodyClass($this->getBodyClass() . ' ' . $className); - return $this; - } - /** * @return bool */ diff --git a/app/code/Magento/Backend/Block/Page/Head.php b/app/code/Magento/Backend/Block/Page/Head.php deleted file mode 100644 index 5c86ceb63f30b..0000000000000 --- a/app/code/Magento/Backend/Block/Page/Head.php +++ /dev/null @@ -1,113 +0,0 @@ - - */ -namespace Magento\Backend\Block\Page; - -class Head extends \Magento\Theme\Block\Html\Head -{ - /** - * @var string - */ - protected $_template = 'page/head.phtml'; - - /** - * @var \Magento\Framework\Data\Form\FormKey - */ - protected $formKey; - - /** - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDatabase - * @param \Magento\Framework\ObjectManager $objectManager - * @param \Magento\Framework\View\Asset\GroupedCollection $assets - * @param \Magento\Framework\View\Asset\MergeService $assetMergeService - * @param \Magento\Framework\View\Asset\MinifyService $assetMinifyService - * @param \Magento\Framework\Locale\ResolverInterface $localeResolver - * @param \Magento\Translation\Block\Js $jsTranslation - * @param \Magento\Framework\App\Action\Title $titles - * @param \Magento\Framework\Data\Form\FormKey $formKey - * @param array $data - */ - public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Core\Helper\File\Storage\Database $fileStorageDatabase, - \Magento\Framework\ObjectManager $objectManager, - \Magento\Framework\View\Asset\GroupedCollection $assets, - \Magento\Framework\View\Asset\MergeService $assetMergeService, - \Magento\Framework\View\Asset\MinifyService $assetMinifyService, - \Magento\Framework\Locale\ResolverInterface $localeResolver, - \Magento\Translation\Block\Js $jsTranslation, - \Magento\Framework\App\Action\Title $titles, - \Magento\Framework\Data\Form\FormKey $formKey, - array $data = array() - ) { - $this->_titles = $titles; - $this->formKey = $formKey; - parent::__construct( - $context, - $fileStorageDatabase, - $objectManager, - $assets, - $assetMergeService, - $assetMinifyService, - $localeResolver, - $jsTranslation, - $data - ); - $this->formKey = $formKey; - } - - /** - * Retrieve Session Form Key - * - * @return string - */ - public function getFormKey() - { - return $this->formKey->getFormKey(); - } - - /** - * @return array|string - */ - public function getTitle() - { - /** Get default title */ - $title = parent::getTitle(); - - /** Add default title */ - $this->_titles->add($title, true); - - /** Set title list */ - $this->setTitle(array_reverse($this->_titles->get())); - - /** Render titles */ - return parent::getTitle(); - } -} diff --git a/app/code/Magento/Catalog/Block/Product/Widget/Link.php b/app/code/Magento/Backend/Block/Page/RequireJs.php similarity index 64% rename from app/code/Magento/Catalog/Block/Product/Widget/Link.php rename to app/code/Magento/Backend/Block/Page/RequireJs.php index 6bedd12770078..f5513c049ee69 100644 --- a/app/code/Magento/Catalog/Block/Product/Widget/Link.php +++ b/app/code/Magento/Backend/Block/Page/RequireJs.php @@ -22,28 +22,43 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Backend\Block\Page; + /** - * Widget to display link to the product - * - * @author Magento Core Team + * Require Js block */ -namespace Magento\Catalog\Block\Product\Widget; - -class Link extends \Magento\Catalog\Block\Widget\Link +class RequireJs extends \Magento\Framework\View\Element\Template { + /** + * @var \Magento\Framework\Data\Form\FormKey + */ + protected $formKey; + /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\UrlRewrite\Model\Resource\UrlRewrite $urlRewrite - * @param \Magento\Catalog\Model\Resource\Product $catalogProduct + * @param \Magento\Framework\Data\Form\FormKey $formKey * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\UrlRewrite\Model\Resource\UrlRewrite $urlRewrite, - \Magento\Catalog\Model\Resource\Product $catalogProduct, + \Magento\Framework\Data\Form\FormKey $formKey, array $data = array() ) { - parent::__construct($context, $urlRewrite, $data); - $this->_entityResource = $catalogProduct; + $this->formKey = $formKey; + parent::__construct( + $context, + $data + ); + $this->formKey = $formKey; + } + + /** + * Retrieve Session Form Key + * + * @return string + */ + public function getFormKey() + { + return $this->formKey->getFormKey(); } } diff --git a/app/code/Magento/Backend/Block/System/Account/Edit/Form.php b/app/code/Magento/Backend/Block/System/Account/Edit/Form.php index fe9f26aaf10f7..bf15a0ca77688 100644 --- a/app/code/Magento/Backend/Block/System/Account/Edit/Form.php +++ b/app/code/Magento/Backend/Block/System/Account/Edit/Form.php @@ -30,6 +30,8 @@ */ class Form extends \Magento\Backend\Block\Widget\Form\Generic { + const IDENTITY_VERIFICATION_PASSWORD_FIELD = 'current_password'; + /** * @var \Magento\Backend\Model\Auth\Session */ @@ -142,7 +144,26 @@ protected function _prepareForm() ) ); - $form->setValues($user->getData()); + $verificationFieldset = $form->addFieldset( + 'current_user_verification_fieldset', + ['legend' => __('Current User Identity Verification')] + ); + $verificationFieldset->addField( + self::IDENTITY_VERIFICATION_PASSWORD_FIELD, + 'password', + array( + 'name' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD, + 'label' => __('Your Password'), + 'id' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD, + 'title' => __('Your Password'), + 'class' => 'input-text validate-current-password required-entry', + 'required' => true + ) + ); + + $data = $user->getData(); + unset($data[self::IDENTITY_VERIFICATION_PASSWORD_FIELD]); + $form->setValues($data); $form->setAction($this->getUrl('adminhtml/system_account/save')); $form->setMethod('post'); $form->setUseContainer(true); diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index 70680f30e22c6..656b3931b1393 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -56,6 +56,11 @@ class Context extends \Magento\Framework\View\Element\Template\Context */ protected $nameBuilder; + /** + * @var \Magento\Framework\View\Page\Config + */ + protected $pageConfig; + /** * @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\View\LayoutInterface $layout @@ -80,6 +85,7 @@ class Context extends \Magento\Framework\View\Element\Template\Context * @param \Magento\Framework\View\TemplateEnginePool $enginePool * @param \Magento\Framework\App\State $appState * @param \Magento\Framework\StoreManagerInterface $storeManager + * @param \Magento\Framework\View\Page\Config $pageConfig * @param \Magento\Framework\AuthorizationInterface $authorization * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Framework\Math\Random $mathRandom @@ -112,6 +118,7 @@ public function __construct( \Magento\Framework\View\TemplateEnginePool $enginePool, \Magento\Framework\App\State $appState, \Magento\Framework\StoreManagerInterface $storeManager, + \Magento\Framework\View\Page\Config $pageConfig, \Magento\Framework\AuthorizationInterface $authorization, \Magento\Backend\Model\Session $backendSession, \Magento\Framework\Math\Random $mathRandom, @@ -146,7 +153,8 @@ public function __construct( $viewFileSystem, $enginePool, $appState, - $storeManager + $storeManager, + $pageConfig ); } diff --git a/app/code/Magento/Backend/Block/Urlrewrite.php b/app/code/Magento/Backend/Block/Urlrewrite.php deleted file mode 100644 index d3306b3dab3b8..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite.php +++ /dev/null @@ -1,96 +0,0 @@ - - */ -class Urlrewrite extends \Magento\Backend\Block\Widget\Grid\Container -{ - /** - * Part for generating apropriate grid block name - * - * @var string - */ - protected $_controller = 'urlrewrite'; - - /** - * @var \Magento\Backend\Block\Urlrewrite\Selector - */ - protected $_urlrewriteSelector; - - /** - * @param \Magento\Backend\Block\Widget\Context $context - * @param \Magento\Backend\Block\Urlrewrite\Selector $urlrewriteSelector - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Widget\Context $context, - \Magento\Backend\Block\Urlrewrite\Selector $urlrewriteSelector, - array $data = array() - ) { - $this->_urlrewriteSelector = $urlrewriteSelector; - parent::__construct($context, $data); - } - - /** - * Set custom labels and headers - * - * @return void - */ - protected function _construct() - { - $this->_headerText = __('URL Rewrite Management'); - $this->_addButtonLabel = __('Add URL Rewrite'); - parent::_construct(); - } - - /** - * Customize grid row URLs - * - * @see \Magento\Backend\Block\Urlrewrite\Selector - * @return string - */ - public function getCreateUrl() - { - $url = $this->getUrl('adminhtml/*/edit'); - - $selectorBlock = $this->getSelectorBlock(); - if ($selectorBlock === null) { - $selectorBlock = $this->_urlrewriteSelector; - } - - if ($selectorBlock) { - $modes = array_keys($selectorBlock->getModes()); - $url .= reset($modes); - } - - return $url; - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Edit.php deleted file mode 100644 index c8ffa03ca60e0..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Edit.php +++ /dev/null @@ -1,137 +0,0 @@ - - */ -class Edit extends \Magento\Backend\Block\Urlrewrite\Edit -{ - /** - * @var \Magento\Catalog\Model\CategoryFactory - */ - protected $_categoryFactory; - - /** - * @param \Magento\Backend\Block\Widget\Context $context - * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Widget\Context $context, - \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Catalog\Model\CategoryFactory $categoryFactory, - array $data = array() - ) { - $this->_categoryFactory = $categoryFactory; - parent::__construct($context, $rewriteFactory, $adminhtmlData, $data); - } - - /** - * Prepare layout for URL rewrite creating for category - * - * @return void - */ - protected function _prepareLayoutFeatures() - { - if ($this->_getUrlRewrite()->getId()) { - $this->_headerText = __('Edit URL Rewrite for a Category'); - } else { - $this->_headerText = __('Add URL Rewrite for a Category'); - } - - if ($this->_getCategory()->getId()) { - $this->_addCategoryLinkBlock(); - $this->_addEditFormBlock(); - $this->_updateBackButtonLink($this->_adminhtmlData->getUrl('adminhtml/*/edit') . 'category'); - } else { - $this->_addUrlRewriteSelectorBlock(); - $this->_addCategoryTreeBlock(); - } - } - - /** - * Get or create new instance of category - * - * @return \Magento\Catalog\Model\Product - */ - private function _getCategory() - { - if (!$this->hasData('category')) { - $this->setCategory($this->_categoryFactory->create()); - } - return $this->getCategory(); - } - - /** - * Add child category link block - * - * @return void - */ - private function _addCategoryLinkBlock() - { - $this->addChild( - 'category_link', - 'Magento\Backend\Block\Urlrewrite\Link', - array( - 'item_url' => $this->_adminhtmlData->getUrl('adminhtml/*/*') . 'category', - 'item_name' => $this->_getCategory()->getName(), - 'label' => __('Category:') - ) - ); - } - - /** - * Add child category tree block - * - * @return void - */ - private function _addCategoryTreeBlock() - { - $this->addChild('categories_tree', 'Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree'); - } - - /** - * Creates edit form block - * - * @return \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form - */ - protected function _createEditFormBlock() - { - return $this->getLayout()->createBlock( - 'Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form', - '', - array('data' => array('category' => $this->_getCategory(), 'url_rewrite' => $this->_getUrlRewrite())) - ); - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php deleted file mode 100644 index 3075a987d4653..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php +++ /dev/null @@ -1,196 +0,0 @@ - - */ -class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory -{ - /** - * List of allowed category ids - * - * @var int[]|null - */ - protected $_allowedCategoryIds = null; - - /** - * @var string - */ - protected $_template = 'urlrewrite/categories.phtml'; - - /** - * Adminhtml data - * - * @var \Magento\Backend\Helper\Data - */ - protected $_adminhtmlData = null; - - /** - * @var \Magento\Catalog\Model\CategoryFactory - */ - protected $_categoryFactory; - - /** - * @var \Magento\Catalog\Model\ProductFactory - */ - protected $_productFactory; - - /** - * @var \Magento\Framework\Json\EncoderInterface - */ - protected $_jsonEncoder; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTree - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder - * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Catalog\Model\Resource\Category\Tree $categoryTree, - \Magento\Framework\Registry $registry, - \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Framework\Json\EncoderInterface $jsonEncoder, - \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Backend\Helper\Data $adminhtmlData, - array $data = array() - ) { - $this->_jsonEncoder = $jsonEncoder; - $this->_categoryFactory = $categoryFactory; - $this->_productFactory = $productFactory; - $this->_adminhtmlData = $adminhtmlData; - parent::__construct($context, $categoryTree, $registry, $categoryFactory, $data); - } - - /** - * Get categories tree as recursive array - * - * @param int $parentId - * @param bool $asJson - * @param int $recursionLevel - * @return array - */ - public function getTreeArray($parentId = null, $asJson = false, $recursionLevel = 3) - { - $productId = $this->_request->getParam('product'); - if ($productId) { - $product = $this->_productFactory->create()->setId($productId); - $this->_allowedCategoryIds = $product->getCategoryIds(); - unset($product); - } - - $result = array(); - if ($parentId) { - $category = $this->_categoryFactory->create()->load($parentId); - if (!empty($category)) { - $tree = $this->_getNodesArray($this->getNode($category, $recursionLevel)); - if (!empty($tree) && !empty($tree['children'])) { - $result = $tree['children']; - } - } - } else { - $result = $this->_getNodesArray($this->getRoot(null, $recursionLevel)); - } - - if ($asJson) { - return $this->_jsonEncoder->encode($result); - } - - $this->_allowedCategoryIds = null; - - return $result; - } - - /** - * Get categories collection - * - * @return \Magento\Catalog\Model\Resource\Category\Collection - */ - public function getCategoryCollection() - { - $collection = $this->_getData('category_collection'); - if (is_null($collection)) { - $collection = $this->_categoryFactory->create()->getCollection()->addAttributeToSelect( - array('name', 'is_active') - )->setLoadProductCount( - true - ); - $this->setData('category_collection', $collection); - } - - return $collection; - } - - /** - * Convert categories tree to array recursively - * - * @param \Magento\Framework\Data\Tree\Node $node - * @return array - */ - protected function _getNodesArray($node) - { - $result = array( - 'id' => (int)$node->getId(), - 'parent_id' => (int)$node->getParentId(), - 'children_count' => (int)$node->getChildrenCount(), - 'is_active' => (bool)$node->getIsActive(), - 'name' => $node->getName(), - 'level' => (int)$node->getLevel(), - 'product_count' => (int)$node->getProductCount() - ); - - if (is_array($this->_allowedCategoryIds) && !in_array($result['id'], $this->_allowedCategoryIds)) { - $result['disabled'] = true; - } - - if ($node->hasChildren()) { - $result['children'] = array(); - foreach ($node->getChildren() as $childNode) { - $result['children'][] = $this->_getNodesArray($childNode); - } - } - $result['cls'] = ($result['is_active'] ? '' : 'no-') . 'active-category'; - $result['expanded'] = !empty($result['children']); - - return $result; - } - - /** - * Get URL for categories tree ajax loader - * - * @return string - */ - public function getLoadTreeUrl() - { - return $this->_adminhtmlData->getUrl('adminhtml/*/categoriesJson'); - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php deleted file mode 100644 index ed612197dab41..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php +++ /dev/null @@ -1,239 +0,0 @@ - - * - */ -namespace Magento\Backend\Block\Urlrewrite\Catalog\Edit; - -/** - * @SuppressWarnings(PHPMD.DepthOfInheritance) - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form -{ - /** - * @var \Magento\Catalog\Model\Url - */ - protected $_catalogUrl; - - /** - * @var \Magento\Catalog\Model\ProductFactory - */ - protected $_productFactory; - - /** - * @var \Magento\Catalog\Model\CategoryFactory - */ - protected $_categoryFactory; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Data\FormFactory $formFactory - * @param \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory - * @param \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory - * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Store\Model\System\Store $systemStore - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Catalog\Model\Url $catalogUrl - * @param array $data - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Framework\Data\FormFactory $formFactory, - \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory, - \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory, - \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Store\Model\System\Store $systemStore, - \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Catalog\Model\Url $catalogUrl, - array $data = array() - ) { - $this->_productFactory = $productFactory; - $this->_categoryFactory = $categoryFactory; - $this->_catalogUrl = $catalogUrl; - parent::__construct( - $context, - $registry, - $formFactory, - $typesFactory, - $optionFactory, - $rewriteFactory, - $systemStore, - $adminhtmlData, - $data - ); - } - - /** - * Form post init - * - * @param \Magento\Framework\Data\Form $form - * @return \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form - */ - protected function _formPostInit($form) - { - // Set form action - $form->setAction( - $this->_adminhtmlData->getUrl( - 'adminhtml/*/save', - array( - 'id' => $this->_getModel()->getId(), - 'product' => $this->_getProduct()->getId(), - 'category' => $this->_getCategory()->getId() - ) - ) - ); - - // Fill id path, request path and target path elements - /** @var $idPath \Magento\Framework\Data\Form\Element\AbstractElement */ - $idPath = $this->getForm()->getElement('id_path'); - /** @var $requestPath \Magento\Framework\Data\Form\Element\AbstractElement */ - $requestPath = $this->getForm()->getElement('request_path'); - /** @var $targetPath \Magento\Framework\Data\Form\Element\AbstractElement */ - $targetPath = $this->getForm()->getElement('target_path'); - - $model = $this->_getModel(); - $disablePaths = false; - if (!$model->getId()) { - $product = null; - $category = null; - if ($this->_getProduct()->getId()) { - $product = $this->_getProduct(); - $category = $this->_getCategory(); - } elseif ($this->_getCategory()->getId()) { - $category = $this->_getCategory(); - } - - if ($product || $category) { - $idPath->setValue($this->_catalogUrl->generatePath('id', $product, $category)); - - $sessionData = $this->_getSessionData(); - if (!isset($sessionData['request_path'])) { - $requestPath->setValue($this->_catalogUrl->generatePath('request', $product, $category, '')); - } - $targetPath->setValue($this->_catalogUrl->generatePath('target', $product, $category)); - $disablePaths = true; - } - } else { - $disablePaths = $model->getProductId() || $model->getCategoryId(); - } - - // Disable id_path and target_path elements - if ($disablePaths) { - $idPath->setData('disabled', true); - $targetPath->setData('disabled', true); - } - - return $this; - } - - /** - * Get catalog entity associated stores - * - * @return array - * @throws \Magento\Framework\Model\Exception - */ - protected function _getEntityStores() - { - $product = $this->_getProduct(); - $category = $this->_getCategory(); - $entityStores = array(); - - // showing websites that only associated to products - if ($product->getId()) { - $entityStores = (array)$product->getStoreIds(); - - //if category is chosen, reset stores which are not related with this category - if ($category->getId()) { - $categoryStores = (array)$category->getStoreIds(); - $entityStores = array_intersect($entityStores, $categoryStores); - } - // @codingStandardsIgnoreStart - if (!$entityStores) { - throw new \Magento\Framework\Model\Exception( - __( - 'We can\'t set up a URL rewrite because the product you chose is not associated with a website.' - ) - ); - } - $this->_requireStoresFilter = true; - } elseif ($category->getId()) { - $entityStores = (array)$category->getStoreIds(); - if (!$entityStores) { - throw new \Magento\Framework\Model\Exception( - __( - 'We can\'t set up a URL rewrite because the category your chose is not associated with a website.' - ) - ); - } - $this->_requireStoresFilter = true; - } - // @codingStandardsIgnoreEnd - - return $entityStores; - } - - /** - * Get product model instance - * - * @return \Magento\Catalog\Model\Product - */ - protected function _getProduct() - { - if (!$this->hasData('product')) { - $this->setProduct($this->_productFactory->create()); - } - return $this->getProduct(); - } - - /** - * Get category model instance - * - * @return \Magento\Catalog\Model\Category - */ - protected function _getCategory() - { - if (!$this->hasData('category')) { - $this->setCategory($this->_categoryFactory->create()); - } - return $this->getCategory(); - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Edit.php deleted file mode 100644 index 648aa40029cf5..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Edit.php +++ /dev/null @@ -1,239 +0,0 @@ - - */ -class Edit extends \Magento\Backend\Block\Urlrewrite\Edit -{ - /** - * @var \Magento\Catalog\Model\ProductFactory - */ - protected $_productFactory; - - /** - * @var \Magento\Catalog\Model\CategoryFactory - */ - protected $_categoryFactory; - - /** - * @param \Magento\Backend\Block\Widget\Context $context - * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Widget\Context $context, - \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Catalog\Model\CategoryFactory $categoryFactory, - array $data = array() - ) { - $this->_categoryFactory = $categoryFactory; - $this->_productFactory = $productFactory; - parent::__construct($context, $rewriteFactory, $adminhtmlData, $data); - } - - /** - * Prepare layout for URL rewrite creating for product - * - * @return void - */ - protected function _prepareLayoutFeatures() - { - if ($this->_getUrlRewrite()->getId()) { - $this->_headerText = __('Edit URL Rewrite for a Product'); - } else { - $this->_headerText = __('Add URL Rewrite for a Product'); - } - - if ($this->_getProduct()->getId()) { - $this->_addProductLinkBlock($this->_getProduct()); - } - - if ($this->_getCategory()->getId()) { - $this->_addCategoryLinkBlock(); - } - - if ($this->_getProduct()->getId()) { - if ($this->_getCategory()->getId() || !$this->getIsCategoryMode()) { - $this->_addEditFormBlock(); - $this->_updateBackButtonLink( - $this->_adminhtmlData->getUrl( - 'adminhtml/*/edit', - array('product' => $this->_getProduct()->getId()) - ) . 'category' - ); - } else { - // categories selector & skip categories button - $this->_addCategoriesTreeBlock(); - $this->_addSkipCategoriesBlock(); - $this->_updateBackButtonLink($this->_adminhtmlData->getUrl('adminhtml/*/edit') . 'product'); - } - } else { - $this->_addUrlRewriteSelectorBlock(); - $this->_addProductsGridBlock(); - } - } - - /** - * Get or create new instance of product - * - * @return \Magento\Catalog\Model\Product - */ - private function _getProduct() - { - if (!$this->hasData('product')) { - $this->setProduct($this->_productFactory->create()); - } - return $this->getProduct(); - } - - /** - * Get or create new instance of category - * - * @return \Magento\Catalog\Model\Category - */ - private function _getCategory() - { - if (!$this->hasData('category')) { - $this->setCategory($this->_categoryFactory->create()); - } - return $this->getCategory(); - } - - /** - * Add child product link block - * - * @return void - */ - private function _addProductLinkBlock() - { - $this->addChild( - 'product_link', - 'Magento\Backend\Block\Urlrewrite\Link', - array( - 'item_url' => $this->_adminhtmlData->getUrl('adminhtml/*/*') . 'product', - 'item_name' => $this->_getProduct()->getName(), - 'label' => __('Product:') - ) - ); - } - - /** - * Add child category link block - * - * @return void - */ - private function _addCategoryLinkBlock() - { - $this->addChild( - 'category_link', - 'Magento\Backend\Block\Urlrewrite\Link', - array( - 'item_url' => $this->_adminhtmlData->getUrl( - 'adminhtml/*/*', - array('product' => $this->_getProduct()->getId()) - ) . 'category', - 'item_name' => $this->_getCategory()->getName(), - 'label' => __('Category:') - ) - ); - } - - /** - * Add child products grid block - * - * @return void - */ - private function _addProductsGridBlock() - { - $this->addChild('products_grid', 'Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid'); - } - - /** - * Add child Categories Tree block - * - * @return void - */ - private function _addCategoriesTreeBlock() - { - $this->addChild('categories_tree', 'Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree'); - } - - /** - * Add child Skip Categories block - * - * @return void - */ - private function _addSkipCategoriesBlock() - { - $this->addChild( - 'skip_categories', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Skip Category Selection'), - 'onclick' => 'window.location = \'' . $this->_adminhtmlData->getUrl( - 'adminhtml/*/*', - array('product' => $this->_getProduct()->getId()) - ) . '\'', - 'class' => 'save', - 'level' => -1 - ) - ); - } - - /** - * Creates edit form block - * - * @return \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form - */ - protected function _createEditFormBlock() - { - return $this->getLayout()->createBlock( - 'Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form', - '', - array( - 'data' => array( - 'product' => $this->_getProduct(), - 'category' => $this->_getCategory(), - 'url_rewrite' => $this->_getUrlRewrite() - ) - ) - ); - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Grid.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Grid.php deleted file mode 100644 index 5eba26e0e75d2..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Grid.php +++ /dev/null @@ -1,88 +0,0 @@ - - */ -class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid -{ - /** - * Disable massaction - * - * @return $this - */ - protected function _prepareMassaction() - { - return $this; - } - - /** - * Prepare columns layout - * - * @return $this - */ - protected function _prepareColumns() - { - $this->addColumn('entity_id', array('header' => __('ID'), 'width' => 50, 'index' => 'entity_id')); - - $this->addColumn('name', array('header' => __('Name'), 'index' => 'name')); - - $this->addColumn('sku', array('header' => __('SKU'), 'width' => 80, 'index' => 'sku')); - $this->addColumn( - 'status', - array( - 'header' => __('Status'), - 'width' => 50, - 'index' => 'status', - 'type' => 'options', - 'options' => $this->_status->getOptionArray() - ) - ); - return $this; - } - - /** - * Get URL for dispatching grid ajax requests - * - * @return string - */ - public function getGridUrl() - { - return $this->getUrl('adminhtml/*/productGrid', array('_current' => true)); - } - - /** - * Return row url for js event handlers - * - * @param \Magento\Catalog\Model\Product|\Magento\Framework\Object $row - * @return string - */ - public function getRowUrl($row) - { - return $this->getUrl('adminhtml/*/edit', array('product' => $row->getId())) . 'category'; - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit.php deleted file mode 100644 index ccb5872dac859..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit.php +++ /dev/null @@ -1,136 +0,0 @@ - - */ -class Edit extends \Magento\Backend\Block\Urlrewrite\Edit -{ - /** - * @var \Magento\Cms\Model\PageFactory - */ - protected $_pageFactory; - - /** - * @param \Magento\Backend\Block\Widget\Context $context - * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Cms\Model\PageFactory $pageFactory - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Widget\Context $context, - \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Cms\Model\PageFactory $pageFactory, - array $data = array() - ) { - $this->_pageFactory = $pageFactory; - parent::__construct($context, $rewriteFactory, $adminhtmlData, $data); - } - - /** - * Prepare layout for URL rewrite creating for CMS page - * - * @return void - */ - protected function _prepareLayoutFeatures() - { - if ($this->_getUrlRewrite()->getId()) { - $this->_headerText = __('Edit URL Rewrite for CMS page'); - } else { - $this->_headerText = __('Add URL Rewrite for CMS page'); - } - - if ($this->_getCmsPage()->getId()) { - $this->_addCmsPageLinkBlock(); - $this->_addEditFormBlock(); - $this->_updateBackButtonLink($this->_adminhtmlData->getUrl('adminhtml/*/edit') . 'cms_page'); - } else { - $this->_addUrlRewriteSelectorBlock(); - $this->_addCmsPageGridBlock(); - } - } - - /** - * Get or create new instance of CMS page - * - * @return \Magento\Cms\Model\Page - */ - private function _getCmsPage() - { - if (!$this->hasData('cms_page')) { - $this->setCmsPage($this->_pageFactory->create()); - } - return $this->getCmsPage(); - } - - /** - * Add child CMS page link block - * - * @return void - */ - private function _addCmsPageLinkBlock() - { - $this->addChild( - 'cms_page_link', - 'Magento\Backend\Block\Urlrewrite\Link', - array( - 'item_url' => $this->_adminhtmlData->getUrl('adminhtml/*/*') . 'cms_page', - 'item_name' => $this->getCmsPage()->getTitle(), - 'label' => __('CMS page:') - ) - ); - } - - /** - * Add child CMS page block - * - * @return void - */ - private function _addCmsPageGridBlock() - { - $this->addChild('cms_pages_grid', 'Magento\Backend\Block\Urlrewrite\Cms\Page\Grid'); - } - - /** - * Creates edit form block - * - * @return \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form - */ - protected function _createEditFormBlock() - { - return $this->getLayout()->createBlock( - 'Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form', - '', - array('data' => array('cms_page' => $this->_getCmsPage(), 'url_rewrite' => $this->_getUrlRewrite())) - ); - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php deleted file mode 100644 index ad42ead070c39..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php +++ /dev/null @@ -1,175 +0,0 @@ -_urlRewriteFactory = $urlRewriteFactory; - $this->_pageFactory = $pageFactory; - parent::__construct( - $context, - $registry, - $formFactory, - $typesFactory, - $optionFactory, - $rewriteFactory, - $systemStore, - $adminhtmlData, - $data - ); - } - - /** - * Form post init - * - * @param \Magento\Framework\Data\Form $form - * @return \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form - */ - protected function _formPostInit($form) - { - $cmsPage = $this->getCmsPageInstance(); - $form->setAction( - $this->_adminhtmlData->getUrl( - 'adminhtml/*/save', - array('id' => $this->_getModel()->getId(), 'cms_page' => $cmsPage->getId()) - ) - ); - - // Fill id path, request path and target path elements - /** @var $idPath \Magento\Framework\Data\Form\Element\AbstractElement */ - $idPath = $this->getForm()->getElement('id_path'); - /** @var $requestPath \Magento\Framework\Data\Form\Element\AbstractElement */ - $requestPath = $this->getForm()->getElement('request_path'); - /** @var $targetPath \Magento\Framework\Data\Form\Element\AbstractElement */ - $targetPath = $this->getForm()->getElement('target_path'); - - $model = $this->_getModel(); - /** @var $cmsPageUrlRewrite \Magento\Cms\Model\Page\Urlrewrite */ - $cmsPageUrlRewrite = $this->_urlRewriteFactory->create(); - if (!$model->getId()) { - $idPath->setValue($cmsPageUrlRewrite->generateIdPath($cmsPage)); - - $sessionData = $this->_getSessionData(); - if (!isset($sessionData['request_path'])) { - $requestPath->setValue($cmsPageUrlRewrite->generateRequestPath($cmsPage)); - } - $targetPath->setValue($cmsPageUrlRewrite->generateTargetPath($cmsPage)); - $disablePaths = true; - } else { - $cmsPageUrlRewrite->load($this->_getModel()->getId(), 'url_rewrite_id'); - $disablePaths = $cmsPageUrlRewrite->getId() > 0; - } - if ($disablePaths) { - $idPath->setData('disabled', true); - $targetPath->setData('disabled', true); - } - - return $this; - } - - /** - * Get catalog entity associated stores - * - * @return array - * @throws \Magento\Framework\Model\Exception - */ - protected function _getEntityStores() - { - $cmsPage = $this->getCmsPageInstance(); - $entityStores = array(); - - // showing websites that only associated to CMS page - if ($this->getCmsPageInstance()->getId()) { - $entityStores = (array)$cmsPage->getResource()->lookupStoreIds($cmsPage->getId()); - $this->_requireStoresFilter = !in_array(0, $entityStores); - - if (!$entityStores) { - throw new \Magento\Framework\Model\Exception( - __('Chosen cms page is not associated with any website.') - ); - } - } - - return $entityStores; - } - - /** - * Get CMS page model instance - * - * @return \Magento\Cms\Model\Page - */ - protected function getCmsPageInstance() - { - if (!$this->hasData('cms_page')) { - $this->setCmsPage($this->_pageFactory->create()); - } - return $this->getCmsPage(); - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Grid.php b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Grid.php deleted file mode 100644 index 905ad2184bcca..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Grid.php +++ /dev/null @@ -1,113 +0,0 @@ - - */ -class Grid extends \Magento\Cms\Block\Adminhtml\Page\Grid -{ - /** - * Constructor - * - * @return void - */ - public function _construct() - { - parent::_construct(); - $this->setUseAjax(true); - } - - /** - * Disable massaction - * - * @return $this - */ - protected function _prepareMassaction() - { - return $this; - } - - /** - * Prepare columns layout - * - * @return $this - */ - protected function _prepareColumns() - { - $this->addColumn('title', array('header' => __('Title'), 'align' => 'left', 'index' => 'title')); - - $this->addColumn('identifier', array('header' => __('URL Key'), 'align' => 'left', 'index' => 'identifier')); - - if (!$this->_storeManager->isSingleStoreMode()) { - $this->addColumn( - 'store_id', - array( - 'header' => __('Store View'), - 'index' => 'store_id', - 'type' => 'store', - 'store_all' => true, - 'store_view' => true, - 'sortable' => false, - 'filter_condition_callback' => array($this, '_filterStoreCondition') - ) - ); - } - - $this->addColumn( - 'is_active', - array( - 'header' => __('Status'), - 'index' => 'is_active', - 'type' => 'options', - 'options' => $this->_cmsPage->getAvailableStatuses() - ) - ); - - return $this; - } - - /** - * Get URL for dispatching grid ajax requests - * - * @return string - */ - public function getGridUrl() - { - return $this->getUrl('adminhtml/*/cmsPageGrid', array('_current' => true)); - } - - /** - * Return row url for js event handlers - * - * @param \Magento\Cms\Model\Page|\Magento\Framework\Object $row - * @return string - */ - public function getRowUrl($row) - { - return $this->getUrl('adminhtml/*/edit', array('cms_page' => $row->getId())); - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Edit.php deleted file mode 100644 index 66ae64dbdde81..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Edit.php +++ /dev/null @@ -1,300 +0,0 @@ - - */ -class Edit extends \Magento\Backend\Block\Widget\Container -{ - /** - * @var \Magento\Backend\Block\Urlrewrite\Selector - */ - private $_selectorBlock; - - /** - * Part for building some blocks names - * - * @var string - */ - protected $_controller = 'urlrewrite'; - - /** - * Generated buttons html cache - * - * @var string - */ - protected $_buttonsHtml; - - /** - * Adminhtml data - * - * @var \Magento\Backend\Helper\Data - */ - protected $_adminhtmlData = null; - - /** - * @var \Magento\UrlRewrite\Model\UrlRewriteFactory - */ - protected $_rewriteFactory; - - /** - * @param \Magento\Backend\Block\Widget\Context $context - * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Widget\Context $context, - \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Backend\Helper\Data $adminhtmlData, - array $data = array() - ) { - $this->_rewriteFactory = $rewriteFactory; - $this->_adminhtmlData = $adminhtmlData; - parent::__construct($context, $data); - } - - /** - * Prepare URL rewrite editing layout - * - * @return $this - */ - protected function _prepareLayout() - { - $this->setTemplate('urlrewrite/edit.phtml'); - - $this->_addBackButton(); - $this->_prepareLayoutFeatures(); - - return parent::_prepareLayout(); - } - - /** - * Prepare featured blocks for layout of URL rewrite editing - * - * @return void - */ - protected function _prepareLayoutFeatures() - { - if ($this->_getUrlRewrite()->getId()) { - $this->_headerText = __('Edit URL Rewrite'); - } else { - $this->_headerText = __('Add New URL Rewrite'); - } - - $this->_updateBackButtonLink( - $this->_adminhtmlData->getUrl('adminhtml/*/edit') . $this->_getSelectorBlock()->getDefaultMode() - ); - $this->_addUrlRewriteSelectorBlock(); - $this->_addEditFormBlock(); - } - - /** - * Add child edit form block - * - * @return void - */ - protected function _addEditFormBlock() - { - $this->setChild('form', $this->_createEditFormBlock()); - - if ($this->_getUrlRewrite()->getId()) { - $this->_addResetButton(); - $this->_addDeleteButton(); - } - - $this->_addSaveButton(); - } - - /** - * Add reset button - * - * @return void - */ - protected function _addResetButton() - { - $this->buttonList->add( - 'reset', - array( - 'label' => __('Reset'), - 'onclick' => '$(\'edit_form\').reset()', - 'class' => 'scalable', - 'level' => -1 - ) - ); - } - - /** - * Add back button - * - * @return void - */ - protected function _addBackButton() - { - $this->buttonList->add( - 'back', - array( - 'label' => __('Back'), - 'onclick' => 'setLocation(\'' . $this->_adminhtmlData->getUrl('adminhtml/*/') . '\')', - 'class' => 'back', - 'level' => -1 - ) - ); - } - - /** - * Update Back button location link - * - * @param string $link - * @return void - */ - protected function _updateBackButtonLink($link) - { - $this->buttonList->update('back', 'onclick', 'setLocation(\'' . $link . '\')'); - } - - /** - * Add delete button - * - * @return void - */ - protected function _addDeleteButton() - { - $this->buttonList->add( - 'delete', - array( - 'label' => __('Delete'), - 'onclick' => 'deleteConfirm(\'' . addslashes( - __('Are you sure you want to do this?') - ) . '\', \'' . $this->_adminhtmlData->getUrl( - 'adminhtml/*/delete', - array('id' => $this->getUrlRewrite()->getId()) - ) . '\')', - 'class' => 'scalable delete', - 'level' => -1 - ) - ); - } - - /** - * Add save button - * - * @return void - */ - protected function _addSaveButton() - { - $this->buttonList->add( - 'save', - array( - 'label' => __('Save'), - 'class' => 'save primary save-url-redirect', - 'level' => -1, - 'data_attribute' => array( - 'mage-init' => array('button' => array('event' => 'save', 'target' => '#edit_form')) - ) - ) - ); - } - - /** - * Creates edit form block - * - * @return \Magento\Backend\Block\Urlrewrite\Edit\Form - */ - protected function _createEditFormBlock() - { - return $this->getLayout()->createBlock( - 'Magento\Backend\Block\Urlrewrite\Edit\Form', - '', - array('data' => array('url_rewrite' => $this->_getUrlRewrite())) - ); - } - - /** - * Add child URL rewrite selector block - * - * @return void - */ - protected function _addUrlRewriteSelectorBlock() - { - $this->setChild('selector', $this->_getSelectorBlock()); - } - - /** - * Get selector block - * - * @return \Magento\Backend\Block\Urlrewrite\Selector - */ - private function _getSelectorBlock() - { - if (!$this->_selectorBlock) { - $this->_selectorBlock = $this->getLayout()->createBlock('Magento\Backend\Block\Urlrewrite\Selector'); - } - return $this->_selectorBlock; - } - - /** - * Get container buttons HTML - * - * Since buttons are set as children, we remove them as children after generating them - * not to duplicate them in future - * - * @param null $area - * @return string - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getButtonsHtml($area = null) - { - if (null === $this->_buttonsHtml) { - $this->_buttonsHtml = parent::getButtonsHtml(); - $layout = $this->getLayout(); - foreach ($this->getChildNames() as $name) { - $alias = $layout->getElementAlias($name); - if (false !== strpos($alias, '_button')) { - $layout->unsetChild($this->getNameInLayout(), $alias); - } - } - } - return $this->_buttonsHtml; - } - - /** - * Get or create new instance of URL rewrite - * - * @return \Magento\UrlRewrite\Model\UrlRewrite - */ - protected function _getUrlRewrite() - { - if (!$this->hasData('url_rewrite')) { - $this->setUrlRewrite($this->_rewriteFactory->create()); - } - return $this->getUrlRewrite(); - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php deleted file mode 100644 index 42f7d0264e0eb..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php +++ /dev/null @@ -1,417 +0,0 @@ - - * - * - * @SuppressWarnings(PHPMD.DepthOfInheritance) - */ -class Form extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** - * @var array - */ - protected $_sessionData = null; - - /** - * @var array - */ - protected $_allStores = null; - - /** - * @var bool - */ - protected $_requireStoresFilter = false; - - /** - * @var array - */ - protected $_formValues = array(); - - /** - * Adminhtml data - * - * @var \Magento\Backend\Helper\Data - */ - protected $_adminhtmlData = null; - - /** - * @var \Magento\Store\Model\System\Store - */ - protected $_systemStore; - - /** - * @var \Magento\UrlRewrite\Model\UrlRewriteFactory - */ - protected $_rewriteFactory; - - /** - * @var \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory - */ - protected $_optionFactory; - - /** - * @var \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory - */ - protected $_typesFactory; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Data\FormFactory $formFactory - * @param \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory - * @param \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory - * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Store\Model\System\Store $systemStore - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param array $data - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Framework\Data\FormFactory $formFactory, - \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory, - \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory, - \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Store\Model\System\Store $systemStore, - \Magento\Backend\Helper\Data $adminhtmlData, - array $data = array() - ) { - $this->_typesFactory = $typesFactory; - $this->_optionFactory = $optionFactory; - $this->_rewriteFactory = $rewriteFactory; - $this->_systemStore = $systemStore; - $this->_adminhtmlData = $adminhtmlData; - parent::__construct($context, $registry, $formFactory, $data); - } - - /** - * Set form id and title - * - * @return void - */ - protected function _construct() - { - parent::_construct(); - $this->setId('urlrewrite_form'); - $this->setTitle(__('Block Information')); - } - - /** - * Initialize form values - * Set form data either from model values or from session - * - * @return $this - */ - protected function _initFormValues() - { - $model = $this->_getModel(); - $this->_formValues = array( - 'store_id' => $model->getStoreId(), - 'id_path' => $model->getIdPath(), - 'request_path' => $model->getRequestPath(), - 'target_path' => $model->getTargetPath(), - 'options' => $model->getOptions(), - 'description' => $model->getDescription() - ); - - $sessionData = $this->_getSessionData(); - if ($sessionData) { - foreach (array_keys($this->_formValues) as $key) { - if (isset($sessionData[$key])) { - $this->_formValues[$key] = $sessionData[$key]; - } - } - } - - return $this; - } - - /** - * Prepare the form layout - * - * @return $this - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - protected function _prepareForm() - { - $this->_initFormValues(); - - // Prepare form - /** @var \Magento\Framework\Data\Form $form */ - $form = $this->_formFactory->create( - array('data' => array('id' => 'edit_form', 'use_container' => true, 'method' => 'post')) - ); - - $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('URL Rewrite Information'))); - - /** @var $typesModel \Magento\UrlRewrite\Model\UrlRewrite\TypeProvider */ - $typesModel = $this->_typesFactory->create(); - $fieldset->addField( - 'is_system', - 'select', - array( - 'label' => __('Type'), - 'title' => __('Type'), - 'name' => 'is_system', - 'required' => true, - 'options' => $typesModel->getAllOptions(), - 'disabled' => true, - 'value' => $this->_getModel()->getIsSystem() - ) - ); - - $fieldset->addField( - 'id_path', - 'text', - array( - 'label' => __('ID Path'), - 'title' => __('ID Path'), - 'name' => 'id_path', - 'required' => true, - 'disabled' => false, - 'value' => $this->_formValues['id_path'] - ) - ); - - $fieldset->addField( - 'request_path', - 'text', - array( - 'label' => __('Request Path'), - 'title' => __('Request Path'), - 'name' => 'request_path', - 'required' => true, - 'value' => $this->_formValues['request_path'] - ) - ); - - $fieldset->addField( - 'target_path', - 'text', - array( - 'label' => __('Target Path'), - 'title' => __('Target Path'), - 'name' => 'target_path', - 'required' => true, - 'disabled' => false, - 'value' => $this->_formValues['target_path'] - ) - ); - - /** @var $optionsModel \Magento\UrlRewrite\Model\UrlRewrite\OptionProvider */ - $optionsModel = $this->_optionFactory->create(); - $fieldset->addField( - 'options', - 'select', - array( - 'label' => __('Redirect'), - 'title' => __('Redirect'), - 'name' => 'options', - 'options' => $optionsModel->getAllOptions(), - 'value' => $this->_formValues['options'] - ) - ); - - $fieldset->addField( - 'description', - 'textarea', - array( - 'label' => __('Description'), - 'title' => __('Description'), - 'name' => 'description', - 'cols' => 20, - 'rows' => 5, - 'value' => $this->_formValues['description'], - 'wrap' => 'soft' - ) - ); - - $this->_prepareStoreElement($fieldset); - - $this->setForm($form); - $this->_formPostInit($form); - - return parent::_prepareForm(); - } - - /** - * Prepare store element - * - * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset - * @return void - */ - protected function _prepareStoreElement($fieldset) - { - // get store switcher or a hidden field with it's id - if ($this->_storeManager->isSingleStoreMode()) { - $fieldset->addField( - 'store_id', - 'hidden', - array('name' => 'store_id', 'value' => $this->_storeManager->getStore(true)->getId()), - 'id_path' - ); - } else { - /** @var $renderer \Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset\Element */ - $renderer = $this->getLayout()->createBlock( - 'Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset\Element' - ); - - $storeElement = $fieldset->addField( - 'store_id', - 'select', - array( - 'label' => __('Store'), - 'title' => __('Store'), - 'name' => 'store_id', - 'required' => true, - 'values' => $this->_getRestrictedStoresList(), - 'disabled' => $this->_getModel()->getIsSystem(), - 'value' => $this->_formValues['store_id'] - ), - 'id_path' - ); - $storeElement->setRenderer($renderer); - } - } - - /** - * Form post init - * - * @param \Magento\Framework\Data\Form $form - * @return $this - */ - protected function _formPostInit($form) - { - $form->setAction( - $this->_adminhtmlData->getUrl('adminhtml/*/save', array('id' => $this->_getModel()->getId())) - ); - return $this; - } - - /** - * Get session data - * - * @return array - */ - protected function _getSessionData() - { - if (is_null($this->_sessionData)) { - $this->_sessionData = $this->_backendSession->getData('urlrewrite_data', true); - } - return $this->_sessionData; - } - - /** - * Get URL rewrite model instance - * - * @return \Magento\UrlRewrite\Model\UrlRewrite - */ - protected function _getModel() - { - if (!$this->hasData('url_rewrite')) { - $this->setUrlRewrite($this->_rewriteFactory->create()); - } - return $this->getUrlRewrite(); - } - - /** - * Get request stores - * - * @return array - */ - protected function _getAllStores() - { - if (is_null($this->_allStores)) { - $this->_allStores = $this->_systemStore->getStoreValuesForForm(); - } - - return $this->_allStores; - } - - /** - * Get entity stores - * - * @return array - */ - protected function _getEntityStores() - { - return $this->_getAllStores(); - } - - /** - * Get restricted stores list - * Stores should be filtered only if custom entity is specified. - * If we use custom rewrite, all stores are accepted. - * - * @return array - */ - protected function _getRestrictedStoresList() - { - $stores = $this->_getAllStores(); - $entityStores = $this->_getEntityStores(); - $stores = $this->_getStoresListRestrictedByEntityStores($stores, $entityStores); - - return $stores; - } - - /** - * Get stores list restricted by entity stores - * - * @param array $stores - * @param array $entityStores - * @return array - */ - private function _getStoresListRestrictedByEntityStores(array $stores, array $entityStores) - { - if ($this->_requireStoresFilter) { - foreach ($stores as $i => $store) { - if (isset($store['value']) && $store['value']) { - $found = false; - foreach ($store['value'] as $k => $v) { - if (isset($v['value']) && in_array($v['value'], $entityStores)) { - $found = true; - } else { - unset($stores[$i]['value'][$k]); - } - } - if (!$found) { - unset($stores[$i]); - } - } - } - } - - return $stores; - } -} diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Selector.php b/app/code/Magento/Backend/Block/Urlrewrite/Selector.php deleted file mode 100644 index 46ce62f567456..0000000000000 --- a/app/code/Magento/Backend/Block/Urlrewrite/Selector.php +++ /dev/null @@ -1,100 +0,0 @@ - label - * - * @var array - */ - protected $_modes; - - /** - * @var string - */ - protected $_template = 'urlrewrite/selector.phtml'; - - /** - * Set block template and get available modes - * - * @return void - */ - protected function _construct() - { - $this->_modes = array( - 'category' => __('For category'), - 'product' => __('For product'), - 'cms_page' => __('For CMS page'), - 'id' => __('Custom') - ); - } - - /** - * Available modes getter - * - * @return array - */ - public function getModes() - { - return $this->_modes; - } - - /** - * Label getter - * - * @return string - */ - public function getSelectorLabel() - { - return __('Create URL Rewrite:'); - } - - /** - * Check whether selection is in specified mode - * - * @param string $mode - * @return bool - */ - public function isMode($mode) - { - return $this->getRequest()->has($mode); - } - - /** - * Get default mode - * - * @return string - */ - public function getDefaultMode() - { - $keys = array_keys($this->_modes); - return array_shift($keys); - } -} diff --git a/app/code/Magento/Backend/Block/Widget/Context.php b/app/code/Magento/Backend/Block/Widget/Context.php index 8ffce8ce30721..9596a04f3e316 100644 --- a/app/code/Magento/Backend/Block/Widget/Context.php +++ b/app/code/Magento/Backend/Block/Widget/Context.php @@ -39,6 +39,11 @@ class Context extends \Magento\Backend\Block\Template\Context */ protected $buttonToolbar; + /** + * @var \Magento\Framework\View\Page\Config + */ + protected $pageConfig; + /** * @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\View\LayoutInterface $layout @@ -70,6 +75,7 @@ class Context extends \Magento\Backend\Block\Template\Context * @param \Magento\Framework\Code\NameBuilder $nameBuilder * @param \Magento\Backend\Block\Widget\Button\ButtonList $buttonList * @param Button\ToolbarInterface $toolbar + * @param \Magento\Framework\View\Page\Config $pageConfig * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -97,6 +103,7 @@ public function __construct( \Magento\Framework\View\TemplateEnginePool $enginePool, \Magento\Framework\App\State $appState, \Magento\Framework\StoreManagerInterface $storeManager, + \Magento\Framework\View\Page\Config $pageConfig, \Magento\Framework\AuthorizationInterface $authorization, \Magento\Backend\Model\Session $backendSession, \Magento\Framework\Math\Random $mathRandom, @@ -129,6 +136,7 @@ public function __construct( $enginePool, $appState, $storeManager, + $pageConfig, $authorization, $backendSession, $mathRandom, diff --git a/app/code/Magento/Backend/Block/Widget/Grid.php b/app/code/Magento/Backend/Block/Widget/Grid.php index 3cade6d445fe9..84f1156aaf877 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid.php +++ b/app/code/Magento/Backend/Block/Widget/Grid.php @@ -132,13 +132,6 @@ class Grid extends \Magento\Backend\Block\Widget */ protected $_varTotals; - /** - * RSS list - * - * @var \Magento\Framework\Object[] - */ - protected $_rssLists = array(); - /** * @var string */ @@ -201,12 +194,6 @@ protected function _construct() ); $this->setData('use_ajax', $this->hasData('use_ajax') ? (bool)$this->getData('use_ajax') : false); - - if ($this->hasData('rssList') && is_array($this->getData('rssList'))) { - foreach ($this->getData('rssList') as $item) { - $this->addRssList($item['url'], $item['label']); - } - } } /** @@ -697,42 +684,6 @@ public function setDefaultFilter($filter) return $this; } - /** - * Retrieve rss lists types - * - * @return \Magento\Framework\Object[]|false - */ - public function getRssLists() - { - return empty($this->_rssLists) ? false : $this->_rssLists; - } - - /** - * Add new rss list to grid - * - * @param string $url - * @param string $label - * @return $this - */ - public function addRssList($url, $label) - { - $this->_rssLists[] = new \Magento\Framework\Object( - array('url' => $this->getUrl($url, array('_nosecret' => true)), 'label' => $label) - ); - return $this; - } - - /** - * Clear rss list in grid - * - * @return $this - */ - public function clearRss() - { - $this->_rssLists = array(); - return $this; - } - /** * Check whether grid container should be displayed * diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php index 2347f0886753a..39b5fe89c57fa 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php @@ -57,17 +57,6 @@ public function __construct( parent::__construct($context, $resourceHelper, $data); } - /** - * {@inheritdoc} - */ - protected function _prepareLayout() - { - if ($head = $this->getLayout()->getBlock('head')) { - $head->setCanLoadCalendarJs(true); - } - return $this; - } - /** * @return string */ diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php index b38adef9876c6..ebd0aae1102fc 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php @@ -24,14 +24,12 @@ namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; use Magento\Backend\Block\Widget\Grid\Column; +use Magento\Framework\Object; /** * Backend grid item abstract renderer - * - * @author Magento Core Team */ -abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock implements - \Magento\Backend\Block\Widget\Grid\Column\Renderer\RendererInterface +abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock implements RendererInterface { /** * @var int @@ -64,10 +62,10 @@ public function getColumn() /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param Object $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(Object $row) { if ($this->getColumn()->getEditable()) { $value = $this->_getValue($row); @@ -82,19 +80,19 @@ public function render(\Magento\Framework\Object $row) /** * Render column for export * - * @param \Magento\Framework\Object $row + * @param Object $row * @return string */ - public function renderExport(\Magento\Framework\Object $row) + public function renderExport(Object $row) { return $this->render($row); } /** - * @param \Magento\Framework\Object $row + * @param Object $row * @return mixed */ - protected function _getValue(\Magento\Framework\Object $row) + protected function _getValue(Object $row) { if ($getter = $this->getColumn()->getGetter()) { if (is_string($getter)) { @@ -108,10 +106,10 @@ protected function _getValue(\Magento\Framework\Object $row) } /** - * @param \Magento\Framework\Object $row + * @param Object $row * @return string */ - public function _getInputValueElement(\Magento\Framework\Object $row) + public function _getInputValueElement(Object $row) { return ' - + Magento\Backend\Helper\Data @@ -93,10 +93,10 @@ Magento\Backend\Model\Locale\Resolver\Proxy - + Magento\Backend\Model\Auth\Session::XML_PATH_SESSION_LIFETIME - Magento\Backend\AdminConfig::SESSION_NAME_ADMIN + Magento\Backend\Model\Session\AdminConfig::SESSION_NAME_ADMIN diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index 5314894c08395..db577f8e588f1 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -589,16 +589,21 @@ + Magento\Backend\Model\Config\Backend\Cookie\Lifetime + Magento\Backend\Model\Config\Backend\Cookie\Path - Magento\Backend\Model\Config\Backend\Domain + Magento\Backend\Model\Config\Backend\Cookie\Domain + + Warning: Do not set to "No". User security could be compromised.]]> + Magento\Backend\Model\Config\Source\Yesno diff --git a/app/code/Magento/Backend/etc/config.xml b/app/code/Magento/Backend/etc/config.xml index 1a88e36aea2c3..fc72289ab27bd 100644 --- a/app/code/Magento/Backend/etc/config.xml +++ b/app/code/Magento/Backend/etc/config.xml @@ -40,13 +40,6 @@ - - - - /*/sitemap.xml - - - price diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index b969c2fe61d92..11c99dcde0304 100644 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -40,12 +40,11 @@ - - + diff --git a/app/code/Magento/Backend/i18n/de_DE.csv b/app/code/Magento/Backend/i18n/de_DE.csv index 42d4d718f5dfa..7a956dbcdcfac 100644 --- a/app/code/Magento/Backend/i18n/de_DE.csv +++ b/app/code/Magento/Backend/i18n/de_DE.csv @@ -273,8 +273,8 @@ Synchronizing...,Synchronizing... "Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1.","Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1." "You saved the custom variable.","You saved the custom variable." "You deleted the custom variable.","You deleted the custom variable." -"URL Redirects","URL Redirects" -"[New/Edit] URL Redirect","[New/Edit] URL Redirect" +"URL Rewrites","URL Rewrites" +"[New/Edit] URL Rewrite","[New/Edit] URL Rewrite" "The URL Rewrite has been saved.","The URL Rewrite has been saved." "An error occurred while saving URL Rewrite.","An error occurred while saving URL Rewrite." "Chosen product does not associated with the chosen store or category.","Chosen product does not associated with the chosen store or category." diff --git a/app/code/Magento/Backend/i18n/en_US.csv b/app/code/Magento/Backend/i18n/en_US.csv index 42d4d718f5dfa..7a956dbcdcfac 100644 --- a/app/code/Magento/Backend/i18n/en_US.csv +++ b/app/code/Magento/Backend/i18n/en_US.csv @@ -273,8 +273,8 @@ Synchronizing...,Synchronizing... "Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1.","Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1." "You saved the custom variable.","You saved the custom variable." "You deleted the custom variable.","You deleted the custom variable." -"URL Redirects","URL Redirects" -"[New/Edit] URL Redirect","[New/Edit] URL Redirect" +"URL Rewrites","URL Rewrites" +"[New/Edit] URL Rewrite","[New/Edit] URL Rewrite" "The URL Rewrite has been saved.","The URL Rewrite has been saved." "An error occurred while saving URL Rewrite.","An error occurred while saving URL Rewrite." "Chosen product does not associated with the chosen store or category.","Chosen product does not associated with the chosen store or category." diff --git a/app/code/Magento/Backend/i18n/es_ES.csv b/app/code/Magento/Backend/i18n/es_ES.csv index 42d4d718f5dfa..7a956dbcdcfac 100644 --- a/app/code/Magento/Backend/i18n/es_ES.csv +++ b/app/code/Magento/Backend/i18n/es_ES.csv @@ -273,8 +273,8 @@ Synchronizing...,Synchronizing... "Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1.","Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1." "You saved the custom variable.","You saved the custom variable." "You deleted the custom variable.","You deleted the custom variable." -"URL Redirects","URL Redirects" -"[New/Edit] URL Redirect","[New/Edit] URL Redirect" +"URL Rewrites","URL Rewrites" +"[New/Edit] URL Rewrite","[New/Edit] URL Rewrite" "The URL Rewrite has been saved.","The URL Rewrite has been saved." "An error occurred while saving URL Rewrite.","An error occurred while saving URL Rewrite." "Chosen product does not associated with the chosen store or category.","Chosen product does not associated with the chosen store or category." diff --git a/app/code/Magento/Backend/i18n/fr_FR.csv b/app/code/Magento/Backend/i18n/fr_FR.csv index 42d4d718f5dfa..7a956dbcdcfac 100644 --- a/app/code/Magento/Backend/i18n/fr_FR.csv +++ b/app/code/Magento/Backend/i18n/fr_FR.csv @@ -273,8 +273,8 @@ Synchronizing...,Synchronizing... "Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1.","Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1." "You saved the custom variable.","You saved the custom variable." "You deleted the custom variable.","You deleted the custom variable." -"URL Redirects","URL Redirects" -"[New/Edit] URL Redirect","[New/Edit] URL Redirect" +"URL Rewrites","URL Rewrites" +"[New/Edit] URL Rewrite","[New/Edit] URL Rewrite" "The URL Rewrite has been saved.","The URL Rewrite has been saved." "An error occurred while saving URL Rewrite.","An error occurred while saving URL Rewrite." "Chosen product does not associated with the chosen store or category.","Chosen product does not associated with the chosen store or category." diff --git a/app/code/Magento/Backend/i18n/nl_NL.csv b/app/code/Magento/Backend/i18n/nl_NL.csv index 42d4d718f5dfa..7a956dbcdcfac 100644 --- a/app/code/Magento/Backend/i18n/nl_NL.csv +++ b/app/code/Magento/Backend/i18n/nl_NL.csv @@ -273,8 +273,8 @@ Synchronizing...,Synchronizing... "Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1.","Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1." "You saved the custom variable.","You saved the custom variable." "You deleted the custom variable.","You deleted the custom variable." -"URL Redirects","URL Redirects" -"[New/Edit] URL Redirect","[New/Edit] URL Redirect" +"URL Rewrites","URL Rewrites" +"[New/Edit] URL Rewrite","[New/Edit] URL Rewrite" "The URL Rewrite has been saved.","The URL Rewrite has been saved." "An error occurred while saving URL Rewrite.","An error occurred while saving URL Rewrite." "Chosen product does not associated with the chosen store or category.","Chosen product does not associated with the chosen store or category." diff --git a/app/code/Magento/Backend/i18n/pt_BR.csv b/app/code/Magento/Backend/i18n/pt_BR.csv index 42d4d718f5dfa..7a956dbcdcfac 100644 --- a/app/code/Magento/Backend/i18n/pt_BR.csv +++ b/app/code/Magento/Backend/i18n/pt_BR.csv @@ -273,8 +273,8 @@ Synchronizing...,Synchronizing... "Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1.","Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1." "You saved the custom variable.","You saved the custom variable." "You deleted the custom variable.","You deleted the custom variable." -"URL Redirects","URL Redirects" -"[New/Edit] URL Redirect","[New/Edit] URL Redirect" +"URL Rewrites","URL Rewrites" +"[New/Edit] URL Rewrite","[New/Edit] URL Rewrite" "The URL Rewrite has been saved.","The URL Rewrite has been saved." "An error occurred while saving URL Rewrite.","An error occurred while saving URL Rewrite." "Chosen product does not associated with the chosen store or category.","Chosen product does not associated with the chosen store or category." diff --git a/app/code/Magento/Backend/i18n/zh_CN.csv b/app/code/Magento/Backend/i18n/zh_CN.csv index 42d4d718f5dfa..7a956dbcdcfac 100644 --- a/app/code/Magento/Backend/i18n/zh_CN.csv +++ b/app/code/Magento/Backend/i18n/zh_CN.csv @@ -273,8 +273,8 @@ Synchronizing...,Synchronizing... "Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1.","Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1." "You saved the custom variable.","You saved the custom variable." "You deleted the custom variable.","You deleted the custom variable." -"URL Redirects","URL Redirects" -"[New/Edit] URL Redirect","[New/Edit] URL Redirect" +"URL Rewrites","URL Rewrites" +"[New/Edit] URL Rewrite","[New/Edit] URL Rewrite" "The URL Rewrite has been saved.","The URL Rewrite has been saved." "An error occurred while saving URL Rewrite.","An error occurred while saving URL Rewrite." "Chosen product does not associated with the chosen store or category.","Chosen product does not associated with the chosen store or category." diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_denied.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_denied.xml index 8d967323d270d..6d4251833ecc6 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_denied.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_denied.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml index d405b9690c239..a6e2c06947701 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml @@ -24,7 +24,6 @@ */ --> - diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_urlrewrite_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_urlrewrite_index.xml deleted file mode 100644 index c6557a289d3f0..0000000000000 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_urlrewrite_index.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - urlrewriteGrid - Magento\UrlRewrite\Model\Resource\UrlRewrite\Collection - url_rewrite_id - - - - - adminhtml/*/edit - - getId - - - - - - ID - text - url_rewrite_id - url_rewrite_id - col-id - col-id - - - - - Store View - store - store_id - store_id - true - - - - - Type - options - is_system - is_system - - - 1 - System - - - 0 - Custom - - - - - - - ID Path - text - id_path - id_path - - - - - Request Path - text - request_path - request_path - - - - - Target Path - text - target_path - target_path - - - - - Options - text - options - options - - - - - Action - 0 - 0 - action - actions - url_rewrite_id - - - Edit - - adminhtml/*/edit - - id - - - - - - - - - diff --git a/app/code/Magento/Backend/view/adminhtml/layout/default.xml b/app/code/Magento/Backend/view/adminhtml/layout/default.xml index cc535e0a52ca8..e7d7e18610eae 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/default.xml @@ -24,6 +24,34 @@ */ --> + + Magento Admin + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -87,154 +115,11 @@ - - - Magento Admin - - - - prototype/prototype.js - - - - - prototype/window.js - - - - - scriptaculous/builder.js - - - - - scriptaculous/effects.js - - - - - lib/ccard.js - - - - - prototype/validation.js - - - - - varien/js.js - - - - - mage/adminhtml/varienLoader.js - - - - - mage/adminhtml/tools.js - - - - - lib/ds-sleight.js - - defer - lt IE 7 - - - - - - mage/calendar.css - - - - - - - - - requirejs/require.js - - - - - mage/requirejs/resolver.js - - - - - app-config.js - - - - - - jquery/jquery-1.8.2.js - - - - - mage/jquery-no-conflict.js - - - - - - extjs/ext-tree.js - - - - can_load_ext_js - - - - - - extjs/ext-tree-checkbox.js - - - - can_load_ext_js - - - - - - extjs/resources/css/ext-all.css - - - - can_load_ext_js - - - - - - extjs/resources/css/ytheme-magento.css - - - - can_load_ext_js - - - - - - Magento_Rule::rules.js - - - - can_load_rules_js - - - + + + + - + diff --git a/app/code/Magento/Backend/view/adminhtml/layout/editor.xml b/app/code/Magento/Backend/view/adminhtml/layout/editor.xml index f5552723b99ce..0e1ab8be92df5 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/editor.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/editor.xml @@ -24,24 +24,9 @@ */ --> - - - 1 - - - - Magento_Backend::js/bootstrap/editor.js - - - - - prototype/windows/themes/default.css - - - - - Magento_Core::prototype/magento.css - - - + + + + + diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml new file mode 100644 index 0000000000000..e95aabc891ad3 --- /dev/null +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml @@ -0,0 +1,77 @@ + + + + + + + getChildHtml('head') ?> + + +getBodyClass() ? ' class="' . $this->getBodyClass() . '"' : ''; ?> data-container="body" data-mage-init='{"loaderAjax":{},"loader":{}}'> +
+ getChildHtml('notification_window'); ?> + getChildHtml('global_notices') ?> + + getChildHtml('menu') ?> + getChildHtml('notifications'); ?> + +
+ getChildHtml('main-top'); ?> +
+ getLayout()->getMessagesBlock()->getGroupedHtml() ?> +
+ getChildHtml('page_main_actions'); ?> + getChildHtml('left')): ?> +
+
+ getChildHtml('content') ?> +
+ +
+ getChildHtml('left') ?> +
+
+ +
+ getChildHtml('content') ?> +
+ +
+ + getChildHtml('js') ?> + +
+ getChildHtml('before_body_end') ?> + + + + \ No newline at end of file diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/popup.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/popup.phtml deleted file mode 100644 index 679bccef887d3..0000000000000 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/popup.phtml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - -getChildHtml('head') ?> - -getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>> -
-
-
- getChildHtml('left')): ?> -
-
- getChildHtml('left') ?> -
-
-
-
getLayout()->getMessagesBlock()->getGroupedHtml() ?>
- getChildHtml('content') ?> -
-
-
- -
getLayout()->getMessagesBlock()->getGroupedHtml() ?>
- getChildHtml('content') ?> - -
-
- getChildHtml('footer')): ?> - - - getChildHtml('js') ?> - - - -
-getChildHtml('before_body_end') ?> - - diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/head.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/head.phtml deleted file mode 100644 index 96007f399a583..0000000000000 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/head.phtml +++ /dev/null @@ -1,68 +0,0 @@ - - - -<?php echo htmlspecialchars(html_entity_decode($this->getTitle())) ?> - - - - - -getCssJsHtml() ?> - -getCanLoadExtJs()): ?> - - - -getCanLoadTinyMce()): // TinyMCE is broken when loaded through index.php ?> - - - - - -getChildHtml('components'); ?> -getChildHtml('calendar'); ?> -getChildHtml('optional_zip_countries'); ?> -getTranslatorScript(); ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/head_scripts.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/head_scripts.phtml new file mode 100644 index 0000000000000..cc0cfcffc9158 --- /dev/null +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/head_scripts.phtml @@ -0,0 +1,35 @@ + + + + + + diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml new file mode 100644 index 0000000000000..45dd53a4171c4 --- /dev/null +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml @@ -0,0 +1,37 @@ + + diff --git a/app/code/Magento/Backend/view/adminhtml/templates/urlrewrite/selector.phtml b/app/code/Magento/Backend/view/adminhtml/templates/urlrewrite/selector.phtml deleted file mode 100644 index eb0b392d1517b..0000000000000 --- a/app/code/Magento/Backend/view/adminhtml/templates/urlrewrite/selector.phtml +++ /dev/null @@ -1,45 +0,0 @@ - -
-
-
- -
- helper('Magento\Backend\Helper\Data')->getUrl('adminhtml/*/*')?> - -
-
-
-
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index 341baadcf8306..dec1f99a7786e 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -142,11 +142,8 @@ $numColumns = sizeof($this->getColumns()); - getRssLists()): ?> - getRssLists() as $_rss): ?> - getLabel() ?> - + getChildBlock('grid.bottom.links')): ?> + getChildHtml('grid.bottom.links') ?> @@ -184,7 +181,6 @@ $numColumns = sizeof($this->getColumns()); getChildBlock('grid.massaction')->getJavaScript() ?> getAdditionalJavaScript(); ?> - }); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index 09c70ed4b899c..10a18d448ea4a 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -233,11 +233,8 @@ $numColumns = sizeof($this->getColumns()); - getRssLists()): ?> - getRssLists() as $_rss): ?> - getLabel() ?> - + getChildBlock('grid.bottom.links')): ?> + getChildHtml('grid.bottom.links') ?> diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php b/app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php index 964bb7274b00b..94c7927e5c106 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php @@ -127,7 +127,7 @@ public function execute() $backupManager->rollback(); - $helper->invalidateCache()->invalidateIndexer(); + $helper->invalidateCache(); $adminSession = $this->_getSession(); $adminSession->destroy(); diff --git a/app/code/Magento/Backup/Helper/Data.php b/app/code/Magento/Backup/Helper/Data.php index eb046555cd9af..4b38d04e4f3fd 100644 --- a/app/code/Magento/Backup/Helper/Data.php +++ b/app/code/Magento/Backup/Helper/Data.php @@ -45,13 +45,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $_cacheTypeList; - /** - * Index resource process collection factory - * - * @var \Magento\Index\Model\Resource\Process\CollectionFactory - */ - protected $_processFactory; - /** * Construct * @@ -59,20 +52,17 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Framework\App\Filesystem $filesystem * @param \Magento\Framework\AuthorizationInterface $authorization * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList - * @param \Magento\Index\Model\Resource\Process\CollectionFactory $processFactory */ public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Framework\App\Filesystem $filesystem, \Magento\Framework\AuthorizationInterface $authorization, - \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, - \Magento\Index\Model\Resource\Process\CollectionFactory $processFactory + \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList ) { parent::__construct($context); $this->_authorization = $authorization; $this->_filesystem = $filesystem; $this->_cacheTypeList = $cacheTypeList; - $this->_processFactory = $processFactory; } /** @@ -261,19 +251,6 @@ public function invalidateCache() return $this; } - /** - * Invalidate Indexer - * - * @return $this - */ - public function invalidateIndexer() - { - foreach ($this->_processFactory->create() as $process) { - $process->changeStatus(\Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX); - } - return $this; - } - /** * Creates backup's display name from it's name * diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index 4eed44f1c19a1..ee63f6d234430 100644 --- a/app/code/Magento/Backup/composer.json +++ b/app/code/Magento/Backup/composer.json @@ -3,16 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-cron": "0.1.0-alpha96", - "magento/module-index": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-cron": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Backup/etc/module.xml b/app/code/Magento/Backup/etc/module.xml index 66ccd9178cb7c..1cc6eb52a3b21 100644 --- a/app/code/Magento/Backup/etc/module.xml +++ b/app/code/Magento/Backup/etc/module.xml @@ -34,7 +34,6 @@ - diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php index c7593e533c967..c13df9a9af2e4 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php @@ -21,7 +21,6 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab; /** @@ -154,40 +153,6 @@ function changeTaxClassId() { ) ); } - - $mapEnabled = $this->getForm()->getElement('msrp_enabled'); - if ($mapEnabled && $this->getCanEditPrice() !== false) { - $mapEnabled->setAfterElementHtml( - '' - ); - } } /** diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index e9438dd2a5cd0..929edba7102cd 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -56,13 +56,6 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView */ protected $_options; - /** - * Default MAP renderer type - * - * @var string - */ - protected $_mapRenderer = 'msrp_item'; - /** * Catalog product * @@ -231,7 +224,6 @@ public function getJsonConfig() } // break the reference with the last element - $canApplyMAP = false; $bundleOptionPriceAmount = $currentProduct->getPriceInfo()->getPrice('bundle_option') ->getOptionSelectionAmount($selectionItem); $priceInclTax = $bundleOptionPriceAmount->getValue(); @@ -247,7 +239,7 @@ public function getJsonConfig() 'name' => $selectionItem->getName(), 'plusDisposition' => 0, 'minusDisposition' => 0, - 'canApplyMAP' => $canApplyMAP + 'canApplyMsrp' => false ); $selection['price'] = $this->_taxData->displayPriceIncludingTax() @@ -311,7 +303,6 @@ public function getJsonConfig() ->getValue(), 'includeTax' => $this->_taxData->priceIncludesTax() ? 'true' : 'false', 'isFixedPrice' => $isFixedPrice, - //'isMAPAppliedDirectly' => $this->_catalogData->canApplyMsrp($this->getProduct(), null, false) ); $config['finalPrice'] = $this->_taxData->displayPriceIncludingTax() diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index 9b202cfc27d15..c1d30c9cf4cee 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -358,13 +358,6 @@ public function beforeSave($product) } if ($product->getPriceType() == Price::PRICE_TYPE_DYNAMIC) { - $product->setData( - 'msrp_enabled', - \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type\Enabled::MSRP_ENABLE_NO - ); - $product->unsetData('msrp'); - $product->unsetData('msrp_display_actual_price_type'); - /** unset product custom options for dynamic price */ if ($product->hasData('product_options')) { $product->unsetData('product_options'); @@ -1146,55 +1139,6 @@ public function canConfigure($product) ); } - /** - * Check if Minimum Advertise Price is enabled at least in one option - * - * @param \Magento\Catalog\Model\Product $product - * @param int $visibility - * @return bool|null - */ - public function isMapEnabledInOptions($product, $visibility = null) - { - /** - * @TODO: In order to clarify is MAP enabled for product we can check associated products. - * Commented for future improvements. - */ - /* - $collection = $this->getUsedProductCollection($product); - $helper = $this->_catalogData; - - $result = null; - $parentVisibility = $product->getMsrpDisplayActualPriceType(); - if ($parentVisibility === null) { - $parentVisibility = $helper->getMsrpDisplayActualPriceType(); - } - $visibilities = array($parentVisibility); - foreach ($collection as $item) { - if ($helper->canApplyMsrp($item)) { - $productVisibility = $item->getMsrpDisplayActualPriceType(); - if ($productVisibility === null) { - $productVisibility = $helper->getMsrpDisplayActualPriceType(); - } - $visibilities[] = $productVisibility; - $result = true; - } - } - - if ($result && $visibility !== null) { - if ($visibilities) { - $maxVisibility = max($visibilities); - $result = $result && $maxVisibility == $visibility; - } else { - $result = false; - } - } - - return $result; - */ - - return null; - } - /** * Delete data specific for Bundle product type * diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index 4f6e16b7f09c5..b7e4ac63c1c14 100644 --- a/app/code/Magento/Bundle/composer.json +++ b/app/code/Magento/Bundle/composer.json @@ -3,25 +3,24 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-catalog-rule": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-gift-message": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", - "magento/module-webapi": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-catalog-rule": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-gift-message": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", + "magento/module-webapi": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml index 8b75bdd1c7588..15c5089db1cd7 100644 --- a/app/code/Magento/Bundle/etc/di.xml +++ b/app/code/Magento/Bundle/etc/di.xml @@ -69,7 +69,6 @@ Magento\Bundle\Pricing\Price\TierPrice Magento\Bundle\Pricing\Price\GroupPrice Magento\Bundle\Pricing\Price\SpecialPrice - Magento\Catalog\Pricing\Price\MsrpPrice Magento\Catalog\Pricing\Price\CustomOptionPrice Magento\Catalog\Pricing\Price\BasePrice Magento\Bundle\Pricing\Price\ConfiguredPrice diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index 3af545dbed1b7..a6a663bb9fded 100644 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -41,7 +41,6 @@ - diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_bundle.xml b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_bundle.xml index 811f019a72653..97536c0829759 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_bundle.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_bundle.xml @@ -24,13 +24,9 @@ */ --> - - - - Magento_Bundle::css/bundle-product.css - - - + + + bundle diff --git a/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml b/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml index a0d3c734fc2c4..d57ca331e3b09 100644 --- a/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml @@ -41,14 +41,14 @@ $finalPriceModel = $this->getPrice(); showRangePrice()): ?>

renderAmount($finalPriceModel->getMinimalPrice(), [ - 'display_label' => __('From:'), + 'display_label' => __('From'), 'price_id' => $this->getPriceId('from-'), 'include_container' => true ]); ?>

renderAmount($finalPriceModel->getMaximalPrice(), [ - 'display_label' => __('To:'), + 'display_label' => __('To'), 'price_id' => $this->getPriceId('to-'), 'include_container' => true ]); ?> diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml index 34e8c9fe1ebf8..31c442f003027 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml @@ -24,11 +24,9 @@ */ --> - - - type-bundle - - + + + diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index 86facba5ec5cd..4ae84418b0039 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml index 8effff1b9a953..75321b025c78c 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml @@ -38,7 +38,6 @@ - guest_checkout diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php index 84e61bf939b5d..72bb3dc9f9675 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php @@ -75,14 +75,6 @@ public function __construct( */ protected function _prepareLayout() { - //if ($head = $this->getLayout()->getBlock('head')) { - // $head->addChild( - // 'magento-adminhtml-catalog-category-edit-js', - // 'Magento\Theme\Block\Html\Head\Script', - // array('file' => 'Magento_Catalog::catalog/category/edit.js') - // ); - //} - $category = $this->getCategory(); $categoryId = (int)$category->getId(); // 0 when we create category, otherwise some value for editing category diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php index 359f6d2acd2ee..362fb2bbf0d7d 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php @@ -32,29 +32,6 @@ class Attributes extends \Magento\Backend\Block\Widget\Form\Generic { - /** - * @var \Magento\Cms\Model\Wysiwyg\Config - */ - protected $_wysiwygConfig; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Data\FormFactory $formFactory - * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Framework\Data\FormFactory $formFactory, - \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, - array $data = array() - ) { - $this->_wysiwygConfig = $wysiwygConfig; - parent::__construct($context, $registry, $formFactory, $data); - } - /** * Retrieve Category object * @@ -76,19 +53,6 @@ protected function _construct() $this->setShowGlobalIcon(true); } - /** - * Load Wysiwyg on demand and Prepare layout - * - * @return void - */ - protected function _prepareLayout() - { - parent::_prepareLayout(); - if ($this->_wysiwygConfig->isEnabled()) { - $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); - } - } - /** * Prepare form before rendering HTML * @@ -133,28 +97,6 @@ protected function _prepareForm() $this->_setFieldset($attributes, $fieldset); - foreach ($attributes as $attribute) { - /* @var $attribute \Magento\Eav\Model\Entity\Attribute */ - if ($attribute->getAttributeCode() == 'url_key') { - if ($this->getCategory()->getLevel() == 1) { - $fieldset->removeField('url_key'); - $fieldset->addField( - 'url_key', - 'hidden', - array('name' => 'url_key', 'value' => $this->getCategory()->getUrlKey()) - ); - } else { - $form->getElement( - 'url_key' - )->setRenderer( - $this->getLayout()->createBlock( - 'Magento\Catalog\Block\Adminhtml\Form\Renderer\Attribute\Urlkey' - ) - ); - } - } - } - if ($this->getCategory()->getLevel() == 1) { $fieldset->removeField('custom_use_parent_settings'); } else { @@ -188,7 +130,6 @@ protected function _prepareForm() $form->setFieldNameSuffix('general'); $this->setForm($form); - return parent::_prepareForm(); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/General.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/General.php deleted file mode 100644 index 5f20894e654a8..0000000000000 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/General.php +++ /dev/null @@ -1,143 +0,0 @@ - - */ -namespace Magento\Catalog\Block\Adminhtml\Category\Tab; - -class General extends \Magento\Catalog\Block\Adminhtml\Form -{ - /** - * @var array|null - */ - protected $_category; - - /** - * @return void - */ - protected function _construct() - { - parent::_construct(); - $this->setShowGlobalIcon(true); - } - - /** - * @return array|null - */ - public function getCategory() - { - if (!$this->_category) { - $this->_category = $this->_coreRegistry->registry('category'); - } - return $this->_category; - } - - /** - * @return void - */ - public function _prepareLayout() - { - parent::_prepareLayout(); - /** @var \Magento\Framework\Data\Form $form */ - $form = $this->_formFactory->create(); - $form->setHtmlIdPrefix('_general'); - $form->setDataObject($this->getCategory()); - - $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('General Information'))); - - if (!$this->getCategory()->getId()) { - // $fieldset->addField('path', 'select', array( - // 'name' => 'path', - // 'label' => __('Parent Category'), - // 'value' => base64_decode($this->getRequest()->getParam('parent')), - // 'values'=> $this->_getParentCategoryOptions(), - // //'required' => true, - // //'class' => 'required-entry' - // ), - // 'name' - // ); - $parentId = $this->getRequest()->getParam('parent'); - if (!$parentId) { - $parentId = \Magento\Catalog\Model\Category::TREE_ROOT_ID; - } - $fieldset->addField('path', 'hidden', array('name' => 'path', 'value' => $parentId)); - } else { - $fieldset->addField('id', 'hidden', array('name' => 'id', 'value' => $this->getCategory()->getId())); - $fieldset->addField('path', 'hidden', array('name' => 'path', 'value' => $this->getCategory()->getPath())); - } - - $this->_setFieldset($this->getCategory()->getAttributes(true), $fieldset); - - if ($this->getCategory()->getId()) { - if ($this->getCategory()->getLevel() == 1) { - $fieldset->removeField('url_key'); - $fieldset->addField( - 'url_key', - 'hidden', - array('name' => 'url_key', 'value' => $this->getCategory()->getUrlKey()) - ); - } - } - - $form->addValues($this->getCategory()->getData()); - - $form->setFieldNameSuffix('general'); - $this->setForm($form); - } - - /** - * @return array - */ - protected function _getAdditionalElementTypes() - { - return array('image' => 'Magento\Catalog\Block\Adminhtml\Category\Helper\Image'); - } - - /** - * @param array|null $node - * @param array &$options - * @return array - */ - protected function _getParentCategoryOptions($node = null, &$options = array()) - { - if (is_null($node)) { - $node = $this->getRoot(); - } - - if ($node) { - $options[] = array( - 'value' => $node->getPathId(), - 'label' => str_repeat(' ', max(0, 3 * $node->getLevel())) . $this->escapeHtml($node->getName()) - ); - - foreach ($node->getChildren() as $child) { - $this->_getParentCategoryOptions($child, $options); - } - } - return $options; - } -} diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php index 660b6418de2b4..47185ec755077 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php @@ -31,52 +31,6 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form { - /** - * Catalog data - * - * @var \Magento\Catalog\Helper\Data - */ - protected $_catalogData = null; - - /** - * @var \Magento\Cms\Model\Wysiwyg\Config - */ - protected $_wysiwygConfig; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Data\FormFactory $formFactory - * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig - * @param \Magento\Catalog\Helper\Data $catalogData - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Framework\Data\FormFactory $formFactory, - \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, - \Magento\Catalog\Helper\Data $catalogData, - array $data = array() - ) { - $this->_wysiwygConfig = $wysiwygConfig; - $this->_catalogData = $catalogData; - parent::__construct($context, $registry, $formFactory, $data); - } - - /** - * Load Wysiwyg on demand and prepare layout - * - * @return void - */ - protected function _prepareLayout() - { - parent::_prepareLayout(); - if ($this->_catalogData->isModuleEnabled('Magento_Cms') && $this->_wysiwygConfig->isEnabled()) { - $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); - } - } - /** * Prepare attributes form * @@ -108,13 +62,6 @@ protected function _prepareForm() $this->_setFieldset($attributes, $fieldset, array('gallery')); - $urlKey = $form->getElement('url_key'); - if ($urlKey) { - $urlKey->setRenderer( - $this->getLayout()->createBlock('Magento\Catalog\Block\Adminhtml\Form\Renderer\Attribute\Urlkey') - ); - } - $tierPrice = $form->getElement('tier_price'); if ($tierPrice) { $tierPrice->setRenderer( diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php index 81a22bbbdd45a..ce2854d0bc795 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php @@ -224,7 +224,6 @@ protected function _prepareLayout() /** * Do not change this tab id - * @see \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tabs */ if ($this->getChildBlock('customer_options')) { $this->addTab('customer_options', 'customer_options'); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php index 4f9c130e5f222..8efc7787b8852 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php @@ -81,7 +81,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended * @param \Magento\Catalog\Model\Product\Visibility $visibility * @param \Magento\Catalog\Helper\Data $catalogData * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -383,8 +383,9 @@ protected function _prepareColumns() ) ); - if ($this->_catalogData->isModuleEnabled('Magento_Rss')) { - $this->addRssList('rss/catalog/notifystock', __('Notify Low Stock RSS')); + $block = $this->getLayout()->getBlock('grid.bottom.links'); + if ($block) { + $this->setChild('grid.bottom.links', $block); } return parent::_prepareColumns(); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php index 8c8845c768868..fb9d07a155e71 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php @@ -37,7 +37,7 @@ class Price extends \Magento\Framework\Data\Form\Element\Text protected $_taxData; /** - * @var Magneto_Core_Model_StoreManager + * @var \Magento\Framework\StoreManagerInterface */ protected $_storeManager; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Rss/Grid/Link.php b/app/code/Magento/Catalog/Block/Adminhtml/Rss/Grid/Link.php new file mode 100644 index 0000000000000..59207a10453cd --- /dev/null +++ b/app/code/Magento/Catalog/Block/Adminhtml/Rss/Grid/Link.php @@ -0,0 +1,97 @@ +rssUrlBuilder = $rssUrlBuilder; + parent::__construct($context, $data); + } + + /** + * {@inheritdoc} + */ + protected function _construct() + { + $this->setId('grid.rss.link'); + } + + /** + * @return string + */ + public function getLink() + { + return $this->rssUrlBuilder->getUrl($this->getLinkParams()); + } + + /** + * @return string + */ + public function getLabel() + { + return __('Notify Low Stock RSS'); + } + + /** + * Check whether status notification is allowed + * + * @return bool + */ + public function isRssAllowed() + { + return true; + } + + /** + * @return string + */ + protected function getLinkParams() + { + return array('type' => 'notifystock'); + } +} diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Rss/NotifyStock.php b/app/code/Magento/Catalog/Block/Adminhtml/Rss/NotifyStock.php new file mode 100644 index 0000000000000..1f32d4042745b --- /dev/null +++ b/app/code/Magento/Catalog/Block/Adminhtml/Rss/NotifyStock.php @@ -0,0 +1,116 @@ +rssUrlBuilder = $rssUrlBuilder; + $this->rssModel = $rssModel; + parent::__construct($context, $data); + } + + /** + * @return void + */ + protected function _construct() + { + $this->setCacheKey('rss_catalog_notifystock'); + parent::_construct(); + } + + /** + * {@inheritdoc} + */ + public function getRssData() + { + $newUrl = $this->rssUrlBuilder->getUrl(array('_secure' => true, '_nosecret' => true, 'type' => 'notifystock')); + $title = __('Low Stock Products'); + $data = array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'); + + foreach ($this->rssModel->getProductsCollection() as $item) { + /* @var $item \Magento\Catalog\Model\Product */ + $url = $this->getUrl( + 'catalog/product/edit', + array('id' => $item->getId(), '_secure' => true, '_nosecret' => true) + ); + $qty = 1 * $item->getQty(); + $description = __('%1 has reached a quantity of %2.', $item->getName(), $qty); + $data['entries'][] = array('title' => $item->getName(), 'link' => $url, 'description' => $description); + } + + return $data; + } + + /** + * {@inheritdoc} + */ + public function getCacheLifetime() + { + return 600; + } + + /** + * {@inheritdoc} + */ + public function isAllowed() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function getFeeds() + { + return array(); + } +} diff --git a/app/code/Magento/Catalog/Block/Breadcrumbs.php b/app/code/Magento/Catalog/Block/Breadcrumbs.php index 40faf651acf61..87b4e3f84cba7 100644 --- a/app/code/Magento/Catalog/Block/Breadcrumbs.php +++ b/app/code/Magento/Catalog/Block/Breadcrumbs.php @@ -90,9 +90,7 @@ protected function _prepareLayout() $title[] = $breadcrumb['label']; } - if ($headBlock = $this->getLayout()->getBlock('head')) { - $headBlock->setTitle(join($this->getTitleSeparator(), array_reverse($title))); - } + $this->pageConfig->setTitle(join($this->getTitleSeparator(), array_reverse($title))); } return parent::_prepareLayout(); } diff --git a/app/code/Magento/Catalog/Block/Category/Rss/Link.php b/app/code/Magento/Catalog/Block/Category/Rss/Link.php new file mode 100644 index 0000000000000..a9c1b0d6d2a4c --- /dev/null +++ b/app/code/Magento/Catalog/Block/Category/Rss/Link.php @@ -0,0 +1,104 @@ +registry = $registry; + $this->rssUrlBuilder = $rssUrlBuilder; + parent::__construct($context, $data); + } + + /** + * @return string + */ + public function isRssAllowed() + { + return $this->_scopeConfig->getValue('rss/catalog/category', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + } + + /** + * @return string + */ + public function getLabel() + { + return __('Subscribe to RSS Feed'); + } + + /** + * @return string + */ + protected function getLinkParams() + { + return array( + 'type' => 'category', + 'cid' => $this->registry->registry('current_category')->getId(), + 'store_id' => $this->_storeManager->getStore()->getId() + ); + } + + /** + * @return bool + */ + public function isTopCategory() + { + return $this->registry->registry('current_category')->getLevel() == 2; + } + + /** + * @return string + */ + public function getLink() + { + return $this->rssUrlBuilder->getUrl($this->getLinkParams()); + } +} diff --git a/app/code/Magento/Catalog/Block/Category/View.php b/app/code/Magento/Catalog/Block/Category/View.php index c9963e8e4c590..fc94a7f9d076c 100644 --- a/app/code/Magento/Catalog/Block/Category/View.php +++ b/app/code/Magento/Catalog/Block/Category/View.php @@ -21,14 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Category; /** - * Category View block - * - * @author Magento Core Team + * Class View + * @package Magento\Catalog\Block\Category */ -namespace Magento\Catalog\Block\Category; - class View extends \Magento\Framework\View\Element\Template implements \Magento\Framework\View\Block\IdentityInterface { /** @@ -79,42 +77,27 @@ protected function _prepareLayout() $this->getLayout()->createBlock('Magento\Catalog\Block\Breadcrumbs'); - $headBlock = $this->getLayout()->getBlock('head'); $category = $this->getCurrentCategory(); - if ($headBlock && $category) { + if ($category) { $title = $category->getMetaTitle(); if ($title) { - $headBlock->setTitle($title); + $this->pageConfig->setTitle($title); } $description = $category->getMetaDescription(); if ($description) { - $headBlock->setDescription($description); + $this->pageConfig->setDescription($description); } $keywords = $category->getMetaKeywords(); if ($keywords) { - $headBlock->setKeywords($keywords); + $this->pageConfig->setKeywords($keywords); } - //@todo: move canonical link to separate block - if ($this->_categoryHelper->canUseCanonicalTag() && !$headBlock->getChildBlock( - 'magento-page-head-category-canonical-link' - ) - ) { - $headBlock->addChild( - 'magento-page-head-category-canonical-link', - 'Magento\Theme\Block\Html\Head\Link', - array( - 'url' => $category->getUrl(), - 'properties' => array('attributes' => array('rel' => 'canonical')) - ) + if ($this->_categoryHelper->canUseCanonicalTag()) { + $this->pageConfig->addRemotePageAsset( + $category->getUrl(), + ['attributes' => ['rel' => 'canonical']] ); } - /** - * want to show rss feed in the url - */ - if ($this->isRssCatalogEnable() && $this->isTopCategory()) { - $title = __('%1 RSS Feed', $this->getCurrentCategory()->getName()); - $headBlock->addRss($title, $this->getRssLink()); - } + $pageMainTitle = $this->getLayout()->getBlock('page.main.title'); if ($pageMainTitle) { $pageMainTitle->setPageTitle($this->getCurrentCategory()->getName()); @@ -124,36 +107,6 @@ protected function _prepareLayout() return $this; } - /** - * @return string - */ - public function isRssCatalogEnable() - { - return $this->_scopeConfig->getValue('rss/catalog/category', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); - } - - /** - * @return bool - */ - public function isTopCategory() - { - return $this->getCurrentCategory()->getLevel() == 2; - } - - /** - * @return string - */ - public function getRssLink() - { - return $this->_urlBuilder->getUrl( - 'rss/catalog/category', - array( - 'cid' => $this->getCurrentCategory()->getId(), - 'store_id' => $this->_storeManager->getStore()->getId() - ) - ); - } - /** * @return string */ diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 850ae06b70986..910efe754782b 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -23,10 +23,7 @@ */ namespace Magento\Catalog\Block\Product; -/** - * Catalog Product Abstract Block - */ -abstract class AbstractProduct extends \Magento\Framework\View\Element\Template +class AbstractProduct extends \Magento\Framework\View\Element\Template { /** * @var array @@ -54,13 +51,6 @@ abstract class AbstractProduct extends \Magento\Framework\View\Element\Template */ protected $_columnCountLayoutDepend = array(); - /** - * Default MAP renderer type - * - * @var string - */ - protected $_mapRenderer = 'msrp'; - /** * Core registry * diff --git a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php index 26bd2557ff19b..22319f9b4d34b 100644 --- a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php @@ -60,13 +60,6 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare */ protected $_customerId = null; - /** - * Default MAP renderer type - * - * @var string - */ - protected $_mapRenderer = 'msrp_noform'; - /** * @var \Magento\Framework\App\Http\Context */ @@ -159,10 +152,7 @@ public function getAddToWishlistParams($product) */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Products Comparison List') . ' - ' . $headBlock->getDefaultTitle()); - } + $this->pageConfig->setTitle(__('Products Comparison List') . ' - ' . $this->pageConfig->getDefaultTitle()); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Catalog/Block/Product/Context.php b/app/code/Magento/Catalog/Block/Product/Context.php index fe22dcc23b0fe..ae4512a66517d 100644 --- a/app/code/Magento/Catalog/Block/Product/Context.php +++ b/app/code/Magento/Catalog/Block/Product/Context.php @@ -83,6 +83,11 @@ class Context extends \Magento\Framework\View\Element\Template\Context */ protected $stockItemService; + /** + * @var \Magento\Framework\View\Page\Config + */ + protected $pageConfig; + /** * @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\View\LayoutInterface $layout @@ -118,6 +123,7 @@ class Context extends \Magento\Framework\View\Element\Template\Context * @param \Magento\Catalog\Helper\Image $imageHelper * @param ReviewRendererInterface $reviewRenderer * @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService + * @param \Magento\Framework\View\Page\Config $pageConfig * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -145,6 +151,7 @@ public function __construct( \Magento\Framework\View\TemplateEnginePool $enginePool, \Magento\Framework\App\State $appState, \Magento\Framework\StoreManagerInterface $storeManager, + \Magento\Framework\View\Page\Config $pageConfig, \Magento\Catalog\Model\Config $catalogConfig, \Magento\Framework\Registry $registry, \Magento\Tax\Helper\Data $taxHelper, @@ -191,7 +198,8 @@ public function __construct( $viewFileSystem, $enginePool, $appState, - $storeManager + $storeManager, + $pageConfig ); } diff --git a/app/code/Magento/Catalog/Block/Product/Gallery.php b/app/code/Magento/Catalog/Block/Product/Gallery.php index 1e28695837e85..d303bad8442d6 100644 --- a/app/code/Magento/Catalog/Block/Product/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/Gallery.php @@ -60,10 +60,7 @@ public function __construct( */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle($this->getProduct()->getMetaTitle()); - } + $this->pageConfig->setTitle($this->getProduct()->getMetaTitle()); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Crosssell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Crosssell.php index 9b45812607a1b..360951799f927 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Crosssell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Crosssell.php @@ -29,13 +29,6 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct { - /** - * Default MAP renderer type - * - * @var string - */ - protected $_mapRenderer = 'msrp_item'; - /** * Crosssell item collection * diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index c66550e7a7671..46ade087a8571 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -33,13 +33,6 @@ */ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\View\Block\IdentityInterface { - /** - * Default MAP renderer type - * - * @var string - */ - protected $_mapRenderer = 'msrp_noform'; - /** * @var Collection */ diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 02128fd204a61..96ee027397a13 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -33,13 +33,6 @@ */ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\View\Block\IdentityInterface { - /** - * Default MAP renderer type - * - * @var string - */ - protected $_mapRenderer = 'msrp_noform'; - /** * @var int */ diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index b23ad04e27892..7a134829deca1 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -31,14 +31,6 @@ */ class View extends AbstractProduct implements \Magento\Framework\View\Block\IdentityInterface { - /** - * Default MAP renderer type - * - * @var string - * @deprecated - */ - protected $_mapRenderer = 'msrp_item'; - /** * Magento string lib * @@ -141,39 +133,31 @@ protected function _prepareLayout() if (!$product) { return parent::_prepareLayout(); } - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $title = $product->getMetaTitle(); - if ($title) { - $headBlock->setTitle($title); - } - $keyword = $product->getMetaKeyword(); - $currentCategory = $this->_coreRegistry->registry('current_category'); - if ($keyword) { - $headBlock->setKeywords($keyword); - } elseif ($currentCategory) { - $headBlock->setKeywords($product->getName()); - } - $description = $product->getMetaDescription(); - if ($description) { - $headBlock->setDescription($description); - } else { - $headBlock->setDescription($this->string->substr($product->getDescription(), 0, 255)); - } - //@todo: move canonical link to separate block - $childBlockName = 'magento-page-head-product-canonical-link'; - if ($this->_productHelper->canUseCanonicalTag() && !$headBlock->getChildBlock($childBlockName)) { - $params = array('_ignore_category' => true); - $headBlock->addChild( - $childBlockName, - 'Magento\Theme\Block\Html\Head\Link', - array( - 'url' => $product->getUrlModel()->getUrl($product, $params), - 'properties' => array('attributes' => array('rel' => 'canonical')) - ) - ); - } + + $title = $product->getMetaTitle(); + if ($title) { + $this->pageConfig->setTitle($title); + } + $keyword = $product->getMetaKeyword(); + $currentCategory = $this->_coreRegistry->registry('current_category'); + if ($keyword) { + $this->pageConfig->setKeywords($keyword); + } elseif ($currentCategory) { + $this->pageConfig->setKeywords($product->getName()); } + $description = $product->getMetaDescription(); + if ($description) { + $this->pageConfig->setDescription($description); + } else { + $this->pageConfig->setDescription($this->string->substr($product->getDescription(), 0, 255)); + } + if ($this->_productHelper->canUseCanonicalTag()) { + $this->pageConfig->addRemotePageAsset( + $product->getUrlModel()->getUrl($product, ['_ignore_category' => true]), + ['attributes' => array('rel' => 'canonical')] + ); + } + $pageMainTitle = $this->getLayout()->getBlock('page.main.title'); if ($pageMainTitle) { $pageMainTitle->setPageTitle($product->getName()); diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php index 3369bd4238f5b..7a5dff4af4758 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php @@ -64,17 +64,6 @@ public function __construct( parent::__construct($context, $coreHelper, $catalogData, $data); } - /** - * @return AbstractBlock - */ - protected function _prepareLayout() - { - if ($head = $this->getLayout()->getBlock('head')) { - $head->setCanLoadCalendarJs(true); - } - return parent::_prepareLayout(); - } - /** * Use JS calendar settings * diff --git a/app/code/Magento/Catalog/Block/Rss/Category.php b/app/code/Magento/Catalog/Block/Rss/Category.php new file mode 100644 index 0000000000000..e9ca79966f6dc --- /dev/null +++ b/app/code/Magento/Catalog/Block/Rss/Category.php @@ -0,0 +1,266 @@ +imageHelper = $imageHelper; + $this->categoryFactory = $categoryFactory; + $this->customerSession = $customerSession; + $this->rssModel = $rssModel; + $this->rssUrlBuilder = $rssUrlBuilder; + $this->storeManager = $context->getStoreManager(); + parent::__construct($context, $data); + } + + /** + * @return void + */ + protected function _construct() + { + $this->setCacheKey( + 'rss_catalog_category_' + . $this->getRequest()->getParam('cid') . '_' + . $this->getStoreId() . '_' + . $this->customerSession->getId() + ); + parent::_construct(); + } + + /** + * {@inheritdoc} + */ + public function getRssData() + { + $category = $this->categoryFactory->create(); + $category->load($this->getRequest()->getParam('cid')); + if ($category->getId()) { + $category->setIsAnchor(true); + $newUrl = $category->getUrl(); + $title = $category->getName(); + $data = array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'); + + /** @var $product \Magento\Catalog\Model\Product */ + foreach ($this->rssModel->getProductCollection($category, $this->getStoreId()) as $product) { + $product->setAllowedInRss(true); + $product->setAllowedPriceInRss(true); + + $this->_eventManager->dispatch('rss_catalog_category_xml_callback', array('product' => $product)); + + if (!$product->getAllowedInRss()) { + continue; + } + + $description = ' + + + +
%s %s
+ '; + + $description = sprintf( + $description, + $product->getProductUrl(), + $this->imageHelper->init($product, 'thumbnail')->resize(75, 75), + $product->getDescription(), + $product->getAllowedPriceInRss() ? $this->renderPriceHtml($product) : '' + ); + + $data['entries'][] = array( + 'title' => $product->getName(), + 'link' => $product->getProductUrl(), + 'description' => $description + ); + } + } else { + $data = array( + 'title' => 'Category Not Found', + 'description' => 'Category Not Found', + 'link' => $this->getUrl(''), + 'charset' => 'UTF-8' + ); + } + + return $data; + } + + /** + * Get rendered price html + * + * @param \Magento\Catalog\Model\Product $product + * @return string + */ + protected function renderPriceHtml(\Magento\Catalog\Model\Product $product) + { + /** @var \Magento\Framework\Pricing\Render $priceRender */ + $priceRender = $this->getLayout()->getBlock('product.price.render.default'); + if (!$priceRender) { + $priceRender = $this->getLayout()->createBlock( + 'Magento\Framework\Pricing\Render', + 'product.price.render.default', + array('data' => array('price_render_handle' => 'catalog_product_prices')) + ); + } + + $price = ''; + if ($priceRender) { + $price = $priceRender->render( + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + $product, + array( + 'display_minimal_price' => true, + 'use_link_for_as_low_as' => true, + 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST + ) + ); + } + + return $price; + } + + /** + * @return int + */ + protected function getStoreId() + { + $storeId = (int)$this->getRequest()->getParam('store_id'); + if ($storeId == null) { + $storeId = $this->storeManager->getStore()->getId(); + } + return $storeId; + } + + /** + * @return int + */ + public function getCacheLifetime() + { + return 600; + } + + /** + * {@inheritdoc} + */ + public function isAllowed() + { + return $this->_scopeConfig->isSetFlag('rss/catalog/category', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + } + + /** + * @return array + */ + public function getFeeds() + { + $result = array(); + if ($this->isAllowed()) { + /** @var $category \Magento\Catalog\Model\Category */ + $category = $this->categoryFactory->create(); + $treeModel = $category->getTreeModel()->loadNode($this->storeManager->getStore()->getRootCategoryId()); + $nodes = $treeModel->loadChildren()->getChildren(); + + $nodeIds = array(); + foreach ($nodes as $node) { + $nodeIds[] = $node->getId(); + } + + /* @var $collection \Magento\Catalog\Model\Resource\Category\Collection */ + $collection = $category->getResourceCollection(); + $collection->addIdFilter($nodeIds) + ->addAttributeToSelect('url_key') + ->addAttributeToSelect('name') + ->addAttributeToSelect('is_anchor') + ->addAttributeToFilter('is_active', 1) + ->addAttributeToSort('name') + ->load(); + + $feeds = array(); + foreach ($collection as $category) { + $feeds[] = array( + 'label' => $category->getName(), + 'link' => $this->rssUrlBuilder->getUrl(array('type' => 'category', 'cid' => $category->getId())) + ); + } + $result = array('group' => 'Categories', 'feeds' => $feeds); + } + return $result; + } +} diff --git a/app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php b/app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php new file mode 100644 index 0000000000000..e249f0a016c2c --- /dev/null +++ b/app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php @@ -0,0 +1,218 @@ +imageHelper = $imageHelper; + $this->rssModel = $rssModel; + $this->rssUrlBuilder = $rssUrlBuilder; + $this->storeManager = $context->getStoreManager(); + parent::__construct($context, $data); + } + + /** + * @return void + */ + protected function _construct() + { + $this->setCacheKey('rss_catalog_new_products_store_' . $this->getStoreId()); + parent::_construct(); + } + + /** + * {@inheritdoc} + */ + public function isAllowed() + { + return $this->_scopeConfig->isSetFlag('rss/catalog/new', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + } + + /** + * {@inheritdoc} + */ + public function getRssData() + { + $storeModel = $this->storeManager->getStore($this->getStoreId()); + $newUrl = $this->rssUrlBuilder->getUrl(array('store_id' => $this->getStoreId(), 'type' => 'new_products')); + $title = __('New Products from %1', $storeModel->getFrontendName()); + $lang = $this->_scopeConfig->getValue( + 'general/locale/code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeModel + ); + $data = array( + 'title' => $title, + 'description' => $title, + 'link' => $newUrl, + 'charset' => 'UTF-8', + 'language' => $lang + ); + + foreach ($this->rssModel->getProductsCollection($this->getStoreId()) as $item) { + /** @var $item \Magento\Catalog\Model\Product */ + $item->setAllowedInRss(true); + $item->setAllowedPriceInRss(true); + + $this->_eventManager->dispatch('rss_catalog_new_xml_callback', array( + 'row' => $item->getData(), + 'product' => $item + )); + + if (!$item->getAllowedInRss()) { + continue; + } + + $allowedPriceInRss = $item->getAllowedPriceInRss(); + $description =' + + + +
%s %s
+ '; + $description = sprintf( + $description, + $item->getProductUrl(), + $this->imageHelper->init($item, 'thumbnail')->resize(75, 75), + $item->getDescription(), + $allowedPriceInRss ? $this->renderPriceHtml($item) : '' + ); + + $data['entries'][] = array( + 'title' => $item->getName(), + 'link' => $item->getProductUrl(), + 'description' => $description + ); + } + + return $data; + } + + /** + * @return int + */ + protected function getStoreId() + { + $storeId = (int)$this->getRequest()->getParam('store_id'); + if ($storeId == null) { + $storeId = $this->storeManager->getStore()->getId(); + } + return $storeId; + } + + /** + * Get rendered price html + * + * @param \Magento\Catalog\Model\Product $product + * @return string + */ + protected function renderPriceHtml(\Magento\Catalog\Model\Product $product) + { + /** @var \Magento\Framework\Pricing\Render $priceRender */ + $priceRender = $this->getLayout()->getBlock('product.price.render.default'); + if (!$priceRender) { + $priceRender = $this->getLayout()->createBlock( + 'Magento\Framework\Pricing\Render', + 'product.price.render.default', + array('data' => array('price_render_handle' => 'catalog_product_prices')) + ); + } + $price = ''; + if ($priceRender) { + $price = $priceRender->render( + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + $product, + array( + 'display_minimal_price' => true, + 'use_link_for_as_low_as' => true, + 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST + ) + ); + } + + return $price; + } + + /** + * {@inheritdoc} + */ + public function getCacheLifetime() + { + return 600; + } + + /** + * @return array + */ + public function getFeeds() + { + $data = array(); + if ($this->isAllowed()) { + $url = $this->rssUrlBuilder->getUrl(array('type' => 'new_products')); + $data = array('label' => __('New Products'), 'link' => $url); + } + + return $data; + } +} diff --git a/app/code/Magento/Catalog/Block/Rss/Product/Special.php b/app/code/Magento/Catalog/Block/Rss/Product/Special.php new file mode 100644 index 0000000000000..cab115dbe8604 --- /dev/null +++ b/app/code/Magento/Catalog/Block/Rss/Product/Special.php @@ -0,0 +1,267 @@ +outputHelper = $outputHelper; + $this->imageHelper = $imageHelper; + $this->rssModel = $rssModel; + $this->rssUrlBuilder = $rssUrlBuilder; + $this->priceCurrency = $priceCurrency; + $this->catalogHelper = $catalogHelper; + $this->httpContext = $httpContext; + $this->storeManager = $context->getStoreManager(); + parent::__construct($context, $data); + } + + /** + * @return void + */ + protected function _construct() + { + $this->setCacheKey('rss_catalog_special_' . $this->getStoreId() . '_' . $this->getCustomerGroupId()); + parent::_construct(); + } + + /** + * @return string + */ + public function getRssData() + { + $newUrl = $this->rssUrlBuilder->getUrl(array('type' => 'special_products', 'store_id' => $this->getStoreId())); + $title = __('%1 - Special Products', $this->storeManager->getStore()->getFrontendName()); + $lang = $this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + + $data = array( + 'title' => $title, + 'description' => $title, + 'link' => $newUrl, + 'charset' => 'UTF-8', + 'language' => $lang + ); + + $currentDate = new \Magento\Framework\Stdlib\DateTime\Date(); + foreach ($this->rssModel->getProductsCollection($this->getStoreId(), $this->getCustomerGroupId()) as $item) { + /** @var $item \Magento\Catalog\Model\Product */ + $item->setAllowedInRss(true); + $item->setAllowedPriceInRss(true); + + $this->_eventManager->dispatch('rss_catalog_special_xml_callback', array( + 'row' => $item->getData(), + 'product' => $item + )); + + if (!$item->getAllowedInRss()) { + continue; + } + + $item->setUseSpecial(false); + if ($item->getSpecialToDate() && $item->getFinalPrice() <= $item->getSpecialPrice() && + $item->getAllowedPriceInRss() + ) { + $compareDate = $currentDate->compareDate( + $item->getSpecialToDate(), + \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT + ); + if (-1 === $compareDate || 0 === $compareDate) { + $item->setUseSpecial(true); + } + } + $data['entries'][] = $this->getEntryData($item); + } + + return $data; + } + + /** + * @param \Magento\Catalog\Model\Product $item + * @return array + */ + protected function getEntryData(\Magento\Catalog\Model\Product $item) + { + $description = ' + + + +
%s %s
+ '; + + $specialPrice = ''; + if ($item->getAllowedPriceInRss()) { + if ($this->catalogHelper->canApplyMsrp($item)) { + $specialPrice = '
' . __('Click for price') . ''; + } else { + $special = ''; + if ($item->getUseSpecial()) { + $special = '
' . __('Special Expires On: %1', $this->formatDate( + $item->getSpecialToDate(), + \Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM + )); + } + $specialPrice = sprintf( + '

%s %s%s

', + __('Price: %1', $this->priceCurrency->convertAndFormat($item->getPrice())), + __('Special Price: %1', $this->priceCurrency->convertAndFormat($item->getFinalPrice())), + $special + ); + } + } + $description = sprintf( + $description, + $item->getProductUrl(), + $this->imageHelper->init($item, 'thumbnail')->resize(75, 75), + $this->outputHelper->productAttribute($item, $item->getDescription(), 'description'), + $specialPrice + ); + + return array( + 'title' => $item->getName(), + 'link' => $item->getProductUrl(), + 'description' => $description + ); + } + + /** + * Get store id + * + * @return int + */ + protected function getStoreId() + { + $storeId = (int)$this->getRequest()->getParam('store_id'); + if ($storeId == null) { + $storeId = $this->storeManager->getStore()->getId(); + } + return $storeId; + } + + /** + * Get customer group id + * + * @return int + */ + protected function getCustomerGroupId() + { + $customerGroupId = (int) $this->getRequest()->getParam('cid'); + if ($customerGroupId == null) { + $customerGroupId = $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_GROUP); + } + return $customerGroupId; + } + + /** + * Check if RSS feed allowed + * + * @return mixed + */ + public function isAllowed() + { + return $this->_scopeConfig->isSetFlag('rss/catalog/special', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + } + + /** + * {@inheritdoc} + */ + public function getCacheLifetime() + { + return 600; + } + + /** + * @return array + */ + public function getFeeds() + { + $data = array(); + if ($this->isAllowed()) { + $url = $this->rssUrlBuilder->getUrl(array('type' => 'special_products')); + $data = array('label' => __('Special Products'), 'link' => $url); + } + return $data; + } +} diff --git a/app/code/Magento/Catalog/Block/Widget/Link.php b/app/code/Magento/Catalog/Block/Widget/Link.php index 19616864587a5..2d94f12ab8c38 100644 --- a/app/code/Magento/Catalog/Block/Widget/Link.php +++ b/app/code/Magento/Catalog/Block/Widget/Link.php @@ -29,6 +29,10 @@ */ namespace Magento\Catalog\Block\Widget; +use Magento\UrlRewrite\Model\UrlFinderInterface; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; + class Link extends \Magento\Framework\View\Element\Html\Link implements \Magento\Widget\Block\BlockInterface { /** @@ -52,60 +56,81 @@ class Link extends \Magento\Framework\View\Element\Html\Link implements \Magento protected $_anchorText; /** - * Url rewrite + * Url finder for category * - * @var \Magento\UrlRewrite\Model\Resource\UrlRewrite + * @var UrlFinderInterface */ - protected $_urlRewrite; + protected $urlFinder; /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\UrlRewrite\Model\Resource\UrlRewrite $urlRewrite + * @param UrlFinderInterface $urlFinder * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\UrlRewrite\Model\Resource\UrlRewrite $urlRewrite, - array $data = array() + UrlFinderInterface $urlFinder, + array $data = [] ) { - $this->_urlRewrite = $urlRewrite; parent::__construct($context, $data); + $this->urlFinder = $urlFinder; } /** * Prepare url using passed id path and return it * or return false if path was not found in url rewrites. * + * @throws \RuntimeException * @return string|false */ public function getHref() { - if (!$this->_href) { + if ($this->_href === null) { + if (!$this->getData('id_path')) { + throw new \RuntimeException('Parameter id_path is not set.'); + } + $rewriteData = $this->parseIdPath($this->getData('id_path')); - if ($this->hasStoreId()) { - $store = $this->_storeManager->getStore($this->getStoreId()); - } else { - $store = $this->_storeManager->getStore(); + $href = false; + $store = $this->hasStoreId() ? $this->_storeManager->getStore($this->getStoreId()) + : $this->_storeManager->getStore(); + $filterData = [ + UrlRewrite::ENTITY_ID => $rewriteData[1], + UrlRewrite::ENTITY_TYPE => $rewriteData[0], + UrlRewrite::STORE_ID => $store->getId(), + ]; + if (!empty($rewriteData[2]) && $rewriteData[0] == ProductUrlRewriteGenerator::ENTITY_TYPE) { + $filterData[UrlRewrite::METADATA]['category_id'] = $rewriteData[2]; } + $rewrite = $this->urlFinder->findOneByData($filterData); + + if ($rewrite) { + $href = $store->getUrl('', ['_direct' => $rewrite->getRequestPath()]); - /* @var $store \Magento\Store\Model\Store */ - $href = ""; - if ($this->getData('id_path')) { - $href = $this->_urlRewrite->getRequestPathByIdPath($this->getData('id_path'), $store); - if (!$href) { - return false; + if (strpos($href, '___store') === false) { + $href .= (strpos($href, '?') === false ? '?' : '&') . '___store=' . $store->getCode(); } } - - $this->_href = $store->getUrl('', array('_direct' => $href)); + $this->_href = $href; } + return $this->_href; + } - if (strpos($this->_href, "___store") === false) { - $symbol = strpos($this->_href, "?") === false ? "?" : "&"; - $this->_href = $this->_href . $symbol . "___store=" . $store->getCode(); - } + /** + * Parse id_path + * + * @param string $idPath + * @throws \RuntimeException + * @return array + */ + protected function parseIdPath($idPath) + { + $rewriteData = explode('/', $idPath); - return $this->_href; + if (!isset($rewriteData[0]) || !isset($rewriteData[1])) { + throw new \RuntimeException('Wrong id_path structure.'); + } + return $rewriteData; } /** diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php index 366d0e3b8985d..6f5e2e20a6777 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php @@ -110,7 +110,6 @@ public function execute() $this->_view->loadLayout(); $this->_setActiveMenu('Magento_Catalog::catalog_categories'); - $this->_view->getLayout()->getBlock('head')->setCanLoadExtJs(true)->setContainerCssClass('catalog-categories'); $this->_addBreadcrumb(__('Manage Catalog Categories'), __('Manage Categories')); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php index e6f3378323a4e..5c2292e8201fe 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php @@ -74,6 +74,7 @@ public function execute() } $parentCategory = $this->_objectManager->create('Magento\Catalog\Model\Category')->load($parentId); $category->setPath($parentCategory->getPath()); + $category->setParentId($parentId); } /** @@ -86,14 +87,6 @@ public function execute() } } - /** - * Create Permanent Redirect for old URL key - */ - // && $category->getOrigData('url_key') != $category->getData('url_key') - if ($category->getId() && isset($data['general']['url_key_create_redirect'])) { - $category->setData('save_rewrites_history', (bool)$data['general']['url_key_create_redirect']); - } - $category->setAttributeSetId($category->getDefaultAttributeSetId()); if (isset($data['category_products']) && !$category->getProductsReadonly()) { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php index 8bcf964d1916d..07eedf8cc69f8 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php @@ -183,8 +183,7 @@ public function execute() $this->messageManager->addNotice( __( - 'Please refresh "Catalog URL Rewrites" and "Product Attributes" in System -> ' . - 'Index Management.', + 'Please refresh "Product EAV" in System -> Index Management.', $this->getUrl('adminhtml/process/list') ) ); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php index fb4fcbb3ef62e..bcd2261590d46 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php @@ -81,8 +81,6 @@ public function execute() ); } - $this->_view->getLayout()->getBlock('head')->setCanLoadExtJs(true); - $block = $this->_view->getLayout()->getBlock('catalog.wysiwyg.js'); if ($block) { $block->setStoreId($product->getStoreId()); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php index 9dc472ea17270..7941ca0787b33 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php @@ -108,13 +108,6 @@ public function initialize(\Magento\Catalog\Model\Product $product) $product->setWebsiteIds(array($this->storeManager->getStore(true)->getWebsite()->getId())); } - /** - * Create Permanent Redirect for old URL key - */ - if ($product->getId() && isset($productData['url_key_create_redirect'])) { - $product->setData('save_rewrites_history', (bool)$productData['url_key_create_redirect']); - } - /** * Check "Use Default Value" checkboxes values */ diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/NewAction.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/NewAction.php index 089cbd4138478..dc97a9da9ce95 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/NewAction.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/NewAction.php @@ -91,8 +91,6 @@ public function execute() $this->_setActiveMenu('Magento_Catalog::catalog_products'); } - $this->_view->getLayout()->getBlock('head')->setCanLoadExtJs(true); - $block = $this->_view->getLayout()->getBlock('catalog.wysiwyg.js'); if ($block) { $block->setStoreId($product->getStoreId()); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php index 8dac12620e5f8..071db65a98164 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php @@ -51,8 +51,6 @@ public function execute() $this->_view->loadLayout(); $this->_setActiveMenu('Magento_Catalog::catalog_attributes_sets'); - $this->_view->getLayout()->getBlock('head')->setCanLoadExtJs(true); - $this->_addBreadcrumb(__('Catalog'), __('Catalog')); $this->_addBreadcrumb(__('Manage Product Sets'), __('Manage Product Sets')); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Search/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Search/Edit.php index 418720fa8d79e..4df2a960cece3 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Search/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Search/Edit.php @@ -74,8 +74,6 @@ public function execute() $this->_title->add($id ? $model->getQueryText() : __('New Search')); - $this->_view->getLayout()->getBlock('head')->setCanLoadRulesJs(true); - $this->_view->getLayout()->getBlock( 'adminhtml.catalog.search.edit' )->setData( diff --git a/app/code/Magento/Catalog/Controller/Category/View.php b/app/code/Magento/Catalog/Controller/Category/View.php index 12a68a4b63088..ef119e611cbde 100644 --- a/app/code/Magento/Catalog/Controller/Category/View.php +++ b/app/code/Magento/Catalog/Controller/Category/View.php @@ -59,6 +59,9 @@ class View extends \Magento\Framework\App\Action\Action */ protected $_storeManager; + /** @var \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator */ + protected $categoryUrlPathGenerator; + /** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory @@ -66,6 +69,7 @@ class View extends \Magento\Framework\App\Action\Action * @param \Magento\Catalog\Model\Session $catalogSession * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Framework\StoreManagerInterface $storeManager + * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator */ public function __construct( \Magento\Framework\App\Action\Context $context, @@ -73,13 +77,15 @@ public function __construct( \Magento\Catalog\Model\Design $catalogDesign, \Magento\Catalog\Model\Session $catalogSession, \Magento\Framework\Registry $coreRegistry, - \Magento\Framework\StoreManagerInterface $storeManager + \Magento\Framework\StoreManagerInterface $storeManager, + \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator ) { $this->_storeManager = $storeManager; $this->_categoryFactory = $categoryFactory; $this->_catalogDesign = $catalogDesign; $this->_catalogSession = $catalogSession; $this->_coreRegistry = $coreRegistry; + $this->categoryUrlPathGenerator = $categoryUrlPathGenerator; parent::__construct($context); } @@ -176,7 +182,7 @@ public function execute() $this->_view->generateLayoutBlocks(); $pageConfig->addBodyClass('page-products') - ->addBodyClass('categorypath-' . $category->getUrlPath()) + ->addBodyClass('categorypath-' . $this->categoryUrlPathGenerator->getUrlPath($category)) ->addBodyClass('category-' . $category->getUrlKey()); $this->_view->getLayout()->initMessages(); diff --git a/app/code/Magento/Catalog/Helper/Catalog.php b/app/code/Magento/Catalog/Helper/Catalog.php index f5d49df403c2e..7f2638a449222 100644 --- a/app/code/Magento/Catalog/Helper/Catalog.php +++ b/app/code/Magento/Catalog/Helper/Catalog.php @@ -30,16 +30,6 @@ */ class Catalog extends \Magento\Framework\App\Helper\AbstractHelper { - /** - * Config path to valid file paths - */ - const XML_PATH_PUBLIC_FILES_VALID_PATHS = 'general/file/public_files_valid_paths'; - - /** - * Config path to sitemap valid paths - */ - const XML_PATH_SITEMAP_VALID_PATHS = 'general/file/sitemap_generate_valid_paths'; - /** * Attribute Tab block name for product edit * @@ -118,17 +108,4 @@ public function setCategoryAttributeTabBlock($attributeTabBlock) $this->_categoryAttributeTabBlock = $attributeTabBlock; return $this; } - - /** - * Get list valid paths for generate a sitemap XML file - * - * @return array - */ - public function getSitemapValidPaths() - { - return array_merge( - $this->_scopeConfig->getValue(self::XML_PATH_SITEMAP_VALID_PATHS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE), - $this->_scopeConfig->getValue(self::XML_PATH_PUBLIC_FILES_VALID_PATHS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) - ); - } } diff --git a/app/code/Magento/Catalog/Helper/Category.php b/app/code/Magento/Catalog/Helper/Category.php index 99e5a25df2e3d..c698ec9a2cd24 100644 --- a/app/code/Magento/Catalog/Helper/Category.php +++ b/app/code/Magento/Catalog/Helper/Category.php @@ -34,8 +34,6 @@ */ class Category extends AbstractHelper { - const XML_PATH_CATEGORY_URL_SUFFIX = 'catalog/seo/category_url_suffix'; - const XML_PATH_USE_CATEGORY_CANONICAL_TAG = 'catalog/seo/category_canonical_tag'; const XML_PATH_CATEGORY_ROOT_ID = 'catalog/category/root_id'; @@ -47,13 +45,6 @@ class Category extends AbstractHelper */ protected $_storeCategories = array(); - /** - * Cache for category rewrite suffix - * - * @var array - */ - protected $_categoryUrlSuffix = array(); - /** * Scope config * @@ -184,53 +175,6 @@ public function canShow($category) return true; } - /** - * Retrieve category rewrite suffix for store - * - * @param int $storeId - * @return string - */ - public function getCategoryUrlSuffix($storeId = null) - { - if (is_null($storeId)) { - $storeId = $this->_storeManager->getStore()->getId(); - } - - if (!isset($this->_categoryUrlSuffix[$storeId])) { - $this->_categoryUrlSuffix[$storeId] = $this->_scopeConfig->getValue( - self::XML_PATH_CATEGORY_URL_SUFFIX, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - } - return $this->_categoryUrlSuffix[$storeId]; - } - - /** - * Retrieve clear url for category as parent - * - * @param string $urlPath - * @param bool $slash - * @param int $storeId - * @return string - */ - public function getCategoryUrlPath($urlPath, $slash = false, $storeId = null) - { - if (!$this->getCategoryUrlSuffix($storeId)) { - return $urlPath; - } - - if ($slash) { - $regexp = '#(' . preg_quote($this->getCategoryUrlSuffix($storeId), '#') . ')/$#i'; - $replace = '/'; - } else { - $regexp = '#(' . preg_quote($this->getCategoryUrlSuffix($storeId), '#') . ')$#i'; - $replace = ''; - } - - return preg_replace($regexp, $replace, $urlPath); - } - /** * Check if can be used for category * diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php index 1e21a3a8de9c0..aa81392fb0a37 100644 --- a/app/code/Magento/Catalog/Helper/Data.php +++ b/app/code/Magento/Catalog/Helper/Data.php @@ -23,13 +23,10 @@ */ namespace Magento\Catalog\Helper; -use Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type; use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Tax\Service\V1\Data\QuoteDetailsBuilder; use Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder as QuoteDetailsItemBuilder; use Magento\Tax\Service\V1\Data\TaxClassKey; -use Magento\Tax\Service\V1\Data\TaxClassKeyBuilder; -use Magento\Tax\Service\V1\TaxCalculationServiceInterface; use Magento\Customer\Model\Address\Converter as AddressConverter; use Magento\Customer\Model\Session as CustomerSession; use Magento\Tax\Model\Config; @@ -45,27 +42,12 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper const XML_PATH_PRICE_SCOPE = 'catalog/price/scope'; - const XML_PATH_SEO_SAVE_HISTORY = 'catalog/seo/save_rewrites_history'; - const CONFIG_USE_STATIC_URLS = 'cms/wysiwyg/use_static_urls_in_catalog'; const CONFIG_PARSE_URL_DIRECTIVES = 'catalog/frontend/parse_url_directives'; const XML_PATH_DISPLAY_PRODUCT_COUNT = 'catalog/layered_navigation/display_product_count'; - /** - * Minimum advertise price constants - */ - const XML_PATH_MSRP_ENABLED = 'sales/msrp/enabled'; - - const XML_PATH_MSRP_DISPLAY_ACTUAL_PRICE_TYPE = 'sales/msrp/display_price_type'; - - const XML_PATH_MSRP_APPLY_TO_ALL = 'sales/msrp/apply_for_all'; - - const XML_PATH_MSRP_EXPLANATION_MESSAGE = 'sales/msrp/explanation_message'; - - const XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS = 'sales/msrp/explanation_message_whats_this'; - /** * Cache context */ @@ -84,13 +66,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $_categoryPath; - /** - * Array of product types that MAP enabled - * - * @var array - */ - protected $_mapApplyToProductType = null; - /** * Currently selected store ID if applicable * @@ -157,13 +132,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $_categoryFactory; - /** - * Eav attribute factory - * - * @var \Magento\Catalog\Model\Resource\Eav\AttributeFactory - */ - protected $_eavAttributeFactory; - /** * Template filter factory * @@ -171,11 +139,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $_templateFilterFactory; - /** - * @var \Magento\Framework\Escaper - */ - protected $_escaper; - /** * Tax class key builder * @@ -232,7 +195,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Framework\StoreManagerInterface $storeManager @@ -243,7 +205,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory - * @param \Magento\Framework\Escaper $escaper * @param string $templateFilterModel * @param TaxClassKeyBuilder $taxClassKeyBuilder * @param Config $taxConfig @@ -256,7 +217,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ public function __construct( \Magento\Framework\App\Helper\Context $context, - \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Framework\StoreManagerInterface $storeManager, @@ -267,7 +227,6 @@ public function __construct( \Magento\Framework\Registry $coreRegistry, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory, - \Magento\Framework\Escaper $escaper, $templateFilterModel, \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder, \Magento\Tax\Model\Config $taxConfig, @@ -278,7 +237,6 @@ public function __construct( AddressConverter $addressConverter, PriceCurrencyInterface $priceCurrency ) { - $this->_eavAttributeFactory = $eavAttributeFactory; $this->_categoryFactory = $categoryFactory; $this->_productFactory = $productFactory; $this->_storeManager = $storeManager; @@ -290,7 +248,6 @@ public function __construct( $this->_scopeConfig = $scopeConfig; $this->_coreRegistry = $coreRegistry; $this->_templateFilterModel = $templateFilterModel; - $this->_escaper = $escaper; $this->_taxClassKeyBuilder = $taxClassKeyBuilder; $this->_taxConfig = $taxConfig; $this->_quoteDetailsBuilder = $quoteDetailsBuilder; @@ -466,21 +423,6 @@ public function isPriceGlobal() return $this->getPriceScope() == self::PRICE_SCOPE_GLOBAL; } - /** - * Indicate whether to save URL Rewrite History or not (create redirects to old URLs) - * - * @param int $storeId Store View - * @return bool - */ - public function shouldSaveUrlRewritesHistory($storeId = null) - { - return $this->_scopeConfig->isSetFlag( - self::XML_PATH_SEO_SAVE_HISTORY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - } - /** * Check if the store is configured to use static URLs for media * @@ -519,187 +461,6 @@ public function getPageTemplateProcessor() return $this->_templateFilterFactory->create($this->_templateFilterModel); } - /** - * Check if Minimum Advertised Price is enabled - * - * @return bool - */ - public function isMsrpEnabled() - { - return (bool)$this->_scopeConfig->getValue( - self::XML_PATH_MSRP_ENABLED, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->_storeId - ); - } - - /** - * Return MAP display actual type - * - * @return null|string - */ - public function getMsrpDisplayActualPriceType() - { - return $this->_scopeConfig->getValue( - self::XML_PATH_MSRP_DISPLAY_ACTUAL_PRICE_TYPE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->_storeId - ); - } - - /** - * Check if MAP apply to all products - * - * @return bool - */ - public function isMsrpApplyToAll() - { - return (bool) $this->_scopeConfig->getValue( - self::XML_PATH_MSRP_APPLY_TO_ALL, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->_storeId - ); - } - - /** - * Return MAP explanation message - * - * @return string - */ - public function getMsrpExplanationMessage() - { - return $this->_escaper->escapeHtml( - $this->_scopeConfig->getValue( - self::XML_PATH_MSRP_EXPLANATION_MESSAGE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->_storeId - ), - array('b', 'br', 'strong', 'i', 'u', 'p', 'span') - ); - } - - /** - * Return MAP explanation message for "Whats This" window - * - * @return string - */ - public function getMsrpExplanationMessageWhatsThis() - { - return $this->_escaper->escapeHtml( - $this->_scopeConfig->getValue( - self::XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->_storeId - ), - array('b', 'br', 'strong', 'i', 'u', 'p', 'span') - ); - } - - /** - * Check if can apply Minimum Advertise price to product - * in specific visibility - * - * @param int|\Magento\Catalog\Model\Product $product - * @param int $visibility Check displaying price in concrete place (by default generally) - * @param bool $checkAssociatedItems - * @return bool - */ - public function canApplyMsrp($product, $visibility = null, $checkAssociatedItems = true) - { - if (!$this->isMsrpEnabled()) { - return false; - } - - if (is_numeric($product)) { - /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->_productFactory->create()->setStoreId( - $this->_storeManager->getStore()->getId() - )->load( - $product - ); - } - - if (!$this->canApplyMsrpToProductType($product)) { - return false; - } - - $result = $product->getMsrpEnabled(); - if ($result == Type\Enabled::MSRP_ENABLE_USE_CONFIG) { - $result = $this->isMsrpApplyToAll(); - } - - if (!$product->hasMsrpEnabled() && $this->isMsrpApplyToAll()) { - $result = true; - } - - if ($result && $visibility !== null) { - $productVisibility = $product->getMsrpDisplayActualPriceType(); - if ($productVisibility == Type\Price::TYPE_USE_CONFIG) { - $productVisibility = $this->getMsrpDisplayActualPriceType(); - } - $result = $productVisibility == $visibility; - } - - if ($product->getTypeInstance()->isComposite($product) - && $checkAssociatedItems - && (!$result || $visibility !== null) - ) { - $resultInOptions = $product->getTypeInstance()->isMapEnabledInOptions($product, $visibility); - if ($resultInOptions !== null) { - $result = $resultInOptions; - } - } - - return $result; - } - - /** - * Check whether MAP applied to product Product Type - * - * @param \Magento\Catalog\Model\Product $product - * @return bool - */ - public function canApplyMsrpToProductType($product) - { - if ($this->_mapApplyToProductType === null) { - /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ - $attribute = $this->_eavAttributeFactory->create()->loadByCode( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp_enabled' - ); - $this->_mapApplyToProductType = $attribute->getApplyTo(); - } - return empty($this->_mapApplyToProductType) || in_array($product->getTypeId(), $this->_mapApplyToProductType); - } - - /** - * Get MAP message for price - * - * @param \Magento\Catalog\Model\Product $product - * @return string - */ - public function getMsrpPriceMessage($product) - { - $message = ""; - if ($this->canApplyMsrp($product, Type::TYPE_IN_CART)) { - $message = __('To see product price, add this item to your cart. You can always remove it later.'); - } elseif ($this->canApplyMsrp($product, Type::TYPE_BEFORE_ORDER_CONFIRM)) { - $message = __('See price before order confirmation.'); - } - return $message; - } - - /** - * Check is product need gesture to show price - * - * @param \Magento\Catalog\Model\Product $product - * @return bool - */ - public function isShowPriceOnGesture($product) - { - return $this->canApplyMsrp($product, Type::TYPE_ON_GESTURE); - } - /** * Whether to display items count for each filter option * @param int $storeId Store view ID @@ -720,10 +481,10 @@ public function shouldDisplayProductCountOnLayer($storeId = null) * @param \Magento\Catalog\Model\Product $product * @param float $price inputted product price * @param bool $includingTax return price include tax flag - * @param null|Address $shippingAddress - * @param null|Address $billingAddress + * @param null|\Magento\Customer\Model\Address\AbstractAddress $shippingAddress + * @param null|\Magento\Customer\Model\Address\AbstractAddress $billingAddress * @param null|int $ctc customer tax class - * @param null|string|bool|int|Store $store + * @param null|string|bool|int|\Magento\Store\Model\Store $store * @param bool $priceIncludesTax flag what price parameter contain tax * @param bool $roundPrice * @return float diff --git a/app/code/Magento/Catalog/Helper/Product.php b/app/code/Magento/Catalog/Helper/Product.php index 4be9078942eaa..85348d3ebd477 100644 --- a/app/code/Magento/Catalog/Helper/Product.php +++ b/app/code/Magento/Catalog/Helper/Product.php @@ -31,8 +31,6 @@ */ class Product extends \Magento\Core\Helper\Url { - const XML_PATH_PRODUCT_URL_SUFFIX = 'catalog/seo/product_url_suffix'; - const XML_PATH_PRODUCT_URL_USE_CATEGORY = 'catalog/seo/product_use_categories'; const XML_PATH_USE_PRODUCT_CANONICAL_TAG = 'catalog/seo/product_canonical_tag'; @@ -46,13 +44,6 @@ class Product extends \Magento\Core\Helper\Url */ protected $_skipSaleableCheck = false; - /** - * Cache for product rewrite suffix - * - * @var array - */ - protected $_productUrlSuffix = array(); - /** * @var array */ @@ -328,28 +319,6 @@ public function canShow($product, $where = 'catalog') return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility(); } - /** - * Retrieve product rewrite sufix for store - * - * @param int $storeId - * @return string - */ - public function getProductUrlSuffix($storeId = null) - { - if (is_null($storeId)) { - $storeId = $this->_storeManager->getStore()->getId(); - } - - if (!isset($this->_productUrlSuffix[$storeId])) { - $this->_productUrlSuffix[$storeId] = $this->_scopeConfig->getValue( - self::XML_PATH_PRODUCT_URL_SUFFIX, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - } - return $this->_productUrlSuffix[$storeId]; - } - /** * Check if can be used for product * diff --git a/app/code/Magento/Catalog/Helper/Product/View.php b/app/code/Magento/Catalog/Helper/Product/View.php index db0a65704c096..e9ee09ceaa973 100644 --- a/app/code/Magento/Catalog/Helper/Product/View.php +++ b/app/code/Magento/Catalog/Helper/Product/View.php @@ -79,6 +79,9 @@ class View extends \Magento\Framework\App\Helper\AbstractHelper */ protected $messageManager; + /** @var \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator */ + protected $categoryUrlPathGenerator; + /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Catalog\Model\Session $catalogSession @@ -87,6 +90,7 @@ class View extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Framework\App\ViewInterface $view * @param \Magento\Framework\Message\ManagerInterface $messageManager + * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator * @param array $messageGroups */ public function __construct( @@ -97,6 +101,7 @@ public function __construct( \Magento\Framework\Registry $coreRegistry, \Magento\Framework\App\ViewInterface $view, \Magento\Framework\Message\ManagerInterface $messageManager, + \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator, array $messageGroups = array() ) { $this->_catalogSession = $catalogSession; @@ -106,6 +111,7 @@ public function __construct( $this->_view = $view; $this->messageGroups = $messageGroups; $this->messageManager = $messageManager; + $this->categoryUrlPathGenerator = $categoryUrlPathGenerator; parent::__construct($context); } @@ -179,7 +185,7 @@ public function initProductLayout($product, $controller, $params = null) } $pageConfig->addBodyClass('product-' . $product->getUrlKey()); if ($currentCategory instanceof \Magento\Catalog\Model\Category) { - $pageConfig->addBodyClass('categorypath-' . $currentCategory->getUrlPath()) + $pageConfig->addBodyClass('categorypath-' . $this->categoryUrlPathGenerator->getUrlPath($currentCategory)) ->addBodyClass('category-' . $currentCategory->getUrlKey()); } diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index bc0ec4c791e5f..f367d9e74d850 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -23,15 +23,23 @@ */ namespace Magento\Catalog\Model; +use Magento\Framework\Profiler; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\UrlRewrite\Model\UrlFinderInterface; + /** * Catalog category * - * @method setAffectedProductIds(array $productIds) + * @method Category setAffectedProductIds(array $productIds) * @method array getAffectedProductIds() - * @method setMovedCategoryId(array $productIds) + * @method Category setMovedCategoryId(array $productIds) * @method int getMovedCategoryId() - * @method setAffectedCategoryIds(array $categoryIds) + * @method Category setAffectedCategoryIds(array $categoryIds) * @method array getAffectedCategoryIds() + * @method string getUrlKey() + * @method Category setUrlKey(string $urlKey) + * @method Category setUrlPath(string $urlPath) * * @SuppressWarnings(PHPMD.LongVariable) */ @@ -147,13 +155,6 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ */ protected $_storeCollectionFactory; - /** - * Url rewrite factory - * - * @var \Magento\UrlRewrite\Model\UrlRewriteFactory - */ - protected $_urlRewriteFactory; - /** * Category factory * @@ -178,33 +179,34 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ */ protected $flatIndexer; - /** - * @var \Magento\Index\Model\Indexer - */ - protected $indexIndexer; - /** * @var \Magento\Indexer\Model\IndexerInterface */ protected $productIndexer; + /** @var \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator */ + protected $categoryUrlPathGenerator; + + /** @var UrlFinderInterface */ + protected $urlFinder; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTreeResource - * @param \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory - * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $urlRewriteFactory + * @param Resource\Category\Tree $categoryTreeResource + * @param Resource\Category\TreeFactory $categoryTreeFactory + * @param CategoryFactory $categoryFactory * @param \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory * @param \Magento\Framework\UrlInterface $url - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Index\Model\Indexer $indexIndexer + * @param Resource\Product\CollectionFactory $productCollectionFactory + * @param Config $catalogConfig * @param \Magento\Framework\Filter\FilterManager $filter * @param Indexer\Category\Flat\State $flatState * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer * @param \Magento\Indexer\Model\IndexerInterface $productIndexer + * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator + * @param UrlFinderInterface $urlFinder * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data @@ -216,16 +218,16 @@ public function __construct( \Magento\Catalog\Model\Resource\Category\Tree $categoryTreeResource, \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\UrlRewrite\Model\UrlRewriteFactory $urlRewriteFactory, \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory, \Magento\Framework\UrlInterface $url, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Index\Model\Indexer $indexIndexer, \Magento\Framework\Filter\FilterManager $filter, Indexer\Category\Flat\State $flatState, \Magento\Indexer\Model\IndexerInterface $flatIndexer, \Magento\Indexer\Model\IndexerInterface $productIndexer, + \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator, + UrlFinderInterface $urlFinder, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -233,16 +235,16 @@ public function __construct( $this->_treeModel = $categoryTreeResource; $this->_categoryTreeFactory = $categoryTreeFactory; $this->_categoryFactory = $categoryFactory; - $this->_urlRewriteFactory = $urlRewriteFactory; $this->_storeCollectionFactory = $storeCollectionFactory; $this->_url = $url; $this->_productCollectionFactory = $productCollectionFactory; $this->_catalogConfig = $catalogConfig; - $this->indexIndexer = $indexIndexer; $this->productIndexer = $productIndexer; $this->filter = $filter; $this->flatState = $flatState; $this->flatIndexer = $flatIndexer; + $this->categoryUrlPathGenerator = $categoryUrlPathGenerator; + $this->urlFinder = $urlFinder; parent::__construct($context, $registry, $storeManager, $resource, $resourceCollection, $data); } @@ -262,6 +264,16 @@ protected function _construct() } } + /** + * Get flat resource model flag + * + * @return bool + */ + public function getUseFlatResource() + { + return $this->_useFlatResource; + } + /** * Return flat indexer object * @@ -298,19 +310,6 @@ public function getUrlInstance() return $this->_url; } - /** - * Get url rewrite model - * - * @return \Magento\UrlRewrite\Model\UrlRewrite - */ - public function getUrlRewrite() - { - if (!$this->_urlRewrite) { - $this->_urlRewrite = $this->_urlRewriteFactory->create(); - } - return $this->_urlRewrite; - } - /** * Retrieve category tree model * @@ -396,7 +395,6 @@ public function move($parentId, $afterCategoryId) throw $e; } $this->_eventManager->dispatch('category_move', $eventParams); - $this->indexIndexer->processEntityAction($this, self::ENTITY, \Magento\Index\Model\Event::TYPE_SAVE); if ($this->flatState->isFlatEnabled() && !$this->getFlatIndexer()->isScheduled()) { $this->getFlatIndexer()->reindexList(array($this->getId(), $oldParentId, $parentId)); } @@ -559,31 +557,27 @@ public function setStoreId($storeId) public function getUrl() { $url = $this->_getData('url'); - if (is_null($url)) { - \Magento\Framework\Profiler::start('REWRITE: ' . __METHOD__, array('group' => 'REWRITE', 'method' => __METHOD__)); - + if ($url === null) { + Profiler::start('REWRITE: ' . __METHOD__, array('group' => 'REWRITE', 'method' => __METHOD__)); if ($this->hasData('request_path') && $this->getRequestPath() != '') { $this->setData('url', $this->getUrlInstance()->getDirectUrl($this->getRequestPath())); - \Magento\Framework\Profiler::stop('REWRITE: ' . __METHOD__); + Profiler::stop('REWRITE: ' . __METHOD__); return $this->getData('url'); } - $rewrite = $this->getUrlRewrite(); - if ($this->getStoreId()) { - $rewrite->setStoreId($this->getStoreId()); - } - $idPath = 'category/' . $this->getId(); - $rewrite->loadByIdPath($idPath); - - if ($rewrite->getId()) { + $rewrite = $this->urlFinder->findOneByData([ + UrlRewrite::ENTITY_ID => $this->getId(), + UrlRewrite::ENTITY_TYPE => CategoryUrlRewriteGenerator::ENTITY_TYPE, + UrlRewrite::STORE_ID => $this->getStoreId(), + ]); + if ($rewrite) { $this->setData('url', $this->getUrlInstance()->getDirectUrl($rewrite->getRequestPath())); - \Magento\Framework\Profiler::stop('REWRITE: ' . __METHOD__); + Profiler::stop('REWRITE: ' . __METHOD__); return $this->getData('url'); } - \Magento\Framework\Profiler::stop('REWRITE: ' . __METHOD__); - $this->setData('url', $this->getCategoryIdUrl()); + Profiler::stop('REWRITE: ' . __METHOD__); return $this->getData('url'); } return $url; @@ -596,10 +590,10 @@ public function getUrl() */ public function getCategoryIdUrl() { - \Magento\Framework\Profiler::start('REGULAR: ' . __METHOD__, array('group' => 'REGULAR', 'method' => __METHOD__)); + Profiler::start('REGULAR: ' . __METHOD__, array('group' => 'REGULAR', 'method' => __METHOD__)); $urlKey = $this->getUrlKey() ? $this->getUrlKey() : $this->formatUrlKey($this->getName()); $url = $this->getUrlInstance()->getUrl('catalog/category/view', array('s' => $urlKey, 'id' => $this->getId())); - \Magento\Framework\Profiler::stop('REGULAR: ' . __METHOD__); + Profiler::stop('REGULAR: ' . __METHOD__); return $url; } @@ -631,30 +625,6 @@ public function getImageUrl() return $url; } - /** - * Retrieve URL path - * - * @return string - */ - public function getUrlPath() - { - $path = $this->getData('url_path'); - if ($path) { - return $path; - } - - $path = $this->getUrlKey(); - - if ($this->getParentId()) { - $parentPath = $this->_categoryFactory->create()->load($this->getParentId())->getCategoryPath(); - $path = $parentPath . '/' . $path; - } - - $this->setUrlPath($path); - - return $path; - } - /** * Get parent category object * @@ -1055,7 +1025,6 @@ public function validate() protected function _afterSave() { $result = parent::_afterSave(); - $this->indexIndexer->processEntityAction($this, self::ENTITY, \Magento\Index\Model\Event::TYPE_SAVE); $this->_getResource()->addCommitCallback(array($this, 'reindex')); return $result; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php index cac8406b51935..5e11522d526b6 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php @@ -28,23 +28,39 @@ class CustomerGroup extends AbstractPlugin { /** + * Invalidate the indexer after the group is created. + * * @param CustomerGroupServiceInterface $subject * @param string $result * @return string - * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterSaveGroup(CustomerGroupServiceInterface $subject, $result) + public function afterCreateGroup(CustomerGroupServiceInterface $subject, $result) { $this->invalidateIndexer(); return $result; } /** + * Invalidate the indexer after the group is updated. + * * @param CustomerGroupServiceInterface $subject * @param string $result * @return string + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterUpdateGroup(CustomerGroupServiceInterface $subject, $result) + { + $this->invalidateIndexer(); + return $result; + } + + /** + * Invalidate the indexer after the group is deleted. * + * @param CustomerGroupServiceInterface $subject + * @param string $result + * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterDeleteGroup(CustomerGroupServiceInterface $subject, $result) diff --git a/app/code/Magento/Catalog/Model/Indexer/Url.php b/app/code/Magento/Catalog/Model/Indexer/Url.php deleted file mode 100644 index 0a1dd8dc3a23e..0000000000000 --- a/app/code/Magento/Catalog/Model/Indexer/Url.php +++ /dev/null @@ -1,302 +0,0 @@ - array(\Magento\Index\Model\Event::TYPE_SAVE), - \Magento\Catalog\Model\Category::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), - \Magento\Store\Model\Store::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), - \Magento\Store\Model\Group::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), - \Magento\Framework\App\Config\ValueInterface::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE) - ); - - /** - * Related Config Settings - * - * @var array - */ - protected $_relatedConfigSettings = array( - \Magento\Catalog\Helper\Category::XML_PATH_CATEGORY_URL_SUFFIX, - \Magento\Catalog\Helper\Product::XML_PATH_PRODUCT_URL_SUFFIX, - \Magento\Catalog\Helper\Product::XML_PATH_PRODUCT_URL_USE_CATEGORY - ); - - /** - * Catalog url - * - * @var \Magento\Catalog\Model\Url - */ - protected $_catalogUrl; - - /** - * Catalog url1 - * - * @var \Magento\Catalog\Model\Resource\Url - */ - protected $_catalogResourceUrl; - - /** - * Constructor - * - * @param \Magento\Framework\Model\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory - * @param \Magento\Catalog\Model\Url $catalogUrl - * @param \Magento\Framework\Model\Resource\AbstractResource $resource - * @param \Magento\Framework\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Framework\Model\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory, - \Magento\Catalog\Model\Url $catalogUrl, - \Magento\Framework\Model\Resource\AbstractResource $resource = null, - \Magento\Framework\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - $this->_catalogResourceUrl = $catalogResourceUrlFactory->create(); - $this->_catalogUrl = $catalogUrl; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - } - - /** - * Get Indexer name - * - * @return string - */ - public function getName() - { - return __('Catalog URL Rewrites'); - } - - /** - * Get Indexer description - * - * @return string - */ - public function getDescription() - { - return __('Index product and categories URL Redirects'); - } - - /** - * Check if event can be matched by process. - * Overwrote for specific config save, store and store groups save matching - * - * @param \Magento\Index\Model\Event $event - * @return bool - */ - public function matchEvent(\Magento\Index\Model\Event $event) - { - $data = $event->getNewData(); - if (isset($data[self::EVENT_MATCH_RESULT_KEY])) { - return $data[self::EVENT_MATCH_RESULT_KEY]; - } - - $entity = $event->getEntity(); - if ($entity == \Magento\Store\Model\Store::ENTITY) { - $store = $event->getDataObject(); - if ($store && ($store->isObjectNew() || $store->dataHasChangedFor('group_id'))) { - $result = true; - } else { - $result = false; - } - } else { - if ($entity == \Magento\Store\Model\Group::ENTITY) { - /** @var \Magento\Store\Model\Group $storeGroup */ - $storeGroup = $event->getDataObject(); - $hasDataChanges = $storeGroup && ($storeGroup->dataHasChangedFor( - 'root_category_id' - ) || $storeGroup->dataHasChangedFor( - 'website_id' - )); - if ($storeGroup && !$storeGroup->isObjectNew() && $hasDataChanges) { - $result = true; - } else { - $result = false; - } - } else { - if ($entity == \Magento\Framework\App\Config\ValueInterface::ENTITY) { - $configData = $event->getDataObject(); - if ($configData && in_array($configData->getPath(), $this->_relatedConfigSettings)) { - $result = $configData->isValueChanged(); - } else { - $result = false; - } - } else { - $result = parent::matchEvent($event); - } - } - } - - $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result); - - return $result; - } - - /** - * Register data required by process in event object - * - * @param \Magento\Index\Model\Event $event - * @return $this - */ - protected function _registerEvent(\Magento\Index\Model\Event $event) - { - $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true); - $entity = $event->getEntity(); - switch ($entity) { - case \Magento\Catalog\Model\Product::ENTITY: - $this->_registerProductEvent($event); - break; - - case \Magento\Catalog\Model\Category::ENTITY: - $this->_registerCategoryEvent($event); - break; - - case \Magento\Store\Model\Store::ENTITY: - case \Magento\Store\Model\Store::ENTITY: - case \Magento\Framework\App\Config\ValueInterface::ENTITY: - $process = $event->getProcess(); - $process->changeStatus(\Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX); - break; - } - return $this; - } - - /** - * Register event data during product save process - * - * @param \Magento\Index\Model\Event $event - * @return void - */ - protected function _registerProductEvent(\Magento\Index\Model\Event $event) - { - $product = $event->getDataObject(); - $dataChange = $product->dataHasChangedFor( - 'url_key' - ) || $product->getIsChangedCategories() || $product->getIsChangedWebsites(); - - if (!$product->getExcludeUrlRewrite() && $dataChange) { - $event->addNewData('rewrite_product_ids', array($product->getId())); - } - } - - /** - * Register event data during category save process - * - * @param \Magento\Index\Model\Event $event - * @return void - */ - protected function _registerCategoryEvent(\Magento\Index\Model\Event $event) - { - $category = $event->getDataObject(); - if (!$category->getInitialSetupFlag() && $category->getLevel() > 1) { - if ($category->dataHasChangedFor('url_key') || $category->getIsChangedProductList()) { - $event->addNewData('rewrite_category_ids', array($category->getId())); - } - /** - * Check if category has another affected category ids (category move result) - */ - if ($category->getAffectedCategoryIds()) { - $event->addNewData('rewrite_category_ids', $category->getAffectedCategoryIds()); - } - } - } - - /** - * Process event - * - * @param \Magento\Index\Model\Event $event - * @return void - */ - protected function _processEvent(\Magento\Index\Model\Event $event) - { - $data = $event->getNewData(); - if (!empty($data['catalog_url_reindex_all'])) { - $this->reindexAll(); - } - - // Force rewrites history saving - $dataObject = $event->getDataObject(); - if ($dataObject instanceof \Magento\Framework\Object && $dataObject->hasData('save_rewrites_history')) { - $this->_catalogUrl->setShouldSaveRewritesHistory($dataObject->getData('save_rewrites_history')); - } - - if (isset($data['rewrite_product_ids'])) { - $this->_catalogUrl->clearStoreInvalidRewrites(); - // Maybe some products were moved or removed from website - foreach ($data['rewrite_product_ids'] as $productId) { - $this->_catalogUrl->refreshProductRewrite($productId); - } - } - if (isset($data['rewrite_category_ids'])) { - $this->_catalogUrl->clearStoreInvalidRewrites(); - // Maybe some categories were moved - foreach ($data['rewrite_category_ids'] as $categoryId) { - $this->_catalogUrl->refreshCategoryRewrite($categoryId, null, true, true); - } - } - } - - /** - * Rebuild all index data - * - * @return void - * @throws \Exception - */ - public function reindexAll() - { - $this->_catalogResourceUrl->beginTransaction(); - try { - $this->_catalogUrl->refreshRewrites(); - $this->_catalogResourceUrl->commit(); - } catch (\Exception $e) { - $this->_catalogResourceUrl->rollBack(); - throw $e; - } - } -} diff --git a/app/code/Magento/Catalog/Model/Observer.php b/app/code/Magento/Catalog/Model/Observer.php index 9bf515157cda3..8ef26b5e73b01 100644 --- a/app/code/Magento/Catalog/Model/Observer.php +++ b/app/code/Magento/Catalog/Model/Observer.php @@ -44,13 +44,6 @@ class Observer */ protected $_catalogCategory; - /** - * Index indexer - * - * @var \Magento\Index\Model\Indexer - */ - protected $_indexIndexer; - /** * Catalog layer * @@ -79,13 +72,6 @@ class Observer */ protected $_categoryResource; - /** - * Url factory - * - * @var \Magento\Catalog\Model\UrlFactory - */ - protected $_urlFactory; - /** * Factory for product resource * @@ -94,35 +80,29 @@ class Observer protected $_productResourceFactory; /** - * @param \Magento\Catalog\Model\UrlFactory $urlFactory * @param \Magento\Catalog\Model\Resource\Category $categoryResource * @param \Magento\Catalog\Model\Resource\Product $catalogProduct * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer\Category $catalogLayer - * @param \Magento\Index\Model\Indexer $indexIndexer * @param \Magento\Catalog\Helper\Category $catalogCategory * @param \Magento\Catalog\Helper\Data $catalogData * @param Indexer\Category\Flat\State $categoryFlatState * @param \Magento\Catalog\Model\Resource\ProductFactory $productResourceFactory */ public function __construct( - \Magento\Catalog\Model\UrlFactory $urlFactory, \Magento\Catalog\Model\Resource\Category $categoryResource, \Magento\Catalog\Model\Resource\Product $catalogProduct, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer\Category $catalogLayer, - \Magento\Index\Model\Indexer $indexIndexer, \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, \Magento\Catalog\Model\Resource\ProductFactory $productResourceFactory ) { - $this->_urlFactory = $urlFactory; $this->_categoryResource = $categoryResource; $this->_catalogProduct = $catalogProduct; $this->_storeManager = $storeManager; $this->_catalogLayer = $catalogLayer; - $this->_indexIndexer = $indexIndexer; $this->_catalogCategory = $catalogCategory; $this->_catalogData = $catalogData; $this->categoryFlatConfig = $categoryFlatState; @@ -184,7 +164,7 @@ protected function _addCategoriesToMenu($categories, $parentCategoryNode, $block $categoryNode = new \Magento\Framework\Data\Tree\Node($categoryData, 'id', $tree, $parentCategoryNode); $parentCategoryNode->addChild($categoryNode); - if ($this->categoryFlatConfig->isFlatEnabled()) { + if ($this->categoryFlatConfig->isFlatEnabled() && $category->getUseFlatResource()) { $subcategories = (array)$category->getChildrenNodes(); } else { $subcategories = $category->getChildren(); diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 6bae0cd627000..5ac4bd524d102 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -29,15 +29,18 @@ /** * Catalog product model * - * @method \Magento\Catalog\Model\Product setHasError(bool $value) + * @method Product setHasError(bool $value) * @method null|bool getHasError() - * @method \Magento\Catalog\Model\Product setTypeId(string $typeId) - * @method \Magento\Catalog\Model\Product setAssociatedProductIds(array $productIds) + * @method Product setTypeId(string $typeId) + * @method Product setAssociatedProductIds(array $productIds) * @method array getAssociatedProductIds() - * @method \Magento\Catalog\Model\Product setNewVariationsAttributeSetId(int $value) + * @method Product setNewVariationsAttributeSetId(int $value) * @method int getNewVariationsAttributeSetId() * @method int getPriceType - * @method \Magento\Catalog\Model\Resource\Product\Collection getCollection() + * @method Resource\Product\Collection getCollection() + * @method string getUrlKey() + * @method Product setUrlKey(string $urlKey) + * @method Product setRequestPath(string $requestPath) * * @SuppressWarnings(PHPMD.LongVariable) */ @@ -112,11 +115,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn */ protected static $_url; - /** - * @var string - */ - protected static $_urlRewrite; - /** * @var array */ @@ -181,13 +179,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn */ protected $_catalogProductType; - /** - * Index indexer - * - * @var \Magento\Index\Model\Indexer - */ - protected $_indexIndexer; - /** * Catalog product media config * @@ -282,7 +273,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn * @param Product\Visibility $catalogProductVisibility * @param Product\Attribute\Source\Status $catalogProductStatus * @param Product\Media\Config $catalogProductMediaConfig - * @param \Magento\Index\Model\Indexer $indexIndexer * @param Product\Type $catalogProductType * @param \Magento\Catalog\Helper\Image $catalogImage * @param \Magento\Catalog\Helper\Data $catalogData @@ -312,7 +302,6 @@ public function __construct( \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus, \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig, - \Magento\Index\Model\Indexer $indexIndexer, Product\Type $catalogProductType, \Magento\Catalog\Helper\Image $catalogImage, \Magento\Catalog\Helper\Data $catalogData, @@ -334,7 +323,6 @@ public function __construct( $this->_catalogProductVisibility = $catalogProductVisibility; $this->_catalogProductStatus = $catalogProductStatus; $this->_catalogProductMediaConfig = $catalogProductMediaConfig; - $this->_indexIndexer = $indexIndexer; $this->_catalogProductType = $catalogProductType; $this->_catalogImage = $catalogImage; $this->_catalogData = $catalogData; @@ -755,7 +743,6 @@ protected function _afterSave() $result = parent::_afterSave(); - $this->_indexIndexer->processEntityAction($this, self::ENTITY, \Magento\Index\Model\Event::TYPE_SAVE); $this->_getResource()->addCommitCallback(array($this, 'reindex')); $this->reloadPriceInfo(); return $result; @@ -830,7 +817,6 @@ public function reindex() protected function _beforeDelete() { $this->cleanCache(); - $this->_indexIndexer->logEvent($this, self::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE); return parent::_beforeDelete(); } @@ -844,7 +830,6 @@ protected function _afterDeleteCommit() $this->reindex(); $this->_productPriceIndexerProcessor->reindexRow($this->getId()); parent::_afterDeleteCommit(); - $this->_indexIndexer->indexEvents(self::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE); } /** @@ -1517,17 +1502,6 @@ public function formatUrlKey($str) return $this->getUrlModel()->formatUrlKey($str); } - /** - * Retrieve Product Url Path (include category) - * - * @param \Magento\Catalog\Model\Category $category - * @return string - */ - public function getUrlPath($category = null) - { - return $this->getUrlModel()->getUrlPath($this, $category); - } - /** * Save current attribute with code $code and assign new value * diff --git a/app/code/Magento/Catalog/Model/Product/Action.php b/app/code/Magento/Catalog/Model/Product/Action.php index 7eb6cd2310811..6a77bc1cb884a 100644 --- a/app/code/Magento/Catalog/Model/Product/Action.php +++ b/app/code/Magento/Catalog/Model/Product/Action.php @@ -30,13 +30,6 @@ */ class Action extends \Magento\Framework\Model\AbstractModel { - /** - * Index indexer - * - * @var \Magento\Index\Model\Indexer - */ - protected $_indexIndexer; - /** * Product website factory * @@ -63,7 +56,6 @@ class Action extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory - * @param \Magento\Index\Model\Indexer $indexIndexer * @param \Magento\Indexer\Model\IndexerInterface $categoryIndexer * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Catalog\Model\Indexer\Product\Eav\Processor $productEavIndexerProcessor @@ -75,7 +67,6 @@ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory, - \Magento\Index\Model\Indexer $indexIndexer, \Magento\Indexer\Model\IndexerInterface $categoryIndexer, \Magento\Eav\Model\Config $eavConfig, \Magento\Catalog\Model\Indexer\Product\Eav\Processor $productEavIndexerProcessor, @@ -84,7 +75,6 @@ public function __construct( array $data = array() ) { $this->_productWebsiteFactory = $productWebsiteFactory; - $this->_indexIndexer = $indexIndexer; $this->categoryIndexer = $categoryIndexer; $this->_eavConfig = $eavConfig; $this->_productEavIndexerProcessor = $productEavIndexerProcessor; @@ -148,12 +138,6 @@ public function updateAttributes($productIds, $attrData, $storeId) $this->_productEavIndexerProcessor->reindexList(array_unique($productIds)); } - // register mass action indexer event - $this->_indexIndexer->processEntityAction( - $this, - \Magento\Catalog\Model\Product::ENTITY, - \Magento\Index\Model\Event::TYPE_MASS_ACTION - ); if (!$this->getCategoryIndexer()->isScheduled()) { $this->getCategoryIndexer()->reindexList(array_unique($productIds)); } @@ -215,12 +199,6 @@ public function updateWebsites($productIds, $websiteIds, $type) array('product_ids' => array_unique($productIds), 'website_ids' => $websiteIds, 'action_type' => $type) ); - // register mass action indexer event - $this->_indexIndexer->processEntityAction( - $this, - \Magento\Catalog\Model\Product::ENTITY, - \Magento\Index\Model\Event::TYPE_MASS_ACTION - ); if (!$this->getCategoryIndexer()->isScheduled()) { $this->getCategoryIndexer()->reindexList(array_unique($productIds)); } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Msrp.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Msrp.php deleted file mode 100644 index 5e66b632aa386..0000000000000 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Msrp.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -class Msrp extends \Magento\Catalog\Model\Product\Attribute\Backend\Boolean -{ - /** - * Catalog data - * - * @var \Magento\Catalog\Helper\Data - */ - protected $_catalogData = null; - - /** - * Constructor - * - * @param \Magento\Framework\Logger $logger - * @param \Magento\Catalog\Helper\Data $catalogData - */ - public function __construct(\Magento\Framework\Logger $logger, \Magento\Catalog\Helper\Data $catalogData) - { - $this->_catalogData = $catalogData; - parent::__construct($logger); - } - - /** - * Disable MAP if it's bundle with dynamic price type - * - * @param \Magento\Catalog\Model\Product $product - * @return $this - */ - public function beforeSave($product) - { - if (!$product instanceof \Magento\Catalog\Model\Product || - $product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE || - $product->getPriceType() != \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC - ) { - return parent::beforeSave($product); - } - - parent::beforeSave($product); - $attributeCode = $this->getAttribute()->getName(); - $value = $product->getData($attributeCode); - if (empty($value)) { - $value = $this->_catalogData->isMsrpApplyToAll(); - } - if ($value) { - $product->setData($attributeCode, 0); - } - return $this; - } -} diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Urlkey.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Urlkey.php deleted file mode 100644 index 5779ffbda706e..0000000000000 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Urlkey.php +++ /dev/null @@ -1,53 +0,0 @@ - - */ -class Urlkey extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend -{ - /** - * @param \Magento\Framework\Object $object - * @return $this - */ - public function beforeSave($object) - { - $attributeName = $this->getAttribute()->getName(); - - $urlKey = $object->getData($attributeName); - if ($urlKey === false) { - return $this; - } - if ($urlKey == '') { - $urlKey = $object->getName(); - } - - $object->setData($attributeName, $object->formatUrlKey($urlKey)); - - return $this; - } -} diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type/Enabled.php b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type/Enabled.php deleted file mode 100644 index 177277dcb6aa5..0000000000000 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type/Enabled.php +++ /dev/null @@ -1,128 +0,0 @@ - - */ -namespace Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type; - -use Magento\Framework\DB\Ddl\Table; - -class Enabled extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource -{ - /** - * Enable MAP - */ - const MSRP_ENABLE_YES = 1; - - /** - * Disable MAP - */ - const MSRP_ENABLE_NO = 0; - - /** - * Get value from the store configuration settings - */ - const MSRP_ENABLE_USE_CONFIG = 2; - - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - - /** - * Entity attribute factory - * - * @var \Magento\Eav\Model\Resource\Entity\AttributeFactory - */ - protected $_entityAttributeFactory; - - /** - * Construct - * - * @param \Magento\Eav\Model\Resource\Entity\AttributeFactory $entityAttributeFactory - * @param \Magento\Core\Helper\Data $coreData - */ - public function __construct( - \Magento\Eav\Model\Resource\Entity\AttributeFactory $entityAttributeFactory, - \Magento\Core\Helper\Data $coreData - ) { - $this->_entityAttributeFactory = $entityAttributeFactory; - $this->_coreData = $coreData; - } - - /** - * Retrieve all attribute options - * - * @return array - */ - public function getAllOptions() - { - if (!$this->_options) { - $this->_options = array( - array('label' => __('Yes'), 'value' => self::MSRP_ENABLE_YES), - array('label' => __('No'), 'value' => self::MSRP_ENABLE_NO), - array('label' => __('Use config'), 'value' => self::MSRP_ENABLE_USE_CONFIG) - ); - } - return $this->_options; - } - - /** - * Retrieve flat column definition - * - * @return array - */ - public function getFlatColumns() - { - $attributeCode = $this->getAttribute()->getAttributeCode(); - - return [ - $attributeCode => [ - 'unsigned' => false, - 'default' => null, - 'extra' => null, - 'type' => Table::TYPE_SMALLINT, - 'length' => 1, - 'nullable' => true, - 'comment' => $attributeCode . ' column', - ], - ]; - } - - /** - * Retrieve Select For Flat Attribute update - * - * @param int $store - * @return \Magento\Framework\DB\Select|null - */ - public function getFlatUpdateSelect($store) - { - return $this->_entityAttributeFactory->create()->getFlatUpdateSelect($this->getAttribute(), $store); - } -} diff --git a/app/code/Magento/Catalog/Model/Product/Copier.php b/app/code/Magento/Catalog/Model/Product/Copier.php index b1e256f59a5e2..8513ba3b996cd 100644 --- a/app/code/Magento/Catalog/Model/Product/Copier.php +++ b/app/code/Magento/Catalog/Model/Product/Copier.php @@ -25,6 +25,8 @@ */ namespace Magento\Catalog\Model\Product; +use Magento\UrlRewrite\Model\Storage\DuplicateEntryException; + class Copier { /** @@ -71,7 +73,19 @@ public function copy(\Magento\Catalog\Model\Product $product) $duplicate->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID); $this->copyConstructor->build($product, $duplicate); - $duplicate->save(); + $isDuplicateSaved = false; + do { + $urlKey = $duplicate->getUrlKey(); + $urlKey = preg_match('/(.*)-(\d+)$/', $urlKey, $matches) + ? $matches[1] . '-' . ($matches[2] + 1) + : $urlKey . '-1'; + $duplicate->setUrlKey($urlKey); + try { + $duplicate->save(); + $isDuplicateSaved = true; + } catch (DuplicateEntryException $e) { + } + } while (!$isDuplicateSaved); $product->getOptionInstance()->duplicate($product->getId(), $duplicate->getId()); $product->getResource()->duplicate($product->getId(), $duplicate->getId()); diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index 232a6ecd2c996..865a7f2ee4f30 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -1035,18 +1035,6 @@ public function checkProductConfiguration($product, $buyRequest) return $errors; } - /** - * Check if Minimum advertise price is enabled at least in one option - * - * @param \Magento\Catalog\Model\Product $product - * @param int $visibility - * @return bool - */ - public function isMapEnabledInOptions($product, $visibility = null) - { - return false; - } - /** * Determine presence of weight for product type * @@ -1078,4 +1066,13 @@ public function getIdentities(\Magento\Catalog\Model\Product $product) { return array(); } + + /** + * @param \Magento\Catalog\Model\Product\Type\AbstractType $product + * @return array + */ + public function getAssociatedProducts($product) + { + return []; + } } diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php old mode 100755 new mode 100644 diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index 45268641301ff..5e78cb5814592 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -30,10 +30,11 @@ */ namespace Magento\Catalog\Model\Product; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\UrlRewrite\Model\UrlFinderInterface; + class Url extends \Magento\Framework\Object { - const CACHE_TAG = 'url_rewrite'; - /** * Static URL instance * @@ -41,13 +42,6 @@ class Url extends \Magento\Framework\Object */ protected $_url; - /** - * Static URL Rewrite Instance - * - * @var \Magento\UrlRewrite\Model\UrlRewrite - */ - protected $_urlRewrite; - /** * @var \Magento\Framework\Filter\FilterManager */ @@ -72,33 +66,40 @@ class Url extends \Magento\Framework\Object */ protected $_sidResolver; + /** @var \Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator */ + protected $productUrlPathGenerator; + + /** @var UrlFinderInterface */ + protected $urlFinder; + /** - * Construct - * - * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $urlRewriteFactory * @param \Magento\Framework\UrlInterface $url * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Category $catalogCategory * @param \Magento\Framework\Filter\FilterManager $filter * @param \Magento\Framework\Session\SidResolverInterface $sidResolver + * @param \Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator $productUrlPathGenerator + * @param UrlFinderInterface $urlFinder * @param array $data */ public function __construct( - \Magento\UrlRewrite\Model\UrlRewriteFactory $urlRewriteFactory, \Magento\Framework\UrlInterface $url, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Framework\Filter\FilterManager $filter, \Magento\Framework\Session\SidResolverInterface $sidResolver, + \Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator $productUrlPathGenerator, + UrlFinderInterface $urlFinder, array $data = array() ) { - $this->_urlRewrite = $urlRewriteFactory->create(); + parent::__construct($data); $this->_url = $url; $this->_storeManager = $storeManager; $this->_catalogCategory = $catalogCategory; $this->filter = $filter; $this->_sidResolver = $sidResolver; - parent::__construct($data); + $this->productUrlPathGenerator = $productUrlPathGenerator; + $this->urlFinder = $urlFinder; } /** @@ -111,16 +112,6 @@ public function getUrlInstance() return $this->_url; } - /** - * Retrieve URL Rewrite Instance - * - * @return \Magento\UrlRewrite\Model\UrlRewrite - */ - public function getUrlRewrite() - { - return $this->_urlRewrite; - } - /** * 'no_selection' shouldn't be a valid image attribute value * @@ -180,29 +171,6 @@ public function formatUrlKey($str) return $this->filter->translitUrl($str); } - /** - * Retrieve Product Url path (with category if exists) - * - * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Catalog\Model\Category $category - * - * @return string - * @throws \Magento\Framework\Model\Exception - */ - public function getUrlPath($product, $category = null) - { - $path = $product->getData('url_path'); - - if (is_null($category)) { - /** @todo get default category */ - return $path; - } elseif (!$category instanceof \Magento\Catalog\Model\Category) { - throw new \Magento\Framework\Model\Exception('Invalid category object supplied'); - } - - return $this->_catalogCategory->getCategoryUrlPath($category->getUrlPath()) . '/' . $path; - } - /** * Retrieve Product URL using UrlDataObject * @@ -230,13 +198,16 @@ public function getUrl(\Magento\Catalog\Model\Product $product, $params = array( } else { $requestPath = $product->getRequestPath(); if (empty($requestPath) && $requestPath !== false) { - $idPath = sprintf('product/%d', $product->getEntityId()); + $filterData = [ + UrlRewrite::ENTITY_ID => $product->getId(), + UrlRewrite::ENTITY_TYPE => \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::ENTITY_TYPE, + UrlRewrite::STORE_ID => $storeId, + ]; if ($categoryId) { - $idPath = sprintf('%s/%d', $idPath, $categoryId); + $filterData[UrlRewrite::METADATA]['category_id'] = $categoryId; } - $rewrite = $this->getUrlRewrite(); - $rewrite->setStoreId($storeId)->loadByIdPath($idPath); - if ($rewrite->getId()) { + $rewrite = $this->urlFinder->findOneByData($filterData); + if ($rewrite) { $requestPath = $rewrite->getRequestPath(); $product->setRequestPath($requestPath); } else { diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Collection.php index 8fbd56539510f..5333a105b014b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Collection.php @@ -23,6 +23,8 @@ */ namespace Magento\Catalog\Model\Resource\Category; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; + /** * Category resource collection * @@ -322,15 +324,15 @@ public function addPathFilter($regexp) */ public function joinUrlRewrite() { - $storeId = $this->_storeManager->getStore()->getId(); $this->joinTable( - 'core_url_rewrite', - 'category_id=entity_id', - array('request_path'), - "{{table}}.is_system=1" . - " AND {{table}}.product_id IS NULL" . - " AND {{table}}.store_id='{$storeId}'" . - " AND id_path LIKE 'category/%'", + 'url_rewrite', + 'entity_id = entity_id', + ['request_path'], + sprintf( + '{{table}}.is_autogenerated = 1 AND {{table}}.store_id = %d AND {{table}}.entity_type = \'%s\'', + $this->_storeManager->getStore()->getId(), + CategoryUrlRewriteGenerator::ENTITY_TYPE + ), 'left' ); return $this; diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php index 51515557a697f..adfe857270c88 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php @@ -23,12 +23,14 @@ */ namespace Magento\Catalog\Model\Resource\Category; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; + /** * Category flat model * * @SuppressWarnings(PHPMD.LongVariable) */ -class Flat extends \Magento\Index\Model\Resource\AbstractResource +class Flat extends \Magento\Indexer\Model\Resource\AbstractResource { /** * Store id @@ -268,19 +270,12 @@ protected function _loadNodes($parentNode = null, $recursionLevel = 0, $storeId 'is_anchor' ) )->joinLeft( - array('url_rewrite' => $this->getTable('core_url_rewrite')), - 'url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND ' . $_conn->quoteInto( - 'url_rewrite.product_id IS NULL AND url_rewrite.store_id=? AND ', - $storeId - ) . $_conn->prepareSqlCondition( - 'url_rewrite.id_path', - array('like' => 'category/%') - ), - array('request_path' => 'url_rewrite.request_path') - )->where( - 'main_table.is_active = ?', - '1' - ); + ['url_rewrite' => $this->getTable('url_rewrite')], + 'url_rewrite.entity_id = main_table.entity_id AND url_rewrite.is_autogenerated = 1' + . $_conn->quoteInto(' AND url_rewrite.store_id = ?', $storeId) + . $_conn->quoteInto(' AND url_rewrite.entity_type = ?', CategoryUrlRewriteGenerator::ENTITY_TYPE), + ['request_path' => 'url_rewrite.request_path'] + )->where('main_table.is_active = 1'); if (false == $skipMenuFilter) { $select->where('main_table.include_in_menu = ?', '1'); @@ -526,15 +521,11 @@ public function getParentCategories($category, $isActive = true) array('main_table' => $this->getMainStoreTable($category->getStoreId())), array('main_table.entity_id', 'main_table.name') )->joinLeft( - array('url_rewrite' => $this->getTable('core_url_rewrite')), - 'url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND ' . $read->quoteInto( - 'url_rewrite.product_id IS NULL AND url_rewrite.store_id=? AND ', - $category->getStoreId() - ) . $read->prepareSqlCondition( - 'url_rewrite.id_path', - array('like' => 'category/%') - ), - array('request_path' => 'url_rewrite.request_path') + ['url_rewrite' => $this->getTable('url_rewrite')], + 'url_rewrite.entity_id = main_table.entity_id AND url_rewrite.is_autogenerated = 1' + . $read->quoteInto(' AND url_rewrite.store_id = ?', $category->getStoreId()) + . $read->quoteInto(' AND url_rewrite.entity_type = ?', CategoryUrlRewriteGenerator::ENTITY_TYPE), + ['request_path' => 'url_rewrite.request_path'] )->where( 'main_table.entity_id IN (?)', array_reverse(explode(',', $category->getPathInStore())) diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php index e91e35d297d10..48b5b3b14d828 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php @@ -23,6 +23,7 @@ */ namespace Magento\Catalog\Model\Resource\Category\Flat; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; use Magento\Core\Model\EntityFactory; use Magento\Framework\Event\ManagerInterface; use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; @@ -335,20 +336,14 @@ public function addAttributeToFilter($attribute, $condition = null) */ public function addUrlRewriteToResult() { - $storeId = $this->_storeManager->getStore()->getId(); + $connection = $this->getConnection(); + $this->getSelect()->joinLeft( - array('url_rewrite' => $this->getTable('core_url_rewrite')), - 'url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 ' . - 'AND url_rewrite.product_id IS NULL' . - ' AND ' . - $this->getConnection()->quoteInto( - 'url_rewrite.store_id=?', - $storeId - ) . ' AND ' . $this->getConnection()->quoteInto( - 'url_rewrite.id_path LIKE ?', - 'category/%' - ), - array('request_path') + ['url_rewrite' => $this->getTable('url_rewrite')], + 'url_rewrite.entity_id = main_table.entity_id AND url_rewrite.is_autogenerated = 1' + . $connection->quoteInto(' AND url_rewrite.store_id = ?', $this->_storeManager->getStore()->getId()) + . $connection->quoteInto(' AND url_rewrite.entity_type = ?', CategoryUrlRewriteGenerator::ENTITY_TYPE), + ['request_path'] ); return $this; } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php deleted file mode 100644 index a3d7d895269a3..0000000000000 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php +++ /dev/null @@ -1,83 +0,0 @@ - - */ -class Urlkey extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend -{ - /** - * Catalog url - * - * @var \Magento\Catalog\Model\Url - */ - protected $_catalogUrl; - - /** - * @param \Magento\Framework\Logger $logger - * @param \Magento\Catalog\Model\Url $catalogUrl - */ - public function __construct(\Magento\Framework\Logger $logger, \Magento\Catalog\Model\Url $catalogUrl) - { - $this->_catalogUrl = $catalogUrl; - parent::__construct($logger); - } - - /** - * Before save - * - * @param \Magento\Framework\Object $object - * @return $this - */ - public function beforeSave($object) - { - $attributeName = $this->getAttribute()->getName(); - - $urlKey = $object->getData($attributeName); - if ($urlKey == '') { - $urlKey = $object->getName(); - } - - $object->setData($attributeName, $object->formatUrlKey($urlKey)); - - return $this; - } - - /** - * Refresh product rewrites - * - * @param \Magento\Framework\Object $object - * @return $this - */ - public function afterSave($object) - { - if ($object->dataHasChangedFor($this->getAttribute()->getName())) { - $this->_catalogUrl->refreshProductRewrites(null, $object, true); - } - return $this; - } -} diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php index ac7b011b7e90d..bad88547c508b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php @@ -25,8 +25,6 @@ /** * Catalog product EAV additional attribute resource collection - * - * @author Magento Core Team */ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection { diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php index a4a2f008a5611..ffc76618132de 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Model\Resource\Product; use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; use Magento\Store\Model\Store; use Magento\Customer\Service\V1\CustomerGroupServiceInterface; @@ -622,7 +623,7 @@ public function addAttributeToSelect($attribute, $joinType = false) protected function _afterLoad() { if ($this->_addUrlRewrite) { - $this->_addUrlRewrite($this->_urlRewriteCategory); + $this->_addUrlRewrite(); } $this->_prepareUrlDataObject(); @@ -1223,13 +1224,12 @@ public function getProductTypeIds() public function joinUrlRewrite() { $this->joinTable( - 'core_url_rewrite', - 'entity_id=entity_id', - array('request_path'), - '{{table}}.type = ' . \Magento\UrlRewrite\Model\UrlRewrite::TYPE_PRODUCT, + 'url_rewrite', + 'entity_id = entity_id', + ['request_path'], + '{{table}}.entity_type = \'' . ProductUrlRewriteGenerator::ENTITY_TYPE . '\'', 'left' ); - return $this; } @@ -1272,34 +1272,31 @@ protected function _addUrlRewrite() foreach ($this->getItems() as $item) { $productIds[] = $item->getEntityId(); } - if (!count($productIds)) { + if (!$productIds) { return; } - $select = $this->getConnection()->select()->from( - $this->getTable('core_url_rewrite'), - array('product_id', 'request_path') - )->where( - 'store_id = ?', - $this->_storeManager->getStore()->getId() - )->where( - 'is_system = ?', - 1 - )->where( - 'category_id = ? OR category_id IS NULL', - $this->_urlRewriteCategory - )->where( - 'product_id IN(?)', - $productIds - )->order( - 'category_id ' . self::SORT_ORDER_DESC - ); + $select = $this->getConnection() + ->select() + ->from(array('u' => $this->getTable('url_rewrite')), ['u.entity_id', 'u.request_path']) + ->where('u.store_id = ?', $this->_storeManager->getStore()->getId()) + ->where('u.is_autogenerated = 1') + ->where('u.entity_type = ?', ProductUrlRewriteGenerator::ENTITY_TYPE) + ->where('u.entity_id IN(?)', $productIds); + + if ($this->_urlRewriteCategory) { + $select->joinInner( + array('cu' => $this->getTable('catalog_url_rewrite_product_category')), + 'u.url_rewrite_id=cu.url_rewrite_id' + )->where('cu.category_id IN (?)', $this->_urlRewriteCategory); + } + // more priority is data with category id $urlRewrites = array(); foreach ($this->getConnection()->fetchAll($select) as $row) { - if (!isset($urlRewrites[$row['product_id']])) { - $urlRewrites[$row['product_id']] = $row['request_path']; + if (!isset($urlRewrites[$row['entity_id']])) { + $urlRewrites[$row['entity_id']] = $row['request_path']; } } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php index 5d3504ac6e59f..53623343c71b5 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php @@ -28,7 +28,7 @@ * * @author Magento Core Team */ -abstract class AbstractIndexer extends \Magento\Index\Model\Resource\AbstractResource +abstract class AbstractIndexer extends \Magento\Indexer\Model\Resource\AbstractResource { /** * Eav config diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php deleted file mode 100644 index 1ee96001d447b..0000000000000 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php +++ /dev/null @@ -1,233 +0,0 @@ - - */ -class Eav extends AbstractIndexer -{ - /** - * EAV Indexers by type - * - * @var array - */ - protected $_types; - - /** - * Eav source factory - * - * @var \Magento\Catalog\Model\Resource\Product\Indexer\Eav\SourceFactory - */ - protected $_eavSourceFactory; - - /** - * Eav decimal factory - * - * @var \Magento\Catalog\Model\Resource\Product\Indexer\Eav\DecimalFactory - */ - protected $_eavDecimalFactory; - - /** - * @param \Magento\Framework\App\Resource $resource - * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Catalog\Model\Resource\Product\Indexer\Eav\DecimalFactory $eavDecimalFactory - * @param \Magento\Catalog\Model\Resource\Product\Indexer\Eav\SourceFactory $eavSourceFactory - */ - public function __construct( - \Magento\Framework\App\Resource $resource, - \Magento\Eav\Model\Config $eavConfig, - \Magento\Catalog\Model\Resource\Product\Indexer\Eav\DecimalFactory $eavDecimalFactory, - \Magento\Catalog\Model\Resource\Product\Indexer\Eav\SourceFactory $eavSourceFactory - ) { - $this->_eavDecimalFactory = $eavDecimalFactory; - $this->_eavSourceFactory = $eavSourceFactory; - parent::__construct($resource, $eavConfig); - } - - /** - * Define main index table - * - * @return void - */ - protected function _construct() - { - $this->_init('catalog_product_index_eav', 'entity_id'); - } - - /** - * Retrieve array of EAV type indexers - * - * @return array - */ - public function getIndexers() - { - if (is_null($this->_types)) { - $this->_types = array( - 'source' => $this->_eavSourceFactory->create(), - 'decimal' => $this->_eavDecimalFactory->create() - ); - } - - return $this->_types; - } - - /** - * Retrieve indexer instance by type - * - * @param string $type - * @return \Magento\Catalog\Model\Resource\Product\Indexer\Eav\AbstractEav - * @throws \Magento\Framework\Model\Exception - */ - public function getIndexer($type) - { - $indexers = $this->getIndexers(); - if (!isset($indexers[$type])) { - throw new \Magento\Framework\Model\Exception(__('We found an unknown EAV indexer type "%1".', $type)); - } - return $indexers[$type]; - } - - /** - * Process product save. - * Method is responsible for index support - * when product was saved and assigned categories was changed. - * - * @param \Magento\Index\Model\Event $event - * @return $this - */ - public function catalogProductSave(\Magento\Index\Model\Event $event) - { - $productId = $event->getEntityPk(); - $data = $event->getNewData(); - - /** - * Check if filterable attribute values were updated - */ - if (!isset($data['reindex_eav'])) { - return $this; - } - - foreach ($this->getIndexers() as $indexer) { - /** @var $indexer \Magento\Catalog\Model\Resource\Product\Indexer\Eav\AbstractEav */ - $indexer->reindexEntities($productId); - } - - return $this; - } - - /** - * Process Product Delete - * - * @param \Magento\Index\Model\Event $event - * @return $this - */ - public function catalogProductDelete(\Magento\Index\Model\Event $event) - { - $data = $event->getNewData(); - if (empty($data['reindex_eav_parent_ids'])) { - return $this; - } - - foreach ($this->getIndexers() as $indexer) { - /** @var $indexer \Magento\Catalog\Model\Resource\Product\Indexer\Eav\AbstractEav */ - $indexer->reindexEntities($data['reindex_eav_parent_ids']); - } - - return $this; - } - - /** - * Process Product Mass Update - * - * @param \Magento\Index\Model\Event $event - * @return $this - */ - public function catalogProductMassAction(\Magento\Index\Model\Event $event) - { - $data = $event->getNewData(); - if (empty($data['reindex_eav_product_ids'])) { - return $this; - } - - foreach ($this->getIndexers() as $indexer) { - /** @var $indexer \Magento\Catalog\Model\Resource\Product\Indexer\Eav\AbstractEav */ - $indexer->reindexEntities($data['reindex_eav_product_ids']); - } - - return $this; - } - - /** - * Process Catalog Eav Attribute Save - * - * @param \Magento\Index\Model\Event $event - * @return $this - */ - public function catalogEavAttributeSave(\Magento\Index\Model\Event $event) - { - $data = $event->getNewData(); - if (empty($data['reindex_attribute'])) { - return $this; - } - - $indexer = $this->getIndexer($data['attribute_index_type']); - - $indexer->reindexAttribute($event->getEntityPk(), !empty($data['is_indexable'])); - - return $this; - } - - /** - * Rebuild all index data - * - * @return $this - */ - public function reindexAll() - { - $this->useIdxTable(true); - foreach ($this->getIndexers() as $indexer) { - /** @var $indexer \Magento\Catalog\Model\Resource\Product\Indexer\Eav\AbstractEav */ - $indexer->reindexAll(); - } - - return $this; - } - - /** - * Retrieve temporary source index table name - * - * @param string $table - * @return string - */ - public function getIdxTable($table = null) - { - if ($this->useIdxTable()) { - return $this->getTable('catalog_product_index_eav_idx'); - } - return $this->getTable('catalog_product_index_eav_tmp'); - } -} diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php index a20e8e47f7dab..61a908781231c 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php @@ -654,16 +654,6 @@ protected function _getGroupPriceIndexTable() return $this->getTable('catalog_product_index_group_price'); } - /** - * Register data required by product type process in event object - * - * @param \Magento\Index\Model\Event $event - * @return void - */ - public function registerEvent(\Magento\Index\Model\Event $event) - { - } - /** * Retrieve temporary index table name * diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/PriceInterface.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/PriceInterface.php index 0272277aa35f4..a25802e63d01b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/PriceInterface.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/PriceInterface.php @@ -44,12 +44,4 @@ public function reindexAll(); * @return $this */ public function reindexEntity($entityIds); - - /** - * Register data required by product type process in event object - * - * @param \Magento\Index\Model\Event $event - * @return void - */ - public function registerEvent(\Magento\Index\Model\Event $event); } diff --git a/app/code/Magento/Catalog/Model/Resource/Setup.php b/app/code/Magento/Catalog/Model/Resource/Setup.php index 9578a85612b9a..3dd73ed183ea9 100644 --- a/app/code/Magento/Catalog/Model/Resource/Setup.php +++ b/app/code/Magento/Catalog/Model/Resource/Setup.php @@ -34,13 +34,6 @@ class Setup extends \Magento\Eav\Model\Entity\Setup */ protected $_categoryFactory; - /** - * Indexer model factory - * - * @var \Magento\Index\Model\IndexerFactory - */ - protected $_indexerFactory; - /** * Attribute resource model factory * @@ -54,7 +47,6 @@ class Setup extends \Magento\Eav\Model\Entity\Setup * @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Index\Model\IndexerFactory $indexerFactory * @param Eav\AttributeFactory $eavAttributeResourceFactory * @param string $moduleName * @param string $connectionName @@ -65,13 +57,11 @@ public function __construct( \Magento\Framework\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Index\Model\IndexerFactory $indexerFactory, \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeResourceFactory, $moduleName = 'Magento_Catalog', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_categoryFactory = $categoryFactory; - $this->_indexerFactory = $indexerFactory; $this->_eavAttributeResourceFactory = $eavAttributeResourceFactory; parent::__construct( $context, @@ -138,16 +128,6 @@ public function getDefaultEntities() 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'group' => 'General Information' ), - 'url_key' => array( - 'type' => 'varchar', - 'label' => 'URL Key', - 'input' => 'text', - 'backend' => 'Magento\Catalog\Model\Category\Attribute\Backend\Urlkey', - 'required' => false, - 'sort_order' => 3, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'group' => 'General Information' - ), 'description' => array( 'type' => 'text', 'label' => 'Description', @@ -262,14 +242,6 @@ public function getDefaultEntities() 'visible' => false, 'group' => 'General Information' ), - 'url_path' => array( - 'type' => 'varchar', - 'required' => false, - 'sort_order' => 17, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'visible' => false, - 'group' => 'General Information' - ), 'custom_design' => array( 'type' => 'varchar', 'label' => 'Custom Design', @@ -541,7 +513,7 @@ public function getDefaultEntities() 'label' => 'Meta Title', 'input' => 'text', 'required' => false, - 'sort_order' => 1, + 'sort_order' => 20, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'group' => 'Meta Information' ), @@ -550,7 +522,7 @@ public function getDefaultEntities() 'label' => 'Meta Keywords', 'input' => 'textarea', 'required' => false, - 'sort_order' => 2, + 'sort_order' => 30, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'group' => 'Meta Information' ), @@ -561,7 +533,7 @@ public function getDefaultEntities() 'required' => false, 'note' => 'Maximum 255 chars', 'class' => 'validate-length maximum-length-255', - 'sort_order' => 3, + 'sort_order' => 40, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'group' => 'Meta Information' ), @@ -679,23 +651,6 @@ public function getDefaultEntities() 'searchable' => true, 'used_in_product_listing' => true ), - 'url_key' => array( - 'type' => 'varchar', - 'label' => 'URL Key', - 'input' => 'text', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Urlkey', - 'required' => false, - 'sort_order' => 10, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'used_in_product_listing' => true - ), - 'url_path' => array( - 'type' => 'varchar', - 'required' => false, - 'sort_order' => 11, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'visible' => false - ), 'minimal_price' => array( 'type' => 'decimal', 'label' => 'Minimal Price', diff --git a/app/code/Magento/Catalog/Model/Resource/Url.php b/app/code/Magento/Catalog/Model/Resource/Url.php index 18e90d9608e1f..3c04c8fa03411 100644 --- a/app/code/Magento/Catalog/Model/Resource/Url.php +++ b/app/code/Magento/Catalog/Model/Resource/Url.php @@ -28,6 +28,8 @@ * * @author Magento Core Team */ +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; + class Url extends \Magento\Framework\Model\Resource\Db\AbstractDb { /** @@ -134,7 +136,7 @@ public function __construct( */ protected function _construct() { - $this->_init('core_url_rewrite', 'url_rewrite_id'); + $this->_init('url_rewrite', 'url_rewrite_id'); } /** @@ -164,333 +166,6 @@ public function getCategoryModel() return $this->_catalogCategory; } - /** - * Retrieve rewrite by idPath - * - * @param string $idPath - * @param int $storeId - * @return \Magento\Framework\Object|false - */ - public function getRewriteByIdPath($idPath, $storeId) - { - $adapter = $this->_getReadAdapter(); - $select = $adapter->select()->from( - $this->getMainTable() - )->where( - 'store_id = :store_id' - )->where( - 'id_path = :id_path' - ); - $bind = array('store_id' => (int)$storeId, 'id_path' => $idPath); - $row = $adapter->fetchRow($select, $bind); - - if (!$row) { - return false; - } - $rewrite = new \Magento\Framework\Object($row); - $rewrite->setIdFieldName($this->getIdFieldName()); - - return $rewrite; - } - - /** - * Retrieve rewrite by requestPath - * - * @param string $requestPath - * @param int $storeId - * @return \Magento\Framework\Object|false - */ - public function getRewriteByRequestPath($requestPath, $storeId) - { - $adapter = $this->_getWriteAdapter(); - $select = $adapter->select()->from( - $this->getMainTable() - )->where( - 'store_id = :store_id' - )->where( - 'request_path = :request_path' - ); - $bind = array('request_path' => $requestPath, 'store_id' => (int)$storeId); - $row = $adapter->fetchRow($select, $bind); - - if (!$row) { - return false; - } - $rewrite = new \Magento\Framework\Object($row); - $rewrite->setIdFieldName($this->getIdFieldName()); - - return $rewrite; - } - - /** - * Get last used increment part of rewrite request path - * - * @param string $prefix - * @param string $suffix - * @param int $storeId - * @return int - */ - public function getLastUsedRewriteRequestIncrement($prefix, $suffix, $storeId) - { - $adapter = $this->_getWriteAdapter(); - $requestPathField = new \Zend_Db_Expr($adapter->quoteIdentifier('request_path')); - - //select increment part of request path and cast expression to integer - $expression = $adapter->getSubstringSql( - $requestPathField, - strlen($prefix) + 1, - $adapter->getLengthSql($requestPathField) . ' - ' . strlen($prefix) . ' - ' . strlen($suffix) - ); - $urlIncrementPartExpression = new \Zend_Db_Expr("CAST({$expression} AS SIGNED)"); - $select = $adapter->select()->from( - $this->getMainTable(), - new \Zend_Db_Expr('MAX(' . $urlIncrementPartExpression . ')') - )->where( - 'store_id = :store_id' - )->where( - 'request_path LIKE :request_path' - )->where( - $adapter->prepareSqlCondition( - 'request_path', - array('regexp' => '^' . preg_quote($prefix) . '[0-9]*' . preg_quote($suffix) . '$') - ) - ); - $bind = array('store_id' => (int)$storeId, 'request_path' => $prefix . '%' . $suffix); - - return (int)$adapter->fetchOne($select, $bind); - } - - /** - * Validate array of request paths. Return first not used path in case if validations passed - * - * @param array $paths - * @param int $storeId - * @return bool|string - */ - public function checkRequestPaths($paths, $storeId) - { - $adapter = $this->_getWriteAdapter(); - $select = $adapter->select()->from( - $this->getMainTable(), - 'request_path' - )->where( - 'store_id = :store_id' - )->where( - 'request_path IN (?)', - $paths - ); - $data = $adapter->fetchCol($select, array('store_id' => $storeId)); - $paths = array_diff($paths, $data); - if (empty($paths)) { - return false; - } - reset($paths); - - return current($paths); - } - - /** - * Prepare rewrites for condition - * - * @param int $storeId - * @param int|array $categoryIds - * @param int|array $productIds - * @return array - */ - public function prepareRewrites($storeId, $categoryIds = null, $productIds = null) - { - $rewrites = array(); - $adapter = $this->_getWriteAdapter(); - $select = $adapter->select()->from( - $this->getMainTable() - )->where( - 'store_id = :store_id' - )->where( - 'is_system = ?', - 1 - ); - $bind = array('store_id' => $storeId); - if ($categoryIds === null) { - $select->where('category_id IS NULL'); - } elseif ($categoryIds) { - $catIds = is_array($categoryIds) ? $categoryIds : array($categoryIds); - - // Check maybe we request products and root category id is within categoryIds, - // it's a separate case because root category products are stored with NULL categoryId - if ($productIds) { - $addNullCategory = in_array($this->getStores($storeId)->getRootCategoryId(), $catIds); - } else { - $addNullCategory = false; - } - - // Compose optimal condition - if ($addNullCategory) { - $select->where('category_id IN(?) OR category_id IS NULL', $catIds); - } else { - $select->where('category_id IN(?)', $catIds); - } - } - - if ($productIds === null) { - $select->where('product_id IS NULL'); - } elseif ($productIds) { - $select->where('product_id IN(?)', $productIds); - } - - $rowSet = $adapter->fetchAll($select, $bind); - - foreach ($rowSet as $row) { - $rewrite = new \Magento\Framework\Object($row); - $rewrite->setIdFieldName($this->getIdFieldName()); - $rewrites[$rewrite->getIdPath()] = $rewrite; - } - - return $rewrites; - } - - /** - * Save rewrite URL - * - * @param array $rewriteData - * @param int|\Magento\Framework\Object $rewrite - * @return $this - * @throws \Magento\Framework\Model\Exception - */ - public function saveRewrite($rewriteData, $rewrite) - { - $adapter = $this->_getWriteAdapter(); - try { - $adapter->insertOnDuplicate($this->getMainTable(), $rewriteData); - } catch (\Exception $e) { - $this->_logger->logException($e); - throw new \Magento\Framework\Model\Exception(__('Something went wrong saving the URL rewite.')); - } - - if ($rewrite && $rewrite->getId()) { - if ($rewriteData['request_path'] != $rewrite->getRequestPath()) { - // Update existing rewrites history and avoid chain redirects - $where = array('target_path = ?' => $rewrite->getRequestPath()); - if ($rewrite->getStoreId()) { - $where['store_id = ?'] = (int)$rewrite->getStoreId(); - } - $adapter->update($this->getMainTable(), array('target_path' => $rewriteData['request_path']), $where); - } - } - unset($rewriteData); - - return $this; - } - - /** - * Saves rewrite history - * - * @param array $rewriteData - * @return $this - */ - public function saveRewriteHistory($rewriteData) - { - $rewriteData = new \Magento\Framework\Object($rewriteData); - // check if rewrite exists with save request_path - $rewrite = $this->getRewriteByRequestPath($rewriteData->getRequestPath(), $rewriteData->getStoreId()); - if ($rewrite === false) { - // create permanent redirect - $this->_getWriteAdapter()->insert($this->getMainTable(), $rewriteData->getData()); - } - - return $this; - } - - /** - * Save category attribute - * - * @param \Magento\Framework\Object $category - * @param string $attributeCode - * @return $this - */ - public function saveCategoryAttribute(\Magento\Framework\Object $category, $attributeCode) - { - $adapter = $this->_getWriteAdapter(); - if (!isset($this->_categoryAttributes[$attributeCode])) { - $attribute = $this->getCategoryModel()->getResource()->getAttribute($attributeCode); - - $this->_categoryAttributes[$attributeCode] = array( - 'entity_type_id' => $attribute->getEntityTypeId(), - 'attribute_id' => $attribute->getId(), - 'table' => $attribute->getBackend()->getTable(), - 'is_global' => $attribute->getIsGlobal() - ); - unset($attribute); - } - - $attributeTable = $this->_categoryAttributes[$attributeCode]['table']; - - $attributeData = array( - 'entity_type_id' => $this->_categoryAttributes[$attributeCode]['entity_type_id'], - 'attribute_id' => $this->_categoryAttributes[$attributeCode]['attribute_id'], - 'store_id' => $category->getStoreId(), - 'entity_id' => $category->getId(), - 'value' => $category->getData($attributeCode) - ); - - if ($this->_categoryAttributes[$attributeCode]['is_global'] || $category->getStoreId() == 0) { - $attributeData['store_id'] = 0; - } - - $select = $adapter->select()->from( - $attributeTable - )->where( - 'entity_type_id = ?', - (int)$attributeData['entity_type_id'] - )->where( - 'attribute_id = ?', - (int)$attributeData['attribute_id'] - )->where( - 'store_id = ?', - (int)$attributeData['store_id'] - )->where( - 'entity_id = ?', - (int)$attributeData['entity_id'] - ); - - $row = $adapter->fetchRow($select); - $whereCond = array('value_id = ?' => $row['value_id']); - if ($row) { - $adapter->update($attributeTable, $attributeData, $whereCond); - } else { - $adapter->insert($attributeTable, $attributeData); - } - - if ($attributeData['store_id'] != 0) { - $attributeData['store_id'] = 0; - $select = $adapter->select()->from( - $attributeTable - )->where( - 'entity_type_id = ?', - (int)$attributeData['entity_type_id'] - )->where( - 'attribute_id = ?', - (int)$attributeData['attribute_id'] - )->where( - 'store_id = ?', - (int)$attributeData['store_id'] - )->where( - 'entity_id = ?', - (int)$attributeData['entity_id'] - ); - - $row = $adapter->fetchRow($select); - if ($row) { - $whereCond = array('value_id = ?' => $row['value_id']); - $adapter->update($attributeTable, $attributeData, $whereCond); - } else { - $adapter->insert($attributeTable, $attributeData); - } - } - unset($attributeData); - - return $this; - } - /** * Retrieve category attributes * @@ -583,97 +258,6 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId) return $attributes; } - /** - * Save product attribute - * - * @param \Magento\Framework\Object $product - * @param string $attributeCode - * @return $this - */ - public function saveProductAttribute(\Magento\Framework\Object $product, $attributeCode) - { - $adapter = $this->_getWriteAdapter(); - if (!isset($this->_productAttributes[$attributeCode])) { - $attribute = $this->productResource->getAttribute($attributeCode); - - $this->_productAttributes[$attributeCode] = array( - 'entity_type_id' => $attribute->getEntityTypeId(), - 'attribute_id' => $attribute->getId(), - 'table' => $attribute->getBackend()->getTable(), - 'is_global' => $attribute->getIsGlobal() - ); - unset($attribute); - } - - $attributeTable = $this->_productAttributes[$attributeCode]['table']; - - $attributeData = array( - 'entity_type_id' => $this->_productAttributes[$attributeCode]['entity_type_id'], - 'attribute_id' => $this->_productAttributes[$attributeCode]['attribute_id'], - 'store_id' => $product->getStoreId(), - 'entity_id' => $product->getId(), - 'value' => $product->getData($attributeCode) - ); - - if ($this->_productAttributes[$attributeCode]['is_global'] || $product->getStoreId() == 0) { - $attributeData['store_id'] = 0; - } - - $select = $adapter->select()->from( - $attributeTable - )->where( - 'entity_type_id = ?', - (int)$attributeData['entity_type_id'] - )->where( - 'attribute_id = ?', - (int)$attributeData['attribute_id'] - )->where( - 'store_id = ?', - (int)$attributeData['store_id'] - )->where( - 'entity_id = ?', - (int)$attributeData['entity_id'] - ); - - $row = $adapter->fetchRow($select); - if ($row) { - $whereCond = array('value_id = ?' => $row['value_id']); - $adapter->update($attributeTable, $attributeData, $whereCond); - } else { - $adapter->insert($attributeTable, $attributeData); - } - - if ($attributeData['store_id'] != 0) { - $attributeData['store_id'] = 0; - $select = $adapter->select()->from( - $attributeTable - )->where( - 'entity_type_id = ?', - (int)$attributeData['entity_type_id'] - )->where( - 'attribute_id = ?', - (int)$attributeData['attribute_id'] - )->where( - 'store_id = ?', - (int)$attributeData['store_id'] - )->where( - 'entity_id = ?', - (int)$attributeData['entity_id'] - ); - - $row = $adapter->fetchRow($select); - if ($row) { - $whereCond = array('value_id = ?' => $row['value_id']); - $adapter->update($attributeTable, $attributeData, $whereCond); - } else { - $adapter->insert($attributeTable, $attributeData); - } - } - unset($attributeData); - - return $this; - } - /** * Retrieve product attribute * @@ -932,127 +516,6 @@ public function getCategories($categoryIds, $storeId) return $this->_getCategories($categoryIds, $storeId); } - /** - * Retrieve category child data objects - * - * @param \Magento\Framework\Object $category - * @return \Magento\Framework\Object - */ - public function loadCategoryChilds(\Magento\Framework\Object $category) - { - if ($category->getId() === null || $category->getStoreId() === null) { - return $category; - } - - $categories = $this->_getCategories(null, $category->getStoreId(), $category->getPath() . '/'); - $category->setChilds(array()); - foreach ($categories as $child) { - if (!is_array($child->getChilds())) { - $child->setChilds(array()); - } - if ($child->getParentId() == $category->getId()) { - $category->setChilds($category->getChilds() + array($child->getId() => $child)); - } else { - if (isset($categories[$child->getParentId()])) { - if (!is_array($categories[$child->getParentId()]->getChilds())) { - $categories[$child->getParentId()]->setChilds(array()); - } - $categories[$child->getParentId()]->setChilds( - $categories[$child->getParentId()]->getChilds() + array($child->getId() => $child) - ); - } - } - } - $category->setAllChilds($categories); - - return $category; - } - - /** - * Retrieves all children ids of root category tree - * Actually this routine can be used to get children ids of any category, not only root. - * But as far as result is cached in memory, it's not recommended to do so. - * - * @param string $categoryId - * @param string $categoryPath - * @param bool $includeStart - * @return \Magento\Framework\Object - */ - public function getRootChildrenIds($categoryId, $categoryPath, $includeStart = true) - { - if (!isset($this->_rootChildrenIds[$categoryId])) { - // Select all descedant category ids - $adapter = $this->_getReadAdapter(); - $select = $adapter->select()->from( - array($this->getTable('catalog_category_entity')), - array('entity_id') - )->where( - 'path LIKE ?', - $categoryPath . '/%' - ); - - $categoryIds = array(); - $rowSet = $adapter->fetchAll($select); - foreach ($rowSet as $row) { - $categoryIds[$row['entity_id']] = $row['entity_id']; - } - $this->_rootChildrenIds[$categoryId] = $categoryIds; - } - - $categoryIds = $this->_rootChildrenIds[$categoryId]; - if ($includeStart) { - $categoryIds[$categoryId] = $categoryId; - } - return $categoryIds; - } - - /** - * Retrieve category parent path - * - * @param \Magento\Framework\Object $category - * @return string - */ - public function getCategoryParentPath(\Magento\Framework\Object $category) - { - $store = $this->_storeManager->getStore($category->getStoreId()); - - if ($category->getId() == $store->getRootCategoryId()) { - return ''; - } elseif ($category->getParentId() == 1 || $category->getParentId() == $store->getRootCategoryId()) { - return ''; - } - - $parentCategory = $this->getCategory($category->getParentId(), $store->getId()); - return $parentCategory->getUrlPath() . '/'; - } - - /** - * Retrieve product ids by category - * - * @param \Magento\Framework\Object|int $category - * @return array - */ - public function getProductIdsByCategory($category) - { - if ($category instanceof \Magento\Framework\Object) { - $categoryId = $category->getId(); - } else { - $categoryId = $category; - } - $adapter = $this->_getReadAdapter(); - $select = $adapter->select()->from( - $this->getTable('catalog_category_product'), - array('product_id') - )->where( - 'category_id = :category_id' - )->order( - 'product_id' - ); - $bind = array('category_id' => $categoryId); - - return $adapter->fetchCol($select, $bind); - } - /** * Retrieve Product data objects * @@ -1161,217 +624,6 @@ public function getProductsByStore($storeId, &$lastEntityId) return $this->_getProducts(null, $storeId, $lastEntityId, $lastEntityId); } - /** - * Retrieve Product data objects in category - * - * @param \Magento\Framework\Object $category - * @param int &$lastEntityId - * @return array - */ - public function getProductsByCategory(\Magento\Framework\Object $category, &$lastEntityId) - { - $productIds = $this->getProductIdsByCategory($category); - if (!$productIds) { - return array(); - } - return $this->_getProducts($productIds, $category->getStoreId(), $lastEntityId, $lastEntityId); - } - - /** - * Find and remove unused products rewrites - a case when products were moved away from the category - * (either to other category or deleted), so rewrite "category_id-product_id" is invalid - * - * @param int $storeId - * @return $this - */ - public function clearCategoryProduct($storeId) - { - $adapter = $this->_getWriteAdapter(); - $select = $adapter->select()->from( - array('tur' => $this->getMainTable()), - $this->getIdFieldName() - )->joinLeft( - array('tcp' => $this->getTable('catalog_category_product')), - 'tur.category_id = tcp.category_id AND tur.product_id = tcp.product_id', - array() - )->where( - 'tur.store_id = :store_id' - )->where( - 'tur.category_id IS NOT NULL' - )->where( - 'tur.product_id IS NOT NULL' - )->where( - 'tcp.category_id IS NULL' - ); - $rewriteIds = $adapter->fetchCol($select, array('store_id' => $storeId)); - if ($rewriteIds) { - $where = array($this->getIdFieldName() . ' IN(?)' => $rewriteIds); - $adapter->delete($this->getMainTable(), $where); - } - - return $this; - } - - /** - * Remove unused rewrites for product - called after we created all needed rewrites for product and - * know the categories where the product is contained ($excludeCategoryIds), - * so we can remove all invalid product rewrites that have other category ids - * - * Notice: this routine is not identical to clearCategoryProduct(), because after checking all categories - * this one removes rewrites for product still contained within categories. - * - * @param int $productId Product entity Id - * @param int $storeId Store Id for rewrites - * @param array $excludeCategoryIds Array of category Ids that should be skipped - * @return $this - */ - public function clearProductRewrites($productId, $storeId, $excludeCategoryIds = array()) - { - $where = array('product_id = ?' => $productId, 'store_id = ?' => $storeId); - - if (!empty($excludeCategoryIds)) { - $where['category_id NOT IN (?)'] = $excludeCategoryIds; - // If there's at least one category to skip, also skip root category, because product belongs to website - $where[] = 'category_id IS NOT NULL'; - } - - $this->_getWriteAdapter()->delete($this->getMainTable(), $where); - - return $this; - } - - /** - * Finds and deletes all old category and category/product rewrites for store - * left from the times when categories/products belonged to store - * - * @param int $storeId - * @return $this - */ - public function clearStoreCategoriesInvalidRewrites($storeId) - { - // Form a list of all current store categories ids - $store = $this->getStores($storeId); - $rootCategoryId = $store->getRootCategoryId(); - if (!$rootCategoryId) { - return $this; - } - $categoryIds = $this->getRootChildrenIds($rootCategoryId, $store->getRootCategoryPath()); - - // Remove all store catalog rewrites that are for some category or cartegory/product not within store categories - $where = array( - 'store_id = ?' => $storeId, - 'category_id IS NOT NULL', // For sure check that it's a catalog rewrite - 'category_id NOT IN (?)' => $categoryIds - ); - - $this->_getWriteAdapter()->delete($this->getMainTable(), $where); - - return $this; - } - - /** - * Finds and deletes product rewrites (that are not assigned to any category) for store - * left from the times when product was assigned to this store's website and now is not assigned - * - * Notice: this routine is different from clearProductRewrites() and clearCategoryProduct() because - * it handles direct rewrites to product without defined category (category_id IS NULL) whilst that routines - * handle only product rewrites within categories - * - * @param int $storeId - * @param int|array|null $productId - * @return $this - */ - public function clearStoreProductsInvalidRewrites($storeId, $productId = null) - { - $store = $this->getStores($storeId); - $adapter = $this->_getReadAdapter(); - $bind = array('website_id' => (int)$store->getWebsiteId(), 'store_id' => (int)$storeId); - $select = $adapter->select()->from( - array('rewrite' => $this->getMainTable()), - $this->getIdFieldName() - )->joinLeft( - array('website' => $this->getTable('catalog_product_website')), - 'rewrite.product_id = website.product_id AND website.website_id = :website_id', - array() - )->where( - 'rewrite.store_id = :store_id' - )->where( - 'rewrite.category_id IS NULL' - ); - if ($productId) { - $select->where('rewrite.product_id IN (?)', $productId); - } else { - $select->where('rewrite.product_id IS NOT NULL'); - } - $select->where('website.website_id IS NULL'); - - $rewriteIds = $adapter->fetchCol($select, $bind); - if ($rewriteIds) { - $where = array($this->getIdFieldName() . ' IN(?)' => $rewriteIds); - $this->_getWriteAdapter()->delete($this->getMainTable(), $where); - } - - return $this; - } - - /** - * Clear store invalid rewrites - * - * Finds and deletes old rewrites for store - * a) category rewrites left from the times when store had some other root category - * b) product rewrites left from products that once belonged to this site, but then deleted or just removed from website - * - * @param int $storeId - * @return $this - */ - public function clearStoreInvalidRewrites($storeId) - { - $this->clearStoreCategoriesInvalidRewrites($storeId); - $this->clearStoreProductsInvalidRewrites($storeId); - return $this; - } - - /** - * Delete rewrites for associated to category products - * - * @param int $categoryId - * @param array|int|null $productIds - * @return $this - */ - public function deleteCategoryProductRewrites($categoryId, $productIds) - { - $this->deleteCategoryProductStoreRewrites($categoryId, $productIds); - return $this; - } - - /** - * Delete URL rewrites for category products of specific store - * - * @param int $categoryId - * @param array|int|null $productIds - * @param null|int $storeId - * @return $this - */ - public function deleteCategoryProductStoreRewrites($categoryId, $productIds = null, $storeId = null) - { - // Notice that we don't include category_id = NULL in case of root category, - // because product removed from all categories but assigned to store's website is still - // assumed to be in root cat. Unassigned products must be removed by other routine. - $condition = array('category_id = ?' => $categoryId); - if (empty($productIds)) { - $condition[] = 'product_id IS NOT NULL'; - } else { - $condition['product_id IN (?)'] = $productIds; - } - - if ($storeId !== null) { - $condition['store_id IN(?)'] = $storeId; - } - - $this->_getWriteAdapter()->delete($this->getMainTable(), $condition); - return $this; - } - /** * Get rewrite by product store * @@ -1399,9 +651,14 @@ public function getRewriteByProductStore(array $products) array('i' => $this->getTable('catalog_category_product_index')), array('product_id', 'store_id', 'visibility') )->joinLeft( - array('r' => $this->getMainTable()), - 'i.product_id = r.product_id AND i.store_id=r.store_id AND r.category_id IS NULL', + array('u' => $this->getMainTable()), + 'i.product_id = u.entity_id AND i.store_id = u.store_id' + . ' AND u.entity_type = "' . ProductUrlRewriteGenerator::ENTITY_TYPE . '"', array('request_path') + )->joinLeft( + array('r' => $this->getTable('catalog_url_rewrite_product_category')), + 'u.url_rewrite_id = r.url_rewrite_id AND r.category_id is NULL', + array() ); $bind = array(); @@ -1431,74 +688,4 @@ public function getRewriteByProductStore(array $products) return $result; } - - /** - * Find and return final id path by request path - * Needed for permanent redirect old URLs. - * - * @param string $requestPath - * @param int $storeId - * @param array &$_checkedPaths internal variable to prevent infinite loops. - * @return string|bool - */ - public function findFinalTargetPath($requestPath, $storeId, &$_checkedPaths = array()) - { - if (in_array($requestPath, $_checkedPaths)) { - return false; - } - - $_checkedPaths[] = $requestPath; - - $select = $this->_getWriteAdapter()->select()->from( - $this->getMainTable(), - array('target_path', 'id_path') - )->where( - 'store_id = ?', - $storeId - )->where( - 'request_path = ?', - $requestPath - ); - - $row = $this->_getWriteAdapter()->fetchRow($select); - if ($row) { - $idPath = $this->findFinalTargetPath($row['target_path'], $storeId, $_checkedPaths); - if (!$idPath) { - return $row['id_path']; - } else { - return $idPath; - } - } - - return false; - } - - /** - * Delete rewrite path record from the database. - * - * @param string $requestPath - * @param int $storeId - * @return void - */ - public function deleteRewrite($requestPath, $storeId) - { - $this->deleteRewriteRecord($requestPath, $storeId); - } - - /** - * Delete rewrite path record from the database with RP checking. - * - * @param string $requestPath - * @param int $storeId - * @param bool $rp whether check rewrite option to be "Redirect = Permanent" - * @return void - */ - public function deleteRewriteRecord($requestPath, $storeId, $rp = false) - { - $conditions = array('store_id = ?' => $storeId, 'request_path = ?' => $requestPath); - if ($rp) { - $conditions['options = ?'] = 'RP'; - } - $this->_getWriteAdapter()->delete($this->getMainTable(), $conditions); - } } diff --git a/app/code/Magento/Catalog/Model/Rss/Category.php b/app/code/Magento/Catalog/Model/Rss/Category.php new file mode 100644 index 0000000000000..9a7f34bbadfdd --- /dev/null +++ b/app/code/Magento/Catalog/Model/Rss/Category.php @@ -0,0 +1,96 @@ +catalogLayer = $catalogLayer; + $this->collectionFactory = $collectionFactory; + $this->visibility = $visibility; + } + + + /** + * @param \Magento\Catalog\Model\Category $category + * @param int $storeId + * @return $this + */ + public function getProductCollection(\Magento\Catalog\Model\Category $category, $storeId) + { + /** @var $layer \Magento\Catalog\Model\Layer */ + $layer = $this->catalogLayer->setStore($storeId); + $collection = $category->getResourceCollection(); + $collection->addAttributeToSelect('url_key') + ->addAttributeToSelect('name') + ->addAttributeToSelect('is_anchor') + ->addAttributeToFilter('is_active', 1) + ->addIdFilter($category->getChildren()) + ->load(); + /** @var $productCollection \Magento\Catalog\Model\Resource\Product\Collection */ + $productCollection = $this->collectionFactory->create(); + + $currentCategory = $layer->setCurrentCategory($category); + $layer->prepareProductCollection($productCollection); + $productCollection->addCountToCategories($collection); + + $category->getProductCollection()->setStoreId($storeId); + + $products = $currentCategory->getProductCollection() + ->addAttributeToSort('updated_at', 'desc') + ->setVisibility($this->visibility->getVisibleInCatalogIds()) + ->setCurPage(1) + ->setPageSize(50); + + return $products; + } +} diff --git a/app/code/Magento/Catalog/Model/Rss/Product/NewProducts.php b/app/code/Magento/Catalog/Model/Rss/Product/NewProducts.php new file mode 100644 index 0000000000000..b0b1c27cf52f3 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Rss/Product/NewProducts.php @@ -0,0 +1,119 @@ +productFactory = $productFactory; + $this->visibility = $visibility; + $this->localeDate = $localeDate; + } + + + /** + * @param int $storeId + * @return \Magento\Catalog\Model\Resource\Product\Collection + */ + public function getProductsCollection($storeId) + { + /** @var $product \Magento\Catalog\Model\Product */ + $product = $this->productFactory->create(); + $todayStartOfDayDate = $this->localeDate->date()->setTime('00:00:00') + ->toString(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); + + $todayEndOfDayDate = $this->localeDate->date()->setTime('23:59:59') + ->toString(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); + /** @var $products \Magento\Catalog\Model\Resource\Product\Collection */ + $products = $product->getResourceCollection(); + $products->setStoreId($storeId); + $products->addStoreFilter()->addAttributeToFilter( + 'news_from_date', + array( + 'or' => array( + 0 => array('date' => true, 'to' => $todayEndOfDayDate), + 1 => array('is' => new \Zend_Db_Expr('null')) + ) + ), + 'left' + )->addAttributeToFilter( + 'news_to_date', + array( + 'or' => array( + 0 => array('date' => true, 'from' => $todayStartOfDayDate), + 1 => array('is' => new \Zend_Db_Expr('null')) + ) + ), + 'left' + )->addAttributeToFilter(array( + array('attribute' => 'news_from_date', 'is' => new \Zend_Db_Expr('not null')), + array('attribute' => 'news_to_date', 'is' => new \Zend_Db_Expr('not null')) + ))->addAttributeToSort('news_from_date', 'desc') + ->addAttributeToSelect(array('name', 'short_description', 'description'), 'inner') + ->addAttributeToSelect( + array( + 'price', + 'special_price', + 'special_from_date', + 'special_to_date', + 'msrp_enabled', + 'msrp_display_actual_price_type', + 'msrp', + 'thumbnail' + ), + 'left' + )->applyFrontendPriceLimitations(); + $products->setVisibility($this->visibility->getVisibleInCatalogIds()); + + return $products; + } +} diff --git a/app/code/Magento/Catalog/Model/Rss/Product/NotifyStock.php b/app/code/Magento/Catalog/Model/Rss/Product/NotifyStock.php new file mode 100644 index 0000000000000..5f5bb0f4bac50 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Rss/Product/NotifyStock.php @@ -0,0 +1,98 @@ +productFactory = $productFactory; + $this->stockFactory = $stockFactory; + $this->productStatus = $productStatus; + $this->eventManager = $eventManager; + } + + + /** + * @return \Magento\Catalog\Model\Resource\Product\Collection + */ + public function getProductsCollection() + { + /* @var $product \Magento\Catalog\Model\Product */ + $product = $this->productFactory->create(); + /* @var $collection \Magento\Catalog\Model\Resource\Product\Collection */ + $collection = $product->getCollection(); + /** @var $resourceStock \Magento\CatalogInventory\Model\Resource\Stock */ + $resourceStock = $this->stockFactory->create(); + $resourceStock->addLowStockFilter( + $collection, + array('qty', 'notify_stock_qty', 'low_stock_date', 'use_config' => 'use_config_notify_stock_qty') + ); + $collection->addAttributeToSelect('name', true) + ->addAttributeToFilter('status', array('in' => $this->productStatus->getVisibleStatusIds())) + ->setOrder('low_stock_date'); + + $this->eventManager->dispatch( + 'rss_catalog_notify_stock_collection_select', + array('collection' => $collection) + ); + return $collection; + } +} diff --git a/app/code/Magento/Catalog/Model/Rss/Product/Special.php b/app/code/Magento/Catalog/Model/Rss/Product/Special.php new file mode 100644 index 0000000000000..dd823ae3e0ed2 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Rss/Product/Special.php @@ -0,0 +1,89 @@ +productFactory = $productFactory; + $this->storeManager = $storeManager; + } + + + /** + * @param int $storeId + * @param int $customerGroupId + * @return \Magento\Catalog\Model\Resource\Product\Collection + */ + public function getProductsCollection($storeId, $customerGroupId) + { + $websiteId = $this->storeManager->getStore($storeId)->getWebsiteId(); + + /** @var $product \Magento\Catalog\Model\Product */ + $product = $this->productFactory->create(); + $product->setStoreId($storeId); + + $collection = $product->getResourceCollection() + ->addPriceDataFieldFilter('%s < %s', array('final_price', 'price')) + ->addPriceData($customerGroupId, $websiteId) + ->addAttributeToSelect( + array( + 'name', + 'short_description', + 'description', + 'price', + 'thumbnail', + 'special_price', + 'special_to_date', + 'msrp_enabled', + 'msrp_display_actual_price_type', + 'msrp' + ), + 'left' + )->addAttributeToSort('name', 'asc'); + + return $collection; + } +} diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index a76d76197dc19..a86383cc8cffc 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -27,35 +27,58 @@ */ namespace Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite; +use Magento\Framework\App\Resource; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; +use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator; +use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator; +use Magento\UrlRewrite\Model\Storage\DbStorage; +use Magento\Store\Model\ScopeInterface; + class Suffix extends \Magento\Framework\App\Config\Value { - /** - * Core url rewrite - * - * @var \Magento\UrlRewrite\Helper\UrlRewrite - */ - protected $_coreUrlRewrite = null; + /** @var \Magento\UrlRewrite\Helper\UrlRewrite */ + protected $urlRewriteHelper; + + /** @var \Magento\Framework\StoreManagerInterface */ + protected $storeManager; + + /** @var \Magento\UrlRewrite\Model\UrlFinderInterface */ + protected $urlFinder; + + /** @var \Magento\Framework\DB\Adapter\AdapterInterface */ + protected $connection; /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param \Magento\UrlRewrite\Helper\UrlRewrite $coreUrlRewrite * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection + * @param \Magento\UrlRewrite\Helper\UrlRewrite $urlRewriteHelper + * @param \Magento\Framework\StoreManagerInterface $storeManager + * @param \Magento\Framework\App\Resource $appResource + * @param \Magento\UrlRewrite\Model\UrlFinderInterface $urlFinder * @param array $data */ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Config\ScopeConfigInterface $config, - \Magento\UrlRewrite\Helper\UrlRewrite $coreUrlRewrite, + \Magento\UrlRewrite\Helper\UrlRewrite $urlRewriteHelper, + \Magento\Framework\StoreManagerInterface $storeManager, + \Magento\Framework\App\Resource $appResource, + \Magento\UrlRewrite\Model\UrlFinderInterface $urlFinder, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreUrlRewrite = $coreUrlRewrite; parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); + $this->urlRewriteHelper = $urlRewriteHelper; + $this->connection = $appResource->getConnection(Resource::DEFAULT_WRITE_RESOURCE); + $this->urlFinder = $urlFinder; + $this->storeManager = $storeManager; } /** @@ -65,7 +88,87 @@ public function __construct( */ protected function _beforeSave() { - $this->_coreUrlRewrite->validateSuffix($this->getValue()); + $this->urlRewriteHelper->validateSuffix($this->getValue()); return $this; } + + /** + * @return $this + */ + protected function _afterSave() + { + if ($this->isValueChanged()) { + $this->updateSuffixForUrlRewrites(); + } + return parent::_afterSave(); + } + + /** + * Update suffix for url rewrites + * + * @return $this + */ + protected function updateSuffixForUrlRewrites() + { + $map = [ + ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX => ProductUrlRewriteGenerator::ENTITY_TYPE, + CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX => CategoryUrlRewriteGenerator::ENTITY_TYPE + ]; + if (!isset($map[$this->getPath()])) { + return $this; + } + $dataFilter = [UrlRewrite::ENTITY_TYPE => $map[$this->getPath()]]; + $storesIds = $this->getStoreIds(); + if ($storesIds) { + $dataFilter[UrlRewrite::STORE_ID] = $storesIds; + } + $entities = $this->urlFinder->findAllByData($dataFilter); + $oldSuffixPattern = '~' . preg_quote($this->getOldValue()). '$~'; + $suffix = $this->getValue(); + foreach ($entities as $urlRewrite) { + $bind = $urlRewrite->getIsAutogenerated() + ? [UrlRewrite::REQUEST_PATH => preg_replace($oldSuffixPattern, $suffix, $urlRewrite->getRequestPath())] + : [UrlRewrite::TARGET_PATH => preg_replace($oldSuffixPattern, $suffix, $urlRewrite->getTargetPath())]; + $this->connection->update( + DbStorage::TABLE_NAME, + $bind, + $this->connection->quoteIdentifier(UrlRewrite::URL_REWRITE_ID) . ' = ' . $urlRewrite->getUrlRewriteId() + ); + } + return $this; + } + + /** + * @return array|null + */ + protected function getStoreIds() + { + if ($this->getScope() == 'stores') { + $storeIds = [$this->getScopeId()]; + } elseif ($this->getScope() == 'websites') { + $website = $this->storeManager->getWebsite($this->getScopeId()); + $storeIds = array_keys($website->getStoreIds()); + $storeIds = array_diff($storeIds, $this->getOverrideStoreIds($storeIds)); + } else { + $storeIds = array_keys($this->storeManager->getStores()); + $storeIds = array_diff($storeIds, $this->getOverrideStoreIds($storeIds)); + } + return $storeIds; + } + + /** + * @param array $storeIds + * @return array + */ + protected function getOverrideStoreIds($storeIds) + { + $excludeIds = []; + foreach ($storeIds as $storeId) { + $suffix = $this->_config->getValue($this->getPath(), ScopeInterface::SCOPE_STORE, $storeId); + if ($suffix != $this->getOldValue()) { + $excludeIds[] = $storeId; + } + } + return $excludeIds; + } } diff --git a/app/code/Magento/Catalog/Model/Url.php b/app/code/Magento/Catalog/Model/Url.php deleted file mode 100644 index fbd489bce8245..0000000000000 --- a/app/code/Magento/Catalog/Model/Url.php +++ /dev/null @@ -1,1045 +0,0 @@ - - */ -namespace Magento\Catalog\Model; - -class Url -{ - /** - * Number of characters allowed to be in URL path - * - * @var int - */ - const MAX_REQUEST_PATH_LENGTH = 240; - - /** - * Number of characters allowed to be in URL path - * after MAX_REQUEST_PATH_LENGTH number of characters - * - * @var int - */ - const ALLOWED_REQUEST_PATH_OVERFLOW = 10; - - /** - * Resource model - * - * @var \Magento\Catalog\Model\Resource\Url - */ - protected $_resourceModel; - - /** - * Categories cache for products - * - * @var array - */ - protected $_categories = array(); - - /** - * Store root categories cache - * - * @var array - */ - protected $_rootCategories = array(); - - /** - * Rewrite cache - * - * @var array - */ - protected $_rewrites = array(); - - /** - * Current url rewrite rule - * - * @var \Magento\Framework\Object - */ - protected $_rewrite; - - /** - * Cache for product rewrite suffix - * - * @var array - */ - protected $_productUrlSuffix = array(); - - /** - * Cache for category rewrite suffix - * - * @var array - */ - protected $_categoryUrlSuffix = array(); - - /** - * Flag to overwrite config settings for Catalog URL rewrites history maintainance - * - * @var bool - */ - protected $_saveRewritesHistory = null; - - /** - * Singleton of category model for building URL path - * - * @var \Magento\Catalog\Model\Category - */ - protected static $_categoryForUrlPath; - - /** - * Catalog data - * - * @var \Magento\Catalog\Helper\Data - */ - protected $_catalogData = null; - - /** - * Catalog product - * - * @var \Magento\Catalog\Helper\Product - */ - protected $_catalogProduct = null; - - /** - * Catalog category - * - * @var \Magento\Catalog\Helper\Category - */ - protected $_catalogCategory = null; - - /** - * Category factory - * - * @var \Magento\Catalog\Model\CategoryFactory - */ - protected $_categoryFactory; - - /** - * Url factory - * - * @var \Magento\Catalog\Model\Resource\UrlFactory - */ - protected $_urlFactory; - - /** - * @var \Magento\Catalog\Model\Product\Url - */ - protected $productUrl; - - /** - * @param Resource\UrlFactory $urlFactory - * @param CategoryFactory $categoryFactory - * @param \Magento\Catalog\Helper\Category $catalogCategory - * @param \Magento\Catalog\Helper\Product $catalogProduct - * @param \Magento\Catalog\Helper\Data $catalogData - * @param Product\Url $productUrl - */ - public function __construct( - \Magento\Catalog\Model\Resource\UrlFactory $urlFactory, - \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Catalog\Helper\Category $catalogCategory, - \Magento\Catalog\Helper\Product $catalogProduct, - \Magento\Catalog\Helper\Data $catalogData, - Product\Url $productUrl - ) { - $this->_urlFactory = $urlFactory; - $this->_categoryFactory = $categoryFactory; - $this->_catalogCategory = $catalogCategory; - $this->_catalogProduct = $catalogProduct; - $this->_catalogData = $catalogData; - $this->productUrl = $productUrl; - } - - /** - * Adds url_path property for non-root category - to ensure that url path is not empty. - * - * Sometimes attribute 'url_path' can be empty, because url_path hasn't been generated yet, - * in this case category is loaded with empty url_path and we should generate it manually. - * - * @param \Magento\Framework\Object $category - * @return void - */ - protected function _addCategoryUrlPath($category) - { - if (!$category instanceof \Magento\Framework\Object || $category->getUrlPath()) { - return; - } - - // This routine is not intended to be used with root categories, - // but handle 'em gracefully - ensure them to have empty path. - if ($category->getLevel() <= 1) { - $category->setUrlPath(''); - return; - } - - if (self::$_categoryForUrlPath === null) { - self::$_categoryForUrlPath = $this->_categoryFactory->create(); - } - - // Generate url_path - $urlPath = self::$_categoryForUrlPath->setData($category->getData())->getUrlPath(); - $category->setUrlPath($urlPath); - } - - /** - * Retrieve stores array or store model - * - * @param int $storeId - * @return \Magento\Store\Model\Store|\Magento\Store\Model\Store[] - */ - public function getStores($storeId = null) - { - return $this->getResource()->getStores($storeId); - } - - /** - * Retrieve resource model - * - * @return \Magento\Catalog\Model\Resource\Url - */ - public function getResource() - { - if (is_null($this->_resourceModel)) { - $this->_resourceModel = $this->_urlFactory->create(); - } - return $this->_resourceModel; - } - - /** - * Retrieve Category model singleton - * - * @return \Magento\Catalog\Model\Category - */ - public function getCategoryModel() - { - return $this->getResource()->getCategoryModel(); - } - - /** - * Returns store root category, uses caching for it - * - * @param int $storeId - * @return \Magento\Framework\Object - */ - public function getStoreRootCategory($storeId) - { - if (!array_key_exists($storeId, $this->_rootCategories)) { - $category = null; - $store = $this->getStores($storeId); - if ($store) { - $rootCategoryId = $store->getRootCategoryId(); - $category = $this->getResource()->getCategory($rootCategoryId, $storeId); - } - $this->_rootCategories[$storeId] = $category; - } - return $this->_rootCategories[$storeId]; - } - - /** - * Setter for $_saveRewritesHistory - * Force Rewrites History save bypass config settings - * - * @param bool $flag - * @return $this - */ - public function setShouldSaveRewritesHistory($flag) - { - $this->_saveRewritesHistory = (bool)$flag; - return $this; - } - - /** - * Indicate whether to save URL Rewrite History or not (create redirects to old URLs) - * - * @param int $storeId Store View - * @return bool - */ - public function getShouldSaveRewritesHistory($storeId = null) - { - if ($this->_saveRewritesHistory !== null) { - return $this->_saveRewritesHistory; - } - return $this->_catalogData->shouldSaveUrlRewritesHistory($storeId); - } - - /** - * Refresh all rewrite urls for some store or for all stores - * Used to make full reindexing of url rewrites - * - * @param int $storeId - * @return $this - */ - public function refreshRewrites($storeId = null) - { - if (is_null($storeId)) { - foreach ($this->getStores() as $store) { - $this->refreshRewrites($store->getId()); - } - return $this; - } - - $this->clearStoreInvalidRewrites($storeId); - $this->refreshCategoryRewrite($this->getStores($storeId)->getRootCategoryId(), $storeId, false, false); - $this->refreshProductRewrites($storeId); - $this->getResource()->clearCategoryProduct($storeId); - - return $this; - } - - /** - * Refresh category rewrite - * - * @param \Magento\Framework\Object $category - * @param string $parentPath - * @param bool $refreshProducts - * @param bool $changeRequestPath - * @return $this - */ - protected function _refreshCategoryRewrites( - \Magento\Framework\Object $category, - $parentPath = null, - $refreshProducts = true, - $changeRequestPath = false - ) { - if ($category->getId() != $this->getStores($category->getStoreId())->getRootCategoryId()) { - if ($category->getUrlKey() == '') { - $urlKey = $this->getCategoryModel()->formatUrlKey($category->getName()); - } else { - $urlKey = $this->getCategoryModel()->formatUrlKey($category->getUrlKey()); - } - - $idPath = $this->generatePath('id', null, $category); - $targetPath = $this->generatePath('target', null, $category); - $requestPath = $this->getCategoryRequestPath($category, $parentPath, $changeRequestPath); - - $rewriteData = array( - 'store_id' => $category->getStoreId(), - 'category_id' => $category->getId(), - 'product_id' => null, - 'id_path' => $idPath, - 'request_path' => $requestPath, - 'target_path' => $targetPath, - 'is_system' => 1 - ); - - $this->getResource()->saveRewrite($rewriteData, $this->_rewrite); - - if ($this->getShouldSaveRewritesHistory($category->getStoreId())) { - $this->_saveRewriteHistory($rewriteData, $this->_rewrite); - } - - if ($category->getUrlKey() != $urlKey) { - $category->setUrlKey($urlKey); - $this->getResource()->saveCategoryAttribute($category, 'url_key'); - } - if ($category->getUrlPath() != $requestPath) { - $category->setUrlPath($requestPath); - $this->getResource()->saveCategoryAttribute($category, 'url_path'); - } - } else { - if ($category->getUrlPath() != '') { - $category->setUrlPath(''); - $this->getResource()->saveCategoryAttribute($category, 'url_path'); - } - } - - if ($refreshProducts) { - $this->_refreshCategoryProductRewrites($category); - } - - foreach ($category->getChilds() as $child) { - $this->_refreshCategoryRewrites( - $child, - $category->getUrlPath() . '/', - $refreshProducts, - $changeRequestPath - ); - } - - return $this; - } - - /** - * Refresh product rewrite - * - * @param \Magento\Framework\Object $product - * @param \Magento\Framework\Object $category - * @return $this - */ - protected function _refreshProductRewrite(\Magento\Framework\Object $product, \Magento\Framework\Object $category) - { - if ($category->getId() == $category->getPath()) { - return $this; - } - if ($product->getUrlKey() == '') { - $urlKey = $this->productUrl->formatUrlKey($product->getName()); - } else { - $urlKey = $this->productUrl->formatUrlKey($product->getUrlKey()); - } - - $idPath = $this->generatePath('id', $product, $category); - $targetPath = $this->generatePath('target', $product, $category); - $requestPath = $this->getProductRequestPath($product, $category); - - $categoryId = null; - $updateKeys = true; - if ($category->getLevel() > 1) { - $categoryId = $category->getId(); - $updateKeys = false; - } - - $rewriteData = array( - 'store_id' => $category->getStoreId(), - 'category_id' => $categoryId, - 'product_id' => $product->getId(), - 'id_path' => $idPath, - 'request_path' => $requestPath, - 'target_path' => $targetPath, - 'is_system' => 1 - ); - - $this->getResource()->saveRewrite($rewriteData, $this->_rewrite); - - if ($this->getShouldSaveRewritesHistory($category->getStoreId())) { - $this->_saveRewriteHistory($rewriteData, $this->_rewrite); - } - - if ($updateKeys && $product->getUrlKey() != $urlKey) { - $product->setUrlKey($urlKey); - $this->getResource()->saveProductAttribute($product, 'url_key'); - } - if ($updateKeys && $product->getUrlPath() != $requestPath) { - $product->setUrlPath($requestPath); - $this->getResource()->saveProductAttribute($product, 'url_path'); - } - - return $this; - } - - /** - * Refresh products for category - * - * @param \Magento\Framework\Object $category - * @return $this - */ - protected function _refreshCategoryProductRewrites(\Magento\Framework\Object $category) - { - $originalRewrites = $this->_rewrites; - $process = true; - $lastEntityId = 0; - $firstIteration = true; - while ($process == true) { - $products = $this->getResource()->getProductsByCategory($category, $lastEntityId); - if (!$products) { - if ($firstIteration) { - $this->getResource()->deleteCategoryProductStoreRewrites( - $category->getId(), - array(), - $category->getStoreId() - ); - } - $process = false; - break; - } - - // Prepare rewrites for generation - $rootCategory = $this->getStoreRootCategory($category->getStoreId()); - $categoryIds = array($category->getId(), $rootCategory->getId()); - $this->_rewrites = $this->getResource()->prepareRewrites( - $category->getStoreId(), - $categoryIds, - array_keys($products) - ); - - foreach ($products as $product) { - // Product always must have rewrite in root category - $this->_refreshProductRewrite($product, $rootCategory); - $this->_refreshProductRewrite($product, $category); - } - $firstIteration = false; - unset($products); - } - $this->_rewrites = $originalRewrites; - return $this; - } - - /** - * Refresh category and children rewrites - * Called when reindexing all rewrites and as a reaction on category change that affects rewrites - * - * @param int $categoryId - * @param int|null $storeId - * @param bool $refreshProducts - * @param bool $changeRequestPath - * @return $this - */ - public function refreshCategoryRewrite( - $categoryId, - $storeId = null, - $refreshProducts = true, - $changeRequestPath = false - ) { - if (is_null($storeId)) { - foreach ($this->getStores() as $store) { - $this->refreshCategoryRewrite($categoryId, $store->getId(), $refreshProducts, $changeRequestPath); - } - return $this; - } - - $category = $this->getResource()->getCategory($categoryId, $storeId); - if (!$category) { - return $this; - } - - // Load all childs and refresh all categories - $category = $this->getResource()->loadCategoryChilds($category); - $categoryIds = array($category->getId()); - if ($category->getAllChilds()) { - $categoryIds = array_merge($categoryIds, array_keys($category->getAllChilds())); - } - $this->_rewrites = $this->getResource()->prepareRewrites($storeId, $categoryIds); - $this->_refreshCategoryRewrites($category, null, $refreshProducts, $changeRequestPath); - - unset($category); - $this->_rewrites = array(); - - return $this; - } - - /** - * Refresh product rewrite urls for one store or all stores - * Called as a reaction on product change that affects rewrites - * - * @param int $productId - * @param int|null $storeId - * @return $this - */ - public function refreshProductRewrite($productId, $storeId = null) - { - if (is_null($storeId)) { - foreach ($this->getStores() as $store) { - $this->refreshProductRewrite($productId, $store->getId()); - } - return $this; - } - - $product = $this->getResource()->getProduct($productId, $storeId); - if ($product) { - $store = $this->getStores($storeId); - $storeRootCategoryId = $store->getRootCategoryId(); - - // List of categories the product is assigned to, filtered by being within the store's categories root - $categories = $this->getResource()->getCategories($product->getCategoryIds(), $storeId); - $this->_rewrites = $this->getResource()->prepareRewrites($storeId, '', $productId); - - // Add rewrites for all needed categories - // If product is assigned to any of store's categories - - // we also should use store root category to create root product url rewrite - if (!isset($categories[$storeRootCategoryId])) { - $categories[$storeRootCategoryId] = $this->getResource()->getCategory($storeRootCategoryId, $storeId); - } - - // Create product url rewrites - foreach ($categories as $category) { - $this->_refreshProductRewrite($product, $category); - } - - // Remove all other product rewrites created earlier for this store - they're invalid now - $excludeCategoryIds = array_keys($categories); - $this->getResource()->clearProductRewrites($productId, $storeId, $excludeCategoryIds); - - unset($categories); - unset($product); - } else { - // Product doesn't belong to this store - clear all its url rewrites including root one - $this->getResource()->clearProductRewrites($productId, $storeId, array()); - } - - return $this; - } - - /** - * Refresh all product rewrites for designated store - * - * @param int $storeId - * @return $this - */ - public function refreshProductRewrites($storeId) - { - $this->_categories = array(); - $storeRootCategoryId = $this->getStores($storeId)->getRootCategoryId(); - $storeRootCategoryPath = $this->getStores($storeId)->getRootCategoryPath(); - $this->_categories[$storeRootCategoryId] = $this->getResource()->getCategory($storeRootCategoryId, $storeId); - - $lastEntityId = 0; - $process = true; - - while ($process == true) { - $products = $this->getResource()->getProductsByStore($storeId, $lastEntityId); - if (!$products) { - $process = false; - break; - } - - $this->_rewrites = $this->getResource()->prepareRewrites($storeId, false, array_keys($products)); - - $loadCategories = array(); - foreach ($products as $product) { - foreach ($product->getCategoryIds() as $categoryId) { - if (!isset($this->_categories[$categoryId])) { - $loadCategories[$categoryId] = $categoryId; - } - } - } - - if ($loadCategories) { - foreach ($this->getResource()->getCategories($loadCategories, $storeId) as $category) { - $this->_categories[$category->getId()] = $category; - } - } - - foreach ($products as $product) { - $this->_refreshProductRewrite($product, $this->_categories[$storeRootCategoryId]); - foreach ($product->getCategoryIds() as $categoryId) { - if ($categoryId != $storeRootCategoryId && isset($this->_categories[$categoryId])) { - if (strpos($this->_categories[$categoryId]['path'], $storeRootCategoryPath . '/') !== 0) { - continue; - } - $this->_refreshProductRewrite($product, $this->_categories[$categoryId]); - } - } - } - - unset($products); - $this->_rewrites = array(); - } - - $this->_categories = array(); - return $this; - } - - /** - * Deletes old rewrites for store, left from the times when store had some other root category - * - * @param int $storeId - * @return $this - */ - public function clearStoreInvalidRewrites($storeId = null) - { - if (is_null($storeId)) { - foreach ($this->getStores() as $store) { - $this->clearStoreInvalidRewrites($store->getId()); - } - return $this; - } - - $this->getResource()->clearStoreInvalidRewrites($storeId); - return $this; - } - - /** - * Get requestPath that was not used yet - * - * Will try to get unique path by adding -1 -2 etc. between url_key and optional url_suffix - * - * @param int $storeId - * @param string $requestPath - * @param string $idPath - * @param string $urlKey - * @return string - */ - public function getUnusedPath($storeId, $requestPath, $idPath, $urlKey) - { - if (strpos($idPath, 'product') !== false) { - $suffix = $this->getProductUrlSuffix($storeId); - } else { - $suffix = $this->getCategoryUrlSuffix($storeId); - } - if (empty($requestPath)) { - $requestPath = '-'; - } elseif ($requestPath == $suffix) { - $requestPath = '-' . $suffix; - } - - /** - * Validate maximum length of request path - */ - if (strlen($requestPath) > self::MAX_REQUEST_PATH_LENGTH + self::ALLOWED_REQUEST_PATH_OVERFLOW) { - $requestPath = substr($requestPath, 0, self::MAX_REQUEST_PATH_LENGTH); - } - - if (isset($this->_rewrites[$idPath])) { - $this->_rewrite = $this->_rewrites[$idPath]; - if ($this->_rewrites[$idPath]->getRequestPath() == $requestPath) { - return $requestPath; - } - } else { - $this->_rewrite = null; - } - - $rewrite = $this->getResource()->getRewriteByRequestPath($requestPath, $storeId); - if ($rewrite && $rewrite->getId()) { - if ($rewrite->getIdPath() == $idPath) { - $this->_rewrite = $rewrite; - return $requestPath; - } - // match request_url {$urlKey}(-12)(.html) pattern - $match = array(); - $suffix = preg_quote($suffix); - $quotedUrlKey = preg_quote($urlKey); - $regularExpression = "#(?P{$quotedUrlKey})(\\-(?P[0-9]+))?(?P{$suffix})?\$#i"; - if (!preg_match($regularExpression, $requestPath, $match)) { - return $this->getUnusedPath($storeId, '-', $idPath, $urlKey); - } - $match['urlKey'] = $match['urlKey'] . '-'; - $match['suffix'] = isset($match['suffix']) ? $match['suffix'] : ''; - - $lastRequestPath = $this->getResource()->getLastUsedRewriteRequestIncrement( - $match['urlKey'], - $match['suffix'], - $storeId - ); - if ($lastRequestPath) { - $match['copyNum'] = $lastRequestPath; - } - return $match['urlKey'] . (isset($match['copyNum']) ? $match['copyNum'] + 1 : '1') . $match['suffix']; - } else { - return $requestPath; - } - } - - /** - * Retrieve product rewrite sufix for store - * - * @param int $storeId - * @return string - */ - public function getProductUrlSuffix($storeId) - { - return $this->_catalogProduct->getProductUrlSuffix($storeId); - } - - /** - * Retrieve category rewrite sufix for store - * - * @param int $storeId - * @return string - */ - public function getCategoryUrlSuffix($storeId) - { - return $this->_catalogCategory->getCategoryUrlSuffix($storeId); - } - - /** - * Get unique category request path - * - * @param \Magento\Framework\Object $category - * @param string $parentPath - * @param bool $changeRequestPath - * @return string - */ - public function getCategoryRequestPath($category, $parentPath, $changeRequestPath = false) - { - $storeId = $category->getStoreId(); - $idPath = $this->generatePath('id', null, $category); - $categoryUrlSuffix = $this->getCategoryUrlSuffix($storeId); - $pathSuffix = '(\-[0-9]+)?'; - if (isset($this->_rewrites[$idPath])) { - $this->_rewrite = $this->_rewrites[$idPath]; - $existingRequestPath = $this->_rewrites[$idPath]->getRequestPath(); - } - - if ($category->getUrlKey() == '') { - $urlKey = $this->getCategoryModel()->formatUrlKey($category->getName()); - } else { - $urlKey = $this->getCategoryModel()->formatUrlKey($category->getUrlKey()); - } - - if (null === $parentPath) { - $parentPath = $this->getResource()->getCategoryParentPath($category); - } elseif ($parentPath == '/') { - $parentPath = ''; - } - $parentPath = $this->_catalogCategory->getCategoryUrlPath($parentPath, true, $storeId); - - $requestPath = $parentPath . $urlKey; - if ($changeRequestPath) { - $pathSuffix = ''; - } - $regexp = '/^' . preg_quote($requestPath, '/') . $pathSuffix . preg_quote($categoryUrlSuffix, '/') . '$/i'; - if (isset($existingRequestPath) && preg_match($regexp, $existingRequestPath)) { - return $existingRequestPath; - } - - $fullPath = $requestPath . $categoryUrlSuffix; - if ($this->_deleteOldTargetPath($fullPath, $idPath, $storeId)) { - return $requestPath; - } - - return $this->getUnusedPath($storeId, $fullPath, $this->generatePath('id', null, $category), $urlKey); - } - - /** - * Check if current generated request path is one of the old paths - * - * @param string $requestPath - * @param string $idPath - * @param int $storeId - * @return bool - */ - protected function _deleteOldTargetPath($requestPath, $idPath, $storeId) - { - $finalOldTargetPath = $this->getResource()->findFinalTargetPath($requestPath, $storeId); - if ($finalOldTargetPath && $finalOldTargetPath == $idPath) { - $this->getResource()->deleteRewriteRecord($requestPath, $storeId, true); - return true; - } - - return false; - } - - /** - * Get unique product request path - * - * @param \Magento\Framework\Object $product - * @param \Magento\Framework\Object $category - * @return string - */ - public function getProductRequestPath($product, $category) - { - if ($product->getUrlKey() == '') { - $urlKey = $this->productUrl->formatUrlKey($product->getName()); - } else { - $urlKey = $this->productUrl->formatUrlKey($product->getUrlKey()); - } - $storeId = $category->getStoreId(); - $suffix = $this->getProductUrlSuffix($storeId); - $idPath = $this->generatePath('id', $product, $category); - /** - * Prepare product base request path - */ - if ($category->getLevel() > 1) { - // To ensure, that category has path either from attribute or generated now - $this->_addCategoryUrlPath($category); - $categoryUrl = $this->_catalogCategory->getCategoryUrlPath($category->getUrlPath(), false, $storeId); - $requestPath = $categoryUrl . '/' . $urlKey; - } else { - $requestPath = $urlKey; - } - - if (strlen($requestPath) > self::MAX_REQUEST_PATH_LENGTH + self::ALLOWED_REQUEST_PATH_OVERFLOW) { - $requestPath = substr($requestPath, 0, self::MAX_REQUEST_PATH_LENGTH); - } - - $this->_rewrite = null; - /** - * Check $requestPath should be unique - */ - if (isset($this->_rewrites[$idPath])) { - $this->_rewrite = $this->_rewrites[$idPath]; - $existingRequestPath = $this->_rewrites[$idPath]->getRequestPath(); - - $regexp = '/^' . preg_quote($requestPath, '/') . '(\-[0-9]+)?' . preg_quote($suffix, '/') . '$/i'; - if (preg_match($regexp, $existingRequestPath)) { - return $existingRequestPath; - } - - $existingRequestPath = preg_replace('/' . preg_quote($suffix, '/') . '$/', '', $existingRequestPath); - /** - * Check if existing request past can be used - */ - if ($product->getUrlKey() == '' && !empty($requestPath) && strpos($existingRequestPath, $requestPath) === 0 - ) { - $existingRequestPath = preg_replace( - '/^' . preg_quote($requestPath, '/') . '/', - '', - $existingRequestPath - ); - if (preg_match('#^-([0-9]+)$#i', $existingRequestPath)) { - return $this->_rewrites[$idPath]->getRequestPath(); - } - } - - $fullPath = $requestPath . $suffix; - if ($this->_deleteOldTargetPath($fullPath, $idPath, $storeId)) { - return $fullPath; - } - } - /** - * Check 2 variants: $requestPath and $requestPath . '-' . $productId - */ - $validatedPath = $this->getResource()->checkRequestPaths( - array($requestPath . $suffix, $requestPath . '-' . $product->getId() . $suffix), - $storeId - ); - - if ($validatedPath) { - return $validatedPath; - } - /** - * Use unique path generator - */ - return $this->getUnusedPath($storeId, $requestPath . $suffix, $idPath, $urlKey); - } - - /** - * Generate either id path, request path or target path for product and/or category - * - * For generating id or system path, either product or category is required - * For generating request path - category is required - * $parentPath used only for generating category path - * - * @param string $type - * @param \Magento\Framework\Object $product - * @param \Magento\Framework\Object $category - * @param string $parentPath - * @return string - * @throws \Magento\Framework\Model\Exception - */ - public function generatePath($type = 'target', $product = null, $category = null, $parentPath = null) - { - if (!$product && !$category) { - throw new \Magento\Framework\Model\Exception(__('Please specify either a category or a product, or both.')); - } - - // generate id_path - if ('id' === $type) { - if (!$product) { - return 'category/' . $category->getId(); - } - if ($category && $category->getLevel() > 1) { - return 'product/' . $product->getId() . '/' . $category->getId(); - } - return 'product/' . $product->getId(); - } - - // generate request_path - if ('request' === $type) { - // for category - if (!$product) { - if ($category->getUrlKey() == '') { - $urlKey = $this->getCategoryModel()->formatUrlKey($category->getName()); - } else { - $urlKey = $this->getCategoryModel()->formatUrlKey($category->getUrlKey()); - } - - $categoryUrlSuffix = $this->getCategoryUrlSuffix($category->getStoreId()); - if (null === $parentPath) { - $parentPath = $this->getResource()->getCategoryParentPath($category); - } elseif ($parentPath == '/') { - $parentPath = ''; - } - $parentPath = $this->_catalogCategory->getCategoryUrlPath($parentPath, true, $category->getStoreId()); - - return $this->getUnusedPath( - $category->getStoreId(), - $parentPath . $urlKey . $categoryUrlSuffix, - $this->generatePath('id', null, $category), - $urlKey - ); - } - - // for product & category - if (!$category) { - throw new \Magento\Framework\Model\Exception( - __('A category object is required for determining the product request path.') - ); - } - - if ($product->getUrlKey() == '') { - $urlKey = $this->productUrl->formatUrlKey($product->getName()); - } else { - $urlKey = $this->productUrl->formatUrlKey($product->getUrlKey()); - } - $productUrlSuffix = $this->getProductUrlSuffix($category->getStoreId()); - if ($category->getLevel() > 1) { - // To ensure, that category has url path either from attribute or generated now - $this->_addCategoryUrlPath($category); - $categoryUrl = $this->_catalogCategory->getCategoryUrlPath( - $category->getUrlPath(), - false, - $category->getStoreId() - ); - return $this->getUnusedPath( - $category->getStoreId(), - $categoryUrl . '/' . $urlKey . $productUrlSuffix, - $this->generatePath('id', $product, $category), - $urlKey - ); - } - - // for product only - return $this->getUnusedPath( - $category->getStoreId(), - $urlKey . $productUrlSuffix, - $this->generatePath('id', $product), - $urlKey - ); - } - - // generate target_path - if (!$product) { - return 'catalog/category/view/id/' . $category->getId(); - } - if ($category && $category->getLevel() > 1) { - return 'catalog/product/view/id/' . $product->getId() . '/category/' . $category->getId(); - } - return 'catalog/product/view/id/' . $product->getId(); - } - - /** - * Return unique string based on the time in microseconds. - * - * @return string - */ - public function generateUniqueIdPath() - { - return str_replace('.', '_', uniqid(\Magento\Framework\Math\Random::getRandomNumber(), true)); - } - - /** - * Create Custom URL Rewrite for old product/category URL after url_key changed - * It will perform permanent redirect from old URL to new URL - * - * @param array $rewriteData New rewrite data - * @param \Magento\Framework\Object $rewrite Rewrite model - * @return $this - */ - protected function _saveRewriteHistory($rewriteData, $rewrite) - { - if ($rewrite instanceof \Magento\Framework\Object && $rewrite->getId()) { - $rewriteData['target_path'] = $rewriteData['request_path']; - $rewriteData['request_path'] = $rewrite->getRequestPath(); - $rewriteData['id_path'] = $this->generateUniqueIdPath(); - $rewriteData['is_system'] = 0; - $rewriteData['options'] = 'RP'; - // Redirect = Permanent - $this->getResource()->saveRewriteHistory($rewriteData); - } - - return $this; - } -} diff --git a/app/code/Magento/Catalog/Pricing/Render.php b/app/code/Magento/Catalog/Pricing/Render.php index 80c7a931d4d83..a1ce65ffab063 100644 --- a/app/code/Magento/Catalog/Pricing/Render.php +++ b/app/code/Magento/Catalog/Pricing/Render.php @@ -35,7 +35,6 @@ * * @method string getPriceRender() * @method string getPriceTypeCode() - * @method string getDisplayMsrpHelpMessage() */ class Render extends Template { diff --git a/app/code/Magento/Catalog/Pricing/Render/ConfiguredPriceBox.php b/app/code/Magento/Catalog/Pricing/Render/ConfiguredPriceBox.php index 4bba39b6d451b..4edb1a3037be1 100644 --- a/app/code/Magento/Catalog/Pricing/Render/ConfiguredPriceBox.php +++ b/app/code/Magento/Catalog/Pricing/Render/ConfiguredPriceBox.php @@ -38,7 +38,7 @@ class ConfiguredPriceBox extends FinalPriceBox */ protected function _prepareLayout() { - /** @var $price \Magento\Bundle\Pricing\Price\ConfiguredPrice */ + /** @var $price \Magento\Catalog\Pricing\Price\ConfiguredPrice */ $price = $this->getPrice(); /** @var $renderBlock \Magento\Catalog\Pricing\Render */ $renderBlock = $this->getRenderBlock(); diff --git a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php index 4941a5bf9744d..a0c10b1f21110 100644 --- a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php +++ b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php @@ -25,7 +25,7 @@ namespace Magento\Catalog\Pricing\Render; use Magento\Framework\Pricing\Render\PriceBox as BasePriceBox; -use Magento\Catalog\Pricing\Price\MsrpPrice; +use Magento\Msrp\Pricing\Price\MsrpPrice; use Magento\Framework\Pricing\Render; use Magento\Catalog\Pricing\Price; @@ -52,8 +52,9 @@ protected function _toHtml() return $this->wrapResult($result); } - //Renders MAP price in case it is enabled - if ($msrpPriceType->canApplyMsrp($this->getSaleableItem())) { + //Renders MSRP in case it is enabled + $product = $this->getSaleableItem(); + if ($msrpPriceType->canApplyMsrp($product) && $msrpPriceType->isMinimalPriceLessMsrp($product)) { /** @var BasePriceBox $msrpBlock */ $msrpBlock = $this->rendererPool->createPriceRender( MsrpPrice::PRICE_CODE, @@ -92,7 +93,7 @@ public function renderAmountMinimal() return $this->renderAmount( $price->getMinimalPrice(), [ - 'display_label' => __('As low as:'), + 'display_label' => __('As low as'), 'price_id' => $id, 'include_container' => false, 'skip_adjustments' => true diff --git a/app/code/Magento/Catalog/Pricing/Render/PriceBox.php b/app/code/Magento/Catalog/Pricing/Render/PriceBox.php index 1909902f18a4a..cd812a098d10e 100644 --- a/app/code/Magento/Catalog/Pricing/Render/PriceBox.php +++ b/app/code/Magento/Catalog/Pricing/Render/PriceBox.php @@ -36,7 +36,6 @@ * * @method string getPriceElementIdPrefix() * @method string getIdSuffix() - * @method string getDisplayMsrpHelpMessage() */ class PriceBox extends PriceBoxRender { diff --git a/app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php b/app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php index e00443d1f8aaa..51f3a20764c6c 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php +++ b/app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php @@ -93,7 +93,6 @@ public function __construct( public function set($productSku, $customerGroupId, \Magento\Catalog\Service\V1\Data\Product\TierPrice $price) { $product = $this->productRepository->get($productSku, true); - $customerGroup = $this->customerGroupService->getGroup($customerGroupId); $tierPrices = $product->getData('tier_price'); $websiteId = 0; @@ -119,7 +118,7 @@ public function set($productSku, $customerGroupId, \Magento\Catalog\Service\V1\D if (!$found) { $mappedCustomerGroupId = 'all' == $customerGroupId ? \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL - : $customerGroup->getId(); + : $this->customerGroupService->getGroup($customerGroupId)->getId(); $tierPrices[] = array( 'cust_group' => $mappedCustomerGroupId, diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index fc9c4e764d0cb..5a75b0a230d2e 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -3,33 +3,33 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-cms": "0.1.0-alpha96", - "magento/module-index": "0.1.0-alpha96", - "magento/module-indexer": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-log": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-widget": "0.1.0-alpha96", - "magento/module-wishlist": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-bundle": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-catalog-rule": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-catalog-search": "0.1.0-alpha96", - "magento/module-product-alert": "0.1.0-alpha96", - "magento/module-url-rewrite": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-cms": "0.1.0-alpha97", + "magento/module-indexer": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-log": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-widget": "0.1.0-alpha97", + "magento/module-wishlist": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-msrp": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-catalog-rule": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-catalog-search": "0.1.0-alpha97", + "magento/module-product-alert": "0.1.0-alpha97", + "magento/module-url-rewrite": "0.1.0-alpha97", + "magento/module-catalog-url-rewrite": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php index 088a9af243891..f8656fc61349e 100644 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php +++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php @@ -94,7 +94,6 @@ ), //Autosettings tab 'short_description' => array($autosettingsTabName => 0, 'is_required' => 0), - 'url_key' => array($autosettingsTabName => 10), 'visibility' => array($autosettingsTabName => 20, 'is_required' => 0), 'news_from_date' => array($autosettingsTabName => 30), 'news_to_date' => array($autosettingsTabName => 40), diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.23-1.6.0.0.24.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.23-1.6.0.0.24.php index faa56ca88e5ec..eaa6c462be4b1 100644 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.23-1.6.0.0.24.php +++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.23-1.6.0.0.24.php @@ -45,20 +45,6 @@ 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Weight' ); -$this->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp_enabled', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Msrp\Enabled' -); - -$this->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp_display_actual_price_type', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Msrp\Price' -); - $this->updateAttribute( \Magento\Catalog\Model\Category::ENTITY, 'available_sort_by', diff --git a/app/code/Magento/Rss/Controller/Index/Nofeed.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.28-1.6.0.0.29.php similarity index 58% rename from app/code/Magento/Rss/Controller/Index/Nofeed.php rename to app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.28-1.6.0.0.29.php index ed76be54cf761..7c64beec9686d 100644 --- a/app/code/Magento/Rss/Controller/Index/Nofeed.php +++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.28-1.6.0.0.29.php @@ -1,6 +1,5 @@ getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); +$attributeSetId = $this->getAttributeSetId($entityTypeId, 'Default'); +$groupId = $this->getAttributeGroupId($entityTypeId, $attributeSetId, $oldTabName); -class Nofeed extends \Magento\Rss\Controller\Index -{ - /** - * Display feed not found message - * - * @return void - */ - public function execute() - { - $this->_rssHelper->sendEmptyRssFeed($this->getResponse()); - } -} +$this->updateAttributeGroup($entityTypeId, $attributeSetId, $groupId, 'attribute_group_name', $newTabName); +$this->updateAttributeGroup( + $entityTypeId, + $attributeSetId, + $groupId, + 'attribute_group_code', + preg_replace('/[^a-z0-9]+/', '-', strtolower($newTabName)) +); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.3-1.6.0.0.4.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.3-1.6.0.0.4.php deleted file mode 100644 index 23be7a821499b..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.3-1.6.0.0.4.php +++ /dev/null @@ -1,54 +0,0 @@ -updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp_enabled', - 'source_model', - 'Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type\Enabled' -); - -$installer->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp_enabled', - 'default_value', - \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type\Enabled::MSRP_ENABLE_USE_CONFIG -); - -$installer->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp_display_actual_price_type', - 'source_model', - 'Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type\Price' -); - -$installer->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp_display_actual_price_type', - 'default_value', - \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type\Price::TYPE_USE_CONFIG -); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.5-1.6.0.0.6.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.5-1.6.0.0.6.php index 18554e203a02c..9e29094ab1cd3 100644 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.5-1.6.0.0.6.php +++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.5-1.6.0.0.6.php @@ -25,10 +25,6 @@ /** @var $installer \Magento\Catalog\Model\Resource\Setup */ $installer = $this; -$installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'url_key', 'frontend_label', 'URL Key'); - -$installer->updateAttribute(\Magento\Catalog\Model\Category::ENTITY, 'url_key', 'frontend_label', 'URL Key'); - $installer->updateAttribute( \Magento\Catalog\Model\Product::ENTITY, 'options_container', diff --git a/app/code/Magento/Catalog/etc/acl.xml b/app/code/Magento/Catalog/etc/acl.xml index d7e1600640987..eaffab7aab3a4 100644 --- a/app/code/Magento/Catalog/etc/acl.xml +++ b/app/code/Magento/Catalog/etc/acl.xml @@ -33,11 +33,6 @@ - - - - - diff --git a/app/code/Magento/Catalog/etc/adminhtml/di.xml b/app/code/Magento/Catalog/etc/adminhtml/di.xml index b838bdd88f295..59df420f65820 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/di.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/di.xml @@ -76,4 +76,11 @@ Magento\Framework\Url
+ + + + Magento\Catalog\Block\Adminhtml\Rss\NotifyStock + + + diff --git a/app/code/Magento/Catalog/etc/adminhtml/menu.xml b/app/code/Magento/Catalog/etc/adminhtml/menu.xml index cd0ab5368305b..f8989dca2f882 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/menu.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/menu.xml @@ -30,7 +30,6 @@ - diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 4d7523f5d0502..8b1997ae9034a 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -115,26 +115,7 @@ - - - - Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix - You need to refresh the cache. - - - - Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix - You need to refresh the cache. - - - - Magento\Backend\Model\Config\Source\Yesno - Magento\Catalog\Model\Config\Backend\Seo\Product - - - - Magento\Backend\Model\Config\Source\Yesno - + @@ -218,29 +199,20 @@ -
- - - - - Magento\Backend\Model\Config\Source\Yesno - - - - Magento\Backend\Model\Config\Source\Yesno - - Warning! Applying MAP by default will hide all product prices on the front end.]]> - - - - - Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type - - - - - - +
+ + + + + Magento\Backend\Model\Config\Source\Enabledisable + + + + Magento\Backend\Model\Config\Source\Enabledisable + + + + Magento\Backend\Model\Config\Source\Enabledisable
diff --git a/app/code/Magento/Catalog/etc/catalog_attributes.xml b/app/code/Magento/Catalog/etc/catalog_attributes.xml index d53e2b3a7984f..cbca919daffa2 100644 --- a/app/code/Magento/Catalog/etc/catalog_attributes.xml +++ b/app/code/Magento/Catalog/etc/catalog_attributes.xml @@ -26,12 +26,10 @@ - - diff --git a/app/code/Magento/Catalog/etc/config.xml b/app/code/Magento/Catalog/etc/config.xml index 7b4d82ae76d24..c469a96d44604 100644 --- a/app/code/Magento/Catalog/etc/config.xml +++ b/app/code/Magento/Catalog/etc/config.xml @@ -74,14 +74,5 @@ - - - 0 - 0 - 1 - Our price is lower than the manufacturer's "minimum advertised price." As a result, we cannot show you the price in catalog or the product page. <br /><br /> You have no obligation to purchase the product once you know the price. You can simply remove the item from your cart. - Our price is lower than the manufacturer's "minimum advertised price." As a result, we cannot show you the price in catalog or the product page. <br /><br /> You have no obligation to purchase the product once you know the price. You can simply remove the item from your cart. - - diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 455ad2b273b08..d330ebfb2fb04 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -104,9 +104,6 @@ special_from_date special_to_date website_ids - msrp - msrp_enabled - msrp_display_actual_price_type gift_wrapping_price tax_class_id @@ -378,7 +375,6 @@ Magento\Catalog\Pricing\Price\TierPrice Magento\Catalog\Pricing\Price\GroupPrice Magento\Catalog\Pricing\Price\SpecialPrice - Magento\Catalog\Pricing\Price\MsrpPrice Magento\Catalog\Pricing\Price\BasePrice Magento\Catalog\Pricing\Price\CustomOptionPrice Magento\Catalog\Pricing\Price\ConfiguredPrice @@ -499,4 +495,15 @@ + + + + + + Magento\Catalog\Block\Rss\Product\NewProducts + Magento\Catalog\Block\Rss\Product\Special + Magento\Catalog\Block\Rss\Category + + + diff --git a/app/code/Magento/Catalog/etc/eav_attributes.xml b/app/code/Magento/Catalog/etc/eav_attributes.xml index 3ed356f546c5a..2f0d490cf1986 100644 --- a/app/code/Magento/Catalog/etc/eav_attributes.xml +++ b/app/code/Magento/Catalog/etc/eav_attributes.xml @@ -29,9 +29,6 @@ - - - diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index 575f1f91c1807..362c7d346faae 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -24,11 +24,10 @@ */ --> - + - @@ -36,7 +35,6 @@ - @@ -47,14 +45,15 @@ - + + diff --git a/app/code/Magento/Catalog/i18n/de_DE.csv b/app/code/Magento/Catalog/i18n/de_DE.csv index afcf15d94d338..5248fb6353e76 100644 --- a/app/code/Magento/Catalog/i18n/de_DE.csv +++ b/app/code/Magento/Catalog/i18n/de_DE.csv @@ -255,7 +255,7 @@ Categories,Kategorien "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management.","Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management." +"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." @@ -341,8 +341,7 @@ Center,Mitte "Bad value was supplied.","Bad value was supplied." "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module","The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module" "Unsupported product type ""%1"".","Unsupported product type ""%1""." -"Catalog URL Rewrites","Umschreibung der Katalog-URL" -"Index product and categories URL Redirects","Index product and categories URL Redirects" +"Index product and categories URL Rewrites","Index product and categories URL Rewrites" "The category must be an instance of \Magento\Catalog\Model\Category.","The category must be an instance of \Magento\Catalog\Model\Category." "Please correct the category.","Please correct the category." "The attribute model is not defined.","The attribute model is not defined." @@ -562,7 +561,7 @@ Comma-separated.,Comma-separated. "Allow Dynamic Media URLs in Products and Categories","Allow Dynamic Media URLs in Products and Categories" "E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance.","E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance." "Product Image Placeholders","Product Image Placeholders" -"Search Engine Optimizations","Search Engine Optimizations" +"Search Engine Optimization","Search Engine Optimization" "Category URL Suffix","Category URL Suffix" "You need to refresh the cache.","You need to refresh the cache." "Product URL Suffix","Product URL Suffix" @@ -589,12 +588,7 @@ Watermark,Watermark "This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.","This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes." "Minimum Advertised Price","Minimum Advertised Price" "Enable MAP","Enable MAP" -"Apply MAP (Default Value)","Apply MAP (Default Value)" -" - Warning! Applying MAP by default will hide all product prices on the front end. - "," - Warning! Applying MAP by default will hide all product prices on the front end. - " +"Warning! Applying MAP by default will hide all product prices on the front end.","Warning! Applying MAP by default will hide all product prices on the front end." "Display Actual Price","Display Actual Price" "Default Popup Text Message","Default Popup Text Message" "Default ""What's This"" Text Message","Default ""What's This"" Text Message" diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index b90461bb4d0bd..5887784287b99 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -255,7 +255,7 @@ Categories,Categories "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management.","Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management." +"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." @@ -340,8 +340,7 @@ Center,Center "Bad value was supplied.","Bad value was supplied." "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module","The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module" "Unsupported product type ""%1"".","Unsupported product type ""%1""." -"Catalog URL Rewrites","Catalog URL Rewrites" -"Index product and categories URL Redirects","Index product and categories URL Redirects" +"Index product and categories URL Rewrites","Index product and categories URL Rewrites" "The category must be an instance of \Magento\Catalog\Model\Category.","The category must be an instance of \Magento\Catalog\Model\Category." "Please correct the category.","Please correct the category." "The attribute model is not defined.","The attribute model is not defined." @@ -562,7 +561,7 @@ Comma-separated.,Comma-separated. "Allow Dynamic Media URLs in Products and Categories","Allow Dynamic Media URLs in Products and Categories" "E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance.","E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance." "Product Image Placeholders","Product Image Placeholders" -"Search Engine Optimizations","Search Engine Optimizations" +"Search Engine Optimization","Search Engine Optimization" "Category URL Suffix","Category URL Suffix" "You need to refresh the cache.","You need to refresh the cache." "Product URL Suffix","Product URL Suffix" @@ -589,12 +588,7 @@ Watermark,Watermark "This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.","This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes." "Minimum Advertised Price","Minimum Advertised Price" "Enable MAP","Enable MAP" -"Apply MAP (Default Value)","Apply MAP (Default Value)" -" - Warning! Applying MAP by default will hide all product prices on the front end. - "," - Warning! Applying MAP by default will hide all product prices on the front end. - " +"Warning! Applying MAP by default will hide all product prices on the front end.","Warning! Applying MAP by default will hide all product prices on the front end." "Display Actual Price","Display Actual Price" "Default Popup Text Message","Default Popup Text Message" "Default ""What's This"" Text Message","Default ""What's This"" Text Message" diff --git a/app/code/Magento/Catalog/i18n/es_ES.csv b/app/code/Magento/Catalog/i18n/es_ES.csv index c7f09578e435e..d86c9b05058a1 100644 --- a/app/code/Magento/Catalog/i18n/es_ES.csv +++ b/app/code/Magento/Catalog/i18n/es_ES.csv @@ -255,7 +255,7 @@ Categories,Categorías "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management.","Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management." +"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." @@ -341,8 +341,7 @@ Center,Centro "Bad value was supplied.","Bad value was supplied." "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module","The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module" "Unsupported product type ""%1"".","Unsupported product type ""%1""." -"Catalog URL Rewrites","Nueva versión de URL de Catálogo" -"Index product and categories URL Redirects","Index product and categories URL Redirects" +"Index product and categories URL Rewrites","Index product and categories URL Rewrites" "The category must be an instance of \Magento\Catalog\Model\Category.","The category must be an instance of \Magento\Catalog\Model\Category." "Please correct the category.","Please correct the category." "The attribute model is not defined.","The attribute model is not defined." @@ -562,7 +561,7 @@ Comma-separated.,Comma-separated. "Allow Dynamic Media URLs in Products and Categories","Allow Dynamic Media URLs in Products and Categories" "E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance.","E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance." "Product Image Placeholders","Product Image Placeholders" -"Search Engine Optimizations","Search Engine Optimizations" +"Search Engine Optimization","Search Engine Optimization" "Category URL Suffix","Category URL Suffix" "You need to refresh the cache.","You need to refresh the cache." "Product URL Suffix","Product URL Suffix" @@ -589,12 +588,7 @@ Watermark,Watermark "This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.","This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes." "Minimum Advertised Price","Minimum Advertised Price" "Enable MAP","Enable MAP" -"Apply MAP (Default Value)","Apply MAP (Default Value)" -" - Warning! Applying MAP by default will hide all product prices on the front end. - "," - Warning! Applying MAP by default will hide all product prices on the front end. - " +"Warning! Applying MAP by default will hide all product prices on the front end.","Warning! Applying MAP by default will hide all product prices on the front end." "Display Actual Price","Display Actual Price" "Default Popup Text Message","Default Popup Text Message" "Default ""What's This"" Text Message","Default ""What's This"" Text Message" diff --git a/app/code/Magento/Catalog/i18n/fr_FR.csv b/app/code/Magento/Catalog/i18n/fr_FR.csv index a066af4b25ec8..4c2595d01bf68 100644 --- a/app/code/Magento/Catalog/i18n/fr_FR.csv +++ b/app/code/Magento/Catalog/i18n/fr_FR.csv @@ -255,7 +255,7 @@ Categories,catégories "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management.","Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management." +"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." @@ -341,8 +341,7 @@ Center,Centrer "Bad value was supplied.","Bad value was supplied." "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module","The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module" "Unsupported product type ""%1"".","Unsupported product type ""%1""." -"Catalog URL Rewrites","Catalogue Réécritures URL" -"Index product and categories URL Redirects","Index product and categories URL Redirects" +"Index product and categories URL Rewrites","Index product and categories URL Rewrites" "The category must be an instance of \Magento\Catalog\Model\Category.","The category must be an instance of \Magento\Catalog\Model\Category." "Please correct the category.","Please correct the category." "The attribute model is not defined.","The attribute model is not defined." @@ -562,7 +561,7 @@ Comma-separated.,Comma-separated. "Allow Dynamic Media URLs in Products and Categories","Allow Dynamic Media URLs in Products and Categories" "E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance.","E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance." "Product Image Placeholders","Product Image Placeholders" -"Search Engine Optimizations","Search Engine Optimizations" +"Search Engine Optimization","Search Engine Optimization" "Category URL Suffix","Category URL Suffix" "You need to refresh the cache.","You need to refresh the cache." "Product URL Suffix","Product URL Suffix" @@ -589,12 +588,7 @@ Watermark,Watermark "This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.","This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes." "Minimum Advertised Price","Minimum Advertised Price" "Enable MAP","Enable MAP" -"Apply MAP (Default Value)","Apply MAP (Default Value)" -" - Warning! Applying MAP by default will hide all product prices on the front end. - "," - Warning! Applying MAP by default will hide all product prices on the front end. - " +"Warning! Applying MAP by default will hide all product prices on the front end.","Warning! Applying MAP by default will hide all product prices on the front end." "Display Actual Price","Display Actual Price" "Default Popup Text Message","Default Popup Text Message" "Default ""What's This"" Text Message","Default ""What's This"" Text Message" diff --git a/app/code/Magento/Catalog/i18n/nl_NL.csv b/app/code/Magento/Catalog/i18n/nl_NL.csv index 06558ec32e287..8a3940a19a4e9 100644 --- a/app/code/Magento/Catalog/i18n/nl_NL.csv +++ b/app/code/Magento/Catalog/i18n/nl_NL.csv @@ -255,7 +255,7 @@ Categories,Categoriën "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management.","Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management." +"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." @@ -341,8 +341,7 @@ Center,Centrum "Bad value was supplied.","Bad value was supplied." "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module","The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module" "Unsupported product type ""%1"".","Unsupported product type ""%1""." -"Catalog URL Rewrites","Catalogus URL Herschrijvingen" -"Index product and categories URL Redirects","Index product and categories URL Redirects" +"Index product and categories URL Rewrites","Index product and categories URL Rewrites" "The category must be an instance of \Magento\Catalog\Model\Category.","The category must be an instance of \Magento\Catalog\Model\Category." "Please correct the category.","Please correct the category." "The attribute model is not defined.","The attribute model is not defined." @@ -562,7 +561,7 @@ Comma-separated.,Comma-separated. "Allow Dynamic Media URLs in Products and Categories","Allow Dynamic Media URLs in Products and Categories" "E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance.","E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance." "Product Image Placeholders","Product Image Placeholders" -"Search Engine Optimizations","Search Engine Optimizations" +"Search Engine Optimization","Search Engine Optimization" "Category URL Suffix","Category URL Suffix" "You need to refresh the cache.","You need to refresh the cache." "Product URL Suffix","Product URL Suffix" @@ -589,12 +588,7 @@ Watermark,Watermark "This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.","This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes." "Minimum Advertised Price","Minimum Advertised Price" "Enable MAP","Enable MAP" -"Apply MAP (Default Value)","Apply MAP (Default Value)" -" - Warning! Applying MAP by default will hide all product prices on the front end. - "," - Warning! Applying MAP by default will hide all product prices on the front end. - " +"Warning! Applying MAP by default will hide all product prices on the front end.","Warning! Applying MAP by default will hide all product prices on the front end." "Display Actual Price","Display Actual Price" "Default Popup Text Message","Default Popup Text Message" "Default ""What's This"" Text Message","Default ""What's This"" Text Message" diff --git a/app/code/Magento/Catalog/i18n/pt_BR.csv b/app/code/Magento/Catalog/i18n/pt_BR.csv index 406868b73d415..5717e8f7b64b1 100644 --- a/app/code/Magento/Catalog/i18n/pt_BR.csv +++ b/app/code/Magento/Catalog/i18n/pt_BR.csv @@ -255,7 +255,7 @@ Categories,Categorias "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management.","Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management." +"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." @@ -341,8 +341,7 @@ Center,Centro "Bad value was supplied.","Bad value was supplied." "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module","The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module" "Unsupported product type ""%1"".","Unsupported product type ""%1""." -"Catalog URL Rewrites","Reedições da URL de Catálogo" -"Index product and categories URL Redirects","Index product and categories URL Redirects" +"Index product and categories URL Rewrites","Index product and categories URL Rewrites" "The category must be an instance of \Magento\Catalog\Model\Category.","The category must be an instance of \Magento\Catalog\Model\Category." "Please correct the category.","Please correct the category." "The attribute model is not defined.","The attribute model is not defined." @@ -562,7 +561,7 @@ Comma-separated.,Comma-separated. "Allow Dynamic Media URLs in Products and Categories","Allow Dynamic Media URLs in Products and Categories" "E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance.","E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance." "Product Image Placeholders","Product Image Placeholders" -"Search Engine Optimizations","Search Engine Optimizations" +"Search Engine Optimization","Search Engine Optimization" "Category URL Suffix","Category URL Suffix" "You need to refresh the cache.","You need to refresh the cache." "Product URL Suffix","Product URL Suffix" @@ -589,12 +588,7 @@ Watermark,Watermark "This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.","This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes." "Minimum Advertised Price","Minimum Advertised Price" "Enable MAP","Enable MAP" -"Apply MAP (Default Value)","Apply MAP (Default Value)" -" - Warning! Applying MAP by default will hide all product prices on the front end. - "," - Warning! Applying MAP by default will hide all product prices on the front end. - " +"Warning! Applying MAP by default will hide all product prices on the front end.","Warning! Applying MAP by default will hide all product prices on the front end." "Display Actual Price","Display Actual Price" "Default Popup Text Message","Default Popup Text Message" "Default ""What's This"" Text Message","Default ""What's This"" Text Message" diff --git a/app/code/Magento/Catalog/i18n/zh_CN.csv b/app/code/Magento/Catalog/i18n/zh_CN.csv index 117d58634971d..9a431375ea5e7 100644 --- a/app/code/Magento/Catalog/i18n/zh_CN.csv +++ b/app/code/Magento/Catalog/i18n/zh_CN.csv @@ -255,7 +255,7 @@ Categories,分类 "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management.","Please refresh ""Catalog URL Rewrites"" and ""Product Attributes"" in System -> ' 'Index Management." +"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." @@ -341,8 +341,7 @@ Center,中心 "Bad value was supplied.","Bad value was supplied." "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module","The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."" ""Currently there are %1\$d of them."" ""Please reduce the number of filterable/sortable attributes in order to use this module" "Unsupported product type ""%1"".","Unsupported product type ""%1""." -"Catalog URL Rewrites",分类URL重写 -"Index product and categories URL Redirects","Index product and categories URL Redirects" +"Index product and categories URL Rewrites","Index product and categories URL Rewrites" "The category must be an instance of \Magento\Catalog\Model\Category.","The category must be an instance of \Magento\Catalog\Model\Category." "Please correct the category.","Please correct the category." "The attribute model is not defined.","The attribute model is not defined." @@ -562,7 +561,7 @@ Comma-separated.,Comma-separated. "Allow Dynamic Media URLs in Products and Categories","Allow Dynamic Media URLs in Products and Categories" "E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance.","E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance." "Product Image Placeholders","Product Image Placeholders" -"Search Engine Optimizations","Search Engine Optimizations" +"Search Engine Optimization","Search Engine Optimization" "Category URL Suffix","Category URL Suffix" "You need to refresh the cache.","You need to refresh the cache." "Product URL Suffix","Product URL Suffix" @@ -589,12 +588,7 @@ Watermark,Watermark "This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.","This applies only to catalog products and categories. Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes." "Minimum Advertised Price","Minimum Advertised Price" "Enable MAP","Enable MAP" -"Apply MAP (Default Value)","Apply MAP (Default Value)" -" - Warning! Applying MAP by default will hide all product prices on the front end. - "," - Warning! Applying MAP by default will hide all product prices on the front end. - " +"Warning! Applying MAP by default will hide all product prices on the front end.","Warning! Applying MAP by default will hide all product prices on the front end." "Display Actual Price","Display Actual Price" "Default Popup Text Message","Default Popup Text Message" "Default ""What's This"" Text Message","Default ""What's This"" Text Message" diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php index 034a5a1721f63..f72a40e876802 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php @@ -3886,42 +3886,4 @@ ); $installer->getConnection()->createTable($table); -/** - * Modify core/url_rewrite table - */ -$installer->getConnection()->addColumn( - $installer->getTable('core_url_rewrite'), - 'category_id', - array( - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 'unsigned' => true, - 'nullable' => true, - 'comment' => 'Category Id' - ) -); -$installer->getConnection()->addColumn( - $installer->getTable('core_url_rewrite'), - 'product_id', - array( - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 'unsigned' => true, - 'nullable' => true, - 'comment' => 'Product Id' - ) -); -$installer->getConnection()->addForeignKey( - $installer->getFkName('core_url_rewrite', 'category_id', 'catalog_category_entity', 'entity_id'), - $installer->getTable('core_url_rewrite'), - 'category_id', - $installer->getTable('catalog_category_entity'), - 'entity_id' -); -$installer->getConnection()->addForeignKey( - $installer->getFkName('core_url_rewrite', 'product_id', 'catalog_category_entity', 'entity_id'), - $installer->getTable('core_url_rewrite'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id' -); - $installer->endSetup(); diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml index 973318d8c404b..9a49726e05342 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml @@ -25,18 +25,10 @@ --> - - - - jquery/fileUploader/css/jquery.fileupload-ui.css - - - - - Magento_Catalog::js/bootstrap/category-edit.js - - - + + + + @@ -60,5 +52,4 @@ - diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml index 081ab5359bc4d..4ee8fbba74586 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml @@ -44,4 +44,9 @@ + + + + + diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml index fffeacc4ff85b..40c23d672cdf7 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml @@ -25,28 +25,12 @@ --> - - - - jquery/fileUploader/css/jquery.fileupload-ui.css - - - - - Magento_Catalog::catalog/category-selector.css - - - - - Magento_Catalog::product/product.css - - - - - Magento_Catalog::js/bootstrap/product-new.js - - - + + + + + + diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml index 350f61365cc31..698ead9021ddc 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml @@ -52,14 +52,92 @@
+
+ +
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view.xml index 08cf14d41fb65..bad8ca2a411e9 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view.xml @@ -94,5 +94,7 @@
- + + +
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_compare_index.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_compare_index.xml index cfec489907935..51fcb22949418 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_compare_index.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_compare_index.xml @@ -32,5 +32,4 @@ - diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml index 5db60cf1e40ff..29b925aff485e 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml @@ -38,13 +38,9 @@ itemscope itemtype="http://schema.org/Product" - - - - mage/gallery.css - - - + + + @@ -63,7 +59,6 @@ product.price.render.default final_price - 1 item_view @@ -71,7 +66,6 @@ product.price.render.default tier_price - 1 item_view @@ -161,6 +155,4 @@ - - diff --git a/app/code/Magento/Catalog/view/frontend/layout/default.xml b/app/code/Magento/Catalog/view/frontend/layout/default.xml index ea388d154c91e..7a3714e07a629 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/default.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/default.xml @@ -30,7 +30,7 @@ - + - + diff --git a/app/code/Magento/Rss/view/frontend/templates/category/link.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml similarity index 82% rename from app/code/Magento/Rss/view/frontend/templates/category/link.phtml rename to app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml index 9ada24d068517..a936c6b469681 100644 --- a/app/code/Magento/Rss/view/frontend/templates/category/link.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml @@ -22,6 +22,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -isRssCatalogEnable() && $this->isTopCategory()): ?> - +isRssAllowed() && $this->getLink() && $this->isTopCategory()): ?> + getLabel() ?> diff --git a/app/code/Magento/Catalog/view/frontend/web/js/price-option.js b/app/code/Magento/Catalog/view/frontend/web/js/price-option.js index 8c2e112336729..4fc47ee220117 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/price-option.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/price-option.js @@ -106,9 +106,12 @@ define([ var skipIds = [], priceSelectors = [ '#product-price-' + this.options.priceConfig.productId, + '#product-price-copy-' + this.options.priceConfig.productId, '#bundle-price-' + this.options.priceConfig.productId, '#price-including-tax-product-price-' + this.options.priceConfig.productId, + '#price-including-tax-product-price-copy-' + this.options.priceConfig.productId, '#price-excluding-tax-product-price-' + this.options.priceConfig.productId, + '#price-excluding-tax-product-price-copy-' + this.options.priceConfig.productId, '#old-price-' + this.options.priceConfig.productId ], getOptionPrices = this._getOptionPrices(), diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json index 225fc03887cf7..4e6aaa07908e2 100644 --- a/app/code/Magento/CatalogImportExport/composer.json +++ b/app/code/Magento/CatalogImportExport/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-core": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-import-export": "0.1.0-alpha96", - "magento/module-indexer": "0.1.0-alpha96", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-core": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-import-export": "0.1.0-alpha97", + "magento/module-indexer": "0.1.0-alpha97", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json index 47e034652f7ed..e377c3bbbe810 100644 --- a/app/code/Magento/CatalogInventory/composer.json +++ b/app/code/Magento/CatalogInventory/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-indexer": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-indexer": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogInventory/etc/di.xml b/app/code/Magento/CatalogInventory/etc/di.xml index 62c8429573b3c..3465c991d4406 100644 --- a/app/code/Magento/CatalogInventory/etc/di.xml +++ b/app/code/Magento/CatalogInventory/etc/di.xml @@ -29,7 +29,6 @@ Magento\CatalogInventory\Model\Resource\Stock\Proxy - Magento\Index\Model\Indexer\Proxy Magento\CatalogInventory\Model\Stock\Proxy Magento\CatalogInventory\Model\Stock\Status\Proxy Magento\CatalogInventory\Helper\Data\Proxy diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php index 2129001314449..9de825124395b 100644 --- a/app/code/Magento/CatalogRule/Model/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Rule.php @@ -124,11 +124,6 @@ class Rule extends \Magento\Rule\Model\AbstractModel */ protected $_resourceIterator; - /** - * @var \Magento\Index\Model\Indexer - */ - protected $_indexer; - /** * @var \Magento\Customer\Model\Session */ @@ -175,7 +170,6 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Framework\Model\Resource\Iterator $resourceIterator - * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\CatalogRule\Helper\Data $catalogRuleData * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypesList @@ -196,7 +190,6 @@ public function __construct( \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Framework\Model\Resource\Iterator $resourceIterator, - \Magento\Index\Model\Indexer $indexer, \Magento\Customer\Model\Session $customerSession, \Magento\CatalogRule\Helper\Data $catalogRuleData, \Magento\Framework\App\Cache\TypeListInterface $cacheTypesList, @@ -212,7 +205,6 @@ public function __construct( $this->_actionCollectionFactory = $actionCollectionFactory; $this->_productFactory = $productFactory; $this->_resourceIterator = $resourceIterator; - $this->_indexer = $indexer; $this->_customerSession = $customerSession; $this->_catalogRuleData = $catalogRuleData; $this->_cacheTypesList = $cacheTypesList; diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json index dae73d4f51700..a6c09e071f118 100644 --- a/app/code/Magento/CatalogRule/composer.json +++ b/app/code/Magento/CatalogRule/composer.json @@ -3,18 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-rule": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-index": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-rule": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogRule/etc/module.xml b/app/code/Magento/CatalogRule/etc/module.xml index da7cd1f9cc130..5fda9f6e40ce4 100644 --- a/app/code/Magento/CatalogRule/etc/module.xml +++ b/app/code/Magento/CatalogRule/etc/module.xml @@ -35,7 +35,6 @@ - diff --git a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml index 176f55a129e2b..144f368dd74e7 100644 --- a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml +++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml @@ -24,14 +24,6 @@ */ --> - - - 1 - - - 1 - - diff --git a/app/code/Magento/CatalogSearch/Block/Result.php b/app/code/Magento/CatalogSearch/Block/Result.php index 9abe90169f578..b5c8637c13478 100644 --- a/app/code/Magento/CatalogSearch/Block/Result.php +++ b/app/code/Magento/CatalogSearch/Block/Result.php @@ -92,8 +92,7 @@ protected function _getQuery() protected function _prepareLayout() { $title = $this->getSearchQueryText(); - $this->getLayout()->getBlock('head')->setTitle($title); - + $this->pageConfig->setTitle($title); // add Home breadcrumb $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'); if ($breadcrumbs) { diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php index 87c59349195d0..d0360c88f00de 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php @@ -151,10 +151,16 @@ class Full */ protected $priceCurrency; + /** + * @var \Magento\Framework\Search\Request\Config + */ + private $searchRequestConfig; + /** * @param \Magento\Framework\App\Resource $resource * @param \Magento\Catalog\Model\Product\Type $catalogProductType * @param \Magento\Eav\Model\Config $eavConfig + * @param \Magento\Framework\Search\Request\Config $searchRequestConfig * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $productAttributeCollectionFactory * @param \Magento\CatalogSearch\Model\Resource\EngineProvider $engineProvider @@ -172,6 +178,7 @@ public function __construct( \Magento\Framework\App\Resource $resource, \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Eav\Model\Config $eavConfig, + \Magento\Framework\Search\Request\Config $searchRequestConfig, \Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $productAttributeCollectionFactory, \Magento\CatalogSearch\Model\Resource\EngineProvider $engineProvider, @@ -188,6 +195,7 @@ public function __construct( $this->resource = $resource; $this->catalogProductType = $catalogProductType; $this->eavConfig = $eavConfig; + $this->searchRequestConfig = $searchRequestConfig; $this->catalogProductStatus = $catalogProductStatus; $this->productAttributeCollectionFactory = $productAttributeCollectionFactory; $this->eventManager = $eventManager; @@ -260,6 +268,7 @@ protected function rebuildIndex($productIds = null) foreach ($storeIds as $storeId) { $this->rebuildStoreIndex($storeId, $productIds); } + $this->searchRequestConfig->reset(); } /** diff --git a/app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php b/app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php new file mode 100644 index 0000000000000..3286c2316ab6f --- /dev/null +++ b/app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php @@ -0,0 +1,60 @@ +requestGenerator = $requestGenerator; + } + + /** + * Merge reader's value with generated + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @param \Magento\Framework\Config\ReaderInterface $subject + * @param \Closure $proceed + * @param string $scope + * @return array + */ + public function aroundRead( + \Magento\Framework\Config\ReaderInterface $subject, + \Closure $proceed, + $scope = null + ) { + $result = $proceed($scope); + $result = array_merge_recursive($result, $this->requestGenerator->generate()); + return $result; + } +} diff --git a/app/code/Magento/CatalogSearch/Model/Search/RequestGenerator.php b/app/code/Magento/CatalogSearch/Model/Search/RequestGenerator.php new file mode 100644 index 0000000000000..2ad1ef807b163 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Model/Search/RequestGenerator.php @@ -0,0 +1,163 @@ +productAttributeCollectionFactory = $productAttributeCollectionFactory; + } + + /** + * Generate dynamic fields requests + * + * @return array + */ + public function generate() + { + $requests = []; + $requests['quick_search_container'] = $this->generateQuickSearchRequest(); + $requests['advanced_search_container'] = $this->generateAdvancedSearchRequest(); + return $requests; + } + + /** + * Generate quick search request + * + * @return array + */ + private function generateQuickSearchRequest() + { + $request = []; + foreach ($this->getSearchableAttributes() as $attribute) { + /** @var $attribute \Magento\Catalog\Model\Product\Attribute */ + if (in_array($attribute->getAttributeCode(), ['price', 'sku'])) { + //same fields have special semantics + continue; + } + $request['queries']['quick_search_container']['match'][] = [ + 'field' => $attribute->getAttributeCode(), + 'boost' => $attribute->getSearchWeight() ?: 1, + ]; + } + return $request; + } + + /** + * Generate advanced search request + * + * @return array + */ + private function generateAdvancedSearchRequest() + { + $request = []; + foreach ($this->getSearchableAttributes() as $attribute) { + /** @var $attribute \Magento\Catalog\Model\Product\Attribute */ + if (!$attribute->getIsVisibleInAdvancedSearch()) { + continue; + } + if (in_array($attribute->getAttributeCode(), ['price', 'sku'])) { + //same fields have special semantics + continue; + } + + $queryName = $attribute->getAttributeCode() . '_query'; + $request['queries']['advanced_search_container']['queryReference'][] = [ + 'clause' => 'should', + 'ref' => $queryName, + ]; + switch ($attribute->getBackendType()) { + case 'static': + break; + case 'text': + case 'varchar': + $request['queries'][$queryName] = [ + 'name' => $queryName, + 'type' => 'matchQuery', + 'value' => '$' . $attribute->getAttributeCode() . '$', + 'match' => [ + [ + 'field' => $attribute->getAttributeCode(), + 'boost' => $attribute->getSearchWeight() ?: 1, + ] + ] + ]; + break; + case 'decimal': + case 'date': + $filterName = $attribute->getAttributeCode() . '_filter'; + $request['queries'][$queryName] = [ + 'name' => $queryName, + 'type' => 'filteredQuery', + 'filterReference' => [['ref' => $filterName]] + ]; + $request['filters'][$filterName] = [ + 'field' => $attribute->getAttributeCode(), + 'type' => 'rangeFilter', + 'from' => '$' . $attribute->getAttributeCode() . '.from$', + 'to' => '$' . $attribute->getAttributeCode() . '.to$', + ]; + break; + default: + $filterName = $attribute->getAttributeCode() . '_filter'; + $request['queries'][$queryName] = [ + 'name' => $queryName, + 'type' => 'filteredQuery', + 'filterReference' => [['ref' => $filterName]] + ]; + + $request['filters'][$filterName] = [ + 'type' => 'termFilter', + 'field' => $attribute->getAttributeCode(), + 'value' => '$' . $attribute->getAttributeCode() . '$', + ]; + } + } + return $request; + } + + /** + * Retrieve searchable attributes + * + * @return \Traversable + */ + protected function getSearchableAttributes() + { + /** @var \Magento\Catalog\Model\Resource\Product\Attribute\Collection $productAttributes */ + $productAttributes = $this->productAttributeCollectionFactory->create(); + $productAttributes->addFieldToFilter('is_searchable', 1); + + return $productAttributes; + } +} diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index 89ad0c2cc7195..a9cc6a7815b9b 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-indexer": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-indexer": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogSearch/etc/di.xml b/app/code/Magento/CatalogSearch/etc/di.xml index 8f314df617447..f1cfc63c177d5 100644 --- a/app/code/Magento/CatalogSearch/etc/di.xml +++ b/app/code/Magento/CatalogSearch/etc/di.xml @@ -72,4 +72,7 @@ Magento\Framework\Search\ProductEntityMetadata + + + diff --git a/app/code/Magento/CatalogSearch/etc/search_request.xml b/app/code/Magento/CatalogSearch/etc/search_request.xml index f1c6ef3c362b9..ebb1d50ac8945 100644 --- a/app/code/Magento/CatalogSearch/etc/search_request.xml +++ b/app/code/Magento/CatalogSearch/etc/search_request.xml @@ -23,19 +23,20 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + - + - - - - - - - + + + + + + + 10 @@ -43,42 +44,25 @@ - + - - - - - - - - + - - - - - - - + - - - - - 10 + 0 10 diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_index.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_index.xml index e85347f277e35..6509820bcc06e 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_index.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_index.xml @@ -24,11 +24,9 @@ */ --> - - - Advanced Search - - + + Advanced Search + diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_result.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_result.xml index b53ae3e292775..b640d14743c88 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_result.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_result.xml @@ -24,16 +24,14 @@ */ --> + + + Catalog Advanced Search - - - page-products - - diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_result_index.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_result_index.xml index 6d62792a75ea5..f5862aa548d34 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_result_index.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_result_index.xml @@ -24,11 +24,9 @@ */ --> - - - page-products - - + + + diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_term_popular.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_term_popular.xml index 42b07876ccb35..4f52660551d6b 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_term_popular.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_term_popular.xml @@ -24,11 +24,9 @@ */ --> - - - Popular Search Terms - - + + Popular Search Terms + diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Attribute/Urlkey.php b/app/code/Magento/CatalogUrlRewrite/Block/UrlKeyRenderer.php similarity index 79% rename from app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Attribute/Urlkey.php rename to app/code/Magento/CatalogUrlRewrite/Block/UrlKeyRenderer.php index 86754a2ac0a33..3393aab3754b7 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Attribute/Urlkey.php +++ b/app/code/Magento/CatalogUrlRewrite/Block/UrlKeyRenderer.php @@ -21,23 +21,17 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\CatalogUrlRewrite\Block; + +use Magento\Store\Model\ScopeInterface; /** * Renderer for URL key input * Allows to manage and overwrite URL Rewrites History save settings - * - * @author Magento Core Team */ -namespace Magento\Catalog\Block\Adminhtml\Form\Renderer\Attribute; - -class Urlkey extends \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Element +class UrlKeyRenderer extends \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Element { - /** - * Catalog data - * - * @var \Magento\Catalog\Helper\Data - */ - protected $_catalogData = null; + const XML_PATH_SEO_SAVE_HISTORY = 'catalog/seo/save_rewrites_history'; /** * @var \Magento\Framework\Data\Form\Element\Factory @@ -47,17 +41,14 @@ class Urlkey extends \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Ele /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Data\Form\Element\Factory $elementFactory - * @param \Magento\Catalog\Helper\Data $catalogData * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\Data\Form\Element\Factory $elementFactory, - \Magento\Catalog\Helper\Data $catalogData, array $data = array() ) { $this->_elementFactory = $elementFactory; - $this->_catalogData = $catalogData; parent::__construct($context, $data); } @@ -83,15 +74,16 @@ public function getElementHtml() $data['html_id'] = $element->getHtmlId() . '_create_redirect'; $data['label'] = __('Create Permanent Redirect for old URL'); $data['value'] = $element->getValue(); - $data['checked'] = $this->_catalogData->shouldSaveUrlRewritesHistory($storeId); + $data['checked'] = $this->_scopeConfig->isSetFlag( + self::XML_PATH_SEO_SAVE_HISTORY, + ScopeInterface::SCOPE_STORE, + $storeId + ); /** @var \Magento\Framework\Data\Form\Element\Checkbox $checkbox */ $checkbox = $this->_elementFactory->create('checkbox', array('data' => $data)); $checkbox->setForm($element->getForm()); - return parent::getElementHtml() . - '
' . - $hidden->getElementHtml() . - $checkbox->getElementHtml() . - $checkbox->getLabelHtml(); + return parent::getElementHtml() . '
' . $hidden->getElementHtml() . $checkbox->getElementHtml() + . $checkbox->getLabelHtml(); } } diff --git a/app/code/Magento/CatalogUrlRewrite/Helper/Data.php b/app/code/Magento/CatalogUrlRewrite/Helper/Data.php deleted file mode 100644 index 098a731a8aa37..0000000000000 --- a/app/code/Magento/CatalogUrlRewrite/Helper/Data.php +++ /dev/null @@ -1,277 +0,0 @@ -eavConfig = $eavConfig; - $this->connection = $resource->getConnection(Resource::DEFAULT_READ_RESOURCE); - $this->productHelper = $productHelper; - $this->storeManager = $storeManager; - $this->categoryHelper = $categoryHelper; - $this->converter = $converter; - } - - /** - * If product saved on default store view, then need to check specific url_key for other stores - * - * @param int $storeId - * @param int $productId - * @return bool - */ - public function isNeedCreateUrlRewrite($storeId, $productId) - { - $attribute = $this->eavConfig->getAttribute(Product::ENTITY, 'url_key'); - $select = $this->connection->select() - ->from($attribute->getBackendTable(), 'store_id') - ->where('attribute_id = ?', $attribute->getId()) - ->where('entity_id = ?', $productId); - - return !in_array($storeId, $this->connection->fetchCol($select)); - } - - /** - * Whether the store is default - * - * @param int|null $storeId - * @return bool - */ - public function isDefaultStore($storeId) - { - return null === $storeId || $storeId == Store::DEFAULT_STORE_ID; - } - - /** - * Get canonical product url path - * - * @param Product $product - * @return string - */ - public function getProductCanonicalUrlPath(Product $product) - { - return 'catalog/product/view/id/' . $product->getId(); - } - - /** - * Get canonical product url path with category - * - * @param Product $product - * @param Category $category - * @return string - */ - public function getProductCanonicalUrlPathWithCategory(Product $product, Category $category) - { - return $this->getProductCanonicalUrlPath($product) . '/category/' . $category->getId(); - } - - /** - * Get product url key path - * - * @param Product $product - * @param int $storeId - * @return string - */ - public function getProductUrlKeyPath(Product $product, $storeId) - { - return $product->getUrlModel()->getUrlPath($product) . $this->productHelper->getProductUrlSuffix($storeId); - } - - /** - * Get product url key path with category - * - * @param Product $product - * @param Category $category - * @param int $storeId - * @return string - */ - public function getProductUrlKeyPathWithCategory(Product $product, Category $category, $storeId) - { - return $product->getUrlModel()->getUrlPath($product, $category) - . $this->productHelper->getProductUrlSuffix($storeId); - } - - /** - * Get canonical category url - * - * @param Category $category - * @return string - */ - public function getCategoryCanonicalUrlPath(Category $category) - { - return 'catalog/category/view/id/' . $category->getId(); - } - - /** - * Get category url path - * - * @param Category $category - * @return string - */ - public function getCategoryUrlKeyPath(Category $category) - { - return $category->getUrlPath(); - } - - /** - * Check is root category - * - * @param Category $category - * @return string - */ - public function isRootCategory(Category $category) - { - $store = $this->storeManager->getStore($category->getStoreId()); - - return $category->getId() == $store->getRootCategoryId(); - } - - /** - * Generate category url key path - * - * @param \Magento\Catalog\Model\Category $category - * @return string - */ - public function generateCategoryUrlKeyPath($category) - { - $parentPath = $this->categoryHelper->getCategoryUrlPath('', true, $category->getStoreId()); - - $urlKey = $category->getUrlKey() == '' - ? $category->formatUrlKey($category->getName()) : $category->formatUrlKey($category->getUrlKey()); - - return $parentPath . $urlKey; - } - - /** - * Generate product url key path - * - * @param \Magento\Catalog\Model\Product $product - * @return string - */ - public function generateProductUrlKeyPath($product) - { - $urlKey = $product->getUrlKey() == '' - ? $product->formatUrlKey($product->getName()) - : $product->formatUrlKey($product->getUrlKey()); - - return $urlKey; - } - - /** - * Create url rewrite object - * - * @param string $entityType - * @param int $entityId - * @param int $storeId - * @param string $requestPath - * @param string $targetPath - * @param string|null $redirectType Null or one of OptionProvider const - * @return UrlRewrite - */ - public function createUrlRewrite( - $entityType, - $entityId, - $storeId, - $requestPath, - $targetPath, - $redirectType = null - ) { - return $this->converter->convertArrayToObject([ - UrlRewrite::ENTITY_TYPE => $entityType, - UrlRewrite::ENTITY_ID => $entityId, - UrlRewrite::STORE_ID => $storeId, - UrlRewrite::REQUEST_PATH => $requestPath, - UrlRewrite::TARGET_PATH => $targetPath, - UrlRewrite::REDIRECT_TYPE => $redirectType, - ]); - } -} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGenerator.php new file mode 100644 index 0000000000000..5e9c7094839ae --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGenerator.php @@ -0,0 +1,69 @@ +categoryUrlPathGenerator = $categoryUrlPathGenerator; + $this->urlRewriteBuilder = $urlRewriteBuilder; + } + + /** + * Generate list based on store view + * + * @param int $storeId + * @param \Magento\Catalog\Model\Category $category + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + public function generate($storeId, Category $category) + { + return [ + $this->urlRewriteBuilder->setStoreId($storeId) + ->setEntityType(CategoryUrlRewriteGenerator::ENTITY_TYPE) + ->setEntityId($category->getId()) + ->setRequestPath($this->categoryUrlPathGenerator->getUrlPathWithSuffix($category, $storeId)) + ->setTargetPath($this->categoryUrlPathGenerator->getCanonicalUrlPath($category)) + ->create() + ]; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenCategoriesProvider.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenCategoriesProvider.php new file mode 100644 index 0000000000000..9ce634e22c797 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenCategoriesProvider.php @@ -0,0 +1,63 @@ +getResourceCollection() + ->addAttributeToSelect('url_path') + ->addAttributeToSelect('url_key') + ->addAttributeToSelect('name') + ->addIdFilter($this->getChildrenIds($category, $recursive)); + } + + /** + * @param \Magento\Catalog\Model\Category $category + * @param boolean $recursive + * @return int[] + */ + public function getChildrenIds(Category $category, $recursive = false) + { + $connection = $category->getResource()->getReadConnection(); + $select = $connection->select() + ->from($category->getResource()->getEntityTable(), 'entity_id') + ->where($connection->quoteIdentifier('path') . ' LIKE :c_path'); + $bind = ['c_path' => $category->getPath() . '/%']; + if (!$recursive) { + $select->where($connection->quoteIdentifier('level') . ' <= :c_level'); + $bind['c_level'] = $category->getLevel() + 1; + } + + return $connection->fetchCol($select, $bind); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenUrlRewriteGenerator.php new file mode 100644 index 0000000000000..95c88680f0337 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenUrlRewriteGenerator.php @@ -0,0 +1,69 @@ +childrenCategoriesProvider = $childrenCategoriesProvider; + $this->categoryUrlRewriteGeneratorFactory = $categoryUrlRewriteGeneratorFactory; + } + + /** + * Generate list of children urls + * + * @param int $storeId + * @param \Magento\Catalog\Model\Category $category + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + public function generate($storeId, Category $category) + { + $urls = []; + foreach ($this->childrenCategoriesProvider->getChildren($category) as $childCategory) { + $childCategory->setStoreId($storeId); + $childCategory->setData('save_rewrites_history', $category->getData('save_rewrites_history')); + $urls = array_merge( + $urls, + $this->categoryUrlRewriteGeneratorFactory->create()->generate($childCategory) + ); + } + return $urls; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegenerator.php new file mode 100644 index 0000000000000..b9c1ba4ecd511 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegenerator.php @@ -0,0 +1,144 @@ +categoryUrlPathGenerator = $categoryUrlPathGenerator; + $this->urlRewriteBuilder = $urlRewriteBuilder; + $this->urlFinder = $urlFinder; + } + + /** + * Generate list based on current url rewrites + * + * @param int $storeId + * @param \Magento\Catalog\Model\Category $category + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + public function generate($storeId, Category $category) + { + $this->category = $category; + + $currentUrlRewrites = $this->urlFinder->findAllByData( + [ + UrlRewrite::STORE_ID => $storeId, + UrlRewrite::ENTITY_ID => $category->getId(), + UrlRewrite::ENTITY_TYPE => CategoryUrlRewriteGenerator::ENTITY_TYPE, + ] + ); + + $urlRewrites = []; + foreach ($currentUrlRewrites as $rewrite) { + if ($rewrite->getIsAutogenerated()) { + $urlRewrites = array_merge($urlRewrites, $this->generateForAutogenerated($rewrite, $storeId)); + } else { + $urlRewrites = array_merge($urlRewrites, $this->generateForCustom($rewrite, $storeId)); + } + } + return $urlRewrites; + } + + /** + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewrite $url + * @param int $storeId + * @return array + */ + protected function generateForAutogenerated($url, $storeId) + { + $urls = []; + if ($this->category->getData('save_rewrites_history')) { + $targetPath = $this->categoryUrlPathGenerator->getUrlPathWithSuffix($this->category, $storeId); + if ($url->getRequestPath() !== $targetPath) { + $urls[] = $this->urlRewriteBuilder + ->setEntityType(CategoryUrlRewriteGenerator::ENTITY_TYPE) + ->setEntityId($this->category->getId()) + ->setRequestPath($url->getRequestPath()) + ->setTargetPath($targetPath) + ->setRedirectType(OptionProvider::PERMANENT) + ->setStoreId($storeId) + ->setIsAutogenerated(0) + ->create(); + } + } + return $urls; + } + + /** + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewrite $url + * @param int $storeId + * @return array + */ + protected function generateForCustom($url, $storeId) + { + $urls = []; + $targetPath = !$url->getRedirectType() + ? $url->getTargetPath() + : $this->categoryUrlPathGenerator->getUrlPathWithSuffix($this->category, $storeId); + if ($url->getRequestPath() !== $targetPath) { + $urls[] = $this->urlRewriteBuilder + ->setEntityType(CategoryUrlRewriteGenerator::ENTITY_TYPE) + ->setEntityId($this->category->getId()) + ->setRequestPath($url->getRequestPath()) + ->setTargetPath($targetPath) + ->setRedirectType($url->getRedirectType()) + ->setStoreId($storeId) + ->setDescription($url->getDescription()) + ->setIsAutogenerated(0) + ->setMetadata($url->getMetadata()) + ->create(); + } + return $urls; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Observer.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Observer.php index c2387d36e4bb6..dd65243301f92 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Observer.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Observer.php @@ -23,50 +23,61 @@ */ namespace Magento\CatalogUrlRewrite\Model\Category; -use Magento\CatalogUrlRewrite\Helper\Data as CatalogUrlRewriteHelper; -use Magento\CatalogUrlRewrite\Service\V1\CategoryUrlGeneratorInterface; -use Magento\CatalogUrlRewrite\Service\V1\ProductUrlGeneratorInterface; +use Magento\Catalog\Model\Category; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; use Magento\Framework\Event\Observer as EventObserver; -use Magento\UrlRedirect\Service\V1\UrlSaveInterface; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\UrlRewrite\Model\UrlPersistInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\CatalogUrlRewrite\Block\UrlKeyRenderer; class Observer { - /** - * @var CategoryUrlGeneratorInterface - */ - protected $categoryUrlGenerator; + /** @var \Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider */ + protected $childrenCategoriesProvider; - /** - * @var CategoryUrlGeneratorInterface - */ - protected $productUrlGenerator; + /** @var CategoryUrlRewriteGenerator */ + protected $categoryUrlRewriteGenerator; - /** - * @var UrlSaveInterface - */ - protected $urlSave; + /** @var ProductUrlRewriteGenerator */ + protected $productUrlRewriteGenerator; - /** - * @var CatalogUrlRewriteHelper - */ - protected $catalogUrlRewriteHelper; + /** @var UrlPersistInterface */ + protected $urlPersist; + + /** @var ScopeConfigInterface */ + protected $scopeConfig; + + /** @var array */ + protected $isSkippedProduct; + + /** @var \Magento\Catalog\Model\Resource\Product\CollectionFactory */ + protected $productCollectionFactory; /** - * @param CategoryUrlGeneratorInterface $categoryUrlGenerator - * @param ProductUrlGeneratorInterface $productUrlGenerator - * @param UrlSaveInterface $urlSave - * @param CatalogUrlRewriteHelper $catalogUrlRewriteHelper + * @param \Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider $childrenCategoriesProvider + * @param CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator + * @param ProductUrlRewriteGenerator $productUrlRewriteGenerator + * @param UrlPersistInterface $urlPersist + * @param ScopeConfigInterface $scopeConfig + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory */ public function __construct( - CategoryUrlGeneratorInterface $categoryUrlGenerator, - ProductUrlGeneratorInterface $productUrlGenerator, - UrlSaveInterface $urlSave, - CatalogUrlRewriteHelper $catalogUrlRewriteHelper + ChildrenCategoriesProvider $childrenCategoriesProvider, + CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator, + ProductUrlRewriteGenerator $productUrlRewriteGenerator, + UrlPersistInterface $urlPersist, + ScopeConfigInterface $scopeConfig, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory ) { - $this->categoryUrlGenerator = $categoryUrlGenerator; - $this->productUrlGenerator = $productUrlGenerator; - $this->urlSave = $urlSave; - $this->catalogUrlRewriteHelper = $catalogUrlRewriteHelper; + $this->childrenCategoriesProvider = $childrenCategoriesProvider; + $this->categoryUrlRewriteGenerator = $categoryUrlRewriteGenerator; + $this->productUrlRewriteGenerator = $productUrlRewriteGenerator; + $this->urlPersist = $urlPersist; + $this->scopeConfig = $scopeConfig; + $this->productCollectionFactory = $productCollectionFactory; } /** @@ -77,26 +88,131 @@ public function __construct( */ public function processUrlRewriteSaving(EventObserver $observer) { - /** @var \Magento\Catalog\Model\Category $category */ + /** @var Category $category */ $category = $observer->getEvent()->getCategory(); + if ($category->getParentId() == Category::TREE_ROOT_ID) { + return; + } + if ($category->dataHasChangedFor('url_key') || $category->getIsChangedProductList()) { + $urlRewrites = array_merge( + $this->categoryUrlRewriteGenerator->generate($category), + $this->generateProductUrlRewrites($category) + ); + $this->urlPersist->replace($urlRewrites); + } + } - if (!$this->catalogUrlRewriteHelper->isRootCategory($category) - && (!$category->getData('url_key') || $category->getOrigData('url_key') != $category->getData('url_key')) - ) { - $this->urlSave->save($this->categoryUrlGenerator->generate($category)); + /** + * @param EventObserver $observer + * @return void + */ + public function processUrlRewriteMoving(EventObserver $observer) + { + /** @var Category $category */ + $category = $observer->getEvent()->getCategory(); + if ($category->dataHasChangedFor('parent_id')) { + $saveRewritesHistory = $this->scopeConfig->isSetFlag( + UrlKeyRenderer::XML_PATH_SEO_SAVE_HISTORY, + ScopeInterface::SCOPE_STORE, + $category->getStoreId() + ); + $category->setData('save_rewrites_history', $saveRewritesHistory); + $urlRewrites = array_merge( + $this->categoryUrlRewriteGenerator->generate($category), + $this->generateProductUrlRewrites($category) + ); + $this->deleteCategoryRewritesForChildren($category); + $this->urlPersist->replace($urlRewrites); + } + } - $products = $category->getProductCollection() + /** + * Generate url rewrites for products assigned to category + * + * @param Category $category + * @return array + */ + protected function generateProductUrlRewrites(Category $category) + { + $this->isSkippedProduct = []; + $saveRewriteHistory = $category->getData('save_rewrites_history'); + $storeId = $category->getStoreId(); + $productUrls = []; + if ($category->getAffectedProductIds()) { + $this->isSkippedProduct = $category->getAffectedProductIds(); + $collection = $this->productCollectionFactory->create() + ->setStoreId($storeId) + ->addIdFilter($category->getAffectedProductIds()) + ->addAttributeToSelect('name') ->addAttributeToSelect('url_key') ->addAttributeToSelect('url_path'); + foreach ($collection as $product) { + $product->setStoreId($storeId); + $product->setData('save_rewrites_history', $saveRewriteHistory); + $productUrls = array_merge($productUrls, $this->productUrlRewriteGenerator->generate($product)); + } + } else { + $productUrls = array_merge( + $productUrls, + $this->getCategoryProductsUrlRewrites($category, $storeId, $saveRewriteHistory) + ); + } + foreach ($this->childrenCategoriesProvider->getChildren($category, true) as $childCategory) { + $productUrls = array_merge( + $productUrls, + $this->getCategoryProductsUrlRewrites($childCategory, $storeId, $saveRewriteHistory) + ); + } + return $productUrls; + } - foreach ($products as $product) { - $product->setData('save_rewrites_history', $category->getData('save_rewrites_history')); - - $this->urlSave->save($this->productUrlGenerator->generateWithChangedCategories( - $product, - [$category->getId() => $category] - )); + /** + * @param Category $category + * @param int $storeId + * @param bool $saveRewriteHistory + * @return UrlRewrite[] + */ + protected function getCategoryProductsUrlRewrites(Category $category, $storeId, $saveRewriteHistory) + { + /** @var \Magento\Catalog\Model\Resource\Product\Collection $productCollection */ + $productCollection = $category->getProductCollection() + ->addAttributeToSelect('name') + ->addAttributeToSelect('url_key') + ->addAttributeToSelect('url_path'); + $productUrls = []; + foreach ($productCollection as $product) { + if (in_array($product->getId(), $this->isSkippedProduct)) { + continue; } + $this->isSkippedProduct[] = $product->getId(); + $product->setStoreId($storeId); + $product->setData('save_rewrites_history', $saveRewriteHistory); + $productUrls = array_merge($productUrls, $this->productUrlRewriteGenerator->generate($product)); + } + return $productUrls; + } + + /** + * @param Category $category + * @return void + */ + protected function deleteCategoryRewritesForChildren(Category $category) + { + $categoryIds = $this->childrenCategoriesProvider->getChildrenIds($category, true); + $categoryIds[] = $category->getId(); + foreach ($categoryIds as $categoryId) { + $this->urlPersist->deleteByData( + [ + UrlRewrite::ENTITY_ID => $categoryId, + UrlRewrite::ENTITY_TYPE => CategoryUrlRewriteGenerator::ENTITY_TYPE, + ] + ); + $this->urlPersist->deleteByData( + [ + UrlRewrite::METADATA => serialize(['category_id' => $categoryId]), + UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, + ] + ); } } } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php new file mode 100644 index 0000000000000..ab1e6bf9c4733 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php @@ -0,0 +1,64 @@ +categoryUrlPathGenerator = $categoryUrlPathGenerator; + } + + /** + * @param \Magento\Catalog\Model\Resource\Category $subject + * @param callable $proceed + * @param Category $category + * @param Category $newParent + * @param null|int $afterCategoryId + * @return callable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundChangeParent( + \Magento\Catalog\Model\Resource\Category $subject, + \Closure $proceed, + $category, + $newParent, + $afterCategoryId + ) { + $result = $proceed($category, $newParent, $afterCategoryId); + $category->setUrlKey($this->categoryUrlPathGenerator->generateUrlKey($category)) + ->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category)); + return $result; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Remove.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Remove.php new file mode 100644 index 0000000000000..8c33fd728b76b --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Remove.php @@ -0,0 +1,107 @@ +urlPersist = $urlPersist; + $this->categoryFactory = $categoryFactory; + $this->productUrlRewriteGenerator = $productUrlRewriteGenerator; + $this->childrenCategoriesProvider = $childrenCategoriesProvider; + } + + /** + * Remove product urls from storage + * + * @param Category $category + * @param callable $proceed + * @return mixed + */ + public function aroundDelete(Category $category, \Closure $proceed) + { + $categoryIds = $this->childrenCategoriesProvider->getChildrenIds($category, true); + $categoryIds[] = $category->getId(); + $result = $proceed(); + foreach ($categoryIds as $categoryId) { + $this->deleteRewritesForCategory($categoryId); + } + return $result; + } + + /** + * Remove url rewrites by categoryId + * + * @param int $categoryId + * @return void + */ + protected function deleteRewritesForCategory($categoryId) + { + $this->urlPersist->deleteByData( + [ + UrlRewrite::ENTITY_ID => $categoryId, + UrlRewrite::ENTITY_TYPE => CategoryUrlRewriteGenerator::ENTITY_TYPE, + ] + ); + $this->urlPersist->deleteByData( + [ + UrlRewrite::METADATA => serialize(['category_id' => $categoryId]), + UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, + ] + ); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Storage.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Storage.php new file mode 100644 index 0000000000000..7e9b29f446c29 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Storage.php @@ -0,0 +1,130 @@ +urlFinder = $urlFinder; + $this->productFactory = $productFactory; + } + + /** + * @param \Magento\UrlRewrite\Model\StorageInterface $object + * @param callable $proceed + * @param array $urls + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundReplace(StorageInterface $object, \Closure $proceed, array $urls) + { + $proceed($urls); + $toSave = []; + foreach ($this->filterUrls($urls) as $record) { + $metadata = $record->getMetadata(); + $toSave[] = [ + 'url_rewrite_id' => $record->getUrlRewriteId(), + 'category_id' => $metadata['category_id'], + 'product_id' => $record->getEntityId() + ]; + } + if ($toSave) { + $this->productFactory->create()->getResource()->saveMultiple($toSave); + } + } + + /** + * @param \Magento\UrlRewrite\Model\StorageInterface $object + * @param array $data + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeDeleteByData(StorageInterface $object, array $data) + { + $toRemove = []; + $records = $this->urlFinder->findAllByData($data); + foreach ($records as $record) { + $toRemove[] = $record->getUrlRewriteId(); + } + if ($toRemove) { + $this->productFactory->create()->getResource()->removeMultiple($toRemove); + } + } + + /** + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] $urls + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + protected function filterUrls(array $urls) + { + $filteredUrls = []; + /** @var UrlRewrite $url */ + foreach ($urls as $url) { + if ($this->isCorrectUrl($url)) { + $filteredUrls[] = $url; + } + } + $data = []; + foreach ($filteredUrls as $url) { + foreach ([UrlRewrite::REQUEST_PATH, UrlRewrite::STORE_ID] as $key) { + $fieldValue = $url->getByKey($key); + if (!isset($data[$key]) || !in_array($fieldValue, $data[$key])) { + $data[$key][] = $fieldValue; + } + } + } + return $data ? $this->urlFinder->findAllByData($data) : []; + } + + /** + * @param UrlRewrite $url + * @return bool + */ + protected function isCorrectUrl(UrlRewrite $url) + { + $metadata = $url->getMetadata(); + return $url->getEntityType() == ProductUrlRewriteGenerator::ENTITY_TYPE + && !empty($metadata['category_id']) + && $url->getIsAutogenerated(); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php new file mode 100644 index 0000000000000..b92a128527bbf --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php @@ -0,0 +1,165 @@ +urlPersist = $urlPersist; + $this->categoryFactory = $categoryFactory; + $this->productFactory = $productFactory; + $this->categoryUrlRewriteGenerator = $categoryUrlRewriteGenerator; + $this->productUrlRewriteGenerator = $productUrlRewriteGenerator; + $this->storeManager = $storeManager; + } + + /** + * @param \Magento\Store\Model\Resource\Group $object + * @param callable $proceed + * @param AbstractModel $group + * @return \Magento\Store\Model\Resource\Group + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundSave( + \Magento\Store\Model\Resource\Group $object, + \Closure $proceed, + AbstractModel $group + ) { + $originGroup = $group; + $result = $proceed($originGroup); + if (!$group->isObjectNew() + && ($group->dataHasChangedFor('website_id') + || $group->dataHasChangedFor('root_category_id')) + ) { + $this->storeManager->reinitStores(); + foreach ($group->getStoreIds() as $storeId) { + $this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $storeId]); + } + + $this->urlPersist->replace( + $this->generateCategoryUrls($group->getRootCategoryId(), $group->getStoreIds()) + ); + + $this->urlPersist->replace( + $this->generateProductUrls($group->getWebsiteId(), $group->getOrigData('website_id')) + ); + } + + return $result; + } + + /** + * Generate url rewrites for products assigned to website + * + * @param int $websiteId + * @param int $originWebsiteId + * @return array + */ + protected function generateProductUrls($websiteId, $originWebsiteId) + { + $urls = []; + $websiteIds = $websiteId != $originWebsiteId + ? [$websiteId, $originWebsiteId] + : [$websiteId]; + $collection = $this->productFactory->create() + ->getCollection() + ->addCategoryIds() + ->addAttributeToSelect(array('name', 'url_path', 'url_key')) + ->addWebsiteFilter($websiteIds); + foreach ($collection as $product) { + /** @var \Magento\Catalog\Model\Product $product */ + $product->setStoreId(Store::DEFAULT_STORE_ID); + $urls = array_merge( + $urls, + $this->productUrlRewriteGenerator->generate($product) + ); + } + + return $urls; + } + + /** + * @param int $rootCategoryId + * @param array $storeIds + * @return array + */ + protected function generateCategoryUrls($rootCategoryId, $storeIds) + { + $urls = []; + $categories = $this->categoryFactory->create()->getCategories($rootCategoryId, 1, false, true); + foreach ($categories as $category) { + /** @var \Magento\Catalog\Model\Category $category */ + $category->setStoreId(Store::DEFAULT_STORE_ID); + $category->setStoreIds($storeIds); + $urls = array_merge( + $urls, + $this->categoryUrlRewriteGenerator->generate($category) + ); + } + return $urls; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php new file mode 100644 index 0000000000000..13bfef17f80fd --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php @@ -0,0 +1,171 @@ +categoryUrlRewriteGenerator = $categoryUrlRewriteGenerator; + $this->productUrlRewriteGenerator = $productUrlRewriteGenerator; + $this->urlPersist = $urlPersist; + $this->categoryFactory = $categoryFactory; + $this->productFactory = $productFactory; + } + + /** + * @param \Magento\Store\Model\Resource\Store $object + * @param callable $proceed + * @param AbstractModel $store + * @return \Magento\Store\Model\Resource\Store + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundSave( + \Magento\Store\Model\Resource\Store $object, + \Closure $proceed, + AbstractModel $store + ) { + $originStore = $store; + $result = $proceed($originStore); + if ($store->isObjectNew() || $store->dataHasChangedFor('group_id')) { + if (!$store->isObjectNew()) { + $this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $store->getId()]); + } + + $this->urlPersist->replace( + $this->generateCategoryUrls($store->getRootCategoryId(), $store->getId()) + ); + + $this->urlPersist->replace( + $this->generateProductUrls($store->getWebsiteId(), $store->getOrigData('website_id'), $store->getId()) + ); + } + + return $result; + } + + /** + * Generate url rewrites for products assigned to website + * + * @param int $websiteId + * @param int $originWebsiteId + * @param int $storeId + * @return array + */ + protected function generateProductUrls($websiteId, $originWebsiteId, $storeId) + { + $urls = []; + $websiteIds = $websiteId != $originWebsiteId && !is_null($originWebsiteId) + ? [$websiteId, $originWebsiteId] + : [$websiteId]; + $collection = $this->productFactory->create() + ->getCollection() + ->addCategoryIds() + ->addAttributeToSelect(array('name', 'url_path', 'url_key')) + ->addWebsiteFilter($websiteIds); + foreach ($collection as $product) { + $product->setStoreId($storeId); + /** @var \Magento\Catalog\Model\Product $product */ + $urls = array_merge( + $urls, + $this->productUrlRewriteGenerator->generate($product) + ); + } + return $urls; + } + + /** + * @param int $rootCategoryId + * @param int $storeId + * @return array + */ + protected function generateCategoryUrls($rootCategoryId, $storeId) + { + $urls = []; + $categories = $this->categoryFactory->create()->getCategories($rootCategoryId, 1, false, true); + foreach ($categories as $category) { + /** @var \Magento\Catalog\Model\Category $category */ + $category->setStoreId($storeId); + $urls = array_merge( + $urls, + $this->categoryUrlRewriteGenerator->generate($category) + ); + } + return $urls; + } + + /** + * @param \Magento\Store\Model\Resource\Store $object + * @param callable $proceed + * @param AbstractModel $store + * @return mixed + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundDelete( + \Magento\Store\Model\Resource\Store $object, + \Closure $proceed, + AbstractModel $store + ) { + $result = $proceed($store); + $this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $store->getId()]); + return $result; + } +} diff --git a/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Product.php similarity index 77% rename from app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php rename to app/code/Magento/CatalogUrlRewrite/Model/Category/Product.php index f1dc364879d14..cd8dfb34698de 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Product.php @@ -17,24 +17,23 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Cms\Model\Resource\Page; +namespace Magento\CatalogUrlRewrite\Model\Category; -/** - * Cms page url rewrite resource model - */ -class Urlrewrite extends \Magento\Framework\Model\Resource\Db\AbstractDb +use Magento\Framework\Model\AbstractModel; + +class Product extends AbstractModel { /** - * Init cms page urlrewrite model + * Model construct that should be used for object initialization * * @return void */ protected function _construct() { - $this->_init('cms_url_rewrite', 'cms_rewrite_id'); + $this->_init('Magento\CatalogUrlRewrite\Model\Resource\Category\Product'); } } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php new file mode 100644 index 0000000000000..1ad254fde1b09 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php @@ -0,0 +1,156 @@ +storeManager = $storeManager; + $this->scopeConfig = $scopeConfig; + $this->categoryFactory = $categoryFactory; + } + + /** + * Build category URL path + * + * @param \Magento\Catalog\Model\Category|\Magento\Framework\Object $category + * @return string + */ + public function getUrlPath($category) + { + if ($category->getParentId() == Category::TREE_ROOT_ID) { + return ''; + } + $path = $category->getUrlPath(); + if ($path !== null && !$category->dataHasChangedFor('url_key') && !$category->dataHasChangedFor('path_ids')) { + return $path; + } + $path = $category->getUrlKey(); + if ($this->isNeedToGenerateUrlPathForParent($category)) { + $parentPath = $this->getUrlPath($this->categoryFactory->create()->load($category->getParentId())); + $path = $parentPath === '' ? $path : $parentPath . '/' . $path; + } + return $path; + } + + /** + * @param \Magento\Catalog\Model\Category $category + * @return bool + */ + protected function isNeedToGenerateUrlPathForParent($category) + { + return $category->getParentId() && $category->getLevel() >= self::MINIMAL_CATEGORY_LEVEL_FOR_PROCESSING; + } + + /** + * Get category url path + * + * @param \Magento\Catalog\Model\Category $category + * @param int $storeId + * @return string + */ + public function getUrlPathWithSuffix($category, $storeId = null) + { + if ($storeId === null) { + $storeId = $category->getStoreId(); + } + return $this->getUrlPath($category) . $this->getCategoryUrlSuffix($storeId); + } + + /** + * Retrieve category rewrite suffix for store + * + * @param int $storeId + * @return string + */ + protected function getCategoryUrlSuffix($storeId = null) + { + if ($storeId === null) { + $storeId = $this->storeManager->getStore()->getId(); + } + if (!isset($this->categoryUrlSuffix[$storeId])) { + $this->categoryUrlSuffix[$storeId] = $this->scopeConfig->getValue( + self::XML_PATH_CATEGORY_URL_SUFFIX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } + return $this->categoryUrlSuffix[$storeId]; + } + + /** + * Get canonical category url + * + * @param \Magento\Catalog\Model\Category $category + * @return string + */ + public function getCanonicalUrlPath($category) + { + return 'catalog/category/view/id/' . $category->getId(); + } + + /** + * Generate category url key + * + * @param \Magento\Catalog\Model\Category $category + * @return string + */ + public function generateUrlKey($category) + { + $urlKey = $category->getUrlKey(); + return $category->formatUrlKey($urlKey === '' || $urlKey === null ? $category->getName() : $urlKey); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php new file mode 100644 index 0000000000000..ba3474c4e5793 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php @@ -0,0 +1,132 @@ +storeViewService = $storeViewService; + $this->canonicalUrlRewriteGenerator = $canonicalUrlRewriteGenerator; + $this->childrenUrlRewriteGenerator = $childrenUrlRewriteGenerator; + $this->currentUrlRewritesRegenerator = $currentUrlRewritesRegenerator; + } + + /** + * {@inheritdoc} + */ + public function generate($category) + { + $this->category = $category; + + $storeId = $this->category->getStoreId(); + $urls = $this->isGlobalScope($storeId) + ? $this->generateForGlobalScope() + : $this->generateForSpecificStoreView($storeId); + + $this->category = null; + return $urls; + } + + /** + * Generate list of urls for global scope + * + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + protected function generateForGlobalScope() + { + $urls = []; + $categoryId = $this->category->getId(); + foreach ($this->category->getStoreIds() as $id) { + if (!$this->isGlobalScope($id) + && !$this->storeViewService->doesEntityHaveOverriddenUrlKeyForStore($id, $categoryId, Category::ENTITY) + ) { + $urls = array_merge($urls, $this->generateForSpecificStoreView($id)); + } + } + return $urls; + } + + /** + * Check is global scope + * + * @param int|null $storeId + * @return bool + */ + protected function isGlobalScope($storeId) + { + return null === $storeId || $storeId == Store::DEFAULT_STORE_ID; + } + + /** + * Generate list of urls per store + * + * @param string $storeId + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + protected function generateForSpecificStoreView($storeId) + { + $urls = array_merge( + $this->canonicalUrlRewriteGenerator->generate($storeId, $this->category), + $this->childrenUrlRewriteGenerator->generate($storeId, $this->category), + $this->currentUrlRewritesRegenerator->generate($storeId, $this->category) + ); + return $urls; + } +} diff --git a/app/code/Magento/UrlRewrite/Model/UrlRewrite/TypeProvider.php b/app/code/Magento/CatalogUrlRewrite/Model/ObjectRegistry.php similarity index 57% rename from app/code/Magento/UrlRewrite/Model/UrlRewrite/TypeProvider.php rename to app/code/Magento/CatalogUrlRewrite/Model/ObjectRegistry.php index 1d6f90505d7ea..7b8ca03bf8947 100644 --- a/app/code/Magento/UrlRewrite/Model/UrlRewrite/TypeProvider.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/ObjectRegistry.php @@ -1,7 +1,5 @@ _options)) { - $this->_options = array( - self::SYSTEM => __('System'), - self::CUSTOM => __('Custom'), - ); + $this->entitiesMap = []; + foreach ($entities as $entity) { + $this->entitiesMap[$entity->getId()] = $entity; } - return $this->_options; } /** - * Return option array - * - * @return array + * @param int $entityId + * @return \Magento\Framework\Object|null + */ + public function get($entityId) + { + return isset($this->entitiesMap[$entityId]) ? $this->entitiesMap[$entityId] : null; + } + + /** + * @return \Magento\Framework\Object[] */ - public function toOptionArray() + public function getList() { - return $this->getAllOptions(); + return $this->entitiesMap; } } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php new file mode 100644 index 0000000000000..84f9677fa5e45 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php @@ -0,0 +1,69 @@ +productUrlPathGenerator = $productUrlPathGenerator; + $this->urlRewriteBuilder = $urlRewriteBuilder; + } + + /** + * Generate list based on store view + * + * @param int $storeId + * @param Product $product + * @return UrlRewrite[] + */ + public function generate($storeId, Product $product) + { + return [ + $this->urlRewriteBuilder + ->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE) + ->setEntityId($product->getId()) + ->setRequestPath($this->productUrlPathGenerator->getUrlPathWithSuffix($product, $storeId)) + ->setTargetPath($this->productUrlPathGenerator->getCanonicalUrlPath($product)) + ->setStoreId($storeId) + ->create() + ]; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php new file mode 100644 index 0000000000000..7709ac4711f4b --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php @@ -0,0 +1,74 @@ +productUrlPathGenerator = $productUrlPathGenerator; + $this->urlRewriteBuilder = $urlRewriteBuilder; + } + + /** + * Generate list based on categories + * + * @param int $storeId + * @param Product $product + * @param ObjectRegistry $productCategories + * @return UrlRewrite[] + */ + public function generate($storeId, Product $product, ObjectRegistry $productCategories) + { + $urls = []; + foreach ($productCategories->getList() as $category) { + $urls[] = $this->urlRewriteBuilder + ->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE) + ->setEntityId($product->getId()) + ->setRequestPath($this->productUrlPathGenerator->getUrlPathWithSuffix($product, $storeId, $category)) + ->setTargetPath($this->productUrlPathGenerator->getCanonicalUrlPath($product, $category)) + ->setStoreId($storeId) + ->setMetadata(['category_id' => $category->getId()]) + ->create(); + } + return $urls; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php new file mode 100644 index 0000000000000..0082d14a5a7e7 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php @@ -0,0 +1,179 @@ +urlFinder = $urlFinder; + $this->productUrlPathGenerator = $productUrlPathGenerator; + $this->urlRewriteBuilder = $urlRewriteBuilder; + } + + /** + * Generate list based on current rewrites + * + * @param int $storeId + * @param Product $product + * @param ObjectRegistry $productCategories + * @return UrlRewrite[] + */ + public function generate($storeId, Product $product, ObjectRegistry $productCategories) + { + $this->product = $product; + $this->productCategories = $productCategories; + + $currentUrlRewrites = $this->urlFinder->findAllByData( + [ + UrlRewrite::STORE_ID => $storeId, + UrlRewrite::ENTITY_ID => $this->product->getId(), + UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, + ] + ); + + $urlRewrites = []; + foreach ($currentUrlRewrites as $currentUrlRewrite) { + $category = $this->retrieveCategoryFromMetadata($currentUrlRewrite); + if ($category === false) { + continue; + } + $url = $currentUrlRewrite->getIsAutogenerated() + ? $this->generateForAutogenerated($currentUrlRewrite, $storeId, $category) + : $this->generateForCustom($currentUrlRewrite, $storeId, $category); + $urlRewrites = array_merge($urlRewrites, $url); + } + + $this->product = null; + $this->productCategories = null; + return $urlRewrites; + } + + /** + * @param UrlRewrite $url + * @param int $storeId + * @param Category|null $category + * @return array + */ + protected function generateForAutogenerated($url, $storeId, $category) + { + if (!$this->product->getData('save_rewrites_history')) { + return []; + } + $targetPath = $this->productUrlPathGenerator->getUrlPathWithSuffix($this->product, $storeId, $category); + if ($url->getRequestPath() === $targetPath) { + return []; + } + return [ + $this->urlRewriteBuilder + ->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE) + ->setEntityId($this->product->getId()) + ->setRequestPath($url->getRequestPath()) + ->setTargetPath($targetPath) + ->setRedirectType(OptionProvider::PERMANENT) + ->setStoreId($storeId) + ->setDescription($url->getDescription()) + ->setIsAutogenerated(0) + ->setMetadata($url->getMetadata()) + ->create() + ]; + } + + /** + * @param UrlRewrite $url + * @param int $storeId + * @param Category|null $category + * @return array + */ + protected function generateForCustom($url, $storeId, $category) + { + $targetPath = $url->getRedirectType() + ? $this->productUrlPathGenerator->getUrlPathWithSuffix($this->product, $storeId, $category) + : $url->getTargetPath(); + if ($url->getRequestPath() === $targetPath) { + return []; + } + return [ + $this->urlRewriteBuilder + ->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE) + ->setEntityId($this->product->getId()) + ->setRequestPath($url->getRequestPath()) + ->setTargetPath($targetPath) + ->setRedirectType($url->getRedirectType()) + ->setStoreId($storeId) + ->setDescription($url->getDescription()) + ->setIsAutogenerated(0) + ->setMetadata($url->getMetadata()) + ->create() + ]; + } + + /** + * @param UrlRewrite $url + * @return Category|null|bool + */ + protected function retrieveCategoryFromMetadata($url) + { + $metadata = $url->getMetadata(); + if (isset($metadata['category_id'])) { + $category = $this->productCategories->get($metadata['category_id']); + return $category === null ? false : $category; + } + return null; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/Observer.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/Observer.php index 9dfbb358ce570..11e44bf6160b9 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/Observer.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/Observer.php @@ -23,41 +23,33 @@ */ namespace Magento\CatalogUrlRewrite\Model\Product; -use Magento\CatalogUrlRewrite\Helper\Data as CatalogUrlRewriteHelper; -use Magento\CatalogUrlRewrite\Service\V1\ProductUrlGeneratorInterface; use Magento\Framework\Event\Observer as EventObserver; -use Magento\UrlRedirect\Service\V1\UrlSaveInterface; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\UrlRewrite\Model\UrlPersistInterface; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; class Observer { /** - * @var ProductUrlGeneratorInterface + * @var ProductUrlRewriteGenerator */ - protected $productUrlGenerator; + protected $productUrlRewriteGenerator; /** - * @var UrlSaveInterface + * @var UrlPersistInterface */ - protected $urlSave; + protected $urlPersist; /** - * @var CatalogUrlRewriteHelper - */ - protected $catalogUrlRewriteHelper; - - /** - * @param ProductUrlGeneratorInterface $productUrlGenerator - * @param UrlSaveInterface $urlSave - * @param CatalogUrlRewriteHelper $catalogUrlRewriteHelper + * @param ProductUrlRewriteGenerator $productUrlRewriteGenerator + * @param UrlPersistInterface $urlPersist */ public function __construct( - ProductUrlGeneratorInterface $productUrlGenerator, - UrlSaveInterface $urlSave, - CatalogUrlRewriteHelper $catalogUrlRewriteHelper + ProductUrlRewriteGenerator $productUrlRewriteGenerator, + UrlPersistInterface $urlPersist ) { - $this->productUrlGenerator = $productUrlGenerator; - $this->urlSave = $urlSave; - $this->catalogUrlRewriteHelper = $catalogUrlRewriteHelper; + $this->productUrlRewriteGenerator = $productUrlRewriteGenerator; + $this->urlPersist = $urlPersist; } /** @@ -71,12 +63,36 @@ public function processUrlRewriteSaving(EventObserver $observer) /** @var \Magento\Catalog\Model\Product $product */ $product = $observer->getEvent()->getProduct(); - if (!$product->getUrlPath() || $product->getOrigData('url_key') != $product->getData('url_key')) { - $product->setUrlPath($this->catalogUrlRewriteHelper->generateProductUrlKeyPath($product)); + $isChangedWebsites = $product->getIsChangedWebsites(); + if ($product->dataHasChangedFor('url_key') || $product->getIsChangedCategories() || $isChangedWebsites) { + if ($isChangedWebsites) { + $this->urlPersist->deleteByData([ + UrlRewrite::ENTITY_ID => $product->getId(), + UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, + ]); + } + $this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product)); } + } + + /** + * Remove product urls from storage + * + * @param \Magento\Framework\Event\Observer $observer + * @return void + */ + public function processUrlRewriteRemoving(EventObserver $observer) + { + /** @var \Magento\Catalog\Model\Product $product */ + $product = $observer->getEvent()->getProduct(); - if (!$product->getData('url_key') || $product->getOrigData('url_key') != $product->getData('url_key')) { - $this->urlSave->save($this->productUrlGenerator->generate($product)); + if ($product->getId()) { + $this->urlPersist->deleteByData( + [ + UrlRewrite::ENTITY_ID => $product->getId(), + UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, + ] + ); } } } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/Plugin/Import.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/Plugin/Import.php new file mode 100644 index 0000000000000..655ea14dac75d --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/Plugin/Import.php @@ -0,0 +1,105 @@ +productFactory = $productFactory; + $this->urlPersist = $urlPersist; + $this->productUrlRewriteGenerator = $productUrlRewriteGenerator; + } + + /** + * @param ImportProduct $import + * @param bool $result + * @return bool + */ + public function afterImportData(ImportProduct $import, $result) + { + if ($import->getAffectedEntityIds()) { + foreach ($import->getAffectedEntityIds() as $productId) { + $product = $this->productFactory->create()->load($productId); + $productUrls = $this->productUrlRewriteGenerator->generate($product); + if ($productUrls) { + $this->urlPersist->replace($productUrls); + } + } + } elseif (ImportExport::BEHAVIOR_DELETE == $import->getBehavior()) { + $this->clearProductUrls($import); + } + + return $result; + } + + /** + * @param ImportProduct $import + * @return void + */ + protected function clearProductUrls(ImportProduct $import) + { + $oldSku = $import->getOldSku(); + while ($bunch = $import->getNextBunch()) { + $idToDelete = []; + foreach ($bunch as $rowNum => $rowData) { + if ($import->validateRow($rowData, $rowNum) + && ImportProduct::SCOPE_DEFAULT == $import->getRowScope($rowData) + ) { + $idToDelete[] = $oldSku[$rowData[ImportProduct::COL_SKU]]['entity_id']; + } + } + foreach ($idToDelete as $productId) { + $this->urlPersist->deleteByData([ + UrlRewrite::ENTITY_ID => $productId, + UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, + ]); + } + } + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php new file mode 100644 index 0000000000000..be5e811e2484b --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php @@ -0,0 +1,138 @@ +storeManager = $storeManager; + $this->scopeConfig = $scopeConfig; + $this->categoryUrlPathGenerator = $categoryUrlPathGenerator; + } + + /** + * Retrieve Product Url path (with category if exists) + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Category $category + * + * @return string + */ + public function getUrlPath($product, $category = null) + { + $path = $product->getData('url_path'); + if ($path === null) { + $path = $this->generateUrlKey($product); + } + return $category === null ? $path + : $this->categoryUrlPathGenerator->getUrlPath($category) . '/' . $path; + } + + /** + * Retrieve Product Url path with suffix + * + * @param \Magento\Catalog\Model\Product $product + * @param int $storeId + * @param \Magento\Catalog\Model\Category $category + * @return string + */ + public function getUrlPathWithSuffix($product, $storeId, $category = null) + { + return $this->getUrlPath($product, $category) . $this->getProductUrlSuffix($storeId); + } + + /** + * Get canonical product url path + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Category|null $category + * @return string + */ + public function getCanonicalUrlPath($product, $category = null) + { + $path = 'catalog/product/view/id/' . $product->getId(); + return $category ? $path . '/category/' . $category->getId() : $path; + } + + /** + * Generate product url key based on url_key entered by merchant or product name + * + * @param \Magento\Catalog\Model\Product $product + * @return string + */ + public function generateUrlKey($product) + { + $urlKey = $product->getUrlKey(); + return $product->formatUrlKey($urlKey === '' || $urlKey === null ? $product->getName() : $urlKey); + } + + /** + * Retrieve product rewrite suffix for store + * + * @param int $storeId + * @return string + */ + protected function getProductUrlSuffix($storeId = null) + { + if (is_null($storeId)) { + $storeId = $this->storeManager->getStore()->getId(); + } + + if (!isset($this->productUrlSuffix[$storeId])) { + $this->productUrlSuffix[$storeId] = $this->scopeConfig->getValue( + self::XML_PATH_PRODUCT_URL_SUFFIX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } + return $this->productUrlSuffix[$storeId]; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php new file mode 100644 index 0000000000000..140749d6a1e64 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php @@ -0,0 +1,180 @@ +canonicalUrlRewriteGenerator = $canonicalUrlRewriteGenerator; + $this->currentUrlRewritesRegenerator = $currentUrlRewritesRegenerator; + $this->categoriesUrlRewriteGenerator = $categoriesUrlRewriteGenerator; + $this->objectRegistryFactory = $objectRegistryFactory; + $this->storeViewService = $storeViewService; + $this->storeManager = $storeManager; + } + + /** + * Generate product url rewrites + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + public function generate(Product $product) + { + $this->product = $product; + $storeId = $this->product->getStoreId(); + + $productCategories = $product->getCategoryCollection() + ->addAttributeToSelect('url_key') + ->addAttributeToSelect('url_path'); + + $urls = $this->isGlobalScope($storeId) + ? $this->generateForGlobalScope($productCategories) + : $this->generateForSpecificStoreView($storeId, $productCategories); + + $this->product = null; + return $urls; + } + + /** + * Check is global scope + * + * @param int|null $storeId + * @return bool + */ + protected function isGlobalScope($storeId) + { + return null === $storeId || $storeId == Store::DEFAULT_STORE_ID; + } + + /** + * Generate list of urls for global scope + * + * @param \Magento\Framework\Data\Collection $productCategories + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + protected function generateForGlobalScope($productCategories) + { + $urls = []; + $productId = $this->product->getId(); + foreach ($this->product->getStoreIds() as $id) { + if (!$this->isGlobalScope($id) + && !$this->storeViewService->doesEntityHaveOverriddenUrlKeyForStore($id, $productId, Product::ENTITY) + ) { + $urls = array_merge($urls, $this->generateForSpecificStoreView($id, $productCategories)); + } + } + return $urls; + } + + /** + * Generate list of urls for specific store view + * + * @param int $storeId + * @param \Magento\Framework\Data\Collection $productCategories + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ + protected function generateForSpecificStoreView($storeId, $productCategories) + { + $categories = []; + foreach ($productCategories as $category) { + if ($this->isCategoryProperForGenerating($category, $storeId)) { + $categories[] = $category; + } + } + $this->productCategories = $this->objectRegistryFactory->create(['entities' => $categories]); + $urls = array_merge( + $this->canonicalUrlRewriteGenerator->generate($storeId, $this->product), + $this->categoriesUrlRewriteGenerator->generate($storeId, $this->product, $this->productCategories), + $this->currentUrlRewritesRegenerator->generate($storeId, $this->product, $this->productCategories) + ); + $this->productCategories = null; + return $urls; + } + + /** + * @param \Magento\Catalog\Model\Category $category + * @param int $storeId + * @return bool + */ + protected function isCategoryProperForGenerating($category, $storeId) + { + if ($category->getParentId() != \Magento\Catalog\Model\Category::TREE_ROOT_ID) { + list(, $rootCategoryId) = $category->getParentIds(); + return $rootCategoryId == $this->storeManager->getStore($storeId)->getRootCategoryId(); + } + return false; + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Resource/Category/Product.php b/app/code/Magento/CatalogUrlRewrite/Model/Resource/Category/Product.php new file mode 100644 index 0000000000000..cd908d3bb6abc --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Resource/Category/Product.php @@ -0,0 +1,84 @@ +_init(self::TABLE_NAME, 'url_rewrite_id'); + } + + /** + * @param array $insertData + * @return int + */ + public function saveMultiple(array $insertData) + { + $write = $this->_getWriteAdapter(); + if (sizeof($insertData) <= self::CHUNK_SIZE) { + return $write->insertMultiple($this->getTable(self::TABLE_NAME), $insertData); + } + $data = array_chunk($insertData, self::CHUNK_SIZE); + $totalCount = 0; + foreach ($data as $insertData) { + $totalCount += $write->insertMultiple($this->getTable(self::TABLE_NAME), $insertData); + } + return $totalCount; + } + + /** + * @param array $removeData + * @return int + */ + public function removeMultiple(array $removeData) + { + $write = $this->_getWriteAdapter(); + return $write->delete($this->getTable(self::TABLE_NAME), array('url_rewrite_id in (?)' => $removeData)); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Resource/Category/ProductCollection.php b/app/code/Magento/CatalogUrlRewrite/Model/Resource/Category/ProductCollection.php new file mode 100644 index 0000000000000..cdef9b27ecb15 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Model/Resource/Category/ProductCollection.php @@ -0,0 +1,31 @@ +connection->select(); + $select->from(array('url_rewrite' => $this->resource->getTableName('url_rewrite'))) + ->joinLeft( + array('relation' => $this->resource->getTableName(Product::TABLE_NAME)), + 'url_rewrite.url_rewrite_id = relation.url_rewrite_id' + ) + ->where('url_rewrite.entity_id = ?', $data['entity_id']) + ->where('url_rewrite.entity_type = ?', $data['entity_type']) + ->where('url_rewrite.store_id = ?', $data['store_id']); + if (empty($data[UrlRewrite::METADATA]['category_id'])) { + $select->where('relation.category_id IS NULL'); + } else { + $select->where('relation.category_id = ?', $data[UrlRewrite::METADATA]['category_id']); + } + return $select; + } +} diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process/ListAction.php b/app/code/Magento/CatalogUrlRewrite/Observer/CategorySaveRewritesHistorySetter.php similarity index 58% rename from app/code/Magento/Index/Controller/Adminhtml/Process/ListAction.php rename to app/code/Magento/CatalogUrlRewrite/Observer/CategorySaveRewritesHistorySetter.php index b03a433d44c22..f3a8c6e4cd764 100644 --- a/app/code/Magento/Index/Controller/Adminhtml/Process/ListAction.php +++ b/app/code/Magento/CatalogUrlRewrite/Observer/CategorySaveRewritesHistorySetter.php @@ -1,6 +1,5 @@ _title->add(__('Index Management')); + /** @var Category $category */ + $category = $observer->getEvent()->getCategory(); + $data = $observer->getEvent()->getRequest()->getPost(); - $this->_view->loadLayout(); - $this->_setActiveMenu('Magento_Index::system_index'); - $this->_addContent($this->_view->getLayout()->createBlock('Magento\Index\Block\Adminhtml\Process')); - $this->_view->renderLayout(); + /** + * Create Permanent Redirect for old URL key + */ + if ($category->getId() && isset($data['general']['url_key_create_redirect'])) { + $category->setData('save_rewrites_history', (bool)$data['general']['url_key_create_redirect']); + } } } diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogenerator.php b/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogenerator.php new file mode 100644 index 0000000000000..52201a2023ca8 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogenerator.php @@ -0,0 +1,54 @@ +categoryUrlPathGenerator = $categoryUrlPathGenerator; + } + + /** + * @param Observer $observer + * @return void + */ + public function invoke(Observer $observer) + { + /** @var Category $category */ + $category = $observer->getEvent()->getCategory(); + $category->setUrlKey($this->categoryUrlPathGenerator->generateUrlKey($category)) + ->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category)); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/ProductUrlKeyAutogenerator.php b/app/code/Magento/CatalogUrlRewrite/Observer/ProductUrlKeyAutogenerator.php new file mode 100644 index 0000000000000..21d625ed74ca0 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Observer/ProductUrlKeyAutogenerator.php @@ -0,0 +1,53 @@ +productUrlPathGenerator = $productUrlPathGenerator; + } + + /** + * @param Observer $observer + * @return void + */ + public function invoke(Observer $observer) + { + /** @var Product $product */ + $product = $observer->getEvent()->getProduct(); + $product->setUrlKey($this->productUrlPathGenerator->generateUrlKey($product)); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Block/Adminhtml/Category/Tab/Attributes.php b/app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Block/Adminhtml/Category/Tab/Attributes.php new file mode 100644 index 0000000000000..27072a8d4ed22 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Block/Adminhtml/Category/Tab/Attributes.php @@ -0,0 +1,57 @@ +getForm(); + $fieldset = $form->getElements()[0]; + $field = $form->getElement('url_key'); + if ($field) { + if ($subject->getCategory()->getLevel() == 1) { + $fieldset->removeField('url_key'); + $fieldset->addField( + 'url_key', + 'hidden', + array('name' => 'url_key', 'value' => $subject->getCategory()->getUrlKey()) + ); + } else { + $field->setRenderer( + $subject->getLayout()->createBlock('Magento\CatalogUrlRewrite\Block\UrlKeyRenderer') + ); + } + } + return $result; + } +} diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Msrp/Price.php b/app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php similarity index 53% rename from app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Msrp/Price.php rename to app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php index ba23be189a1ae..006d09c09cc5a 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Msrp/Price.php +++ b/app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php @@ -21,26 +21,26 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\CatalogUrlRewrite\Plugin\Catalog\Block\Adminhtml\Product\Edit\Tab; -/** - * Product form MSRP field helper - * - * @author Magento Core Team - */ -namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Msrp; - -class Price extends \Magento\Framework\Data\Form\Element\Select +class Attributes { /** - * Retrieve Element HTML fragment - * - * @return string + * @param \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes $subject + * @param \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes $result + * @return \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes */ - public function getElementHtml() - { - if (is_null($this->getValue())) { - $this->setValue(\Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type\Price::TYPE_USE_CONFIG); + public function afterSetForm( + \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes $subject, + \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes $result + ) { + $form = $subject->getForm(); + $field = $form->getElement('url_key'); + if ($field) { + $field->setRenderer( + $subject->getLayout()->createBlock('Magento\CatalogUrlRewrite\Block\UrlKeyRenderer') + ); } - return parent::getElementHtml(); + return $result; } } diff --git a/app/code/Magento/UrlRewrite/App/FrontController/Plugin/UrlRewrite.php b/app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php similarity index 55% rename from app/code/Magento/UrlRewrite/App/FrontController/Plugin/UrlRewrite.php rename to app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php index be99bf62d82bd..d8bacc6458b34 100644 --- a/app/code/Magento/UrlRewrite/App/FrontController/Plugin/UrlRewrite.php +++ b/app/code/Magento/CatalogUrlRewrite/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php @@ -1,7 +1,5 @@ _rewriteService = $rewriteService; + $this->request = $request; } /** - * Perform url rewrites - * - * @param \Magento\Framework\App\FrontController $subject - * @param callable $proceed - * @param \Magento\Framework\App\RequestInterface $request - * - * @return \Magento\Framework\App\ResponseInterface + * @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $subject + * @param \Magento\Catalog\Model\Product $result + * @return \Magento\Catalog\Model\Product * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDispatch( - \Magento\Framework\App\FrontController $subject, - \Closure $proceed, - \Magento\Framework\App\RequestInterface $request + public function afterInitialize( + \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $subject, + \Magento\Catalog\Model\Product $result ) { - $this->_rewriteService->applyRewrites($request); - return $proceed($request); + $productData = $this->request->getPost('product'); + /** + * Create Permanent Redirect for old URL key + */ + if ($result->getId() && isset($productData['url_key_create_redirect'])) { + $result->setData('save_rewrites_history', (bool)$productData['url_key_create_redirect']); + } + return $result; } } diff --git a/app/code/Magento/CatalogUrlRewrite/Service/V1/AbstractUrlGenerator.php b/app/code/Magento/CatalogUrlRewrite/Service/V1/AbstractUrlGenerator.php deleted file mode 100644 index 73abbe199ddaf..0000000000000 --- a/app/code/Magento/CatalogUrlRewrite/Service/V1/AbstractUrlGenerator.php +++ /dev/null @@ -1,40 +0,0 @@ -filterFactory = $filterFactory; - $this->storeManager = $storeManager; - $this->urlMatcher = $urlMatcher; - $this->catalogUrlRewriteHelper = $catalogUrlRewriteHelper; - } - - /** - * {@inheritdoc} - */ - public function generate($category) - { - $this->category = $category; - $storeId = $this->category->getStoreId(); - - $urls = $this->catalogUrlRewriteHelper->isDefaultStore($storeId) - ? $this->generateForDefaultStore() : $this->generateForStore($storeId); - - $this->category = null; - return $urls; - } - - /** - * Generate list of urls for default store - * - * @return UrlRewrite[] - */ - protected function generateForDefaultStore() - { - $urls = []; - foreach ($this->storeManager->getStores() as $store) { - if ($this->catalogUrlRewriteHelper->isNeedCreateUrlRewrite( - $store->getStoreId(), - $this->category->getId() - )) { - $urls = array_merge($urls, $this->generateForStore($store->getStoreId())); - } - } - return $urls; - } - - /** - * Generate list of urls per store - * - * @param int $storeId - * @return UrlRewrite[] - */ - protected function generateForStore($storeId) - { - $urls[] = $this->createUrlRewrite( - $storeId, - $this->catalogUrlRewriteHelper->getCategoryUrlKeyPath($this->category), - $this->catalogUrlRewriteHelper->getCategoryCanonicalUrlPath($this->category) - ); - - return array_merge($urls, $this->generateRewritesBasedOnCurrentRewrites($storeId)); - } - - /** - * Generate permanent rewrites based on current rewrites - * - * @param int $storeId - * @return array - */ - protected function generateRewritesBasedOnCurrentRewrites($storeId) - { - $urls = []; - foreach ($this->urlMatcher->findAllByFilter($this->createCurrentUrlRewritesFilter($storeId)) as $url) { - $targetPath = null; - if ($url->getRedirectType()) { - $targetPath = str_replace( - $this->category->getOrigData('url_key'), - $this->category->getData('url_key'), - $url->getTargetPath() - ); - $redirectType = $url->getRedirectType(); - } elseif ($this->category->getData('save_rewrites_history')) { - $targetPath = str_replace( - $this->category->getOrigData('url_key'), - $this->category->getData('url_key'), - $url->getRequestPath() - ); - $redirectType = OptionProvider::PERMANENT; - } - - if ($targetPath && $url->getRequestPath() != $targetPath) { - $urls[] = $this->createUrlRewrite($storeId, $url->getRequestPath(), $targetPath, $redirectType); - } - } - return $urls; - } - - /** - * @param int $storeId - * @return \Magento\UrlRedirect\Service\V1\Data\Filter - */ - protected function createCurrentUrlRewritesFilter($storeId) - { - /** @var \Magento\UrlRedirect\Service\V1\Data\Filter $filter */ - $filter = $this->filterFactory->create(); - - $filter->setStoreId($storeId); - $filter->setEntityId($this->category->getId()); - $filter->setEntityType(self::ENTITY_TYPE_CATEGORY); - return $filter; - } - - /** - * Create url rewrite object - * - * @param int $storeId - * @param string $requestPath - * @param string $targetPath - * @param string|null $redirectType Null or one of OptionProvider const - * @return UrlRewrite - */ - protected function createUrlRewrite($storeId, $requestPath, $targetPath, $redirectType = null) - { - return $this->catalogUrlRewriteHelper->createUrlRewrite( - self::ENTITY_TYPE_CATEGORY, - $this->category->getId(), - $storeId, - $requestPath, - $targetPath, - $redirectType - ); - } -} diff --git a/app/code/Magento/CatalogUrlRewrite/Service/V1/ProductUrlGenerator.php b/app/code/Magento/CatalogUrlRewrite/Service/V1/ProductUrlGenerator.php deleted file mode 100644 index a41fd154e90ff..0000000000000 --- a/app/code/Magento/CatalogUrlRewrite/Service/V1/ProductUrlGenerator.php +++ /dev/null @@ -1,254 +0,0 @@ -filterFactory = $filterFactory; - $this->storeManager = $storeManager; - $this->urlMatcher = $urlMatcher; - $this->catalogUrlRewriteHelper = $catalogUrlRewriteHelper; - } - - /** - * {@inheritdoc} - */ - public function generate($product) - { - $this->product = $product; - $storeId = $this->product->getStoreId(); - - $urls = $this->catalogUrlRewriteHelper->isDefaultStore($storeId) - ? $this->generateForDefaultStore() : $this->generateForStore($storeId); - - $this->product = null; - $this->categories = null; - return $urls; - } - - /** - * {@inheritdoc} - */ - public function generateWithChangedCategories($product, $changedCategories) - { - $this->changedCategories = $changedCategories; - - return $this->generate($product); - } - - /** - * Generate list of urls for default store - * - * @return \Magento\UrlRedirect\Service\V1\Data\UrlRewrite[] - */ - protected function generateForDefaultStore() - { - $urls = []; - foreach ($this->storeManager->getStores() as $store) { - if ($this->catalogUrlRewriteHelper->isNeedCreateUrlRewrite($store->getStoreId(), $this->product->getId())) { - $urls = array_merge($urls, $this->generateForStore($store->getStoreId())); - } - } - return $urls; - } - - /** - * Generate list of urls per store - * - * @param int $storeId - * @return \Magento\UrlRedirect\Service\V1\Data\UrlRewrite[] - */ - protected function generateForStore($storeId) - { - $urls[] = $this->createUrlRewrite( - $storeId, - $this->catalogUrlRewriteHelper->getProductUrlKeyPath($this->product, $storeId), - $this->catalogUrlRewriteHelper->getProductCanonicalUrlPath($this->product) - ); - - foreach ($this->getCategories() as $category) { - if (isset($this->changedCategories[$category->getId()])) { - $category = $this->changedCategories[$category->getId()]; - } - - if ($this->catalogUrlRewriteHelper->isRootCategory($category)) { - continue; - } - $urls[] = $this->createUrlRewrite( - $storeId, - $this->catalogUrlRewriteHelper->getProductUrlKeyPathWithCategory($this->product, $category, $storeId), - $this->catalogUrlRewriteHelper->getProductCanonicalUrlPathWithCategory($this->product, $category) - ); - } - return array_merge($urls, $this->generateRewritesBasedOnCurrentRewrites($storeId)); - } - - /** - * Generate permanent rewrites based on current rewrites - * - * @param int $storeId - * @return array - */ - protected function generateRewritesBasedOnCurrentRewrites($storeId) - { - $urls = []; - foreach ($this->urlMatcher->findAllByFilter($this->createCurrentUrlRewritesFilter($storeId)) as $url) { - $targetPath = null; - if ($url->getRedirectType()) { - $targetPath = str_replace( - $this->product->getOrigData('url_key'), - $this->product->getData('url_key'), - $url->getTargetPath() - ); - $redirectType = $url->getRedirectType(); - } elseif ($this->product->getData('save_rewrites_history')) { - $targetPath = str_replace( - $this->product->getOrigData('url_key'), - $this->product->getData('url_key'), - $url->getRequestPath() - ); - $redirectType = OptionProvider::PERMANENT; - } - - if ($targetPath && $url->getRequestPath() != $targetPath) { - $urls[] = $this->createUrlRewrite($storeId, $url->getRequestPath(), $targetPath, $redirectType); - } - } - return $urls; - } - - /** - * @param int $storeId - * @return \Magento\UrlRedirect\Service\V1\Data\Filter - */ - protected function createCurrentUrlRewritesFilter($storeId) - { - /** @var \Magento\UrlRedirect\Service\V1\Data\Filter $filter */ - $filter = $this->filterFactory->create(); - - $filter->setStoreId($storeId); - $filter->setEntityId($this->product->getId()); - $filter->setEntityType(self::ENTITY_TYPE_PRODUCT); - return $filter; - } - - /** - * Get categories assigned to product - * - * @return \Magento\Catalog\Model\Resource\Category\Collection - */ - protected function getCategories() - { - if (!$this->categories) { - $this->categories = $this->product->getCategoryCollection(); - $this->categories->addAttributeToSelect('url_key'); - $this->categories->addAttributeToSelect('url_path'); - } - return $this->categories; - } - - /** - * Create url rewrite object - * - * @param int $storeId - * @param string $requestPath - * @param string $targetPath - * @param string|null $redirectType Null or one of OptionProvider const - * @return \Magento\UrlRedirect\Service\V1\Data\UrlRewrite - */ - protected function createUrlRewrite($storeId, $requestPath, $targetPath, $redirectType = null) - { - return $this->catalogUrlRewriteHelper->createUrlRewrite( - self::ENTITY_TYPE_PRODUCT, - $this->product->getId(), - $storeId, - $requestPath, - $targetPath, - $redirectType - ); - } -} diff --git a/app/code/Magento/CatalogUrlRewrite/Service/V1/ProductUrlGeneratorInterface.php b/app/code/Magento/CatalogUrlRewrite/Service/V1/ProductUrlGeneratorInterface.php deleted file mode 100644 index 75daa35a4df70..0000000000000 --- a/app/code/Magento/CatalogUrlRewrite/Service/V1/ProductUrlGeneratorInterface.php +++ /dev/null @@ -1,45 +0,0 @@ -eavConfig = $eavConfig; + $this->connection = $resource->getConnection(Resource::DEFAULT_READ_RESOURCE); + } + + /** + * Check that entity has overridden url key for specific store + * + * @param int $storeId + * @param int $entityId + * @param string $entityType + * @throws \InvalidArgumentException + * @return bool + */ + public function doesEntityHaveOverriddenUrlKeyForStore($storeId, $entityId, $entityType) + { + $attribute = $this->eavConfig->getAttribute($entityType, 'url_key'); + if (!$attribute) { + throw new \InvalidArgumentException(sprintf('Cannot retrieve attribute for entity type "%s"', $entityType)); + } + $select = $this->connection->select() + ->from($attribute->getBackendTable(), 'store_id') + ->where('attribute_id = ?', $attribute->getId()) + ->where('entity_id = ?', $entityId); + + return in_array($storeId, $this->connection->fetchCol($select)); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json index 5eecd5076d810..0eb731ddbca00 100644 --- a/app/code/Magento/CatalogUrlRewrite/composer.json +++ b/app/code/Magento/CatalogUrlRewrite/composer.json @@ -3,15 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-store": "0.1.0-alpha96", - "magento/module-url-redirect": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-catalog-import-export": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-import-export": "0.1.0-alpha97", + "magento/module-store": "0.1.0-alpha97", + "magento/module-url-rewrite": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/data-install-1.0.0.0.php b/app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/data-install-1.0.0.0.php new file mode 100644 index 0000000000000..3f96decf0e1bd --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/data-install-1.0.0.0.php @@ -0,0 +1,76 @@ +addAttribute( + \Magento\Catalog\Model\Category::ENTITY, + 'url_key', + array( + 'type' => 'varchar', + 'label' => 'URL Key', + 'input' => 'text', + 'required' => false, + 'sort_order' => 3, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'group' => 'General Information' + ) +); + +$this->addAttribute( + \Magento\Catalog\Model\Category::ENTITY, + 'url_path', + array( + 'type' => 'varchar', + 'required' => false, + 'sort_order' => 17, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'visible' => false, + ) +); + +$this->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'url_key', + array( + 'type' => 'varchar', + 'label' => 'URL Key', + 'input' => 'text', + 'required' => false, + 'sort_order' => 10, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'used_in_product_listing' => true, + 'group' => 'Search Engine Optimization' + ) +); + +$this->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'url_path', + array( + 'type' => 'varchar', + 'required' => false, + 'sort_order' => 11, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'visible' => false, + ) +); diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml index 7f2e29067ac83..53e8834d9a387 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml @@ -24,6 +24,31 @@ */ --> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml index 1b6588ba29311..f6395efefd8e3 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml @@ -24,10 +24,25 @@ */ --> - - + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml new file mode 100644 index 0000000000000..8b993c27ad842 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml @@ -0,0 +1,52 @@ + + + + +
+ + + + + Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix + You need to refresh the cache. + + + + Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix + You need to refresh the cache. + + + + Magento\Backend\Model\Config\Source\Yesno + + + + Magento\Backend\Model\Config\Source\Yesno + + +
+
+
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml b/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml new file mode 100644 index 0000000000000..3c6a01f297bad --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/app/code/Magento/Index/etc/di.xml b/app/code/Magento/CatalogUrlRewrite/etc/di.xml similarity index 70% rename from app/code/Magento/Index/etc/di.xml rename to app/code/Magento/CatalogUrlRewrite/etc/di.xml index 6a08ca9a1bbc1..fd53baf5d4314 100644 --- a/app/code/Magento/Index/etc/di.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/di.xml @@ -24,11 +24,20 @@ */ --> - + + + Magento\CatalogUrlRewrite\Model\Storage\DbStorage + + + + + Magento\CatalogUrlRewrite\Model\Storage\DbStorage + + - Magento\Index\Model\Resource\Setup + Magento\Catalog\Model\Resource\Setup diff --git a/app/code/Magento/Catalog/etc/indexers.xml b/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml similarity index 82% rename from app/code/Magento/Catalog/etc/indexers.xml rename to app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml index 52135bd75d703..bf11cd002cd4e 100644 --- a/app/code/Magento/Catalog/etc/indexers.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml @@ -23,6 +23,10 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - + + + + + + diff --git a/app/code/Magento/UrlRedirect/etc/frontend/di.xml b/app/code/Magento/CatalogUrlRewrite/etc/install/di.xml similarity index 68% rename from app/code/Magento/UrlRedirect/etc/frontend/di.xml rename to app/code/Magento/CatalogUrlRewrite/etc/install/di.xml index 7b7acb7b3de3d..51d426c2e2b19 100644 --- a/app/code/Magento/UrlRedirect/etc/frontend/di.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/install/di.xml @@ -24,15 +24,13 @@ */ --> - - - - - Magento\UrlRedirect\Controller\Router - false - 40 - - - + + + + + + + + diff --git a/app/code/Magento/CatalogUrlRewrite/etc/install/events.xml b/app/code/Magento/CatalogUrlRewrite/etc/install/events.xml new file mode 100644 index 0000000000000..39b12d18bcc16 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/etc/install/events.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/CatalogUrlRewrite/etc/module.xml b/app/code/Magento/CatalogUrlRewrite/etc/module.xml index 1ff2849f6f22e..8048acf4c5b97 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/module.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/module.xml @@ -24,12 +24,18 @@ */ --> - + + + + + + + - + diff --git a/app/code/Magento/Cms/sql/cms_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-1.0.0.0.php similarity index 56% rename from app/code/Magento/Cms/sql/cms_setup/upgrade-1.6.0.1-1.6.0.2.php rename to app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-1.0.0.0.php index 1b13eb808b235..8d0157ef98034 100644 --- a/app/code/Magento/Cms/sql/cms_setup/upgrade-1.6.0.1-1.6.0.2.php +++ b/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-1.0.0.0.php @@ -17,54 +17,64 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/* @var $installer \Magento\Framework\Module\Setup */ $installer = $this; -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ + +$installer->startSetup(); + +$tableName = \Magento\CatalogUrlRewrite\Model\Resource\Category\Product::TABLE_NAME; $table = $installer->getConnection()->newTable( - $installer->getTable('cms_url_rewrite') + $installer->getTable($tableName) )->addColumn( - 'cms_rewrite_id', + 'url_rewrite_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Cms Url Rewrite ID' + array('unsigned' => true, 'nullable' => false), + 'url_rewrite_id' )->addColumn( - 'url_rewrite_id', + 'category_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false), - 'Core Url Rewrite ID' + 'category_id' +)->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false), + 'product_id' )->addIndex( - $installer->getIdxName('cms_url_rewrite', array('url_rewrite_id')), - array('url_rewrite_id') + $installer->getIdxName($tableName, array('category_id', 'product_id')), + array('category_id', 'product_id') )->addForeignKey( - $installer->getFkName('cms_url_rewrite', 'url_rewrite_id', 'core_url_rewrite', 'url_rewrite_id'), - 'url_rewrite_id', - $installer->getTable('core_url_rewrite'), - 'url_rewrite_id', + $installer->getFkName($tableName, 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName($tableName, 'category_id', 'catalog_category_entity', 'entity_id'), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addColumn( - 'cms_page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('nullable' => false), - 'Cms Page ID' -)->addIndex( - $installer->getIdxName('cms_url_rewrite', array('cms_page_id')), - array('cms_page_id') )->addForeignKey( - $installer->getFkName('cms_url_rewrite', 'cms_page_id', 'cms_page', 'page_id'), - 'cms_page_id', - $installer->getTable('cms_page'), - 'page_id', + $installer->getFkName($tableName, 'url_rewrite_id', 'url_rewrite', 'url_rewrite_id'), + 'url_rewrite_id', + $installer->getTable('url_rewrite'), + 'url_rewrite_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( - 'Cms Url Rewrite Table' + 'url_rewrite_relation' ); $installer->getConnection()->createTable($table); + +$installer->endSetup(); diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json index a8e60e9de4a3d..0ca946052efe6 100644 --- a/app/code/Magento/Centinel/composer.json +++ b/app/code/Magento/Centinel/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Checkout/Block/Cart.php b/app/code/Magento/Checkout/Block/Cart.php index d9b2583fc9a58..c781da4bed66b 100644 --- a/app/code/Magento/Checkout/Block/Cart.php +++ b/app/code/Magento/Checkout/Block/Cart.php @@ -45,7 +45,6 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Catalog\Model\Resource\Url $catalogUrlBuilder @@ -55,7 +54,6 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Model\Resource\Url $catalogUrlBuilder, @@ -65,7 +63,7 @@ public function __construct( ) { $this->_cartHelper = $cartHelper; $this->_catalogUrlBuilder = $catalogUrlBuilder; - parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + parent::__construct($context, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; $this->httpContext = $httpContext; } diff --git a/app/code/Magento/Checkout/Block/Cart/AbstractCart.php b/app/code/Magento/Checkout/Block/Cart/AbstractCart.php index d0764c03d44ba..dbcb156887fae 100644 --- a/app/code/Magento/Checkout/Block/Cart/AbstractCart.php +++ b/app/code/Magento/Checkout/Block/Cart/AbstractCart.php @@ -50,13 +50,6 @@ class AbstractCart extends \Magento\Framework\View\Element\Template */ protected $_itemRenders = array(); - /** - * Catalog data - * - * @var \Magento\Catalog\Helper\Data - */ - protected $_catalogData = null; - /** * @var \Magento\Customer\Model\Session */ @@ -69,21 +62,18 @@ class AbstractCart extends \Magento\Framework\View\Element\Template /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, array $data = array() ) { $this->_customerSession = $customerSession; $this->_checkoutSession = $checkoutSession; - $this->_catalogData = $catalogData; parent::__construct($context, $data); $this->_isScopePrivate = true; } @@ -176,17 +166,4 @@ public function getTotalsCache() } return $this->_totals; } - - /** - * Check if can apply msrp to totals - * - * @return bool - */ - public function canApplyMsrp() - { - if (!$this->getQuote()->hasCanApplyMsrp() && $this->_catalogData->isMsrpEnabled()) { - $this->getQuote()->collectTotals(); - } - return $this->getQuote()->getCanApplyMsrp(); - } } diff --git a/app/code/Magento/Checkout/Block/Cart/Coupon.php b/app/code/Magento/Checkout/Block/Cart/Coupon.php index dbdd89d06ce46..8da8677fd715f 100644 --- a/app/code/Magento/Checkout/Block/Cart/Coupon.php +++ b/app/code/Magento/Checkout/Block/Cart/Coupon.php @@ -27,19 +27,17 @@ class Coupon extends \Magento\Checkout\Block\Cart\AbstractCart { /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, array $data = array() ) { - parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + parent::__construct($context, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index e28bcf056af1a..3f44aca2592b9 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -63,7 +63,6 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Directory\Block\Data $directoryBlock @@ -73,7 +72,6 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Directory\Block\Data $directoryBlock, @@ -84,7 +82,7 @@ public function __construct( $this->priceCurrency = $priceCurrency; $this->_directoryBlock = $directoryBlock; $this->_carrierFactory = $carrierFactory; - parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + parent::__construct($context, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php index d54530e2f6741..5371bfb1e6e9c 100644 --- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php +++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php @@ -53,7 +53,6 @@ class Sidebar extends AbstractCart implements IdentityInterface /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Catalog\Model\Resource\Url $catalogUrl @@ -65,7 +64,6 @@ class Sidebar extends AbstractCart implements IdentityInterface */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Model\Resource\Url $catalogUrl, @@ -76,7 +74,7 @@ public function __construct( $this->_checkoutHelper = $checkoutHelper; $this->_catalogUrl = $catalogUrl; $this->_checkoutCart = $checkoutCart; - parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + parent::__construct($context, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Checkout/Block/Cart/Totals.php b/app/code/Magento/Checkout/Block/Cart/Totals.php index ed585a6046c91..07b6c04b626bc 100644 --- a/app/code/Magento/Checkout/Block/Cart/Totals.php +++ b/app/code/Magento/Checkout/Block/Cart/Totals.php @@ -49,7 +49,6 @@ class Totals extends \Magento\Checkout\Block\Cart\AbstractCart /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Sales\Model\Config $salesConfig @@ -57,14 +56,13 @@ class Totals extends \Magento\Checkout\Block\Cart\AbstractCart */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\Config $salesConfig, array $data = array() ) { $this->_salesConfig = $salesConfig; - parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + parent::__construct($context, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Checkout/Block/Shipping/Price.php b/app/code/Magento/Checkout/Block/Shipping/Price.php index aa28b3e97b6ad..3a2d573174ed8 100644 --- a/app/code/Magento/Checkout/Block/Shipping/Price.php +++ b/app/code/Magento/Checkout/Block/Shipping/Price.php @@ -41,7 +41,6 @@ class Price extends AbstractCart /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param PriceCurrencyInterface $priceCurrency @@ -49,14 +48,13 @@ class Price extends AbstractCart */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, PriceCurrencyInterface $priceCurrency, array $data = array() ) { $this->priceCurrency = $priceCurrency; - parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + parent::__construct($context, $customerSession, $checkoutSession, $data); } diff --git a/app/code/Magento/Checkout/Block/Total/Nominal.php b/app/code/Magento/Checkout/Block/Total/Nominal.php index 8fa5499620962..6eb39530aba0b 100644 --- a/app/code/Magento/Checkout/Block/Total/Nominal.php +++ b/app/code/Magento/Checkout/Block/Total/Nominal.php @@ -44,7 +44,6 @@ class Nominal extends \Magento\Checkout\Block\Total\DefaultTotal /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Sales\Model\Config $salesConfig @@ -53,7 +52,6 @@ class Nominal extends \Magento\Checkout\Block\Total\DefaultTotal */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\Config $salesConfig, @@ -61,7 +59,7 @@ public function __construct( array $data = array() ) { $this->priceCurrency = $priceCurrency; - parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $salesConfig, $data); + parent::__construct($context, $customerSession, $checkoutSession, $salesConfig, $data); } /** diff --git a/app/code/Magento/Checkout/Controller/Cart/Index.php b/app/code/Magento/Checkout/Controller/Cart/Index.php index 4f7b5e439c0ad..25423c7e0f86c 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Index.php +++ b/app/code/Magento/Checkout/Controller/Cart/Index.php @@ -90,7 +90,7 @@ public function execute() $this->_view->loadLayout(); $layout = $this->_view->getLayout(); $layout->initMessages(); - $layout->getBlock('head')->setTitle(__('Shopping Cart')); + $this->_view->getPage()->getConfig()->setTitle(__('Shopping Cart')); $this->_view->renderLayout(); \Magento\Framework\Profiler::stop(__METHOD__ . 'cart_display'); } diff --git a/app/code/Magento/Checkout/Controller/Onepage.php b/app/code/Magento/Checkout/Controller/Onepage.php old mode 100755 new mode 100644 diff --git a/app/code/Magento/Checkout/Controller/Onepage/Index.php b/app/code/Magento/Checkout/Controller/Onepage/Index.php index d83225b5114a1..2d29c3831d40a 100644 --- a/app/code/Magento/Checkout/Controller/Onepage/Index.php +++ b/app/code/Magento/Checkout/Controller/Onepage/Index.php @@ -56,7 +56,7 @@ public function execute() $this->_view->loadLayout(); $layout = $this->_view->getLayout(); $layout->initMessages(); - $layout->getBlock('head')->setTitle(__('Checkout')); + $this->_view->getPage()->getConfig()->setTitle(__('Checkout')); $this->_view->renderLayout(); } } diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index a3760e04cedc7..ffdfb5c0d999c 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -466,7 +466,11 @@ public function suggestItemsQty($data) */ public function updateItems($data) { - $this->_eventManager->dispatch('checkout_cart_update_items_before', array('cart' => $this, 'info' => $data)); + $infoDataObject = new \Magento\Framework\Object($data); + $this->_eventManager->dispatch( + 'checkout_cart_update_items_before', + ['cart' => $this, 'info' => $infoDataObject] + ); $qtyRecalculatedFlag = false; foreach ($data as $itemId => $itemInfo) { @@ -506,7 +510,10 @@ public function updateItems($data) ); } - $this->_eventManager->dispatch('checkout_cart_update_items_after', array('cart' => $this, 'info' => $data)); + $this->_eventManager->dispatch( + 'checkout_cart_update_items_after', + ['cart' => $this, 'info' => $infoDataObject] + ); return $this; } diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index 241e2ac7bace3..772f86efbdb04 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -3,26 +3,27 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-authorization": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-gift-message": "0.1.0-alpha96", - "magento/module-wishlist": "0.1.0-alpha96", - "magento/module-page-cache": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-authorization": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-gift-message": "0.1.0-alpha97", + "magento/module-wishlist": "0.1.0-alpha97", + "magento/module-page-cache": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-msrp": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml index f2e9d84340a4f..233bb2da2606a 100644 --- a/app/code/Magento/Checkout/etc/module.xml +++ b/app/code/Magento/Checkout/etc/module.xml @@ -44,6 +44,7 @@ + diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml index b77f099b0b0fe..25fb62bcbdce0 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml @@ -36,7 +36,9 @@ - + + + diff --git a/app/code/Magento/Checkout/view/frontend/layout/default.xml b/app/code/Magento/Checkout/view/frontend/layout/default.xml index 959321b5f8281..a006c4df8299c 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/default.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/default.xml @@ -33,6 +33,9 @@ + + + diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml index c94ff5af7e441..14f01d2cf9d76 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml @@ -25,8 +25,11 @@ /** @var $this \Magento\Checkout\Block\Cart\Item\Renderer */ $_item = $this->getItem(); -$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility(); -$canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_item->getProduct(), \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type::TYPE_BEFORE_ORDER_CONFIRM); +$product = $_item->getProduct(); +$isVisibleProduct = $product->isVisibleInSiteVisibility(); +/** @var \Magento\Msrp\Helper\Data $helper */ +$helper = $this->helper('Magento\Msrp\Helper\Data'); +$canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinimalPriceLessMsrp($product); ?> @@ -82,25 +85,19 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite getId(); ?> - getProduct(); ?> - formatPrice($_item->getCalculationPrice()) ?>", - "msrpPrice": "helper('Magento\Core\Helper\Data')->currency($_product->getMsrp(),true,true) ?>", - "showAddToCart": false}}'> + helper('Magento\Core\Helper\Data'); ?> + + - - getUnitPriceHtml($_item); ?> - - + + getUnitPriceHtml($_item); ?> + + diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml index cae1afcee5c72..b5f5770ffdf0b 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml @@ -25,9 +25,7 @@ /** @var $this \Magento\Checkout\Block\Item\Price\Renderer */ ?> getItem() ?> -
-
- - helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> -
+
+ + helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml index 319c68dbc82c4..9bdb695caaf98 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml @@ -21,7 +21,6 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ - /** @var $this \Magento\Checkout\Block\Cart\Sidebar */ ?> getInList()): ?> @@ -68,18 +67,7 @@ getAllowCartLink()): ?> isPossibleOnepageCheckout() ?> -
- canApplyMsrp()): ?> - - - - - - - - getTotalsHtml() ?> - -
+ getChildHtml('subtotal'); ?> getChildHtml('minicart_info') ?>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml index 80b6c5762b640..028bc8203bd08 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml @@ -105,7 +105,7 @@ require([ getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" /> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml index a06f9acf686a0..f12f42d4dd706 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml @@ -21,26 +21,30 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ - +?> +getItem(); +$product = $_item->getProduct(); +/** @var \Magento\Msrp\Helper\Data $helper */ +$helper = $this->helper('Magento\Msrp\Helper\Data'); +$canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinimalPriceLessMsrp($product); +$imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Image') ?> -getItem() ?> -helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_item->getProduct(), \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type::TYPE_BEFORE_ORDER_CONFIRM); ?> -getLayout()->createBlock('Magento\Catalog\Block\Product\Image')?>
  • -
    - hasProductUrl()): ?> - - init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail')->toHtml() ?> - - - - init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail')->toHtml() ?> - - +
    + hasProductUrl()): ?> + + init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail')->toHtml() ?> + + + + init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail')->toHtml() ?> + + -
    - +
    + hasProductUrl()): ?> escapeHtml($this->getProductName()) ?> @@ -70,38 +74,39 @@
    - + +
    + - - -
    - - -
    +
    + + +
    - - getSidebarItemPriceHtml($_item); ?> - + + getSidebarItemPriceHtml($_item); ?> + -
    - - getQty() ?> +
    + + getQty() ?> +
    -
    - getProduct()->isVisibleInSiteVisibility()):?> -
    - -
    - -
    -
  • diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/subtotal.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/subtotal.phtml new file mode 100644 index 0000000000000..ead8da3883b55 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/subtotal.phtml @@ -0,0 +1,31 @@ + +
    + + + + getTotalsHtml() ?> +
    diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/totals.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/totals.phtml index 16b3b3389b5ee..61fac6d51e206 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/totals.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/totals.phtml @@ -29,14 +29,10 @@ */ ?>
    -canApplyMsrp()): ?> -
    - renderTotals(); ?> renderTotals('footer'); ?>
    -
    diff --git a/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml index f521c33736b19..854b9b033fec0 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml @@ -26,8 +26,8 @@ $_item = $this->getItem(); ?> - - + + helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml index 8da9e3d05c6ff..4f16aec9f0067 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml @@ -26,8 +26,8 @@ $_item = $this->getItem(); ?> - - + + helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml index 5691c5ce71dab..93c9ac461abe2 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml @@ -125,7 +125,7 @@
    - +
    diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/info.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/info.phtml index 9c541610eccb0..f8ac576a95d96 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/info.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/info.phtml @@ -31,19 +31,11 @@ Order Review - - - - + + + + - helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(false) ?> - helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(true) ?> - helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(false) ?> - helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(true) ?> - - getChildHtml('totals'); ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml index b88c21432ee00..ce95274d4ef25 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml @@ -51,25 +51,29 @@ $_item = $this->getItem(); setItem($_item)->toHtml() ?> - helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - getUnitPriceExclTaxHtml($_item); ?> + + helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + + getUnitPriceInclTaxHtml($_item); ?> + + + helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + + getUnitPriceExclTaxHtml($_item); ?> + + - - helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - getUnitPriceInclTaxHtml($_item); ?> + getQty() ?> + + helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + + getRowTotalInclTaxHtml($_item); ?> + + + helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + + getRowTotalExclTaxHtml($_item); ?> + + - - getQty() ?> - helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - getRowTotalExclTaxHtml($_item); ?> - - - helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - getRowTotalInclTaxHtml($_item); ?> - - diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml index 2624f4597a306..8a70f4f900bd3 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml @@ -26,6 +26,6 @@ $_item = $this->getItem(); ?> - + helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml index 97f5021039b3a..878f9f02eca8c 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml @@ -27,6 +27,6 @@ $_item = $this->getItem(); ?> helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> - + helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml index 5f62b4ef2cf36..81013e3ba7539 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml @@ -26,6 +26,6 @@ $_item = $this->getItem(); ?> - + helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml index cfdc0239fc851..5f3e4bd6a6212 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml @@ -27,6 +27,6 @@ $_item = $this->getItem(); ?> helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> - + helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/totals.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/totals.phtml index 507d9f35ec514..54d630a0405b4 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/totals.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/totals.phtml @@ -27,7 +27,7 @@ */ ?> getTotals()): ?> - helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? 5 : 3; ?> + renderTotals(null, $_colspan); ?> renderTotals('footer', $_colspan); ?> needDisplayBaseGrandtotal()):?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml index 3369eb8313a70..7b69b6a907017 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml @@ -93,7 +93,7 @@
    - +
    diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json index e535109311ad8..ba2e152066f78 100644 --- a/app/code/Magento/CheckoutAgreements/composer.json +++ b/app/code/Magento/CheckoutAgreements/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-store": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-store": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php index 8972c8694ded9..a7a2894917bed 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php @@ -71,19 +71,6 @@ protected function _construct() $this->setTitle(__('Block Information')); } - /** - * Load Wysiwyg on demand and Prepare layout - * - * @return void - */ - protected function _prepareLayout() - { - parent::_prepareLayout(); - if ($this->_wysiwygConfig->isEnabled()) { - $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); - } - } - /** * Prepare form * diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php index 0338181ad4f80..a892280ab8002 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php @@ -52,19 +52,6 @@ public function __construct( parent::__construct($context, $registry, $formFactory, $data); } - /** - * Load Wysiwyg on demand and Prepare layout - * - * @return void - */ - protected function _prepareLayout() - { - parent::_prepareLayout(); - if ($this->_wysiwygConfig->isEnabled()) { - $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); - } - } - /** * Prepare form * diff --git a/app/code/Magento/Cms/Block/Page.php b/app/code/Magento/Cms/Block/Page.php index 8d5c12fb7a6dc..5cd355504c54e 100644 --- a/app/code/Magento/Cms/Block/Page.php +++ b/app/code/Magento/Cms/Block/Page.php @@ -141,13 +141,9 @@ protected function _prepareLayout() } $this->pageConfig->addBodyClass('cms-' . $page->getIdentifier()); - - $head = $this->getLayout()->getBlock('head'); - if ($head) { - $head->setTitle($page->getTitle()); - $head->setKeywords($page->getMetaKeywords()); - $head->setDescription($page->getMetaDescription()); - } + $this->pageConfig->setTitle($page->getTitle()); + $this->pageConfig->setKeywords($page->getMetaKeywords()); + $this->pageConfig->setDescription($page->getMetaDescription()); $pageMainTitle = $this->getLayout()->getBlock('page.main.title'); if ($pageMainTitle) { diff --git a/app/code/Magento/Cms/Controller/Adminhtml/AbstractMassDelete.php b/app/code/Magento/Cms/Controller/Adminhtml/AbstractMassDelete.php new file mode 100644 index 0000000000000..bb3f1ab668a09 --- /dev/null +++ b/app/code/Magento/Cms/Controller/Adminhtml/AbstractMassDelete.php @@ -0,0 +1,161 @@ +getRequest()->getParam('massaction', '[]'); + $data = json_decode($data, true); + + try { + if (isset($data['all_selected']) && $data['all_selected'] === true) { + if (!empty($data['excluded'])) { + $this->excludedDelete($data['excluded']); + } else { + $this->deleteAll(); + } + } elseif (!empty($data['selected'])) { + $this->selectedDelete($data['selected']); + } else { + $this->messageManager->addError(__('Please select item(s).')); + $this->_redirect(static::REDIRECT_URL); + } + } catch (\Exception $e) { + $this->messageManager->addError($e->getMessage()); + } + + $this->_redirect(static::REDIRECT_URL); + } + + /** + * Delete all + * + * @return void + * @throws \Exception + */ + protected function deleteAll() + { + /** @var AbstractCollection $collection */ + $collection = $this->_objectManager->get($this->collection); + $this->setSuccessMessage($this->delete($collection)); + } + + /** + * Delete all but the not selected + * + * @param array $excluded + * @return void + * @throws \Exception + */ + protected function excludedDelete(array $excluded) + { + /** @var AbstractCollection $collection */ + $collection = $this->_objectManager->get($this->collection); + $collection->addFieldToFilter(static::ID_FIELD, ['nin' => $excluded]); + $this->setSuccessMessage($this->delete($collection)); + } + + /** + * Delete selected items + * + * @param array $selected + * @return void + * @throws \Exception + */ + protected function selectedDelete(array $selected) + { + /** @var AbstractCollection $collection */ + $collection = $this->_objectManager->get($this->collection); + $collection->addFieldToFilter(static::ID_FIELD, ['in' => $selected]); + $this->setSuccessMessage($this->delete($collection)); + } + + /** + * Delete collection items + * + * @param AbstractCollection $collection + * @return int + */ + protected function delete(AbstractCollection $collection) + { + $count = 0; + foreach ($collection->getAllIds() as $id) { + /** @var \Magento\Framework\Model\AbstractModel $model */ + $model = $this->_objectManager->get($this->model); + $model->load($id); + $model->delete(); + ++$count; + } + + return $count; + } + + /** + * Set error messages + * + * @param int $count + * @return void + */ + protected function setSuccessMessage($count) + { + $this->messageManager->addSuccess(__('A total of %1 record(s) have been deleted.', $count)); + } +} diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Block/MassDelete.php b/app/code/Magento/Cms/Controller/Adminhtml/Block/MassDelete.php new file mode 100644 index 0000000000000..6c46d4fd6362a --- /dev/null +++ b/app/code/Magento/Cms/Controller/Adminhtml/Block/MassDelete.php @@ -0,0 +1,52 @@ +getRequest()->getPost(); if ($data) { $data = $this->dataProcessor->filter($data); - //init model and set data $model = $this->_objectManager->create('Magento\Cms\Model\Page'); $id = $this->getRequest()->getParam('page_id'); @@ -77,31 +75,25 @@ public function execute() array('page' => $model, 'request' => $this->getRequest()) ); - //validating if (!$this->dataProcessor->validate($data)) { $this->_redirect('*/*/edit', array('page_id' => $model->getId(), '_current' => true)); return; } - // try to save it try { - // save the data $model->save(); - - // display success message $this->messageManager->addSuccess(__('The page has been saved.')); - // clear previously saved data from session $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false); - // check if 'Save and Continue' if ($this->getRequest()->getParam('back')) { $this->_redirect('*/*/edit', array('page_id' => $model->getId(), '_current' => true)); return; } - // go to grid $this->_redirect('*/*/'); return; } catch (\Magento\Framework\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); + } catch (\RuntimeException $e) { + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong while saving the page.')); } diff --git a/app/code/Magento/Cms/Model/Page.php b/app/code/Magento/Cms/Model/Page.php index 93a2c676c66f0..2e3b9807d0ce8 100644 --- a/app/code/Magento/Cms/Model/Page.php +++ b/app/code/Magento/Cms/Model/Page.php @@ -62,6 +62,7 @@ * @method \Magento\Cms\Model\Page setCustomThemeFrom(string $value) * @method string getCustomThemeTo() * @method \Magento\Cms\Model\Page setCustomThemeTo(string $value) + * @method int[] getStores() */ class Page extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\Object\IdentityInterface { diff --git a/app/code/Magento/Cms/Model/Resource/Page.php b/app/code/Magento/Cms/Model/Resource/Page.php index 90796013df229..fc5fa4387efee 100644 --- a/app/code/Magento/Cms/Model/Resource/Page.php +++ b/app/code/Magento/Cms/Model/Resource/Page.php @@ -52,11 +52,6 @@ class Page extends \Magento\Framework\Model\Resource\Db\AbstractDb */ protected $dateTime; - /** - * @var \Magento\Framework\Filter\FilterManager - */ - protected $filter; - /** * Construct * @@ -64,20 +59,17 @@ class Page extends \Magento\Framework\Model\Resource\Db\AbstractDb * @param \Magento\Framework\Stdlib\DateTime\DateTime $date * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Framework\Filter\FilterManager $filter */ public function __construct( \Magento\Framework\App\Resource $resource, \Magento\Framework\Stdlib\DateTime\DateTime $date, \Magento\Framework\StoreManagerInterface $storeManager, - \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Framework\Filter\FilterManager $filter + \Magento\Framework\Stdlib\DateTime $dateTime ) { parent::__construct($resource); $this->_date = $date; $this->_storeManager = $storeManager; $this->dateTime = $dateTime; - $this->filter = $filter; } /** @@ -125,14 +117,6 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) $object->setData($field, $this->dateTime->formatDate($value)); } - if (!$object->getData('identifier')) { - $object->setData('identifier', $this->filter->translitUrl($object->getData('title'))); - } - - if (!$this->getIsUniquePageToStores($object)) { - throw new \Magento\Framework\Model\Exception(__('A page URL key for specified store already exists.')); - } - if (!$this->isValidPageIdentifier($object)) { throw new \Magento\Framework\Model\Exception(__('The page URL key contains capital letters or disallowed symbols.')); } @@ -141,7 +125,6 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) throw new \Magento\Framework\Model\Exception(__('The page URL key cannot be made of only numbers.')); } - // modify create / update dates if ($object->isObjectNew() && !$object->hasCreationTime()) { $object->setCreationTime($this->_date->gmtDate()); } @@ -286,33 +269,6 @@ protected function _getLoadByIdentifierSelect($identifier, $store, $isActive = n return $select; } - /** - * Check for unique of identifier of page to selected store(s). - * - * @param \Magento\Framework\Model\AbstractModel $object - * @return bool - */ - public function getIsUniquePageToStores(\Magento\Framework\Model\AbstractModel $object) - { - if ($this->_storeManager->hasSingleStore() || !$object->hasStores()) { - $stores = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID); - } else { - $stores = (array)$object->getData('stores'); - } - - $select = $this->_getLoadByIdentifierSelect($object->getData('identifier'), $stores); - - if ($object->getId()) { - $select->where('cps.page_id <> ?', $object->getId()); - } - - if ($this->_getWriteAdapter()->fetchRow($select)) { - return false; - } - - return true; - } - /** * Check whether page identifier is numeric * diff --git a/app/code/Magento/Cms/Model/Resource/Page/Grid/Collection.php b/app/code/Magento/Cms/Model/Resource/Page/Grid/Collection.php new file mode 100644 index 0000000000000..0d91cd6a75f63 --- /dev/null +++ b/app/code/Magento/Cms/Model/Resource/Page/Grid/Collection.php @@ -0,0 +1,88 @@ +addStoreFilter($condition, false); + } + + return parent::addFieldToFilter($field, $condition); + } + + /** + * Perform operations after collection load + * + * @return $this + */ + protected function _afterLoad() + { + $items = $this->getColumnValues('page_id'); + if (count($items)) { + $connection = $this->getConnection(); + $select = $connection->select()->from(['cps' => $this->getTable('cms_page_store')]) + ->where('cps.page_id IN (?)', $items); + $result = $connection->fetchPairs($select); + if ($result) { + foreach ($this as $item) { + $pageId = $item->getData('page_id'); + if (!isset($result[$pageId])) { + continue; + } + if ($result[$pageId] == 0) { + $stores = $this->_storeManager->getStores(false, true); + $storeId = current($stores)->getId(); + $storeCode = key($stores); + } else { + $storeId = $result[$item->getData('page_id')]; + $storeCode = $this->_storeManager->getStore($storeId)->getCode(); + } + $item->setData('_first_store_id', $storeId); + $item->setData('store_code', $storeCode); + $item->setData('store_id', [$result[$pageId]]); + } + } + } + + $this->_previewFlag = false; + return parent::_afterLoad(); + } +} diff --git a/app/code/Magento/Cms/Ui/DataProvider/Block/Row/Actions.php b/app/code/Magento/Cms/Ui/DataProvider/Block/Row/Actions.php new file mode 100644 index 0000000000000..59e6015763763 --- /dev/null +++ b/app/code/Magento/Cms/Ui/DataProvider/Block/Row/Actions.php @@ -0,0 +1,68 @@ +urlBuilder = $urlBuilder; + } + + /** + * Get data + * + * @param array $dataRow + * @return mixed + */ + public function getData(array $dataRow) + { + return [ + 'edit' => [ + 'href' => $this->urlBuilder->getUrl(static::URL_PATH, ['block_id' => $dataRow['block_id']]), + 'title' => __('Edit'), + + ] + ]; + } +} diff --git a/app/code/Magento/Cms/Ui/DataProvider/Page/Options/IsActive.php b/app/code/Magento/Cms/Ui/DataProvider/Page/Options/IsActive.php new file mode 100644 index 0000000000000..65175c4773c8b --- /dev/null +++ b/app/code/Magento/Cms/Ui/DataProvider/Page/Options/IsActive.php @@ -0,0 +1,66 @@ +cmsPage = $cmsPage; + } + + /** + * Get options + * + * @param array $options + * @return array + */ + public function getOptions(array $options = []) + { + $newOptions = $this->cmsPage->getAvailableStatuses(); + foreach ($newOptions as $key => $value) { + $newOptions[$key] = [ + 'label' => $value, + 'value' => $key + ]; + } + + return array_merge_recursive($newOptions, $options); + } +} diff --git a/app/code/Magento/UrlRedirect/Service/V1/Data/Converter.php b/app/code/Magento/Cms/Ui/DataProvider/Page/Options/PageLayout.php similarity index 53% rename from app/code/Magento/UrlRedirect/Service/V1/Data/Converter.php rename to app/code/Magento/Cms/Ui/DataProvider/Page/Options/PageLayout.php index daca432b79c45..a3cdb5f24bfbd 100644 --- a/app/code/Magento/UrlRedirect/Service/V1/Data/Converter.php +++ b/app/code/Magento/Cms/Ui/DataProvider/Page/Options/PageLayout.php @@ -21,48 +21,47 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\UrlRedirect\Service\V1\Data; +namespace Magento\Cms\Ui\DataProvider\Page\Options; -use Magento\Framework\Service\SimpleDataObjectConverter; -use Magento\UrlRedirect\Service\V1\Data\UrlRewriteBuilderFactory; +use Magento\Ui\DataProvider\OptionsInterface; +use Magento\Core\Model\PageLayout\Config\Builder; /** - * Data object converter + * Class PageLayout */ -class Converter +class PageLayout implements OptionsInterface { /** - * @var UrlRewriteBuilderFactory + * @var \Magento\Core\Model\PageLayout\Config\Builder */ - protected $builderFactory; + protected $pageLayoutBuilder; /** - * @param UrlRewriteBuilderFactory $builderFactory - */ - public function __construct(UrlRewriteBuilderFactory $builderFactory) - { - $this->builderFactory = $builderFactory; - } - - /** - * Convert array to Service Data Object + * Constructor * - * @param array $data - * @return UrlRewrite + * @param Builder $pageLayoutBuilder */ - public function convertArrayToObject(array $data) + public function __construct(Builder $pageLayoutBuilder) { - return $this->builderFactory->create()->populateWithArray($data)->create(); + $this->pageLayoutBuilder = $pageLayoutBuilder; } /** - * Convert Service Data Object to array + * Get options * - * @param UrlRewrite $object + * @param array $options * @return array */ - public function convertObjectToArray(UrlRewrite $object) + public function getOptions(array $options = []) { - return SimpleDataObjectConverter::toFlatArray($object); + $newOptions = $this->pageLayoutBuilder->getPageLayoutsConfig()->getOptions(); + foreach ($newOptions as $key => $value) { + $newOptions[$key] = [ + 'label' => $value, + 'value' => $key + ]; + } + + return array_merge_recursive($newOptions, $options); } } diff --git a/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php b/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php new file mode 100644 index 0000000000000..36b0da9c589b0 --- /dev/null +++ b/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php @@ -0,0 +1,87 @@ +urlBuilder = $urlBuilder; + $this->actionUrlBuilder = $actionUrlBuilder; + } + + /** + * Get data + * + * @param array $dataRow + * @return mixed + */ + public function getData(array $dataRow) + { + return [ + 'edit' => [ + 'href' => $this->urlBuilder->getUrl(static::URL_PATH, ['page_id' => $dataRow['page_id']]), + 'title' => __('Edit'), + 'hidden' => true + + ], + 'preview' => [ + 'href' => $this->actionUrlBuilder->getUrl( + $dataRow['identifier'], + isset($dataRow['_first_store_id']) ? $dataRow['_first_store_id'] : null, + isset($dataRow['store_code']) ? $dataRow['store_code'] : null + ), + 'title' => __('Preview') + ] + ]; + } +} diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json index abc36c49bc8d3..da8253d95d932 100644 --- a/app/code/Magento/Cms/composer.json +++ b/app/code/Magento/Cms/composer.json @@ -3,18 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-widget": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-email": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-widget": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-email": "0.1.0-alpha97", + "magento/module-ui": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Cms/etc/module.xml b/app/code/Magento/Cms/etc/module.xml index 24d9c5e083a85..fbd5918bacb8c 100644 --- a/app/code/Magento/Cms/etc/module.xml +++ b/app/code/Magento/Cms/etc/module.xml @@ -28,7 +28,6 @@ - @@ -39,6 +38,7 @@ + diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml index 311554cd27d0e..ffce5673a3443 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml @@ -25,19 +25,11 @@ --> - - - - jquery/fileUploader/css/jquery.fileupload-ui.css - - - - - jquery/fileUploader/bootstrap.js - - - + + + + - \ No newline at end of file + diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml index db432ae388337..6439c07fd1686 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml @@ -25,85 +25,6 @@ --> - - - - cmsBlockGrid - Magento\Cms\Model\Resource\Block\Grid\Collection - block_identifier - ASC - - - - cmsBlockGrid - - */*/edit - - getId - - - - - - Title - left - title - - - - - Identifier - left - identifier - - - - - Store View - store_id - store - 1 - 1 - 0 - - - - - Status - is_active - options - - - 0 - Disabled - - - 1 - Enabled - - - - - - - Created - datetime - creation_time - col-date - col-date - - - - - Modified - datetime - update_time - col-date - col-date - - - - - + diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_listing.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_listing.xml new file mode 100644 index 0000000000000..4c9f1a309ee99 --- /dev/null +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_listing.xml @@ -0,0 +1,148 @@ + + + + + + cms_block_listing + Magento\Cms\Model\Resource\Block\Grid\Collection + 1 + + + + Add New Block + + + + + + true + true + true + + block_id + edit + + + ID + left + text + filter_range + + + Title + left + text + filter_input + + + Identifier + left + text + filter_input + + + Store View + left + store + false + filter_store + Magento\Ui\DataProvider\Options\Store + + + Status + left + text + filter_select + + + 0 + Disabled + + + 1 + Enabled + + + + + Created + left + date + filter_date + + + Modified + left + date + filter_date + + + + + + Magento\Cms\Ui\DataProvider\Block\Row\Actions + + + Magento\Ui\DataProvider\Row\Store + + + + + + + Magento_Ui::listingcontainer/massaction/default.phtml + + + + Delete + cms/block/massDelete + + + + + + + + + + + Magento_Store/templates/filter/store.html + Magento_Store/js/listing/filter/store + + + + + + + + + block_id + + + + + + diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml index c80aed98c482e..ecfc23280d6df 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml @@ -24,18 +24,10 @@ */ --> - - - - jquery/fileUploader/css/jquery.fileupload-ui.css - - - - - jquery/fileUploader/bootstrap.js - - - + + + + diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml index 0ade3cda6558a..bfe3daab138c3 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml @@ -25,6 +25,6 @@ --> - + diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_listing.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_listing.xml new file mode 100644 index 0000000000000..7dedb50ab33b8 --- /dev/null +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_listing.xml @@ -0,0 +1,150 @@ + + + + + + cms_page_listing + Magento\Cms\Model\Resource\Page\Grid\Collection + 1 + + + + Add New Page + + + + + + true + true + true + + page_id + edit + + + ID + left + text + filter_range + + + Title + left + text + filter_input + + + URL Key + left + text + filter_input + + + Layout + left + text + filter_select + Magento\Cms\Ui\DataProvider\Page\Options\PageLayout + + + Store View + left + false + store + filter_store + Magento\Ui\DataProvider\Options\Store + + + Status + left + text + filter_select + Magento\Cms\Ui\DataProvider\Page\Options\IsActive + + + Created + left + date + filter_date + + + Modified + left + date + filter_date + + + Action + left + actions + false + false + + + + + + Magento\Cms\Ui\DataProvider\Page\Row\Actions + + + Magento\Ui\DataProvider\Row\Store + + + + + + + + + + Delete + cms/page/massDelete + + + + + + + + + + + Magento_Store/templates/filter/store.html + Magento_Store/js/listing/filter/store + + + + + + + + + page_id + + + + diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml index 7c8cbbcb290e9..f2f91a1955d73 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml @@ -25,7 +25,6 @@ --> - diff --git a/app/code/Magento/Cms/Model/Page/Urlrewrite.php b/app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlPathGenerator.php similarity index 59% rename from app/code/Magento/Cms/Model/Page/Urlrewrite.php rename to app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlPathGenerator.php index fd0af0f3726fa..c76526f06bc6f 100644 --- a/app/code/Magento/Cms/Model/Page/Urlrewrite.php +++ b/app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlPathGenerator.php @@ -21,59 +21,49 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Cms\Model\Page; +namespace Magento\CmsUrlRewrite\Model; -/** - * Page Url rewrite model - * - * @method \Magento\Cms\Model\Resource\Page\Urlrewrite getResource() getResource() - * @method int getCmsPageId() getCmsPageId() - * @method int getUrlRewriteId() getUrlRewriteId() - * @method \Magento\Cms\Model\Page\Urlrewrite setCmsPageId() setCmsPageId(int) - * @method \Magento\Cms\Model\Page\Urlrewrite setUrlRewriteId() setUrlRewriteId(int) - */ -class Urlrewrite extends \Magento\Framework\Model\AbstractModel +class CmsPageUrlPathGenerator { - /** - * Initialize resource model - * - * @return void - */ - protected function _construct() - { - $this->_init('Magento\Cms\Model\Resource\Page\Urlrewrite'); + /** @var \Magento\Framework\Filter\FilterManager */ + protected $filterManager; + + public function __construct( + \Magento\Framework\Filter\FilterManager $filterManager + ) { + $this->filterManager = $filterManager; } /** - * Generate id path - * * @param \Magento\Cms\Model\Page $cmsPage + * * @return string */ - public function generateIdPath($cmsPage) + public function getUrlPath($cmsPage) { - return 'cms_page/' . $cmsPage->getId(); + return $cmsPage->getIdentifier(); } /** - * Generate target path + * Get canonical product url path * * @param \Magento\Cms\Model\Page $cmsPage * @return string */ - public function generateTargetPath($cmsPage) + public function getCanonicalUrlPath($cmsPage) { return 'cms/page/view/page_id/' . $cmsPage->getId(); } /** - * Get request path + * Generate CMS page url key based on url_key entered by merchant or page title * * @param \Magento\Cms\Model\Page $cmsPage * @return string */ - public function generateRequestPath($cmsPage) + public function generateUrlKey($cmsPage) { - return $cmsPage->getIdentifier(); + $urlKey = $cmsPage->getIdentifier(); + return $this->filterManager->translitUrl($urlKey === '' || $urlKey === null ? $cmsPage->getTitle() : $urlKey); } } diff --git a/app/code/Magento/CmsUrlRewrite/Service/V1/CmsPageUrlGenerator.php b/app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlRewriteGenerator.php similarity index 64% rename from app/code/Magento/CmsUrlRewrite/Service/V1/CmsPageUrlGenerator.php rename to app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlRewriteGenerator.php index 076448145b63b..f99d039999fbe 100644 --- a/app/code/Magento/CmsUrlRewrite/Service/V1/CmsPageUrlGenerator.php +++ b/app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlRewriteGenerator.php @@ -21,23 +21,23 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\CmsUrlRewrite\Service\V1; +namespace Magento\CmsUrlRewrite\Model; use Magento\Framework\StoreManagerInterface; -use Magento\UrlRedirect\Service\V1\Data\Converter; -use Magento\UrlRedirect\Service\V1\Data\UrlRewrite; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; -class CmsPageUrlGenerator implements CmsPageUrlGeneratorInterface +class CmsPageUrlRewriteGenerator { /** * Entity type code */ const ENTITY_TYPE = 'cms-page'; - /** - * @var Converter - */ - protected $converter; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder */ + protected $urlRewriteBuilder; + + /** @var \Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator */ + protected $cmsPageUrlPathGenerator; /** * Store manager @@ -52,19 +52,23 @@ class CmsPageUrlGenerator implements CmsPageUrlGeneratorInterface protected $cmsPage; /** - * @param Converter $converter + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder $urlRewriteBuilder + * @param \Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator $cmsPageUrlPathGenerator * @param StoreManagerInterface $storeManager */ public function __construct( - Converter $converter, + UrlRewriteBuilder $urlRewriteBuilder, + CmsPageUrlPathGenerator $cmsPageUrlPathGenerator, StoreManagerInterface $storeManager ) { - $this->converter = $converter; + $this->urlRewriteBuilder = $urlRewriteBuilder; $this->storeManager = $storeManager; + $this->cmsPageUrlPathGenerator = $cmsPageUrlPathGenerator; } /** - * {@inheritdoc} + * @param \Magento\Cms\Model\Page $cmsPage + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] */ public function generate($cmsPage) { @@ -79,7 +83,7 @@ public function generate($cmsPage) /** * Generate list of urls for default store * - * @return UrlRewrite[] + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] */ protected function generateForAllStores() { @@ -94,7 +98,7 @@ protected function generateForAllStores() * Generate list of urls per store * * @param int[] $storeIds - * @return UrlRewrite[] + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] */ protected function generateForSpecificStores($storeIds) { @@ -113,18 +117,18 @@ protected function generateForSpecificStores($storeIds) * Create url rewrite object * * @param int $storeId - * @param string|null $redirectType Null or one of OptionProvider const - * @return UrlRewrite + * @param int $redirectType + * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite */ - protected function createUrlRewrite($storeId, $redirectType = null) + protected function createUrlRewrite($storeId, $redirectType = 0) { - return $this->converter->convertArrayToObject([ - UrlRewrite::ENTITY_TYPE => self::ENTITY_TYPE, - UrlRewrite::ENTITY_ID => $this->cmsPage->getId(), - UrlRewrite::STORE_ID => $storeId, - UrlRewrite::REQUEST_PATH => $this->cmsPage->getIdentifier(), - UrlRewrite::TARGET_PATH => 'cms/page/view/page_id/' . $this->cmsPage->getId(), - UrlRewrite::REDIRECT_TYPE => $redirectType, - ]); + return $this->urlRewriteBuilder->setStoreId($storeId) + ->setEntityType(self::ENTITY_TYPE) + ->setEntityId($this->cmsPage->getId()) + ->setRequestPath($this->cmsPage->getIdentifier()) + ->setTargetPath($this->cmsPageUrlPathGenerator->getCanonicalUrlPath($this->cmsPage)) + ->setIsAutogenerated(1) + ->setRedirectType($redirectType) + ->create(); } } diff --git a/app/code/Magento/CmsUrlRewrite/Model/Observer.php b/app/code/Magento/CmsUrlRewrite/Model/Observer.php index e5278ac34beb1..ff6ed1efc66af 100644 --- a/app/code/Magento/CmsUrlRewrite/Model/Observer.php +++ b/app/code/Magento/CmsUrlRewrite/Model/Observer.php @@ -24,30 +24,28 @@ namespace Magento\CmsUrlRewrite\Model; use Magento\Framework\Event\Observer as EventObserver; -use Magento\CmsUrlRewrite\Service\V1\CmsPageUrlGeneratorInterface; -use Magento\UrlRedirect\Service\V1\UrlSaveInterface; -use Magento\Framework\Model\Exception; +use Magento\UrlRewrite\Model\UrlPersistInterface; class Observer { /** - * @var CmsPageUrlGeneratorInterface + * @var CmsPageUrlRewriteGenerator */ - protected $urlGenerator; + protected $cmsPageUrlRewriteGenerator; /** - * @var \Magento\UrlRedirect\Service\V1\UrlSaveInterface + * @var UrlPersistInterface */ - protected $urlSave; + protected $urlPersist; /** - * @param CmsPageUrlGeneratorInterface $urlGenerator - * @param UrlSaveInterface $urlSave + * @param CmsPageUrlRewriteGenerator $cmsPageUrlRewriteGenerator + * @param UrlPersistInterface $urlPersist */ - public function __construct(CmsPageUrlGeneratorInterface $urlGenerator, UrlSaveInterface $urlSave) + public function __construct(CmsPageUrlRewriteGenerator $cmsPageUrlRewriteGenerator, UrlPersistInterface $urlPersist) { - $this->urlGenerator = $urlGenerator; - $this->urlSave = $urlSave; + $this->cmsPageUrlRewriteGenerator = $cmsPageUrlRewriteGenerator; + $this->urlPersist = $urlPersist; } /** @@ -55,22 +53,14 @@ public function __construct(CmsPageUrlGeneratorInterface $urlGenerator, UrlSaveI * * @param \Magento\Framework\Event\Observer $observer * @return void - * @throws Exception|\Exception */ public function processUrlRewriteSaving(EventObserver $observer) { /** @var $cmsPage \Magento\Cms\Model\Page */ $cmsPage = $observer->getEvent()->getObject(); - if ($cmsPage->getOrigData('identifier') !== $cmsPage->getData('identifier')) { - $urls = $this->urlGenerator->generate($cmsPage); - try { - $this->urlSave->save($urls); - } catch (\Exception $e) { - if ($e->getCode() === 23000) { // Integrity constraint violation: 1062 Duplicate entry - throw new Exception(__('A page URL key for specified store already exists.')); - } - throw $e; - } + if ($cmsPage->dataHasChangedFor('identifier')) { + $urls = $this->cmsPageUrlRewriteGenerator->generate($cmsPage); + $this->urlPersist->replace($urls); } } } diff --git a/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/Resource/Page.php b/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/Resource/Page.php new file mode 100644 index 0000000000000..713bce5d6890b --- /dev/null +++ b/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/Resource/Page.php @@ -0,0 +1,59 @@ +cmsPageUrlPathGenerator = $cmsPageUrlPathGenerator; + } + + /** + * Before save handler + * + * @param \Magento\Cms\Model\Resource\Page $subject + * @param \Magento\Framework\Model\AbstractModel $object + * + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeSave( + \Magento\Cms\Model\Resource\Page $subject, + \Magento\Framework\Model\AbstractModel $object + ) { + /** @var $object \Magento\Cms\Model\Page */ + $urlKey = $object->getData('identifier'); + if ($urlKey === '' || $urlKey === null) { + $object->setData('identifier', $this->cmsPageUrlPathGenerator->generateUrlKey($object)); + } + } +} diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json index cba14ac474c13..acf8fb0f3b86e 100644 --- a/app/code/Magento/CmsUrlRewrite/composer.json +++ b/app/code/Magento/CmsUrlRewrite/composer.json @@ -3,12 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-url-redirect": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-cms": "0.1.0-alpha97", + "magento/module-url-rewrite": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/CmsUrlRewrite/etc/adminhtml/di.xml b/app/code/Magento/CmsUrlRewrite/etc/adminhtml/di.xml index 8f4ed44ca657e..68d7390305193 100644 --- a/app/code/Magento/CmsUrlRewrite/etc/adminhtml/di.xml +++ b/app/code/Magento/CmsUrlRewrite/etc/adminhtml/di.xml @@ -24,5 +24,7 @@ */ --> - + + + diff --git a/app/code/Magento/CmsUrlRewrite/etc/module.xml b/app/code/Magento/CmsUrlRewrite/etc/module.xml index 7d40a61c1068d..9c20c38fdfb56 100644 --- a/app/code/Magento/CmsUrlRewrite/etc/module.xml +++ b/app/code/Magento/CmsUrlRewrite/etc/module.xml @@ -24,9 +24,10 @@ */ --> - + - + + diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json index 7a1f9aad02ea0..e17863da679de 100644 --- a/app/code/Magento/ConfigurableImportExport/composer.json +++ b/app/code/Magento/ConfigurableImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-catalog-import-export": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-import-export": "0.1.0-alpha96", - "magento/module-configurable-product": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-catalog-import-export": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-import-export": "0.1.0-alpha97", + "magento/module-configurable-product": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index ca9ca611ed03f..6b78393236a3d 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -696,6 +696,7 @@ public function getSelectedAttributesInfo($product) foreach ($data as $attributeId => $attributeValue) { if (isset($usedAttributes[$attributeId])) { + /** @var \Magento\Catalog\Model\Resource\Eav\Attribute $attribute */ $attribute = $usedAttributes[$attributeId]->getProductAttribute(); $label = $attribute->getStoreLabel(); $value = $attribute; @@ -1007,19 +1008,6 @@ public function processBuyRequest($product, $buyRequest) return $options; } - /** - * Check if Minimum Advertise Price is enabled at least in one option - * - * @param \Magento\Catalog\Model\Product $product - * @param int $visibility - * @return bool|null - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function isMapEnabledInOptions($product, $visibility = null) - { - return null; - } - /** * Prepare and retrieve options values with product data * diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php index e7aa08e135a47..11702db2928ad 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php @@ -25,8 +25,12 @@ */ namespace Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute; +use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute\Price\Data as PriceData; + /** * @SuppressWarnings(PHPMD.LongVariable) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection { @@ -72,6 +76,13 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac */ protected $_storeManager; + /** + * Price values cache + * + * @var PriceData + */ + protected $priceData; + /** * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Framework\Logger $logger @@ -81,7 +92,9 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac * @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable $catalogProductTypeConfigurable * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute $resource + * @param PriceData $priceData * @param \Zend_Db_Adapter_Abstract $connection + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -92,11 +105,13 @@ public function __construct( \Magento\ConfigurableProduct\Model\Product\Type\Configurable $catalogProductTypeConfigurable, \Magento\Catalog\Helper\Data $catalogData, \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute $resource, + PriceData $priceData, $connection = null ) { $this->_storeManager = $storeManager; $this->_productTypeConfigurable = $catalogProductTypeConfigurable; $this->_catalogData = $catalogData; + $this->priceData = $priceData; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); } @@ -259,101 +274,139 @@ protected function _loadLabels() * Load attribute prices information * * @return $this - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function _loadPrices() { if ($this->count()) { - $pricings = array(0 => array()); - if ($this->_catalogData->isPriceGlobal()) { - $websiteId = 0; - } else { - $websiteId = (int)$this->_storeManager->getStore($this->getStoreId())->getWebsiteId(); - $pricing[$websiteId] = array(); + $values = $this->getPriceValues(); + + foreach ($values as $data) { + $this->getItemById($data['product_super_attribute_id'])->addPrice($data); } + } + return $this; + } - $select = $this->getConnection()->select()->from( - array('price' => $this->_priceTable) - )->where( - 'price.product_super_attribute_id IN (?)', - array_keys($this->_items) - ); + /** + * Retrieve price values + * + * @return array + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + protected function getPriceValues() + { + $cachedPriceData = $this->priceData->getProductPrice($this->getProduct()->getId()); + if (false !== $cachedPriceData) { + return $cachedPriceData; + } - if ($websiteId > 0) { - $select->where('price.website_id IN(?)', array(0, $websiteId)); - } else { - $select->where('price.website_id = ?', 0); - } + $pricings = array(0 => array()); - $query = $this->getConnection()->query($select); + if ($this->_catalogData->isPriceGlobal()) { + $websiteId = 0; + } else { + $websiteId = (int) $this->_storeManager->getStore($this->getStoreId())->getWebsiteId(); + $pricing[$websiteId] = array(); + } - while ($row = $query->fetch()) { - $pricings[(int)$row['website_id']][] = $row; - } + $select = $this->getConnection()->select()->from( + array('price' => $this->_priceTable) + )->where( + 'price.product_super_attribute_id IN (?)', + array_keys($this->_items) + ); - $values = array(); - $usedProducts = $this->getProductType()->getUsedProducts($this->getProduct()); - if ($usedProducts) { - foreach ($this->_items as $item) { - $productAttribute = $item->getProductAttribute(); - if (!$productAttribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute) { - continue; - } - $itemId = $item->getId(); - $options = $productAttribute->getFrontend()->getSelectOptions(); - foreach ($options as $option) { - foreach ($usedProducts as $associatedProduct) { - $attributeCodeValue = $associatedProduct->getData($productAttribute->getAttributeCode()); - if (!empty($option['value']) && $option['value'] == $attributeCodeValue) { - // If option available in associated product - if (!isset($values[$item->getId() . ':' . $option['value']])) { - $values[$itemId . ':' . $option['value']] = array( - 'product_super_attribute_id' => $itemId, - 'value_index' => $option['value'], - 'label' => $option['label'], - 'default_label' => $option['label'], - 'store_label' => $option['label'], - 'is_percent' => 0, - 'pricing_value' => null, - 'use_default_value' => true - ); - } + if ($websiteId > 0) { + $select->where('price.website_id IN(?)', array(0, $websiteId)); + } else { + $select->where('price.website_id = ?', 0); + } + + $query = $this->getConnection()->query($select); + + while ($row = $query->fetch()) { + $pricings[(int)$row['website_id']][] = $row; + } + + $values = array(); + $usedProducts = $this->getProductType()->getUsedProducts($this->getProduct()); + if ($usedProducts) { + foreach ($this->_items as $item) { + $productAttribute = $item->getProductAttribute(); + if (!$productAttribute instanceof AbstractAttribute) { + continue; + } + $itemId = $item->getId(); + $options = $this->getIncludedOptions($usedProducts, $productAttribute); + foreach ($options as $option) { + foreach ($usedProducts as $associatedProduct) { + $attributeCodeValue = $associatedProduct->getData($productAttribute->getAttributeCode()); + if (!empty($option['value']) && $option['value'] == $attributeCodeValue) { + // If option available in associated product + if (!isset($values[$item->getId() . ':' . $option['value']])) { + $values[$itemId . ':' . $option['value']] = array( + 'product_super_attribute_id' => $itemId, + 'value_index' => $option['value'], + 'label' => $option['label'], + 'default_label' => $option['label'], + 'store_label' => $option['label'], + 'is_percent' => 0, + 'pricing_value' => null, + 'use_default_value' => true + ); } } } } } + } - foreach ($pricings[0] as $pricing) { - // Addding pricing to options + foreach ($pricings[0] as $pricing) { + // Addding pricing to options + $valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index']; + if (isset($values[$valueKey])) { + $values[$valueKey]['pricing_value'] = $pricing['pricing_value']; + $values[$valueKey]['is_percent'] = $pricing['is_percent']; + $values[$valueKey]['value_id'] = $pricing['value_id']; + $values[$valueKey]['use_default_value'] = true; + } + } + + if ($websiteId && isset($pricings[$websiteId])) { + foreach ($pricings[$websiteId] as $pricing) { $valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index']; if (isset($values[$valueKey])) { $values[$valueKey]['pricing_value'] = $pricing['pricing_value']; $values[$valueKey]['is_percent'] = $pricing['is_percent']; $values[$valueKey]['value_id'] = $pricing['value_id']; - $values[$valueKey]['use_default_value'] = true; + $values[$valueKey]['use_default_value'] = false; } } + } - if ($websiteId && isset($pricings[$websiteId])) { - foreach ($pricings[$websiteId] as $pricing) { - $valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index']; - if (isset($values[$valueKey])) { - $values[$valueKey]['pricing_value'] = $pricing['pricing_value']; - $values[$valueKey]['is_percent'] = $pricing['is_percent']; - $values[$valueKey]['value_id'] = $pricing['value_id']; - $values[$valueKey]['use_default_value'] = false; - } - } - } + $this->priceData->setProductPrice($this->getProduct()->getId(), $values); - foreach ($values as $data) { - $this->getItemById($data['product_super_attribute_id'])->addPrice($data); - } + return $values; + } + + /** + * Get options for all product attribute values from used products + * + * @param \Magento\Catalog\Model\Product[] $usedProducts + * @param AbstractAttribute $productAttribute + * @return array + */ + protected function getIncludedOptions(array $usedProducts, AbstractAttribute $productAttribute) + { + $attributeValues = []; + foreach ($usedProducts as $associatedProduct) { + $attributeValues[] = $associatedProduct->getData($productAttribute->getAttributeCode()); } - return $this; + $options = $productAttribute->getSource()->getSpecificOptions(array_unique($attributeValues)); + return $options; + } /** diff --git a/app/code/Magento/UrlRedirect/Model/StorageInterface.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Price/Data.php similarity index 51% rename from app/code/Magento/UrlRedirect/Model/StorageInterface.php rename to app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Price/Data.php index c362c56460ca8..61a7dc3aaf390 100644 --- a/app/code/Magento/UrlRedirect/Model/StorageInterface.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Price/Data.php @@ -1,5 +1,7 @@ prices[$productId] = $priceData; + } /** - * Delete data from storage by specific filter - * - * @param Filter $filter - * @return void + * @param int $productId + * @return array|bool */ - public function deleteByFilter(Filter $filter); + public function getProductPrice($productId) + { + return isset($this->prices[$productId]) ? $this->prices[$productId] : false; + } } diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index 42dd8794a7f53..dd6b68d1aca04 100644 --- a/app/code/Magento/ConfigurableProduct/composer.json +++ b/app/code/Magento/ConfigurableProduct/composer.json @@ -3,24 +3,23 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-catalog-rule": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", - "magento/module-webapi": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-catalog-rule": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", + "magento/module-webapi": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/data-install-1.0.0.0.php b/app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/data-install-1.0.0.0.php index c5a0949e29f5b..3a082776544c0 100644 --- a/app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/data-install-1.0.0.0.php +++ b/app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/data-install-1.0.0.0.php @@ -28,9 +28,6 @@ 'country_of_manufacture', 'group_price', 'minimal_price', - 'msrp', - 'msrp_enabled', - 'msrp_display_actual_price_type', 'price', 'special_price', 'special_from_date', diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml index 45f5c2af24f7d..5fa18b98e71bf 100644 --- a/app/code/Magento/ConfigurableProduct/etc/module.xml +++ b/app/code/Magento/ConfigurableProduct/etc/module.xml @@ -38,7 +38,6 @@ - diff --git a/app/code/Magento/ConfigurableProduct/sql/configurable_setup/install-1.0.0.0.php b/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-1.0.0.0.php similarity index 100% rename from app/code/Magento/ConfigurableProduct/sql/configurable_setup/install-1.0.0.0.php rename to app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-1.0.0.0.php diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_configurable.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_configurable.xml index cf299a6cb0244..e2569e2bf7efa 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_configurable.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_configurable.xml @@ -25,13 +25,9 @@ --> - - - - Magento_ConfigurableProduct::css/configurable-product.css - - - + + + diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml index 151948983939b..bbbd73d421811 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml @@ -29,13 +29,9 @@ - - - - Magento_ConfigurableProduct::product/product.css - - - + + + diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml b/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml index a8a78e7adde0e..225f40ddc618d 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml @@ -24,14 +24,12 @@ */ --> + + + - - - type-configurable - - diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json index bf22cae32ad9d..c4b5409c8bcc4 100644 --- a/app/code/Magento/Contact/composer.json +++ b/app/code/Magento/Contact/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-cms": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-cms": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Contact/view/email/submitted_form.html b/app/code/Magento/Contact/view/email/submitted_form.html index 847fbf146cfbb..d1af780b31300 100644 --- a/app/code/Magento/Contact/view/email/submitted_form.html +++ b/app/code/Magento/Contact/view/email/submitted_form.html @@ -7,6 +7,6 @@ @--> Name: {{var data.name}} E-mail: {{var data.email}} -Telephone: {{var data.telephone}} +Phone Number: {{var data.telephone}} Comment: {{var data.comment}} \ No newline at end of file diff --git a/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml b/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml index db2198aa74737..136bbae3e5111 100644 --- a/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml +++ b/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml @@ -24,11 +24,9 @@ */ --> - - - Contact Us - - + + Contact Us + diff --git a/app/code/Magento/Contact/view/frontend/templates/form.phtml b/app/code/Magento/Contact/view/frontend/templates/form.phtml index db3516d2fa951..53e1a0547f4e6 100644 --- a/app/code/Magento/Contact/view/frontend/templates/form.phtml +++ b/app/code/Magento/Contact/view/frontend/templates/form.phtml @@ -29,7 +29,8 @@ data-hasrequired="" data-mage-init='{"validation":{}}'>
    -
    +
    +
    @@ -37,21 +38,21 @@
    - +
    - +
    - +
    - +
    getChildHtml('form.additional.info'); ?> diff --git a/app/code/Magento/Core/Helper/Data.php b/app/code/Magento/Core/Helper/Data.php index bcc1e4036620b..b149418deac10 100644 --- a/app/code/Magento/Core/Helper/Data.php +++ b/app/code/Magento/Core/Helper/Data.php @@ -40,11 +40,15 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ const CONTEXT_STORE = 'store'; + /**#@+ + * Paths for various config settings + */ + const XML_PATH_DEFAULT_LOCALE = 'general/locale/code'; + const XML_PATH_DEFAULT_TIMEZONE = 'general/locale/timezone'; const XML_PATH_DEFAULT_COUNTRY = 'general/country/default'; - const XML_PATH_DEV_ALLOW_IPS = 'dev/restrict/allow_ips'; - const XML_PATH_CONNECTION_TYPE = 'global/resources/default_setup/connection/type'; + /**#@- */ /** * Const for correct dividing decimal values @@ -211,7 +215,9 @@ public function getCacheTypes() { $types = array(); foreach ($this->_cacheConfig->getTypes() as $type => $node) { - $types[$type] = $node['label']; + if (array_key_exists('label', $node)) { + $types[$type] = $node['label']; + } } return $types; } diff --git a/app/code/Magento/Core/Helper/File/Storage/Database.php b/app/code/Magento/Core/Helper/File/Storage/Database.php index 4f9f06d97c0f9..3f47943146301 100644 --- a/app/code/Magento/Core/Helper/File/Storage/Database.php +++ b/app/code/Magento/Core/Helper/File/Storage/Database.php @@ -255,8 +255,9 @@ public function saveFileToFilesystem($filename) return false; } - return $this->getStorageFileModel()->saveFile($file, true); + return $this->getStorageFileModel()->saveFile($file->getData(), true); } + return false; } /** diff --git a/app/code/Magento/Core/Helper/Url.php b/app/code/Magento/Core/Helper/Url.php index eee8a61f032cc..6a73d8360940f 100644 --- a/app/code/Magento/Core/Helper/Url.php +++ b/app/code/Magento/Core/Helper/Url.php @@ -80,19 +80,6 @@ public function getHomeUrl() return $this->_storeManager->getStore()->getBaseUrl(); } - /** - * @param string $string - * @return string - */ - protected function _prepareString($string) - { - $string = preg_replace('#[^0-9a-z]+#i', '-', $string); - $string = strtolower($string); - $string = trim($string, '-'); - - return $string; - } - /** * Add request parameter into url * @@ -119,7 +106,9 @@ public function addRequestParam($url, $param) $arrQueryParams[] = $key . '=' . $value; } } - $url .= $startDelimiter . implode('&', $arrQueryParams); + if (!empty($arrQueryParams)) { + $url .= $startDelimiter . implode('&', $arrQueryParams); + } return $url; } diff --git a/app/code/Magento/Core/Model/PageLayout/Config/Builder.php b/app/code/Magento/Core/Model/PageLayout/Config/Builder.php index 0d6fafdf6abda..21433466d6773 100644 --- a/app/code/Magento/Core/Model/PageLayout/Config/Builder.php +++ b/app/code/Magento/Core/Model/PageLayout/Config/Builder.php @@ -67,7 +67,7 @@ public function getPageLayoutsConfig() { return $this->objectManager->create( 'Magento\Framework\View\PageLayout\Config', - array('configFiles' => $this->getConfigFiles()) + ['configFiles' => $this->getConfigFiles()] ); } diff --git a/app/code/Magento/Core/composer.json b/app/code/Magento/Core/composer.json index 7406f63fc5004..9d33c4c29624a 100644 --- a/app/code/Magento/Core/composer.json +++ b/app/code/Magento/Core/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-cron": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-page-cache": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-cron": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-page-cache": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Core/etc/body.xsd b/app/code/Magento/Core/etc/body.xsd new file mode 100644 index 0000000000000..39cf8f69be928 --- /dev/null +++ b/app/code/Magento/Core/etc/body.xsd @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 72ba009dcc69a..04ae981c354cf 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -82,6 +82,7 @@ + @@ -524,7 +525,7 @@ - general/locale/timezone + Magento\Core\Helper\Data::XML_PATH_DEFAULT_TIMEZONE Magento\Store\Model\ScopeInterface::SCOPE_STORE @@ -536,7 +537,7 @@ - general/locale/code + Magento\Core\Helper\Data::XML_PATH_DEFAULT_LOCALE Magento\Store\Model\ScopeInterface::SCOPE_STORE diff --git a/app/code/Magento/Core/etc/head.xsd b/app/code/Magento/Core/etc/head.xsd new file mode 100644 index 0000000000000..3b4c20e53a22d --- /dev/null +++ b/app/code/Magento/Core/etc/head.xsd @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Index/etc/indexers_merged.xsd b/app/code/Magento/Core/etc/html.xsd similarity index 60% rename from app/code/Magento/Index/etc/indexers_merged.xsd rename to app/code/Magento/Core/etc/html.xsd index d4a190032c581..d0c51668c4e4d 100644 --- a/app/code/Magento/Index/etc/indexers_merged.xsd +++ b/app/code/Magento/Core/etc/html.xsd @@ -23,17 +23,18 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/app/code/Magento/Core/etc/layouts.xsd b/app/code/Magento/Core/etc/layouts.xsd index cbaf7c5a2bf64..805c6d4b7a193 100644 --- a/app/code/Magento/Core/etc/layouts.xsd +++ b/app/code/Magento/Core/etc/layouts.xsd @@ -142,6 +142,18 @@ + + + + Argument name must be unique in scope of all Blocks, Containers and other UI Components. + + + + + + + + @@ -154,6 +166,12 @@ + + + + + + @@ -203,6 +221,7 @@ + @@ -233,6 +252,7 @@ + @@ -248,6 +268,28 @@ + + + + Part of view that can generate appropriate content. + + + + + + + + + + + + + + + + + + @@ -308,6 +350,7 @@ + @@ -321,6 +364,7 @@ + diff --git a/app/code/Magento/Core/etc/page.xsd b/app/code/Magento/Core/etc/page.xsd index 1d4a4e6b766a6..24f8128d42224 100644 --- a/app/code/Magento/Core/etc/page.xsd +++ b/app/code/Magento/Core/etc/page.xsd @@ -25,20 +25,15 @@ --> - - - - - - - - - - - + + + + + + @@ -46,9 +41,21 @@ + + + + + + + + + + + + diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json index 2c54b3deff584..0ada7c1ab4349 100644 --- a/app/code/Magento/Cron/composer.json +++ b/app/code/Magento/Cron/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php b/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php index 4180dc7adc9fb..e4427be41cb9c 100644 --- a/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php +++ b/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php @@ -22,13 +22,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\CurrencySymbol\Model\System; + /** * Custom currency symbol model - * - * @author Magento Core Team */ -namespace Magento\CurrencySymbol\Model\System; - class Currencysymbol { /** @@ -69,7 +67,7 @@ class Currencysymbol */ const XML_PATH_CUSTOM_CURRENCY_SYMBOL = 'currency/options/customsymbol'; - const XML_PATH_ALLOWED_CURRENCIES = 'currency/options/allow'; + const XML_PATH_ALLOWED_CURRENCIES = \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW; /* * Separator used in config in allowed currencies list @@ -155,34 +153,6 @@ public function __construct( $this->_scopeConfig = $scopeConfig; } - /** - * Sets store Id - * - * @param string|null $storeId - * @return $this - */ - public function setStoreId($storeId = null) - { - $this->_storeId = $storeId; - $this->_symbolsData = array(); - - return $this; - } - - /** - * Sets website Id - * - * @param string|null $websiteId - * @return $this - */ - public function setWebsiteId($websiteId = null) - { - $this->_websiteId = $websiteId; - $this->_symbolsData = array(); - - return $this; - } - /** * Returns currency symbol properties array based on config values * @@ -307,6 +277,8 @@ public function setCurrencySymbolsData($symbols = array()) $this->_storeManager->reinitStores(); $this->clearCache(); + //Reset symbols cache since new data is added + $this->_symbolsData = []; $this->_eventManager->dispatch( 'admin_system_config_changed_section_currency', @@ -337,7 +309,7 @@ public function getCurrencySymbol($code) * * @return $this */ - public function clearCache() + protected function clearCache() { // clear cache for frontend foreach ($this->_cacheTypes as $cacheType) { diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json index 3ed42a6ef46e9..92f7949f60bd0 100644 --- a/app/code/Magento/CurrencySymbol/composer.json +++ b/app/code/Magento/CurrencySymbol/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-page-cache": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-page-cache": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Customer/Block/Address/Book.php b/app/code/Magento/Customer/Block/Address/Book.php index f1999fc1aa311..39388bcfd43bb 100644 --- a/app/code/Magento/Customer/Block/Address/Book.php +++ b/app/code/Magento/Customer/Block/Address/Book.php @@ -82,8 +82,7 @@ public function __construct( */ protected function _prepareLayout() { - $this->getLayout()->getBlock('head')->setTitle(__('Address Book')); - + $this->pageConfig->setTitle(__('Address Book')); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Customer/Block/Address/Edit.php b/app/code/Magento/Customer/Block/Address/Edit.php index 5f4989d8211d2..ca9b2e6d75f15 100644 --- a/app/code/Magento/Customer/Block/Address/Edit.php +++ b/app/code/Magento/Customer/Block/Address/Edit.php @@ -137,9 +137,7 @@ protected function _prepareLayout() )->create(); } - if ($headBlock = $this->getLayout()->getBlock('head')) { - $headBlock->setTitle($this->getTitle()); - } + $this->pageConfig->setTitle($this->getTitle()); if ($postedData = $this->_customerSession->getAddressFormData(true)) { if (!empty($postedData['region_id']) || !empty($postedData['region'])) { diff --git a/app/code/Magento/Customer/Block/Form/Edit.php b/app/code/Magento/Customer/Block/Form/Edit.php old mode 100755 new mode 100644 diff --git a/app/code/Magento/Customer/Block/Form/Login.php b/app/code/Magento/Customer/Block/Form/Login.php index ce2c40b5c41f1..a0f41ddc52adb 100644 --- a/app/code/Magento/Customer/Block/Form/Login.php +++ b/app/code/Magento/Customer/Block/Form/Login.php @@ -89,7 +89,7 @@ public function __construct( */ protected function _prepareLayout() { - $this->getLayout()->getBlock('head')->setTitle(__('Customer Login')); + $this->pageConfig->setTitle(__('Customer Login')); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Customer/Block/Form/Register.php b/app/code/Magento/Customer/Block/Form/Register.php index 8c8cf2f64e5b3..f8e64473190a1 100644 --- a/app/code/Magento/Customer/Block/Form/Register.php +++ b/app/code/Magento/Customer/Block/Form/Register.php @@ -100,10 +100,7 @@ public function getConfig($path) */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Create New Customer Account')); - } + $this->pageConfig->setTitle(__('Create New Customer Account')); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Customer/Controller/Account/Edit.php b/app/code/Magento/Customer/Controller/Account/Edit.php index a07456177f214..d89d5b2e95b80 100644 --- a/app/code/Magento/Customer/Controller/Account/Edit.php +++ b/app/code/Magento/Customer/Controller/Account/Edit.php @@ -91,7 +91,7 @@ public function execute() $this->_getSession()->setCustomerData($customerDataObject); $this->_getSession()->setChangePassword($this->getRequest()->getParam('changepass') == 1); - $this->_view->getLayout()->getBlock('head')->setTitle(__('Account Information')); + $this->_view->getPage()->getConfig()->setTitle(__('Account Information')); $this->_view->getLayout()->getBlock('messages')->setEscapeMessageFlag(true); $this->_view->renderLayout(); } diff --git a/app/code/Magento/Customer/Controller/Account/EditPost.php b/app/code/Magento/Customer/Controller/Account/EditPost.php index 742bcd3d15181..23a41d93a6437 100644 --- a/app/code/Magento/Customer/Controller/Account/EditPost.php +++ b/app/code/Magento/Customer/Controller/Account/EditPost.php @@ -135,7 +135,7 @@ public function execute() try { $this->_customerDetailsBuilder->setCustomer($customer); - $this->_customerAccountService->updateCustomer($this->_customerDetailsBuilder->create()); + $this->_customerAccountService->updateCustomer($customerId, $this->_customerDetailsBuilder->create()); } catch (AuthenticationException $e) { $this->messageManager->addError($e->getMessage()); } catch (InputException $e) { diff --git a/app/code/Magento/Customer/Controller/Account/Index.php b/app/code/Magento/Customer/Controller/Account/Index.php index a4ac0da966df7..47c9179311768 100644 --- a/app/code/Magento/Customer/Controller/Account/Index.php +++ b/app/code/Magento/Customer/Controller/Account/Index.php @@ -35,7 +35,7 @@ public function execute() { $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); - $this->_view->getLayout()->getBlock('head')->setTitle(__('My Account')); + $this->_view->getPage()->getConfig()->setTitle(__('My Account')); $this->_view->renderLayout(); } } diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Group/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Group/Save.php index db5df3518de7d..cfe1aea759994 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Group/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Group/Save.php @@ -68,7 +68,11 @@ public function execute() $this->_customerGroupBuilder->setTaxClassId($taxClass); $customerGroup = $this->_customerGroupBuilder->create(); - $id = $this->_groupService->saveGroup($customerGroup); + if (!is_null($id)) { + $this->_groupService->updateGroup($id, $customerGroup); + } else { + $id = $this->_groupService->createGroup($customerGroup); + } $this->messageManager->addSuccess(__('The customer group has been saved.')); $this->getResponse()->setRedirect($this->getUrl('customer/group')); return; diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroup.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroup.php index c143d64cdd657..ea07275c29003 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroup.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroup.php @@ -43,7 +43,7 @@ function ($customerId) { $customerDetails = $this->_customerDetailsBuilder ->setCustomer($customer) ->create(); - $this->_customerAccountService->updateCustomer($customerDetails); + $this->_customerAccountService->updateCustomer($customerId, $customerDetails); }, $customerIds ); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php index e674cb73d4a1e..1dcd16ed6e405 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php @@ -159,7 +159,7 @@ public function execute() $customer )->setAddresses($addresses)->create(); if ($isExistingCustomer) { - $this->_customerAccountService->updateCustomer($customerDetails); + $this->_customerAccountService->updateCustomer($customerId, $customerDetails); } else { $customer = $this->_customerAccountService->createCustomer($customerDetails); $customerId = $customer->getId(); diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php old mode 100755 new mode 100644 index e8615a90e9365..1dec5ce132e35 --- a/app/code/Magento/Customer/Helper/Address.php +++ b/app/code/Magento/Customer/Helper/Address.php @@ -25,6 +25,7 @@ use Magento\Directory\Model\Country\Format; use Magento\Customer\Service\V1\Data\Eav\AttributeMetadata; +use Magento\Framework\Exception\NoSuchEntityException; /** * Customer address helper @@ -256,22 +257,28 @@ public function canShowConfig($key) */ public function getAttributeValidationClass($attributeCode) { - /** @var $attribute \Magento\Customer\Service\V1\Data\Eav\AttributeMetadata */ - $attribute = isset($this->_attributes[$attributeCode]) - ? $this->_attributes[$attributeCode] - : $this->_addressMetadataService->getAttributeMetadata($attributeCode); - $class = $attribute ? $attribute->getFrontendClass() : ''; - if (in_array($attributeCode, array('firstname', 'middlename', 'lastname', 'prefix', 'suffix', 'taxvat'))) { - if ($class && !$attribute->isVisible()) { - // address attribute is not visible thus its validation rules are not applied - $class = ''; - } + $class = ''; + + try { + /** @var $attribute \Magento\Customer\Service\V1\Data\Eav\AttributeMetadata */ + $attribute = isset($this->_attributes[$attributeCode]) + ? $this->_attributes[$attributeCode] + : $this->_addressMetadataService->getAttributeMetadata($attributeCode); + $class = $attribute ? $attribute->getFrontendClass() : ''; + if (in_array($attributeCode, array('firstname', 'middlename', 'lastname', 'prefix', 'suffix', 'taxvat'))) { + if ($class && !$attribute->isVisible()) { + // address attribute is not visible thus its validation rules are not applied + $class = ''; + } - /** @var $customerAttribute \Magento\Customer\Service\V1\Data\Eav\AttributeMetadata */ - $customerAttribute = $this->_customerMetadataService->getAttributeMetadata($attributeCode); - $class .= $customerAttribute && - $customerAttribute->isVisible() ? $customerAttribute->getFrontendClass() : ''; - $class = implode(' ', array_unique(array_filter(explode(' ', $class)))); + /** @var $customerAttribute \Magento\Customer\Service\V1\Data\Eav\AttributeMetadata */ + $customerAttribute = $this->_customerMetadataService->getAttributeMetadata($attributeCode); + $class .= $customerAttribute && + $customerAttribute->isVisible() ? $customerAttribute->getFrontendClass() : ''; + $class = implode(' ', array_unique(array_filter(explode(' ', $class)))); + } + } catch (NoSuchEntityException $e) { + // the attribute does not exist so just return an empty string } return $class; diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index c9e5159b97ea2..16b6483c85403 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -489,7 +489,7 @@ public function validate() } if (!\Zend_Validate::is($this->getTelephone(), 'NotEmpty')) { - $errors[] = __('Please enter the telephone number.'); + $errors[] = __('Please enter the phone number.'); } $_havingOptionalZip = $this->_directoryData->getCountriesWithOptionalZip(); diff --git a/app/code/Magento/Customer/Model/Group.php b/app/code/Magento/Customer/Model/Group.php index af37e5a978c5f..2d2068d49cfb5 100644 --- a/app/code/Magento/Customer/Model/Group.php +++ b/app/code/Magento/Customer/Model/Group.php @@ -73,18 +73,12 @@ class Group extends \Magento\Framework\Model\AbstractModel */ protected $_storesConfig; - /** - * @var \Magento\Index\Model\Indexer - */ - protected $_indexer; - /** * Constructor * * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Store\Model\StoresConfig $storesConfig - * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data @@ -93,13 +87,11 @@ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Store\Model\StoresConfig $storesConfig, - \Magento\Index\Model\Indexer $indexer, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_storesConfig = $storesConfig; - $this->_indexer = $indexer; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -164,18 +156,6 @@ public function usesAsDefault() return false; } - /** - * Run reindex process after data save - * - * @return $this - */ - protected function _afterSave() - { - parent::_afterSave(); - $this->_indexer->processEntityAction($this, self::ENTITY, \Magento\Index\Model\Event::TYPE_SAVE); - return $this; - } - /** * Prepare data before save * diff --git a/app/code/Magento/Customer/Model/GroupRegistry.php b/app/code/Magento/Customer/Model/GroupRegistry.php index 24f4267107da2..195496d8d87fc 100644 --- a/app/code/Magento/Customer/Model/GroupRegistry.php +++ b/app/code/Magento/Customer/Model/GroupRegistry.php @@ -65,7 +65,7 @@ public function retrieve($groupId) } $group = $this->groupFactory->create(); $group->load($groupId); - if (is_null($group->getId())) { + if (is_null($group->getId()) || $group->getId() != $groupId) { throw NoSuchEntityException::singleField('groupId', $groupId); } $this->registry[$groupId] = $group; diff --git a/app/code/Magento/Customer/Model/Resource/Setup.php b/app/code/Magento/Customer/Model/Resource/Setup.php index a55b15d883c43..14b2bb6b7f725 100644 --- a/app/code/Magento/Customer/Model/Resource/Setup.php +++ b/app/code/Magento/Customer/Model/Resource/Setup.php @@ -441,7 +441,7 @@ public function getDefaultEntities() ), 'telephone' => array( 'type' => 'varchar', - 'label' => 'Telephone', + 'label' => 'Phone Number', 'input' => 'text', 'sort_order' => 120, 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php old mode 100755 new mode 100644 diff --git a/app/code/Magento/Customer/Service/V1/AddressMetadataService.php b/app/code/Magento/Customer/Service/V1/AddressMetadataService.php index fd526f96749b7..c1b8b47053085 100644 --- a/app/code/Magento/Customer/Service/V1/AddressMetadataService.php +++ b/app/code/Magento/Customer/Service/V1/AddressMetadataService.php @@ -85,6 +85,9 @@ public function getAttributes($formCode) $attributes[$attribute->getAttributeCode()] = $this->attributeMetadataConverter ->createMetadataAttribute($attribute); } + if (empty($attributes)) { + throw NoSuchEntityException::singleField('formCode', $formCode); + } return $attributes; } @@ -95,7 +98,7 @@ public function getAttributeMetadata($attributeCode) { /** @var AbstractAttribute $attribute */ $attribute = $this->attributeMetadataDataProvider->getAttribute(self::ENTITY_TYPE_ADDRESS, $attributeCode); - if ($attribute) { + if ($attribute && ($attributeCode === 'id' || !is_null($attribute->getId()))) { $attributeMetadata = $this->attributeMetadataConverter->createMetadataAttribute($attribute); return $attributeMetadata; } else { @@ -142,7 +145,11 @@ public function getCustomAttributesMetadata($dataObjectClassName = self::DATA_OB { $customAttributes = []; if (!$this->addressDataObjectMethods) { - $this->addressDataObjectMethods = array_flip(get_class_methods($dataObjectClassName)); + $dataObjectMethods = array_flip(get_class_methods($dataObjectClassName)); + $baseClassDataObjectMethods = array_flip( + get_class_methods('Magento\Framework\Service\Data\AbstractExtensibleObject') + ); + $this->addressDataObjectMethods = array_diff_key($dataObjectMethods, $baseClassDataObjectMethods); } foreach ($this->getAllAttributesMetadata() as $attributeMetadata) { $attributeCode = $attributeMetadata->getAttributeCode(); diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php index 4000b68b0a56f..4b34f881786a0 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php @@ -52,6 +52,7 @@ use Magento\Framework\Service\V1\Data\SortOrder; use Magento\Framework\UrlInterface; use Magento\Framework\StoreManagerInterface; +use Magento\Framework\Stdlib\String as StringHelper; /** * Handle various customer account actions @@ -147,6 +148,11 @@ class CustomerAccountService implements CustomerAccountServiceInterface */ private $configShare; + /** + * @var StringHelper + */ + private $stringHelper; + /** * @param CustomerFactory $customerFactory * @param ManagerInterface $eventManager @@ -166,6 +172,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface * @param Logger $logger * @param Encryptor $encryptor * @param ConfigShare $configShare + * @param StringHelper $stringHelper * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -187,7 +194,8 @@ public function __construct( UrlInterface $url, Logger $logger, Encryptor $encryptor, - ConfigShare $configShare + ConfigShare $configShare, + StringHelper $stringHelper ) { $this->customerFactory = $customerFactory; $this->eventManager = $eventManager; @@ -207,12 +215,13 @@ public function __construct( $this->logger = $logger; $this->encryptor = $encryptor; $this->configShare = $configShare; + $this->stringHelper = $stringHelper; } /** * {@inheritdoc} */ - public function resendConfirmation($email, $websiteId, $redirectUrl = '') + public function resendConfirmation($email, $websiteId = null, $redirectUrl = '') { $customer = $this->customerRegistry->retrieveByEmail($email, $websiteId); if (!$customer->getConfirmation()) { @@ -259,6 +268,7 @@ public function activateCustomer($customerId, $confirmationKey) */ public function authenticate($username, $password) { + $this->checkPasswordStrength($password); $customerModel = $this->customerFactory->create(); $customerModel->setWebsiteId($this->storeManager->getStore()->getWebsiteId()); try { @@ -288,6 +298,7 @@ public function authenticate($username, $password) public function validateResetPasswordLinkToken($customerId, $resetPasswordLinkToken) { $this->validateResetPasswordToken($customerId, $resetPasswordLinkToken); + return true; } /** @@ -341,6 +352,7 @@ public function resetPassword($customerId, $resetToken, $newPassword) $customerModel = $this->validateResetPasswordToken($customerId, $resetToken); $customerModel->setRpToken(null); $customerModel->setRpTokenCreatedAt(null); + $this->checkPasswordStrength($newPassword); $customerModel->setPasswordHash($this->getPasswordHash($newPassword)); $customerModel->save(); } @@ -369,8 +381,11 @@ public function createCustomer( $password = null, $redirectUrl = '' ) { - //Generate password hash - $password = $password ? $password : $this->mathRandom->getRandomString(self::DEFAULT_PASSWORD_LENGTH); + if ($password) { + $this->checkPasswordStrength($password); + } else { + $password = $this->mathRandom->getRandomString(self::MIN_PASSWORD_LENGTH); + } $hash = $this->getPasswordHash($password); return $this->createCustomerWithPasswordHash($customerDetails, $hash, $redirectUrl); } @@ -460,22 +475,26 @@ protected function _sendEmailConfirmation(CustomerModel $customerModel, Data\Cus /** * {@inheritdoc} */ - public function updateCustomer(Data\CustomerDetails $customerDetails) + public function updateCustomer($customerId, Data\CustomerDetails $customerDetails) { $customer = $customerDetails->getCustomer(); // Making this call first will ensure the customer already exists. - $this->customerRegistry->retrieve($customer->getId()); + $this->customerRegistry->retrieve($customerId); + + if ($customerId != $customer->getId()) { + throw InputException::invalidFieldValue('id', $customer->getId()); + } $this->saveCustomer( $customer, - $this->converter->getCustomerModel($customer->getId())->getPasswordHash() + $this->converter->getCustomerModel($customerId)->getPasswordHash() ); $addresses = $customerDetails->getAddresses(); // If $address is null, no changes must made to the list of addresses // be careful $addresses != null would be true of $addresses is an empty array if ($addresses !== null) { - $existingAddresses = $this->customerAddressService->getAddresses($customer->getId()); + $existingAddresses = $this->customerAddressService->getAddresses($customerId); /** @var Data\Address[] $deletedAddresses */ $deletedAddresses = array_udiff( $existingAddresses, @@ -490,7 +509,7 @@ function (Data\Address $existing, Data\Address $replacement) { foreach ($deletedAddresses as $address) { $this->customerAddressService->deleteAddress($address->getId()); } - $this->customerAddressService->saveAddresses($customer->getId(), $addresses); + $this->customerAddressService->saveAddresses($customerId, $addresses); } return true; @@ -617,6 +636,7 @@ public function changePassword($customerId, $currentPassword, $newPassword) } $customerModel->setRpToken(null); $customerModel->setRpTokenCreatedAt(null); + $this->checkPasswordStrength($newPassword); $customerModel->setPasswordHash($this->getPasswordHash($newPassword)); $customerModel->save(); // FIXME: Are we using the proper template here? @@ -625,6 +645,27 @@ public function changePassword($customerId, $currentPassword, $newPassword) return true; } + /** + * Make sure that password complies with minimum security requirements. + * + * @param string $password + * @return void + * @throws InputException + */ + protected function checkPasswordStrength($password) + { + $length = $this->stringHelper->strlen($password); + if ($length < self::MIN_PASSWORD_LENGTH) { + throw new InputException( + 'The password must have at least %min_length characters.', + ['min_length' => self::MIN_PASSWORD_LENGTH] + ); + } + if ($this->stringHelper->strlen(trim($password)) != $length) { + throw new InputException('The password can not begin or end with a space.'); + } + } + /** * {@inheritDoc} */ @@ -810,7 +851,7 @@ private function validate(CustomerModel $customerModel) */ private function validateResetPasswordToken($customerId, $resetPasswordLinkToken) { - if (!is_int($customerId) || empty($customerId) || $customerId < 0) { + if (empty($customerId) || $customerId < 0) { $params = ['value' => $customerId, 'fieldName' => 'customerId']; throw new InputException(InputException::INVALID_FIELD_VALUE, $params); } @@ -868,7 +909,7 @@ public function getCustomerDetailsByEmail($customerEmail, $websiteId = null) /** * {@inheritdoc} */ - public function updateCustomerDetailsByEmail( + public function updateCustomerByEmail( $customerEmail, CustomerDetails $customerDetails, $websiteId = null @@ -886,7 +927,7 @@ public function updateCustomerDetailsByEmail( ->setCustomer($customerData) ->create(); - return $this->updateCustomer($customerDetails); + return $this->updateCustomer($customerId, $customerDetails); } /** diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountServiceInterface.php b/app/code/Magento/Customer/Service/V1/CustomerAccountServiceInterface.php index 97e891e0db735..54448946c068a 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAccountServiceInterface.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAccountServiceInterface.php @@ -52,7 +52,7 @@ interface CustomerAccountServiceInterface const EMAIL_RESET = 'email_reset'; - const DEFAULT_PASSWORD_LENGTH = 6; + const MIN_PASSWORD_LENGTH = 6; /** * Create Customer Account @@ -93,16 +93,17 @@ public function createCustomerWithPasswordHash( * CustomerDetails contains an array of Address Data. In the event that no change was made to addresses * the array must be null. * + * @param string $customerId * @param \Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerDetails is not found. * @return bool True if this customer was updated */ - public function updateCustomer(\Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails); + public function updateCustomer($customerId, \Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails); /** * Retrieve Customer * - * @param int $customerId + * @param string $customerId * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerId is not found. * @return \Magento\Customer\Service\V1\Data\Customer */ @@ -111,7 +112,7 @@ public function getCustomer($customerId); /** * Used to activate a customer account using a key that was sent in a confirmation e-mail. * - * @param int $customerId + * @param string $customerId * @param string $confirmationKey Sent to customer in an confirmation e-mail. * @return \Magento\Customer\Service\V1\Data\Customer * @throws \Magento\Framework\Exception\NoSuchEntityException If customer doesn't exist @@ -144,7 +145,7 @@ public function authenticate($username, $password); /** * Change customer password. * - * @param int $customerId + * @param string $customerId * @param string $currentPassword * @param string $newPassword * @return bool True if password changed @@ -166,9 +167,9 @@ public function getPasswordHash($password); /** * Check if password reset token is valid * - * @param int $customerId + * @param string $customerId * @param string $resetPasswordLinkToken - * @return void + * @return bool True if the token is valid * @throws \Magento\Framework\Exception\State\InputMismatchException If token is mismatched * @throws \Magento\Framework\Exception\State\ExpiredException If token is expired * @throws \Magento\Framework\Exception\InputException If token or customer id is invalid @@ -181,7 +182,7 @@ public function validateResetPasswordLinkToken($customerId, $resetPasswordLinkTo * * @param string $email * @param string $template Type of email to send. Must be one of the email constants. - * @param int $websiteId Optional id. If the website id is not provided + * @param string $websiteId Optional id. If the website id is not provided * it will be retrieved from the store manager * @return void */ @@ -190,7 +191,7 @@ public function initiatePasswordReset($email, $template, $websiteId = null); /** * Reset customer password. * - * @param int $customerId + * @param string $customerId * @param string $resetToken Token sent to customer via e-mail * @param string $newPassword * @return void @@ -204,7 +205,7 @@ public function resetPassword($customerId, $resetToken, $newPassword); /** * Gets the account confirmation status * - * @param int $customerId + * @param string $customerId * @return string returns one of the account confirmation statuses * * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerId is not found. @@ -222,7 +223,7 @@ public function getConfirmationStatus($customerId); * @throws \Magento\Framework\Exception\NoSuchEntityException If no customer found for provided email * @throws \Magento\Framework\Exception\State\InvalidTransitionException If confirmation is not needed */ - public function resendConfirmation($email, $websiteId, $redirectUrl = ''); + public function resendConfirmation($email, $websiteId = null, $redirectUrl = ''); /** * Validate customer entity @@ -240,7 +241,7 @@ public function validateCustomerData( * Indicates if the Customer for the provided customerId is restricted to being read only * for the currently logged in user, or if modifications can be made. * - * @param int $customerId + * @param string $customerId * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerId is not found. * @return bool true if modifications can be made; false if read only. */ @@ -250,7 +251,7 @@ public function canModify($customerId); * Indicates if the Customer for the currently logged in user as specified by the provided * customerId can be deleted. * - * @param int $customerId + * @param string $customerId * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerId is not found. * @return bool true if the customer can be deleted */ @@ -259,7 +260,7 @@ public function canDelete($customerId); /** * Retrieve customer details * - * @param int $customerId + * @param string $customerId * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerId is not found. * @return \Magento\Customer\Service\V1\Data\CustomerDetails */ @@ -268,7 +269,7 @@ public function getCustomerDetails($customerId); /** * Delete Customer * - * @param int $customerId + * @param string $customerId * @throws \Magento\Customer\Exception If something goes wrong during delete * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerId is not found. * @return bool True if the customer was deleted @@ -287,8 +288,8 @@ public function isEmailAvailable($customerEmail, $websiteId = null); /** * Check store availability for customer given the customerId * - * @param int $customerWebsiteId - * @param int $storeId + * @param string $customerWebsiteId + * @param string $storeId * @return bool */ public function isCustomerInStore($customerWebsiteId, $storeId); @@ -297,7 +298,7 @@ public function isCustomerInStore($customerWebsiteId, $storeId); * Retrieve customer * * @param string $customerEmail - * @param int $websiteId If not set, will use the current websiteId + * @param string $websiteId If not set, will use the current websiteId * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerEmail is not found. * @return \Magento\Customer\Service\V1\Data\Customer */ @@ -307,7 +308,7 @@ public function getCustomerByEmail($customerEmail, $websiteId = null); * Retrieve customer details * * @param string $customerEmail - * @param int $websiteId If not set, will use the current websiteId + * @param string $websiteId If not set, will use the current websiteId * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerEmail is not found. * @return \Magento\Customer\Service\V1\Data\CustomerDetails */ @@ -320,11 +321,11 @@ public function getCustomerDetailsByEmail($customerEmail, $websiteId = null); * * @param string $customerEmail * @param \Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails - * @param int $websiteId If not set, will use the current websiteId + * @param string $websiteId If not set, will use the current websiteId * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerDetails is not found. * @return bool True if this customer was updated */ - public function updateCustomerDetailsByEmail( + public function updateCustomerByEmail( $customerEmail, \Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails, $websiteId = null @@ -334,7 +335,7 @@ public function updateCustomerDetailsByEmail( * Delete Customer by email * * @param string $customerEmail - * @param int $websiteId If not set, will use the current websiteId + * @param string $websiteId If not set, will use the current websiteId * @throws \Magento\Customer\Exception If something goes wrong during delete * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerId is not found. * @return bool True if the customer was deleted diff --git a/app/code/Magento/Customer/Service/V1/CustomerAddressServiceInterface.php b/app/code/Magento/Customer/Service/V1/CustomerAddressServiceInterface.php index 85e37696ffdc6..71b4d069ed97d 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAddressServiceInterface.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAddressServiceInterface.php @@ -31,7 +31,7 @@ interface CustomerAddressServiceInterface /** * Retrieve all Customer Addresses * - * @param int $customerId + * @param string $customerId * @return \Magento\Customer\Service\V1\Data\Address[] * @throws \Magento\Framework\Exception\NoSuchEntityException If the customer Id is invalid */ @@ -40,7 +40,7 @@ public function getAddresses($customerId); /** * Retrieve default billing address * - * @param int $customerId + * @param string $customerId * @return \Magento\Customer\Service\V1\Data\Address * @throws \Magento\Framework\Exception\NoSuchEntityException If the customer Id is invalid */ @@ -49,7 +49,7 @@ public function getDefaultBillingAddress($customerId); /** * Retrieve default shipping address * - * @param int $customerId + * @param string $customerId * @return \Magento\Customer\Service\V1\Data\Address * @throws \Magento\Framework\Exception\NoSuchEntityException If the customer Id is invalid */ @@ -58,7 +58,7 @@ public function getDefaultShippingAddress($customerId); /** * Retrieve address by id * - * @param int $addressId + * @param string $addressId * @return \Magento\Customer\Service\V1\Data\Address * @throws \Magento\Framework\Exception\NoSuchEntityException If no address can be found for the provided id. */ @@ -67,7 +67,7 @@ public function getAddress($addressId); /** * Removes an address by id. * - * @param int $addressId + * @param string $addressId * @return bool True if the address was deleted * @throws \Magento\Framework\Exception\NoSuchEntityException If no address can be found for the provided id. */ @@ -85,7 +85,7 @@ public function deleteAddress($addressId); * This doesn't support partial updates to addresses, meaning * that a full set of data must be provided with each Address * - * @param int $customerId + * @param string $customerId * @param \Magento\Customer\Service\V1\Data\Address[] $addresses * @throws \Magento\Framework\Exception\InputException If there are validation errors. * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with customerId is not found. diff --git a/app/code/Magento/Customer/Service/V1/CustomerGroupService.php b/app/code/Magento/Customer/Service/V1/CustomerGroupService.php index 60bd524faf707..12abb8020905c 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerGroupService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerGroupService.php @@ -47,6 +47,9 @@ */ class CustomerGroupService implements CustomerGroupServiceInterface { + + const MESSAGE_CUSTOMER_GROUP_ID_IS_NOT_EXPECTED = 'ID is not expected for this request.'; + /** * @var GroupFactory */ @@ -268,28 +271,64 @@ public function canDelete($groupId) /** * {@inheritdoc} */ - public function saveGroup(Data\CustomerGroup $group) + public function createGroup(Data\CustomerGroup $group) { + if ($group->getId()) { + throw new InputException(self::MESSAGE_CUSTOMER_GROUP_ID_IS_NOT_EXPECTED); + } + if (!$group->getCode()) { throw InputException::invalidFieldValue('code', $group->getCode()); } - $customerGroup = null; + /** @var /Magento/Customer/Model/Group $customerGroup */ + $customerGroup = $this->_groupFactory->create(); + $customerGroup->setCode($group->getCode()); - if ($group->getId()) { - try { - $customerGroup = $this->_groupRegistry->retrieve($group->getId()); - } catch (NoSuchEntityException $e) { - throw NoSuchEntityException::singleField('id', $group->getId()); + /** @var int $taxClassId */ + $taxClassId = $group->getTaxClassId(); + if (!$taxClassId) { + $taxClassId = self::DEFAULT_TAX_CLASS_ID; + } + $this->_verifyTaxClassModel($taxClassId, $group); + + $customerGroup->setTaxClassId($taxClassId); + try { + $customerGroup->save(); + } catch (\Magento\Framework\Model\Exception $e) { + /** + * Would like a better way to determine this error condition but + * difficult to do without imposing more database calls + */ + if ($e->getMessage() === __('Customer Group already exists.')) { + throw new InvalidTransitionException('Customer Group already exists.'); } + throw $e; } - if (!$customerGroup) { - $customerGroup = $this->_groupFactory->create(); + return $customerGroup->getId(); + } + + /** + * {@inheritdoc} + */ + public function updateGroup($groupId, Data\CustomerGroup $group) + { + if (!$group->getCode()) { + throw InputException::invalidFieldValue('code', $group->getCode()); + } + + /** @var /Magento/Customer/Model/Group $customerGroup */ + $customerGroup = null; + try { + $customerGroup = $this->_groupRegistry->retrieve($groupId); + } catch (NoSuchEntityException $e) { + throw NoSuchEntityException::singleField('id', $groupId); } $customerGroup->setCode($group->getCode()); + /** @var int $taxClassId */ $taxClassId = $group->getTaxClassId(); if (!$taxClassId) { $taxClassId = self::DEFAULT_TAX_CLASS_ID; @@ -310,7 +349,7 @@ public function saveGroup(Data\CustomerGroup $group) throw $e; } - return $customerGroup->getId(); + return true; } /** diff --git a/app/code/Magento/Customer/Service/V1/CustomerGroupServiceInterface.php b/app/code/Magento/Customer/Service/V1/CustomerGroupServiceInterface.php index c2926abcaf55b..a635ff9dd42da 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerGroupServiceInterface.php +++ b/app/code/Magento/Customer/Service/V1/CustomerGroupServiceInterface.php @@ -59,7 +59,7 @@ public function searchGroups(\Magento\Framework\Service\V1\Data\SearchCriteria $ /** * Get a customer group by group ID. * - * @param int $groupId + * @param string $groupId * @throws \Magento\Framework\Exception\NoSuchEntityException If $groupId is not found * @return \Magento\Customer\Service\V1\Data\CustomerGroup */ @@ -68,7 +68,7 @@ public function getGroup($groupId); /** * Get default group * - * @param int $storeId Defaults the current store + * @param string $storeId Defaults the current store * @throws \Magento\Framework\Exception\NoSuchEntityException If default group for $storeId is not found * @return \Magento\Customer\Service\V1\Data\CustomerGroup */ @@ -77,29 +77,42 @@ public function getDefaultGroup($storeId = null); /** * Check if the group can be deleted * - * @param int $groupId + * @param string $groupId * @throws \Magento\Framework\Exception\NoSuchEntityException If group is not found * @return bool True, if this group can be deleted */ public function canDelete($groupId); /** - * Save group + * Create group * * @param \Magento\Customer\Service\V1\Data\CustomerGroup $group * @throws \Magento\Framework\Exception\InputException If there is a problem with the input - * @throws \Magento\Framework\Exception\NoSuchEntityException If a group ID is sent but the group does not exist * @throws \Magento\Framework\Exception\State\InvalidTransitionException * If saving customer group with customer group code that is used by an existing customer group * @throws \Magento\Framework\Model\Exception If something goes wrong during save * @return int customer group ID */ - public function saveGroup(\Magento\Customer\Service\V1\Data\CustomerGroup $group); + public function createGroup(\Magento\Customer\Service\V1\Data\CustomerGroup $group); + + /** + * Update group + * + * @param string $groupId + * @param \Magento\Customer\Service\V1\Data\CustomerGroup $group + * @throws \Magento\Framework\Exception\InputException If there is a problem with the input + * @throws \Magento\Framework\Exception\NoSuchEntityException If a group ID is sent but the group does not exist + * @throws \Magento\Framework\Exception\State\InvalidTransitionException + * If saving customer group with customer group code that is used by an existing customer group + * @throws \Magento\Framework\Model\Exception If something goes wrong during save + * @return bool True if this group was updated + */ + public function updateGroup($groupId, \Magento\Customer\Service\V1\Data\CustomerGroup $group); /** * Delete group * - * @param int $groupId + * @param string $groupId * @throws \Magento\Framework\Exception\NoSuchEntityException If $groupId is not found * @throws \Magento\Framework\Exception\StateException Thrown if cannot delete group * @throws \Exception If something goes wrong during delete diff --git a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php index b37ac0978714a..fad3a7af130d8 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php @@ -86,6 +86,9 @@ public function getAttributes($formCode) $attributes[$attribute->getAttributeCode()] = $this->attributeMetadataConverter ->createMetadataAttribute($attribute); } + if (empty($attributes)) { + throw NoSuchEntityException::singleField('formCode', $formCode); + } return $attributes; } @@ -96,7 +99,7 @@ public function getAttributeMetadata($attributeCode) { /** @var AbstractAttribute $attribute */ $attribute = $this->attributeMetadataDataProvider->getAttribute(self::ENTITY_TYPE_CUSTOMER, $attributeCode); - if ($attribute) { + if ($attribute && ($attributeCode === 'id' || !is_null($attribute->getId()))) { $attributeMetadata = $this->attributeMetadataConverter->createMetadataAttribute($attribute); return $attributeMetadata; } else { @@ -143,7 +146,11 @@ public function getCustomAttributesMetadata($dataObjectClassName = self::DATA_OB { $customAttributes = []; if (!$this->customerDataObjectMethods) { - $this->customerDataObjectMethods = array_flip(get_class_methods($dataObjectClassName)); + $dataObjectMethods = array_flip(get_class_methods($dataObjectClassName)); + $baseClassDataObjectMethods = array_flip( + get_class_methods('Magento\Framework\Service\Data\AbstractExtensibleObject') + ); + $this->customerDataObjectMethods = array_diff_key($dataObjectMethods, $baseClassDataObjectMethods); } foreach ($this->getAllAttributesMetadata() as $attributeMetadata) { $attributeCode = $attributeMetadata->getAttributeCode(); diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataConverter.php b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataConverter.php index 507bc29f52cdc..ccc20e2429df3 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataConverter.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataConverter.php @@ -72,9 +72,17 @@ public function createMetadataAttribute($attribute) $options = []; if ($attribute->usesSource()) { foreach ($attribute->getSource()->getAllOptions() as $option) { - $options[] = $this->_optionBuilder->setLabel($option['label']) - ->setValue($option['value']) - ->create(); + if (!is_array($option['value'])) { + $this->_optionBuilder->setValue($option['value']); + } else { + $optionArray = []; + foreach ($option['value'] as $optionArrayValues) { + $optionArray[] = $this->_optionBuilder->populateWithArray($optionArrayValues)->create(); + } + $this->_optionBuilder->setOptions($optionArray); + } + $this->_optionBuilder->setLabel($option['label']); + $options[] = $this->_optionBuilder->create(); } } $validationRules = []; diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/Option.php b/app/code/Magento/Customer/Service/V1/Data/Eav/Option.php index 9b13abae9cff4..ad03c669030c7 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/Option.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/Option.php @@ -37,6 +37,8 @@ class Option extends \Magento\Framework\Service\Data\AbstractExtensibleObject const VALUE = 'value'; + const OPTIONS = 'options'; + /** * Get option label * @@ -50,10 +52,20 @@ public function getLabel() /** * Get option value * - * @return string + * @return string|null */ public function getValue() { return $this->_get(self::VALUE); } + + /** + * Get nested options + * + * @return \Magento\Customer\Service\V1\Data\Eav\Option[]|null + */ + public function getOptions() + { + return $this->_get(self::OPTIONS); + } } diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/OptionBuilder.php b/app/code/Magento/Customer/Service/V1/Data/Eav/OptionBuilder.php index facd06ac9e38d..79e07a5240783 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/OptionBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/OptionBuilder.php @@ -49,4 +49,16 @@ public function setValue($value) { return $this->_set(Option::VALUE, $value); } + + + /** + * Set nested options + * + * @param \Magento\Customer\Service\V1\Data\Eav\Option[] $options + * @return $this + */ + public function setOptions($options) + { + return $this->_set(Option::OPTIONS, $options); + } } diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index ff5775d3367b7..e1d3c73fe7d80 100644 --- a/app/code/Magento/Customer/composer.json +++ b/app/code/Magento/Customer/composer.json @@ -3,28 +3,27 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-newsletter": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-wishlist": "0.1.0-alpha96", - "magento/module-index": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-review": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-page-cache": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", - "magento/module-authorization": "0.1.0-alpha96", - "magento/module-integration": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-newsletter": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-wishlist": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-review": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-page-cache": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", + "magento/module-authorization": "0.1.0-alpha97", + "magento/module-integration": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index e50495d8ebbe0..ae300c23a9ea9 100644 --- a/app/code/Magento/Customer/etc/module.xml +++ b/app/code/Magento/Customer/etc/module.xml @@ -40,7 +40,6 @@ - diff --git a/app/code/Magento/Customer/etc/webapi.xml b/app/code/Magento/Customer/etc/webapi.xml index c4efa8e5be8a6..4308398117b09 100644 --- a/app/code/Magento/Customer/etc/webapi.xml +++ b/app/code/Magento/Customer/etc/webapi.xml @@ -26,43 +26,61 @@ - + - + - + - + + + + + + + - + - - + + + + + + + + + + + + + + - + @@ -70,25 +88,25 @@ - + - + - + - + @@ -96,25 +114,25 @@ - + - + - + - + @@ -122,42 +140,41 @@ - + - - + + - - - + - + - - + + - + + + %customer_id% + - - + + @@ -165,142 +182,192 @@ %customer_id% - - + + - + - + + + + %customer_id% + + + + + + - + - + + + + + + + - + - + + + %customer_id% + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - + - + - + - + - + + + + + + + + + %customer_id% + + + - + - + + + + + + + %customer_id% + + + - + + + + + + + %customer_id% + + + - + - + + + + + + + + %customer_id% + + diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml index f0ae85bb1ab90..7fe3000489802 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml @@ -24,11 +24,9 @@ */ --> - - - account - - + + + diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_confirmation.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_confirmation.xml index 50a1eb3695feb..1b6bf3ce5ff22 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_confirmation.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_confirmation.xml @@ -24,11 +24,9 @@ */ --> - - - Send confirmation link - - + + Send confirmation link + diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_createpassword.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_createpassword.xml index 76236133690f6..5bb398f8e603c 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_createpassword.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_createpassword.xml @@ -24,11 +24,9 @@ */ --> - - - Reset a Password - - + + Reset a Password + Reset a Password diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml index 75baa8cb41cf4..ce979c44bc76b 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml @@ -24,11 +24,9 @@ */ --> - - - Forgot Your Password - - + + Forgot Your Password + Password forgotten diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 1ae68868affa6..ef1923e4fa5b6 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -43,9 +43,9 @@
    - +
    - +
    diff --git a/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml old mode 100755 new mode 100644 diff --git a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml index 45f5babe56f25..e7ef71d0d7504 100644 --- a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml @@ -79,9 +79,9 @@
    - +
    - +
    diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json index 548dc13521753..b422fcd758fa5 100644 --- a/app/code/Magento/CustomerImportExport/composer.json +++ b/app/code/Magento/CustomerImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-import-export": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-import-export": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php index 2de881bb8c260..2451af6d44d93 100644 --- a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php +++ b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php @@ -29,11 +29,6 @@ */ class Standard extends \Magento\Core\App\Router\Base { - /** - * @var \Magento\Framework\ObjectManager - */ - protected $_objectManager; - /** * Routers that must not been matched * @@ -48,11 +43,6 @@ class Standard extends \Magento\Core\App\Router\Base */ protected $_routerList; - /** - * @var \Magento\UrlRewrite\App\Request\RewriteService - */ - protected $_urlRewriteService; - /** * @var \Magento\DesignEditor\Helper\Data */ @@ -81,7 +71,6 @@ class Standard extends \Magento\Core\App\Router\Base * @param string $routerId * @param \Magento\Framework\Code\NameBuilder $nameBuilder * @param \Magento\Framework\App\RouterListInterface $routerList - * @param \Magento\UrlRewrite\App\Request\RewriteService $urlRewriteService * @param \Magento\DesignEditor\Helper\Data $designEditorHelper * @param \Magento\DesignEditor\Model\State $designEditorState * @param \Magento\Backend\Model\Auth\Session $session @@ -101,7 +90,6 @@ public function __construct( $routerId, \Magento\Framework\Code\NameBuilder $nameBuilder, \Magento\Framework\App\RouterListInterface $routerList, - \Magento\UrlRewrite\App\Request\RewriteService $urlRewriteService, \Magento\DesignEditor\Helper\Data $designEditorHelper, \Magento\DesignEditor\Model\State $designEditorState, \Magento\Backend\Model\Auth\Session $session @@ -119,7 +107,6 @@ public function __construct( $routerId, $nameBuilder ); - $this->_urlRewriteService = $urlRewriteService; $this->_routerList = $routerList; $this->_designEditorHelper = $designEditorHelper; $this->_state = $designEditorState; @@ -146,9 +133,10 @@ public function match(\Magento\Framework\App\RequestInterface $request) // prepare request to imitate $this->_prepareVdeRequest($request); - - // apply rewrites - $this->_urlRewriteService->applyRewrites($request); + /** + * Deprecated line of code was here which should be adopted if needed: + * $this->_urlRewriteService->applyRewrites($request); + */ // match routers $controller = null; diff --git a/app/code/Magento/DesignEditor/Model/Observer.php b/app/code/Magento/DesignEditor/Model/Observer.php index c2dfb3aa8850d..a2d8a4ca74c46 100644 --- a/app/code/Magento/DesignEditor/Model/Observer.php +++ b/app/code/Magento/DesignEditor/Model/Observer.php @@ -33,21 +33,31 @@ class Observer /** * @var \Magento\Framework\ObjectManager */ - protected $_objectManager; + protected $objectManager; /** * @var \Magento\DesignEditor\Helper\Data */ - protected $_helper; + protected $helper; + + /** + * @var \Magento\Framework\Registry + */ + protected $registry; /** * @param \Magento\Framework\ObjectManager $objectManager * @param \Magento\DesignEditor\Helper\Data $helper + * @param \Magento\Framework\Registry $registry */ - public function __construct(\Magento\Framework\ObjectManager $objectManager, \Magento\DesignEditor\Helper\Data $helper) - { - $this->_objectManager = $objectManager; - $this->_helper = $helper; + public function __construct( + \Magento\Framework\ObjectManager $objectManager, + \Magento\DesignEditor\Helper\Data $helper, + \Magento\Framework\Registry $registry + ) { + $this->objectManager = $objectManager; + $this->helper = $helper; + $this->registry = $registry; } /** @@ -59,16 +69,14 @@ public function __construct(\Magento\Framework\ObjectManager $objectManager, \Ma */ public function clearJs(EventObserver $event) { - /** @var $layout \Magento\Framework\View\LayoutInterface */ - $layout = $event->getEvent()->getLayout(); - $blockHead = $layout->getBlock('head'); - if (!$blockHead || !$blockHead->getData('vde_design_mode')) { + /** @var $pageAssets \Magento\Framework\View\Asset\GroupedCollection */ + $pageAssets = $this->objectManager->get('Magento\Framework\View\Asset\GroupedCollection'); + + /** @todo Temporary solution for vde mode should be verified with PO and refactored */ + if (!$this->registry->registry('vde_design_mode')) { return; } - /** @var $pageAssets \Magento\Framework\View\Asset\GroupedCollection */ - $pageAssets = $this->_objectManager->get('Magento\Framework\View\Asset\GroupedCollection'); - $vdeAssets = array(); foreach ($pageAssets->getGroups() as $group) { if ($group->getProperty('flag_name') == 'vde_design_mode') { @@ -100,14 +108,14 @@ public function saveQuickStyles($event) $theme = $event->getData('theme'); if ($configuration->getControlConfig() instanceof \Magento\DesignEditor\Model\Config\Control\QuickStyles) { /** @var $renderer \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer */ - $renderer = $this->_objectManager->create('Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer'); + $renderer = $this->objectManager->create('Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer'); $content = $renderer->render($configuration->getAllControlsData()); /** @var $cssService \Magento\DesignEditor\Model\Theme\Customization\File\QuickStyleCss */ - $cssService = $this->_objectManager->create( + $cssService = $this->objectManager->create( 'Magento\DesignEditor\Model\Theme\Customization\File\QuickStyleCss' ); /** @var $singleFile \Magento\Theme\Model\Theme\SingleFile */ - $singleFile = $this->_objectManager->create( + $singleFile = $this->objectManager->create( 'Magento\Theme\Model\Theme\SingleFile', array('fileService' => $cssService) ); @@ -126,7 +134,7 @@ public function saveChangeTime($event) /** @var $theme \Magento\Core\Model\Theme|null */ $theme = $event->getTheme() ?: $event->getDataObject()->getTheme(); /** @var $change \Magento\DesignEditor\Model\Theme\Change */ - $change = $this->_objectManager->create('Magento\DesignEditor\Model\Theme\Change'); + $change = $this->objectManager->create('Magento\DesignEditor\Model\Theme\Change'); if ($theme && $theme->getId()) { $change->loadByThemeId($theme->getId()); $change->setThemeId($theme->getId())->setChangeTime(null); diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json index cefb80f55336d..76d6d3100b3f6 100644 --- a/app/code/Magento/DesignEditor/composer.json +++ b/app/code/Magento/DesignEditor/composer.json @@ -3,17 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-url-rewrite": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/DesignEditor/etc/module.xml b/app/code/Magento/DesignEditor/etc/module.xml index 19dc07ee289fc..1067c9cc09798 100644 --- a/app/code/Magento/DesignEditor/etc/module.xml +++ b/app/code/Magento/DesignEditor/etc/module.xml @@ -34,7 +34,6 @@ -
    diff --git a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_files_index.xml b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_files_index.xml index b1771312b5448..844d664cb24e9 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_files_index.xml +++ b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_files_index.xml @@ -25,7 +25,6 @@ --> - diff --git a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_firstentrance.xml b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_firstentrance.xml index 44888b49adac5..ae4d67c378986 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_firstentrance.xml +++ b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_firstentrance.xml @@ -24,18 +24,10 @@ */ --> - - - - Magento_DesignEditor::js/bootstrap/edit.js - - - - - Magento_DesignEditor::css/styles.css - - - + + + + diff --git a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_index.xml b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_index.xml index 3270aad61c716..a1b98032ba728 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_index.xml +++ b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_index.xml @@ -24,18 +24,10 @@ */ --> - - - - Magento_DesignEditor::js/bootstrap/edit.js - - - - - Magento_DesignEditor::css/styles.css - - - + + + + diff --git a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_launch.xml b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_launch.xml index 76a45cf6a6e3a..7bff8f9b72a28 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_launch.xml +++ b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_launch.xml @@ -24,66 +24,52 @@ */ --> - - - Magento_DesignEditor::editor.phtml - - - - - 1 - - - - jquery/fileUploader/css/jquery.fileupload-ui.css - - - - - Magento_DesignEditor::css/styles.css - - - - - Magento_DesignEditor::js/bootstrap/launch.js - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor.phtml index 2a9a2c52cabca..a540501b85acb 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor.phtml +++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor.phtml @@ -22,20 +22,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> - - - - getChildHtml('head') ?> - -getBodyClass() ? ' class="' . $this->getBodyClass() . '"' : ''; ?>> - getChildHtml('content') ?> - - - +getChildHtml('content') ?> + diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index 663cd5d8450b2..764da496332e2 100644 --- a/app/code/Magento/Dhl/composer.json +++ b/app/code/Magento/Dhl/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-shipping": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-shipping": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Directory/Model/Config/Source/Country/Full.php b/app/code/Magento/Directory/Model/Config/Source/Country/Full.php index fdb06a32f70c1..4ed1d718fc3c7 100644 --- a/app/code/Magento/Directory/Model/Config/Source/Country/Full.php +++ b/app/code/Magento/Directory/Model/Config/Source/Country/Full.php @@ -23,6 +23,9 @@ */ namespace Magento\Directory\Model\Config\Source\Country; +/** + * @codeCoverageIgnore + */ class Full extends \Magento\Directory\Model\Config\Source\Country implements \Magento\Framework\Option\ArrayInterface { /** diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json index e52b58243fb29..a58450d3f7f0e 100644 --- a/app/code/Magento/Directory/composer.json +++ b/app/code/Magento/Directory/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php index 2c0816e33cd04..0ff961d898707 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php @@ -160,11 +160,8 @@ public function getContentTabId() */ protected function _toHtml() { - $accordion = $this->getLayout()->createBlock( - 'Magento\Backend\Block\Widget\Accordion' - )->setId( - $this->accordionBlockId - ); + $accordion = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Accordion') + ->setId($this->accordionBlockId); $accordion->addItem( 'samples', array( diff --git a/app/code/Magento/Downloadable/Controller/Customer/Products.php b/app/code/Magento/Downloadable/Controller/Customer/Products.php index b2db83e666724..f3862e933e8a6 100644 --- a/app/code/Magento/Downloadable/Controller/Customer/Products.php +++ b/app/code/Magento/Downloadable/Controller/Customer/Products.php @@ -71,10 +71,7 @@ public function execute() if ($block = $this->_view->getLayout()->getBlock('downloadable_customer_products_list')) { $block->setRefererUrl($this->_redirect->getRefererUrl()); } - $headBlock = $this->_view->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('My Downloadable Products')); - } + $this->_view->getPage()->getConfig()->setTitle(__('My Downloadable Products')); $this->_view->renderLayout(); } } diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json index d4f93e34f4dc0..427bfb8644938 100644 --- a/app/code/Magento/Downloadable/composer.json +++ b/app/code/Magento/Downloadable/composer.json @@ -3,25 +3,26 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-wishlist": "0.1.0-alpha96", - "magento/module-gift-message": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-wishlist": "0.1.0-alpha97", + "magento/module-gift-message": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/module-msrp": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php b/app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php deleted file mode 100644 index 139c4ffc8f6e4..0000000000000 --- a/app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php +++ /dev/null @@ -1,53 +0,0 @@ -getAttribute('catalog_product', 'msrp_enabled', 'apply_to'); -if ($msrpEnabled && strstr($msrpEnabled, \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) == false) { - $installer->updateAttribute( - 'catalog_product', - 'msrp_enabled', - array('apply_to' => $msrpEnabled . ',' . \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) - ); -} - -$msrpDisplay = $installer->getAttribute('catalog_product', 'msrp_display_actual_price_type', 'apply_to'); -if ($msrpDisplay && strstr($msrpEnabled, \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) == false) { - $installer->updateAttribute( - 'catalog_product', - 'msrp_display_actual_price_type', - array('apply_to' => $msrpDisplay . ',' . \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) - ); -} - -$msrp = $installer->getAttribute('catalog_product', 'msrp', 'apply_to'); -if ($msrp && strstr($msrpEnabled, \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) == false) { - $installer->updateAttribute( - 'catalog_product', - 'msrp', - array('apply_to' => $msrp . ',' . \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) - ); -} diff --git a/app/code/Magento/Downloadable/etc/module.xml b/app/code/Magento/Downloadable/etc/module.xml index 9a0a14069bccd..95c8bd61ba4cb 100644 --- a/app/code/Magento/Downloadable/etc/module.xml +++ b/app/code/Magento/Downloadable/etc/module.xml @@ -43,6 +43,7 @@ +
    diff --git a/app/code/Magento/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml b/app/code/Magento/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml index aa7e7b9bf2f31..fbb9bfe93cfa7 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml @@ -24,6 +24,9 @@ */ --> + + + @@ -36,7 +39,6 @@ product.price.render.default link_price - 1 diff --git a/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/links.phtml b/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/links.phtml index f64a777e6e2e7..f2991c53f498c 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/links.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/links.phtml @@ -31,7 +31,8 @@ +
    + + +
    diff --git a/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/samples.phtml b/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/samples.phtml index 83ab77b61076e..054fcf1821b7f 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/samples.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/samples.phtml @@ -30,13 +30,13 @@ ?> hasSamples()): ?> -
    -
    getSamplesTitle() ?>
    +
    +
    getSamplesTitle() ?>
    getSamples() ?> -
    +
    getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?> - class="sample link"> + class="item-link samples-item-link"> escapeHtml($_sample->getTitle()) ?>
    diff --git a/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml b/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml index 8f5d09241888d..73b59b516bee0 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml @@ -24,8 +24,11 @@ ?> getItem(); -$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility(); -$canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_item->getProduct(), \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type::TYPE_BEFORE_ORDER_CONFIRM); +$product = $_item->getProduct(); +$isVisibleProduct = $product->isVisibleInSiteVisibility(); +/** @var \Magento\Msrp\Helper\Data $helper */ +$helper = $this->helper('Magento\Msrp\Helper\Data'); +$canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinimalPriceLessMsrp($product); ?> getChildHtml('item_extra') ?> @@ -36,7 +39,7 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite title="escapeHtml($this->getProductName()) ?>" class="product photo product-item-photo"> - getLayout()->createBlock('Magento\Catalog\Block\Product\Image')->init($_item->getProduct(), 'cart_page_product_thumbnail')->toHtml(); ?> + getLayout()->createBlock('Magento\Catalog\Block\Product\Image')->init($product, 'cart_page_product_thumbnail')->toHtml(); ?> hasProductUrl()):?>
    @@ -79,17 +82,15 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite - + getId(); ?> + require(['prototype'], function () { + Catalog.Map.addHelpLink($(''), ""); + }); + diff --git a/app/code/Magento/Downloadable/view/frontend/templates/sales/order/invoice/items/renderer/downloadable.phtml b/app/code/Magento/Downloadable/view/frontend/templates/sales/order/invoice/items/renderer/downloadable.phtml index 509f1f54c69d0..fc18f0c56c086 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/sales/order/invoice/items/renderer/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/sales/order/invoice/items/renderer/downloadable.phtml @@ -78,7 +78,7 @@ getItemPriceHtml(); ?> - getQty()*1 ?> + getQty()*1 ?> getItemRowTotalHtml(); ?> diff --git a/app/code/Magento/Downloadable/view/frontend/web/downloadable.js b/app/code/Magento/Downloadable/view/frontend/web/downloadable.js index 86931ae8cac47..9431e745cae64 100644 --- a/app/code/Magento/Downloadable/view/frontend/web/downloadable.js +++ b/app/code/Magento/Downloadable/view/frontend/web/downloadable.js @@ -28,9 +28,25 @@ define([ $.widget('mage.downloadable', { _create: function() { + var self = this; + this.element.find(this.options.linkElement).on('change', $.proxy(function() { this._reloadPrice(); }, this)); + + this.element.find(this.options.allElements).on('change', function() { + if (this.checked) { + $('label[for="' + this.id + '"] > span').text($(this).attr('data-checked')); + self.element.find(self.options.linkElement + ':not(:checked)').each(function(){ + $(this).trigger('click'); + }); + } else { + $('[for="' + this.id + '"] > span').text($(this).attr('data-notchecked')); + self.element.find(self.options.linkElement + ':checked').each(function(){ + $(this).trigger('click'); + }); + } + }); }, /** @@ -48,6 +64,7 @@ define([ inclTaxPrice += this.options.config.links[$(element).val()].inclTaxPrice; exclTaxPrice += this.options.config.links[$(element).val()].exclTaxPrice; }, this)); + this.element.trigger('changePrice', { 'config': 'config', 'price': { diff --git a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php index 77fab5ff5c25f..97efc56711ed7 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php @@ -38,7 +38,7 @@ abstract class AbstractData * * @var \Magento\Eav\Model\Attribute */ - protected $_attribite; + protected $_attribute; /** * Entity instance @@ -121,7 +121,7 @@ public function __construct( */ public function setAttribute(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute) { - $this->_attribite = $attribute; + $this->_attribute = $attribute; return $this; } @@ -133,10 +133,10 @@ public function setAttribute(\Magento\Eav\Model\Entity\Attribute\AbstractAttribu */ public function getAttribute() { - if (!$this->_attribite) { + if (!$this->_attribute) { throw new CoreException(__('Attribute object is undefined')); } - return $this->_attribite; + return $this->_attribute; } /** diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php index b159e60b695de..7cf458c4fcc6c 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php @@ -99,6 +99,28 @@ public function getAllOptions($withEmpty = true, $defaultValues = false) return $options; } + /** + * Retrieve Option values array by ids + * + * @param string|array $ids + * @param bool $withEmpty Add empty option to array + * @return array + */ + public function getSpecificOptions($ids, $withEmpty = true) + { + $options = $this->_attrOptionCollectionFactory->create() + ->setPositionOrder('asc') + ->setAttributeFilter($this->getAttribute()->getId()) + ->addFieldToFilter('main_table.option_id', array('in' => $ids)) + ->setStoreFilter($this->getAttribute()->getStoreId()) + ->load() + ->toOptionArray(); + if ($withEmpty) { + array_unshift($options, array('label' => '', 'value' => '')); + } + return $options; + } + /** * Get a text for option value * @@ -113,7 +135,7 @@ public function getOptionText($value) $value = explode(',', $value); } - $options = $this->getAllOptions(false); + $options = $this->getSpecificOptions($value, false); if ($isMultiple) { $values = array(); diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json index a3e663f309060..4762b42b045c6 100644 --- a/app/code/Magento/Eav/composer.json +++ b/app/code/Magento/Eav/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php index ec40d0fbe7829..b3dc3efb20707 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php @@ -68,23 +68,9 @@ public function __construct( */ protected function _prepareLayout() { - if ($head = $this->getLayout()->getBlock('head')) { - $head->addChild( - 'prototype-window-js', - 'Magento\Theme\Block\Html\Head\Script', - array('file' => 'prototype/window.js') - ); - $head->addChild( - 'prototype-windows-themes-default-css', - 'Magento\Theme\Block\Html\Head\Css', - array('file' => 'prototype/windows/themes/default.css') - ); - $head->addChild( - 'magento-core-prototype-magento-css', - 'Magento\Theme\Block\Html\Head\Css', - array('file' => 'Magento_Core::prototype/magento.css') - ); - } + $this->pageConfig->addPageAsset('prototype/window.js'); + $this->pageConfig->addPageAsset('prototype/windows/themes/default.css'); + $this->pageConfig->addPageAsset('Magento_Core::prototype/magento.css'); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 7a66e13c43e3a..8b02103b840cb 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -3,16 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-cms": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-cms": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Email/etc/module.xml b/app/code/Magento/Email/etc/module.xml index bbc8e18e27a4c..76ddc96cf16fa 100644 --- a/app/code/Magento/Email/etc/module.xml +++ b/app/code/Magento/Email/etc/module.xml @@ -35,7 +35,6 @@ - diff --git a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_edit.xml b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_edit.xml index 2b1cae0e2e359..fd109d1916649 100644 --- a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_edit.xml +++ b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_edit.xml @@ -24,11 +24,7 @@ */ --> - - - - Magento_Email::js/bootstrap.js - - - + + + diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index f80702833742f..c23658cc4a48f 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-shipping": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-shipping": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index 7cfb649cea511..38540a41549df 100644 --- a/app/code/Magento/GiftMessage/composer.json +++ b/app/code/Magento/GiftMessage/composer.json @@ -3,21 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-multishipping": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-multishipping": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/GiftMessage/etc/module.xml b/app/code/Magento/GiftMessage/etc/module.xml index e61d225a16b9c..cd07313e98678 100644 --- a/app/code/Magento/GiftMessage/etc/module.xml +++ b/app/code/Magento/GiftMessage/etc/module.xml @@ -39,7 +39,6 @@ - diff --git a/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_view.xml index 51214d4ea0117..7101a6292d6b7 100644 --- a/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_view.xml +++ b/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_view.xml @@ -24,13 +24,9 @@ */ --> - - - - Magento_Core::prototype/magento.css - - - + + + diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json index e37ee726ebb03..5d8a4ec9ad4d0 100644 --- a/app/code/Magento/GoogleAdwords/composer.json +++ b/app/code/Magento/GoogleAdwords/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json index ab0d0972e6bda..1520dd03b0979 100644 --- a/app/code/Magento/GoogleAnalytics/composer.json +++ b/app/code/Magento/GoogleAnalytics/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json index 5fcca9ffc28b7..b3bc0b4e2887a 100644 --- a/app/code/Magento/GoogleOptimizer/composer.json +++ b/app/code/Magento/GoogleOptimizer/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-google-analytics": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-cms": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-google-analytics": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-cms": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_category_view.xml index 160d76cfb1661..5f6e4a8562614 100644 --- a/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_category_view.xml +++ b/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_category_view.xml @@ -24,7 +24,7 @@ */ --> - + - + diff --git a/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_product_view.xml index 536bfac606569..c8e69375781eb 100644 --- a/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_product_view.xml @@ -24,7 +24,7 @@ */ --> - + - + diff --git a/app/code/Magento/GoogleOptimizer/view/frontend/layout/cms_page_view.xml b/app/code/Magento/GoogleOptimizer/view/frontend/layout/cms_page_view.xml index 48b2d671f5695..c8f53e719a5fe 100644 --- a/app/code/Magento/GoogleOptimizer/view/frontend/layout/cms_page_view.xml +++ b/app/code/Magento/GoogleOptimizer/view/frontend/layout/cms_page_view.xml @@ -24,7 +24,7 @@ */ --> - + - + diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Condition.php b/app/code/Magento/GoogleShopping/Model/Attribute/Condition.php index 1ed8a8345d5e7..c8ea374374407 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute/Condition.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute/Condition.php @@ -54,6 +54,7 @@ public function convertAttribute($product, $entry) $availableConditions = array(self::CONDITION_NEW, self::CONDITION_USED, self::CONDITION_REFURBISHED); $mapValue = $this->getProductAttributeValue($product); + $mapValue = !is_null($mapValue) ? mb_convert_case($mapValue, MB_CASE_LOWER) : $mapValue; if (!is_null($mapValue) && in_array($mapValue, $availableConditions)) { $condition = $mapValue; } else { diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json index f457471c4f18a..40ab8c4fc338f 100644 --- a/app/code/Magento/GoogleShopping/composer.json +++ b/app/code/Magento/GoogleShopping/composer.json @@ -3,20 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleShopping/etc/adminhtml/events.xml b/app/code/Magento/GoogleShopping/etc/adminhtml/events.xml index f10715e501ee8..b4fe8d5f9e9b2 100644 --- a/app/code/Magento/GoogleShopping/etc/adminhtml/events.xml +++ b/app/code/Magento/GoogleShopping/etc/adminhtml/events.xml @@ -24,7 +24,7 @@ */ --> - + diff --git a/app/code/Magento/GoogleShopping/etc/module.xml b/app/code/Magento/GoogleShopping/etc/module.xml index 89c6286283da0..a1d4df7bdee99 100644 --- a/app/code/Magento/GoogleShopping/etc/module.xml +++ b/app/code/Magento/GoogleShopping/etc/module.xml @@ -37,7 +37,6 @@ - diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml b/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml index 07ac63527a8ea..5ff3bd78037aa 100644 --- a/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml +++ b/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml @@ -24,16 +24,12 @@ */ --> - - - - Magento_GoogleShopping::js/bootstrap.js - - - + + + - diff --git a/app/code/Magento/GoogleShopping/view/frontend/layout/cms_index_index.xml b/app/code/Magento/GoogleShopping/view/frontend/layout/cms_index_index.xml index fff3f77e0de8c..48ddf5978c5c2 100644 --- a/app/code/Magento/GoogleShopping/view/frontend/layout/cms_index_index.xml +++ b/app/code/Magento/GoogleShopping/view/frontend/layout/cms_index_index.xml @@ -24,7 +24,7 @@ */ --> - + - + diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json index 9387c28ecddfc..ff4046298de10 100644 --- a/app/code/Magento/GroupedImportExport/composer.json +++ b/app/code/Magento/GroupedImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-import-export": "0.1.0-alpha96", - "magento/module-catalog-import-export": "0.1.0-alpha96", - "magento/module-grouped-product": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-import-export": "0.1.0-alpha97", + "magento/module-catalog-import-export": "0.1.0-alpha97", + "magento/module-grouped-product": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php index 9308008bb7ad0..b4e77702c70ee 100644 --- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php @@ -93,6 +93,9 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType */ protected $_appState; + /** @var \Magento\Msrp\Helper\Data */ + protected $msrpData; + /** * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Option $catalogProductOption @@ -108,6 +111,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus * @param \Magento\Framework\App\State $appState + * @param \Magento\Msrp\Helper\Data $msrpData * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -127,12 +131,14 @@ public function __construct( \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus, \Magento\Framework\App\State $appState, + \Magento\Msrp\Helper\Data $msrpData, array $data = array() ) { $this->productLinks = $catalogProductLink; $this->_storeManager = $storeManager; $this->_catalogProductStatus = $catalogProductStatus; $this->_appState = $appState; + $this->msrpData = $msrpData; parent::__construct( $productFactory, $catalogProductOption, @@ -481,4 +487,19 @@ public function beforeSave($product) } return parent::beforeSave($product); } + + /** + * @param \Magento\Catalog\Model\Product $product + * @return int + */ + public function getChildrenMsrp(\Magento\Catalog\Model\Product $product) + { + $prices = []; + foreach ($this->getAssociatedProducts($product) as $item) { + if ($item->getMsrp() !== null) { + $prices[] = $item->getMsrp(); + } + } + return min($prices); + } } diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index b0fba94c66a23..f1fcf590315ad 100644 --- a/app/code/Magento/GroupedProduct/composer.json +++ b/app/code/Magento/GroupedProduct/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-msrp": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/GroupedProduct/etc/module.xml b/app/code/Magento/GroupedProduct/etc/module.xml index c6b6ca0063ee5..9d06488e7316c 100644 --- a/app/code/Magento/GroupedProduct/etc/module.xml +++ b/app/code/Magento/GroupedProduct/etc/module.xml @@ -40,7 +40,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml index ca72e17fd6570..e40ba57b44a27 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml @@ -25,13 +25,9 @@ --> - - - - Magento_GroupedProduct::css/grouped-product.css - - - + + + diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js b/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js index ffeaa58a5d47d..06975db91c8cb 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js +++ b/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js @@ -25,7 +25,8 @@ define([ "jquery", "jquery/ui", "mage/translate", - "jquery/template" + "jquery/template", + "mage/adminhtml/grid" ], function($){ 'use strict'; $.widget('mage.groupedProduct', { diff --git a/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml b/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml index 46724dca1d3f1..10a042dcc6ae5 100644 --- a/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml @@ -38,7 +38,7 @@ if ($minProduct) { $minProduct->getPriceInfo()->getPrice('final_price')->getAmount(), $minProduct, $minProduct->getPriceInfo()->getPrice('final_price'), - [] + ['include_container' => true] ); } ?> diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json index 35e9b69c05d60..561eddbb92c57 100644 --- a/app/code/Magento/ImportExport/composer.json +++ b/app/code/Magento/ImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-indexer": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-indexer": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Index/App/Indexer.php b/app/code/Magento/Index/App/Indexer.php deleted file mode 100644 index 530a44aceb296..0000000000000 --- a/app/code/Magento/Index/App/Indexer.php +++ /dev/null @@ -1,108 +0,0 @@ -_reportDir = $reportDir; - $this->_filesystem = $filesystem; - $this->_indexerFactory = $indexerFactory; - $this->_response = $response; - } - - /** - * Run application - * - * @return \Magento\Framework\App\ResponseInterface - */ - public function launch() - { - /* Clean reports */ - $directory = $this->_filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem::ROOT_DIR); - $path = $directory->getRelativePath($this->_reportDir); - if ($directory->isExist($path)) { - $directory->delete($path); - } - - /* Run all indexer processes */ - /** @var $indexer \Magento\Index\Model\Indexer */ - $indexer = $this->_indexerFactory->create(); - /** @var $process \Magento\Index\Model\Process */ - foreach ($indexer->getProcessesCollection() as $process) { - if ($process->getIndexer()->isVisible()) { - $process->reindexEverything(); - } - } - $this->_response->setCode(0); - return $this->_response; - } - - /** - * {@inheritdoc} - */ - public function catchException(App\Bootstrap $bootstrap, \Exception $exception) - { - return false; - } -} diff --git a/app/code/Magento/Index/App/Shell.php b/app/code/Magento/Index/App/Shell.php deleted file mode 100644 index 0898d2529433e..0000000000000 --- a/app/code/Magento/Index/App/Shell.php +++ /dev/null @@ -1,88 +0,0 @@ -_entryFileName = $entryFileName; - $this->_shellFactory = $shellFactory; - $this->_response = $response; - } - - /** - * Run application - * - * @return \Magento\Framework\App\ResponseInterface - */ - public function launch() - { - /** @var $shell \Magento\Index\Model\Shell */ - $shell = $this->_shellFactory->create(array('entryPoint' => $this->_entryFileName)); - $shell->run(); - if ($shell->hasErrors()) { - $this->_response->setCode(-1); - } else { - $this->_response->setCode(0); - } - return $this->_response; - } - - /** - * {@inheritdoc} - */ - public function catchException(Bootstrap $bootstrap, \Exception $exception) - { - return false; - } -} diff --git a/app/code/Magento/Index/Block/Adminhtml/Process.php b/app/code/Magento/Index/Block/Adminhtml/Process.php deleted file mode 100644 index 0b69d2f65632e..0000000000000 --- a/app/code/Magento/Index/Block/Adminhtml/Process.php +++ /dev/null @@ -1,39 +0,0 @@ -_blockGroup = 'Magento_Index'; - $this->_controller = 'adminhtml_process'; - $this->_headerText = __('Index Management'); - parent::_construct(); - $this->buttonList->remove('add'); - } -} diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php b/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php deleted file mode 100644 index 959dc8a818a39..0000000000000 --- a/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php +++ /dev/null @@ -1,106 +0,0 @@ -_coreRegistry = $registry; - parent::__construct($context, $data); - } - - /** - * @return void - */ - protected function _construct() - { - $this->_objectId = 'process_id'; - $this->_controller = 'adminhtml_process'; - $this->_blockGroup = 'Magento_Index'; - - parent::_construct(); - - $this->buttonList->update('save', 'label', __('Save Process')); - if ($this->_coreRegistry->registry('current_index_process')) { - $this->buttonList->add( - 'reindex', - array('label' => __('Reindex Data'), 'onclick' => "setLocation('{$this->getRunUrl()}')") - ); - } - $this->buttonList->remove('reset'); - $this->buttonList->remove('delete'); - } - - /** - * Get back button url - * - * @return string - */ - public function getBackUrl() - { - return $this->getUrl('adminhtml/process/list'); - } - - /** - * Get process reindex action url - * - * @return string - */ - public function getRunUrl() - { - return $this->getUrl( - 'adminhtml/process/reindexProcess', - array('process' => $this->_coreRegistry->registry('current_index_process')->getId()) - ); - } - - /** - * Retrieve text for header element depending on loaded page - * - * @return string - */ - public function getHeaderText() - { - $process = $this->_coreRegistry->registry('current_index_process'); - if ($process && $process->getId()) { - return __("'%1' Index Process Information", $process->getIndexer()->getName()); - } - } -} diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tab/Main.php b/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tab/Main.php deleted file mode 100644 index 2826f39441d93..0000000000000 --- a/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tab/Main.php +++ /dev/null @@ -1,131 +0,0 @@ -_coreRegistry->registry('current_index_process'); - /** @var \Magento\Framework\Data\Form $form */ - $form = $this->_formFactory->create(); - $form->setHtmlIdPrefix('index_process_'); - $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('General'), 'class' => 'fieldset-wide')); - - $fieldset->addField('process_id', 'hidden', array('name' => 'process', 'value' => $model->getId())); - - $fieldset->addField( - 'name', - 'note', - array( - 'label' => __('Index Name'), - 'title' => __('Index Name'), - 'text' => '' . $model->getIndexer()->getName() . '' - ) - ); - - $fieldset->addField( - 'description', - 'note', - array( - 'label' => __('Index Description'), - 'title' => __('Index Description'), - 'text' => $model->getIndexer()->getDescription() - ) - ); - - $fieldset->addField( - 'mode', - 'select', - array( - 'label' => __('Index Mode'), - 'title' => __('Index Mode'), - 'name' => 'mode', - 'value' => $model->getMode(), - 'values' => $model->getModesOptions() - ) - ); - - $this->setForm($form); - return parent::_prepareForm(); - } - - /** - * Prepare label for tab - * - * @return string - */ - public function getTabLabel() - { - return __('Process Information'); - } - - /** - * Prepare title for tab - * - * @return string - */ - public function getTabTitle() - { - return __('Process Information'); - } - - /** - * Returns status flag about this tab can be shown or not - * - * @return true - */ - public function canShowTab() - { - return true; - } - - /** - * Returns status flag about this tab hidden or not - * - * @return false - */ - public function isHidden() - { - return false; - } - - /** - * Check permission for passed action - * - * @param string $action - * @return true - */ - protected function _isAllowedAction($action) - { - return true; - } -} diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Grid.php b/app/code/Magento/Index/Block/Adminhtml/Process/Grid.php deleted file mode 100644 index 74e9efba01e19..0000000000000 --- a/app/code/Magento/Index/Block/Adminhtml/Process/Grid.php +++ /dev/null @@ -1,326 +0,0 @@ -_eventRepository = $eventRepository; - $this->_indexProcess = $indexProcess; - $this->_collectionFactory = $factory; - } - - /** - * Class constructor - * - * @return void - */ - protected function _construct() - { - parent::_construct(); - $this->setId('indexer_processes_grid'); - $this->setFilterVisibility(false); - $this->setPagerVisibility(false); - } - - /** - * Prepare grid collection - * - * @return $this - */ - protected function _prepareCollection() - { - $this->setCollection($this->_collectionFactory->create()); - parent::_prepareCollection(); - - return $this; - } - - /** - * Add name and description to collection elements - * - * @return $this - */ - protected function _afterLoadCollection() - { - /** @var $item \Magento\Index\Model\Process */ - foreach ($this->_collection as $key => $item) { - if (!$item->getIndexer()->isVisible()) { - $this->_collection->removeItemByKey($key); - continue; - } - $item->setName($item->getIndexer()->getName()); - $item->setDescription($item->getIndexer()->getDescription()); - $item->setUpdateRequired($this->_eventRepository->hasUnprocessed($item) ? 1 : 0); - if ($item->isLocked()) { - $item->setStatus(\Magento\Index\Model\Process::STATUS_RUNNING); - } - } - return $this; - } - - /** - * Prepare grid columns - * - * @return $this - */ - protected function _prepareColumns() - { - $this->addColumn( - 'indexer_code', - array('header' => __('Index'), 'index' => 'name', 'sortable' => false) - ); - - $this->addColumn( - 'description', - array('header' => __('Description'), 'index' => 'description', 'sortable' => false) - ); - - $this->addColumn( - 'mode', - array( - 'header' => __('Mode'), - 'index' => 'mode', - 'type' => 'options', - 'options' => $this->_indexProcess->getModesOptions() - ) - ); - - $this->addColumn( - 'status', - array( - 'header' => __('Status'), - 'index' => 'status', - 'type' => 'options', - 'options' => $this->_indexProcess->getStatusesOptions(), - 'frame_callback' => array($this, 'decorateStatus') - ) - ); - - $this->addColumn( - 'update_required', - array( - 'header' => __('Update Required'), - 'sortable' => false, - 'index' => 'update_required', - 'type' => 'options', - 'options' => $this->_indexProcess->getUpdateRequiredOptions(), - 'frame_callback' => array($this, 'decorateUpdateRequired') - ) - ); - - $this->addColumn( - 'ended_at', - array( - 'header' => __('Updated'), - 'type' => 'datetime', - 'index' => 'ended_at', - 'frame_callback' => array($this, 'decorateDate') - ) - ); - - $this->addColumn( - 'action', - array( - 'header' => __('Action'), - 'type' => 'action', - 'getter' => 'getId', - 'actions' => array( - array( - 'caption' => __('Reindex Data'), - 'url' => array('base' => '*/*/reindexProcess'), - 'field' => 'process' - ) - ), - 'filter' => false, - 'sortable' => false, - 'is_system' => true - ) - ); - - parent::_prepareColumns(); - - return $this; - } - - /** - * Decorate status column values - * - * @param string $value - * @param \Magento\Index\Model\Process $row - * @param \Magento\Backend\Block\Widget\Grid\Column $column - * @param bool $isExport - * - * @return string - */ - public function decorateStatus($value, $row, $column, $isExport) - { - $class = ''; - switch ($row->getStatus()) { - case \Magento\Index\Model\Process::STATUS_PENDING: - $class = 'grid-severity-notice'; - break; - case \Magento\Index\Model\Process::STATUS_RUNNING: - $class = 'grid-severity-major'; - break; - case \Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX: - $class = 'grid-severity-critical'; - break; - } - return '' . $value . ''; - } - - /** - * Decorate "Update Required" column values - * - * @param string $value - * @param \Magento\Index\Model\Process $row - * @param \Magento\Backend\Block\Widget\Grid\Column $column - * @param bool $isExport - * - * @return string - */ - public function decorateUpdateRequired($value, $row, $column, $isExport) - { - $class = ''; - switch ($row->getUpdateRequired()) { - case 0: - $class = 'grid-severity-notice'; - break; - case 1: - $class = 'grid-severity-critical'; - break; - } - return '' . $value . ''; - } - - /** - * Decorate last run date coumn - * - * @param string $value - * @param \Magento\Index\Model\Process $row - * @param \Magento\Backend\Block\Widget\Grid\Column $column - * @param bool $isExport - * - * @return string - */ - public function decorateDate($value, $row, $column, $isExport) - { - if (!$value) { - return __('Never'); - } - return $value; - } - - /** - * Get row edit url - * - * @param \Magento\Index\Model\Process $row - * - * @return string - */ - public function getRowUrl($row) - { - return $this->getUrl('adminhtml/*/edit', array('process' => $row->getId())); - } - - /** - * Add mass-actions to grid - * - * @return $this - */ - protected function _prepareMassaction() - { - $this->setMassactionIdField('process_id'); - $this->getMassactionBlock()->setFormFieldName('process'); - - $modeOptions = $this->_indexProcess->getModesOptions(); - - $this->getMassactionBlock()->addItem( - 'change_mode', - array( - 'label' => __('Change Index Mode'), - 'url' => $this->getUrl('adminhtml/*/massChangeMode'), - 'additional' => array( - 'mode' => array( - 'name' => 'index_mode', - 'type' => 'select', - 'class' => 'required-entry', - 'label' => __('Index mode'), - 'values' => $modeOptions - ) - ) - ) - ); - - $this->getMassactionBlock()->addItem( - 'reindex', - array('label' => __('Reindex Data'), 'url' => $this->getUrl('adminhtml/*/massReindex'), 'selected' => true) - ); - - return $this; - } -} diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process.php b/app/code/Magento/Index/Controller/Adminhtml/Process.php deleted file mode 100644 index 28b247780f7d0..0000000000000 --- a/app/code/Magento/Index/Controller/Adminhtml/Process.php +++ /dev/null @@ -1,92 +0,0 @@ -_coreRegistry = $coreRegistry; - $this->_processFactory = $processFactory; - $this->_indexer = $indexer; - parent::__construct($context); - } - - /** - * Initialize process object by request - * - * @return \Magento\Index\Model\Process|false - */ - protected function _initProcess() - { - $processId = $this->getRequest()->getParam('process'); - if ($processId) { - /** @var $process \Magento\Index\Model\Process */ - $process = $this->_processFactory->create()->load($processId); - if ($process->getId() && $process->getIndexer()->isVisible()) { - return $process; - } - } - return false; - } - - /** - * Check ACL permissins - * - * @return bool - */ - protected function _isAllowed() - { - return $this->_authorization->isAllowed('Magento_Index::index'); - } -} diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process/Edit.php b/app/code/Magento/Index/Controller/Adminhtml/Process/Edit.php deleted file mode 100644 index 3cd62ad572204..0000000000000 --- a/app/code/Magento/Index/Controller/Adminhtml/Process/Edit.php +++ /dev/null @@ -1,52 +0,0 @@ -_initProcess(); - if ($process) { - $this->_title->add($process->getIndexCode()); - $this->_title->add(__('System')); - $this->_title->add(__('Index Management')); - $this->_title->add(__($process->getIndexer()->getName())); - - $this->_coreRegistry->register('current_index_process', $process); - $this->_view->loadLayout(); - $this->_view->renderLayout(); - } else { - $this->messageManager->addError(__('Cannot initialize the indexer process.')); - $this->_redirect('adminhtml/*/list'); - } - } -} diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process/MassChangeMode.php b/app/code/Magento/Index/Controller/Adminhtml/Process/MassChangeMode.php deleted file mode 100644 index c5b05b84b50f6..0000000000000 --- a/app/code/Magento/Index/Controller/Adminhtml/Process/MassChangeMode.php +++ /dev/null @@ -1,61 +0,0 @@ -getRequest()->getParam('process'); - if (empty($processIds) || !is_array($processIds)) { - $this->messageManager->addError(__('Please select Index(es)')); - } else { - try { - $counter = 0; - $mode = $this->getRequest()->getParam('index_mode'); - foreach ($processIds as $processId) { - /* @var $process \Magento\Index\Model\Process */ - $process = $this->_processFactory->create()->load($processId); - if ($process->getId() && $process->getIndexer()->isVisible()) { - $process->setMode($mode)->save(); - $counter++; - } - } - $this->messageManager->addSuccess(__('Total of %1 index(es) have changed index mode.', $counter)); - } catch (\Magento\Framework\Model\Exception $e) { - $this->messageManager->addError($e->getMessage()); - } catch (\Exception $e) { - $this->messageManager->addException($e, __('Cannot initialize the indexer process.')); - } - } - - $this->_redirect('adminhtml/*/list'); - } -} diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process/MassReindex.php b/app/code/Magento/Index/Controller/Adminhtml/Process/MassReindex.php deleted file mode 100644 index 175642f82fa3d..0000000000000 --- a/app/code/Magento/Index/Controller/Adminhtml/Process/MassReindex.php +++ /dev/null @@ -1,60 +0,0 @@ -getRequest()->getParam('process'); - if (empty($processIds) || !is_array($processIds)) { - $this->messageManager->addError(__('Please select Indexes')); - } else { - try { - $counter = 0; - foreach ($processIds as $processId) { - /* @var $process \Magento\Index\Model\Process */ - $process = $this->_indexer->getProcessById($processId); - if ($process && $process->getIndexer()->isVisible()) { - $process->reindexEverything(); - $counter++; - } - } - $this->messageManager->addSuccess(__('Total of %1 index(es) have reindexed data.', $counter)); - } catch (\Magento\Framework\Model\Exception $e) { - $this->messageManager->addError($e->getMessage()); - } catch (\Exception $e) { - $this->messageManager->addException($e, __('Cannot initialize the indexer process.')); - } - } - - $this->_redirect('adminhtml/*/list'); - } -} diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process/ReindexProcess.php b/app/code/Magento/Index/Controller/Adminhtml/Process/ReindexProcess.php deleted file mode 100644 index 9cd0b6df8f722..0000000000000 --- a/app/code/Magento/Index/Controller/Adminhtml/Process/ReindexProcess.php +++ /dev/null @@ -1,56 +0,0 @@ -_initProcess(); - if ($process) { - try { - \Magento\Framework\Profiler::start('__INDEX_PROCESS_REINDEX_ALL__'); - - $process->reindexEverything(); - \Magento\Framework\Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__'); - $this->messageManager->addSuccess(__('%1 index was rebuilt.', $process->getIndexer()->getName())); - } catch (\Magento\Framework\Model\Exception $e) { - $this->messageManager->addError($e->getMessage()); - } catch (\Exception $e) { - $this->messageManager->addException($e, __('There was a problem with reindexing process.')); - } - } else { - $this->messageManager->addError(__('Cannot initialize the indexer process.')); - } - - $this->_redirect('adminhtml/*/list'); - } -} diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process/Save.php b/app/code/Magento/Index/Controller/Adminhtml/Process/Save.php deleted file mode 100644 index af69f23f74f2e..0000000000000 --- a/app/code/Magento/Index/Controller/Adminhtml/Process/Save.php +++ /dev/null @@ -1,57 +0,0 @@ -_initProcess(); - if ($process) { - $mode = $this->getRequest()->getPost('mode'); - if ($mode) { - $process->setMode($mode); - } - try { - $process->save(); - $this->messageManager->addSuccess(__('The index has been saved.')); - } catch (\Magento\Framework\Model\Exception $e) { - $this->messageManager->addError($e->getMessage()); - } catch (\Exception $e) { - $this->messageManager->addException($e, __('There was a problem with saving process.')); - } - $this->_redirect('adminhtml/*/list'); - } else { - $this->messageManager->addError(__('Cannot initialize the indexer process.')); - $this->_redirect('adminhtml/*/list'); - } - } -} diff --git a/app/code/Magento/Index/Model/Event.php b/app/code/Magento/Index/Model/Event.php deleted file mode 100644 index eb4bfc0eb5669..0000000000000 --- a/app/code/Magento/Index/Model/Event.php +++ /dev/null @@ -1,384 +0,0 @@ - - */ -class Event extends \Magento\Framework\Model\AbstractModel -{ - /** - * Predefined event types - */ - const TYPE_SAVE = 'save'; - - const TYPE_DELETE = 'delete'; - - const TYPE_MASS_ACTION = 'mass_action'; - - const TYPE_REINDEX = 'reindex'; - - /** - * Array of related processes ids - * @var array - */ - protected $_processIds = null; - - /** - * New and old data namespace. Used for separate processes data - * - * @var string - */ - protected $_dataNamespace = null; - - /** - * Process object which currently working with event - * - * @var null|Process $process - */ - protected $_process = null; - - /** - * @var Indexer - */ - protected $_indexer; - - /** - * @var \Magento\Framework\Stdlib\DateTime - */ - protected $dateTime; - - /** - * @param \Magento\Framework\Model\Context $context - * @param \Magento\Framework\Registry $registry - * @param Indexer $indexer - * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Framework\Model\Resource\AbstractResource $resource - * @param \Magento\Framework\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Framework\Model\Context $context, - \Magento\Framework\Registry $registry, - Indexer $indexer, - \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Framework\Model\Resource\AbstractResource $resource = null, - \Magento\Framework\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - $this->_indexer = $indexer; - $this->dateTime = $dateTime; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - } - - /** - * Initialize resource - * - * @return void - */ - protected function _construct() - { - $this->_init('Magento\Index\Model\Resource\Event'); - } - - /** - * Specify process object - * - * @param null|\Magento\Index\Model\Process $process - * @return $this - */ - public function setProcess($process) - { - $this->_process = $process; - return $this; - } - - /** - * Get related process object - * - * @return Process|null - */ - public function getProcess() - { - return $this->_process; - } - - /** - * Specify namespace for old and new data - * - * @param string $namespace - * @return $this - */ - public function setDataNamespace($namespace) - { - $this->_dataNamespace = $namespace; - return $this; - } - - /** - * Reset old and new data arrays - * - * @return $this - */ - public function resetData() - { - if ($this->_dataNamespace) { - $data = $this->getNewData(false); - $data[$this->_dataNamespace] = null; - $this->setNewData($data); - } else { - $this->setNewData(array()); - } - return $this; - } - - /** - * Add process id to event object - * - * @param string|int $processId - * @param string $status - * @return $this - */ - public function addProcessId($processId, $status = \Magento\Index\Model\Process::EVENT_STATUS_NEW) - { - $this->_processIds[$processId] = $status; - return $this; - } - - /** - * Get event process ids - * - * @return array - */ - public function getProcessIds() - { - return $this->_processIds; - } - - /** - * Merge new data - * - * @param array $previous - * @param mixed $current - * @return array - */ - protected function _mergeNewDataRecursive($previous, $current) - { - if (!is_array($current)) { - if (!is_null($current)) { - $previous[] = $current; - } - return $previous; - } - - foreach ($previous as $key => $value) { - if (array_key_exists($key, $current) && !is_null($current[$key]) && is_array($previous[$key])) { - if (!is_string($key) || is_array($current[$key])) { - $current[$key] = $this->_mergeNewDataRecursive($previous[$key], $current[$key]); - } - } elseif (!array_key_exists($key, $current) || is_null($current[$key])) { - $current[$key] = $previous[$key]; - } elseif (!is_array($previous[$key]) && !is_string($key)) { - $current[] = $previous[$key]; - } - } - - return $current; - } - - /** - * Merge previous event data to object. - * Used for events duplicated protection - * - * @param array $data - * @return $this - */ - public function mergePreviousData($data) - { - if (!empty($data['event_id'])) { - $this->setId($data['event_id']); - $this->setCreatedAt($data['created_at']); - } - - if (!empty($data['new_data'])) { - $previousNewData = unserialize($data['new_data']); - $currentNewData = $this->getNewData(false); - $currentNewData = $this->_mergeNewDataRecursive($previousNewData, $currentNewData); - $this->setNewData(serialize($currentNewData)); - } - return $this; - } - - /** - * Clean new data, unset data for done processes - * - * @return $this - */ - public function cleanNewData() - { - $processIds = $this->getProcessIds(); - if (!is_array($processIds) || empty($processIds)) { - return $this; - } - - $newData = $this->getNewData(false); - foreach ($processIds as $processId => $processStatus) { - if ($processStatus == \Magento\Index\Model\Process::EVENT_STATUS_DONE) { - $process = $this->_indexer->getProcessById($processId); - if ($process) { - $namespace = get_class($process->getIndexer()); - if (array_key_exists($namespace, $newData)) { - unset($newData[$namespace]); - } - } - } - } - $this->setNewData(serialize($newData)); - - return $this; - } - - /** - * Get event old data array - * - * @param bool $useNamespace - * @return array - * - * @deprecated since 1.6.2.0 - */ - public function getOldData($useNamespace = true) - { - return array(); - } - - /** - * Get event new data array - * - * @param bool $useNamespace - * @return array - */ - public function getNewData($useNamespace = true) - { - $data = $this->_getData('new_data'); - if (is_string($data)) { - $data = unserialize($data); - } elseif (empty($data) || !is_array($data)) { - $data = array(); - } - if ($useNamespace && $this->_dataNamespace) { - return isset($data[$this->_dataNamespace]) ? $data[$this->_dataNamespace] : array(); - } - return $data; - } - - /** - * Add new values to old data array (overwrite if value with same key exist) - * - * @param array|string $key - * @param null|mixed $value - * @return $this - * - * @deprecated since 1.6.2.0 - */ - public function addOldData($key, $value = null) - { - return $this; - } - - /** - * Add new values to new data array (overwrite if value with same key exist) - * - * @param array|string $key - * @param null|mixed $value - * @return $this - */ - public function addNewData($key, $value = null) - { - $newData = $this->getNewData(false); - if (!is_array($key)) { - $key = array($key => $value); - } - if ($this->_dataNamespace) { - if (!isset($newData[$this->_dataNamespace])) { - $newData[$this->_dataNamespace] = array(); - } - $newData[$this->_dataNamespace] = array_merge($newData[$this->_dataNamespace], $key); - } else { - $newData = array_merge($newData, $key); - } - $this->setNewData($newData); - return $this; - } - - /** - * Get event entity code. - * Entity code declare what kind of data object related with event (product, category etc.) - * - * @return string - */ - public function getEntity() - { - return $this->_getData('entity'); - } - - /** - * Get event action type. - * Data related on self::TYPE_* constants - * - * @return string - */ - public function getType() - { - return $this->_getData('type'); - } - - /** - * Serelaize old and new data arrays before saving - * - * @return $this - */ - protected function _beforeSave() - { - $newData = $this->getNewData(false); - $this->setNewData(serialize($newData)); - if (!$this->hasCreatedAt()) { - $this->setCreatedAt($this->dateTime->formatDate(time(), true)); - } - return parent::_beforeSave(); - } -} diff --git a/app/code/Magento/Index/Model/EventRepository.php b/app/code/Magento/Index/Model/EventRepository.php deleted file mode 100644 index 3a62a9d096f4f..0000000000000 --- a/app/code/Magento/Index/Model/EventRepository.php +++ /dev/null @@ -1,68 +0,0 @@ -_collectionFactory = $collectionFactory; - } - - /** - * Check whether unprocessed events exist for provided process - * - * @param int|array|Process $process - * @return bool - */ - public function hasUnprocessed($process) - { - return (bool)$this->getUnprocessed($process)->getSize(); - } - - /** - * Retrieve list of unprocessed events - * - * @param int|array|Process $process - * @return Collection - */ - public function getUnprocessed($process) - { - $collection = $this->_collectionFactory->create(); - $collection->addProcessFilter($process, \Magento\Index\Model\Process::EVENT_STATUS_NEW); - return $collection; - } -} diff --git a/app/code/Magento/Index/Model/Indexer.php b/app/code/Magento/Index/Model/Indexer.php deleted file mode 100644 index d8ec300c33017..0000000000000 --- a/app/code/Magento/Index/Model/Indexer.php +++ /dev/null @@ -1,339 +0,0 @@ -_collectionFactory = $collectionFactory; - $this->_resourceProcess = $resourceProcess; - $this->_eventManager = $eventManager; - $this->_indexEventFactory = $indexEventFactory; - $this->_processesCollection = $this->_createCollection(); - } - - /** - * @return \Magento\Index\Model\Resource\Process\Collection - */ - private function _createCollection() - { - return $this->_collectionFactory->create(); - } - - /** - * Get collection of all available processes - * - * @return \Magento\Index\Model\Resource\Process\Collection - */ - public function getProcessesCollection() - { - return $this->_processesCollection; - } - - /** - * Get index process by specific id - * - * @param int $processId - * @return false|Process - */ - public function getProcessById($processId) - { - foreach ($this->_processesCollection as $process) { - if ($process->getId() == $processId) { - return $process; - } - } - return false; - } - - /** - * Get index process by specific code - * - * @param string $code - * @return false|Process - */ - public function getProcessByCode($code) - { - foreach ($this->_processesCollection as $process) { - if ($process->getIndexerCode() == $code) { - return $process; - } - } - return false; - } - - /** - * Indexing all pending events. - * Events set can be limited by event entity and type - * - * @param null|string $entity - * @param null|string $type - * @return $this - * @throws \Exception - */ - public function indexEvents($entity = null, $type = null) - { - $this->_eventManager->dispatch('start_index_events' . $this->_getEventTypeName($entity, $type)); - $this->_resourceProcess->beginTransaction(); - try { - $this->_runAll('indexEvents', array($entity, $type)); - $this->_resourceProcess->commit(); - } catch (\Exception $e) { - $this->_resourceProcess->rollBack(); - throw $e; - } - $this->_eventManager->dispatch('end_index_events' . $this->_getEventTypeName($entity, $type)); - return $this; - } - - /** - * Index one event by all processes - * - * @param Event $event - * @return $this - */ - public function indexEvent(Event $event) - { - $this->_runAll('safeProcessEvent', array($event)); - return $this; - } - - /** - * Register event in each indexing process process - * - * @param Event $event - * @return $this - */ - public function registerEvent(Event $event) - { - $this->_runAll('register', array($event)); - return $this; - } - - /** - * Create new event log and register event in all processes - * - * @param \Magento\Framework\Object $entity - * @param string $entityType - * @param string $eventType - * @param bool $doSave - * @return Event - */ - public function logEvent(\Magento\Framework\Object $entity, $entityType, $eventType, $doSave = true) - { - $event = $this->_indexEventFactory->create()->setEntity( - $entityType - )->setType( - $eventType - )->setDataObject( - $entity - )->setEntityPk( - $entity->getId() - ); - - $this->registerEvent($event); - if ($doSave) { - $event->save(); - } - return $event; - } - - /** - * Create new event log and register event in all processes. - * Initiate events indexing procedure. - * - * @param \Magento\Framework\Object $entity - * @param string $entityType - * @param string $eventType - * @return $this - * @throws \Exception - */ - public function processEntityAction(\Magento\Framework\Object $entity, $entityType, $eventType) - { - $event = $this->logEvent($entity, $entityType, $eventType, false); - /** - * Index and save event just in case if some process matched it - */ - if ($event->getProcessIds()) { - $this->_eventManager->dispatch('start_process_event' . $this->_getEventTypeName($entityType, $eventType)); - $this->_resourceProcess->beginTransaction(); - try { - $this->indexEvent($event); - $this->_resourceProcess->commit(); - } catch (\Exception $e) { - $this->_resourceProcess->rollBack(); - throw $e; - } - $event->save(); - $this->_eventManager->dispatch('end_process_event' . $this->_getEventTypeName($entityType, $eventType)); - } - return $this; - } - - /** - * Reindex all processes - * - * @return void - */ - public function reindexAll() - { - $this->_reindexCollection($this->_createCollection()); - } - - /** - * Reindex only processes that are invalidated - * - * @return void - */ - public function reindexRequired() - { - $collection = $this->_createCollection(); - $collection->addFieldToFilter('status', \Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX); - $this->_reindexCollection($collection); - } - - /** - * Sub-routine for iterating collection and reindexing all processes of specified collection - * - * @param Collection $collection - * @return void - */ - private function _reindexCollection(Collection $collection) - { - /** @var $process \Magento\Index\Model\Process */ - foreach ($collection as $process) { - $process->reindexEverything(); - } - } - - /** - * Run all processes method with parameters - * Run by depends priority - * Not recursive call is not implement - * - * @param string $method - * @param array $args - * @return void - */ - protected function _runAll($method, $args) - { - $checkLocks = $method != 'register'; - $processed = array(); - foreach ($this->_processesCollection as $process) { - $code = $process->getIndexerCode(); - if (in_array($code, $processed)) { - continue; - } - $hasLocks = false; - - if ($process->getDepends()) { - foreach ($process->getDepends() as $processCode) { - $dependProcess = $this->getProcessByCode($processCode); - if ($dependProcess && !in_array($processCode, $processed)) { - if ($checkLocks && $dependProcess->isLocked()) { - $hasLocks = true; - } else { - call_user_func_array(array($dependProcess, $method), $args); - if ($checkLocks && $dependProcess->getMode() == \Magento\Index\Model\Process::MODE_MANUAL - ) { - $hasLocks = true; - } else { - $processed[] = $processCode; - } - } - } - } - } - - if (!$hasLocks) { - call_user_func_array(array($process, $method), $args); - $processed[] = $code; - } - } - } - - /** - * Get event type name - * - * @param null|string $entityType - * @param null|string $eventType - * @return string - */ - protected function _getEventTypeName($entityType = null, $eventType = null) - { - $eventName = $entityType . '_' . $eventType; - $eventName = trim($eventName, '_'); - if (!empty($eventName)) { - $eventName = '_' . $eventName; - } - return $eventName; - } -} diff --git a/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php b/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php deleted file mode 100644 index e3156dca525b7..0000000000000 --- a/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php +++ /dev/null @@ -1,181 +0,0 @@ -matchEvent($event)) { - $this->_registerEvent($event); - } - return $this; - } - - /** - * Process event - * - * @param Event $event - * @return $this - */ - public function processEvent(Event $event) - { - if ($this->matchEvent($event)) { - $this->_processEvent($event); - } - return $this; - } - - /** - * Check if event can be matched by process - * - * @param Event $event - * @return bool - */ - public function matchEvent(Event $event) - { - $entity = $event->getEntity(); - $type = $event->getType(); - return $this->matchEntityAndType($entity, $type); - } - - /** - * Check if indexer matched specific entity and action type - * - * @param string $entity - * @param string $type - * @return bool - */ - public function matchEntityAndType($entity, $type) - { - if (isset($this->_matchedEntities[$entity])) { - if (in_array($type, $this->_matchedEntities[$entity])) { - return true; - } - } - return false; - } - - /** - * Rebuild all index data - * - * @return void - */ - public function reindexAll() - { - $this->_getResource()->reindexAll(); - } - - /** - * Try dynamicly detect and call event handler from resource model. - * Handler name will be generated from event entity and type code - * - * @param Event $event - * @return $this - */ - public function callEventHandler(Event $event) - { - if ($event->getEntity()) { - $method = $event->getEntity() . '_' . $event->getType(); - } else { - $method = $event->getType(); - } - $method = str_replace(' ', '', ucwords(str_replace('_', ' ', $method))); - - $resourceModel = $this->_getResource(); - if (method_exists($resourceModel, $method)) { - $resourceModel->{$method}($event); - } - return $this; - } - - /** - * Whether the indexer should be displayed on process/list page - * - * @return bool - */ - public function isVisible() - { - return $this->_isVisible; - } -} diff --git a/app/code/Magento/Index/Model/Indexer/Config.php b/app/code/Magento/Index/Model/Indexer/Config.php deleted file mode 100644 index 3cde009d3ae76..0000000000000 --- a/app/code/Magento/Index/Model/Indexer/Config.php +++ /dev/null @@ -1,72 +0,0 @@ -get($name, array()); - } - - /** - * Get indexers configuration - * - * @return array - */ - public function getAll() - { - return $this->get(); - } -} diff --git a/app/code/Magento/Index/Model/Indexer/Config/Converter.php b/app/code/Magento/Index/Model/Indexer/Config/Converter.php deleted file mode 100644 index 3f25fee98d02b..0000000000000 --- a/app/code/Magento/Index/Model/Indexer/Config/Converter.php +++ /dev/null @@ -1,61 +0,0 @@ -getElementsByTagName('indexer'); - - /** @var DOMNode $indexer */ - foreach ($indexers as $indexer) { - $indexerConfig = array(); - foreach ($indexer->attributes as $attribute) { - $indexerConfig[$attribute->nodeName] = $attribute->nodeValue; - } - - $dependencies = array(); - /** @var DOMNode $dependency */ - foreach ($indexer->getElementsByTagName('depends') as $dependency) { - $dependencies[] = $dependency->attributes->getNamedItem('name')->nodeValue; - } - $indexerConfig['depends'] = $dependencies; - $output[$indexer->attributes->getNamedItem('name')->nodeValue] = $indexerConfig; - } - - return $output; - } -} diff --git a/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php b/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php deleted file mode 100644 index e50a5d31620ea..0000000000000 --- a/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php +++ /dev/null @@ -1,72 +0,0 @@ -_schema = $moduleReader->getModuleDir('etc', 'Magento_Index') . '/indexers_merged.xsd'; - $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Index') . '/indexers.xsd'; - } - - /** - * Get path to merged config schema - * - * @return string|null - */ - public function getSchema() - { - return $this->_schema; - } - - /** - * Get path to pre file validation schema - * - * @return string|null - */ - public function getPerFileSchema() - { - return $this->_perFileSchema; - } -} diff --git a/app/code/Magento/Index/Model/IndexerInterface.php b/app/code/Magento/Index/Model/IndexerInterface.php deleted file mode 100644 index 4587409710c3e..0000000000000 --- a/app/code/Magento/Index/Model/IndexerInterface.php +++ /dev/null @@ -1,100 +0,0 @@ -_fileFactory = $fileFactory; - $this->_varDirectory = $filesystem->getDirectoryWrite(Filesystem::VAR_DIR); - } - - /** - * Get file handler by process ID - * - * @param string $processId - * @return File - */ - public function getFile($processId) - { - if (!isset($this->_fileHandlers[$processId])) { - $this->_varDirectory->create('locks'); - $fileName = 'locks/index_process_' . $processId . '.lock'; - $stream = $this->_varDirectory->openFile($fileName, 'w+'); - $stream->write(date('r')); - $this->_fileHandlers[$processId] = $this->_fileFactory->create(array('streamHandler' => $stream)); - } - return $this->_fileHandlers[$processId]; - } -} diff --git a/app/code/Magento/Index/Model/Observer.php b/app/code/Magento/Index/Model/Observer.php deleted file mode 100644 index 31597e4bbe2e8..0000000000000 --- a/app/code/Magento/Index/Model/Observer.php +++ /dev/null @@ -1,154 +0,0 @@ -_indexer = $indexer; - } - - /** - * Store after commit observer. Process store related indexes - * - * @param EventObserver $observer - * @return void - */ - public function processStoreSave(EventObserver $observer) - { - $store = $observer->getEvent()->getStore(); - $this->_indexer->processEntityAction( - $store, - \Magento\Store\Model\Store::ENTITY, - \Magento\Index\Model\Event::TYPE_SAVE - ); - } - - /** - * Store group after commit observer. Process store group related indexes - * - * @param EventObserver $observer - * @return void - */ - public function processStoreGroupSave(EventObserver $observer) - { - $storeGroup = $observer->getEvent()->getStoreGroup(); - $this->_indexer->processEntityAction( - $storeGroup, - \Magento\Store\Model\Store::ENTITY, - \Magento\Index\Model\Event::TYPE_SAVE - ); - } - - /** - * Website save after commit observer. Process website related indexes - * - * @param EventObserver $observer - * @return void - */ - public function processWebsiteSave(EventObserver $observer) - { - $website = $observer->getEvent()->getWebsite(); - $this->_indexer->processEntityAction( - $website, - \Magento\Store\Model\Website::ENTITY, - \Magento\Index\Model\Event::TYPE_SAVE - ); - } - - /** - * Store after commit observer. Process store related indexes - * - * @param EventObserver $observer - * @return void - */ - public function processStoreDelete(EventObserver $observer) - { - $store = $observer->getEvent()->getStore(); - $this->_indexer->processEntityAction( - $store, - \Magento\Store\Model\Store::ENTITY, - \Magento\Index\Model\Event::TYPE_DELETE - ); - } - - /** - * Store group after commit observer. Process store group related indexes - * - * @param EventObserver $observer - * @return void - */ - public function processStoreGroupDelete(EventObserver $observer) - { - $storeGroup = $observer->getEvent()->getStoreGroup(); - $this->_indexer->processEntityAction( - $storeGroup, - \Magento\Store\Model\Store::ENTITY, - \Magento\Index\Model\Event::TYPE_DELETE - ); - } - - /** - * Website save after commit observer. Process website related indexes - * - * @param EventObserver $observer - * @return void - */ - public function processWebsiteDelete(EventObserver $observer) - { - $website = $observer->getEvent()->getWebsite(); - $this->_indexer->processEntityAction( - $website, - \Magento\Store\Model\Website::ENTITY, - \Magento\Index\Model\Event::TYPE_DELETE - ); - } - - /** - * Config data after commit observer. - * - * @param EventObserver $observer - * @return void - */ - public function processConfigDataSave(EventObserver $observer) - { - $configData = $observer->getEvent()->getConfigData(); - $this->_indexer->processEntityAction( - $configData, - \Magento\Framework\App\Config\ValueInterface::ENTITY, - \Magento\Index\Model\Event::TYPE_SAVE - ); - } -} diff --git a/app/code/Magento/Index/Model/Process.php b/app/code/Magento/Index/Model/Process.php deleted file mode 100644 index 72aecfe83415d..0000000000000 --- a/app/code/Magento/Index/Model/Process.php +++ /dev/null @@ -1,634 +0,0 @@ - - */ -class Process extends \Magento\Framework\Model\AbstractModel -{ - /** - * Process statuses - */ - const STATUS_RUNNING = 'working'; - - const STATUS_PENDING = 'pending'; - - const STATUS_REQUIRE_REINDEX = 'require_reindex'; - - /** - * Process event statuses - */ - const EVENT_STATUS_NEW = 'new'; - - const EVENT_STATUS_DONE = 'done'; - - const EVENT_STATUS_ERROR = 'error'; - - const EVENT_STATUS_WORKING = 'working'; - - /** - * Process modes - * Process mode allow disable automatic process events processing - */ - const MODE_MANUAL = 'manual'; - - const MODE_REAL_TIME = 'real_time'; - - /** - * Indexer stategy object - * - * @var \Magento\Index\Model\Indexer\AbstractIndexer - */ - protected $_currentIndexer; - - /** - * Lock file entity storage - * - * @var \Magento\Index\Model\Lock\Storage - */ - protected $_lockStorage; - - /** - * Instance of current process file - * - * @var \Magento\Index\Model\Process\File - */ - protected $_processFile; - - /** - * Event repostiory - * - * @var \Magento\Index\Model\EventRepository - */ - protected $_eventRepository; - - /** - * @var \Magento\Index\Model\IndexerFactory - */ - protected $_indexerFactory; - - /** - * @var \Magento\Index\Model\Indexer - */ - protected $_indexer; - - /** - * @var \Magento\Index\Model\Resource\Event - */ - protected $_resourceEvent; - - /** - * @var \Magento\Index\Model\Indexer\ConfigInterface - */ - protected $_indexerConfig; - - /** - * @param \Magento\Framework\Model\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Index\Model\Resource\Event $resourceEvent - * @param \Magento\Index\Model\Indexer\Factory $indexerFactory - * @param \Magento\Index\Model\Indexer $indexer - * @param \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig - * @param \Magento\Index\Model\Lock\Storage $lockStorage - * @param \Magento\Index\Model\EventRepository $eventRepository - * @param \Magento\Framework\Model\Resource\AbstractResource $resource - * @param \Magento\Framework\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Framework\Model\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Index\Model\Resource\Event $resourceEvent, - \Magento\Index\Model\Indexer\Factory $indexerFactory, - \Magento\Index\Model\Indexer $indexer, - \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig, - \Magento\Index\Model\Lock\Storage $lockStorage, - \Magento\Index\Model\EventRepository $eventRepository, - \Magento\Framework\Model\Resource\AbstractResource $resource = null, - \Magento\Framework\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_indexerConfig = $indexerConfig; - $this->_indexerFactory = $indexerFactory; - $this->_indexer = $indexer; - $this->_resourceEvent = $resourceEvent; - $this->_lockStorage = $lockStorage; - $this->_eventRepository = $eventRepository; - } - - /** - * Initialize resource - * - * @return void - */ - protected function _construct() - { - $this->_init('Magento\Index\Model\Resource\Process'); - } - - /** - * Set indexer class name as data namespace for event object - * - * @param Event $event - * @return $this - */ - protected function _setEventNamespace(Event $event) - { - $namespace = get_class($this->getIndexer()); - $event->setDataNamespace($namespace); - $event->setProcess($this); - return $this; - } - - /** - * Remove indexer namespace from event - * - * @param Event $event - * @return $this - */ - protected function _resetEventNamespace($event) - { - $event->setDataNamespace(null); - $event->setProcess(null); - return $this; - } - - /** - * Register data required by process in event object - * - * @param Event $event - * @return $this - */ - public function register(Event $event) - { - if ($this->matchEvent($event)) { - $this->_setEventNamespace($event); - $this->getIndexer()->register($event); - $event->addProcessId($this->getId()); - $this->_resetEventNamespace($event); - if ($this->getMode() == self::MODE_MANUAL) { - $this->_getResource()->updateStatus($this, self::STATUS_REQUIRE_REINDEX); - } - } - return $this; - } - - /** - * Check if event can be matched by process - * - * @param Event $event - * @return bool - */ - public function matchEvent(Event $event) - { - return $this->getIndexer()->matchEvent($event); - } - - /** - * Check if specific entity and action type is matched - * - * @param string $entity - * @param string $type - * @return bool - */ - public function matchEntityAndType($entity, $type) - { - if ($entity !== null && $type !== null) { - return $this->getIndexer()->matchEntityAndType($entity, $type); - } - return true; - } - - /** - * Reindex all data what this process responsible is - * - * @return void - * @throws \Magento\Framework\Model\Exception - * @throws \Exception - */ - public function reindexAll() - { - if ($this->isLocked()) { - throw new \Magento\Framework\Model\Exception( - __( - '%1 Index process is not working now. Please try running this process later.', - $this->getIndexer()->getName() - ) - ); - } - - $processStatus = $this->getStatus(); - - $this->_getResource()->startProcess($this); - $this->lock(); - try { - $eventsCollection = $this->_eventRepository->getUnprocessed($this); - if ($processStatus == self::STATUS_PENDING && $eventsCollection->getSize() > 0 || - $this->getForcePartialReindex() - ) { - $this->_getResource()->beginTransaction(); - try { - $this->_processEventsCollection($eventsCollection, false); - $this->_getResource()->commit(); - } catch (\Exception $e) { - $this->_getResource()->rollBack(); - throw $e; - } - } else { - //Update existing events since we'll do reindexAll - $this->_resourceEvent->updateProcessEvents($this); - $this->getIndexer()->reindexAll(); - } - $this->unlock(); - - if ($this->getMode() == self::MODE_MANUAL && $this->_eventRepository->hasUnprocessed($this)) { - $this->_getResource()->updateStatus($this, self::STATUS_REQUIRE_REINDEX); - } else { - $this->_getResource()->endProcess($this); - } - } catch (\Exception $e) { - $this->unlock(); - $this->_getResource()->failProcess($this); - throw $e; - } - $this->_eventManager->dispatch('after_reindex_process_' . $this->getIndexerCode()); - } - - /** - * Reindex all data what this process responsible is - * Check and using depends processes - * - * @return $this|void - */ - public function reindexEverything() - { - if ($this->getData('runed_reindexall')) { - return $this; - } - - $this->setForcePartialReindex( - $this->getStatus() == self::STATUS_PENDING && $this->_eventRepository->hasUnprocessed($this) - ); - - if ($this->getDepends()) { - foreach ($this->getDepends() as $code) { - $process = $this->_indexer->getProcessByCode($code); - if ($process) { - $process->reindexEverything(); - } - } - } - - $this->setData('runed_reindexall', true); - return $this->reindexAll(); - } - - /** - * Process event with assigned indexer object - * - * @param Event $event - * @return $this - */ - public function processEvent(Event $event) - { - if (!$this->matchEvent($event)) { - return $this; - } - if ($this->getMode() == self::MODE_MANUAL) { - $this->changeStatus(self::STATUS_REQUIRE_REINDEX); - return $this; - } - - // Commented due to deadlock - // @todo: Verify: It is required for partial update - //$this->_getResource()->updateProcessStartDate($this); - - $this->_setEventNamespace($event); - $isError = false; - - try { - $this->getIndexer()->processEvent($event); - } catch (\Exception $e) { - $isError = true; - } - $event->resetData(); - $this->_resetEventNamespace($event); - //$this->_getResource()->updateProcessEndDate($this); - $event->addProcessId($this->getId(), $isError ? self::EVENT_STATUS_ERROR : self::EVENT_STATUS_DONE); - - return $this; - } - - /** - * Get Indexer strategy object - * - * @throws \Magento\Framework\Model\Exception - * @return \Magento\Index\Model\IndexerInterface - */ - public function getIndexer() - { - if ($this->_currentIndexer === null) { - $name = $this->_getData('indexer_code'); - if (!$name) { - throw new \Magento\Framework\Model\Exception(__('Indexer name is not defined.')); - } - $indexerConfiguration = $this->_indexerConfig->getIndexer($name); - if (!$indexerConfiguration || empty($indexerConfiguration['instance'])) { - throw new \Magento\Framework\Model\Exception(__('Indexer model is not defined.')); - } - $indexerModel = $this->_indexerFactory->create($indexerConfiguration['instance']); - if ($indexerModel instanceof \Magento\Index\Model\Indexer\AbstractIndexer) { - $this->_currentIndexer = $indexerModel; - } else { - throw new \Magento\Framework\Model\Exception( - __('Indexer model should extend \Magento\Index\Model\Indexer\Abstract.') - ); - } - } - return $this->_currentIndexer; - } - - /** - * Index pending events addressed to the process - * - * @param null|string $entity - * @param null|string $type - * @return $this - * @throws \Exception - */ - public function indexEvents($entity = null, $type = null) - { - /** - * Check if process indexer can match entity code and action type - */ - if ($entity !== null && $type !== null) { - if (!$this->getIndexer()->matchEntityAndType($entity, $type)) { - return $this; - } - } - - if ($this->getMode() == self::MODE_MANUAL) { - return $this; - } - - if ($this->isLocked()) { - return $this; - } - - $this->lock(); - try { - /** - * Prepare events collection - */ - $eventsCollection = $this->_eventRepository->getUnprocessed($this); - if ($entity !== null) { - $eventsCollection->addEntityFilter($entity); - } - if ($type !== null) { - $eventsCollection->addTypeFilter($type); - } - - $this->_processEventsCollection($eventsCollection); - $this->unlock(); - } catch (\Exception $e) { - $this->unlock(); - throw $e; - } - return $this; - } - - /** - * Process all events of the collection - * - * @param Collection $eventsCollection - * @param bool $skipUnmatched - * @return $this - */ - protected function _processEventsCollection(Collection $eventsCollection, $skipUnmatched = true) - { - // We can't reload the collection because of transaction - /** @var $event \Magento\Index\Model\Event */ - while (true == ($event = $eventsCollection->fetchItem())) { - try { - $this->processEvent($event); - if (!$skipUnmatched) { - $eventProcessIds = $event->getProcessIds(); - if (!isset($eventProcessIds[$this->getId()])) { - $event->addProcessId($this->getId(), null); - } - } - } catch (\Exception $e) { - $event->addProcessId($this->getId(), self::EVENT_STATUS_ERROR); - } - $event->save(); - } - return $this; - } - - /** - * Update status process/event association - * - * @param Event $event - * @param string $status - * @return $this - */ - public function updateEventStatus(Event $event, $status) - { - $this->_getResource()->updateEventStatus($this->getId(), $event->getId(), $status); - return $this; - } - - /** - * Get process file instance - * - * @return \Magento\Index\Model\Process\File - */ - protected function _getProcessFile() - { - if (!$this->_processFile) { - $this->_processFile = $this->_lockStorage->getFile($this->getId()); - } - return $this->_processFile; - } - - /** - * Lock process without blocking. - * This method allow protect multiple process running and fast lock validation. - * - * @return $this - */ - public function lock() - { - $this->_getProcessFile()->processLock(); - return $this; - } - - /** - * Lock and block process. - * If new instance of the process will try validate locking state - * script will wait until process will be unlocked - * - * @return $this - */ - public function lockAndBlock() - { - $this->_getProcessFile()->processLock(false); - return $this; - } - - /** - * Unlock process - * - * @return $this - */ - public function unlock() - { - $this->_getProcessFile()->processUnlock(); - return $this; - } - - /** - * Check if process is locked by another user - * - * @param bool $needUnlock - * @return bool - */ - public function isLocked($needUnlock = true) - { - return $this->_getProcessFile()->isProcessLocked($needUnlock); - } - - /** - * Change process status - * - * @param string $status - * @return $this - */ - public function changeStatus($status) - { - $this->_eventManager->dispatch('index_process_change_status', array('process' => $this, 'status' => $status)); - $this->_getResource()->updateStatus($this, $status); - return $this; - } - - /** - * Get list of process mode options - * - * @return array - */ - public function getModesOptions() - { - return array(self::MODE_REAL_TIME => __('Update on Save'), self::MODE_MANUAL => __('Manual Update')); - } - - /** - * Get list of process status options - * - * @return array - */ - public function getStatusesOptions() - { - return array( - self::STATUS_PENDING => __('Ready'), - self::STATUS_RUNNING => __('Processing'), - self::STATUS_REQUIRE_REINDEX => __('Reindex Required') - ); - } - - /** - * Get list of "Update Required" options - * - * @return array - */ - public function getUpdateRequiredOptions() - { - return array(0 => __('No'), 1 => __('Yes')); - } - - /** - * Retrieve depend indexer codes - * - * @return array - */ - public function getDepends() - { - $depends = $this->getData('depends'); - if (is_null($depends)) { - $depends = array(); - $indexerConfiguration = $this->_indexerConfig->getIndexer($this->getIndexerCode()); - if ($indexerConfiguration) { - if (isset($indexerConfiguration['depends']) && is_array($indexerConfiguration['depends'])) { - $depends = $indexerConfiguration['depends']; - } - } - - $this->setData('depends', $depends); - } - - return $depends; - } - - /** - * Process event with locks checking - * - * @param Event $event - * @return $this - * @throws \Exception - */ - public function safeProcessEvent(Event $event) - { - if (!$this->matchEvent($event)) { - return $this; - } - if ($this->isLocked()) { - return $this; - } - $this->lock(); - try { - $this->processEvent($event); - $this->unlock(); - } catch (\Exception $e) { - $this->unlock(); - throw $e; - } - return $this; - } -} diff --git a/app/code/Magento/Index/Model/Process/File.php b/app/code/Magento/Index/Model/Process/File.php deleted file mode 100644 index d6174506fb57e..0000000000000 --- a/app/code/Magento/Index/Model/Process/File.php +++ /dev/null @@ -1,134 +0,0 @@ -_streamHandler = $streamHandler; - } - - /** - * Lock process file - * - * @param bool $nonBlocking - * @return void - */ - public function processLock($nonBlocking = true) - { - $lockMode = LOCK_EX; - if ($nonBlocking) { - $lockMode = $lockMode | LOCK_NB; - } - try { - $this->_streamHandler->lock($lockMode); - $this->_streamLocked = true; - } catch (FilesystemException $e) { - $this->_streamLocked = false; - } - // true if process is locked by other user - $this->_processLocked = !$this->_streamLocked; - } - - /** - * Unlock process file - * - * @return bool - */ - public function processUnlock() - { - $this->_processLocked = null; - try { - $this->_streamHandler->unlock(); - $this->_streamLocked = false; - } catch (FilesystemException $e) { - $this->_streamLocked = true; - } - return !$this->_streamLocked; - } - - /** - * Check if process is locked by another user - * - * @param bool $needUnlock - * @return bool|null - */ - public function isProcessLocked($needUnlock = true) - { - if (!$this->_streamHandler) { - return null; - } - - if ($this->_processLocked !== null) { - return $this->_processLocked; - } else { - try { - $this->_streamHandler->lock(LOCK_EX | LOCK_NB); - if ($needUnlock) { - $this->_streamHandler->unlock(); - $this->_streamLocked = false; - } else { - $this->_streamLocked = true; - } - return false; - } catch (FilesystemException $e) { - return true; - } - } - } -} diff --git a/app/code/Magento/Index/Model/Resource/Event.php b/app/code/Magento/Index/Model/Resource/Event.php deleted file mode 100644 index fcfad015068c2..0000000000000 --- a/app/code/Magento/Index/Model/Resource/Event.php +++ /dev/null @@ -1,135 +0,0 @@ - - */ -class Event extends \Magento\Framework\Model\Resource\Db\AbstractDb -{ - /** - * @return void - */ - protected function _construct() - { - $this->_init('index_event', 'event_id'); - } - - /** - * Check if semilar event exist before start saving data - * - * @param AbstractModel $object - * @return $this - */ - protected function _beforeSave(AbstractModel $object) - { - /** - * Check if event already exist and merge previous data - */ - if (!$object->getId()) { - $select = $this->_getReadAdapter()->select()->from( - $this->getMainTable() - )->where( - 'type=?', - $object->getType() - )->where( - 'entity=?', - $object->getEntity() - ); - if ($object->hasEntityPk()) { - $select->where('entity_pk=?', $object->getEntityPk()); - } - $data = $this->_getWriteAdapter()->fetchRow($select); - if ($data) { - $object->mergePreviousData($data); - } - } - $object->cleanNewData(); - return parent::_beforeSave($object); - } - - /** - * Save assigned processes - * - * @param \Magento\Framework\Model\AbstractModel $object - * @return $this - */ - protected function _afterSave(AbstractModel $object) - { - $processIds = $object->getProcessIds(); - if (is_array($processIds)) { - $processTable = $this->getTable('index_process_event'); - if (empty($processIds)) { - $this->_getWriteAdapter()->delete($processTable); - } else { - foreach ($processIds as $processId => $processStatus) { - if (is_null($processStatus) || $processStatus == ProcessModel::EVENT_STATUS_DONE) { - $this->_getWriteAdapter()->delete( - $processTable, - array('process_id = ?' => $processId, 'event_id = ?' => $object->getId()) - ); - continue; - } - $data = array( - 'process_id' => $processId, - 'event_id' => $object->getId(), - 'status' => $processStatus - ); - $this->_getWriteAdapter()->insertOnDuplicate($processTable, $data, array('status')); - } - } - } - return parent::_afterSave($object); - } - - /** - * Update status for events of process - * - * @param int|array|ProcessModel $process - * @param string $status - * @return $this - */ - public function updateProcessEvents($process, $status = ProcessModel::EVENT_STATUS_DONE) - { - $whereCondition = ''; - if ($process instanceof ProcessModel) { - $whereCondition = array('process_id = ?' => $process->getId()); - } elseif (is_array($process) && !empty($process)) { - $whereCondition = array('process_id IN (?)' => $process); - } elseif (!is_array($whereCondition)) { - $whereCondition = array('process_id = ?' => $process); - } - $this->_getWriteAdapter()->update( - $this->getTable('index_process_event'), - array('status' => $status), - $whereCondition - ); - return $this; - } -} diff --git a/app/code/Magento/Index/Model/Resource/Event/Collection.php b/app/code/Magento/Index/Model/Resource/Event/Collection.php deleted file mode 100644 index ea517a913a829..0000000000000 --- a/app/code/Magento/Index/Model/Resource/Event/Collection.php +++ /dev/null @@ -1,136 +0,0 @@ - - */ -class Collection extends \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection -{ - /** - * Initialize resource - * - * @return void - */ - protected function _construct() - { - $this->_init('Magento\Index\Model\Event', 'Magento\Index\Model\Resource\Event'); - } - - /** - * Add filter by entity - * - * @param string|array $entity - * @return $this - */ - public function addEntityFilter($entity) - { - if (is_array($entity) && !empty($entity)) { - $this->addFieldToFilter('entity', array('in' => $entity)); - } else { - $this->addFieldToFilter('entity', $entity); - } - return $this; - } - - /** - * Add filter by type - * - * @param string|array $type - * @return $this - */ - public function addTypeFilter($type) - { - if (is_array($type) && !empty($type)) { - $this->addFieldToFilter('type', array('in' => $type)); - } else { - $this->addFieldToFilter('type', $type); - } - return $this; - } - - /** - * Add filter by process and status to events collection - * - * @param int|array|Process $process - * @param string $status - * @return $this - */ - public function addProcessFilter($process, $status = null) - { - $this->_joinProcessEventTable(); - if ($process instanceof Process) { - $this->addFieldToFilter('process_event.process_id', $process->getId()); - } elseif (is_array($process) && !empty($process)) { - $this->addFieldToFilter('process_event.process_id', array('in' => $process)); - } else { - $this->addFieldToFilter('process_event.process_id', $process); - } - - if ($status !== null) { - if (is_array($status) && !empty($status)) { - $this->addFieldToFilter('process_event.status', array('in' => $status)); - } else { - $this->addFieldToFilter('process_event.status', $status); - } - } - return $this; - } - - /** - * Join index_process_event table to event table - * - * @return $this - */ - protected function _joinProcessEventTable() - { - if (!$this->getFlag('process_event_table_joined')) { - $this->getSelect()->join( - array('process_event' => $this->getTable('index_process_event')), - 'process_event.event_id=main_table.event_id', - array('process_event_status' => 'status') - ); - $this->setFlag('process_event_table_joined', true); - } - return $this; - } - - /** - * Reset collection state - * - * @return $this - */ - public function reset() - { - $this->_totalRecords = null; - $this->_data = null; - $this->_isCollectionLoaded = false; - $this->_items = array(); - return $this; - } -} diff --git a/app/code/Magento/Index/Model/Resource/Process.php b/app/code/Magento/Index/Model/Resource/Process.php deleted file mode 100644 index 15bfe4098cce5..0000000000000 --- a/app/code/Magento/Index/Model/Resource/Process.php +++ /dev/null @@ -1,180 +0,0 @@ - - */ -class Process extends \Magento\Framework\Model\Resource\Db\AbstractDb -{ - /** - * @var \Magento\Framework\Stdlib\DateTime - */ - protected $dateTime; - - /** - * @param \Magento\Framework\App\Resource $resource - * @param \Magento\Framework\Stdlib\DateTime $dateTime - */ - public function __construct(\Magento\Framework\App\Resource $resource, \Magento\Framework\Stdlib\DateTime $dateTime) - { - $this->dateTime = $dateTime; - parent::__construct($resource); - } - - /** - * Initialize table and table pk - * - * @return void - */ - protected function _construct() - { - $this->_init('index_process', 'process_id'); - } - - /** - * Update process/event association row status - * - * @param int $processId - * @param int $eventId - * @param string $status - * @return $this - */ - public function updateEventStatus($processId, $eventId, $status) - { - $adapter = $this->_getWriteAdapter(); - $condition = array('process_id = ?' => $processId, 'event_id = ?' => $eventId); - $adapter->update($this->getTable('index_process_event'), array('status' => $status), $condition); - return $this; - } - - /** - * Register process end - * - * @param ModelProcess $process - * @return $this - */ - public function endProcess(ModelProcess $process) - { - $data = array('status' => ModelProcess::STATUS_PENDING, 'ended_at' => $this->dateTime->formatDate(time())); - $this->_updateProcessData($process->getId(), $data); - return $this; - } - - /** - * Register process start - * - * @param ModelProcess $process - * @return $this - */ - public function startProcess(ModelProcess $process) - { - $data = array('status' => ModelProcess::STATUS_RUNNING, 'started_at' => $this->dateTime->formatDate(time())); - $this->_updateProcessData($process->getId(), $data); - return $this; - } - - /** - * Register process fail - * - * @param ModelProcess $process - * @return $this - */ - public function failProcess(ModelProcess $process) - { - $data = array( - 'status' => ModelProcess::STATUS_REQUIRE_REINDEX, - 'ended_at' => $this->dateTime->formatDate(time()) - ); - $this->_updateProcessData($process->getId(), $data); - return $this; - } - - /** - * Update process status field - * - * - * @param ModelProcess $process - * @param string $status - * @return $this - */ - public function updateStatus($process, $status) - { - $data = array('status' => $status); - $this->_updateProcessData($process->getId(), $data); - return $this; - } - - /** - * Updates process data - * @param int $processId - * @param array $data - * @return $this - */ - protected function _updateProcessData($processId, $data) - { - $bind = array('process_id=?' => $processId); - $this->_getWriteAdapter()->update($this->getMainTable(), $data, $bind); - - return $this; - } - - /** - * Update process start date - * - * @param ModelProcess $process - * @return $this - */ - public function updateProcessStartDate(ModelProcess $process) - { - $this->_updateProcessData($process->getId(), array('started_at' => $this->dateTime->formatDate(time()))); - return $this; - } - - /** - * Update process end date - * - * @param ModelProcess $process - * @return $this - */ - public function updateProcessEndDate(ModelProcess $process) - { - $this->_updateProcessData($process->getId(), array('ended_at' => $this->dateTime->formatDate(time()))); - return $this; - } - - /** - * Whether transaction is already started - * - * @return bool - */ - public function isInTransaction() - { - return $this->_getWriteAdapter()->getTransactionLevel() > 0; - } -} diff --git a/app/code/Magento/Index/Model/Resource/Process/Collection.php b/app/code/Magento/Index/Model/Resource/Process/Collection.php deleted file mode 100644 index c537c7a01df3b..0000000000000 --- a/app/code/Magento/Index/Model/Resource/Process/Collection.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ -class Collection extends \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection -{ - /** - * Initialize resource - * - * @return void - */ - protected function _construct() - { - $this->_init('Magento\Index\Model\Process', 'Magento\Index\Model\Resource\Process'); - } - - /** - * Add count of unprocessed events to process collection - * - * @return $this - */ - public function addEventsStats() - { - $countsSelect = $this->getConnection()->select()->from( - $this->getTable('index_process_event'), - array('process_id', 'events' => 'COUNT(*)') - )->where( - 'status=?', - \Magento\Index\Model\Process::EVENT_STATUS_NEW - )->group( - 'process_id' - ); - $this->getSelect()->joinLeft( - array('e' => $countsSelect), - 'e.process_id=main_table.process_id', - array( - 'events' => $this->getConnection()->getCheckSql( - $this->getConnection()->prepareSqlCondition('e.events', array('null' => null)), - 0, - 'e.events' - ) - ) - ); - return $this; - } -} diff --git a/app/code/Magento/Index/Model/Resource/Setup.php b/app/code/Magento/Index/Model/Resource/Setup.php deleted file mode 100644 index f752418b17e76..0000000000000 --- a/app/code/Magento/Index/Model/Resource/Setup.php +++ /dev/null @@ -1,106 +0,0 @@ - - */ -namespace Magento\Index\Model\Resource; - -class Setup extends \Magento\Framework\Module\Setup -{ - /** - * @var \Magento\Index\Model\Indexer\ConfigInterface - */ - protected $_indexerConfig; - - /** - * @param \Magento\Framework\Module\Setup\Context $context - * @param string $resourceName - * @param \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig - * @param string $moduleName - * @param string $connectionName - */ - public function __construct( - \Magento\Framework\Module\Setup\Context $context, - $resourceName, - \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig, - $moduleName = 'Magento_Index', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION - ) { - $this->_indexerConfig = $indexerConfig; - parent::__construct($context, $resourceName, $moduleName, $connectionName); - } - - /** - * Apply Index module DB updates and sync indexes declaration - * - * @return void - */ - public function applyUpdates() - { - parent::applyUpdates(); - $this->_syncIndexes(); - } - - /** - * Sync indexes declarations in config and in DB - * - * @return $this - */ - protected function _syncIndexes() - { - $connection = $this->getConnection(); - if (!$connection) { - return $this; - } - $indexCodes = array(); - foreach (array_keys($this->_indexerConfig->getAll()) as $name) { - $indexCodes[] = $name; - } - $table = $this->getTable('index_process'); - $select = $connection->select()->from($table, 'indexer_code'); - $existingIndexes = $connection->fetchCol($select); - $delete = array_diff($existingIndexes, $indexCodes); - $insert = array_diff($indexCodes, $existingIndexes); - - if (!empty($delete)) { - $connection->delete($table, $connection->quoteInto('indexer_code IN (?)', $delete)); - } - if (!empty($insert)) { - $insertData = array(); - foreach ($insert as $code) { - $insertData[] = array( - 'indexer_code' => $code, - 'status' => \Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX - ); - } - if (method_exists($connection, 'insertArray') && is_callable([$connection, 'insertArray'])) { - $connection->insertArray($table, array('indexer_code', 'status'), $insertData); - } - } - } -} diff --git a/app/code/Magento/Index/Model/Shell.php b/app/code/Magento/Index/Model/Shell.php deleted file mode 100644 index 2146bcdf04a09..0000000000000 --- a/app/code/Magento/Index/Model/Shell.php +++ /dev/null @@ -1,268 +0,0 @@ - - */ -class Shell extends \Magento\Framework\App\AbstractShell -{ - /** - * Error status - whether errors have happened - * - * @var bool - */ - protected $_hasErrors = false; - - /** - * @var \Magento\Index\Model\Indexer - */ - protected $_indexer; - - /** - * @param \Magento\Framework\App\Filesystem $filesystem - * @param string $entryPoint - * @param Indexer $indexer - */ - public function __construct(\Magento\Framework\App\Filesystem $filesystem, $entryPoint, Indexer $indexer) - { - $this->_indexer = $indexer; - parent::__construct($filesystem, $entryPoint); - } - - /** - * Runs this model, assumed to be run by command-line - * - * @return $this - */ - public function run() - { - if ($this->_showHelp()) { - return $this; - } - - if ($this->getArg('info')) { - $this->_runShowInfo(); - } else if ($this->getArg('status') || $this->getArg('mode')) { - $this->_runShowStatusOrMode(); - } else if ($this->getArg('mode-realtime') || $this->getArg('mode-manual')) { - $this->_runSetMode(); - } else if ($this->getArg('reindex') || $this->getArg('reindexall')) { - $this->_runReindex(); - } else { - echo $this->getUsageHelp(); - } - return $this; - } - - /** - * Shows information about indexes - * - * @return $this - */ - protected function _runShowInfo() - { - $processes = $this->_parseIndexerString('all'); - foreach ($processes as $process) { - /* @var $process \Magento\Index\Model\Process */ - echo sprintf('%-30s', $process->getIndexerCode()); - echo $process->getIndexer()->getName() . "\n"; - } - return $this; - } - - /** - * Shows information about statuses or modes - * - * @return $this - */ - protected function _runShowStatusOrMode() - { - if ($this->getArg('status')) { - $processes = $this->_parseIndexerString($this->getArg('status')); - } else { - $processes = $this->_parseIndexerString($this->getArg('mode')); - } - foreach ($processes as $process) { - /* @var $process \Magento\Index\Model\Process */ - $status = 'unknown'; - if ($this->getArg('status')) { - switch ($process->getStatus()) { - case \Magento\Index\Model\Process::STATUS_PENDING: - $status = 'Pending'; - break; - case \Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX: - $status = 'Require Reindex'; - break; - - case \Magento\Index\Model\Process::STATUS_RUNNING: - $status = 'Running'; - break; - - default: - $status = 'Ready'; - break; - } - } else { - switch ($process->getMode()) { - case \Magento\Index\Model\Process::MODE_REAL_TIME: - $status = 'Update on Save'; - break; - case \Magento\Index\Model\Process::MODE_MANUAL: - $status = 'Manual Update'; - break; - } - } - echo sprintf('%-30s ', $process->getIndexer()->getName() . ':') . $status . "\n"; - } - return $this; - } - - /** - * Sets new mode for indexes - * - * @return $this - */ - protected function _runSetMode() - { - if ($this->getArg('mode-realtime')) { - $mode = \Magento\Index\Model\Process::MODE_REAL_TIME; - $processes = $this->_parseIndexerString($this->getArg('mode-realtime')); - } else { - $mode = \Magento\Index\Model\Process::MODE_MANUAL; - $processes = $this->_parseIndexerString($this->getArg('mode-manual')); - } - foreach ($processes as $process) { - /* @var $process \Magento\Index\Model\Process */ - try { - $process->setMode($mode)->save(); - echo $process->getIndexer()->getName() . " index was successfully changed index mode\n"; - } catch (\Magento\Framework\Model\Exception $e) { - echo $e->getMessage() . "\n"; - $this->_hasErrors = true; - } catch (\Exception $e) { - echo $process->getIndexer()->getName() . " index process unknown error:\n"; - echo $e . "\n"; - $this->_hasErrors = true; - } - } - return $this; - } - - /** - * Reindexes indexer(s) - * - * @return void - */ - protected function _runReindex() - { - if ($this->getArg('reindex')) { - $processes = $this->_parseIndexerString($this->getArg('reindex')); - } else { - $processes = $this->_parseIndexerString('all'); - } - - foreach ($processes as $process) { - /* @var $process \Magento\Index\Model\Process */ - try { - $startTime = microtime(true); - $process->reindexEverything(); - $resultTime = microtime(true) - $startTime; - echo $process->getIndexer()->getName() - . " index was rebuilt successfully in " . gmdate('H:i:s', $resultTime) . "\n"; - } catch (\Magento\Framework\Model\Exception $e) { - echo $e->getMessage() . "\n"; - $this->_hasErrors = true; - } catch (\Exception $e) { - echo $process->getIndexer()->getName() . " index process unknown error:\n"; - echo $e . "\n"; - $this->_hasErrors = true; - } - } - } - - /** - * Parses string with indexers and return array of indexer instances - * - * @param string $string - * @return array - */ - protected function _parseIndexerString($string) - { - $processes = array(); - if ($string == 'all') { - $collection = $this->_indexer->getProcessesCollection(); - foreach ($collection as $process) { - $processes[] = $process; - } - } else if (!empty($string)) { - $codes = explode(',', $string); - foreach ($codes as $code) { - $process = $this->_indexer->getProcessByCode(trim($code)); - if (!$process) { - echo 'Warning: Unknown indexer with code ' . trim($code) . "\n"; - $this->_hasErrors = true; - } else { - $processes[] = $process; - } - } - } - return $processes; - } - - /** - * Return whether there errors have happened - * - * @return bool - */ - public function hasErrors() - { - return $this->_hasErrors; - } - - /** - * Retrieves usage help message - * - * @return string - */ - public function getUsageHelp() - { - return <<_entryPoint} -- [options] - - --status Show Indexer(s) Status - --mode Show Indexer(s) Index Mode - --mode-realtime Set index mode type "Update on Save" - --mode-manual Set index mode type "Manual Update" - --reindex Reindex Data - info Show allowed indexers - reindexall Reindex Data by all indexers - help This help - - Comma separated indexer codes or value "all" for all indexers -USAGE; - } -} diff --git a/app/code/Magento/Index/Model/System/Message/IndexOutdated.php b/app/code/Magento/Index/Model/System/Message/IndexOutdated.php deleted file mode 100644 index a25fc378e5605..0000000000000 --- a/app/code/Magento/Index/Model/System/Message/IndexOutdated.php +++ /dev/null @@ -1,128 +0,0 @@ -_indexer = $indexer; - $this->_urlBuilder = $urlBuilder; - $this->_authorization = $authorization; - } - - /** - * @return array - */ - protected function _getProcessesForReindex() - { - if ($this->_indexes === null) { - $this->_indexes = array(); - $processes = $this->_indexer->getProcessesCollection()->addEventsStats(); - /** @var $process \Magento\Index\Model\Process */ - foreach ($processes as $process) { - if (($process->getStatus() == \Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX || - $process->getEvents() > 0) && $process->getIndexer()->isVisible() - ) { - $this->_indexes[] = $process->getIndexer()->getName(); - } - } - } - return $this->_indexes; - } - - /** - * Retrieve unique message identity - * - * @return string - */ - public function getIdentity() - { - $data = $this->_getProcessesForReindex() ?: array(); - return md5('OUTDATED_INDEXES' . implode(':', $data)); - } - - /** - * Check whether - * - * @return bool - */ - public function isDisplayed() - { - return $this->_authorization->isAllowed('Magento_Index::index') && $this->_getProcessesForReindex(); - } - - /** - * Retrieve message text - * - * @return string - */ - public function getText() - { - $data = $this->_getProcessesForReindex() ?: array(); - $indexList = implode(', ', $data); - $url = $this->_urlBuilder->getUrl('adminhtml/process/list'); - $text = __('One or more of the Indexes are not up to date: %1', $indexList) . '. '; - $text .= __('Please go to Index Management and rebuild required indexes.', $url); - return $text; - } - - /** - * Retrieve message severity - * - * @return int - */ - public function getSeverity() - { - return self::SEVERITY_CRITICAL; - } -} diff --git a/app/code/Magento/Index/etc/events.xml b/app/code/Magento/Index/etc/events.xml deleted file mode 100644 index d95ba2a15ca52..0000000000000 --- a/app/code/Magento/Index/etc/events.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/code/Magento/Index/etc/indexers.xsd b/app/code/Magento/Index/etc/indexers.xsd deleted file mode 100644 index e6759758130c7..0000000000000 --- a/app/code/Magento/Index/etc/indexers.xsd +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - Dependent indexer name must be unique - - - - - - - - - - - - Indexer name must be unique - - - - - - - - - - - Indexer declaration - - - - - - - - - - - - - Dependency declaration - - - - - - - - - Identifier can contain only [a-z_]. - - - - - - - - - - - Instance name can contain only [a-zA-Z_\\\\]. - - - - - - - diff --git a/app/code/Magento/Index/i18n/de_DE.csv b/app/code/Magento/Index/i18n/de_DE.csv deleted file mode 100644 index 9ca3f4b392a4d..0000000000000 --- a/app/code/Magento/Index/i18n/de_DE.csv +++ /dev/null @@ -1,42 +0,0 @@ -No,Nein -Action,Aktion -General,Allgemein -Yes,Ja -Status,Status -Description,Beschreibung -System,System -Never,Nie -Updated,Updated -"Index Management","Index Management" -"Save Process","Save Process" -"Reindex Data","Daten neu indexieren" -"'%1' Index Process Information","'%1' Index Process Information" -"Index Name","Index Name" -"Index Description","Index Beschreibung" -"Index Mode","Index Modus" -"Process Information","Informationen verarbeiten" -Index,Index -Mode,Modus -"Update Required","Update erforderlich" -"Change Index Mode","Index-Modus ändern" -"Index mode",Indexmodus -"Cannot initialize the indexer process.","Indexer-Verarbeitung konnte nicht initialisiert werden." -"The index has been saved.","Der Index wurde gespeichert." -"There was a problem with saving process.","Beim Speichern ist ein Problem aufgetreten." -"%1 index was rebuilt.","%1 index was rebuilt." -"There was a problem with reindexing process.","Bei der Verarbeitung der Reindexierung ist ein Problem aufgetreten." -"Please select Indexes","Bitte Indexe auswählen" -"Total of %1 index(es) have reindexed data.","Total of %1 index(es) have reindexed data." -"Please select Index(es)","Bitte Index(e) auswählen" -"Total of %1 index(es) have changed index mode.","Total of %1 index(es) have changed index mode." -"%1 Index process is not working now. Please try running this process later.","%1 Index process is not working now. Please try running this process later." -"Indexer name is not defined.","Indexer name is not defined." -"Indexer model is not defined.","Indexer-Vorlage nicht definiert." -"Indexer model should extend \Magento\Index\Model\Indexer\Abstract.","Indexer model should extend \Magento\Index\Model\Indexer\Abstract." -"Update on Save","Aktualisierung gespeichert." -"Manual Update","Manuelle Aktualisierung" -Ready,Fertig -Processing,"Verarbeitung läuft" -"Reindex Required","Neuindexierung erforderlich" -"One or more of the Indexes are not up to date: %1","One or more of the Indexes are not up to date: %1" -"Please go to Index Management and rebuild required indexes.","Please go to Index Management and rebuild required indexes." diff --git a/app/code/Magento/Index/i18n/en_US.csv b/app/code/Magento/Index/i18n/en_US.csv deleted file mode 100644 index 438556cd67b6f..0000000000000 --- a/app/code/Magento/Index/i18n/en_US.csv +++ /dev/null @@ -1,42 +0,0 @@ -No,No -Action,Action -General,General -Yes,Yes -Status,Status -Description,Description -System,System -Never,Never -Updated,Updated -"Index Management","Index Management" -"Save Process","Save Process" -"Reindex Data","Reindex Data" -"'%1' Index Process Information","'%1' Index Process Information" -"Index Name","Index Name" -"Index Description","Index Description" -"Index Mode","Index Mode" -"Process Information","Process Information" -Index,Index -Mode,Mode -"Update Required","Update Required" -"Change Index Mode","Change Index Mode" -"Index mode","Index mode" -"Cannot initialize the indexer process.","Cannot initialize the indexer process." -"The index has been saved.","The index has been saved." -"There was a problem with saving process.","There was a problem with saving process." -"%1 index was rebuilt.","%1 index was rebuilt." -"There was a problem with reindexing process.","There was a problem with reindexing process." -"Please select Indexes","Please select Indexes" -"Total of %1 index(es) have reindexed data.","Total of %1 index(es) have reindexed data." -"Please select Index(es)","Please select Index(es)" -"Total of %1 index(es) have changed index mode.","Total of %1 index(es) have changed index mode." -"%1 Index process is not working now. Please try running this process later.","%1 Index process is not working now. Please try running this process later." -"Indexer name is not defined.","Indexer name is not defined." -"Indexer model is not defined.","Indexer model is not defined." -"Indexer model should extend \Magento\Index\Model\Indexer\Abstract.","Indexer model should extend \Magento\Index\Model\Indexer\Abstract." -"Update on Save","Update on Save" -"Manual Update","Manual Update" -Ready,Ready -Processing,Processing -"Reindex Required","Reindex Required" -"One or more of the Indexes are not up to date: %1","One or more of the Indexes are not up to date: %1" -"Please go to Index Management and rebuild required indexes.","Please go to Index Management and rebuild required indexes." diff --git a/app/code/Magento/Index/i18n/es_ES.csv b/app/code/Magento/Index/i18n/es_ES.csv deleted file mode 100644 index abe1e54376418..0000000000000 --- a/app/code/Magento/Index/i18n/es_ES.csv +++ /dev/null @@ -1,42 +0,0 @@ -No,No -Action,Acción -General,General -Yes,Sí -Status,Estado -Description,Descripción -System,Sistema -Never,Nunca -Updated,Updated -"Index Management","Gestión de Índices" -"Save Process","Save Process" -"Reindex Data","Volver a indexear los datos" -"'%1' Index Process Information","'%1' Index Process Information" -"Index Name","Nombre de indice" -"Index Description","Descripción del indice" -"Index Mode","Modalidad de indice" -"Process Information","Información de proceso" -Index,Indice -Mode,Modalidad -"Update Required","Es necesaria la actualización." -"Change Index Mode","Cambiar la modalidad de indexación" -"Index mode","Modo de índice" -"Cannot initialize the indexer process.","No se puede iniciar el proceso de indexación" -"The index has been saved.","El indice se ha guardado" -"There was a problem with saving process.","Hubo un problema mientras se guardaba" -"%1 index was rebuilt.","%1 index was rebuilt." -"There was a problem with reindexing process.","Hubo un problema con el proceso de indexear de nuevo" -"Please select Indexes","Por favor seleccione indices" -"Total of %1 index(es) have reindexed data.","Total of %1 index(es) have reindexed data." -"Please select Index(es)","Por favor seleccione indice(s)" -"Total of %1 index(es) have changed index mode.","Total of %1 index(es) have changed index mode." -"%1 Index process is not working now. Please try running this process later.","%1 Index process is not working now. Please try running this process later." -"Indexer name is not defined.","Indexer name is not defined." -"Indexer model is not defined.","Modelo de indexeado no definido" -"Indexer model should extend \Magento\Index\Model\Indexer\Abstract.","Indexer model should extend \Magento\Index\Model\Indexer\Abstract." -"Update on Save","actualización guardada" -"Manual Update","Actualización manual" -Ready,Listo -Processing,Procesando -"Reindex Required","Volver a indexear requerido" -"One or more of the Indexes are not up to date: %1","One or more of the Indexes are not up to date: %1" -"Please go to Index Management and rebuild required indexes.","Please go to Index Management and rebuild required indexes." diff --git a/app/code/Magento/Index/i18n/fr_FR.csv b/app/code/Magento/Index/i18n/fr_FR.csv deleted file mode 100644 index efc407dcf9c2e..0000000000000 --- a/app/code/Magento/Index/i18n/fr_FR.csv +++ /dev/null @@ -1,42 +0,0 @@ -No,Non -Action,Action -General,Général -Yes,Oui -Status,État -Description,Description -System,Système -Never,Jamais -Updated,Updated -"Index Management","Gestion index" -"Save Process","Save Process" -"Reindex Data","Ré-indexer données" -"'%1' Index Process Information","'%1' Index Process Information" -"Index Name","Nom index" -"Index Description","Description index" -"Index Mode","Mode index" -"Process Information","Traiter infos" -Index,Index -Mode,Mode -"Update Required","Mise à jour nécessaire" -"Change Index Mode","Change mode index" -"Index mode","Mode index" -"Cannot initialize the indexer process.","Ne peut initialiser le traitement de l'indexage" -"The index has been saved.","L'index a été sauvegardé." -"There was a problem with saving process.","Il y a eu un problème avec le traitement de sauvegarde." -"%1 index was rebuilt.","%1 index was rebuilt." -"There was a problem with reindexing process.","Il y a eu un problème avec le traitement de ré-indexage." -"Please select Indexes","Veuillez sélectionner des index" -"Total of %1 index(es) have reindexed data.","Total of %1 index(es) have reindexed data." -"Please select Index(es)","Veuillez sélectionner un ou plusieurs index" -"Total of %1 index(es) have changed index mode.","Total of %1 index(es) have changed index mode." -"%1 Index process is not working now. Please try running this process later.","%1 Index process is not working now. Please try running this process later." -"Indexer name is not defined.","Indexer name is not defined." -"Indexer model is not defined.","Modèle indexage non défini." -"Indexer model should extend \Magento\Index\Model\Indexer\Abstract.","Indexer model should extend \Magento\Index\Model\Indexer\Abstract." -"Update on Save","Mise à jour lors de la sauvegarde" -"Manual Update","Mise à jour manuelle" -Ready,Prêt -Processing,Traitement -"Reindex Required","Ré-indexage requis" -"One or more of the Indexes are not up to date: %1","One or more of the Indexes are not up to date: %1" -"Please go to Index Management and rebuild required indexes.","Please go to Index Management and rebuild required indexes." diff --git a/app/code/Magento/Index/i18n/nl_NL.csv b/app/code/Magento/Index/i18n/nl_NL.csv deleted file mode 100644 index fa4cbe6a31fd3..0000000000000 --- a/app/code/Magento/Index/i18n/nl_NL.csv +++ /dev/null @@ -1,42 +0,0 @@ -No,Nee -Action,Actie -General,Algemeen -Yes,Ja -Status,Status -Description,Beschrijving -System,Systeem -Never,Nooit -Updated,Updated -"Index Management","Index Management" -"Save Process","Save Process" -"Reindex Data","Data herindexeren" -"'%1' Index Process Information","'%1' Index Process Information" -"Index Name","Index Naam" -"Index Description","Index Omschrijving" -"Index Mode","Index Modus" -"Process Information",Procesinformatie -Index,Index -Mode,Modus -"Update Required","Update is Nodig" -"Change Index Mode","Change Index Modus" -"Index mode","Index modus" -"Cannot initialize the indexer process.","Kan het indexeerproces niet initialiseren." -"The index has been saved.","De index is opgeslagen." -"There was a problem with saving process.","Er is een probleem bij het opslaan." -"%1 index was rebuilt.","%1 index was rebuilt." -"There was a problem with reindexing process.","Er was een probleem met het herindexeren." -"Please select Indexes","Selecteer indexen" -"Total of %1 index(es) have reindexed data.","Total of %1 index(es) have reindexed data." -"Please select Index(es)","Selecteer index(en)" -"Total of %1 index(es) have changed index mode.","Total of %1 index(es) have changed index mode." -"%1 Index process is not working now. Please try running this process later.","%1 Index process is not working now. Please try running this process later." -"Indexer name is not defined.","Indexer name is not defined." -"Indexer model is not defined.","Indexeermodel is niet gedefinieerd." -"Indexer model should extend \Magento\Index\Model\Indexer\Abstract.","Indexer model should extend \Magento\Index\Model\Indexer\Abstract." -"Update on Save","Update bij opslaan." -"Manual Update","Handmatige Update" -Ready,Gereed -Processing,"Aan het verwerken" -"Reindex Required","Herindexering noodzakelijk" -"One or more of the Indexes are not up to date: %1","One or more of the Indexes are not up to date: %1" -"Please go to Index Management and rebuild required indexes.","Please go to Index Management and rebuild required indexes." diff --git a/app/code/Magento/Index/i18n/pt_BR.csv b/app/code/Magento/Index/i18n/pt_BR.csv deleted file mode 100644 index a332b075a9bcd..0000000000000 --- a/app/code/Magento/Index/i18n/pt_BR.csv +++ /dev/null @@ -1,42 +0,0 @@ -No,Não -Action,Ação -General,Geral -Yes,Sim -Status,Status -Description,Descrição -System,Sistema -Never,Nunca -Updated,Updated -"Index Management","Gerenciamento de Índice" -"Save Process","Save Process" -"Reindex Data","Reindexar Dados" -"'%1' Index Process Information","'%1' Index Process Information" -"Index Name","Nome do Índice" -"Index Description","Descrição de Índice" -"Index Mode","Modo de Índice" -"Process Information","Processar informação" -Index,Índice -Mode,Modo -"Update Required","Atualização necessária" -"Change Index Mode","Alterar Modo de Indexação" -"Index mode","Modo de Índice" -"Cannot initialize the indexer process.","Não é possível inicializar processo indexador." -"The index has been saved.","O índice foi salvo" -"There was a problem with saving process.","Houve um problema no processo de salvar." -"%1 index was rebuilt.","%1 index was rebuilt." -"There was a problem with reindexing process.","Houve um problema com o processo de reindexação." -"Please select Indexes","Por favor, selecione índices" -"Total of %1 index(es) have reindexed data.","Total of %1 index(es) have reindexed data." -"Please select Index(es)","Por favor, selecione índice(es)" -"Total of %1 index(es) have changed index mode.","Total of %1 index(es) have changed index mode." -"%1 Index process is not working now. Please try running this process later.","%1 Index process is not working now. Please try running this process later." -"Indexer name is not defined.","Indexer name is not defined." -"Indexer model is not defined.","Modelo indexador não está definido." -"Indexer model should extend \Magento\Index\Model\Indexer\Abstract.","Indexer model should extend \Magento\Index\Model\Indexer\Abstract." -"Update on Save","Atualização em Salvar" -"Manual Update","Atualização Manual" -Ready,Pronto -Processing,Processando -"Reindex Required","Obrigatório Reindexar" -"One or more of the Indexes are not up to date: %1","One or more of the Indexes are not up to date: %1" -"Please go to Index Management and rebuild required indexes.","Please go to Index Management and rebuild required indexes." diff --git a/app/code/Magento/Index/i18n/zh_CN.csv b/app/code/Magento/Index/i18n/zh_CN.csv deleted file mode 100644 index c35413f791ab2..0000000000000 --- a/app/code/Magento/Index/i18n/zh_CN.csv +++ /dev/null @@ -1,42 +0,0 @@ -No,否 -Action,操作 -General,常规 -Yes,是 -Status,状态 -Description,描述 -System,系统 -Never,永不 -Updated,Updated -"Index Management",索引管理 -"Save Process","Save Process" -"Reindex Data",重新索引数据 -"'%1' Index Process Information","'%1' Index Process Information" -"Index Name",索引名称 -"Index Description",索引描述 -"Index Mode",索引模式 -"Process Information",处理信息 -Index,索引 -Mode,模式 -"Update Required",需要更新 -"Change Index Mode",更改索引模式 -"Index mode",索引模式 -"Cannot initialize the indexer process.",无法初始化索引器进程。 -"The index has been saved.",索引已保存。 -"There was a problem with saving process.",保存进程遇到问题。 -"%1 index was rebuilt.","%1 index was rebuilt." -"There was a problem with reindexing process.",重新索引进程遇到问题。 -"Please select Indexes",请选择索引 -"Total of %1 index(es) have reindexed data.","Total of %1 index(es) have reindexed data." -"Please select Index(es)",请选择索引 -"Total of %1 index(es) have changed index mode.","Total of %1 index(es) have changed index mode." -"%1 Index process is not working now. Please try running this process later.","%1 Index process is not working now. Please try running this process later." -"Indexer name is not defined.","Indexer name is not defined." -"Indexer model is not defined.",索引器模型未定义。 -"Indexer model should extend \Magento\Index\Model\Indexer\Abstract.","Indexer model should extend \Magento\Index\Model\Indexer\Abstract." -"Update on Save",保存时更新 -"Manual Update",手动更新 -Ready,就绪 -Processing,正在处理 -"Reindex Required",需要重新索引 -"One or more of the Indexes are not up to date: %1","One or more of the Indexes are not up to date: %1" -"Please go to Index Management and rebuild required indexes.","Please go to Index Management and rebuild required indexes." diff --git a/app/code/Magento/Index/sql/index_setup/install-1.6.0.0.php b/app/code/Magento/Index/sql/index_setup/install-1.6.0.0.php deleted file mode 100644 index 5ae4fa33f7f79..0000000000000 --- a/app/code/Magento/Index/sql/index_setup/install-1.6.0.0.php +++ /dev/null @@ -1,189 +0,0 @@ -startSetup(); - -/** - * Create table 'index_event' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('index_event') -)->addColumn( - 'event_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Event Id' -)->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - array('nullable' => false), - 'Type' -)->addColumn( - 'entity', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - array('nullable' => false), - 'Entity' -)->addColumn( - 'entity_pk', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - array(), - 'Entity Primary Key' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - array('nullable' => false), - 'Creation Time' -)->addColumn( - 'old_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - array(), - 'Old Data' -)->addColumn( - 'new_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - array(), - 'New Data' -)->addIndex( - $installer->getIdxName( - 'index_event', - array('type', 'entity', 'entity_pk'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('type', 'entity', 'entity_pk'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->setComment( - 'Index Event' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'index_process' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('index_process') -)->addColumn( - 'process_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Process Id' -)->addColumn( - 'indexer_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - array('nullable' => false), - 'Indexer Code' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 15, - array('nullable' => false, 'default' => 'pending'), - 'Status' -)->addColumn( - 'started_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - array(), - 'Started At' -)->addColumn( - 'ended_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - array(), - 'Ended At' -)->addColumn( - 'mode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 9, - array('nullable' => false, 'default' => 'real_time'), - 'Mode' -)->addIndex( - $installer->getIdxName( - 'index_process', - array('indexer_code'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('indexer_code'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->setComment( - 'Index Process' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'index_process_event' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('index_process_event') -)->addColumn( - 'process_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Process Id' -)->addColumn( - 'event_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Event Id' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - array('nullable' => false, 'default' => 'new'), - 'Status' -)->addIndex( - $installer->getIdxName('index_process_event', array('event_id')), - array('event_id') -)->addForeignKey( - $installer->getFkName('index_process_event', 'event_id', 'index_event', 'event_id'), - 'event_id', - $installer->getTable('index_event'), - 'event_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('index_process_event', 'process_id', 'index_process', 'process_id'), - 'process_id', - $installer->getTable('index_process'), - 'process_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Index Process Event' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Index/view/adminhtml/layout/adminhtml_process_edit.xml b/app/code/Magento/Index/view/adminhtml/layout/adminhtml_process_edit.xml deleted file mode 100644 index fa11da04be711..0000000000000 --- a/app/code/Magento/Index/view/adminhtml/layout/adminhtml_process_edit.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - main_section - Magento\Index\Block\Adminhtml\Process\Edit\Tab\Main - - - - diff --git a/app/code/Magento/Indexer/App/Indexer.php b/app/code/Magento/Indexer/App/Indexer.php index 44fb9a96e731b..f84527f37f3d0 100644 --- a/app/code/Magento/Indexer/App/Indexer.php +++ b/app/code/Magento/Indexer/App/Indexer.php @@ -39,11 +39,6 @@ class Indexer implements \Magento\Framework\AppInterface */ protected $filesystem; - /** - * @var \Magento\Index\Model\IndexerFactory - */ - protected $_indexerFactory; - /** * @param string $reportDir * @param \Magento\Framework\Filesystem $filesystem diff --git a/app/code/Magento/Indexer/Block/Backend/Container.php b/app/code/Magento/Indexer/Block/Backend/Container.php index 11c7cdcaaa6f3..44fb741949c59 100644 --- a/app/code/Magento/Indexer/Block/Backend/Container.php +++ b/app/code/Magento/Indexer/Block/Backend/Container.php @@ -34,7 +34,7 @@ protected function _construct() { $this->_controller = 'indexer'; $this->_blockGroup = 'Magento_Indexer'; - $this->_headerText = __('New Indexer Management'); + $this->_headerText = __('Indexer Management'); parent::_construct(); $this->buttonList->remove('add'); } diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/ListAction.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/ListAction.php index 51dfdc1ca441f..cd84c30398c33 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/ListAction.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/ListAction.php @@ -33,7 +33,7 @@ class ListAction extends \Magento\Indexer\Controller\Adminhtml\Indexer */ public function execute() { - $this->_title->add(__('New Index Management')); + $this->_title->add(__('Index Management')); $this->_view->loadLayout(); $this->_setActiveMenu('Magento_Indexer::system_index'); diff --git a/app/code/Magento/Index/Model/Resource/AbstractResource.php b/app/code/Magento/Indexer/Model/Resource/AbstractResource.php similarity index 99% rename from app/code/Magento/Index/Model/Resource/AbstractResource.php rename to app/code/Magento/Indexer/Model/Resource/AbstractResource.php index a08a066cb847b..f57c3ad94116a 100644 --- a/app/code/Magento/Index/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Indexer/Model/Resource/AbstractResource.php @@ -27,7 +27,7 @@ * * @author Magento Core Team */ -namespace Magento\Index\Model\Resource; +namespace Magento\Indexer\Model\Resource; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Select; diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index fa1728a98e0ed..895ea508063bd 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-page-cache": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-page-cache": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Indexer/etc/acl.xml b/app/code/Magento/Indexer/etc/acl.xml index ecc2b372817d9..4fa49ccb2c158 100644 --- a/app/code/Magento/Indexer/etc/acl.xml +++ b/app/code/Magento/Indexer/etc/acl.xml @@ -29,7 +29,7 @@ - + diff --git a/app/code/Magento/Indexer/etc/adminhtml/menu.xml b/app/code/Magento/Indexer/etc/adminhtml/menu.xml index a3aa754ab0853..649daccc2d545 100644 --- a/app/code/Magento/Indexer/etc/adminhtml/menu.xml +++ b/app/code/Magento/Indexer/etc/adminhtml/menu.xml @@ -25,6 +25,6 @@ --> - + diff --git a/app/code/Magento/Indexer/i18n/de_DE.csv b/app/code/Magento/Indexer/i18n/de_DE.csv index ebe2a2f240e4b..aab33db9d1840 100644 --- a/app/code/Magento/Indexer/i18n/de_DE.csv +++ b/app/code/Magento/Indexer/i18n/de_DE.csv @@ -6,10 +6,10 @@ Mode,Mode "Update on Save","Update on Save" Ready,Ready Processing,Processing -"New Indexer Management","New Indexer Management" +"Indexer Management","Indexer Management" "Update by Schedule","Update by Schedule" "Reindex required","Reindex required" -"New Index Management","New Index Management" +"Index Management","Index Management" "Please select indexers.","Please select indexers." "A total of %1 indexer(s) have been turned Update on Save mode on.","A total of %1 indexer(s) have been turned Update on Save mode on." "We couldn't change indexer(s)' mode because of an error.","We couldn't change indexer(s)' mode because of an error." diff --git a/app/code/Magento/Indexer/i18n/en_US.csv b/app/code/Magento/Indexer/i18n/en_US.csv index ebe2a2f240e4b..aab33db9d1840 100644 --- a/app/code/Magento/Indexer/i18n/en_US.csv +++ b/app/code/Magento/Indexer/i18n/en_US.csv @@ -6,10 +6,10 @@ Mode,Mode "Update on Save","Update on Save" Ready,Ready Processing,Processing -"New Indexer Management","New Indexer Management" +"Indexer Management","Indexer Management" "Update by Schedule","Update by Schedule" "Reindex required","Reindex required" -"New Index Management","New Index Management" +"Index Management","Index Management" "Please select indexers.","Please select indexers." "A total of %1 indexer(s) have been turned Update on Save mode on.","A total of %1 indexer(s) have been turned Update on Save mode on." "We couldn't change indexer(s)' mode because of an error.","We couldn't change indexer(s)' mode because of an error." diff --git a/app/code/Magento/Indexer/i18n/es_ES.csv b/app/code/Magento/Indexer/i18n/es_ES.csv index ebe2a2f240e4b..aab33db9d1840 100644 --- a/app/code/Magento/Indexer/i18n/es_ES.csv +++ b/app/code/Magento/Indexer/i18n/es_ES.csv @@ -6,10 +6,10 @@ Mode,Mode "Update on Save","Update on Save" Ready,Ready Processing,Processing -"New Indexer Management","New Indexer Management" +"Indexer Management","Indexer Management" "Update by Schedule","Update by Schedule" "Reindex required","Reindex required" -"New Index Management","New Index Management" +"Index Management","Index Management" "Please select indexers.","Please select indexers." "A total of %1 indexer(s) have been turned Update on Save mode on.","A total of %1 indexer(s) have been turned Update on Save mode on." "We couldn't change indexer(s)' mode because of an error.","We couldn't change indexer(s)' mode because of an error." diff --git a/app/code/Magento/Indexer/i18n/fr_FR.csv b/app/code/Magento/Indexer/i18n/fr_FR.csv index ebe2a2f240e4b..aab33db9d1840 100644 --- a/app/code/Magento/Indexer/i18n/fr_FR.csv +++ b/app/code/Magento/Indexer/i18n/fr_FR.csv @@ -6,10 +6,10 @@ Mode,Mode "Update on Save","Update on Save" Ready,Ready Processing,Processing -"New Indexer Management","New Indexer Management" +"Indexer Management","Indexer Management" "Update by Schedule","Update by Schedule" "Reindex required","Reindex required" -"New Index Management","New Index Management" +"Index Management","Index Management" "Please select indexers.","Please select indexers." "A total of %1 indexer(s) have been turned Update on Save mode on.","A total of %1 indexer(s) have been turned Update on Save mode on." "We couldn't change indexer(s)' mode because of an error.","We couldn't change indexer(s)' mode because of an error." diff --git a/app/code/Magento/Indexer/i18n/nl_NL.csv b/app/code/Magento/Indexer/i18n/nl_NL.csv index ebe2a2f240e4b..aab33db9d1840 100644 --- a/app/code/Magento/Indexer/i18n/nl_NL.csv +++ b/app/code/Magento/Indexer/i18n/nl_NL.csv @@ -6,10 +6,10 @@ Mode,Mode "Update on Save","Update on Save" Ready,Ready Processing,Processing -"New Indexer Management","New Indexer Management" +"Indexer Management","Indexer Management" "Update by Schedule","Update by Schedule" "Reindex required","Reindex required" -"New Index Management","New Index Management" +"Index Management","Index Management" "Please select indexers.","Please select indexers." "A total of %1 indexer(s) have been turned Update on Save mode on.","A total of %1 indexer(s) have been turned Update on Save mode on." "We couldn't change indexer(s)' mode because of an error.","We couldn't change indexer(s)' mode because of an error." diff --git a/app/code/Magento/Indexer/i18n/pt_BR.csv b/app/code/Magento/Indexer/i18n/pt_BR.csv index ebe2a2f240e4b..aab33db9d1840 100644 --- a/app/code/Magento/Indexer/i18n/pt_BR.csv +++ b/app/code/Magento/Indexer/i18n/pt_BR.csv @@ -6,10 +6,10 @@ Mode,Mode "Update on Save","Update on Save" Ready,Ready Processing,Processing -"New Indexer Management","New Indexer Management" +"Indexer Management","Indexer Management" "Update by Schedule","Update by Schedule" "Reindex required","Reindex required" -"New Index Management","New Index Management" +"Index Management","Index Management" "Please select indexers.","Please select indexers." "A total of %1 indexer(s) have been turned Update on Save mode on.","A total of %1 indexer(s) have been turned Update on Save mode on." "We couldn't change indexer(s)' mode because of an error.","We couldn't change indexer(s)' mode because of an error." diff --git a/app/code/Magento/Indexer/i18n/zh_CN.csv b/app/code/Magento/Indexer/i18n/zh_CN.csv index ebe2a2f240e4b..aab33db9d1840 100644 --- a/app/code/Magento/Indexer/i18n/zh_CN.csv +++ b/app/code/Magento/Indexer/i18n/zh_CN.csv @@ -6,10 +6,10 @@ Mode,Mode "Update on Save","Update on Save" Ready,Ready Processing,Processing -"New Indexer Management","New Indexer Management" +"Indexer Management","Indexer Management" "Update by Schedule","Update by Schedule" "Reindex required","Reindex required" -"New Index Management","New Index Management" +"Index Management","Index Management" "Please select indexers.","Please select indexers." "A total of %1 indexer(s) have been turned Update on Save mode on.","A total of %1 indexer(s) have been turned Update on Save mode on." "We couldn't change indexer(s)' mode because of an error.","We couldn't change indexer(s)' mode because of an error." diff --git a/app/code/Magento/Install/composer.json b/app/code/Magento/Install/composer.json index 94f9c15eff73a..54dfe0c181dc2 100644 --- a/app/code/Magento/Install/composer.json +++ b/app/code/Magento/Install/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-user": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-user": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Install/view/adminhtml/layout/default.xml b/app/code/Magento/Install/view/adminhtml/layout/default.xml index b3ba328b0a502..3bacc75455730 100644 --- a/app/code/Magento/Install/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Install/view/adminhtml/layout/default.xml @@ -24,11 +24,7 @@ */ --> - - - - Magento_Install::survey_notification.js - - - + + + diff --git a/app/code/Magento/Install/view/install/templates/page.phtml b/app/code/Magento/Install/view/install/templates/page.phtml index 20c623ff9ae7b..83c6dfce4f7b8 100644 --- a/app/code/Magento/Install/view/install/templates/page.phtml +++ b/app/code/Magento/Install/view/install/templates/page.phtml @@ -22,11 +22,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> - diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json index effb8a631bc25..9c0e59d43d47e 100644 --- a/app/code/Magento/Integration/composer.json +++ b/app/code/Magento/Integration/composer.json @@ -3,18 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-user": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", - "magento/module-authorization": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-user": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", + "magento/module-authorization": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml index eb76e22b29dd2..0e4006a7e1656 100644 --- a/app/code/Magento/Integration/etc/module.xml +++ b/app/code/Magento/Integration/etc/module.xml @@ -36,7 +36,6 @@ - diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml index 9084a59de9783..aa065fb1b8a54 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml @@ -26,13 +26,9 @@ */ --> - - - - Magento_Integration::integration.css - - - + + + diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml index d64bd1140cd8a..1a7a5a6f04a07 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml @@ -23,14 +23,10 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - - - Magento_Integration::integration.css - - - + + + + diff --git a/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml b/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml index 0c57fe56d6258..2f1fd42eb00d8 100644 --- a/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml +++ b/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml @@ -45,7 +45,7 @@ require([ * Confirm dialog for delete integration action */ $(function () { - $('#integrationGrid_table').on('click', 'button#delete', function (e) { + $('div#integrationGrid').on('click', 'button#delete', function (e) { $('#integration-delete-container').dialog({ modal: true, autoOpen: true, @@ -53,7 +53,7 @@ require([ minHeight: 200, minWidth: 300, dialogClass: "no-close", - position: {at: 'top'}, + position: {at: 'center'}, buttons: { Cancel: function () { $(this).dialog("close"); diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json index eb767363badb5..8086986cb7b43 100644 --- a/app/code/Magento/LayeredNavigation/composer.json +++ b/app/code/Magento/LayeredNavigation/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/page_one_column.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/1column.xml similarity index 100% rename from app/code/Magento/LayeredNavigation/view/frontend/layout/page_one_column.xml rename to app/code/Magento/LayeredNavigation/view/frontend/layout/1column.xml diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/page_two_columns_left.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/2columns-left.xml similarity index 100% rename from app/code/Magento/LayeredNavigation/view/frontend/layout/page_two_columns_left.xml rename to app/code/Magento/LayeredNavigation/view/frontend/layout/2columns-left.xml diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/page_two_columns_right.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/2columns-right.xml similarity index 100% rename from app/code/Magento/LayeredNavigation/view/frontend/layout/page_two_columns_right.xml rename to app/code/Magento/LayeredNavigation/view/frontend/layout/2columns-right.xml diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/page_three_columns.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/3columns.xml similarity index 100% rename from app/code/Magento/LayeredNavigation/view/frontend/layout/page_three_columns.xml rename to app/code/Magento/LayeredNavigation/view/frontend/layout/3columns.xml diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml index 1a9c3455d71c3..026096a37add1 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml +++ b/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml @@ -24,11 +24,9 @@ */ --> - - - page-with-filter - - + + + diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_advanced_result.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_advanced_result.xml index e9923f2e9f1b1..e1c51db81d0e3 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_advanced_result.xml +++ b/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_advanced_result.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json index 83aa5c46e14f3..69e46c04b5ff5 100644 --- a/app/code/Magento/Log/composer.json +++ b/app/code/Magento/Log/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Log/view/adminhtml/layout/customer_online_index.xml b/app/code/Magento/Log/view/adminhtml/layout/visitor_online_index.xml similarity index 100% rename from app/code/Magento/Log/view/adminhtml/layout/customer_online_index.xml rename to app/code/Magento/Log/view/adminhtml/layout/visitor_online_index.xml diff --git a/app/code/Magento/Msrp/Block/Adminhtml/Product/Helper/Form/Type.php b/app/code/Magento/Msrp/Block/Adminhtml/Product/Helper/Form/Type.php new file mode 100644 index 0000000000000..6a3ce7eda433b --- /dev/null +++ b/app/code/Magento/Msrp/Block/Adminhtml/Product/Helper/Form/Type.php @@ -0,0 +1,76 @@ +config = $config; + } + + /** + * {@inheritdoc} + */ + public function toHtml() + { + if ($this->config->isEnabled()) { + return parent::toHtml(); + } + return ''; + } +} diff --git a/app/code/Magento/Msrp/Block/Adminhtml/Product/Helper/Form/Type/Price.php b/app/code/Magento/Msrp/Block/Adminhtml/Product/Helper/Form/Type/Price.php new file mode 100644 index 0000000000000..8ad31a3d047ee --- /dev/null +++ b/app/code/Magento/Msrp/Block/Adminhtml/Product/Helper/Form/Type/Price.php @@ -0,0 +1,66 @@ +config = $config; + } + + /** + * {@inheritdoc} + */ + public function toHtml() + { + if (!$this->config->isEnabled()) { + return ''; + } + return parent::toHtml(); + } +} diff --git a/app/code/Magento/Catalog/Block/Category/Widget/Link.php b/app/code/Magento/Msrp/Block/Popup.php similarity index 60% rename from app/code/Magento/Catalog/Block/Category/Widget/Link.php rename to app/code/Magento/Msrp/Block/Popup.php index 204e730b26cc4..4bfccea2e02be 100644 --- a/app/code/Magento/Catalog/Block/Category/Widget/Link.php +++ b/app/code/Magento/Msrp/Block/Popup.php @@ -21,29 +21,50 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Msrp\Block; -/** - * Widget to display link to the category - * - * @author Magento Core Team - */ -namespace Magento\Catalog\Block\Category\Widget; - -class Link extends \Magento\Catalog\Block\Widget\Link +class Popup extends \Magento\Framework\View\Element\Template { + /** + * @var \Magento\Msrp\Model\Config + */ + protected $config; + /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\UrlRewrite\Model\Resource\UrlRewrite $urlRewrite - * @param \Magento\Catalog\Model\Resource\Category $resourceCategory + * @param \Magento\Msrp\Model\Config $config * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\UrlRewrite\Model\Resource\UrlRewrite $urlRewrite, - \Magento\Catalog\Model\Resource\Category $resourceCategory, + \Magento\Msrp\Model\Config $config, array $data = array() ) { - parent::__construct($context, $urlRewrite, $data); - $this->_entityResource = $resourceCategory; + $this->config = $config; + parent::__construct($context, $data); + } + + /** + * @return bool + */ + public function isEnabled() + { + return $this->config->isEnabled(); + } + + /** + * @return string + */ + public function getExplanationMessage() + { + return $this->config->getExplanationMessage(); + } + + /** + * @return string + */ + public function getExplanationMessageWhatsThis() + { + return $this->config->getExplanationMessageWhatsThis(); } } diff --git a/app/code/Magento/Rss/Block/AbstractBlock.php b/app/code/Magento/Msrp/Block/Total.php similarity index 54% rename from app/code/Magento/Rss/Block/AbstractBlock.php rename to app/code/Magento/Msrp/Block/Total.php index 6b1128bde8472..265552f7b007f 100644 --- a/app/code/Magento/Rss/Block/AbstractBlock.php +++ b/app/code/Magento/Msrp/Block/Total.php @@ -21,55 +21,46 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rss\Block; +namespace Magento\Msrp\Block; -class AbstractBlock extends \Magento\Framework\View\Element\Template +/** + * @method string getOriginalBlockName() + */ +class Total extends \Magento\Framework\View\Element\Template { - /** - * @var \Magento\Framework\App\Http\Context - */ - protected $httpContext; + /** @var \Magento\Msrp\Model\Config */ + protected $config; /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\App\Http\Context $httpContext + * @param \Magento\Msrp\Model\Config $config * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\App\Http\Context $httpContext, + \Magento\Msrp\Model\Config $config, array $data = array() ) { - $this->httpContext = $httpContext; parent::__construct($context, $data); - $this->_isScopePrivate = true; + $this->config = $config; } /** - * Get store id - * - * @return int + * @return string */ - protected function _getStoreId() + protected function _toHtml() { - $storeId = (int)$this->getRequest()->getParam('store_id'); - if ($storeId == null) { - $storeId = $this->_storeManager->getStore()->getId(); + /** @var \Magento\Checkout\Block\Cart\AbstractCart $originalBlock */ + $originalBlock = $this->getLayout()->getBlock($this->getOriginalBlockName()); + $quote = $originalBlock->getQuote(); + if (!$quote->hasCanApplyMsrp() && $this->config->isEnabled()) { + $quote->collectTotals(); } - return $storeId; - } - - /** - * Get customer group id - * - * @return int - */ - protected function _getCustomerGroupId() - { - $customerGroupId = (int) $this->getRequest()->getParam('cid'); - if ($customerGroupId == null) { - $customerGroupId = $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_GROUP); + if ($quote->getCanApplyMsrp()) { + $originalBlock->setTemplate(''); + return parent::_toHtml(); + } else { + return ''; } - return $customerGroupId; } } diff --git a/app/code/Magento/Msrp/Helper/Data.php b/app/code/Magento/Msrp/Helper/Data.php new file mode 100644 index 0000000000000..98531d5ca97c9 --- /dev/null +++ b/app/code/Magento/Msrp/Helper/Data.php @@ -0,0 +1,180 @@ +productFactory = $productFactory; + $this->storeManager = $storeManager; + $this->productOptions = $productOptions; + $this->msrp = $msrp; + $this->config = $config; + } + + /** + * Check if can apply Minimum Advertise price to product + * in specific visibility + * + * @param int|Product $product + * @param int|null $visibility Check displaying price in concrete place (by default generally) + * @return bool + * + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + */ + public function canApplyMsrp($product, $visibility = null) + { + if (!$this->config->isEnabled()) { + return false; + } + if (is_numeric($product)) { + $product = $this->productFactory->create() + ->setStoreId($this->storeManager->getStore()->getId()) + ->load($product); + } + $result = $this->msrp->canApplyToProduct($product); + if ($result && $visibility !== null) { + $productPriceVisibility = $product->getMsrpDisplayActualPriceType(); + if ($productPriceVisibility == Type\Price::TYPE_USE_CONFIG) { + $productPriceVisibility = $this->config->getDisplayActualPriceType(); + } + $result = $productPriceVisibility == $visibility; + } + + if ($product->getTypeInstance()->isComposite($product) && (!$result || $visibility !== null)) { + $isEnabledInOptions = $this->productOptions->isEnabled($product, $visibility); + if ($isEnabledInOptions !== null) { + $result = $isEnabledInOptions; + } + } + + return $result; + } + + /** + * Get Msrp message for price + * + * @param Product $product + * @return string + */ + public function getMsrpPriceMessage($product) + { + $message = ""; + if ($this->canApplyMsrp($product, Type::TYPE_IN_CART)) { + $message = __('To see product price, add this item to your cart. You can always remove it later.'); + } elseif ($this->canApplyMsrp($product, Type::TYPE_BEFORE_ORDER_CONFIRM)) { + $message = __('See price before order confirmation.'); + } + return $message; + } + + /** + * Check is product need gesture to show price + * + * @param int|Product $product + * @return bool + */ + public function isShowPriceOnGesture($product) + { + return $this->canApplyMsrp($product, Type::TYPE_ON_GESTURE); + } + + /** + * @param int|Product $product + * @return bool + */ + public function isShowBeforeOrderConfirm($product) + { + return $this->canApplyMsrp($product, Type::TYPE_BEFORE_ORDER_CONFIRM); + } + + /** + * @param int|Product $product + * @return bool|float + */ + public function isMinimalPriceLessMsrp($product) + { + if (is_numeric($product)) { + $product = $this->productFactory->create() + ->setStoreId($this->storeManager->getStore()->getId()) + ->load($product); + } + $msrp = $product->getMsrp(); + $price = $product->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE); + if ($msrp === null) { + if ($product->getTypeId() !== \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) { + return false; + } else { + $msrp = $product->getTypeInstance()->getChildrenMsrp($product); + } + } + return $msrp > $price->getValue(); + } +} diff --git a/app/code/Magento/Msrp/Model/Config.php b/app/code/Magento/Msrp/Model/Config.php new file mode 100644 index 0000000000000..d55447e2a0219 --- /dev/null +++ b/app/code/Magento/Msrp/Model/Config.php @@ -0,0 +1,150 @@ +scopeConfig = $scopeConfig; + $this->storeManager = $storeManager; + $this->escaper = $escaper; + } + + /** + * Set a specified store ID value + * + * @param int $store + * @return $this + */ + public function setStoreId($store) + { + $this->storeId = $store; + return $this; + } + + /** + * Check if Minimum Advertised Price is enabled + * + * @return bool + */ + public function isEnabled() + { + return (bool)$this->scopeConfig->getValue( + self::XML_PATH_MSRP_ENABLED, + ScopeInterface::SCOPE_STORE, + $this->storeId + ); + } + + /** + * Return Msrp display actual type + * + * @return null|string + */ + public function getDisplayActualPriceType() + { + return $this->scopeConfig->getValue( + self::XML_PATH_MSRP_DISPLAY_ACTUAL_PRICE_TYPE, + ScopeInterface::SCOPE_STORE, + $this->storeId + ); + } + + /** + * Return Msrp explanation message + * + * @return string + */ + public function getExplanationMessage() + { + return $this->escaper->escapeHtml( + $this->scopeConfig->getValue( + self::XML_PATH_MSRP_EXPLANATION_MESSAGE, + ScopeInterface::SCOPE_STORE, + $this->storeId + ), + array('b', 'br', 'strong', 'i', 'u', 'p', 'span') + ); + } + + /** + * Return Msrp explanation message for "Whats This" window + * + * @return string + */ + public function getExplanationMessageWhatsThis() + { + return $this->escaper->escapeHtml( + $this->scopeConfig->getValue( + self::XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS, + ScopeInterface::SCOPE_STORE, + $this->storeId + ), + array('b', 'br', 'strong', 'i', 'u', 'p', 'span') + ); + } +} diff --git a/setup/module/Magento/Config/src/Dom/NodeMergingConfig.php b/app/code/Magento/Msrp/Model/Msrp.php similarity index 50% rename from setup/module/Magento/Config/src/Dom/NodeMergingConfig.php rename to app/code/Magento/Msrp/Model/Msrp.php index 1c5a0e2687e9f..de343665e5e90 100644 --- a/setup/module/Magento/Config/src/Dom/NodeMergingConfig.php +++ b/app/code/Magento/Msrp/Model/Msrp.php @@ -17,52 +17,49 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Config\Dom; +namespace Magento\Msrp\Model; -/** - * Configuration of identifier attributes to be taken into account during merging - */ -class NodeMergingConfig +use Magento\Catalog\Model\Resource\Eav\AttributeFactory; +use Magento\Catalog\Model\Product; + +class Msrp { /** - * @var NodePathMatcher + * @var array */ - private $nodePathMatcher; + protected $mapApplyToProductType = null; /** - * Format: array('/node/path' => '', ...) - * - * @var array + * @var AttributeFactory */ - private $idAttributes = array(); + protected $eavAttributeFactory; /** - * @param NodePathMatcher $nodePathMatcher - * @param array $idAttributes + * @param AttributeFactory $eavAttributeFactory */ - public function __construct(NodePathMatcher $nodePathMatcher, array $idAttributes) - { - $this->nodePathMatcher = $nodePathMatcher; - $this->idAttributes = $idAttributes; + public function __construct( + AttributeFactory $eavAttributeFactory + ) { + $this->eavAttributeFactory = $eavAttributeFactory; } /** - * Retrieve name of an identifier attribute for a node + * Check whether Msrp applied to product Product Type * - * @param string $nodeXpath - * @return string|null + * @param \Magento\Catalog\Model\Product $product + * @return bool */ - public function getIdAttribute($nodeXpath) + public function canApplyToProduct($product) { - foreach ($this->idAttributes as $pathPattern => $idAttribute) { - if ($this->nodePathMatcher->match($pathPattern, $nodeXpath)) { - return $idAttribute; - } + if ($this->mapApplyToProductType === null) { + /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ + $attribute = $this->eavAttributeFactory->create()->loadByCode(Product::ENTITY, 'msrp'); + $this->mapApplyToProductType = $attribute->getApplyTo(); } - return null; + return in_array($product->getTypeId(), $this->mapApplyToProductType); } } diff --git a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/SetCanApplyMsrp.php b/app/code/Magento/Msrp/Model/Observer/Frontend/Quote/SetCanApplyMsrp.php similarity index 81% rename from app/code/Magento/Sales/Model/Observer/Frontend/Quote/SetCanApplyMsrp.php rename to app/code/Magento/Msrp/Model/Observer/Frontend/Quote/SetCanApplyMsrp.php index de3834946903a..81ae6ee288d22 100644 --- a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/SetCanApplyMsrp.php +++ b/app/code/Magento/Msrp/Model/Observer/Frontend/Quote/SetCanApplyMsrp.php @@ -21,28 +21,24 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sales\Model\Observer\Frontend\Quote; +namespace Magento\Msrp\Model\Observer\Frontend\Quote; -use Magento\Catalog\Helper\Data as CatalogData; +use Magento\Msrp\Model\Config; /** * Class SetCanApplyMsrp */ class SetCanApplyMsrp { - /** - * Catalog data - * - * @var CatalogData - */ - protected $catalogData; + /** @var Config */ + protected $config; /** - * @param CatalogData $catalogData + * @param Config $config */ - public function __construct(CatalogData $catalogData) + public function __construct(Config $config) { - $this->catalogData = $catalogData; + $this->config = $config; } /** @@ -57,7 +53,7 @@ public function execute(\Magento\Framework\Event\Observer $observer) $quote = $observer->getEvent()->getQuote(); $canApplyMsrp = false; - if ($this->catalogData->isMsrpEnabled()) { + if ($this->config->isEnabled()) { foreach ($quote->getAllAddresses() as $address) { if ($address->getCanApplyMsrp()) { $canApplyMsrp = true; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type.php b/app/code/Magento/Msrp/Model/Product/Attribute/Source/Type.php similarity index 81% rename from app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type.php rename to app/code/Magento/Msrp/Model/Product/Attribute/Source/Type.php index 31f95e38e444f..20267405d7223 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type.php +++ b/app/code/Magento/Msrp/Model/Product/Attribute/Source/Type.php @@ -21,30 +21,27 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Msrp\Model\Product\Attribute\Source; /** - * Catalog product MAP "Display Actual Price" attribute source - * - * @author Magento Core Team + * Catalog product Msrp "Display Actual Price" attribute source */ -namespace Magento\Catalog\Model\Product\Attribute\Source\Msrp; - class Type extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource { /** * Display Product Price on gesture */ - const TYPE_ON_GESTURE = '1'; + const TYPE_ON_GESTURE = 1; /** * Display Product Price in cart */ - const TYPE_IN_CART = '2'; + const TYPE_IN_CART = 2; /** * Display Product Price before order confirmation */ - const TYPE_BEFORE_ORDER_CONFIRM = '3'; + const TYPE_BEFORE_ORDER_CONFIRM = 3; /** * Get all options @@ -55,9 +52,9 @@ public function getAllOptions() { if (!$this->_options) { $this->_options = array( + array('label' => __('On Gesture'), 'value' => self::TYPE_ON_GESTURE), array('label' => __('In Cart'), 'value' => self::TYPE_IN_CART), - array('label' => __('Before Order Confirmation'), 'value' => self::TYPE_BEFORE_ORDER_CONFIRM), - array('label' => __('On Gesture'), 'value' => self::TYPE_ON_GESTURE) + array('label' => __('Before Order Confirmation'), 'value' => self::TYPE_BEFORE_ORDER_CONFIRM) ); } return $this->_options; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type/Price.php b/app/code/Magento/Msrp/Model/Product/Attribute/Source/Type/Price.php similarity index 71% rename from app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type/Price.php rename to app/code/Magento/Msrp/Model/Product/Attribute/Source/Type/Price.php index 5c3ebf471b814..7ce0ebcf7971c 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Msrp/Type/Price.php +++ b/app/code/Magento/Msrp/Model/Product/Attribute/Source/Type/Price.php @@ -21,57 +21,44 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Msrp\Model\Product\Attribute\Source\Type; /** * Source model for 'msrp_display_actual_price_type' product attribute - * - * @author Magento Core Team */ -namespace Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type; - -class Price extends \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type +class Price extends \Magento\Msrp\Model\Product\Attribute\Source\Type { /** * Get value from the store configuration settings */ - const TYPE_USE_CONFIG = '4'; - - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; + const TYPE_USE_CONFIG = 0; /** * Entity attribute factory * * @var \Magento\Eav\Model\Resource\Entity\AttributeFactory */ - protected $_entityAttributeFactory; + protected $entityAttributeFactory; /** * Eav resource helper * * @var \Magento\Eav\Model\Resource\Helper */ - protected $_eavResourceHelper; + protected $eavResourceHelper; /** * Construct * * @param \Magento\Eav\Model\Resource\Entity\AttributeFactory $entityAttributeFactory - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Resource\Helper $eavResourceHelper */ public function __construct( \Magento\Eav\Model\Resource\Entity\AttributeFactory $entityAttributeFactory, - \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Resource\Helper $eavResourceHelper ) { - $this->_entityAttributeFactory = $entityAttributeFactory; - $this->_coreData = $coreData; - $this->_eavResourceHelper = $eavResourceHelper; + $this->entityAttributeFactory = $entityAttributeFactory; + $this->eavResourceHelper = $eavResourceHelper; } /** @@ -82,8 +69,10 @@ public function __construct( public function getAllOptions() { if (!$this->_options) { - $this->_options = parent::getAllOptions(); - $this->_options[] = array('label' => __('Use config'), 'value' => self::TYPE_USE_CONFIG); + $this->_options = array_merge( + [['label' => __('Use config'), 'value' => self::TYPE_USE_CONFIG]], + parent::getAllOptions() + ); } return $this->_options; } @@ -103,7 +92,7 @@ public function getFlatColumns() 'unsigned' => false, 'default' => null, 'extra' => null, - 'type' => $this->_eavResourceHelper->getDdlTypeByColumnType($attributeType), + 'type' => $this->eavResourceHelper->getDdlTypeByColumnType($attributeType), 'nullable' => true, ], ]; @@ -117,6 +106,6 @@ public function getFlatColumns() */ public function getFlatUpdateSelect($store) { - return $this->_entityAttributeFactory->create()->getFlatUpdateSelect($this->getAttribute(), $store); + return $this->entityAttributeFactory->create()->getFlatUpdateSelect($this->getAttribute(), $store); } } diff --git a/app/code/Magento/Msrp/Model/Product/Options.php b/app/code/Magento/Msrp/Model/Product/Options.php new file mode 100644 index 0000000000000..bd777ab8c50ad --- /dev/null +++ b/app/code/Magento/Msrp/Model/Product/Options.php @@ -0,0 +1,93 @@ +config = $config; + $this->msrpData = $msrpData; + } + + /** + * @param \Magento\Catalog\Model\Product $product + * @param null $visibility + * @return bool|null + */ + public function isEnabled($product, $visibility = null) + { + $visibilities = $this->getVisibilities($product); + + $result = (bool)$visibilities ? true : null; + if ($result && $visibility !== null) { + if ($visibilities) { + $maxVisibility = max($visibilities); + $result = $result && $maxVisibility == $visibility; + } else { + $result = false; + } + } + + return $result; + } + + /** + * @param \Magento\Catalog\Model\Product $product + * @return array + */ + protected function getVisibilities($product) + { + /** @var \Magento\Catalog\Model\Product[] $collection */ + $collection = $product->getTypeInstance()->getAssociatedProducts($product)?: []; + $visibilities = []; + /** @var \Magento\Catalog\Model\Product $item */ + foreach ($collection as $item) { + if ($this->msrpData->canApplyMsrp($item)) { + $visibilities[] = $item->getMsrpDisplayActualPriceType() == TypePrice::TYPE_USE_CONFIG + ? $this->config->getDisplayActualPriceType() + : $item->getMsrpDisplayActualPriceType(); + } + } + return $visibilities; + } +} diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Msrp.php b/app/code/Magento/Msrp/Model/Quote/Address/Total.php similarity index 68% rename from app/code/Magento/Sales/Model/Quote/Address/Total/Msrp.php rename to app/code/Magento/Msrp/Model/Quote/Address/Total.php index a5b60bc196afd..bd7d1cbcd6563 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Msrp.php +++ b/app/code/Magento/Msrp/Model/Quote/Address/Total.php @@ -21,29 +21,24 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sales\Model\Quote\Address\Total; +namespace Magento\Msrp\Model\Quote\Address; /** * Msrp items total - * Collects flag if MSRP price is in use - * - * @author Magento Core Team */ -class Msrp extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal +class Total extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal { /** - * Catalog data - * - * @var \Magento\Catalog\Helper\Data + * @var \Magento\Msrp\Helper\Data */ - protected $_catalogData = null; + protected $msrpData = null; /** - * @param \Magento\Catalog\Helper\Data $catalogData + * @param \Magento\Msrp\Helper\Data $msrpData */ - public function __construct(\Magento\Catalog\Helper\Data $catalogData) + public function __construct(\Magento\Msrp\Helper\Data $msrpData) { - $this->_catalogData = $catalogData; + $this->msrpData = $msrpData; } /** @@ -63,11 +58,9 @@ public function collect(\Magento\Sales\Model\Quote\Address $address) $canApplyMsrp = false; foreach ($items as $item) { - if (!$item->getParentItemId() && $this->_catalogData->canApplyMsrp( - $item->getProductId(), - \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type::TYPE_BEFORE_ORDER_CONFIRM, - true - ) + if (!$item->getParentItemId() + && $this->msrpData->isShowBeforeOrderConfirm($item->getProductId()) + && $this->msrpData->isMinimalPriceLessMsrp($item->getProductId()) ) { $canApplyMsrp = true; break; diff --git a/app/code/Magento/Msrp/Plugin/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php b/app/code/Magento/Msrp/Plugin/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php new file mode 100644 index 0000000000000..4b5bd2ee3d5be --- /dev/null +++ b/app/code/Magento/Msrp/Plugin/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php @@ -0,0 +1,65 @@ +getForm()->getElement('msrp'); + if ($mapEnabled && $subject->getCanEditPrice() !== false) { + $mapEnabled->setAfterElementHtml( + '' + ); + } + return $result; + } +} diff --git a/app/code/Magento/Catalog/Pricing/Price/MsrpPrice.php b/app/code/Magento/Msrp/Pricing/Price/MsrpPrice.php similarity index 67% rename from app/code/Magento/Catalog/Pricing/Price/MsrpPrice.php rename to app/code/Magento/Msrp/Pricing/Price/MsrpPrice.php index 452ffb0e73454..bcd69364f78b6 100644 --- a/app/code/Magento/Catalog/Pricing/Price/MsrpPrice.php +++ b/app/code/Magento/Msrp/Pricing/Price/MsrpPrice.php @@ -22,11 +22,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Pricing\Price; +namespace Magento\Msrp\Pricing\Price; -use Magento\Catalog\Helper\Data; use Magento\Framework\Pricing\Adjustment\CalculatorInterface; use Magento\Catalog\Model\Product; +use Magento\Catalog\Pricing\Price\FinalPrice; /** * MSRP price model @@ -39,24 +39,32 @@ class MsrpPrice extends FinalPrice implements MsrpPriceInterface const PRICE_CODE = 'msrp_price'; /** - * @var \Magento\Catalog\Helper\Data + * @var \Magento\Msrp\Helper\Data */ - protected $catalogDataHelper; + protected $msrpData; + + /** + * @var \Magento\Msrp\Model\Config + */ + protected $config; /** * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator - * @param Data $catalogDataHelper + * @param \Magento\Msrp\Helper\Data $msrpData + * @param \Magento\Msrp\Model\Config $config */ public function __construct( Product $saleableItem, $quantity, CalculatorInterface $calculator, - Data $catalogDataHelper + \Magento\Msrp\Helper\Data $msrpData, + \Magento\Msrp\Model\Config $config ) { parent::__construct($saleableItem, $quantity, $calculator); - $this->catalogDataHelper = $catalogDataHelper; + $this->msrpData = $msrpData; + $this->config = $config; } /** @@ -66,27 +74,27 @@ public function __construct( */ public function isShowPriceOnGesture() { - return $this->catalogDataHelper->isShowPriceOnGesture($this->product); + return $this->msrpData->isShowPriceOnGesture($this->product); } /** - * Get MAP message for price + * Get Msrp message for price * * @return string */ public function getMsrpPriceMessage() { - return $this->catalogDataHelper->getMsrpPriceMessage($this->product); + return $this->msrpData->getMsrpPriceMessage($this->product); } /** - * Returns true in case MSRP is enabled + * Check if Minimum Advertised Price is enabled * * @return bool */ public function isMsrpEnabled() { - return $this->catalogDataHelper->isMsrpEnabled(); + return $this->config->isEnabled(); } /** @@ -97,6 +105,15 @@ public function isMsrpEnabled() */ public function canApplyMsrp(Product $product) { - return $this->catalogDataHelper->canApplyMsrp($product); + return $this->msrpData->canApplyMsrp($product); + } + + /** + * @param Product $product + * @return bool|float + */ + public function isMinimalPriceLessMsrp(Product $product) + { + return $this->msrpData->isMinimalPriceLessMsrp($product); } } diff --git a/app/code/Magento/Catalog/Pricing/Price/MsrpPriceInterface.php b/app/code/Magento/Msrp/Pricing/Price/MsrpPriceInterface.php similarity index 92% rename from app/code/Magento/Catalog/Pricing/Price/MsrpPriceInterface.php rename to app/code/Magento/Msrp/Pricing/Price/MsrpPriceInterface.php index 92e72a0c95d63..0ef3c107b182b 100644 --- a/app/code/Magento/Catalog/Pricing/Price/MsrpPriceInterface.php +++ b/app/code/Magento/Msrp/Pricing/Price/MsrpPriceInterface.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Pricing\Price; +namespace Magento\Msrp\Pricing\Price; use Magento\Catalog\Model\Product; @@ -39,14 +39,14 @@ interface MsrpPriceInterface public function isShowPriceOnGesture(); /** - * Get MAP message for price + * Get Msrp message for price * * @return string */ public function getMsrpPriceMessage(); /** - * Returns true in case MSRP is enabled + * Check if Minimum Advertised Price is enabled * * @return bool */ diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json new file mode 100644 index 0000000000000..0b4b89d2783f5 --- /dev/null +++ b/app/code/Magento/Msrp/composer.json @@ -0,0 +1,29 @@ +{ + "name": "magento/module-msrp", + "description": "N/A", + "require": { + "php": "~5.4.11|~5.5.0", + "magento/module-bundle": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-configurable-product": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-downloadable": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-grouped-product": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-store": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", + "magento/magento-composer-installer": "*" + }, + "type": "magento2-module", + "version": "0.1.0-alpha97", + "extra": { + "map": [ + [ + "*", + "Magento/Msrp" + ] + ] + } +} diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php b/app/code/Magento/Msrp/data/msrp_setup/data-install-1.0.0.0.php similarity index 67% rename from app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php rename to app/code/Magento/Msrp/data/msrp_setup/data-install-1.0.0.0.php index 387cbe674409e..f865e95cfe1c7 100644 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php +++ b/app/code/Magento/Msrp/data/msrp_setup/data-install-1.0.0.0.php @@ -25,30 +25,32 @@ /** @var $installer \Magento\Catalog\Model\Resource\Setup */ $installer = $this; -$productTypes = array( +$productTypes = [ \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, + \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, + \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, - \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL -); + \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE, +]; $productTypes = join(',', $productTypes); $installer->addAttribute( \Magento\Catalog\Model\Product::ENTITY, - 'msrp_enabled', + 'msrp', array( - 'group' => 'Prices', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Msrp', + 'group' => 'Advanced Pricing', + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Price', 'frontend' => '', - 'label' => 'Apply MAP', - 'input' => 'select', - 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean', + 'label' => 'Manufacturer\'s Suggested Retail Price', + 'type' => 'decimal', + 'input' => 'price', 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, 'visible' => true, 'required' => false, 'user_defined' => false, - 'default' => '', 'apply_to' => $productTypes, - 'input_renderer' => 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Msrp\Enabled', + 'input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type', + 'frontend_input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type', 'visible_on_front' => false, 'used_in_product_listing' => true ) @@ -58,39 +60,22 @@ \Magento\Catalog\Model\Product::ENTITY, 'msrp_display_actual_price_type', array( - 'group' => 'Prices', + 'group' => 'Advanced Pricing', 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean', 'frontend' => '', 'label' => 'Display Actual Price', 'input' => 'select', - 'source' => 'Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, - 'visible' => true, - 'required' => false, - 'user_defined' => false, - 'default' => '', - 'apply_to' => $productTypes, - 'input_renderer' => 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Msrp\Price', - 'visible_on_front' => false, - 'used_in_product_listing' => true - ) -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp', - array( - 'group' => 'Prices', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Price', - 'frontend' => '', - 'label' => 'Manufacturer\'s Suggested Retail Price', - 'type' => 'decimal', - 'input' => 'price', + 'source' => 'Magento\Msrp\Model\Product\Attribute\Source\Type\Price', + 'source_model' => 'Magento\Msrp\Model\Product\Attribute\Source\Type\Price', 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, 'visible' => true, 'required' => false, 'user_defined' => false, + 'default' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG, + 'default_value' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG, 'apply_to' => $productTypes, + 'input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price', + 'frontend_input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price', 'visible_on_front' => false, 'used_in_product_listing' => true ) diff --git a/app/code/Magento/Msrp/etc/adminhtml/di.xml b/app/code/Magento/Msrp/etc/adminhtml/di.xml new file mode 100644 index 0000000000000..91dd8dfaa763b --- /dev/null +++ b/app/code/Magento/Msrp/etc/adminhtml/di.xml @@ -0,0 +1,30 @@ + + + + + + + diff --git a/app/code/Magento/Msrp/etc/adminhtml/system.xml b/app/code/Magento/Msrp/etc/adminhtml/system.xml new file mode 100644 index 0000000000000..529b8a0c51ded --- /dev/null +++ b/app/code/Magento/Msrp/etc/adminhtml/system.xml @@ -0,0 +1,51 @@ + + + + +
    + + + + + Magento\Backend\Model\Config\Source\Yesno + + Warning! Enabling MAP by default will hide all product prices on the front end.]]> + + + + + Magento\Msrp\Model\Product\Attribute\Source\Type + + + + + + + + +
    + + diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/_files/indexers.xml b/app/code/Magento/Msrp/etc/catalog_attributes.xml similarity index 82% rename from dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/_files/indexers.xml rename to app/code/Magento/Msrp/etc/catalog_attributes.xml index af7a39aee6a8d..c3f9eff52092b 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/_files/indexers.xml +++ b/app/code/Magento/Msrp/etc/catalog_attributes.xml @@ -23,6 +23,9 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - + + + + + diff --git a/app/code/Magento/Msrp/etc/config.xml b/app/code/Magento/Msrp/etc/config.xml new file mode 100644 index 0000000000000..3459c3972f659 --- /dev/null +++ b/app/code/Magento/Msrp/etc/config.xml @@ -0,0 +1,37 @@ + + + + + + + 0 + 1 + Our price is lower than the manufacturer's "minimum advertised price." As a result, we cannot show you the price in catalog or the product page. <br /><br /> You have no obligation to purchase the product once you know the price. You can simply remove the item from your cart. + Our price is lower than the manufacturer's "minimum advertised price." As a result, we cannot show you the price in catalog or the product page. <br /><br /> You have no obligation to purchase the product once you know the price. You can simply remove the item from your cart. + + + + diff --git a/app/code/Magento/Msrp/etc/di.xml b/app/code/Magento/Msrp/etc/di.xml new file mode 100644 index 0000000000000..4a2bea1487415 --- /dev/null +++ b/app/code/Magento/Msrp/etc/di.xml @@ -0,0 +1,64 @@ + + + + + + + Magento\Msrp\Pricing\Price\MsrpPrice + + + + + + + Magento\Msrp\Pricing\Price\MsrpPrice + + + + + + + + msrp + msrp_display_actual_price_type + + + + + + + + Magento\Catalog\Model\Resource\Setup + + + + + + + Magento\Msrp\Model\Product\Options\Proxy + + + diff --git a/app/code/Magento/Msrp/etc/frontend/events.xml b/app/code/Magento/Msrp/etc/frontend/events.xml new file mode 100644 index 0000000000000..cb7b517153f4a --- /dev/null +++ b/app/code/Magento/Msrp/etc/frontend/events.xml @@ -0,0 +1,30 @@ + + + + + + + diff --git a/app/code/Magento/UrlRedirect/etc/module.xml b/app/code/Magento/Msrp/etc/module.xml similarity index 72% rename from app/code/Magento/UrlRedirect/etc/module.xml rename to app/code/Magento/Msrp/etc/module.xml index dd2376b022c52..cb683a46f661b 100644 --- a/app/code/Magento/UrlRedirect/etc/module.xml +++ b/app/code/Magento/Msrp/etc/module.xml @@ -24,13 +24,21 @@ */ --> - + + + + + - + - + + + + + diff --git a/app/code/Magento/Msrp/etc/sales.xml b/app/code/Magento/Msrp/etc/sales.xml new file mode 100644 index 0000000000000..69f42735b3e9c --- /dev/null +++ b/app/code/Magento/Msrp/etc/sales.xml @@ -0,0 +1,32 @@ + + + +
    + + + +
    +
    diff --git a/app/code/Magento/Msrp/view/base/layout/catalog_product_prices.xml b/app/code/Magento/Msrp/view/base/layout/catalog_product_prices.xml new file mode 100644 index 0000000000000..38fd3db1aaf5a --- /dev/null +++ b/app/code/Magento/Msrp/view/base/layout/catalog_product_prices.xml @@ -0,0 +1,39 @@ + + + + + + + + + Magento\Catalog\Pricing\Render\PriceBox + Magento_Msrp::product/price/msrp.phtml + + + + + + diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/msrp_price.phtml b/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml similarity index 72% rename from app/code/Magento/Catalog/view/base/templates/product/price/msrp_price.phtml rename to app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml index b1b449e3f7b27..f7b9229ca4140 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/msrp_price.phtml +++ b/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml @@ -30,28 +30,37 @@ ?> getPrice(); /** @var $product \Magento\Catalog\Model\Product */ $product = $this->getSaleableItem(); $productId = $product->getId(); -// @todo: msrp works totally wrong, any excuses not accepted. will be refactored ASAP -$msrpPrice = $this->renderAmount($priceType->getCustomAmount($product->getMsrp()), +$msrpPrice = $this->renderAmount( + $priceType->getCustomAmount($product->getMsrp() ? : $product->getTypeInstance()->getChildrenMsrp($product)), [ - 'price_id' => $this->getPriceId() ? $this->getPriceId() : 'old-price-' . $productId, + 'price_id' => $this->getPriceId() ? $this->getPriceId() : 'old-price-' . $productId, 'include_container' => false, 'skip_adjustments' => true ] ); $priceElementIdPrefix = $this->getPriceElementIdPrefix() ? $this->getPriceElementIdPrefix() : 'product-price-'; + $addToCartUrl = ''; if ($product->isSaleable()) { - $addToCartUrl = $this->helper('\Magento\Checkout\Helper\Cart') - ->getAddUrl($product); + /** @var Magento\Catalog\Block\Product\AbstractProduct $addToCartUrlGenerator */ + $addToCartUrlGenerator = $this->getLayout()->getBlockSingleton('Magento\Catalog\Block\Product\AbstractProduct'); + $addToCartUrl = $addToCartUrlGenerator->getAddToCartUrl( + $product, + ['_query' => [ + \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED + => $this->helper('Magento\Core\Helper\PostData')->getEncodedUrl( + $addToCartUrlGenerator->getAddToCartUrl($product) + ) + ]] + ); } ?> - getMsrp()): ?> @@ -62,7 +71,12 @@ if ($product->isSaleable()) { getRandomString(20); ?> getRequest()->getFullActionName() === 'catalog_product_view'): ?> + "addToCartButton": "#product_addtocart_form [type=submit]", + + "cartForm": "#product_addtocart_form_from_popup", + "popupId": "#", "productName": "getName() ?>", "realPrice": jsonEncode($this->getRealPriceHtml()) ?>, @@ -70,7 +84,9 @@ if ($product->isSaleable()) { "priceElementId":"", "closeButtonId": "#map-popup-close", "popupCartButtonId": "#map-popup-button", - "addToCartUrl": ""}}'> + "addToCartUrl": ""}}' + > + diff --git a/app/code/Magento/Catalog/view/base/web/js/msrp.js b/app/code/Magento/Msrp/view/base/web/js/msrp.js similarity index 75% rename from app/code/Magento/Catalog/view/base/web/js/msrp.js rename to app/code/Magento/Msrp/view/base/web/js/msrp.js index e3604112a3a01..85c1a66a587c4 100644 --- a/app/code/Magento/Catalog/view/base/web/js/msrp.js +++ b/app/code/Magento/Msrp/view/base/web/js/msrp.js @@ -21,8 +21,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ /*jshint browser:true jquery:true*/ -define(["jquery","jquery/ui","mage/dropdown"], function($){ - +define(["jquery", "jquery/ui", "mage/dropdown"], function($) { $.widget('mage.addToCart', { options: { showAddToCart: true, @@ -46,10 +45,10 @@ define(["jquery","jquery/ui","mage/dropdown"], function($){ $('#map-popup-price').html($(this.options.realPrice)); $('#map-popup-msrp > span.price').html(this.options.msrpPrice); this.element.trigger('reloadPrice'); - var dialog = $( "#map-popup-click-for-price" ); - this._popupDialog(dialog,this.options.popupId); + var dialog = $("#map-popup-click-for-price"); + this._popupDialog(dialog, this.options.popupId); if (!this.options.showAddToCart) { - $('#map-popup-content > .map-popup-checkout').hide(); + $('#product_addtocart_form_from_popup').hide(); } return false; } @@ -57,33 +56,35 @@ define(["jquery","jquery/ui","mage/dropdown"], function($){ $(this.options.helpLinkId).on('click', $.proxy(function(e) { $('#map-popup-heading-what-this').text(this.options.productName); - var dialog = $( "#map-popup-what-this" ); - this._popupDialog(dialog,this.options.helpLinkId); + var dialog = $("#map-popup-what-this"); + this._popupDialog(dialog, this.options.helpLinkId); return false; }, this)); - - }, - _popupDialog : function(target,trigger) { - if(!target.hasClass('ui-dialog-content')) { + _popupDialog: function(target, trigger) { + if (!target.hasClass('ui-dialog-content')) { target.dropdownDialog({ - appendTo :".column.main", - dialogContentClass : 'active', + appendTo: ".column.main", + dialogContentClass: 'active', timeout: "2000", autoPosition: true, - "dialogClass" : "popup" + "dialogClass": "popup" }); } $('.mage-dropdown-dialog > .ui-dialog-content').dropdownDialog("close"); - target.dropdownDialog("option","position",{my: "right+50% top", collision: "none", at: "center bottom", of: trigger}); - target.dropdownDialog("option","triggerTarget",trigger); + target.dropdownDialog("option", "position", {my: "right+50% top", collision: "none", at: "center bottom", of: trigger}); + target.dropdownDialog("option", "triggerTarget", trigger); target.dropdownDialog("open"); }, _addToCartSubmit: function() { this.element.trigger('addToCart', this.element); + if (this.options.addToCartButton) { + $(this.options.addToCartButton).click(); + return; + } if (this.options.addToCartUrl) { $('.mage-dropdown-dialog > .ui-dialog-content').dropdownDialog("close"); $(this.options.cartForm).attr('action', this.options.addToCartUrl); @@ -91,4 +92,4 @@ define(["jquery","jquery/ui","mage/dropdown"], function($){ $(this.options.cartForm).submit(); } }); -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Rss/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/Msrp/view/frontend/layout/catalog_category_view.xml similarity index 75% rename from app/code/Magento/Rss/view/frontend/layout/catalog_category_view.xml rename to app/code/Magento/Msrp/view/frontend/layout/catalog_category_view.xml index 86285166f3b7e..f33925824881b 100644 --- a/app/code/Magento/Rss/view/frontend/layout/catalog_category_view.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/catalog_category_view.xml @@ -23,8 +23,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - - + + diff --git a/app/code/Magento/Msrp/view/frontend/layout/catalog_product_compare_index.xml b/app/code/Magento/Msrp/view/frontend/layout/catalog_product_compare_index.xml new file mode 100644 index 0000000000000..81e2fc704466d --- /dev/null +++ b/app/code/Magento/Msrp/view/frontend/layout/catalog_product_compare_index.xml @@ -0,0 +1,28 @@ + + + + + diff --git a/app/code/Magento/Msrp/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Msrp/view/frontend/layout/catalog_product_view.xml new file mode 100644 index 0000000000000..6e35697c407bc --- /dev/null +++ b/app/code/Magento/Msrp/view/frontend/layout/catalog_product_view.xml @@ -0,0 +1,39 @@ + + + + + + + + 1 + + + + + 1 + + + diff --git a/app/code/Magento/Rss/view/adminhtml/layout/sales_order_grid_block.xml b/app/code/Magento/Msrp/view/frontend/layout/catalog_product_view_type_downloadable.xml similarity index 75% rename from app/code/Magento/Rss/view/adminhtml/layout/sales_order_grid_block.xml rename to app/code/Magento/Msrp/view/frontend/layout/catalog_product_view_type_downloadable.xml index 871e6f5ba8bb3..05a07365711b6 100644 --- a/app/code/Magento/Rss/view/adminhtml/layout/sales_order_grid_block.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/catalog_product_view_type_downloadable.xml @@ -24,14 +24,9 @@ */ --> - + - - - rss/order/new - New Order RSS - - + 1 diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalogsearch_advanced_result.xml b/app/code/Magento/Msrp/view/frontend/layout/catalogsearch_advanced_result.xml similarity index 96% rename from app/code/Magento/Catalog/view/frontend/layout/catalogsearch_advanced_result.xml rename to app/code/Magento/Msrp/view/frontend/layout/catalogsearch_advanced_result.xml index f58e41ede006d..316bbb5180c23 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalogsearch_advanced_result.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/catalogsearch_advanced_result.xml @@ -24,5 +24,5 @@ */ --> - + diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalogsearch_result_index.xml b/app/code/Magento/Msrp/view/frontend/layout/catalogsearch_result_index.xml similarity index 96% rename from app/code/Magento/Catalog/view/frontend/layout/catalogsearch_result_index.xml rename to app/code/Magento/Msrp/view/frontend/layout/catalogsearch_result_index.xml index f58e41ede006d..316bbb5180c23 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalogsearch_result_index.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/catalogsearch_result_index.xml @@ -24,5 +24,5 @@ */ --> - + diff --git a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_special.xml b/app/code/Magento/Msrp/view/frontend/layout/checkout_cart_index.xml similarity index 64% rename from app/code/Magento/Rss/view/frontend/layout/rss_catalog_special.xml rename to app/code/Magento/Msrp/view/frontend/layout/checkout_cart_index.xml index aeda0d2becc62..88d9cc02049ba 100644 --- a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_special.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/checkout_cart_index.xml @@ -23,14 +23,13 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - - + + + + - catalog_product_prices - + checkout.cart.totals - - + + diff --git a/app/code/Magento/Catalog/view/frontend/layout/checkout_onepage_failure.xml b/app/code/Magento/Msrp/view/frontend/layout/checkout_onepage_failure.xml similarity index 96% rename from app/code/Magento/Catalog/view/frontend/layout/checkout_onepage_failure.xml rename to app/code/Magento/Msrp/view/frontend/layout/checkout_onepage_failure.xml index f58e41ede006d..316bbb5180c23 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/checkout_onepage_failure.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/checkout_onepage_failure.xml @@ -24,5 +24,5 @@ */ --> - + diff --git a/app/code/Magento/Catalog/view/frontend/layout/checkout_onepage_success.xml b/app/code/Magento/Msrp/view/frontend/layout/checkout_onepage_success.xml similarity index 96% rename from app/code/Magento/Catalog/view/frontend/layout/checkout_onepage_success.xml rename to app/code/Magento/Msrp/view/frontend/layout/checkout_onepage_success.xml index f58e41ede006d..316bbb5180c23 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/checkout_onepage_success.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/checkout_onepage_success.xml @@ -24,5 +24,5 @@ */ --> - + diff --git a/app/code/Magento/Msrp/view/frontend/layout/default.xml b/app/code/Magento/Msrp/view/frontend/layout/default.xml new file mode 100644 index 0000000000000..4c627d7a49bb1 --- /dev/null +++ b/app/code/Magento/Msrp/view/frontend/layout/default.xml @@ -0,0 +1,34 @@ + + + + + + + minicart.subtotal + + + + diff --git a/app/code/Magento/Catalog/view/frontend/layout/MAP_popup.xml b/app/code/Magento/Msrp/view/frontend/layout/msrp_popup.xml similarity index 90% rename from app/code/Magento/Catalog/view/frontend/layout/MAP_popup.xml rename to app/code/Magento/Msrp/view/frontend/layout/msrp_popup.xml index 1ad87ee2d446c..e10bcac543399 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/MAP_popup.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/msrp_popup.xml @@ -25,7 +25,7 @@ --> - + diff --git a/app/code/Magento/Catalog/view/frontend/layout/review_product_list.xml b/app/code/Magento/Msrp/view/frontend/layout/review_product_list.xml similarity index 92% rename from app/code/Magento/Catalog/view/frontend/layout/review_product_list.xml rename to app/code/Magento/Msrp/view/frontend/layout/review_product_list.xml index 8073b2b1cfe1c..0681cfb064e72 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/review_product_list.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/review_product_list.xml @@ -24,6 +24,6 @@ */ --> - - + + diff --git a/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_index.xml b/app/code/Magento/Msrp/view/frontend/layout/wishlist_index_configure_type_downloadable.xml similarity index 84% rename from app/code/Magento/Catalog/view/frontend/layout/checkout_cart_index.xml rename to app/code/Magento/Msrp/view/frontend/layout/wishlist_index_configure_type_downloadable.xml index f58e41ede006d..ebcf1cfc7a250 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_index.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/wishlist_index_configure_type_downloadable.xml @@ -24,5 +24,9 @@ */ --> - + + + 1 + + diff --git a/app/code/Magento/Catalog/view/frontend/layout/wishlist_index_index.xml b/app/code/Magento/Msrp/view/frontend/layout/wishlist_index_index.xml similarity index 92% rename from app/code/Magento/Catalog/view/frontend/layout/wishlist_index_index.xml rename to app/code/Magento/Msrp/view/frontend/layout/wishlist_index_index.xml index c8ae02657dcbe..5aefce3972560 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/wishlist_index_index.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/wishlist_index_index.xml @@ -24,6 +24,6 @@ */ --> - - + + diff --git a/app/code/Magento/Catalog/view/frontend/layout/wishlist_search_view.xml b/app/code/Magento/Msrp/view/frontend/layout/wishlist_search_view.xml similarity index 92% rename from app/code/Magento/Catalog/view/frontend/layout/wishlist_search_view.xml rename to app/code/Magento/Msrp/view/frontend/layout/wishlist_search_view.xml index c8ae02657dcbe..5aefce3972560 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/wishlist_search_view.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/wishlist_search_view.xml @@ -24,6 +24,6 @@ */ --> - - + + diff --git a/app/code/Magento/Catalog/view/frontend/layout/wishlist_shared_index.xml b/app/code/Magento/Msrp/view/frontend/layout/wishlist_shared_index.xml similarity index 92% rename from app/code/Magento/Catalog/view/frontend/layout/wishlist_shared_index.xml rename to app/code/Magento/Msrp/view/frontend/layout/wishlist_shared_index.xml index c8ae02657dcbe..5aefce3972560 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/wishlist_shared_index.xml +++ b/app/code/Magento/Msrp/view/frontend/layout/wishlist_shared_index.xml @@ -24,6 +24,6 @@ */ --> - - + + diff --git a/lib/web/requirejs-config.js b/app/code/Magento/Msrp/view/frontend/templates/cart/subtotal.phtml similarity index 82% rename from lib/web/requirejs-config.js rename to app/code/Magento/Msrp/view/frontend/templates/cart/subtotal.phtml index bd0f769611783..be1da4e6b47e1 100644 --- a/lib/web/requirejs-config.js +++ b/app/code/Magento/Msrp/view/frontend/templates/cart/subtotal.phtml @@ -1,3 +1,4 @@ + +
    + + + +
    diff --git a/app/code/Magento/Msrp/view/frontend/templates/cart/totals.phtml b/app/code/Magento/Msrp/view/frontend/templates/cart/totals.phtml new file mode 100644 index 0000000000000..f28e5061c7f1f --- /dev/null +++ b/app/code/Magento/Msrp/view/frontend/templates/cart/totals.phtml @@ -0,0 +1,27 @@ + +
    +
    +
    diff --git a/app/code/Magento/Catalog/view/frontend/templates/msrp/popup.phtml b/app/code/Magento/Msrp/view/frontend/templates/popup.phtml similarity index 84% rename from app/code/Magento/Catalog/view/frontend/templates/msrp/popup.phtml rename to app/code/Magento/Msrp/view/frontend/templates/popup.phtml index d74cdcd7c6cd9..c18907f8feb91 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/msrp/popup.phtml +++ b/app/code/Magento/Msrp/view/frontend/templates/popup.phtml @@ -23,12 +23,9 @@ */ ?> -helper('Magento\Catalog\Helper\Data')->isMsrpEnabled()): ?> +isEnabled()): ?>
    @@ -73,7 +68,7 @@ diff --git a/app/code/Magento/Wishlist/view/frontend/templates/render/item/price_msrp_item.phtml b/app/code/Magento/Msrp/view/frontend/templates/render/item/price_msrp_item.phtml similarity index 99% rename from app/code/Magento/Wishlist/view/frontend/templates/render/item/price_msrp_item.phtml rename to app/code/Magento/Msrp/view/frontend/templates/render/item/price_msrp_item.phtml index f36db4e8b83a0..7cc3d0aa24176 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/render/item/price_msrp_item.phtml +++ b/app/code/Magento/Msrp/view/frontend/templates/render/item/price_msrp_item.phtml @@ -48,7 +48,7 @@ isShowPriceOnGesture($_product)): ?> getIdSuffix(); ?> - + getRandomString(20); ?> diff --git a/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php b/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php index 1492f75e879e9..2179c670bfba6 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php @@ -74,9 +74,7 @@ public function __construct( */ protected function _prepareLayout() { - if ($headBlock = $this->getLayout()->getBlock('head')) { - $headBlock->setTitle(__('Change Billing Address') . ' - ' . $headBlock->getDefaultTitle()); - } + $this->pageConfig->setTitle(__('Change Billing Address') . ' - ' . $this->pageConfig->getDefaultTitle()); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Multishipping/Block/Checkout/Addresses.php b/app/code/Magento/Multishipping/Block/Checkout/Addresses.php index 50378e2a5ed8e..fcc07d2ebac44 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Addresses.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Addresses.php @@ -89,10 +89,7 @@ public function getCheckout() */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Ship to Multiple Addresses') . ' - ' . $headBlock->getDefaultTitle()); - } + $this->pageConfig->setTitle(__('Ship to Multiple Addresses') . ' - ' . $this->pageConfig->getDefaultTitle()); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Multishipping/Block/Checkout/Billing.php b/app/code/Magento/Multishipping/Block/Checkout/Billing.php index b567567473735..8333149513c28 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Billing.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Billing.php @@ -77,10 +77,7 @@ public function __construct( */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Billing Information - %1', $headBlock->getDefaultTitle())); - } + $this->pageConfig->setTitle(__('Billing Information - %1', $this->pageConfig->getDefaultTitle())); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Multishipping/Block/Checkout/Overview.php b/app/code/Magento/Multishipping/Block/Checkout/Overview.php index 7355583ef19fb..f6261105eacb5 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Overview.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Overview.php @@ -73,10 +73,7 @@ public function __construct( */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Review Order - %1', $headBlock->getDefaultTitle())); - } + $this->pageConfig->setTitle(__('Review Order - %1', $this->pageConfig->getDefaultTitle())); return parent::_prepareLayout(); } @@ -333,7 +330,7 @@ public function getBillinAddressTotals() public function renderTotals($totals, $colspan = null) { if ($colspan === null) { - $colspan = $this->_taxHelper->displayCartBothPrices() ? 5 : 3; + $colspan = 3; } $totals = $this->getChildBlock( 'totals' diff --git a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php index f74e00187f24d..9868b9bc68600 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php @@ -87,9 +87,7 @@ public function getCheckout() */ protected function _prepareLayout() { - if ($headBlock = $this->getLayout()->getBlock('head')) { - $headBlock->setTitle(__('Shipping Methods') . ' - ' . $headBlock->getDefaultTitle()); - } + $this->pageConfig->setTitle(__('Shipping Methods') . ' - ' . $this->pageConfig->getDefaultTitle()); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Multishipping/Controller/Checkout.php b/app/code/Magento/Multishipping/Controller/Checkout.php old mode 100755 new mode 100644 diff --git a/app/code/Magento/Multishipping/Controller/Checkout/Address/EditAddress.php b/app/code/Magento/Multishipping/Controller/Checkout/Address/EditAddress.php index bc038bcbe187c..8c4693ee85730 100644 --- a/app/code/Magento/Multishipping/Controller/Checkout/Address/EditAddress.php +++ b/app/code/Magento/Multishipping/Controller/Checkout/Address/EditAddress.php @@ -43,10 +43,9 @@ public function execute() )->setBackUrl( $this->_url->getUrl('*/*/selectBilling') ); - - if ($headBlock = $this->_view->getLayout()->getBlock('head')) { - $headBlock->setTitle($addressForm->getTitle() . ' - ' . $headBlock->getDefaultTitle()); - } + $this->_view->getPage()->getConfig()->setTitle( + $addressForm->getTitle() . ' - ' . $this->_view->getPage()->getConfig()->getDefaultTitle() + ); } $this->_view->renderLayout(); } diff --git a/app/code/Magento/Multishipping/Controller/Checkout/Address/EditBilling.php b/app/code/Magento/Multishipping/Controller/Checkout/Address/EditBilling.php index 9123868193fa0..25529394897b0 100644 --- a/app/code/Magento/Multishipping/Controller/Checkout/Address/EditBilling.php +++ b/app/code/Magento/Multishipping/Controller/Checkout/Address/EditBilling.php @@ -46,9 +46,9 @@ public function execute() )->setBackUrl( $this->_url->getUrl('*/checkout/overview') ); - if ($headBlock = $this->_view->getLayout()->getBlock('head')) { - $headBlock->setTitle($addressForm->getTitle() . ' - ' . $headBlock->getDefaultTitle()); - } + $this->_view->getPage()->getConfig()->setTitle( + $addressForm->getTitle() . ' - ' . $this->_view->getPage()->getConfig()->getDefaultTitle() + ); } $this->_view->renderLayout(); } diff --git a/app/code/Magento/Multishipping/Controller/Checkout/Address/EditShipping.php b/app/code/Magento/Multishipping/Controller/Checkout/Address/EditShipping.php index 6a68b1c7f43a3..8d6570852468a 100644 --- a/app/code/Magento/Multishipping/Controller/Checkout/Address/EditShipping.php +++ b/app/code/Magento/Multishipping/Controller/Checkout/Address/EditShipping.php @@ -45,9 +45,9 @@ public function execute() $this->_url->getUrl('*/*/*') ); - if ($headBlock = $this->_view->getLayout()->getBlock('head')) { - $headBlock->setTitle($addressForm->getTitle() . ' - ' . $headBlock->getDefaultTitle()); - } + $this->_view->getPage()->getConfig()->setTitle( + $addressForm->getTitle() . ' - ' . $this->_view->getPage()->getConfig()->getDefaultTitle() + ); if ($this->_getCheckout()->getCustomerDefaultShippingAddress()) { $addressForm->setBackUrl($this->_url->getUrl('*/checkout/shipping')); diff --git a/app/code/Magento/Multishipping/Controller/Checkout/Address/NewBilling.php b/app/code/Magento/Multishipping/Controller/Checkout/Address/NewBilling.php index c18e5636670ef..ffc2459079a9a 100644 --- a/app/code/Magento/Multishipping/Controller/Checkout/Address/NewBilling.php +++ b/app/code/Magento/Multishipping/Controller/Checkout/Address/NewBilling.php @@ -44,9 +44,9 @@ public function execute() $this->_url->getUrl('*/*/selectBilling') ); - if ($headBlock = $this->_view->getLayout()->getBlock('head')) { - $headBlock->setTitle($addressForm->getTitle() . ' - ' . $headBlock->getDefaultTitle()); - } + $this->_view->getPage()->getConfig()->setTitle( + $addressForm->getTitle() . ' - ' . $this->_view->getPage()->getConfig()->getDefaultTitle() + ); } $this->_view->renderLayout(); } diff --git a/app/code/Magento/Multishipping/Controller/Checkout/Address/NewShipping.php b/app/code/Magento/Multishipping/Controller/Checkout/Address/NewShipping.php index 24675a291c57a..994138ed40391 100644 --- a/app/code/Magento/Multishipping/Controller/Checkout/Address/NewShipping.php +++ b/app/code/Magento/Multishipping/Controller/Checkout/Address/NewShipping.php @@ -47,9 +47,9 @@ public function execute() $this->_url->getUrl('*/*/*') ); - if ($headBlock = $this->_view->getLayout()->getBlock('head')) { - $headBlock->setTitle($addressForm->getTitle() . ' - ' . $headBlock->getDefaultTitle()); - } + $this->_view->getPage()->getConfig()->setTitle( + $addressForm->getTitle() . ' - ' . $this->_view->getPage()->getConfig()->getDefaultTitle() + ); if ($this->_getCheckout()->getCustomerDefaultShippingAddress()) { $addressForm->setBackUrl($this->_url->getUrl('*/checkout/addresses')); diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json index 1af5f787da711..3b6e72a045669 100644 --- a/app/code/Magento/Multishipping/composer.json +++ b/app/code/Magento/Multishipping/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml index 5a792124164d3..1637e679a152d 100644 --- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml +++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml @@ -67,22 +67,28 @@ format('html') ?> -
    - +
    + getShippingAddressRate($_address)): ?> -

    +

    escapeHtml($_rate->getCarrierTitle()) ?> (escapeHtml($_rate->getMethodTitle()) ?>) getShippingPriceExclTax($_address); ?> getShippingPriceInclTax($_address); ?> - helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> - ( ) + + + + helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> + -

    + helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> + + +
    @@ -93,19 +99,11 @@ - - - - + + + + - helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - - - - - - renderTotals($this->getShippingAddressTotals($_address)); ?> @@ -135,19 +133,11 @@
    helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(false) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(true) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(false) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(true) ?>
    - - - - - - helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - - - - + + + + - renderTotals($this->getBillinAddressTotals()); ?> diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview/item.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview/item.phtml index 5c6d7e287d04b..7d971445cf6c5 100644 --- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview/item.phtml +++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview/item.phtml @@ -32,36 +32,42 @@ getItem() ?> - - - helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - - - - - helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - - - - + + + + + + getRowTotalExclTaxHtml($_item); ?> + - - - - helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - - diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/shipping.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/shipping.phtml index bbd4fa7ef9c46..bbc0004221805 100644 --- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/shipping.phtml +++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/shipping.phtml @@ -44,42 +44,50 @@
    format('html') ?>
    -
    - +
    + - getShippingRates($_address))): ?> -

    - -
    - $_rates): ?> -
    escapeHtml($this->getCarrierName($code)) ?>
    -
    - -
    - getErrorMessage()): ?> - escapeHtml($_rate->getCarrierTitle()) ?>: escapeHtml($_rate->getErrorMessage()) ?> - - - - - getCode()===$this->getAddressShippingMethod($_address)) echo ' checked="checked"' ?> class="radio" /> - - - -
    - -
    - -
    - +
    + getShippingRates($_address))): ?> +

    + +
    + $_rates): ?> +
    escapeHtml($this->getCarrierName($code)) ?>
    +
    + +
    + getErrorMessage()): ?> + escapeHtml($_rate->getCarrierTitle()) ?>: escapeHtml($_rate->getErrorMessage()) ?> + + + + + getCode()===$this->getAddressShippingMethod($_address)) echo ' checked="checked"' ?> class="radio" /> + + + +
    + +
    + +
    + +
    diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php index 98e50289672a9..89e057e541d65 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php @@ -43,25 +43,17 @@ class Edit extends \Magento\Backend\Block\Template */ protected $_coreRegistry = null; - /** - * @var \Magento\Cms\Model\Wysiwyg\Config - */ - protected $_wysiwygConfig; - /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\Framework\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\Framework\Registry $registry, array $data = array() ) { $this->_coreRegistry = $registry; - $this->_wysiwygConfig = $wysiwygConfig; parent::__construct($context, $data); } @@ -123,11 +115,6 @@ public function getSaveUrl() */ protected function _prepareLayout() { - // Load Wysiwyg on demand and Prepare layout - if ($this->_wysiwygConfig->isEnabled()) { - $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); - } - $this->getToolbar()->addChild( 'back_button', 'Magento\Backend\Block\Widget\Button', diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php index 656be4d4600f6..87368ac692557 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php @@ -78,10 +78,10 @@ public function getModel() protected function _prepareLayout() { // Load Wysiwyg on demand and Prepare layout - $block = $this->getLayout()->getBlock('head'); - if ($this->_wysiwygConfig->isEnabled() && $block) { - $block->setCanLoadTinyMce(true); - } +// $block = $this->getLayout()->getBlock('head'); +// if ($this->_wysiwygConfig->isEnabled() && $block) { +// $block->setCanLoadTinyMce(true); +// } $this->getToolbar()->addChild( 'back_button', diff --git a/app/code/Magento/Newsletter/Controller/Manage/Index.php b/app/code/Magento/Newsletter/Controller/Manage/Index.php index 2d0b45d07492d..1484ef70dbc2a 100644 --- a/app/code/Magento/Newsletter/Controller/Manage/Index.php +++ b/app/code/Magento/Newsletter/Controller/Manage/Index.php @@ -39,7 +39,7 @@ public function execute() if ($block = $this->_view->getLayout()->getBlock('customer_newsletter')) { $block->setRefererUrl($this->_redirect->getRefererUrl()); } - $this->_view->getLayout()->getBlock('head')->setTitle(__('Newsletter Subscription')); + $this->_view->getPage()->getConfig()->setTitle(__('Newsletter Subscription')); $this->_view->renderLayout(); } } diff --git a/app/code/Magento/Newsletter/Controller/Manage/Save.php b/app/code/Magento/Newsletter/Controller/Manage/Save.php index 04eac75883c72..1039725ef0e1b 100644 --- a/app/code/Magento/Newsletter/Controller/Manage/Save.php +++ b/app/code/Magento/Newsletter/Controller/Manage/Save.php @@ -47,7 +47,7 @@ public function execute() $customerDetails = $this->_customerDetailsBuilder->setAddresses(null) ->setCustomer($this->_customerBuilder->populate($customer)->setStoreId($storeId)->create()) ->create(); - $this->_customerAccountService->updateCustomer($customerDetails); + $this->_customerAccountService->updateCustomer($customerId, $customerDetails); if ((boolean)$this->getRequest()->getParam('is_subscribed', false)) { $this->_subscriberFactory->create()->subscribeCustomerById($customerId); diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php index 797d72743de37..af7de6fb3e526 100644 --- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php +++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php @@ -69,6 +69,7 @@ public function afterCreateCustomer(CustomerAccountServiceInterface $subject, Cu * * @param CustomerAccountServiceInterface $subject * @param callable $updateCustomer + * @param string $customerId * @param CustomerDetails $customerDetails * @return bool * @@ -77,9 +78,10 @@ public function afterCreateCustomer(CustomerAccountServiceInterface $subject, Cu public function aroundUpdateCustomer( CustomerAccountServiceInterface $subject, callable $updateCustomer, + $customerId, CustomerDetails $customerDetails ) { - $result = $updateCustomer($customerDetails); + $result = $updateCustomer($customerId, $customerDetails); $this->subscriberFactory->create()->updateSubscription($customerDetails->getCustomer()->getId()); diff --git a/app/code/Magento/Newsletter/Model/Resource/Queue.php b/app/code/Magento/Newsletter/Model/Resource/Queue.php index b53856a8e68cb..0139fa879f7c1 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Queue.php +++ b/app/code/Magento/Newsletter/Model/Resource/Queue.php @@ -78,7 +78,7 @@ public function addSubscribersToQueue(ModelQueue $queue, array $subscriberIds) throw new \Magento\Framework\Model\Exception(__('There are no subscribers selected.')); } - if (!$queue->getId() && $queue->getQueueStatus() != Magento_Newsletter_Model_Queue::STATUS_NEVER) { + if (!$queue->getId() && $queue->getQueueStatus() != \Magento\Newsletter\Model\Queue::STATUS_NEVER) { throw new \Magento\Framework\Model\Exception(__('You selected an invalid queue.')); } diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json index b21997e27c964..1299cb531075c 100644 --- a/app/code/Magento/Newsletter/composer.json +++ b/app/code/Magento/Newsletter/composer.json @@ -3,21 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-widget": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-cms": "0.1.0-alpha96", - "magento/module-email": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-cron": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-widget": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-cms": "0.1.0-alpha97", + "magento/module-email": "0.1.0-alpha97", + "magento/module-cron": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Newsletter/etc/module.xml b/app/code/Magento/Newsletter/etc/module.xml index 3f4d2f1b35071..c4d8cc2d1f1bc 100644 --- a/app/code/Magento/Newsletter/etc/module.xml +++ b/app/code/Magento/Newsletter/etc/module.xml @@ -40,7 +40,6 @@ - diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_edit.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_edit.xml index c4e203a5f3fce..dd7cf98b9f376 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_edit.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_edit.xml @@ -25,18 +25,10 @@ --> - - - - jquery/fileUploader/css/jquery.fileupload-ui.css - - - - - jquery/fileUploader/bootstrap.js - - - + + + + diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_preview.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_preview.xml index 9b0b0a8f86347..197b1ebde82a1 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_preview.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_preview.xml @@ -23,12 +23,16 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - - Magento_Newsletter::preview/iframeswitcher.phtml - - - - + + + + + + + + + + + + diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_edit.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_edit.xml index 774d94f3e8b19..bf235b36dbbd7 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_edit.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_edit.xml @@ -25,18 +25,10 @@ --> - - - - jquery/fileUploader/css/jquery.fileupload-ui.css - - - - - jquery/fileUploader/bootstrap.js - - - + + + + diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_preview.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_preview.xml index acb93d7f00baa..197b1ebde82a1 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_preview.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_preview.xml @@ -23,12 +23,16 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - - Magento_Newsletter::preview/iframeswitcher.phtml - - - - + + + + + + + + + + + + diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml index af988e13cc27f..5b6abc6b6966e 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml @@ -22,15 +22,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> - - - - -getChildHtml('head') ?> - -
    isSingleStoreMode()) :?> @@ -77,5 +68,3 @@ jQuery("#preview_iframe").load(function() { }); - - diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json index dfecdfa001fe3..65ed9dc6de6e7 100644 --- a/app/code/Magento/OfflinePayments/composer.json +++ b/app/code/Magento/OfflinePayments/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-payment": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-payment": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json index efc97818ad1ed..35d7460d1d661 100644 --- a/app/code/Magento/OfflineShipping/composer.json +++ b/app/code/Magento/OfflineShipping/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-shipping": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-sales-rule": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-shipping": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-sales-rule": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Ogone/composer.json b/app/code/Magento/Ogone/composer.json index bd859235d5b86..63095972229bc 100644 --- a/app/code/Magento/Ogone/composer.json +++ b/app/code/Magento/Ogone/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php old mode 100755 new mode 100644 diff --git a/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php old mode 100755 new mode 100644 diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json index f8da46fc5f2e9..a6cd124ebca9a 100644 --- a/app/code/Magento/PageCache/composer.json +++ b/app/code/Magento/PageCache/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/PageCache/view/frontend/layout/default.xml b/app/code/Magento/PageCache/view/frontend/layout/default.xml index 9cd5fc1f8be79..62bc801e271c7 100644 --- a/app/code/Magento/PageCache/view/frontend/layout/default.xml +++ b/app/code/Magento/PageCache/view/frontend/layout/default.xml @@ -27,8 +27,7 @@ - - \ No newline at end of file + diff --git a/app/code/Magento/PayPalRecurringPayment/composer.json b/app/code/Magento/PayPalRecurringPayment/composer.json index 7b016f8c135e3..e45d930bccb05 100644 --- a/app/code/Magento/PayPalRecurringPayment/composer.json +++ b/app/code/Magento/PayPalRecurringPayment/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-paypal": "0.1.0-alpha96", - "magento/module-recurring-payment": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-paypal": "0.1.0-alpha97", + "magento/module-recurring-payment": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index a3d80826c4520..ac92021012d11 100644 --- a/app/code/Magento/Payment/composer.json +++ b/app/code/Magento/Payment/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-centinel": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-centinel": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress/SaveShippingMethod.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress/SaveShippingMethod.php index 24d54ec5ae52f..19b1307085a78 100644 --- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress/SaveShippingMethod.php +++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress/SaveShippingMethod.php @@ -38,7 +38,7 @@ public function execute() $this->_initCheckout(); $this->_checkout->updateShippingMethod($this->getRequest()->getParam('shipping_method')); if ($isAjax) { - $this->_view->loadLayout('paypal_express_review_details'); + $this->_view->loadLayout('paypal_express_review_details', true, true, false); $this->getResponse()->setBody( $this->_view->getLayout()->getBlock('page.block')->setQuote($this->_getQuote())->toHtml() ); diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json index d35eb98c64c86..62d584462c61f 100644 --- a/app/code/Magento/Paypal/composer.json +++ b/app/code/Magento/Paypal/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-centinel": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-centinel": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Paypal/view/adminhtml/layout/adminhtml_system_config_edit.xml b/app/code/Magento/Paypal/view/adminhtml/layout/adminhtml_system_config_edit.xml index b480da881fa9d..5f054039c7e80 100644 --- a/app/code/Magento/Paypal/view/adminhtml/layout/adminhtml_system_config_edit.xml +++ b/app/code/Magento/Paypal/view/adminhtml/layout/adminhtml_system_config_edit.xml @@ -24,11 +24,7 @@ */ --> - - - - Magento_Paypal::styles.css - - - + + + diff --git a/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml b/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml index 1fab718a4cee0..de0a08d520773 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml @@ -24,11 +24,9 @@ */ --> - - - Billing Agreements - - + + Billing Agreements + diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml index 92732d9d1b4d8..a9275be1469b9 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml @@ -41,7 +41,7 @@ - + - + diff --git a/app/code/Magento/Paypal/view/frontend/templates/billing/agreement/view.phtml b/app/code/Magento/Paypal/view/frontend/templates/billing/agreement/view.phtml index 85ffa6aa7d781..9bae2df213f33 100644 --- a/app/code/Magento/Paypal/view/frontend/templates/billing/agreement/view.phtml +++ b/app/code/Magento/Paypal/view/frontend/templates/billing/agreement/view.phtml @@ -23,83 +23,97 @@ */ ?> -
    -
    - escapeHtml($this->getReferenceId())) ?> - getCanCancel()): ?> - - -
    -
    -
    -
    -
    helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(false) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(true) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(false) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(true) ?>
    getRenderedBlock()->getItemHtml($_item) ?> - getUnitPriceExclTaxHtml($_item); ?> + + getRenderedBlock()->getItemHtml($_item) ?> - getUnitPriceInclTaxHtml($_item); ?> + + + helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + + getUnitPriceInclTaxHtml($_item); ?> + + + + + helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + + getUnitPriceExclTaxHtml($_item); ?> + + + getQty()*1 ?>getQty()*1 ?> + + helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + + getRowTotalInclTaxHtml($_item); ?> + + + + helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - getRowTotalExclTaxHtml($_item); ?> - - getRowTotalInclTaxHtml($_item); ?> +
    - - - - - - - getAgreementUpdatedAt()): ?> - - - - - - +
    +
    + escapeHtml($this->getReferenceId())) ?> + getCanCancel()): ?> + + +
    +
    +
    +
    +
    + + + + + + + getAgreementUpdatedAt()): ?> + + + + + + - - - - getAgreementUpdatedAt()): ?> - + + + + getAgreementUpdatedAt()): ?> + - + - -
    escapeHtml($this->getReferenceId()); ?>getAgreementStatus() ?>escapeHtml($this->getAgreementCreatedAt()) ?>escapeHtml($this->getAgreementUpdatedAt()); ?>escapeHtml($this->getReferenceId()); ?>getAgreementStatus() ?>escapeHtml($this->getAgreementCreatedAt()) ?>escapeHtml($this->getAgreementUpdatedAt()); ?> getPaymentMethodTitle() ?>getPaymentMethodTitle() ?>
    + + +
    - getRelatedOrders() ?> - 0): ?> - getChildHtml('pager'); ?> -

    - + getRelatedOrders() ?> + 0): ?> +
    + getChildHtml('pager'); ?> +
    +
    +
    - +
    + -
    -
    - -
    +
    +
    +
    -
    diff --git a/app/code/Magento/Paypal/view/frontend/templates/billing/agreements.phtml b/app/code/Magento/Paypal/view/frontend/templates/billing/agreements.phtml index 84b1ff4917ac5..c6fe52b7e8ded 100644 --- a/app/code/Magento/Paypal/view/frontend/templates/billing/agreements.phtml +++ b/app/code/Magento/Paypal/view/frontend/templates/billing/agreements.phtml @@ -49,7 +49,7 @@ getItemValue($item, 'updated_at') ?> getItemValue($item, 'payment_method_label') ?> - + diff --git a/app/code/Magento/Paypal/view/frontend/templates/express/review.phtml b/app/code/Magento/Paypal/view/frontend/templates/express/review.phtml index 5dd89e3a0af27..6685cd820bbc8 100644 --- a/app/code/Magento/Paypal/view/frontend/templates/express/review.phtml +++ b/app/code/Magento/Paypal/view/frontend/templates/express/review.phtml @@ -27,29 +27,13 @@

    -
    - getShippingAddress()): ?> -
    -
    -
    -
    - - - getCanEditShippingAddress()): ?> - - - - -
    -
    renderAddress($this->getShippingAddress()) ?>
    -
    -
    - -
    - - -
    +
    +
    +
    + getShippingAddress()): ?> +
    + +
    @@ -76,9 +60,12 @@
    -
    - +
    +
    + +

    @@ -89,45 +76,55 @@
    -
    -
    - - -
    -
    -
    -
    - - - getEditUrl()): ?> - - - -
    +
    + +
    +
    renderAddress($this->getShippingAddress()) ?>
    +
    + getCanEditShippingAddress()): ?> +
    + +
    + +
    + +
    + +
    escapeHtml($this->getPaymentMethodTitle()) ?>
    + getEditUrl()): ?> +
    + + + +
    +
    -
    -
    +
    +
    -
    +
    getChildHtml('details') ?>
    getChildHtml('agreements'); ?> -
    - - +
    +
    + + +
    diff --git a/app/code/Magento/Paypal/view/frontend/templates/express/review/details.phtml b/app/code/Magento/Paypal/view/frontend/templates/express/review/details.phtml index 682ff50e12581..2d28f474647c3 100644 --- a/app/code/Magento/Paypal/view/frontend/templates/express/review/details.phtml +++ b/app/code/Magento/Paypal/view/frontend/templates/express/review/details.phtml @@ -26,25 +26,19 @@ * @see \Magento\Paypal\Block\Express\Review\Details */ ?> - - helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?> +
    + - - - - + + + + - helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - - - - - - - getChildHtml('totals'); ?> + + getChildHtml('totals'); ?> + getItems() as $_item): ?> getItemHtml($_item) ?> diff --git a/app/code/Magento/Paypal/view/frontend/templates/express/review/shipping/method.phtml b/app/code/Magento/Paypal/view/frontend/templates/express/review/shipping/method.phtml index f99953d4aa4e2..1f5a98a2fa97d 100644 --- a/app/code/Magento/Paypal/view/frontend/templates/express/review/shipping/method.phtml +++ b/app/code/Magento/Paypal/view/frontend/templates/express/review/shipping/method.phtml @@ -50,6 +50,6 @@

    renderShippingRateOption($this->getCurrentShippingRate()) ?>

    -
    helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(false) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(true) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(false) ?>helper('Magento\Tax\Helper\Data')->getIncExcTaxLabel(true) ?>
    ' . - '' . - '
    ' . - $product->getDescription(); - - if ($product->getAllowedPriceInRss()) { - $description .= $this->renderPriceHtml($product, true); - } - - $description .= '
    '; - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $args['rssObj']; - $data = array( - 'title' => $product->getName(), - 'link' => $product->getProductUrl(), - 'description' => $description - ); - - $rssObj->_addEntry($data); - } -} diff --git a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php deleted file mode 100644 index 1ef4d9d0f91d6..0000000000000 --- a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php +++ /dev/null @@ -1,236 +0,0 @@ -_imageHelper = $imageHelper; - $this->_rssFactory = $rssFactory; - $this->_productFactory = $productFactory; - $this->_visibility = $visibility; - $this->_resourceIterator = $resourceIterator; - parent::__construct($context, $httpContext, $catalogData, $data); - } - - /** - * @return string - */ - protected function _toHtml() - { - $storeId = $this->_getStoreId(); - $storeModel = $this->_storeManager->getStore($storeId); - $newUrl = $this->_urlBuilder->getUrl('rss/catalog/new/store_id/' . $storeId); - $title = __('New Products from %1', $storeModel->getFrontendName()); - $lang = $this->_scopeConfig->getValue( - 'general/locale/code', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeModel - ); - - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $this->_rssFactory->create(); - $rssObj->_addHeader( - array( - 'title' => $title, - 'description' => $title, - 'link' => $newUrl, - 'charset' => 'UTF-8', - 'language' => $lang - ) - ); - - /** @var $product \Magento\Catalog\Model\Product */ - $product = $this->_productFactory->create(); - $todayStartOfDayDate = $this->_localeDate->date()->setTime( - '00:00:00' - )->toString( - \Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT - ); - - $todayEndOfDayDate = $this->_localeDate->date()->setTime( - '23:59:59' - )->toString( - \Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT - ); - - /** @var $products \Magento\Catalog\Model\Resource\Product\Collection */ - $products = $product->getCollection(); - $products->setStoreId($storeId); - $products->addStoreFilter()->addAttributeToFilter( - 'news_from_date', - array( - 'or' => array( - 0 => array('date' => true, 'to' => $todayEndOfDayDate), - 1 => array('is' => new \Zend_Db_Expr('null')) - ) - ), - 'left' - )->addAttributeToFilter( - 'news_to_date', - array( - 'or' => array( - 0 => array('date' => true, 'from' => $todayStartOfDayDate), - 1 => array('is' => new \Zend_Db_Expr('null')) - ) - ), - 'left' - )->addAttributeToFilter( - array( - array('attribute' => 'news_from_date', 'is' => new \Zend_Db_Expr('not null')), - array('attribute' => 'news_to_date', 'is' => new \Zend_Db_Expr('not null')) - ) - )->addAttributeToSort( - 'news_from_date', - 'desc' - )->addAttributeToSelect( - array('name', 'short_description', 'description'), - 'inner' - )->addAttributeToSelect( - array( - 'price', - 'special_price', - 'special_from_date', - 'special_to_date', - 'msrp_enabled', - 'msrp_display_actual_price_type', - 'msrp', - 'thumbnail' - ), - 'left' - )->applyFrontendPriceLimitations(); - $products->setVisibility($this->_visibility->getVisibleInCatalogIds()); - - /* - using resource iterator to load the data one by one - instead of loading all at the same time. loading all data at the same time can cause the big memory allocation. - */ - $this->_resourceIterator->walk( - $products->getSelect(), - array(array($this, 'addNewItemXmlCallback')), - array('rssObj' => $rssObj, 'product' => $product) - ); - - return $rssObj->createRssXml(); - } - - /** - * Preparing data and adding to rss object - * - * @param array $args - * @return void - */ - public function addNewItemXmlCallback($args) - { - /** @var $product \Magento\Catalog\Model\Product */ - $product = $args['product']; - $product->setAllowedInRss(true); - $product->setAllowedPriceInRss(true); - $this->_eventManager->dispatch('rss_catalog_new_xml_callback', $args); - - if (!$product->getAllowedInRss()) { - //Skip adding product to RSS - return; - } - - $allowedPriceInRss = $product->getAllowedPriceInRss(); - //$product->unsetData()->load($args['row']['entity_id']); - $product->setData($args['row']); - $description = '' . - '' . - '' . '
    ' . - $product->getDescription(); - - if ($allowedPriceInRss) { - $description .= $this->renderPriceHtml($product, true); - } - - $description .= '
    '; - - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $args['rssObj']; - $rssObj->_addEntry( - array('title' => $product->getName(), 'link' => $product->getProductUrl(), 'description' => $description) - ); - } -} diff --git a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php deleted file mode 100644 index e715156ccf481..0000000000000 --- a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php +++ /dev/null @@ -1,159 +0,0 @@ -_rssFactory = $rssFactory; - $this->_productFactory = $productFactory; - $this->_stockFactory = $stockFactory; - $this->_productStatus = $productStatus; - $this->_resourceIterator = $resourceIterator; - parent::__construct($context, $data); - } - - /** - * Render RSS - * - * @return string - */ - protected function _toHtml() - { - $newUrl = $this->getUrl('rss/catalog/notifystock', array('_secure' => true, '_nosecret' => true)); - $title = __('Low Stock Products'); - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $this->_rssFactory->create(); - $rssObj->_addHeader( - array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8') - ); - - $globalNotifyStockQty = (double)$this->_scopeConfig->getValue( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_NOTIFY_STOCK_QTY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); - /* @var $product \Magento\Catalog\Model\Product */ - $product = $this->_productFactory->create(); - /* @var $collection \Magento\Catalog\Model\Resource\Product\Collection */ - $collection = $product->getCollection(); - /** @var $resourceStock \Magento\CatalogInventory\Model\Resource\Stock */ - $resourceStock = $this->_stockFactory->create(); - $resourceStock->addLowStockFilter( - $collection, - array('qty', 'notify_stock_qty', 'low_stock_date', 'use_config' => 'use_config_notify_stock_qty') - ); - $collection->addAttributeToSelect( - 'name', - true - )->addAttributeToFilter( - 'status', - array('in' => $this->_productStatus->getVisibleStatusIds()) - )->setOrder( - 'low_stock_date' - ); - $this->_eventManager->dispatch( - 'rss_catalog_notify_stock_collection_select', - array('collection' => $collection) - ); - - /* - using resource iterator to load the data one by one - instead of loading all at the same time. loading all data at the same time can cause the big memory allocation. - */ - $this->_resourceIterator->walk( - $collection->getSelect(), - array(array($this, 'addNotifyItemXmlCallback')), - array('rssObj' => $rssObj, 'product' => $product, 'globalQty' => $globalNotifyStockQty) - ); - - return $rssObj->createRssXml(); - } - - /** - * Adds single product to feed - * - * @param array $args - * @return void - */ - public function addNotifyItemXmlCallback($args) - { - /* @var $product \Magento\Catalog\Model\Product */ - $product = $args['product']; - $product->setData($args['row']); - $url = $this->getUrl( - 'catalog/product/edit', - array('id' => $product->getId(), '_secure' => true, '_nosecret' => true) - ); - $qty = 1 * $product->getQty(); - $description = __('%1 has reached a quantity of %2.', $product->getName(), $qty); - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $args['rssObj']; - $rssObj->_addEntry(array('title' => $product->getName(), 'link' => $url, 'description' => $description)); - } -} diff --git a/app/code/Magento/Rss/Block/Catalog/Review.php b/app/code/Magento/Rss/Block/Catalog/Review.php deleted file mode 100644 index 0204ebbd3e51e..0000000000000 --- a/app/code/Magento/Rss/Block/Catalog/Review.php +++ /dev/null @@ -1,139 +0,0 @@ -_rssFactory = $rssFactory; - $this->_resourceIterator = $resourceIterator; - $this->_reviewFactory = $reviewFactory; - $this->_storeManager = $storeManager; - parent::__construct($context, $data); - } - - /** - * Render XML response - * - * @return string - */ - protected function _toHtml() - { - $newUrl = $this->getUrl('rss/catalog/review', array('_secure' => true, '_nosecret' => true)); - $title = __('Pending product review(s)'); - - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $this->_rssFactory->create(); - $rssObj->_addHeader( - array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8') - ); - - /** @var $reviewModel \Magento\Review\Model\Review */ - $reviewModel = $this->_reviewFactory->create(); - $collection = $reviewModel->getProductCollection() - ->addStatusFilter($reviewModel->getPendingStatus()) - ->addAttributeToSelect('name', 'inner') - ->setDateOrder(); - - $this->_eventManager->dispatch('rss_catalog_review_collection_select', array('collection' => $collection)); - - $this->_resourceIterator->walk( - $collection->getSelect(), - array(array($this, 'addReviewItemXmlCallback')), - array('rssObj' => $rssObj, 'reviewModel' => $reviewModel) - ); - return $rssObj->createRssXml(); - } - - /** - * Format single RSS element - * - * @param array $args - * @return void - */ - public function addReviewItemXmlCallback($args) - { - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $args['rssObj']; - $row = $args['row']; - /** @var \Magento\Review\Model\Review $reviewModel */ - $reviewModel = $args['reviewModel']; - $productUrl = $reviewModel->getProductUrl($row['entity_id'], $row['store_id']); - $reviewUrl = $this->getUrl( - 'review/product/edit/', - array('id' => $row['review_id'], '_secure' => true, '_nosecret' => true) - ); - $storeName = $this->_storeManager->getStore($row['store_id'])->getName(); - $description = '

    ' . __('Product: %2
    ', $productUrl, $row['name']) - . __('Summary of review: %1
    ', $row['title']) . __('Review: %1
    ', $row['detail']) - . __('Store: %1
    ', $storeName) - . __('Click here to view the review.', $reviewUrl) - . '

    '; - $rssObj->_addEntry( - array( - 'title' => __('Product: "%1" reviewed by: %2', $row['name'], $row['nickname']), - 'link' => 'test', - 'description' => $description - ) - ); - } -} diff --git a/app/code/Magento/Rss/Block/Catalog/Salesrule.php b/app/code/Magento/Rss/Block/Catalog/Salesrule.php deleted file mode 100644 index 908c9f4132725..0000000000000 --- a/app/code/Magento/Rss/Block/Catalog/Salesrule.php +++ /dev/null @@ -1,141 +0,0 @@ -_rssFactory = $rssFactory; - $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $httpContext, $data); - } - - /** - * @return void - */ - protected function _construct() - { - /* - * setting cache to save the rss for 10 minutes - */ - $this->setCacheKey('rss_catalog_salesrule_' . $this->getStoreId() . '_' . $this->_getCustomerGroupId()); - $this->setCacheLifetime(600); - } - - /** - * Generate RSS XML with sales rules data - * - * @return string - */ - protected function _toHtml() - { - $storeId = $this->_getStoreId(); - $storeModel = $this->_storeManager->getStore($storeId); - $websiteId = $storeModel->getWebsiteId(); - $customerGroup = $this->_getCustomerGroupId(); - $now = date('Y-m-d'); - $url = $this->_urlBuilder->getUrl(''); - $newUrl = $this->_urlBuilder->getUrl('rss/catalog/salesrule'); - $title = __('%1 - Discounts and Coupons', $storeModel->getName()); - $lang = $this->_scopeConfig->getValue( - 'general/locale/code', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeModel - ); - - /** @var $rssObject \Magento\Rss\Model\Rss */ - $rssObject = $this->_rssFactory->create(); - $rssObject->_addHeader( - array( - 'title' => $title, - 'description' => $title, - 'link' => $newUrl, - 'charset' => 'UTF-8', - 'language' => $lang - ) - ); - - /** @var $collection \Magento\SalesRule\Model\Resource\Rule\Collection */ - $collection = $this->_collectionFactory->create(); - $collection->addWebsiteGroupDateFilter( - $websiteId, - $customerGroup, - $now - )->addFieldToFilter( - 'is_rss', - 1 - )->setOrder( - 'from_date', - 'desc' - ); - $collection->load(); - - /** @var $ruleModel \Magento\SalesRule\Model\Rule */ - foreach ($collection as $ruleModel) { - $description = '' . '
    ' . $ruleModel->getDescription() - . '
    Discount Start Date: ' . $this->formatDate( - $ruleModel->getFromDate(), - 'medium' - ); - if ($ruleModel->getToDate()) { - $description .= '
    Discount End Date: ' . $this->formatDate($ruleModel->getToDate(), 'medium'); - } - if ($ruleModel->getCouponCode()) { - $description .= '
    Coupon Code: ' . $ruleModel->getCouponCode(); - } - $description .= '
    '; - $rssObject->_addEntry( - array('title' => $ruleModel->getName(), 'description' => $description, 'link' => $url) - ); - } - - return $rssObject->createRssXml(); - } -} diff --git a/app/code/Magento/Rss/Block/Catalog/Special.php b/app/code/Magento/Rss/Block/Catalog/Special.php deleted file mode 100644 index 2d72367244782..0000000000000 --- a/app/code/Magento/Rss/Block/Catalog/Special.php +++ /dev/null @@ -1,277 +0,0 @@ -_outputHelper = $outputHelper; - $this->_imageHelper = $imageHelper; - $this->_priceCurrency = $priceCurrency; - $this->_productFactory = $productFactory; - $this->_rssFactory = $rssFactory; - $this->_resourceIterator = $resourceIterator; - parent::__construct($context, $httpContext, $catalogData, $data); - } - - /** - * @return void - */ - protected function _construct() - { - /* - * setting cache to save the rss for 10 minutes - */ - $this->setCacheKey('rss_catalog_special_' . $this->_getStoreId() . '_' . $this->_getCustomerGroupId()); - $this->setCacheLifetime(600); - } - - /** - * @return string - */ - protected function _toHtml() - { - //store id is store view id - $storeId = $this->_getStoreId(); - $websiteId = $this->_storeManager->getStore($storeId)->getWebsiteId(); - - //customer group id - $customerGroupId = $this->_getCustomerGroupId(); - - /** @var $product \Magento\Catalog\Model\Product */ - $product = $this->_productFactory->create(); - $product->setStoreId($storeId); - $specials = $product->getResourceCollection()->addPriceDataFieldFilter( - '%s < %s', - array('final_price', 'price') - )->addPriceData( - $customerGroupId, - $websiteId - )->addAttributeToSelect( - array( - 'name', - 'short_description', - 'description', - 'price', - 'thumbnail', - 'special_price', - 'special_to_date', - 'msrp_enabled', - 'msrp_display_actual_price_type', - 'msrp' - ), - 'left' - )->addAttributeToSort( - 'name', - 'asc' - ); - - $newUrl = $this->_urlBuilder->getUrl('rss/catalog/special/store_id/' . $storeId); - $title = __('%1 - Special Products', $this->_storeManager->getStore()->getFrontendName()); - $lang = $this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $this->_rssFactory->create(); - $rssObj->_addHeader( - array( - 'title' => $title, - 'description' => $title, - 'link' => $newUrl, - 'charset' => 'UTF-8', - 'language' => $lang - ) - ); - - $results = array(); - /* - using resource iterator to load the data one by one - instead of loading all at the same time. loading all data at the same time can cause the big memory allocation. - */ - $this->_resourceIterator->walk( - $specials->getSelect(), - array(array($this, 'addSpecialXmlCallback')), - array('rssObj' => $rssObj, 'results' => &$results) - ); - - if (sizeof($results) > 0) { - foreach ($results as $result) { - // render a row for RSS feed - $product->setData($result); - $html = sprintf( - '' . - '' . - '
    %s', - $product->getProductUrl(), - $this->_imageHelper->init($product, 'thumbnail')->resize(75, 75), - $this->_outputHelper->productAttribute($product, $product->getDescription(), 'description') - ); - - // add price data if needed - if ($product->getAllowedPriceInRss()) { - if ($this->_catalogData->canApplyMsrp($product)) { - $html .= '
    ' . __('Click for price') . ''; - } else { - $special = ''; - if ($result['use_special']) { - $special = '
    ' . __( - 'Special Expires On: %1', - $this->formatDate( - $result['special_to_date'], - \Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM - ) - ); - } - $html .= sprintf( - '

    %s %s%s

    ', - __('Price: %1', $this->_priceCurrency->convertAndFormat($result['price'])), - __('Special Price: %1', $this->_priceCurrency->convertAndFormat($result['final_price'])), - $special - ); - } - } - - $html .= '
    '; - - $rssObj->_addEntry( - array('title' => $product->getName(), 'link' => $product->getProductUrl(), 'description' => $html) - ); - } - } - return $rssObj->createRssXml(); - } - - /** - * Preparing data and adding to rss object - * - * @param array $args - * @return void - */ - public function addSpecialXmlCallback($args) - { - if (!isset(self::$_currentDate)) { - self::$_currentDate = new \Magento\Framework\Stdlib\DateTime\Date(); - } - - // dispatch event to determine whether the product will eventually get to the result - $product = new \Magento\Framework\Object(array('allowed_in_rss' => true, 'allowed_price_in_rss' => true)); - $args['product'] = $product; - $this->_eventManager->dispatch('rss_catalog_special_xml_callback', $args); - if (!$product->getAllowedInRss()) { - return; - } - - // add row to result and determine whether special price is active (less or equal to the final price) - $row = $args['row']; - $row['use_special'] = false; - $row['allowed_price_in_rss'] = $product->getAllowedPriceInRss(); - if (isset( - $row['special_to_date'] - ) && $row['final_price'] <= $row['special_price'] && $row['allowed_price_in_rss'] - ) { - $compareDate = self::$_currentDate->compareDate( - $row['special_to_date'], - \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT - ); - if (-1 === $compareDate || 0 === $compareDate) { - $row['use_special'] = true; - } - } - - $args['results'][] = $row; - } - - /** - * Function for comparing two items in collection - * - * @param array $a - * @param array $b - * @return bool - */ - public function sortByStartDate($a, $b) - { - return $a['start_date'] > $b['start_date'] ? -1 : ($a['start_date'] < $b['start_date'] ? 1 : 0); - } -} diff --git a/app/code/Magento/Rss/Block/Feeds.php b/app/code/Magento/Rss/Block/Feeds.php new file mode 100644 index 0000000000000..15933a453e65e --- /dev/null +++ b/app/code/Magento/Rss/Block/Feeds.php @@ -0,0 +1,103 @@ +rssManager = $rssManager; + parent::__construct($context, $data); + } + + /** + * Add Link elements to head + * + * @return $this + */ + protected function _prepareLayout() + { + $head = $this->getLayout()->getBlock('head'); + $feeds = $this->getFeeds(); + if ($head && !empty($feeds)) { + foreach ($feeds as $feed) { + if (!isset($feed['group'])) { + $head->addRss($feed['label'], $feed['link']); + } else { + foreach ($feed['feeds'] as $item) { + $head->addRss($item['label'], $item['link']); + } + } + } + } + return parent::_prepareLayout(); + } + + /** + * @return array + */ + public function getFeeds() + { + $providers = $this->rssManager->getProviders(); + $feeds = array(); + $groups = array(); + foreach ($providers as $provider) { + $item = $provider->getFeeds(); + if (empty($item)) { + continue; + } + + if (isset($item['group'])) { + $groups[] = $item; + } else { + $feeds[] = $item; + } + } + $feeds = array_merge($feeds, $groups); + + return $feeds; + } +} diff --git a/app/code/Magento/Rss/Block/ListBlock.php b/app/code/Magento/Rss/Block/ListBlock.php deleted file mode 100644 index d488a9ee78b93..0000000000000 --- a/app/code/Magento/Rss/Block/ListBlock.php +++ /dev/null @@ -1,252 +0,0 @@ -httpContext = $httpContext; - $this->_categoryFactory = $categoryFactory; - parent::__construct($context, $data); - $this->_isScopePrivate = true; - } - - /** - * Add Link elements to head - * - * @return $this - */ - protected function _prepareLayout() - { - $head = $this->getLayout()->getBlock('head'); - $feeds = $this->getRssMiscFeeds(); - if ($head && !empty($feeds)) { - foreach ($feeds as $feed) { - $head->addRss($feed['label'], $feed['url']); - } - } - return parent::_prepareLayout(); - } - - /** - * Retrieve rss feeds - * - * @return bool|array - */ - public function getRssFeeds() - { - return empty($this->_rssFeeds) ? false : $this->_rssFeeds; - } - - /** - * Add new rss feed - * - * @param string $url - * @param string $label - * @param array $param - * @param bool $customerGroup - * @return $this - */ - public function addRssFeed($url, $label, $param = array(), $customerGroup = false) - { - $param = array_merge($param, array('store_id' => $this->getCurrentStoreId())); - if ($customerGroup) { - $param = array_merge($param, array('cid' => $this->getCurrentCustomerGroupId())); - } - $this->_rssFeeds[] = new \Magento\Framework\Object( - array('url' => $this->_urlBuilder->getUrl($url, $param), 'label' => $label) - ); - return $this; - } - - /** - * Rest rss feed - * - * @return void - */ - public function resetRssFeed() - { - $this->_rssFeeds = array(); - } - - /** - * Get current store id - * - * @return int - */ - public function getCurrentStoreId() - { - return $this->_storeManager->getStore()->getId(); - } - - /** - * Get current customer group id - * - * @return int - */ - public function getCurrentCustomerGroupId() - { - return $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_GROUP); - } - - /** - * Retrieve rss catalog feeds - * - * array structure: - * - * @return array - */ - public function getRssCatalogFeeds() - { - $this->resetRssFeed(); - $this->categoriesRssFeed(); - return $this->getRssFeeds(); - } - - /** - * Get rss misc feeds - * - * @return array|bool - */ - public function getRssMiscFeeds() - { - $this->resetRssFeed(); - $this->newProductRssFeed(); - $this->specialProductRssFeed(); - $this->salesRuleProductRssFeed(); - return $this->getRssFeeds(); - } - - /** - * New product rss feed - * - * @return void - */ - public function newProductRssFeed() - { - $path = self::XML_PATH_RSS_METHODS . '/catalog/new'; - if ((bool)$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { - $this->addRssFeed($path, __('New Products')); - } - } - - /** - * Special product rss feed - * - * @return void - */ - public function specialProductRssFeed() - { - $path = self::XML_PATH_RSS_METHODS . '/catalog/special'; - if ((bool)$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { - $this->addRssFeed($path, __('Special Products'), array(), true); - } - } - - /** - * Sales rule product rss feed - * - * @return void - */ - public function salesRuleProductRssFeed() - { - $path = self::XML_PATH_RSS_METHODS . '/catalog/salesrule'; - if ((bool)$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { - $this->addRssFeed($path, __('Coupons/Discounts'), array(), true); - } - } - - /** - * Categories rss feed - * - * @return void - */ - public function categoriesRssFeed() - { - $path = self::XML_PATH_RSS_METHODS . '/catalog/category'; - if ((bool)$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { - /** @var $category \Magento\Catalog\Model\Category */ - $category = $this->_categoryFactory->create(); - $treeModel = $category->getTreeModel()->loadNode($this->_storeManager->getStore()->getRootCategoryId()); - $nodes = $treeModel->loadChildren()->getChildren(); - - $nodeIds = array(); - foreach ($nodes as $node) { - $nodeIds[] = $node->getId(); - } - - /* @var $collection \Magento\Catalog\Model\Resource\Category\Collection */ - $collection = $category->getCollection(); - $collection->addIdFilter( - $nodeIds - )->addAttributeToSelect( - 'url_key' - )->addAttributeToSelect( - 'name' - )->addAttributeToSelect( - 'is_anchor' - )->addAttributeToFilter( - 'is_active', - 1 - )->addAttributeToSort( - 'name' - )->load(); - - foreach ($collection as $category) { - $this->addRssFeed('rss/catalog/category', $category->getName(), array('cid' => $category->getId())); - } - } - } -} diff --git a/app/code/Magento/Rss/Block/Order/NewOrder.php b/app/code/Magento/Rss/Block/Order/NewOrder.php deleted file mode 100644 index 9d5ea8bd4b552..0000000000000 --- a/app/code/Magento/Rss/Block/Order/NewOrder.php +++ /dev/null @@ -1,138 +0,0 @@ -_rssFactory = $rssFactory; - $this->_orderFactory = $orderFactory; - $this->_resourceIterator = $resourceIterator; - $this->_dateTime = $dateTime; - parent::__construct($context, $data); - } - - /** - * @return string - */ - protected function _toHtml() - { - /** @var $order \Magento\Sales\Model\Order */ - $order = $this->_orderFactory->create(); - $passDate = $this->_dateTime->formatDate(mktime(0, 0, 0, date('m'), date('d') - 7)); - $newUrl = $this->getUrl('rss/order/new', array('_secure' => true, '_nosecret' => true)); - $title = __('New Orders'); - - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $this->_rssFactory->create(); - $rssObj->_addHeader( - array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8') - ); - - /** @var $collection \Magento\Sales\Model\Resource\Order\Collection */ - $collection = $order->getCollection(); - $collection->addAttributeToFilter( - 'created_at', - array('date' => true, 'from' => $passDate) - )->addAttributeToSort( - 'created_at', - 'desc' - ); - - $detailBlock = $this->_layout->getBlockSingleton('Magento\Rss\Block\Order\Details'); - $this->_eventManager->dispatch('rss_order_new_collection_select', array('collection' => $collection)); - $this->_resourceIterator->walk( - $collection->getSelect(), - array(array($this, 'addNewOrderXmlCallback')), - array('rssObj' => $rssObj, 'order' => $order, 'detailBlock' => $detailBlock) - ); - return $rssObj->createRssXml(); - } - - /** - * @param array $args - * @return void - */ - public function addNewOrderXmlCallback($args) - { - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $args['rssObj']; - /** @var $order \Magento\Sales\Model\Order */ - $order = $args['order']; - /** @var $detailBlock \Magento\Rss\Block\Order\Details */ - $detailBlock = $args['detailBlock']; - $order->reset()->load($args['row']['entity_id']); - if ($order && $order->getId()) { - $title = __( - 'Order #%1 created at %2', - $order->getIncrementId(), - $this->formatDate($order->getCreatedAt()) - ); - $url = $this->getUrl( - 'sales/order/view', - array('_secure' => true, 'order_id' => $order->getId(), '_nosecret' => true) - ); - $detailBlock->setOrder($order); - $rssObj->_addEntry(array('title' => $title, 'link' => $url, 'description' => $detailBlock->toHtml())); - } - } -} diff --git a/app/code/Magento/Rss/Block/Order/Status.php b/app/code/Magento/Rss/Block/Order/Status.php deleted file mode 100644 index d6db2c12030b3..0000000000000 --- a/app/code/Magento/Rss/Block/Order/Status.php +++ /dev/null @@ -1,131 +0,0 @@ -_coreRegistry = $registry; - $this->_rssFactory = $rssFactory; - $this->_orderFactory = $orderFactory; - parent::__construct($context, $data); - } - - /** - * @return void - */ - protected function _construct() - { - /* - * setting cache to save the rss for 10 minutes - */ - $this->setCacheKey('rss_order_status_' . $this->getRequest()->getParam('data')); - $this->setCacheLifetime(600); - } - - /** - * @return string - */ - protected function _toHtml() - { - /** @var $rssObj \Magento\Rss\Model\Rss */ - $rssObj = $this->_rssFactory->create(); - $order = $this->_coreRegistry->registry('current_order'); - if (!$order) { - return ''; - } - $title = __('Order # %1 Notification(s)', $order->getIncrementId()); - $newUrl = $this->_urlBuilder->getUrl('sales/order/view', array('order_id' => $order->getId())); - $rssObj->_addHeader( - array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8') - ); - /** @var $resourceModel \Magento\Rss\Model\Resource\Order */ - $resourceModel = $this->_orderFactory->create(); - $results = $resourceModel->getAllCommentCollection($order->getId()); - if ($results) { - foreach ($results as $result) { - $urlAppend = 'view'; - $type = $result['entity_type_code']; - if ($type && $type != 'order') { - $urlAppend = $type; - } - $type = __(ucwords($type)); - $title = __('Details for %1 #%2', $type, $result['increment_id']); - $description = '

    ' . __( - 'Notified Date: %1
    ', - $this->formatDate($result['created_at']) - ) . __( - 'Comment: %1
    ', - $result['comment'] - ) . '

    '; - $url = $this->_urlBuilder->getUrl('sales/order/' . $urlAppend, array('order_id' => $order->getId())); - $rssObj->_addEntry(array('title' => $title, 'link' => $url, 'description' => $description)); - } - } - $title = __('Order #%1 created at %2', $order->getIncrementId(), $this->formatDate($order->getCreatedAt())); - $url = $this->_urlBuilder->getUrl('sales/order/view', array('order_id' => $order->getId())); - $description = '

    ' . __( - 'Current Status: %1
    ', - $order->getStatusLabel() - ) . __( - 'Total: %1
    ', - $order->formatPrice($order->getGrandTotal()) - ) . '

    '; - $rssObj->_addEntry(array('title' => $title, 'link' => $url, 'description' => $description)); - return $rssObj->createRssXml(); - } -} diff --git a/app/code/Magento/Rss/Controller/Adminhtml/Feed.php b/app/code/Magento/Rss/Controller/Adminhtml/Feed.php new file mode 100644 index 0000000000000..f7b52bc2f5ac5 --- /dev/null +++ b/app/code/Magento/Rss/Controller/Adminhtml/Feed.php @@ -0,0 +1,65 @@ +_objectManager->get('Magento\Backend\Model\UrlInterface')->turnOffSecretKey(); + $this->rssManager = $rssManager; + $this->scopeConfig = $scopeConfig; + $this->rssFactory = $rssFactory; + } +} diff --git a/app/code/Magento/Rss/Controller/Adminhtml/Catalog/Review.php b/app/code/Magento/Rss/Controller/Adminhtml/Feed/Index.php similarity index 52% rename from app/code/Magento/Rss/Controller/Adminhtml/Catalog/Review.php rename to app/code/Magento/Rss/Controller/Adminhtml/Feed/Index.php index 1fadb7035ffdd..e9491cc3c315f 100644 --- a/app/code/Magento/Rss/Controller/Adminhtml/Catalog/Review.php +++ b/app/code/Magento/Rss/Controller/Adminhtml/Feed/Index.php @@ -22,19 +22,44 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rss\Controller\Adminhtml\Catalog; +namespace Magento\Rss\Controller\Adminhtml\Feed; -class Review extends \Magento\Rss\Controller\Adminhtml\Authenticate +use \Magento\Framework\App\Action\NotFoundException; + +/** + * Class Index + * @package Magento\Rss\Controller\Feed + */ +class Index extends \Magento\Rss\Controller\Adminhtml\Feed { /** - * Review action + * Index action * * @return void + * @throws NotFoundException */ public function execute() { + if (!$this->scopeConfig->getValue('rss/config/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { + throw new NotFoundException(); + } + + $type = $this->getRequest()->getParam('type'); + try { + $provider = $this->rssManager->getProvider($type); + } catch (\InvalidArgumentException $e) { + throw new NotFoundException($e->getMessage()); + } + + if (!$provider->isAllowed()) { + throw new NotFoundException(); + } + + /** @var $rss \Magento\Rss\Model\Rss */ + $rss = $this->rssFactory->create(); + $rss->setDataProvider($provider); + $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8'); - $this->_view->loadLayout(false); - $this->_view->renderLayout(); + $this->getResponse()->setBody($rss->createRssXml()); } } diff --git a/app/code/Magento/Rss/Controller/Adminhtml/Order/NewAction.php b/app/code/Magento/Rss/Controller/Adminhtml/Order/NewAction.php deleted file mode 100644 index 149b62f10148a..0000000000000 --- a/app/code/Magento/Rss/Controller/Adminhtml/Order/NewAction.php +++ /dev/null @@ -1,40 +0,0 @@ -getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8'); - $this->_view->loadLayout(false); - $this->_view->renderLayout(); - } -} diff --git a/app/code/Magento/Rss/Controller/Catalog.php b/app/code/Magento/Rss/Controller/Feed.php similarity index 55% rename from app/code/Magento/Rss/Controller/Catalog.php rename to app/code/Magento/Rss/Controller/Feed.php index a3dc1debe8ebb..b089d377f6bca 100644 --- a/app/code/Magento/Rss/Controller/Catalog.php +++ b/app/code/Magento/Rss/Controller/Feed.php @@ -24,62 +24,41 @@ namespace Magento\Rss\Controller; /** - * RSS Controller for Catalog feeds + * Class Feed + * @package Magento\Rss\Controller */ -class Catalog extends \Magento\Framework\App\Action\Action +class Feed extends \Magento\Framework\App\Action\Action { + /** + * @var \Magento\Rss\Model\RssManager + */ + protected $rssManager; + + /** + * @var \Magento\Rss\Model\RssFactory + */ + protected $rssFactory; + /** * @var \Magento\Framework\App\Config\ScopeConfigInterface */ - protected $_scopeConfig; + protected $scopeConfig; /** * @param \Magento\Framework\App\Action\Context $context + * @param \Magento\Rss\Model\RssManager $rssManager * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Rss\Model\RssFactory $rssFactory */ public function __construct( \Magento\Framework\App\Action\Context $context, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + \Magento\Rss\Model\RssManager $rssManager, + \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Rss\Model\RssFactory $rssFactory ) { - $this->_scopeConfig = $scopeConfig; + $this->rssManager = $rssManager; + $this->scopeConfig = $scopeConfig; + $this->rssFactory = $rssFactory; parent::__construct($context); } - - /** - * Render or forward to "no route" action if this type of RSS is disabled - * - * @param string $code - * @return void - */ - protected function _genericAction($code) - { - if ($this->_isEnabled($code)) { - $this->_render(); - } else { - $this->_forward('nofeed', 'index', 'rss'); - } - } - - /** - * Whether specified type of RSS is enabled - * - * @param string $code - * @return bool - */ - protected function _isEnabled($code) - { - return $this->_scopeConfig->isSetFlag("rss/catalog/{$code}", \Magento\Store\Model\ScopeInterface::SCOPE_STORE); - } - - /** - * Render as XML-document using layout handle without inheriting any other handles - * - * @return void - */ - protected function _render() - { - $this->getResponse()->setHeader('Content-Type', 'text/xml; charset=UTF-8'); - $this->_view->loadLayout(false); - $this->_view->renderLayout(); - } } diff --git a/app/code/Magento/Rss/Controller/Adminhtml/Catalog/Notifystock.php b/app/code/Magento/Rss/Controller/Feed/Index.php similarity index 53% rename from app/code/Magento/Rss/Controller/Adminhtml/Catalog/Notifystock.php rename to app/code/Magento/Rss/Controller/Feed/Index.php index e7abd7228b06a..9d75a3d85dc9d 100644 --- a/app/code/Magento/Rss/Controller/Adminhtml/Catalog/Notifystock.php +++ b/app/code/Magento/Rss/Controller/Feed/Index.php @@ -22,19 +22,44 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rss\Controller\Adminhtml\Catalog; +namespace Magento\Rss\Controller\Feed; -class Notifystock extends \Magento\Rss\Controller\Adminhtml\Authenticate +use \Magento\Framework\App\Action\NotFoundException; + +/** + * Class Index + * @package Magento\Rss\Controller\Feed + */ +class Index extends \Magento\Rss\Controller\Feed { /** - * Notify stock action + * Index action * * @return void + * @throws NotFoundException */ public function execute() { + if (!$this->scopeConfig->getValue('rss/config/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { + throw new NotFoundException(); + } + + $type = $this->getRequest()->getParam('type'); + try { + $provider = $this->rssManager->getProvider($type); + } catch (\InvalidArgumentException $e) { + throw new NotFoundException($e->getMessage()); + } + + if (!$provider->isAllowed()) { + throw new NotFoundException(); + } + + /** @var $rss \Magento\Rss\Model\Rss */ + $rss = $this->rssFactory->create(); + $rss->setDataProvider($provider); + $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8'); - $this->_view->loadLayout(false); - $this->_view->renderLayout(); + $this->getResponse()->setBody($rss->createRssXml()); } } diff --git a/app/code/Magento/Rss/Controller/Index.php b/app/code/Magento/Rss/Controller/Index.php index b232d3651fb76..546f3d73fa5b7 100644 --- a/app/code/Magento/Rss/Controller/Index.php +++ b/app/code/Magento/Rss/Controller/Index.php @@ -23,6 +23,10 @@ */ namespace Magento\Rss\Controller; +/** + * Class Index + * @package Magento\Rss\Controller + */ class Index extends \Magento\Framework\App\Action\Action { /** @@ -30,31 +34,15 @@ class Index extends \Magento\Framework\App\Action\Action */ protected $_scopeConfig; - /** - * @var \Magento\Rss\Helper\Data - */ - protected $_rssHelper; - - /** - * @var \Magento\Customer\Model\Session - */ - protected $_customerSession; - /** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Rss\Helper\Data $rssHelper - * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( \Magento\Framework\App\Action\Context $context, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Rss\Helper\Data $rssHelper, - \Magento\Customer\Model\Session $customerSession + \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig ) { $this->_scopeConfig = $scopeConfig; - $this->_rssHelper = $rssHelper; - $this->_customerSession = $customerSession; parent::__construct($context); } } diff --git a/app/code/Magento/Rss/Helper/Order.php b/app/code/Magento/Rss/Helper/Order.php deleted file mode 100644 index 8ad2bb23acf00..0000000000000 --- a/app/code/Magento/Rss/Helper/Order.php +++ /dev/null @@ -1,133 +0,0 @@ -_scopeConfig = $scopeConfig; - $this->_orderFactory = $orderFactory; - parent::__construct($context); - } - - /** - * Check whether status notification is allowed - * - * @return bool - */ - public function isStatusNotificationAllow() - { - if ($this->_scopeConfig->getValue('rss/order/status_notified', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { - return true; - } - return false; - } - - /** - * Retrieve order status history url - * - * @param \Magento\Sales\Model\Order $order - * @return string - */ - public function getStatusHistoryRssUrl($order) - { - return $this->_getUrl( - 'rss/order/status', - array('_secure' => true, '_query' => array('data' => $this->getStatusUrlKey($order))) - ); - } - - /** - * Retrieve order status url key - * - * @param \Magento\Sales\Model\Order $order - * @return string - */ - public function getStatusUrlKey($order) - { - $data = array( - 'order_id' => $order->getId(), - 'increment_id' => $order->getIncrementId(), - 'customer_id' => $order->getCustomerId() - ); - return base64_encode(json_encode($data)); - } - - /** - * Retrieve order instance by specified status url key - * - * @param string $key - * @return \Magento\Sales\Model\Order|null - */ - public function getOrderByStatusUrlKey($key) - { - $data = json_decode(base64_decode($key), true); - if (!is_array( - $data - ) || !isset( - $data['order_id'] - ) || !isset( - $data['increment_id'] - ) || !isset( - $data['customer_id'] - ) - ) { - return null; - } - - /** @var $order \Magento\Sales\Model\Order */ - $order = $this->_orderFactory->create(); - $order->load($data['order_id']); - if ($order->getId() && - $order->getIncrementId() == $data['increment_id'] && - $order->getCustomerId() == $data['customer_id'] - ) { - return $order; - } - - return null; - } -} diff --git a/app/code/Magento/Rss/Model/Rss.php b/app/code/Magento/Rss/Model/Rss.php index ddeba3753eaf2..9e1399521adc4 100644 --- a/app/code/Magento/Rss/Model/Rss.php +++ b/app/code/Magento/Rss/Model/Rss.php @@ -23,6 +23,8 @@ */ namespace Magento\Rss\Model; +use Magento\Framework\App\Rss\DataProviderInterface; + /** * Auth session model * @@ -31,50 +33,62 @@ class Rss { /** - * @var array + * @var DataProviderInterface */ - protected $_feedArray = array(); + protected $dataProvider; /** - * @param array $data - * @return $this - * @codeCoverageIgnore + * @var \Magento\Framework\App\CacheInterface */ - public function _addHeader($data = array()) - { - $this->_feedArray = $data; - return $this; - } + protected $cache; /** - * @param array $entries - * @return $this - * @codeCoverageIgnore + * @param \Magento\Framework\App\CacheInterface $cache */ - public function _addEntries($entries) + public function __construct(\Magento\Framework\App\CacheInterface $cache) { - $this->_feedArray['entries'] = $entries; - return $this; + $this->cache = $cache; } /** - * @param array $entry - * @return $this - * @codeCoverageIgnore + * @return array */ - public function _addEntry($entry) + public function getFeeds() { - $this->_feedArray['entries'][] = $entry; - return $this; + if (is_null($this->dataProvider)) { + return array(); + } + $cache = false; + if ($this->dataProvider->getCacheKey() && $this->dataProvider->getCacheLifetime()) { + $cache = $this->cache->load($this->dataProvider->getCacheKey()); + } + + if ($cache) { + return unserialize($cache); + } + + $data = $this->dataProvider->getRssData(); + + if ($this->dataProvider->getCacheKey() && $this->dataProvider->getCacheLifetime()) { + $this->cache->save( + serialize($data), + $this->dataProvider->getCacheKey(), + array('rss'), + $this->dataProvider->getCacheLifetime() + ); + } + + return $data; } /** - * @return array - * @codeCoverageIgnore + * @param DataProviderInterface $dataProvider + * @return $this */ - public function getFeedArray() + public function setDataProvider(DataProviderInterface $dataProvider) { - return $this->_feedArray; + $this->dataProvider = $dataProvider; + return $this; } /** @@ -82,11 +96,7 @@ public function getFeedArray() */ public function createRssXml() { - try { - $rssFeedFromArray = \Zend_Feed::importArray($this->getFeedArray(), 'rss'); - return $rssFeedFromArray->saveXML(); - } catch (\Exception $e) { - return __('Error in processing xml. %1', $e->getMessage()); - } + $rssFeedFromArray = \Zend_Feed::importArray($this->getFeeds(), 'rss'); + return $rssFeedFromArray->saveXML(); } } diff --git a/app/code/Magento/Rss/Model/RssManager.php b/app/code/Magento/Rss/Model/RssManager.php new file mode 100644 index 0000000000000..860884178c7ff --- /dev/null +++ b/app/code/Magento/Rss/Model/RssManager.php @@ -0,0 +1,90 @@ + + */ +class RssManager implements RssManagerInterface +{ + /** + * @var \Magento\Framework\App\Rss\DataProviderInterface[] + */ + protected $providers; + + /** + * @param \Magento\Framework\ObjectManager $objectManager + * @param array $dataProviders + */ + public function __construct(\Magento\Framework\ObjectManager $objectManager, array $dataProviders = array()) + { + $this->objectManager = $objectManager; + $this->providers = $dataProviders; + } + + /** + * Return Rss Data Provider by Rss Feed Id. + * + * @param string $type + * @return DataProviderInterface + * @throws \InvalidArgumentException + */ + public function getProvider($type) + { + if (!isset($this->providers[$type])) { + throw new \InvalidArgumentException('Unknown provider with type: ' . $type); + } + + $provider = $this->providers[$type]; + + if (is_string($provider)) { + $provider = $this->objectManager->get($provider); + } + + if (!$provider instanceof DataProviderInterface) { + throw new \InvalidArgumentException('Provider should implement DataProviderInterface'); + } + + $this->providers[$type] = $provider; + + return $this->providers[$type]; + } + + /** + * {@inheritdoc} + */ + public function getProviders() + { + $result = array(); + foreach (array_keys($this->providers) as $type) { + $result[] = $this->getProvider($type); + } + return $result; + } +} diff --git a/app/code/Magento/Rss/Model/UrlBuilder.php b/app/code/Magento/Rss/Model/UrlBuilder.php new file mode 100644 index 0000000000000..f1a6fb5da9d31 --- /dev/null +++ b/app/code/Magento/Rss/Model/UrlBuilder.php @@ -0,0 +1,68 @@ +urlBuilder = $urlBuilder; + $this->config = $scopeConfig; + } + + /** + * @param array $queryParams + * @return string + */ + public function getUrl(array $queryParams = array()) + { + if (!$this->config->getValue('rss/config/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { + return ''; + } + + return $this->urlBuilder->getUrl('rss/feed/index', $queryParams); + } +} diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json index cfe36e2b75e07..f4380ee4515bc 100644 --- a/app/code/Magento/Rss/composer.json +++ b/app/code/Magento/Rss/composer.json @@ -3,20 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-sales-rule": "0.1.0-alpha96", - "magento/module-review": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-gift-message": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Rss/etc/adminhtml/system.xml b/app/code/Magento/Rss/etc/adminhtml/system.xml index ec0fadeb971ae..a1c4b25f4fedb 100644 --- a/app/code/Magento/Rss/etc/adminhtml/system.xml +++ b/app/code/Magento/Rss/etc/adminhtml/system.xml @@ -37,32 +37,6 @@ Magento\Rss\Model\System\Config\Backend\Links - - - - - Magento\Backend\Model\Config\Source\Enabledisable - - - - Magento\Backend\Model\Config\Source\Enabledisable - - - - Magento\Backend\Model\Config\Source\Enabledisable - - - - Magento\Backend\Model\Config\Source\Enabledisable - - - - - - - Magento\Backend\Model\Config\Source\Enabledisable - -
    diff --git a/app/code/Magento/Index/etc/adminhtml/menu.xml b/app/code/Magento/Rss/etc/di.xml similarity index 76% rename from app/code/Magento/Index/etc/adminhtml/menu.xml rename to app/code/Magento/Rss/etc/di.xml index db158e3ffaa81..983eb527581c5 100644 --- a/app/code/Magento/Index/etc/adminhtml/menu.xml +++ b/app/code/Magento/Rss/etc/di.xml @@ -23,8 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - - + + + diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index d66af033852ce..81e93a9cbbf6f 100644 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -25,22 +25,9 @@ --> - - - - - - - - - - - - - diff --git a/app/code/Magento/Rss/view/frontend/layout/default.xml b/app/code/Magento/Rss/view/frontend/layout/default.xml index 7774ecf6e37e5..518aa72b134bb 100644 --- a/app/code/Magento/Rss/view/frontend/layout/default.xml +++ b/app/code/Magento/Rss/view/frontend/layout/default.xml @@ -32,8 +32,5 @@ - - - - + diff --git a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_category.xml b/app/code/Magento/Rss/view/frontend/layout/rss_catalog_category.xml deleted file mode 100644 index 0d7a43a7776ea..0000000000000 --- a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_category.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - catalog_product_prices - - - - - diff --git a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_new.xml b/app/code/Magento/Rss/view/frontend/layout/rss_catalog_new.xml deleted file mode 100644 index 4be11a90b5c7e..0000000000000 --- a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_new.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - catalog_product_prices - - - - - - diff --git a/app/code/Magento/Rss/view/frontend/layout/rss_index_index.xml b/app/code/Magento/Rss/view/frontend/layout/rss_index_index.xml index 61423c030fe9a..a0f91e6bc78b2 100644 --- a/app/code/Magento/Rss/view/frontend/layout/rss_index_index.xml +++ b/app/code/Magento/Rss/view/frontend/layout/rss_index_index.xml @@ -30,6 +30,6 @@ - + diff --git a/app/code/Magento/Rss/view/frontend/templates/feeds.phtml b/app/code/Magento/Rss/view/frontend/templates/feeds.phtml new file mode 100644 index 0000000000000..45b2bda318aaa --- /dev/null +++ b/app/code/Magento/Rss/view/frontend/templates/feeds.phtml @@ -0,0 +1,49 @@ + + + + + getFeeds() as $feed): ?> + + + + + + + + + + + + + + + + +
    + +
    + +
    diff --git a/app/code/Magento/Rss/view/frontend/templates/list.phtml b/app/code/Magento/Rss/view/frontend/templates/list.phtml deleted file mode 100644 index 7ecf666c38aa3..0000000000000 --- a/app/code/Magento/Rss/view/frontend/templates/list.phtml +++ /dev/null @@ -1,66 +0,0 @@ - -getRssCatalogFeeds(); - $_misc = $this->getRssMiscFeeds(); -?> - - - - - - - - - - - - - - - - -
    getLabel() ?>
    - - - - - - - - - - - - - - - - -
    escapeHtml($_category->getLabel()) ?>
    - - -

    - diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json index e39949448c98f..bb7975eda0ff5 100644 --- a/app/code/Magento/Rule/composer.json +++ b/app/code/Magento/Rule/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Rss/Block/Order/Details.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Details.php similarity index 89% rename from app/code/Magento/Rss/Block/Order/Details.php rename to app/code/Magento/Sales/Block/Adminhtml/Order/Details.php index 71007d30d9ca7..059e2bf7153ab 100644 --- a/app/code/Magento/Rss/Block/Order/Details.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Details.php @@ -21,8 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rss\Block\Order; +namespace Magento\Sales\Block\Adminhtml\Order; +/** + * Class Details + * @package Magento\Sales\Block\Adminhtml\Order + */ class Details extends \Magento\Framework\View\Element\Template { /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php index 9ce8319710b23..fb5ac2078acd3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php @@ -90,16 +90,24 @@ public function __construct( */ public function getFullTaxInfo() { - /** @var $source \Magento\Sales\Model\Order */ - $source = $this->getOrder(); - $taxClassAmount = array(); - if ($source instanceof \Magento\Sales\Model\Order) { - $taxClassAmount = $this->_taxHelper->getCalculatedTaxes($source); - if (empty($taxClassAmount)) { - $rates = $this->_taxOrderFactory->create()->getCollection()->loadByOrder($source)->toArray(); - $taxClassAmount = $this->_taxCalculation->reproduceProcess($rates['items']); - } + $source = $this->getSource(); + if (!$source instanceof \Magento\Sales\Model\Order\Invoice + && !$source instanceof \Magento\Sales\Model\Order\Creditmemo + ) { + $source = $this->getOrder(); } + + $taxClassAmount = []; + if (empty($source)) { + return $taxClassAmount; + } + + $taxClassAmount = $this->_taxHelper->getCalculatedTaxes($source); + if (empty($taxClassAmount)) { + $rates = $this->_taxOrderFactory->create()->getCollection()->loadByOrder($source)->toArray(); + $taxClassAmount = $this->_taxCalculation->reproduceProcess($rates['items']); + } + return $taxClassAmount; } diff --git a/app/code/Magento/Rss/Block/Order/Info/Buttons/Rss.php b/app/code/Magento/Sales/Block/Adminhtml/Rss/Order/Grid/Link.php similarity index 57% rename from app/code/Magento/Rss/Block/Order/Info/Buttons/Rss.php rename to app/code/Magento/Sales/Block/Adminhtml/Rss/Order/Grid/Link.php index fca08312b50b0..3af2a95d326a6 100644 --- a/app/code/Magento/Rss/Block/Order/Info/Buttons/Rss.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Rss/Order/Grid/Link.php @@ -21,67 +21,69 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -namespace Magento\Rss\Block\Order\Info\Buttons; +namespace Magento\Sales\Block\Adminhtml\Rss\Order\Grid; /** - * Block with rss feed link in Order view page + * Class Link + * @package Magento\Sales\Block\Adminhtml\Rss\Order\Grid */ -class Rss extends \Magento\Framework\View\Element\Template +class Link extends \Magento\Framework\View\Element\Template { /** - * Template of the block - * * @var string */ - protected $_template = 'order/info/buttons/rss.phtml'; + protected $_template = 'rss/order/grid/link.phtml'; /** - * Core registry - * - * @var \Magento\Framework\Registry + * @var \Magento\Framework\App\Rss\UrlBuilderInterface */ - protected $registry; - - /** - * @var \Magento\Rss\Helper\Order - */ - protected $orderHelper; + protected $rssUrlBuilder; /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Rss\Helper\Order $orderHelper + * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Rss\Helper\Order $orderHelper, + \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, array $data = array() ) { - $this->registry = $registry; - $this->orderHelper = $orderHelper; + $this->rssUrlBuilder = $rssUrlBuilder; parent::__construct($context, $data); } /** - * Retrieve current order model instance - * - * @return \Magento\Sales\Model\Order + * @return string */ - public function getOrder() + public function getLink() { - return $this->registry->registry('current_order'); + return $this->rssUrlBuilder->getUrl($this->getLinkParams()); } /** - * Getting order helper + * @return string + */ + public function getLabel() + { + return __('New Order RSS'); + } + + /** + * Check whether status notification is allowed * - * @return \Magento\Rss\Helper\Order + * @return bool + */ + public function isRssAllowed() + { + return true; + } + + /** + * @return string */ - public function getOrderHelper() + protected function getLinkParams() { - return $this->orderHelper; + return array('type' => 'new_order'); } } diff --git a/app/code/Magento/Sales/Block/Order/Creditmemo.php b/app/code/Magento/Sales/Block/Order/Creditmemo.php index 0f0541372ff60..085ad674d944c 100644 --- a/app/code/Magento/Sales/Block/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Block/Order/Creditmemo.php @@ -70,10 +70,7 @@ public function __construct( */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Sales/Block/Order/History.php b/app/code/Magento/Sales/Block/Order/History.php index adb3a8270846f..7d5fe477ef5bb 100644 --- a/app/code/Magento/Sales/Block/Order/History.php +++ b/app/code/Magento/Sales/Block/Order/History.php @@ -48,17 +48,11 @@ class History extends \Magento\Framework\View\Element\Template */ protected $_orderConfig; - /** - * @var \Magento\Framework\View\Page\Config - */ - protected $pageConfig; - /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollectionFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Sales\Model\Order\Config $orderConfig - * @param \Magento\Framework\View\Page\Config $pageConfig * @param array $data */ public function __construct( @@ -66,13 +60,11 @@ public function __construct( \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollectionFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Sales\Model\Order\Config $orderConfig, - \Magento\Framework\View\Page\Config $pageConfig, array $data = array() ) { $this->_orderCollectionFactory = $orderCollectionFactory; $this->_customerSession = $customerSession; $this->_orderConfig = $orderConfig; - $this->pageConfig = $pageConfig; parent::__construct($context, $data); $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Sales/Block/Order/Info.php b/app/code/Magento/Sales/Block/Order/Info.php index c2b26e61adaa1..a19be6098fbda 100644 --- a/app/code/Magento/Sales/Block/Order/Info.php +++ b/app/code/Magento/Sales/Block/Order/Info.php @@ -69,9 +69,7 @@ public function __construct( */ protected function _prepareLayout() { - if ($headBlock = $this->getLayout()->getBlock('head')) { - $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Sales/Block/Order/Info/Buttons/Rss.php b/app/code/Magento/Sales/Block/Order/Info/Buttons/Rss.php new file mode 100644 index 0000000000000..09f3f9878e2bb --- /dev/null +++ b/app/code/Magento/Sales/Block/Order/Info/Buttons/Rss.php @@ -0,0 +1,120 @@ +orderFactory = $orderFactory; + $this->rssUrlBuilder = $rssUrlBuilder; + parent::__construct($context, $data); + } + + /** + * @return string + */ + public function getLink() + { + return $this->rssUrlBuilder->getUrl($this->getLinkParams()); + } + + /** + * @return string + */ + public function getLabel() + { + return __('Subscribe to Order Status'); + } + + /** + * Check whether status notification is allowed + * + * @return bool + */ + public function isRssAllowed() + { + return $this->_scopeConfig->isSetFlag( + 'rss/order/status', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Retrieve order status url key + * + * @param \Magento\Sales\Model\Order $order + * @return string + */ + protected function getUrlKey($order) + { + $data = array( + 'order_id' => $order->getId(), + 'increment_id' => $order->getIncrementId(), + 'customer_id' => $order->getCustomerId() + ); + return base64_encode(json_encode($data)); + } + + /** + * @return string + */ + protected function getLinkParams() + { + $order = $this->orderFactory->create()->load($this->_request->getParam('order_id')); + return array( + 'type' => 'order_status', + '_secure' => true, + '_query' => array('data' => $this->getUrlKey($order)) + ); + } +} diff --git a/app/code/Magento/Sales/Block/Order/Invoice.php b/app/code/Magento/Sales/Block/Order/Invoice.php index 037cd75b9cd9b..321b5a7c7c58b 100644 --- a/app/code/Magento/Sales/Block/Order/Invoice.php +++ b/app/code/Magento/Sales/Block/Order/Invoice.php @@ -68,10 +68,7 @@ public function __construct( */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php index a30638626c69b..671c8364935a5 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php @@ -64,9 +64,7 @@ public function __construct( */ protected function _prepareLayout() { - if ($headBlock = $this->getLayout()->getBlock('head')) { - $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php index 057812db8f286..3d99d510c792f 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php @@ -64,10 +64,7 @@ public function __construct( */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php index b38f500aa8498..d5d9b9e364c26 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php @@ -102,10 +102,7 @@ protected function _beforeToHtml() */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Sales/Block/Order/PrintShipment.php b/app/code/Magento/Sales/Block/Order/PrintShipment.php index 9c9324543e0b7..e3625aa7fa63d 100644 --- a/app/code/Magento/Sales/Block/Order/PrintShipment.php +++ b/app/code/Magento/Sales/Block/Order/PrintShipment.php @@ -65,9 +65,7 @@ public function __construct( */ protected function _prepareLayout() { - if ($headBlock = $this->getLayout()->getBlock('head')) { - $headBlock->setTitle(__('Print Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Print Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Sales/Block/Order/View.php b/app/code/Magento/Sales/Block/Order/View.php index ac0eb229aae2d..b16c4eefc6c1d 100644 --- a/app/code/Magento/Sales/Block/Order/View.php +++ b/app/code/Magento/Sales/Block/Order/View.php @@ -76,10 +76,7 @@ public function __construct( */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/Email.php b/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/Email.php index 1eb233b34c052..afc24d33c9d36 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/Email.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/Email.php @@ -57,7 +57,7 @@ public function execute() return; } - $this->_objectManager->create('Magento\Sales\Model\InvoiceNotifier') + $this->_objectManager->create('Magento\Sales\Model\Order\InvoiceNotifier') ->notify($invoice); $this->messageManager->addSuccess(__('We sent the message.')); diff --git a/app/code/Magento/Sales/Controller/Guest/Form.php b/app/code/Magento/Sales/Controller/Guest/Form.php index 5fa77e2929128..c876697444ff8 100644 --- a/app/code/Magento/Sales/Controller/Guest/Form.php +++ b/app/code/Magento/Sales/Controller/Guest/Form.php @@ -38,7 +38,7 @@ public function execute() return; } $this->_view->loadLayout(); - $this->_view->getLayout()->getBlock('head')->setTitle(__('Orders and Returns')); + $this->_view->getPage()->getConfig()->setTitle(__('Orders and Returns')); $this->_objectManager->get('Magento\Sales\Helper\Guest')->getBreadcrumbs(); $this->_view->renderLayout(); } diff --git a/app/code/Magento/Sales/Controller/Order/History.php b/app/code/Magento/Sales/Controller/Order/History.php index 309886cd40fb9..a7433b38e047c 100644 --- a/app/code/Magento/Sales/Controller/Order/History.php +++ b/app/code/Magento/Sales/Controller/Order/History.php @@ -38,7 +38,7 @@ public function execute() $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); - $this->_view->getLayout()->getBlock('head')->setTitle(__('My Orders')); + $this->_view->getPage()->getConfig()->setTitle(__('My Orders')); $block = $this->_view->getLayout()->getBlock('customer.account.link.back'); if ($block) { diff --git a/app/code/Magento/Sales/Model/Order/Address/Validator.php b/app/code/Magento/Sales/Model/Order/Address/Validator.php index 13b8b8a5d1161..1f04edb7f8649 100644 --- a/app/code/Magento/Sales/Model/Order/Address/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Address/Validator.php @@ -40,7 +40,7 @@ class Validator 'street' => 'Street', 'city' => 'City', 'email' => 'Email', - 'telephone' => 'Telephone', + 'telephone' => 'Phone Number', 'country_id' => 'Country', 'firstname' => 'First Name', 'address_type' => 'Address Type' diff --git a/app/code/Magento/Sales/Model/OrderRepository/Plugin/Authorization.php b/app/code/Magento/Sales/Model/OrderRepository/Plugin/Authorization.php new file mode 100644 index 0000000000000..8898aabb57e8e --- /dev/null +++ b/app/code/Magento/Sales/Model/OrderRepository/Plugin/Authorization.php @@ -0,0 +1,76 @@ +userContext = $userContext; + } + + /** + * Checks if order is allowed + * + * @param \Magento\Sales\Model\OrderRepository $subject + * @param \Magento\Sales\Model\Order $order + * @return \Magento\Sales\Model\Order + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function afterGet( + \Magento\Sales\Model\OrderRepository $subject, + \Magento\Sales\Model\Order $order + ) { + if (!$this->isAllowed($order)) { + throw NoSuchEntityException::singleField('orderId', $order->getId()); + } + return $order; + } + + /** + * Checks if order is allowed for current customer + * + * @param \Magento\Sales\Model\Order $order + * @return bool + */ + protected function isAllowed(\Magento\Sales\Model\Order $order) + { + return $this->userContext->getUserType() == UserContextInterface::USER_TYPE_CUSTOMER + ? $order->getCustomerId() == $this->userContext->getUserId() + : true; + } +} diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php index f71ab9835cb95..1a72291fc08c6 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Address.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php @@ -95,7 +95,7 @@ public function getAllAttributes() 'lastname' => __('Last Name'), 'region_id' => __('State/Province'), 'street' => __('Street Address'), - 'telephone' => __('Telephone'), + 'telephone' => __('Phone Number'), 'postcode' => __('Zip/Postal Code') ); asort($attributes); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php index 8b77a19de463f..33b3d2cb7b4f9 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php @@ -23,8 +23,10 @@ */ namespace Magento\Sales\Model\Resource\Order; -use Magento\Framework\App\Resource; use Magento\Framework\Stdlib\DateTime; +use Magento\Sales\Model\Resource\Attribute; +use Magento\Framework\App\Resource as AppResource; +use Magento\Sales\Model\Increment as SalesIncrement; use Magento\Sales\Model\Resource\Entity as SalesResource; use Magento\Sales\Model\Resource\Order\Creditmemo\Grid as CreditmemoGrid; @@ -51,4 +53,23 @@ protected function _construct() { $this->_init('sales_flat_creditmemo', 'entity_id'); } + + /** + * Constructor + * + * @param AppResource $resource + * @param DateTime $dateTime + * @param Attribute $attribute + * @param SalesIncrement $salesIncrement + * @param CreditmemoGrid $gridAggregator + */ + public function __construct( + AppResource $resource, + DateTime $dateTime, + Attribute $attribute, + SalesIncrement $salesIncrement, + CreditmemoGrid $gridAggregator + ) { + parent::__construct($resource, $dateTime, $attribute, $salesIncrement, $gridAggregator); + } } diff --git a/app/code/Magento/Rss/Model/Resource/Order.php b/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php similarity index 84% rename from app/code/Magento/Rss/Model/Resource/Order.php rename to app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php index a8f8edef120b4..005372e9f9c6c 100644 --- a/app/code/Magento/Rss/Model/Resource/Order.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php @@ -21,14 +21,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rss\Model\Resource; +namespace Magento\Sales\Model\Resource\Order\Rss; /** * Order Rss Resource Model * * @author Magento Core Team */ -class Order +class OrderStatus { /** * @var \Magento\Framework\App\Resource @@ -51,15 +51,15 @@ public function __construct(\Magento\Framework\App\Resource $resource) */ public function getAllCommentCollection($orderId) { - /** @var $res \Magento\Framework\App\Resource */ - $res = $this->_resource; - $read = $res->getConnection('core_read'); + /** @var $resource \Magento\Framework\App\Resource */ + $resource = $this->_resource; + $read = $resource->getConnection('core_read'); $fields = array('notified' => 'is_customer_notified', 'comment', 'created_at'); $commentSelects = array(); foreach (array('invoice', 'shipment', 'creditmemo') as $entityTypeCode) { - $mainTable = $res->getTableName('sales_flat_' . $entityTypeCode); - $slaveTable = $res->getTableName('sales_flat_' . $entityTypeCode . '_comment'); + $mainTable = $resource->getTableName('sales_flat_' . $entityTypeCode); + $slaveTable = $resource->getTableName('sales_flat_' . $entityTypeCode . '_comment'); $select = $read->select()->from( array('main' => $mainTable), array('entity_id' => 'order_id', 'entity_type_code' => new \Zend_Db_Expr("'{$entityTypeCode}'")) @@ -74,7 +74,7 @@ public function getAllCommentCollection($orderId) $commentSelects[] = '(' . $select . ')'; } $select = $read->select()->from( - $res->getTableName('sales_flat_order_status_history'), + $resource->getTableName('sales_flat_order_status_history'), array('entity_id' => 'parent_id', 'entity_type_code' => new \Zend_Db_Expr("'order'")) + $fields )->where( 'parent_id = ?', @@ -87,7 +87,7 @@ public function getAllCommentCollection($orderId) $commentSelect = $read->select()->union($commentSelects, \Zend_Db_Select::SQL_UNION_ALL); $select = $read->select()->from( - array('orders' => $res->getTableName('sales_flat_order')), + array('orders' => $resource->getTableName('sales_flat_order')), array('increment_id') )->join( array('t' => $commentSelect), diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php index f260907b67146..1879a8ab1f012 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php @@ -23,9 +23,9 @@ */ namespace Magento\Sales\Model\Resource\Order; -use Magento\Framework\App\Resource; use Magento\Framework\Stdlib\DateTime; use Magento\Sales\Model\Resource\Attribute; +use Magento\Framework\App\Resource as AppResource; use Magento\Sales\Model\Increment as SalesIncrement; use Magento\Sales\Model\Resource\Entity as SalesResource; use Magento\Sales\Model\Resource\Order\Shipment\Grid as ShipmentGrid; @@ -60,4 +60,23 @@ protected function _construct() { $this->_init('sales_flat_shipment', 'entity_id'); } + + /** + * Constructor + * + * @param AppResource $resource + * @param DateTime $dateTime + * @param Attribute $attribute + * @param SalesIncrement $salesIncrement + * @param ShipmentGrid $gridAggregator + */ + public function __construct( + AppResource $resource, + DateTime $dateTime, + Attribute $attribute, + SalesIncrement $salesIncrement, + ShipmentGrid $gridAggregator + ) { + parent::__construct($resource, $dateTime, $attribute, $salesIncrement, $gridAggregator); + } } diff --git a/app/code/Magento/Sales/Model/Rss/NewOrder.php b/app/code/Magento/Sales/Model/Rss/NewOrder.php new file mode 100644 index 0000000000000..6d763f5905098 --- /dev/null +++ b/app/code/Magento/Sales/Model/Rss/NewOrder.php @@ -0,0 +1,171 @@ +orderFactory = $orderFactory; + $this->urlBuilder = $urlBuilder; + $this->localeDate = $localeDate; + $this->dateTime = $dateTime; + $this->eventManager = $eventManager; + $this->layout = $layout; + $this->rssUrlBuilder = $rssUrlBuilder; + } + + /** + * Check if RSS feed allowed + * + * @return mixed + */ + public function isAllowed() + { + return true; + } + + /** + * Get RSS feed items + * + * @return array + */ + public function getRssData() + { + $passDate = $this->dateTime->formatDate(mktime(0, 0, 0, date('m'), date('d') - 7)); + $newUrl = $this->rssUrlBuilder->getUrl(array('_secure' => true, '_nosecret' => true, 'type' => 'new_order')); + $title = __('New Orders'); + $data = array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'); + + /** @var $order \Magento\Sales\Model\Order */ + $order = $this->orderFactory->create(); + /** @var $collection \Magento\Sales\Model\Resource\Order\Collection */ + $collection = $order->getResourceCollection(); + $collection->addAttributeToFilter('created_at', array('date' => true, 'from' => $passDate)) + ->addAttributeToSort('created_at', 'desc'); + $this->eventManager->dispatch('rss_order_new_collection_select', array('collection' => $collection)); + + $detailBlock = $this->layout->getBlockSingleton('Magento\Sales\Block\Adminhtml\Order\Details'); + foreach ($collection as $item) { + $title = __('Order #%1 created at %2', $item->getIncrementId(), $this->localeDate->formatDate( + $item->getCreatedAt() + )); + $url = $this->urlBuilder->getUrl( + 'sales/order/view', + array('_secure' => true, 'order_id' => $item->getId(), '_nosecret' => true) + ); + $detailBlock->setOrder($item); + + $data['entries'][] = (array('title' => $title, 'link' => $url, 'description' => $detailBlock->toHtml())); + } + + return $data; + } + + /** + * @return string + */ + public function getCacheKey() + { + return 'rss_new_orders_data'; + } + + /** + * @return int + */ + public function getCacheLifetime() + { + return 60; + } + + /** + * @return array + */ + public function getFeeds() + { + return array(); + } +} diff --git a/app/code/Magento/Sales/Model/Rss/OrderStatus.php b/app/code/Magento/Sales/Model/Rss/OrderStatus.php new file mode 100644 index 0000000000000..e134b4781019a --- /dev/null +++ b/app/code/Magento/Sales/Model/Rss/OrderStatus.php @@ -0,0 +1,237 @@ +objectManager = $objectManager; + $this->urlBuilder = $urlBuilder; + $this->request = $request; + $this->orderResourceFactory = $orderResourceFactory; + $this->localeDate = $localeDate; + $this->orderFactory = $orderFactory; + $this->config = $scopeConfig; + } + + /** + * Check if RSS feed allowed + * + * @return bool + */ + public function isAllowed () + { + if ($this->config->getValue('rss/order/status', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { + return true; + } + return false; + } + + /** + * @return array + */ + public function getRssData() + { + $this->order = $this->getOrder(); + if (is_null($this->order)) { + throw new \InvalidArgumentException('Order not found.'); + } + return array_merge($this->getHeader(), $this->getEntries()); + } + + /** + * @return string + */ + public function getCacheKey() + { + $order = $this->getOrder(); + return 'rss_order_status_data_' . md5($order->getId() . $order->getIncrementId() . $order->getCustomerId()); + } + + /** + * @return int + */ + public function getCacheLifetime() + { + return 600; + } + + /** + * @return \Magento\Sales\Model\Order + */ + protected function getOrder() + { + if ($this->order) { + return $this->order; + } + + $data = json_decode(base64_decode((string)$this->request->getParam('data')), true); + if (!is_array($data)) { + return null; + } + + if (!isset($data['order_id']) || !isset($data['increment_id']) || !isset($data['customer_id'])) { + return null; + } + + /** @var $order \Magento\Sales\Model\Order */ + $order = $this->orderFactory->create(); + $order->load($data['order_id']); + + if ($order->getIncrementId() != $data['increment_id'] || $order->getCustomerId() != $data['customer_id']) { + $order = null; + } + $this->order = $order; + + return $this->order; + } + + /** + * Get RSS feed items + * + * @return array + */ + protected function getEntries() + { + /** @var $resourceModel \Magento\Sales\Model\Resource\Order\Rss\OrderStatus */ + $resourceModel = $this->orderResourceFactory->create(); + $results = $resourceModel->getAllCommentCollection($this->order->getId()); + $entries = array(); + if ($results) { + foreach ($results as $result) { + $urlAppend = 'view'; + $type = $result['entity_type_code']; + if ($type && $type != 'order') { + $urlAppend = $type; + } + $type = __(ucwords($type)); + $title = __('Details for %1 #%2', $type, $result['increment_id']); + $description = '

    ' . __('Notified Date: %1', $this->localeDate->formatDate($result['created_at'])) + . '
    ' + . __('Comment: %1
    ', $result['comment']) . '

    '; + $url = $this->urlBuilder->getUrl( + 'sales/order/' . $urlAppend, + array('order_id' => $this->order->getId()) + ); + $entries[] = array('title' => $title, 'link' => $url, 'description' => $description); + } + } + $title = __('Order #%1 created at %2', $this->order->getIncrementId(), $this->localeDate->formatDate( + $this->order->getCreatedAt() + )); + $url = $this->urlBuilder->getUrl('sales/order/view', array('order_id' => $this->order->getId())); + $description = '

    ' . __('Current Status: %1
    ', $this->order->getStatusLabel()) . + __('Total: %1
    ', $this->order->formatPrice($this->order->getGrandTotal())) . '

    '; + + $entries[] = array('title' => $title, 'link' => $url, 'description' => $description); + + return array('entries' => $entries); + } + + /** + * Get data for Header esction of RSS feed + * + * @return array + */ + protected function getHeader() + { + $title = __('Order # %1 Notification(s)', $this->order->getIncrementId()); + $newUrl = $this->urlBuilder->getUrl('sales/order/view', array('order_id' => $this->order->getId())); + + return array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'); + } + + /** + * @return array + */ + public function getFeeds() + { + return array(); + } +} diff --git a/app/code/Magento/Sales/Model/Service/Quote.php b/app/code/Magento/Sales/Model/Service/Quote.php old mode 100755 new mode 100644 index 4614bb1f2d0d1..2555c195b189c --- a/app/code/Magento/Sales/Model/Service/Quote.php +++ b/app/code/Magento/Sales/Model/Service/Quote.php @@ -207,7 +207,7 @@ public function submitOrderWithDataObject() ->setAddresses($addresses) ->create(); if ($customerData->getId()) { - $this->_customerAccountService->updateCustomer($customerDetails); + $this->_customerAccountService->updateCustomer($customerData->getId(), $customerDetails); } else { //for new customers $customerData = $this->_customerAccountService->createCustomerWithPasswordHash( $customerDetails, diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php b/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php index 905811baca449..f38b6dc5fe887 100644 --- a/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php +++ b/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php @@ -108,7 +108,7 @@ public function getAdditionalData() /** * Returns additional_information * - * @return string + * @return string[] */ public function getAdditionalInformation() { diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json index 11a1592eeeb15..46bc9944d9bbb 100644 --- a/app/code/Magento/Sales/composer.json +++ b/app/code/Magento/Sales/composer.json @@ -3,31 +3,31 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-authorization": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-checkout": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/module-sales-rule": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-widget": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-gift-message": "0.1.0-alpha96", - "magento/module-reports": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/module-wishlist": "0.1.0-alpha96", - "magento/module-email": "0.1.0-alpha96", - "magento/module-shipping": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-authorization": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-checkout": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/module-sales-rule": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-widget": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-gift-message": "0.1.0-alpha97", + "magento/module-reports": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/module-wishlist": "0.1.0-alpha97", + "magento/module-email": "0.1.0-alpha97", + "magento/module-shipping": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Index/etc/adminhtml/di.xml b/app/code/Magento/Sales/etc/adminhtml/di.xml similarity index 84% rename from app/code/Magento/Index/etc/adminhtml/di.xml rename to app/code/Magento/Sales/etc/adminhtml/di.xml index 5805634b012d4..97317ecabacb4 100644 --- a/app/code/Magento/Index/etc/adminhtml/di.xml +++ b/app/code/Magento/Sales/etc/adminhtml/di.xml @@ -24,10 +24,10 @@ */ --> - + - - Magento\Index\Model\System\Message\IndexOutdated + + Magento\Sales\Model\Rss\NewOrder diff --git a/app/code/Magento/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml index de77855178a0f..9482c3bc435eb 100644 --- a/app/code/Magento/Sales/etc/adminhtml/system.xml +++ b/app/code/Magento/Sales/etc/adminhtml/system.xml @@ -380,5 +380,14 @@ +
    + + + + + Magento\Backend\Model\Config\Source\Enabledisable + + +
    diff --git a/app/code/Magento/Sales/etc/catalog_attributes.xml b/app/code/Magento/Sales/etc/catalog_attributes.xml index 841b36ed79cb7..2c5ce2a50504c 100644 --- a/app/code/Magento/Sales/etc/catalog_attributes.xml +++ b/app/code/Magento/Sales/etc/catalog_attributes.xml @@ -42,8 +42,5 @@ - - -
    diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 8e4b14a1f75d2..b8ed1b169b04c 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -96,4 +96,11 @@ + + + + Magento\Sales\Model\Rss\OrderStatus + + + diff --git a/app/code/Magento/Sales/etc/frontend/events.xml b/app/code/Magento/Sales/etc/frontend/events.xml index 643294e1f54b5..bea720e8c9ee1 100644 --- a/app/code/Magento/Sales/etc/frontend/events.xml +++ b/app/code/Magento/Sales/etc/frontend/events.xml @@ -30,7 +30,4 @@ - - - diff --git a/app/code/Magento/Sales/etc/sales.xml b/app/code/Magento/Sales/etc/sales.xml index 35fb3bc9724cd..36f24f63227fc 100644 --- a/app/code/Magento/Sales/etc/sales.xml +++ b/app/code/Magento/Sales/etc/sales.xml @@ -29,7 +29,6 @@ - diff --git a/app/code/Magento/Sales/etc/webapi_rest/di.xml b/app/code/Magento/Sales/etc/webapi_rest/di.xml index 278cf9830261b..f345c03e02d27 100644 --- a/app/code/Magento/Sales/etc/webapi_rest/di.xml +++ b/app/code/Magento/Sales/etc/webapi_rest/di.xml @@ -27,4 +27,7 @@ + + + diff --git a/app/code/Magento/Sales/etc/webapi_soap/di.xml b/app/code/Magento/Sales/etc/webapi_soap/di.xml index 278cf9830261b..f345c03e02d27 100644 --- a/app/code/Magento/Sales/etc/webapi_soap/di.xml +++ b/app/code/Magento/Sales/etc/webapi_soap/di.xml @@ -27,4 +27,7 @@ + + + diff --git a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php b/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php index 7f353ff784e2a..4f14d6335252f 100644 --- a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php +++ b/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php @@ -1143,7 +1143,7 @@ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, array(), - 'Telephone' + 'Phone Number' )->addColumn( 'country_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, @@ -4404,7 +4404,7 @@ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, array(), - 'Telephone' + 'Phone Number' )->addColumn( 'fax', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml index c1b114f770648..9bb9a23d8f9c8 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml @@ -31,19 +31,13 @@ order-header - - - - Magento_Sales::js/bootstrap/order-create-index.js - - + - - - Magento_Core::prototype/magento.css - - - + + + + + diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_grid_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_grid_block.xml index a1736952fe9c9..165fd71b57dda 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_grid_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_grid_block.xml @@ -214,6 +214,9 @@ + + + diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml index cde7120971224..0eb9462c8a67f 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml @@ -24,13 +24,9 @@ */ --> - - - - Magento_Sales::js/bootstrap/order-create-index.js - - - + + + @@ -68,7 +64,7 @@ order_invoices sales_order_invoice.grid.container - + order_creditmemos sales_order_creditmemo.grid.container diff --git a/app/code/Magento/Rss/view/frontend/templates/order/details.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/details.phtml similarity index 100% rename from app/code/Magento/Rss/view/frontend/templates/order/details.phtml rename to app/code/Magento/Sales/view/adminhtml/templates/order/details.phtml diff --git a/app/code/Magento/Sales/view/adminhtml/templates/rss/order/grid/link.phtml b/app/code/Magento/Sales/view/adminhtml/templates/rss/order/grid/link.phtml new file mode 100644 index 0000000000000..38e90694c0484 --- /dev/null +++ b/app/code/Magento/Sales/view/adminhtml/templates/rss/order/grid/link.phtml @@ -0,0 +1,29 @@ + +isRssAllowed() && $this->getLink()): ?> +getLabel() ?> + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_guest_creditmemo.xml b/app/code/Magento/Sales/view/frontend/layout/sales_guest_creditmemo.xml index 36ab59e11d208..96e1113168a4d 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_guest_creditmemo.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_guest_creditmemo.xml @@ -44,5 +44,8 @@ + + + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_guest_invoice.xml b/app/code/Magento/Sales/view/frontend/layout/sales_guest_invoice.xml index c845e7382d4cd..e650152f108fa 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_guest_invoice.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_guest_invoice.xml @@ -44,5 +44,8 @@ + + + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_guest_shipment.xml b/app/code/Magento/Sales/view/frontend/layout/sales_guest_shipment.xml index f5a2ff1c5fe3f..cb18545d9d6ea 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_guest_shipment.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_guest_shipment.xml @@ -29,5 +29,8 @@ + + + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_guest_view.xml b/app/code/Magento/Sales/view/frontend/layout/sales_guest_view.xml index 11efb4756469f..3e8dd9f3c3411 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_guest_view.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_guest_view.xml @@ -32,8 +32,7 @@ - - + @@ -45,6 +44,10 @@ + + + + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo.xml index 0b89a18b9db13..716d498341215 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo.xml @@ -49,6 +49,9 @@ + + + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice.xml index 50ba2bf8de093..f10a51b09d12f 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice.xml @@ -50,6 +50,9 @@ + + + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml index ee3aafe4591e6..53a6acf1a681e 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml @@ -32,6 +32,9 @@ + + + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_view.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_view.xml index 22fe53c376d95..3426274e70b0a 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_view.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_view.xml @@ -34,6 +34,9 @@ + + + diff --git a/app/code/Magento/Sales/view/frontend/templates/items/price/row.phtml b/app/code/Magento/Sales/view/frontend/templates/items/price/row.phtml index 7768e182d3a37..f3354f7cd0a1a 100644 --- a/app/code/Magento/Sales/view/frontend/templates/items/price/row.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/items/price/row.phtml @@ -25,7 +25,7 @@ /** @var \Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer $this */ $_item = $this->getItem(); ?> - + getOrder()->formatPrice($this->getItem()->getRowTotal()) ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/items/price/unit.phtml b/app/code/Magento/Sales/view/frontend/templates/items/price/unit.phtml index 3ee30e9540169..7075d0df03d31 100644 --- a/app/code/Magento/Sales/view/frontend/templates/items/price/unit.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/items/price/unit.phtml @@ -25,7 +25,7 @@ /** @var \Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer $this */ $_item = $this->getItem(); ?> - + getOrder()->formatPrice($this->getItem()->getPrice()) ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/order/info/buttons/rss.phtml b/app/code/Magento/Sales/view/frontend/templates/order/info/buttons/rss.phtml new file mode 100644 index 0000000000000..87acdf56c07c3 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/templates/order/info/buttons/rss.phtml @@ -0,0 +1,31 @@ + +isRssAllowed() && $this->getLink()): ?> + + getLabel() ?> + + diff --git a/app/code/Magento/Sales/view/frontend/templates/order/items/renderer/default.phtml b/app/code/Magento/Sales/view/frontend/templates/order/items/renderer/default.phtml index 2677ee2b0fea0..0ca19d4cd61cd 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/items/renderer/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/items/renderer/default.phtml @@ -70,7 +70,6 @@ $_item = $this->getItem(); prepareSku($this->getSku()) ?> - getItemPriceHtml(); ?> diff --git a/app/code/Magento/SalesRule/Block/Rss/Discounts.php b/app/code/Magento/SalesRule/Block/Rss/Discounts.php new file mode 100644 index 0000000000000..53b24bc09be42 --- /dev/null +++ b/app/code/Magento/SalesRule/Block/Rss/Discounts.php @@ -0,0 +1,191 @@ +storeManager = $context->getStoreManager(); + $this->rssModel = $rssModel; + $this->httpContext = $httpContext; + $this->rssUrlBuilder = $rssUrlBuilder; + parent::__construct($context, $data); + } + + /** + * {@inheritdoc} + */ + protected function _construct() + { + $this->setCacheKey('rss_catalog_salesrule_' . $this->getStoreId() . '_' . $this->getCustomerGroupId()); + parent::_construct(); + } + + /** + * {@inheritdoc} + */ + public function getRssData() + { + $storeId = $this->getStoreId(); + $storeModel = $this->storeManager->getStore($storeId); + $websiteId = $storeModel->getWebsiteId(); + $customerGroupId = $this->getCustomerGroupId(); + $url = $this->_urlBuilder->getUrl(''); + $newUrl = $this->rssUrlBuilder->getUrl(array( + 'type' => 'discounts', + 'store_id' => $storeId, + 'cid' => $customerGroupId + )); + $title = __('%1 - Discounts and Coupons', $storeModel->getName()); + $lang = $this->_scopeConfig->getValue( + 'general/locale/code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeModel + ); + + $data = array( + 'title' => $title, + 'description' => $title, + 'link' => $newUrl, + 'charset' => 'UTF-8', + 'language' => $lang + ); + + /** @var $rule \Magento\SalesRule\Model\Rule */ + foreach ($this->rssModel->getDiscountCollection($websiteId, $customerGroupId) as $rule) { + + $toDate = $rule->getToDate() + ? '
    Discount End Date: ' . $this->formatDate($rule->getToDate(), 'medium') + : ''; + $couponCode = $rule->getCouponCode() ? '
    Coupon Code: ' . $rule->getCouponCode() : ''; + + $description = sprintf( + '
    %s
    Discount Start Date: %s %s %s
    ', + $rule->getDescription(), + $this->formatDate($rule->getFromDate(), 'medium'), + $toDate, + $couponCode + ); + + $data['entries'][] = array('title' => $rule->getName(), 'description' => $description, 'link' => $url); + } + + return $data; + } + + /** + * Get customer group id + * + * @return int + */ + protected function getCustomerGroupId() + { + $customerGroupId = (int) $this->getRequest()->getParam('cid'); + if ($customerGroupId == null) { + $customerGroupId = $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_GROUP); + } + return $customerGroupId; + } + + /** + * @return int + */ + protected function getStoreId() + { + $storeId = (int)$this->getRequest()->getParam('store_id'); + if ($storeId == null) { + $storeId = $this->storeManager->getStore()->getId(); + } + return $storeId; + } + + /** + * {@inheritdoc} + */ + public function getCacheLifetime() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function isAllowed() + { + return $this->_scopeConfig->isSetFlag( + 'rss/catalog/discounts', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * {@inheritdoc} + */ + public function getFeeds() + { + $data = array(); + if ($this->isAllowed()) { + $url = $this->rssUrlBuilder->getUrl(array( + 'type' => 'discounts', + 'store_id' => $this->getStoreId(), + 'cid' => $this->getCustomerGroupId() + )); + $data = array('label' => __('Coupons/Discounts'), 'link' => $url); + } + return $data; + } +} diff --git a/app/code/Magento/SalesRule/Model/Rss/Discounts.php b/app/code/Magento/SalesRule/Model/Rss/Discounts.php new file mode 100644 index 0000000000000..8a00d801bd42a --- /dev/null +++ b/app/code/Magento/SalesRule/Model/Rss/Discounts.php @@ -0,0 +1,69 @@ +dateTime = $dateTime; + $this->collectionFactory = $collectionFactory; + } + + /** + * @param int $websiteId + * @param int $customerGroupId + * @return \Magento\SalesRule\Model\Resource\Rule\Collection + */ + public function getDiscountCollection($websiteId, $customerGroupId) + { + /** @var $collection \Magento\SalesRule\Model\Resource\Rule\Collection */ + $collection = $this->collectionFactory->create(); + $collection->addWebsiteGroupDateFilter($websiteId, $customerGroupId, $this->dateTime->now(true)) + ->addFieldToFilter('is_rss', 1) + ->setOrder('from_date', 'desc'); + $collection->load(); + return $collection; + } +} diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json index 3b59c828b0b60..19d2b6b920a49 100644 --- a/app/code/Magento/SalesRule/composer.json +++ b/app/code/Magento/SalesRule/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-rule": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-shipping": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-reports": "0.1.0-alpha96", - "magento/module-catalog-rule": "0.1.0-alpha96", - "magento/module-widget": "0.1.0-alpha96", - "magento/module-cron": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-rule": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-shipping": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-reports": "0.1.0-alpha97", + "magento/module-catalog-rule": "0.1.0-alpha97", + "magento/module-widget": "0.1.0-alpha97", + "magento/module-cron": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/SalesRule/etc/adminhtml/system.xml b/app/code/Magento/SalesRule/etc/adminhtml/system.xml index f5b67efce90b6..2f4dd4572c009 100644 --- a/app/code/Magento/SalesRule/etc/adminhtml/system.xml +++ b/app/code/Magento/SalesRule/etc/adminhtml/system.xml @@ -54,5 +54,13 @@
    +
    + + + + Magento\Backend\Model\Config\Source\Enabledisable + + +
    diff --git a/app/code/Magento/SalesRule/etc/di.xml b/app/code/Magento/SalesRule/etc/di.xml index 964c0212e85b4..3a553a1875457 100644 --- a/app/code/Magento/SalesRule/etc/di.xml +++ b/app/code/Magento/SalesRule/etc/di.xml @@ -35,4 +35,11 @@ + + + + Magento\SalesRule\Block\Rss\Discounts + + + diff --git a/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_edit.xml b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_edit.xml index 9e9c3db746269..cbab317e5590c 100644 --- a/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_edit.xml +++ b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_edit.xml @@ -24,14 +24,6 @@ */ --> - - - 1 - - - 1 - - diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json index 8cf61460aab45..976cf398f14b6 100644 --- a/app/code/Magento/Sendfriend/composer.json +++ b/app/code/Magento/Sendfriend/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-theme": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-theme": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Shipping/Block/Order/Shipment.php b/app/code/Magento/Shipping/Block/Order/Shipment.php index 2011584c5864c..bd22549f6405f 100644 --- a/app/code/Magento/Shipping/Block/Order/Shipment.php +++ b/app/code/Magento/Shipping/Block/Order/Shipment.php @@ -76,10 +76,7 @@ public function __construct( */ protected function _prepareLayout() { - $headBlock = $this->getLayout()->getBlock('head'); - if ($headBlock) { - $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); - } + $this->pageConfig->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId())); $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment())); } diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json index c5b41daf74231..aa103114a723e 100644 --- a/app/code/Magento/Shipping/composer.json +++ b/app/code/Magento/Shipping/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-sales": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-contact": "0.1.0-alpha96", - "magento/module-customer": "0.1.0-alpha96", - "magento/module-payment": "0.1.0-alpha96", - "magento/module-tax": "0.1.0-alpha96", - "magento/module-catalog-inventory": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-sales": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-contact": "0.1.0-alpha97", + "magento/module-customer": "0.1.0-alpha97", + "magento/module-payment": "0.1.0-alpha97", + "magento/module-tax": "0.1.0-alpha97", + "magento/module-catalog-inventory": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "ext-gd": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php index a4ea2096d8b91..41c7da86708d3 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php @@ -102,7 +102,7 @@ protected function _prepareForm() 'label' => __('Path'), 'name' => 'sitemap_path', 'required' => true, - 'note' => __('example: "sitemap/" or "/" for base path (path must be writeable)'), + 'note' => __('example: "/sitemap/" or "/" for base path (path must be writeable)'), 'value' => $model->getSitemapPath() ) ); diff --git a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Save.php b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Save.php index a5dce81be688f..f7a5909ced6e7 100644 --- a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Save.php +++ b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Save.php @@ -44,12 +44,13 @@ public function execute() //validate path to generate if (!empty($data['sitemap_filename']) && !empty($data['sitemap_path'])) { + $data['sitemap_path'] = '/' . ltrim($data['sitemap_path'], '/'); $path = rtrim($data['sitemap_path'], '\\/') . '/' . $data['sitemap_filename']; /** @var $validator \Magento\Core\Model\File\Validator\AvailablePath */ $validator = $this->_objectManager->create('Magento\Core\Model\File\Validator\AvailablePath'); - /** @var $helper \Magento\Catalog\Helper\Catalog */ - $helper = $this->_objectManager->get('Magento\Catalog\Helper\Catalog'); - $validator->setPaths($helper->getSitemapValidPaths()); + /** @var $helper \Magento\Sitemap\Helper\Data */ + $helper = $this->_objectManager->get('Magento\Sitemap\Helper\Data'); + $validator->setPaths($helper->getValidPaths()); if (!$validator->isValid($path)) { foreach ($validator->getMessages() as $message) { $this->messageManager->addError($message); diff --git a/app/code/Magento/Sitemap/Helper/Data.php b/app/code/Magento/Sitemap/Helper/Data.php index 786978c81a350..e4a42f1614466 100644 --- a/app/code/Magento/Sitemap/Helper/Data.php +++ b/app/code/Magento/Sitemap/Helper/Data.php @@ -28,8 +28,20 @@ */ namespace Magento\Sitemap\Helper; +use Magento\Store\Model\ScopeInterface; + class Data extends \Magento\Framework\App\Helper\AbstractHelper { + /** + * Config path to sitemap valid paths + */ + const XML_PATH_SITEMAP_VALID_PATHS = 'sitemap/file/valid_paths'; + + /** + * Config path to valid file paths + */ + const XML_PATH_PUBLIC_FILES_VALID_PATHS = 'general/file/public_files_valid_paths'; + /**#@+ * Limits xpath config settings */ @@ -98,7 +110,7 @@ public function getMaximumLinesNumber($storeId) { return $this->_scopeConfig->getValue( self::XML_PATH_MAX_LINES, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -113,7 +125,7 @@ public function getMaximumFileSize($storeId) { return $this->_scopeConfig->getValue( self::XML_PATH_MAX_FILE_SIZE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -128,7 +140,7 @@ public function getCategoryChangefreq($storeId) { return (string)$this->_scopeConfig->getValue( self::XML_PATH_CATEGORY_CHANGEFREQ, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -143,7 +155,7 @@ public function getProductChangefreq($storeId) { return (string)$this->_scopeConfig->getValue( self::XML_PATH_PRODUCT_CHANGEFREQ, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -158,7 +170,7 @@ public function getPageChangefreq($storeId) { return (string)$this->_scopeConfig->getValue( self::XML_PATH_PAGE_CHANGEFREQ, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -173,7 +185,7 @@ public function getCategoryPriority($storeId) { return (string)$this->_scopeConfig->getValue( self::XML_PATH_CATEGORY_PRIORITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -188,7 +200,7 @@ public function getProductPriority($storeId) { return (string)$this->_scopeConfig->getValue( self::XML_PATH_PRODUCT_PRIORITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -203,7 +215,7 @@ public function getPagePriority($storeId) { return (string)$this->_scopeConfig->getValue( self::XML_PATH_PAGE_PRIORITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -218,7 +230,7 @@ public function getEnableSubmissionRobots($storeId) { return $this->_scopeConfig->getValue( self::XML_PATH_SUBMISSION_ROBOTS, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } @@ -233,8 +245,21 @@ public function getProductImageIncludePolicy($storeId) { return (string)$this->_scopeConfig->getValue( self::XML_PATH_PRODUCT_IMAGES_INCLUDE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } + + /** + * Get list valid paths for generate a sitemap XML file + * + * @return string[] + */ + public function getValidPaths() + { + return array_merge( + $this->_scopeConfig->getValue(self::XML_PATH_SITEMAP_VALID_PATHS, ScopeInterface::SCOPE_STORE), + $this->_scopeConfig->getValue(self::XML_PATH_PUBLIC_FILES_VALID_PATHS, ScopeInterface::SCOPE_STORE) + ); + } } diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php index b081b5ec32a82..57b0b71c2e32b 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php @@ -23,6 +23,8 @@ */ namespace Magento\Sitemap\Model\Resource\Catalog; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; + /** * Sitemap resource catalog collection model * @@ -94,31 +96,29 @@ public function getCollection($storeId) return false; } - $this->_select = $this->_getWriteAdapter()->select()->from( + $adapter = $this->_getWriteAdapter(); + + $this->_select = $adapter->select()->from( $this->getMainTable() )->where( $this->getIdFieldName() . '=?', $store->getRootCategoryId() ); - $categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select); + $categoryRow = $adapter->fetchRow($this->_select); if (!$categoryRow) { return false; } - $urConditions = array( - 'e.entity_id = ur.category_id', - $this->_getWriteAdapter()->quoteInto('ur.store_id=?', $store->getId()), - 'ur.product_id IS NULL', - $this->_getWriteAdapter()->quoteInto('ur.is_system=?', 1) - ); - $this->_select = $this->_getWriteAdapter()->select()->from( - array('e' => $this->getMainTable()), - array($this->getIdFieldName(), 'updated_at') + $this->_select = $adapter->select()->from( + ['e' => $this->getMainTable()], + [$this->getIdFieldName(), 'updated_at'] )->joinLeft( - array('ur' => $this->getTable('core_url_rewrite')), - join(' AND ', $urConditions), - array('url' => 'request_path') + ['url_rewrite' => $this->getTable('url_rewrite')], + 'e.entity_id = url_rewrite.entity_id AND url_rewrite.is_autogenerated = 1' + . $adapter->quoteInto(' AND url_rewrite.store_id = ?', $store->getId()) + . $adapter->quoteInto(' AND url_rewrite.entity_type = ?', CategoryUrlRewriteGenerator::ENTITY_TYPE), + ['url' => 'request_path'] )->where( 'e.path LIKE ?', $categoryRow['path'] . '/%' @@ -126,7 +126,7 @@ public function getCollection($storeId) $this->_addFilter($storeId, 'is_active', 1); - $query = $this->_getWriteAdapter()->query($this->_select); + $query = $adapter->query($this->_select); while ($row = $query->fetch()) { $category = $this->_prepareCategory($row); $categories[$category->getId()] = $category; diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php index 4efb8c625e17e..06bab65ea2c06 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php @@ -23,6 +23,8 @@ */ namespace Magento\Sitemap\Model\Resource\Catalog; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; + /** * Sitemap resource product collection model * @@ -269,13 +271,9 @@ public function getCollection($storeId) return false; } - $urConditions = array( - 'e.entity_id = ur.product_id', - 'ur.category_id IS NULL', - $this->_getWriteAdapter()->quoteInto('ur.store_id = ?', $store->getId()), - $this->_getWriteAdapter()->quoteInto('ur.is_system = ?', 1) - ); - $this->_select = $this->_getWriteAdapter()->select()->from( + $adapter = $this->_getWriteAdapter(); + + $this->_select = $adapter->select()->from( array('e' => $this->getMainTable()), array($this->getIdFieldName(), 'updated_at') )->joinInner( @@ -283,9 +281,11 @@ public function getCollection($storeId) 'e.entity_id = w.product_id', array() )->joinLeft( - array('ur' => $this->getTable('core_url_rewrite')), - join(' AND ', $urConditions), - array('url' => 'request_path') + ['url_rewrite' => $this->getTable('url_rewrite')], + 'e.entity_id = url_rewrite.entity_id AND url_rewrite.is_autogenerated = 1' + . $adapter->quoteInto(' AND url_rewrite.store_id = ?', $store->getId()) + . $adapter->quoteInto(' AND url_rewrite.entity_type = ?', ProductUrlRewriteGenerator::ENTITY_TYPE), + ['url' => 'request_path'] )->where( 'w.website_id = ?', $store->getWebsiteId() @@ -320,7 +320,7 @@ public function getCollection($storeId) } } - $query = $this->_getWriteAdapter()->query($this->_select); + $query = $adapter->query($this->_select); while ($row = $query->fetch()) { $product = $this->_prepareProduct($row, $store->getId()); $products[$product->getId()] = $product; diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json index dd6a0d896461c..cd9d94f30552e 100644 --- a/app/code/Magento/Sitemap/composer.json +++ b/app/code/Magento/Sitemap/composer.json @@ -3,17 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha96", - "magento/module-catalog": "0.1.0-alpha96", - "magento/module-core": "0.1.0-alpha96", - "magento/module-eav": "0.1.0-alpha96", - "magento/module-cms": "0.1.0-alpha96", - "magento/module-backend": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-store": "0.1.0-alpha97", + "magento/module-catalog": "0.1.0-alpha97", + "magento/module-core": "0.1.0-alpha97", + "magento/module-eav": "0.1.0-alpha97", + "magento/module-cms": "0.1.0-alpha97", + "magento/module-backend": "0.1.0-alpha97", + "magento/module-catalog-url-rewrite": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Sitemap/etc/config.xml b/app/code/Magento/Sitemap/etc/config.xml index 62fc8afdf3764..336b3dcda2b97 100644 --- a/app/code/Magento/Sitemap/etc/config.xml +++ b/app/code/Magento/Sitemap/etc/config.xml @@ -52,6 +52,13 @@ 0 + + + + /*/*.xml + + + diff --git a/app/code/Magento/Sitemap/etc/module.xml b/app/code/Magento/Sitemap/etc/module.xml index e181bcab0dcf6..69a571641c3e2 100644 --- a/app/code/Magento/Sitemap/etc/module.xml +++ b/app/code/Magento/Sitemap/etc/module.xml @@ -35,6 +35,7 @@ + diff --git a/app/code/Magento/Store/Block/Store/Switcher.php b/app/code/Magento/Store/Block/Store/Switcher.php index 1404e6503b50e..6b2887f80f619 100644 --- a/app/code/Magento/Store/Block/Store/Switcher.php +++ b/app/code/Magento/Store/Block/Store/Switcher.php @@ -105,7 +105,11 @@ protected function _loadData() if (!$store->getIsActive()) { continue; } - $store->setLocaleCode($this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store->getId())); + $store->setLocaleCode($this->_scopeConfig->getValue( + \Magento\Core\Helper\Data::XML_PATH_DEFAULT_LOCALE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store->getId() + )); $this->_stores[$store->getGroupId()][$store->getId()] = $store; } @@ -120,7 +124,10 @@ protected function _loadData() public function getStoreCount() { $stores = array(); - $localeCode = $this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + $localeCode = $this->_scopeConfig->getValue( + \Magento\Core\Helper\Data::XML_PATH_DEFAULT_LOCALE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); foreach ($this->_groups as $group) { if (!isset($this->_stores[$group->getId()])) { continue; diff --git a/app/code/Magento/Store/Block/Switcher.php b/app/code/Magento/Store/Block/Switcher.php index edd7a335cbcd8..36c507d575b2c 100644 --- a/app/code/Magento/Store/Block/Switcher.php +++ b/app/code/Magento/Store/Block/Switcher.php @@ -112,7 +112,7 @@ public function getRawStores() continue; } $localeCode = $this->_scopeConfig->getValue( - 'general/locale/code', + \Magento\Core\Helper\Data::XML_PATH_DEFAULT_LOCALE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -144,7 +144,7 @@ public function getGroups() $groups = array(); $localeCode = $this->_scopeConfig->getValue( - 'general/locale/code', + \Magento\Core\Helper\Data::XML_PATH_DEFAULT_LOCALE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); foreach ($rawGroups as $group) { @@ -235,6 +235,9 @@ public function getStoreName() */ public function getTargetStorePostData(\Magento\Store\Model\Store $store) { - return $this->_postDataHelper->getPostData($this->getHomeUrl(), array('___store' => $store->getCode())); + return $this->_postDataHelper->getPostData( + $this->getHomeUrl(), + ['___store' => $store->getCode(), '___from_store' => $this->getStoreCode()] + ); } } diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 9d10c2a019cf4..798a0d19d2598 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -23,9 +23,7 @@ */ namespace Magento\Store\Model; -use Magento\Directory\Model\Currency\Filter; use Magento\Framework\Model\AbstractModel; -use Magento\Framework\StoreManagerInterface; /** * Store model @@ -327,7 +325,7 @@ class Store extends AbstractModel implements * @param \Magento\Core\Model\Resource\Config\Data $configDataResource * @param \Magento\Framework\App\Filesystem $filesystem * @param \Magento\Framework\App\Config\ReinitableConfigInterface $config - * @param StoreManagerInterface $storeManager + * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\Session\SidResolverInterface $sidResolver * @param \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory $cookieMetadataFactory * @param \Magento\Framework\Stdlib\CookieManager $cookieManager, @@ -1120,19 +1118,10 @@ public function getName() /** * Protect delete from non admin area * - * Register indexing event before delete store - * * @return $this */ protected function _beforeDelete() { - \Magento\Framework\App\ObjectManager::getInstance()->get( - 'Magento\Index\Model\Indexer' - )->logEvent( - $this, - self::ENTITY, - \Magento\Index\Model\Event::TYPE_DELETE - ); $this->_configDataResource->clearScopeData(\Magento\Store\Model\ScopeInterface::SCOPE_STORES, $this->getId()); return parent::_beforeDelete(); @@ -1150,23 +1139,6 @@ protected function _afterDelete() return $this; } - /** - * Init indexing process after store delete commit - * - * @return $this - */ - protected function _afterDeleteCommit() - { - parent::_afterDeleteCommit(); - \Magento\Framework\App\ObjectManager::getInstance()->get( - 'Magento\Index\Model\Indexer' - )->indexEvents( - self::ENTITY, - \Magento\Index\Model\Event::TYPE_DELETE - ); - return $this; - } - /** * Reinit and reset Config Data * diff --git a/setup/module/Magento/Config/src/Dom/ValidationException.php b/app/code/Magento/Store/Ui/DataType/Store.php similarity index 84% rename from setup/module/Magento/Config/src/Dom/ValidationException.php rename to app/code/Magento/Store/Ui/DataType/Store.php index dfd1fd906cb36..fb85859d82b7c 100644 --- a/setup/module/Magento/Config/src/Dom/ValidationException.php +++ b/app/code/Magento/Store/Ui/DataType/Store.php @@ -21,12 +21,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Store\Ui\DataType; + +use Magento\Ui\DataType\AbstractDataType; /** - * \Exception that should be thrown by DOM model when incoming xml is not valid. + * Class Store */ -namespace Magento\Config\Dom; - -class ValidationException extends \InvalidArgumentException +class Store extends AbstractDataType { + // } diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index 0e66134e8ad76..622ac35b3bd81 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-core": "0.1.0-alpha96", - "magento/module-directory": "0.1.0-alpha96", - "magento/module-index": "0.1.0-alpha96", - "magento/framework": "0.1.0-alpha96", + "magento/module-core": "0.1.0-alpha97", + "magento/module-directory": "0.1.0-alpha97", + "magento/module-ui": "0.1.0-alpha97", + "magento/framework": "0.1.0-alpha97", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha96", + "version": "0.1.0-alpha97", "extra": { "map": [ [ diff --git a/app/code/Magento/Store/etc/module.xml b/app/code/Magento/Store/etc/module.xml index e5b8467b5b251..a898f5d68bd35 100644 --- a/app/code/Magento/Store/etc/module.xml +++ b/app/code/Magento/Store/etc/module.xml @@ -31,7 +31,7 @@ - + diff --git a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_salesrule.xml b/app/code/Magento/Store/view/base/layout/ui_components.xml similarity index 69% rename from app/code/Magento/Rss/view/frontend/layout/rss_catalog_salesrule.xml rename to app/code/Magento/Store/view/base/layout/ui_components.xml index c30898a08203c..c2d046e0e4d5a 100644 --- a/app/code/Magento/Rss/view/frontend/layout/rss_catalog_salesrule.xml +++ b/app/code/Magento/Store/view/base/layout/ui_components.xml @@ -24,7 +24,14 @@ */ --> - - - + + + Magento_Ui::filter/type/select/default.phtml + + + + + Magento_Ui::data_type/text/default.phtml + + diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js b/app/code/Magento/Store/view/base/requirejs-config.js similarity index 86% rename from app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js rename to app/code/Magento/Store/view/base/requirejs-config.js index 3c0b6a3062cb2..98a4d16f62616 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js +++ b/app/code/Magento/Store/view/base/requirejs-config.js @@ -22,12 +22,7 @@ */ var config = { - shim: { - 'jquery.parsequery': { - deps: ['jquery'] - } - }, paths: { - 'jquery.parsequery': 'jquery/jquery.parsequery' + 'ui/template/filter/store/item': 'Magento_Store/templates/filter/store/item' } -}; +}; \ No newline at end of file diff --git a/app/code/Magento/Store/view/base/web/js/listing/filter/store.js b/app/code/Magento/Store/view/base/web/js/listing/filter/store.js new file mode 100644 index 0000000000000..b5c840579bdea --- /dev/null +++ b/app/code/Magento/Store/view/base/web/js/listing/filter/store.js @@ -0,0 +1,108 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +define([ + 'Magento_Ui/js/listing/filter/abstract', + 'underscore' +], function (AbstractControl, _) { + 'use strict'; + + /** + * Recursively loops through array of objects ({label: '...', value: '...'} + * or {label: '...', items: [...]}), looking for label, corresponding to value. + * @param {Array} arr + * @param {String} selected + * @return {String} found label + */ + function findIn(arr, selected) { + var found; + + arr.some(function(obj){ + found = 'value' in obj ? + obj.value == selected && obj.label : + findIn(obj.items, selected); + + return found; + }); + + return found; + } + + return AbstractControl.extend({ + + /** + * Invokes initialize method of parent class and initializes properties of instance. + * @param {Object} data - Item of "fields" array from grid configuration + * @param {Object} config - Filter configuration + */ + initialize: function (data) { + this.constructor.__super__.initialize.apply(this, arguments); + + this.caption = 'Select...'; + + this.observe('selected', ''); + + this.options = this.options || []; + }, + + /** + * Checkes if current state is empty. + * @return {Boolean} + */ + isEmpty: function(){ + return !this.selected(); + }, + + /** + * Returns string value of current state for UI + * @return {String} + */ + display: function (selected) { + var label = findIn(this.options, selected); + + return label; + }, + + /** + * Returns dump of instance's current state + * @returns {Object} - object which represents current state of instance + */ + dump: function () { + var selected = this.selected(); + + this.output(this.display(selected)); + + return { + field: this.index, + value: selected + } + }, + + /** + * Resets state properties of instance and calls dump method. + * @returns {Object} - object which represents current state of instance + */ + reset: function () { + this.selected(null); + } + }); +}); \ No newline at end of file diff --git a/app/code/Magento/Store/view/base/web/templates/filter/store.html b/app/code/Magento/Store/view/base/web/templates/filter/store.html new file mode 100644 index 0000000000000..3ea1a1b9a0f27 --- /dev/null +++ b/app/code/Magento/Store/view/base/web/templates/filter/store.html @@ -0,0 +1,13 @@ +
    + +
    + +
    +
    \ No newline at end of file diff --git a/app/code/Magento/Store/view/base/web/templates/filter/store/item.html b/app/code/Magento/Store/view/base/web/templates/filter/store/item.html new file mode 100644 index 0000000000000..a4acd63f609db --- /dev/null +++ b/app/code/Magento/Store/view/base/web/templates/filter/store/item.html @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/code/Magento/Store/view/frontend/templates/switch/stores.phtml b/app/code/Magento/Store/view/frontend/templates/switch/stores.phtml index eaacc32d75d67..258fcec1469d0 100644 --- a/app/code/Magento/Store/view/frontend/templates/switch/stores.phtml +++ b/app/code/Magento/Store/view/frontend/templates/switch/stores.phtml @@ -30,22 +30,28 @@ */ ?> getGroups())>1): ?> -
    - -