diff --git a/app/code/Magento/Braintree/view/adminhtml/templates/form/paypal/vault.phtml b/app/code/Magento/Braintree/view/adminhtml/templates/form/paypal/vault.phtml
index ef3edc75fa589..93f0d07717ca5 100644
--- a/app/code/Magento/Braintree/view/adminhtml/templates/form/paypal/vault.phtml
+++ b/app/code/Magento/Braintree/view/adminhtml/templates/form/paypal/vault.phtml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js b/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js
index af0fac558d89f..5e1e85e6a3c48 100644
--- a/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js
+++ b/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
diff --git a/app/code/Magento/Braintree/view/adminhtml/web/js/grid/filters/status.html b/app/code/Magento/Braintree/view/adminhtml/web/js/grid/filters/status.html
index f69cbcc619846..63fa308beee48 100644
--- a/app/code/Magento/Braintree/view/adminhtml/web/js/grid/filters/status.html
+++ b/app/code/Magento/Braintree/view/adminhtml/web/js/grid/filters/status.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Braintree/view/adminhtml/web/js/grid/provider.js b/app/code/Magento/Braintree/view/adminhtml/web/js/grid/provider.js
index 8b1380f6029be..373b01d5eaa7e 100644
--- a/app/code/Magento/Braintree/view/adminhtml/web/js/grid/provider.js
+++ b/app/code/Magento/Braintree/view/adminhtml/web/js/grid/provider.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Braintree/view/adminhtml/web/js/vault.js b/app/code/Magento/Braintree/view/adminhtml/web/js/vault.js
index 47decbb18bdbe..a1a1c81d27c3d 100644
--- a/app/code/Magento/Braintree/view/adminhtml/web/js/vault.js
+++ b/app/code/Magento/Braintree/view/adminhtml/web/js/vault.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
diff --git a/app/code/Magento/Braintree/view/adminhtml/web/styles.css b/app/code/Magento/Braintree/view/adminhtml/web/styles.css
index 19a4f794fb428..3c9daaaee72f7 100644
--- a/app/code/Magento/Braintree/view/adminhtml/web/styles.css
+++ b/app/code/Magento/Braintree/view/adminhtml/web/styles.css
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Braintree/view/base/web/js/validator.js b/app/code/Magento/Braintree/view/base/web/js/validator.js
index 931774aaffa2d..3ed678cfb7eac 100644
--- a/app/code/Magento/Braintree/view/base/web/js/validator.js
+++ b/app/code/Magento/Braintree/view/base/web/js/validator.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
diff --git a/app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml b/app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml
index a5125861a048f..ce1c866f1cb6e 100644
--- a/app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml
+++ b/app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Braintree/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Braintree/view/frontend/layout/checkout_index_index.xml
index 872cb7d51ce1f..ab294f8e797b7 100644
--- a/app/code/Magento/Braintree/view/frontend/layout/checkout_index_index.xml
+++ b/app/code/Magento/Braintree/view/frontend/layout/checkout_index_index.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Braintree/view/frontend/layout/vault_cards_listaction.xml b/app/code/Magento/Braintree/view/frontend/layout/vault_cards_listaction.xml
index 1ab68abf1976d..f94eafa0f6f76 100644
--- a/app/code/Magento/Braintree/view/frontend/layout/vault_cards_listaction.xml
+++ b/app/code/Magento/Braintree/view/frontend/layout/vault_cards_listaction.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Braintree/view/frontend/requirejs-config.js b/app/code/Magento/Braintree/view/frontend/requirejs-config.js
index e12a4dd87043e..8b347d799007a 100644
--- a/app/code/Magento/Braintree/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Braintree/view/frontend/requirejs-config.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml b/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml
index 5fc4bf83cab28..a244833051082 100644
--- a/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml
+++ b/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html
index 8df52975917b9..ae1df2a195d35 100644
--- a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html
+++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal/vault.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal/vault.html
index 28cd3ebb2f2d1..b9402da02cc8a 100644
--- a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal/vault.html
+++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal/vault.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Bundle/Api/Data/BundleOptionInterface.php b/app/code/Magento/Bundle/Api/Data/BundleOptionInterface.php
index 5ef6c2971b18b..f8051bb7895e4 100644
--- a/app/code/Magento/Bundle/Api/Data/BundleOptionInterface.php
+++ b/app/code/Magento/Bundle/Api/Data/BundleOptionInterface.php
@@ -1,6 +1,6 @@
"product[{$switchAttributeCode}]",
'values' => $this->getOptions(),
- 'value' => $switchAttributeCode,
'class' => 'required-entry next-toinput',
'no_span' => true,
'disabled' => $this->isDisabledField(),
diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php
index 800f79f56f15f..b3e52e5560cc2 100644
--- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php
+++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php
@@ -1,6 +1,6 @@
getOrderItem()->getId()])) {
return $itemsArray[$item->getOrderItem()->getId()];
- } else {
- return null;
}
+ return null;
}
/**
@@ -186,9 +185,8 @@ public function getOrderItem()
{
if ($this->getItem() instanceof \Magento\Sales\Model\Order\Item) {
return $this->getItem();
- } else {
- return $this->getItem()->getOrderItem();
}
+ return $this->getItem()->getOrderItem();
}
/**
diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php
index a41896f139d9d..d0d68c8415b38 100644
--- a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php
+++ b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php
@@ -1,6 +1,6 @@
getSelectionId(), $selectedOptions);
} elseif ($selectedOptions == 'None') {
return false;
- } else {
- return $selection->getIsDefault() && $selection->isSaleable();
}
+ return $selection->getIsDefault() && $selection->isSaleable();
}
/**
diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php
index c79b4605e847e..6a03124901235 100644
--- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php
+++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php
@@ -1,6 +1,6 @@
getSelectionAttributes($item)) {
return sprintf('%d', $attributes['qty']) . ' x ' . $this->escapeHtml($item->getName()) . " "
. $this->getOrder()->formatPrice($attributes['price']);
- } else {
- return $this->escapeHtml($item->getName());
}
+ return $this->escapeHtml($item->getName());
}
/**
@@ -151,9 +150,8 @@ public function getChildren($item)
if (isset($itemsArray[$item->getOrderItem()->getId()])) {
return $itemsArray[$item->getOrderItem()->getId()];
- } else {
- return null;
}
+ return null;
}
/**
diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/AddAttributeToTemplate.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/AddAttributeToTemplate.php
index d37f4ff77fd91..a3125aa868eff 100644
--- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/AddAttributeToTemplate.php
+++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/AddAttributeToTemplate.php
@@ -1,7 +1,7 @@
setBundleOptionsData($result['bundle_options']);
}
+
$this->processBundleOptionsData($product);
$this->processDynamicOptionsData($product);
+ } elseif (!$compositeReadonly) {
+ $extension = $product->getExtensionAttributes();
+ $extension->setBundleProductOptions([]);
+ $product->setExtensionAttributes($extension);
}
$affectProductSelections = (bool)$this->request->getPost('affect_bundle_product_selections');
@@ -127,13 +132,11 @@ protected function processBundleOptionsData(\Magento\Catalog\Model\Product $prod
}
$options = [];
foreach ($bundleOptionsData as $key => $optionData) {
- if ((bool)$optionData['delete']) {
- continue;
- }
-
$option = $this->optionFactory->create(['data' => $optionData]);
$option->setSku($product->getSku());
- $option->setOptionId(null);
+ if (!$option->getOptionId()) {
+ $option->setOptionId(null);
+ }
$links = [];
$bundleLinks = $product->getBundleSelectionsData();
diff --git a/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php b/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php
index 2b33451d299d4..59f4fa25ede98 100644
--- a/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php
+++ b/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php
@@ -1,6 +1,6 @@
productRepository->get($sku, true);
+ $product = $this->productRepository->get($sku, true, null, true);
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
throw new InputException(__('Only implemented for bundle product'));
}
diff --git a/app/code/Magento/Bundle/Model/OptionTypeList.php b/app/code/Magento/Bundle/Model/OptionTypeList.php
index f35f46caa2442..6415a3d6daa8f 100644
--- a/app/code/Magento/Bundle/Model/OptionTypeList.php
+++ b/app/code/Magento/Bundle/Model/OptionTypeList.php
@@ -1,7 +1,7 @@
getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC
) {
return true;
- } else {
- return $proceed($object);
}
+ return $proceed($object);
}
}
diff --git a/app/code/Magento/Bundle/Model/Plugin/Product.php b/app/code/Magento/Bundle/Model/Plugin/Product.php
index 28792dbe6685b..b0f8d1af32fc2 100644
--- a/app/code/Magento/Bundle/Model/Plugin/Product.php
+++ b/app/code/Magento/Bundle/Model/Plugin/Product.php
@@ -1,6 +1,6 @@
getExtensionAttributes()->getBundleProductOptions();
- if ($entity->getTypeId() !== 'bundle' || empty($bundleProductOptions)) {
+ if ($entity->getTypeId() !== Type::TYPE_CODE || empty($bundleProductOptions)) {
return $entity;
}
+ $existingBundleProductOptions = $this->optionRepository->getList($entity->getSku());
+
+ $existingOptionsIds = !empty($existingBundleProductOptions)
+ ? $this->getOptionIds($existingBundleProductOptions)
+ : [];
+ $optionIds = !empty($bundleProductOptions)
+ ? $this->getOptionIds($bundleProductOptions)
+ : [];
+
+ $options = $bundleProductOptions ?: [];
+
if (!$entity->getCopyFromView()) {
- /** @var \Magento\Catalog\Api\Data\ProductInterface $entity */
- foreach ($this->optionRepository->getList($entity->getSku()) as $option) {
- $this->removeOptionLinks($entity->getSku(), $option);
- $this->optionRepository->delete($option);
- }
+ $this->processRemovedOptions($entity->getSku(), $existingOptionsIds, $optionIds);
+ $this->processExistingOptions($entity->getSku(), $existingOptionsIds, $optionIds);
- $options = $bundleProductOptions ?: [];
- foreach ($options as $option) {
- $option->setOptionId(null);
- $this->optionRepository->save($entity, $option);
- }
+ $newOptionsIds = array_diff($optionIds, $existingOptionsIds);
+ $this->saveOptions($entity, $options, $newOptionsIds);
} else {
//save only labels and not selections + product links
- $options = $bundleProductOptions ?: [];
- foreach ($options as $option) {
- $this->optionRepository->save($entity, $option);
- $entity->setCopyFromView(false);
- }
+ $this->saveOptions($entity, $options);
+ $entity->setCopyFromView(false);
}
return $entity;
}
@@ -75,6 +81,8 @@ public function execute($entity, $arguments = [])
/**
* @param string $entitySku
* @param \Magento\Bundle\Api\Data\OptionInterface $option
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
+ * @throws \Magento\Framework\Exception\InputException
* @return void
*/
protected function removeOptionLinks($entitySku, $option)
@@ -86,4 +94,85 @@ protected function removeOptionLinks($entitySku, $option)
}
}
}
+
+ /**
+ * Perform save for all options entities
+ *
+ * @param ProductInterface $entity
+ * @param array $options
+ * @param array $newOptionsIds
+ * @throws \Magento\Framework\Exception\CouldNotSaveException
+ * @throws \Magento\Framework\Exception\InputException
+ * @return void
+ */
+ private function saveOptions(ProductInterface $entity, array $options, array $newOptionsIds = [])
+ {
+ foreach ($options as $option) {
+ if (in_array($option->getOptionId(), $newOptionsIds, true)) {
+ $option->setOptionId(null);
+ }
+ $this->optionRepository->save($entity, $option);
+ }
+ }
+
+ /**
+ * Get options ids from array of the options entities
+ *
+ * @param array $options
+ * @return array
+ */
+ private function getOptionIds(array $options)
+ {
+ $optionIds = [];
+
+ if (empty($options)) {
+ return $optionIds;
+ }
+
+ /** @var \Magento\Bundle\Api\Data\OptionInterface $option */
+ foreach ($options as $option) {
+ if ($option->getOptionId()) {
+ $optionIds[] = $option->getOptionId();
+ }
+ }
+ return $optionIds;
+ }
+
+ /**
+ * Removes old options that no longer exists
+ *
+ * @param string $entitySku
+ * @param array $existingOptionsIds
+ * @param array $optionIds
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
+ * @throws \Magento\Framework\Exception\InputException
+ * @throws \Magento\Framework\Exception\CouldNotSaveException
+ * @return void
+ */
+ private function processRemovedOptions($entitySku, array $existingOptionsIds, array $optionIds)
+ {
+ foreach (array_diff($existingOptionsIds, $optionIds) as $optionId) {
+ $option = $this->optionRepository->get($entitySku, $optionId);
+ $this->removeOptionLinks($entitySku, $option);
+ $this->optionRepository->delete($option);
+ }
+ }
+
+ /**
+ * Removes option links for existing options
+ *
+ * @param string $entitySku
+ * @param array $existingOptionsIds
+ * @param array $optionIds
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
+ * @throws \Magento\Framework\Exception\InputException
+ * @return void
+ */
+ private function processExistingOptions($entitySku, array $existingOptionsIds, array $optionIds)
+ {
+ foreach (array_intersect($optionIds, $existingOptionsIds) as $optionId) {
+ $option = $this->optionRepository->get($entitySku, $optionId);
+ $this->removeOptionLinks($entitySku, $option);
+ }
+ }
}
diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php
index 033762113d081..affabcb7be4f3 100644
--- a/app/code/Magento/Bundle/Model/Product/Type.php
+++ b/app/code/Magento/Bundle/Model/Product/Type.php
@@ -1,6 +1,6 @@
join(
['e' => $this->getTable('catalog_product_entity')],
- "i.entity_id=e.$linkField",
+ "i.entity_id=e.entity_id",
[]
)->where(
'e.type_id=?',
@@ -502,7 +502,7 @@ protected function _prepareTierPriceIndex($entityIds = null)
$select = $connection->select()->from(
['tp' => $this->getTable('catalog_product_entity_tier_price')],
- [$linkField]
+ ['e.entity_id']
)->join(
['e' => $this->getTable('catalog_product_entity')],
"tp.{$linkField} = e.{$linkField}",
@@ -523,11 +523,11 @@ protected function _prepareTierPriceIndex($entityIds = null)
)->columns(
new \Zend_Db_Expr('MIN(tp.value)')
)->group(
- ["tp.{$linkField}", 'cg.customer_group_id', 'cw.website_id']
+ ['e.entity_id', 'cg.customer_group_id', 'cw.website_id']
);
if (!empty($entityIds)) {
- $select->where("tp.{$linkField} IN(?)", $entityIds);
+ $select->where('e.entity_id IN(?)', $entityIds);
}
$query = $select->insertFromSelect($this->_getTierPriceIndexTable());
diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Stock.php b/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Stock.php
index c05c1dc8b7fa2..4448ebe8c5bd8 100644
--- a/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Stock.php
+++ b/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Stock.php
@@ -1,6 +1,6 @@
getOrderItem()->getId()])) {
return $itemsArray[$item->getOrderItem()->getId()];
- } else {
- return null;
}
+ return null;
}
/**
@@ -196,9 +195,8 @@ public function getOrderItem()
{
if ($this->getItem() instanceof \Magento\Sales\Model\Order\Item) {
return $this->getItem();
- } else {
- return $this->getItem()->getOrderItem();
}
+ return $this->getItem()->getOrderItem();
}
/**
diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php
index 408582343e503..6576763b4dd36 100644
--- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php
+++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php
@@ -1,6 +1,6 @@
getPriceType() == Price::PRICE_TYPE_FIXED) {
return $this->calculateFixedBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude);
- } else {
- return $this->calculateDynamicBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude);
}
+ return $this->calculateDynamicBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude);
}
/**
diff --git a/app/code/Magento/Bundle/Pricing/Price/BundleOptionPrice.php b/app/code/Magento/Bundle/Pricing/Price/BundleOptionPrice.php
index 0ab3cbdfbe0cf..3ca37fb55cbcf 100644
--- a/app/code/Magento/Bundle/Pricing/Price/BundleOptionPrice.php
+++ b/app/code/Magento/Bundle/Pricing/Price/BundleOptionPrice.php
@@ -1,6 +1,6 @@
bundleProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC) {
return parent::getProduct();
- } else {
- return $this->bundleProduct;
}
+ return $this->bundleProduct;
}
}
diff --git a/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php b/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php
index ed1c69fa5f547..4f2f35b076d82 100644
--- a/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php
+++ b/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php
@@ -1,6 +1,6 @@
priceInfo
->getPrice(BundleDiscountPrice::PRICE_CODE)
->calculateDiscount($configuredOptionsAmount);
- } else {
- return parent::getValue();
}
+ return parent::getValue();
}
/**
diff --git a/app/code/Magento/Bundle/Pricing/Price/DiscountCalculator.php b/app/code/Magento/Bundle/Pricing/Price/DiscountCalculator.php
index 032e436239c14..6990149efc373 100644
--- a/app/code/Magento/Bundle/Pricing/Price/DiscountCalculator.php
+++ b/app/code/Magento/Bundle/Pricing/Price/DiscountCalculator.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Bundle/etc/adminhtml/events.xml b/app/code/Magento/Bundle/etc/adminhtml/events.xml
index cd8af005694ea..ff0fa5d58dc23 100644
--- a/app/code/Magento/Bundle/etc/adminhtml/events.xml
+++ b/app/code/Magento/Bundle/etc/adminhtml/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/adminhtml/routes.xml b/app/code/Magento/Bundle/etc/adminhtml/routes.xml
index d2e7c9c3b20f9..926190c8a1f85 100644
--- a/app/code/Magento/Bundle/etc/adminhtml/routes.xml
+++ b/app/code/Magento/Bundle/etc/adminhtml/routes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/catalog_attributes.xml b/app/code/Magento/Bundle/etc/catalog_attributes.xml
index 8c45aaab6c46f..5a96484ca1014 100644
--- a/app/code/Magento/Bundle/etc/catalog_attributes.xml
+++ b/app/code/Magento/Bundle/etc/catalog_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/config.xml b/app/code/Magento/Bundle/etc/config.xml
index 0016210cd149d..152f04e251c35 100644
--- a/app/code/Magento/Bundle/etc/config.xml
+++ b/app/code/Magento/Bundle/etc/config.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml
index 2899ce28d0400..d3cb063ce0d03 100644
--- a/app/code/Magento/Bundle/etc/di.xml
+++ b/app/code/Magento/Bundle/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/extension_attributes.xml b/app/code/Magento/Bundle/etc/extension_attributes.xml
index d23dfc71b39fc..a8bd6e1872cd0 100644
--- a/app/code/Magento/Bundle/etc/extension_attributes.xml
+++ b/app/code/Magento/Bundle/etc/extension_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/frontend/di.xml b/app/code/Magento/Bundle/etc/frontend/di.xml
index 084f681df7e03..54f6d3b4b0f42 100644
--- a/app/code/Magento/Bundle/etc/frontend/di.xml
+++ b/app/code/Magento/Bundle/etc/frontend/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/frontend/events.xml b/app/code/Magento/Bundle/etc/frontend/events.xml
index d08cdb4bcc997..d4505c8a5337e 100644
--- a/app/code/Magento/Bundle/etc/frontend/events.xml
+++ b/app/code/Magento/Bundle/etc/frontend/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml
index 77b78dcc43284..86085d8301142 100644
--- a/app/code/Magento/Bundle/etc/module.xml
+++ b/app/code/Magento/Bundle/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/pdf.xml b/app/code/Magento/Bundle/etc/pdf.xml
index 912aa1426efa1..24f46afb5b9ba 100644
--- a/app/code/Magento/Bundle/etc/pdf.xml
+++ b/app/code/Magento/Bundle/etc/pdf.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/product_types.xml b/app/code/Magento/Bundle/etc/product_types.xml
index 6168189a3b4e3..75c2e5970e440 100644
--- a/app/code/Magento/Bundle/etc/product_types.xml
+++ b/app/code/Magento/Bundle/etc/product_types.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/sales.xml b/app/code/Magento/Bundle/etc/sales.xml
index 3094eb6bfecfa..4d632b3a5b3ab 100644
--- a/app/code/Magento/Bundle/etc/sales.xml
+++ b/app/code/Magento/Bundle/etc/sales.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/webapi.xml b/app/code/Magento/Bundle/etc/webapi.xml
index 69124309687a3..79aa530ef38a3 100644
--- a/app/code/Magento/Bundle/etc/webapi.xml
+++ b/app/code/Magento/Bundle/etc/webapi.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/webapi_rest/di.xml b/app/code/Magento/Bundle/etc/webapi_rest/di.xml
index 084f681df7e03..54f6d3b4b0f42 100644
--- a/app/code/Magento/Bundle/etc/webapi_rest/di.xml
+++ b/app/code/Magento/Bundle/etc/webapi_rest/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/etc/webapi_soap/di.xml b/app/code/Magento/Bundle/etc/webapi_soap/di.xml
index 084f681df7e03..54f6d3b4b0f42 100644
--- a/app/code/Magento/Bundle/etc/webapi_soap/di.xml
+++ b/app/code/Magento/Bundle/etc/webapi_soap/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/registration.php b/app/code/Magento/Bundle/registration.php
index 53f3657ae0519..3a3dacddd5079 100644
--- a/app/code/Magento/Bundle/registration.php
+++ b/app/code/Magento/Bundle/registration.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml
index 6b97971a0ee51..163fc2b7b20f4 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml
@@ -1,7 +1,7 @@
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 d0fdb184355d7..46bc496e67a9e 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
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_new.xml
index a496ea7538923..34f47b745b8e9 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_new.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_new.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_view_type_bundle.xml b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_view_type_bundle.xml
index 15374cb987d36..ad7b4d4a45843 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_view_type_bundle.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_view_type_bundle.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml b/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml
index 7e37070109921..2b53db52b797a 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_new.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_new.xml
index 99fdab5a7e9f4..b75d2c5345897 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_new.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_new.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml
index 99fdab5a7e9f4..b75d2c5345897 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_view.xml
index 323aba1d186e6..d8fff02a12cba 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_view.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_view.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_new.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_new.xml
index b03ce7a9cb451..47fb17196268a 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_new.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_new.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_updateqty.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_updateqty.xml
index b03ce7a9cb451..47fb17196268a 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_updateqty.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_updateqty.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_view.xml
index 34c3470cf06a7..3a38ec4003e1a 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_view.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_view.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_view.xml
index 62f0305194fa9..f3ce4b214b599 100644
--- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_view.xml
+++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_view.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml
index 84e87afd48180..46f1e155c89a6 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml
index 41923c4826432..f5340c1cbdde6 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css b/app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css
index d5aed8a7d652e..15a15d3d6249c 100644
--- a/app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css
+++ b/app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js
index 53b08e43614a0..6ce0c1be59adc 100644
--- a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js
+++ b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true jquery:true*/
diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js
index 7f4a57cb530da..c65ff76c8db94 100644
--- a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js
+++ b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true jquery:true expr:true*/
diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js
index 9c2432bade43f..aedb6c44ac751 100644
--- a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js
+++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js
index cee0489cc901a..6705d568705f9 100644
--- a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js
+++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js
index 7b5734c7451ea..40e72dc4361af 100644
--- a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js
+++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Bundle/view/base/layout/catalog_product_prices.xml b/app/code/Magento/Bundle/view/base/layout/catalog_product_prices.xml
index 5f7d22ba2650b..40419ebfa91e1 100644
--- a/app/code/Magento/Bundle/view/base/layout/catalog_product_prices.xml
+++ b/app/code/Magento/Bundle/view/base/layout/catalog_product_prices.xml
@@ -1,7 +1,7 @@
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 efd75677d3061..095e14e1513a7 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
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml
index fedd29f952b02..6bd2fcb77443f 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml
index adb1b2911983b..fb0efe0cd9edf 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml
index 9abf0a4018980..5137782656269 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml
index ddede2340995b..dce5945e3221d 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/default.xml b/app/code/Magento/Bundle/view/frontend/layout/default.xml
index cb14616af5980..092aab97fb71c 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/default.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/default.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml
index 991011db9fa08..ddd85d3b9f846 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml
index 0e32c9fd9e816..f5fee7a6ccd1d 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml
index 927214fbcc174..46471b57ce142 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml
index 7463caa738083..846d5286eed0e 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml
index c94b4957d267b..ab8bc480c08af 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml
index d07959385bd9f..a89da856cd52a 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml
index fb26de5bc2fdd..125007b2c4ba7 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml
index 8c328c87a5c65..20c2dfa05b73b 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml
index 57e39795df7da..513912eff5d3e 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml
index 510168ac55e8a..34216f4e8eb7b 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml
index f46b6260f3bd8..11b78d15c44a6 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml
index 536953423a3f2..f861b34032147 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Bundle/view/frontend/requirejs-config.js b/app/code/Magento/Bundle/view/frontend/requirejs-config.js
index 51ab4cab6bb2c..753c9cf89251d 100644
--- a/app/code/Magento/Bundle/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Bundle/view/frontend/requirejs-config.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml
index 86cd52b6dc6fd..8ab61e349b69c 100644
--- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml
+++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml
index e3538ebd6caea..559ca5dc820a9 100644
--- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml
+++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml
index 0fc7e6f9c8f06..4278095b4cdb4 100644
--- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml
+++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/BundleImportExport/etc/export.xml b/app/code/Magento/BundleImportExport/etc/export.xml
index c7fd951bfab53..dcbd9521027c0 100644
--- a/app/code/Magento/BundleImportExport/etc/export.xml
+++ b/app/code/Magento/BundleImportExport/etc/export.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/BundleImportExport/etc/import.xml b/app/code/Magento/BundleImportExport/etc/import.xml
index 8daa5296a8c39..4b0761db4d3ba 100644
--- a/app/code/Magento/BundleImportExport/etc/import.xml
+++ b/app/code/Magento/BundleImportExport/etc/import.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/BundleImportExport/etc/module.xml b/app/code/Magento/BundleImportExport/etc/module.xml
index 64f2c06b3c770..e324145cabcca 100644
--- a/app/code/Magento/BundleImportExport/etc/module.xml
+++ b/app/code/Magento/BundleImportExport/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/BundleImportExport/registration.php b/app/code/Magento/BundleImportExport/registration.php
index b4f80e749f130..368032565e588 100644
--- a/app/code/Magento/BundleImportExport/registration.php
+++ b/app/code/Magento/BundleImportExport/registration.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CacheInvalidate/etc/module.xml b/app/code/Magento/CacheInvalidate/etc/module.xml
index b3277477fb62d..dda90ba8b38ab 100644
--- a/app/code/Magento/CacheInvalidate/etc/module.xml
+++ b/app/code/Magento/CacheInvalidate/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CacheInvalidate/registration.php b/app/code/Magento/CacheInvalidate/registration.php
index 00ddee3f6776b..2484edf8e215d 100644
--- a/app/code/Magento/CacheInvalidate/registration.php
+++ b/app/code/Magento/CacheInvalidate/registration.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Captcha/etc/adminhtml/events.xml b/app/code/Magento/Captcha/etc/adminhtml/events.xml
index 7fcadbfd8f2ff..e9de9bc1888f8 100644
--- a/app/code/Magento/Captcha/etc/adminhtml/events.xml
+++ b/app/code/Magento/Captcha/etc/adminhtml/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/adminhtml/routes.xml b/app/code/Magento/Captcha/etc/adminhtml/routes.xml
index 6b6b6717c489a..4d48e6334f298 100644
--- a/app/code/Magento/Captcha/etc/adminhtml/routes.xml
+++ b/app/code/Magento/Captcha/etc/adminhtml/routes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/adminhtml/system.xml b/app/code/Magento/Captcha/etc/adminhtml/system.xml
index 88f0ae27f91c7..a05430989418d 100644
--- a/app/code/Magento/Captcha/etc/adminhtml/system.xml
+++ b/app/code/Magento/Captcha/etc/adminhtml/system.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/config.xml b/app/code/Magento/Captcha/etc/config.xml
index d969626d73144..f754bdbe60ea3 100644
--- a/app/code/Magento/Captcha/etc/config.xml
+++ b/app/code/Magento/Captcha/etc/config.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/crontab.xml b/app/code/Magento/Captcha/etc/crontab.xml
index d3d6e30e1a03a..09909ffbc9743 100644
--- a/app/code/Magento/Captcha/etc/crontab.xml
+++ b/app/code/Magento/Captcha/etc/crontab.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/crontab/di.xml b/app/code/Magento/Captcha/etc/crontab/di.xml
index f3086b469842b..4a8616059787d 100644
--- a/app/code/Magento/Captcha/etc/crontab/di.xml
+++ b/app/code/Magento/Captcha/etc/crontab/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/di.xml b/app/code/Magento/Captcha/etc/di.xml
index db624420ba647..28964152809f7 100644
--- a/app/code/Magento/Captcha/etc/di.xml
+++ b/app/code/Magento/Captcha/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/events.xml b/app/code/Magento/Captcha/etc/events.xml
index 4223c4a2a3256..e3ddd19de2d12 100644
--- a/app/code/Magento/Captcha/etc/events.xml
+++ b/app/code/Magento/Captcha/etc/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/frontend/di.xml b/app/code/Magento/Captcha/etc/frontend/di.xml
index 209f9beb71a04..225e62c8e8203 100644
--- a/app/code/Magento/Captcha/etc/frontend/di.xml
+++ b/app/code/Magento/Captcha/etc/frontend/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/frontend/events.xml b/app/code/Magento/Captcha/etc/frontend/events.xml
index dfa0d1b428557..2f318d305f68f 100644
--- a/app/code/Magento/Captcha/etc/frontend/events.xml
+++ b/app/code/Magento/Captcha/etc/frontend/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/frontend/routes.xml b/app/code/Magento/Captcha/etc/frontend/routes.xml
index d4bbe64821a91..895f18feecb4c 100644
--- a/app/code/Magento/Captcha/etc/frontend/routes.xml
+++ b/app/code/Magento/Captcha/etc/frontend/routes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/etc/module.xml b/app/code/Magento/Captcha/etc/module.xml
index 698604928afb6..03ab6dbee3991 100644
--- a/app/code/Magento/Captcha/etc/module.xml
+++ b/app/code/Magento/Captcha/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/i18n/en_US.csv b/app/code/Magento/Captcha/i18n/en_US.csv
index 2de4ab5345c88..e9ab30df6a0ca 100644
--- a/app/code/Magento/Captcha/i18n/en_US.csv
+++ b/app/code/Magento/Captcha/i18n/en_US.csv
@@ -20,11 +20,7 @@ Forms,Forms
"Number of Symbols","Number of Symbols"
"Please specify 8 symbols at the most. Range allowed (e.g. 3-5)","Please specify 8 symbols at the most. Range allowed (e.g. 3-5)"
"Symbols Used in CAPTCHA","Symbols Used in CAPTCHA"
-"
- Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.
Similar looking characters (e.g. ""i"", ""l"", ""1"") decrease chance of correct recognition by customer.
- ","
- Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.
Similar looking characters (e.g. ""i"", ""l"", ""1"") decrease chance of correct recognition by customer.
- "
+"Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.
Similar looking characters (e.g. ""i"", ""l"", ""1"") decrease chance of correct recognition by customer.","Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.
Similar looking characters (e.g. ""i"", ""l"", ""1"") decrease chance of correct recognition by customer."
"Case Sensitive","Case Sensitive"
"Enable CAPTCHA on Storefront","Enable CAPTCHA on Storefront"
"CAPTCHA for ""Create user"" and ""Forgot password"" forms is always enabled if chosen.","CAPTCHA for ""Create user"" and ""Forgot password"" forms is always enabled if chosen."
diff --git a/app/code/Magento/Captcha/registration.php b/app/code/Magento/Captcha/registration.php
index 488ac412a8926..1413bc36ff180 100644
--- a/app/code/Magento/Captcha/registration.php
+++ b/app/code/Magento/Captcha/registration.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Captcha/view/adminhtml/layout/adminhtml_auth_login.xml b/app/code/Magento/Captcha/view/adminhtml/layout/adminhtml_auth_login.xml
index 8c093257f1790..f9ac960dcfa97 100644
--- a/app/code/Magento/Captcha/view/adminhtml/layout/adminhtml_auth_login.xml
+++ b/app/code/Magento/Captcha/view/adminhtml/layout/adminhtml_auth_login.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml b/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml
index ffffcc4196bb1..8f3c6bf55a857 100644
--- a/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml
+++ b/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml b/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml
index 1460d8fac6974..df6de5b162c26 100644
--- a/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml
+++ b/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml
index cd72cc5857b83..1ba5debf29692 100644
--- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml
+++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_edit.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_edit.xml
index 9700e88006f10..826e288920d25 100644
--- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_edit.xml
+++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_edit.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml
index 1f25fa040b591..cbaabf6332d86 100644
--- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml
+++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml
index 3a24e44fd1afe..50d99cf638f53 100644
--- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml
+++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/view/frontend/layout/default.xml b/app/code/Magento/Captcha/view/frontend/layout/default.xml
index 43a770c54c0ca..5015d6b021cd9 100644
--- a/app/code/Magento/Captcha/view/frontend/layout/default.xml
+++ b/app/code/Magento/Captcha/view/frontend/layout/default.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Captcha/view/frontend/requirejs-config.js b/app/code/Magento/Captcha/view/frontend/requirejs-config.js
index ff1d9f1acc7b1..3b322711f8b1f 100644
--- a/app/code/Magento/Captcha/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Captcha/view/frontend/requirejs-config.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Captcha/view/frontend/templates/default.phtml b/app/code/Magento/Captcha/view/frontend/templates/default.phtml
index d8e11113d7707..f2058e959242d 100644
--- a/app/code/Magento/Captcha/view/frontend/templates/default.phtml
+++ b/app/code/Magento/Captcha/view/frontend/templates/default.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/Api/AttributeSetFinderInterface.php b/app/code/Magento/Catalog/Api/AttributeSetFinderInterface.php
index c7df36623ff83..41b569b7d0684 100644
--- a/app/code/Magento/Catalog/Api/AttributeSetFinderInterface.php
+++ b/app/code/Magento/Catalog/Api/AttributeSetFinderInterface.php
@@ -1,7 +1,7 @@
'options',
'options' => ['1' => __('Yes'), '0' => __('No')],
'align' => 'center'
- ],
- 'is_user_defined'
+ ]
);
$this->_eventManager->dispatch('product_attribute_grid_build', ['grid' => $this]);
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Attributes.php
index 764dc9c8bb0cc..d93d4c98cf45c 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Attributes.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Attributes.php
@@ -1,6 +1,6 @@
*/
-use Magento\Catalog\Model\Entity\Product\Attribute\Group\AttributeMapperInterface;
-
class Main extends \Magento\Backend\Block\Template
{
/**
@@ -89,25 +90,25 @@ protected function _prepareLayout()
{
$setId = $this->_getSetId();
- $this->addChild('group_tree', 'Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main\Tree\Group');
+ $this->addChild('group_tree', \Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main\Tree\Group::class);
- $this->addChild('edit_set_form', 'Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main\Formset');
+ $this->addChild('edit_set_form', \Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main\Formset::class);
$this->addChild(
'delete_group_button',
- 'Magento\Backend\Block\Widget\Button',
+ \Magento\Backend\Block\Widget\Button::class,
['label' => __('Delete Selected Group'), 'onclick' => 'editSet.submit();', 'class' => 'delete']
);
$this->addChild(
'add_group_button',
- 'Magento\Backend\Block\Widget\Button',
+ \Magento\Backend\Block\Widget\Button::class,
['label' => __('Add New'), 'onclick' => 'editSet.addGroup();', 'class' => 'add']
);
$this->getToolbar()->addChild(
'back_button',
- 'Magento\Backend\Block\Widget\Button',
+ \Magento\Backend\Block\Widget\Button::class,
[
'label' => __('Back'),
'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/') . '\')',
@@ -117,14 +118,14 @@ protected function _prepareLayout()
$this->getToolbar()->addChild(
'reset_button',
- 'Magento\Backend\Block\Widget\Button',
+ \Magento\Backend\Block\Widget\Button::class,
['label' => __('Reset'), 'onclick' => 'window.location.reload()', 'class' => 'reset']
);
if (!$this->getIsCurrentSetDefault()) {
$this->getToolbar()->addChild(
'delete_button',
- 'Magento\Backend\Block\Widget\Button',
+ \Magento\Backend\Block\Widget\Button::class,
[
'label' => __('Delete'),
'onclick' => 'deleteConfirm(\'' . $this->escapeJsQuote(
@@ -143,7 +144,7 @@ protected function _prepareLayout()
$this->getToolbar()->addChild(
'save_button',
- 'Magento\Backend\Block\Widget\Button',
+ \Magento\Backend\Block\Widget\Button::class,
[
'label' => __('Save'),
'onclick' => 'editSet.save();',
@@ -153,7 +154,7 @@ protected function _prepareLayout()
$this->addChild(
'rename_button',
- 'Magento\Backend\Block\Widget\Button',
+ \Magento\Backend\Block\Widget\Button::class,
['label' => __('New Set Name'), 'onclick' => 'editSet.rename()']
);
@@ -228,7 +229,7 @@ public function getGroupTreeJson()
/* @var $node \Magento\Eav\Model\Entity\Attribute\Group */
foreach ($groups as $node) {
$item = [];
- $item['text'] = $node->getAttributeGroupName();
+ $item['text'] = $this->escapeHtml($node->getAttributeGroupName());
$item['id'] = $node->getAttributeGroupId();
$item['cls'] = 'folder';
$item['allowDrop'] = true;
@@ -275,7 +276,7 @@ public function getAttributeTreeJson()
foreach ($attributes as $child) {
$attr = [
- 'text' => $child->getAttributeCode(),
+ 'text' => $this->escapeHtml($child->getAttributeCode()),
'id' => $child->getAttributeId(),
'cls' => 'leaf',
'allowDrop' => false,
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formattribute.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formattribute.php
index a8c0d8f5e76b8..1626b6760c9a7 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formattribute.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formattribute.php
@@ -1,6 +1,6 @@
getResizedImageInfo();
+ try {
+ $imagesize = $helper->getResizedImageInfo();
+ } catch (NotLoadInfoImageException $exception) {
+ $imagesize = [$helper->getWidth(), $helper->getHeight()];
+ }
$data = [
'data' => [
@@ -140,8 +145,8 @@ public function create()
'label' => $helper->getLabel(),
'ratio' => $this->getRatio($helper),
'custom_attributes' => $this->getCustomAttributes(),
- 'resized_image_width' => !empty($imagesize[0]) ? $imagesize[0] : $helper->getWidth(),
- 'resized_image_height' => !empty($imagesize[1]) ? $imagesize[1] : $helper->getHeight(),
+ 'resized_image_width' => $imagesize[0],
+ 'resized_image_height' => $imagesize[1],
],
];
diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php
index e0a5f46573688..386fcf8eff9b2 100644
--- a/app/code/Magento/Catalog/Block/Product/ListProduct.php
+++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php
@@ -1,6 +1,6 @@
_getProductCollection() as $item) {
- $identities = array_merge($identities, $item->getIdentities());
- }
+
$category = $this->getLayer()->getCurrentCategory();
if ($category) {
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $category->getId();
}
+
+ //Check if category page shows only static block (No products)
+ if ($category->getData('display_mode') == Category::DM_PAGE) {
+ return $identities;
+ }
+
+ foreach ($this->_getProductCollection() as $item) {
+ $identities = array_merge($identities, $item->getIdentities());
+ }
+
return $identities;
}
@@ -332,7 +340,7 @@ public function getIdentities()
* Get post parameters
*
* @param \Magento\Catalog\Model\Product $product
- * @return string
+ * @return array
*/
public function getAddToCartPostParams(\Magento\Catalog\Model\Product $product)
{
diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php
index 11bb639ac2a5b..cb0904fe5fa64 100644
--- a/app/code/Magento/Catalog/Block/Product/NewProduct.php
+++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php
@@ -1,6 +1,6 @@
pageConfig->setDescription($description);
} else {
- $this->pageConfig->setDescription($this->string->substr($product->getDescription(), 0, 255));
+ $this->pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));
}
if ($this->_productHelper->canUseCanonicalTag()) {
$this->pageConfig->addRemotePageAsset(
diff --git a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php
index 5daaff14ed733..3de6874576c7d 100644
--- a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php
+++ b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php
@@ -1,6 +1,6 @@
setPath('catalog/*/', ['_current' => true, 'id' => null]);
}
- $data['general'] = $this->getRequest()->getPostValue();
- $categoryPostData = $data['general'];
+ $categoryPostData = $this->getRequest()->getPostValue();
$isNewCategory = !isset($categoryPostData['entity_id']);
$categoryPostData = $this->stringToBoolConverting($categoryPostData);
$categoryPostData = $this->imagePreprocessing($categoryPostData);
- $categoryPostData = $this->dateTimePreprocessing($category, $categoryPostData);
$storeId = isset($categoryPostData['store_id']) ? $categoryPostData['store_id'] : null;
$store = $this->storeManager->getStore($storeId);
$this->storeManager->setCurrentStore($store->getCode());
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/SuggestCategories.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/SuggestCategories.php
index 749f13f3cf0c6..d44f340479553 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/SuggestCategories.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/SuggestCategories.php
@@ -1,7 +1,7 @@
resultJsonFactory = $resultJsonFactory;
+ if (null === $attributeGroupFactory) {
+ $attributeGroupFactory = \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(\Magento\Eav\Api\Data\AttributeGroupInterfaceFactory::class);
+ }
+ $this->attributeGroupFactory = $attributeGroupFactory;
}
/**
@@ -132,7 +140,7 @@ public function execute()
$attributeGroup = reset($attributeGroupItems);
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
/** @var AttributeGroupInterface $attributeGroup */
- $attributeGroup = $this->getAttributeGroupFactory()->create();
+ $attributeGroup = $this->attributeGroupFactory->create();
}
$extensionAttributes = $attributeGroup->getExtensionAttributes()
@@ -228,18 +236,6 @@ private function getAttributeGroupRepository()
return $this->attributeGroupRepository;
}
- /**
- * @return AttributeGroupInterfaceFactory
- */
- private function getAttributeGroupFactory()
- {
- if (null === $this->attributeGroupFactory) {
- $this->attributeGroupFactory = \Magento\Framework\App\ObjectManager::getInstance()
- ->get('Magento\Eav\Api\Data\AttributeGroupInterfaceFactory');
- }
- return $this->attributeGroupFactory;
- }
-
/**
* @return SearchCriteriaBuilder
*/
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AlertsPriceGrid.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AlertsPriceGrid.php
index 3b370edc27008..88456f15a364f 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AlertsPriceGrid.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AlertsPriceGrid.php
@@ -1,7 +1,7 @@
buildFactory = $buildFactory;
@@ -90,7 +106,7 @@ public function __construct(
}
/**
- * @return \Magento\Backend\Model\View\Result\Redirect
+ * @return Redirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
@@ -107,31 +123,43 @@ public function execute()
$name = trim($name);
try {
- /** @var $attributeSet \Magento\Eav\Model\Entity\Attribute\Set */
+ /** @var $attributeSet Set */
$attributeSet = $this->buildFactory->create()
->setEntityTypeId($this->_entityTypeId)
->setSkeletonId($setId)
->setName($name)
->getAttributeSet();
-
} catch (AlreadyExistsException $alreadyExists) {
- $this->messageManager->addError(__('An attribute set named \'%1\' already exists.', $name));
+ $this->messageManager->addErrorMessage(__('An attribute set named \'%1\' already exists.', $name));
$this->_session->setAttributeData($data);
return $this->returnResult('catalog/*/edit', ['_current' => true], ['error' => true]);
- } catch (\Magento\Framework\Exception\LocalizedException $e) {
- $this->messageManager->addError($e->getMessage());
+ } catch (LocalizedException $e) {
+ $this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
- $this->messageManager->addException($e, __('Something went wrong while saving the attribute.'));
+ $this->messageManager->addExceptionMessage(
+ $e,
+ __('Something went wrong while saving the attribute.')
+ );
}
}
$attributeId = $this->getRequest()->getParam('attribute_id');
- $attributeCode = $this->getRequest()->getParam('attribute_code')
- ?: $this->generateCode($this->getRequest()->getParam('frontend_label')[0]);
+
+ /** @var $model ProductAttributeInterface */
+ $model = $this->attributeFactory->create();
+ if ($attributeId) {
+ $model->load($attributeId);
+ }
+ $attributeCode = $model && $model->getId()
+ ? $model->getAttributeCode()
+ : $this->getRequest()->getParam('attribute_code');
+ $attributeCode = $attributeCode ?: $this->generateCode($this->getRequest()->getParam('frontend_label')[0]);
if (strlen($attributeCode) > 0) {
- $validatorAttrCode = new \Zend_Validate_Regex(['pattern' => '/^[a-z][a-z_0-9]{0,30}$/']);
+ $validatorAttrCode = new \Zend_Validate_Regex(
+ ['pattern' => '/^[a-z][a-z_0-9]{0,30}$/']
+ );
if (!$validatorAttrCode->isValid($attributeCode)) {
- $this->messageManager->addError(
+ $this->messageManager->addErrorMessage(
__(
'Attribute code "%1" is invalid. Please use only letters (a-z), ' .
'numbers (0-9) or underscore(_) in this field, first character should be a letter.',
@@ -149,11 +177,11 @@ public function execute()
//validate frontend_input
if (isset($data['frontend_input'])) {
- /** @var $inputType \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\Validator */
+ /** @var $inputType Validator */
$inputType = $this->validatorFactory->create();
if (!$inputType->isValid($data['frontend_input'])) {
foreach ($inputType->getMessages() as $message) {
- $this->messageManager->addError($message);
+ $this->messageManager->addErrorMessage($message);
}
return $this->returnResult(
'catalog/*/edit',
@@ -163,18 +191,14 @@ public function execute()
}
}
- /* @var $model \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
- $model = $this->attributeFactory->create();
-
if ($attributeId) {
- $model->load($attributeId);
if (!$model->getId()) {
- $this->messageManager->addError(__('This attribute no longer exists.'));
+ $this->messageManager->addErrorMessage(__('This attribute no longer exists.'));
return $this->returnResult('catalog/*/', [], ['error' => true]);
}
// entity type check
if ($model->getEntityTypeId() != $this->_entityTypeId) {
- $this->messageManager->addError(__('We can\'t update the attribute.'));
+ $this->messageManager->addErrorMessage(__('We can\'t update the attribute.'));
$this->_session->setAttributeData($data);
return $this->returnResult('catalog/*/', [], ['error' => true]);
}
@@ -196,7 +220,7 @@ public function execute()
$data += ['is_filterable' => 0, 'is_filterable_in_search' => 0, 'apply_to' => []];
- if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
+ if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) {
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
}
@@ -242,7 +266,7 @@ public function execute()
try {
$model->save();
- $this->messageManager->addSuccess(__('You saved the product attribute.'));
+ $this->messageManager->addSuccessMessage(__('You saved the product attribute.'));
$this->_attributeLabelCache->clean();
$this->_session->setAttributeData(false);
@@ -253,7 +277,7 @@ public function execute()
'_current' => true,
'product_tab' => $this->getRequest()->getParam('product_tab'),
];
- if (!is_null($attributeSet)) {
+ if ($attributeSet !== null) {
$requestParams['new_attribute_set_id'] = $attributeSet->getId();
}
return $this->returnResult('catalog/product/addAttribute', $requestParams, ['error' => false]);
@@ -266,7 +290,7 @@ public function execute()
}
return $this->returnResult('catalog/*/', [], ['error' => false]);
} catch (\Exception $e) {
- $this->messageManager->addError($e->getMessage());
+ $this->messageManager->addErrorMessage($e->getMessage());
$this->_session->setAttributeData($data);
return $this->returnResult(
'catalog/*/edit',
@@ -282,7 +306,7 @@ public function execute()
* @param string $path
* @param array $params
* @param array $response
- * @return \Magento\Framework\Controller\Result\Json|\Magento\Backend\Model\View\Result\Redirect
+ * @return Json|Redirect
*/
private function returnResult($path = '', array $params = [], array $response = [])
{
@@ -295,7 +319,6 @@ private function returnResult($path = '', array $params = [], array $response =
return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($response);
}
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath($path, $params);
-
}
/**
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php
index 94fad64f5ed96..99c65217e7bad 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php
@@ -1,7 +1,7 @@
productFactory = $productFactory;
$this->logger = $logger;
$this->registry = $registry;
$this->wysiwygConfig = $wysiwygConfig;
+ if (null === $storeFactory) {
+ $storeFactory = \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(StoreFactory::class);
+ }
+ $this->storeFactory = $storeFactory;
}
/**
@@ -70,7 +78,7 @@ public function build(RequestInterface $request)
/** @var $product \Magento\Catalog\Model\Product */
$product = $this->productFactory->create();
$product->setStoreId($request->getParam('store', 0));
- $store = $this->getStoreFactory()->create();
+ $store = $this->storeFactory->create();
$store->load($request->getParam('store', 0));
$typeId = $request->getParam('type');
@@ -99,16 +107,4 @@ public function build(RequestInterface $request)
$this->wysiwygConfig->setStoreId($request->getParam('store'));
return $product;
}
-
- /**
- * @return StoreFactory
- */
- private function getStoreFactory()
- {
- if (null === $this->storeFactory) {
- $this->storeFactory = \Magento\Framework\App\ObjectManager::getInstance()
- ->get('Magento\Store\Model\StoreFactory');
- }
- return $this->storeFactory;
- }
}
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Categories.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Categories.php
index d9a6a92799719..7879e0369ff13 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Categories.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Categories.php
@@ -1,7 +1,7 @@
get(LinkTypeProvider::class);
+ }
+ if (null === $customOptionFactory) {
+ $customOptionFactory = ObjectManager::getInstance()->get(CustomOptionFactory::class);
+ }
+ if (null === $productLinkFactory) {
+ $productLinkFactory = ObjectManager::getInstance()->get(ProductLinkFactory::class);
+ }
+ if (null === $productRepository) {
+ $productRepository = ObjectManager::getInstance()->get(ProductRepository::class);
+ }
+ if (null === $dateTimeFilter) {
+ $dateTimeFilter = ObjectManager::getInstance()->get(DateTime::class);
+ }
+ if (null === $linkResolver) {
+ $linkResolver = ObjectManager::getInstance()->get(LinkResolver::class);
+ }
$this->request = $request;
$this->storeManager = $storeManager;
$this->stockFilter = $stockFilter;
$this->productLinks = $productLinks;
$this->jsHelper = $jsHelper;
$this->dateFilter = $dateFilter;
- $this->linkTypeProvider = $linkTypeProvider ?: \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Catalog\Model\Product\LinkTypeProvider::class);
+ $this->linkTypeProvider = $linkTypeProvider;
+ $this->customOptionFactory = $customOptionFactory;
+ $this->productLinkFactory = $productLinkFactory;
+ $this->productRepository = $productRepository;
+ $this->dateTimeFilter = $dateTimeFilter;
+ $this->linkResolver = $linkResolver;
}
/**
@@ -159,7 +199,7 @@ public function initializeFromData(Product $product, array $productData)
foreach ($attributes as $attrKey => $attribute) {
if ($attribute->getBackend()->getType() == 'datetime') {
if (array_key_exists($attrKey, $productData) && $productData[$attrKey] != '') {
- $dateFieldFilters[$attrKey] = $this->getDateTimeFilter();
+ $dateFieldFilters[$attrKey] = $this->dateTimeFilter;
}
}
}
@@ -222,11 +262,12 @@ public function initialize(Product $product)
*
* @param Product $product
* @return Product
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function setProductLinks(Product $product)
{
- $links = $this->getLinkResolver()->getLinks();
+ $links = $this->linkResolver->getLinks();
$product->setProductLinks([]);
@@ -251,8 +292,8 @@ protected function setProductLinks(Product $product)
continue;
}
- $linkProduct = $this->getProductRepository()->getById($linkData['id']);
- $link = $this->getProductLinkFactory()->create();
+ $linkProduct = $this->productRepository->getById($linkData['id']);
+ $link = $this->productLinkFactory->create();
$link->setSku($product->getSku())
->setLinkedProductSku($linkProduct->getSku())
->setLinkType($linkType)
@@ -360,73 +401,6 @@ private function overwriteValue($optionId, $option, $overwriteOptions)
return $option;
}
- /**
- * @return CustomOptionFactory
- */
- private function getCustomOptionFactory()
- {
- if (null === $this->customOptionFactory) {
- $this->customOptionFactory = \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class);
- }
-
- return $this->customOptionFactory;
- }
-
- /**
- * @return ProductLinkFactory
- */
- private function getProductLinkFactory()
- {
- if (null === $this->productLinkFactory) {
- $this->productLinkFactory = \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Catalog\Api\Data\ProductLinkInterfaceFactory::class);
- }
-
- return $this->productLinkFactory;
- }
-
- /**
- * @return ProductRepository
- */
- private function getProductRepository()
- {
- if (null === $this->productRepository) {
- $this->productRepository = \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Catalog\Api\ProductRepositoryInterface\Proxy::class);
- }
-
- return $this->productRepository;
- }
-
- /**
- * @deprecated
- * @return LinkResolver
- */
- private function getLinkResolver()
- {
- if (!is_object($this->linkResolver)) {
- $this->linkResolver = ObjectManager::getInstance()->get(LinkResolver::class);
- }
-
- return $this->linkResolver;
- }
-
- /**
- * @return \Magento\Framework\Stdlib\DateTime\Filter\DateTime
- *
- * @deprecated
- */
- private function getDateTimeFilter()
- {
- if ($this->dateTimeFilter === null) {
- $this->dateTimeFilter = \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Framework\Stdlib\DateTime\Filter\DateTime::class);
- }
-
- return $this->dateTimeFilter;
- }
-
/**
* Fills $product with options from $productOptions array
*
@@ -464,7 +438,7 @@ function ($valueData) {
}
);
}
- $customOption = $this->getCustomOptionFactory()->create(
+ $customOption = $this->customOptionFactory->create(
['data' => $customOptionData]
);
$customOption->setProductSku($product->getSku());
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactory.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactory.php
index 1aa81f50d822d..575ff09e9d5b1 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactory.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactory.php
@@ -1,6 +1,6 @@
customAttributesCodes;
}
+ /**
+ * @throws \Magento\Framework\Exception\LocalizedException
+ * @return \Magento\Catalog\Model\ResourceModel\Category
+ * @deprecated because resource models should be used directly
+ */
+ protected function _getResource()
+ {
+ return parent::_getResource();
+ }
+
/**
* Get flat resource model flag
*
@@ -704,7 +719,7 @@ public function getParentId()
return $parentId;
}
$parentIds = $this->getParentIds();
- return intval(array_pop($parentIds));
+ return (int)array_pop($parentIds);
}
/**
@@ -938,8 +953,11 @@ public function getAnchorsAbove()
*/
public function getProductCount()
{
- $count = $this->_getResource()->getProductCount($this);
- $this->setData(self::KEY_PRODUCT_COUNT, $count);
+ if (!$this->hasData(self::KEY_PRODUCT_COUNT)) {
+ $count = $this->_getResource()->getProductCount($this);
+ $this->setData(self::KEY_PRODUCT_COUNT, $count);
+ }
+
return $this->getData(self::KEY_PRODUCT_COUNT);
}
@@ -1129,19 +1147,21 @@ public function getIdentities()
{
$identities = [];
if ($this->getId()) {
- $identities[] = self::CACHE_TAG . '_' . $this->getId();
- }
- if ($this->getId()
- && (
- $this->hasDataChanges()
- || $this->isDeleted()
- || $this->dataHasChangedFor(self::KEY_INCLUDE_IN_MENU)
- )
- ) {
- $identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $this->getId();
- }
- if ($this->getId() && $this->isObjectNew()) {
- $identities[] = self::CACHE_TAG;
+ if ($this->getAffectedCategoryIds()) {
+ foreach (array_unique($this->getAffectedCategoryIds()) as $affectedCategoryId) {
+ $identities[] = self::CACHE_TAG . '_' . $affectedCategoryId;
+ }
+ } else {
+ $identities[] = self::CACHE_TAG . '_' . $this->getId();
+ }
+
+ if ($this->hasDataChanges() || $this->isDeleted() || $this->dataHasChangedFor(self::KEY_INCLUDE_IN_MENU)) {
+ $identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $this->getId();
+ }
+
+ if ($this->isObjectNew()) {
+ $identities[] = self::CACHE_TAG;
+ }
}
return $identities;
diff --git a/app/code/Magento/Catalog/Model/Category/Attribute.php b/app/code/Magento/Catalog/Model/Category/Attribute.php
index 94a108c063f51..b56e20822a470 100644
--- a/app/code/Magento/Catalog/Model/Category/Attribute.php
+++ b/app/code/Magento/Catalog/Model/Category/Attribute.php
@@ -1,6 +1,6 @@
resource = $resource;
$this->connection = $resource->getConnection();
$this->storeManager = $storeManager;
$this->config = $config;
- $this->queryGenerator = $queryGenerator ?: \Magento\Framework\App\ObjectManager::getInstance()
- ->get(QueryGenerator::class);
+ $this->queryGenerator = $queryGenerator ?: ObjectManager::getInstance()->get(QueryGenerator::class);
+ $this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
}
/**
@@ -179,9 +186,9 @@ protected function getMainTable()
*/
protected function getMainTmpTable()
{
- return $this->useTempTable ? $this->getTable(
- self::MAIN_INDEX_TABLE . self::TEMPORARY_TABLE_SUFFIX
- ) : $this->getMainTable();
+ return $this->useTempTable
+ ? $this->getTable(self::MAIN_INDEX_TABLE . self::TEMPORARY_TABLE_SUFFIX)
+ : $this->getMainTable();
}
/**
@@ -209,24 +216,25 @@ protected function getPathFromCategoryId($categoryId)
/**
* Retrieve select for reindex products of non anchor categories
*
- * @param \Magento\Store\Model\Store $store
- * @return \Magento\Framework\DB\Select
+ * @param Store $store
+ * @return Select
+ * @throws \Exception when metadata not found for ProductInterface
*/
- protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store)
+ protected function getNonAnchorCategoriesSelect(Store $store)
{
if (!isset($this->nonAnchorSelects[$store->getId()])) {
$statusAttributeId = $this->config->getAttribute(
- \Magento\Catalog\Model\Product::ENTITY,
+ Product::ENTITY,
'status'
)->getId();
$visibilityAttributeId = $this->config->getAttribute(
- \Magento\Catalog\Model\Product::ENTITY,
+ Product::ENTITY,
'visibility'
)->getId();
$rootPath = $this->getPathFromCategoryId($store->getRootCategoryId());
- $metadata = $this->getMetadataPool()->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
+ $metadata = $this->metadataPool->getMetadata(ProductInterface::class);
$linkField = $metadata->getLinkField();
$select = $this->connection->select()->from(
['cc' => $this->getTable('catalog_category_entity')],
@@ -295,12 +303,65 @@ protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $stor
]
);
+ $this->addFilteringByChildProductsToSelect($select, $store);
+
$this->nonAnchorSelects[$store->getId()] = $select;
}
return $this->nonAnchorSelects[$store->getId()];
}
+ /**
+ * Add filtering by child products to select
+ *
+ * It's used for correct handling of composite products.
+ * This method makes assumption that select already joins `catalog_product_entity` as `cpe`.
+ *
+ * @param Select $select
+ * @param Store $store
+ * @return void
+ * @throws \Exception when metadata not found for ProductInterface
+ */
+ private function addFilteringByChildProductsToSelect(Select $select, Store $store)
+ {
+ $metadata = $this->metadataPool->getMetadata(ProductInterface::class);
+ $linkField = $metadata->getLinkField();
+
+ $statusAttributeId = $this->config->getAttribute(Product::ENTITY, 'status')->getId();
+
+ $select->joinLeft(
+ ['relation' => $this->getTable('catalog_product_relation')],
+ 'cpe.' . $linkField . ' = relation.parent_id',
+ []
+ )->joinLeft(
+ ['relation_product_entity' => $this->getTable('catalog_product_entity')],
+ 'relation.child_id = relation_product_entity.entity_id',
+ []
+ )->joinLeft(
+ ['child_cpsd' => $this->getTable('catalog_product_entity_int')],
+ 'child_cpsd.' . $linkField . ' = '. 'relation_product_entity.' . $linkField
+ . ' AND child_cpsd.store_id = 0'
+ . ' AND child_cpsd.attribute_id = ' . $statusAttributeId,
+ []
+ )->joinLeft(
+ ['child_cpss' => $this->getTable('catalog_product_entity_int')],
+ 'child_cpss.' . $linkField . ' = '. 'relation_product_entity.' . $linkField . ''
+ . ' AND child_cpss.attribute_id = child_cpsd.attribute_id'
+ . ' AND child_cpss.store_id = ' . $store->getId(),
+ []
+ )->where(
+ 'relation.child_id IS NULL OR '
+ . $this->connection->getIfNullSql('child_cpss.value', 'child_cpsd.value') . ' = ?',
+ \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
+ )->group(
+ [
+ 'cc.entity_id',
+ 'ccp.product_id',
+ 'visibility'
+ ]
+ );
+ }
+
/**
* Check whether select ranging is needed
*
@@ -314,16 +375,13 @@ protected function isRangingNeeded()
/**
* Return selects cut by min and max.
*
- * @param \Magento\Framework\DB\Select $select
+ * @param Select $select
* @param string $field
* @param int $range
- * @return \Magento\Framework\DB\Select[]
+ * @return Select[]
*/
- protected function prepareSelectsByRange(
- \Magento\Framework\DB\Select $select,
- $field,
- $range = self::RANGE_CATEGORY_STEP
- ) {
+ protected function prepareSelectsByRange(Select $select, $field, $range = self::RANGE_CATEGORY_STEP)
+ {
if ($this->isRangingNeeded()) {
$iterator = $this->queryGenerator->generate(
$field,
@@ -346,10 +404,10 @@ protected function prepareSelectsByRange(
/**
* Reindex products of non anchor categories
*
- * @param \Magento\Store\Model\Store $store
+ * @param Store $store
* @return void
*/
- protected function reindexNonAnchorCategories(\Magento\Store\Model\Store $store)
+ protected function reindexNonAnchorCategories(Store $store)
{
$selects = $this->prepareSelectsByRange($this->getNonAnchorCategoriesSelect($store), 'entity_id');
foreach ($selects as $select) {
@@ -367,10 +425,10 @@ protected function reindexNonAnchorCategories(\Magento\Store\Model\Store $store)
/**
* Check if anchor select isset
*
- * @param \Magento\Store\Model\Store $store
+ * @param Store $store
* @return bool
*/
- protected function hasAnchorSelect(\Magento\Store\Model\Store $store)
+ protected function hasAnchorSelect(Store $store)
{
return isset($this->anchorSelects[$store->getId()]);
}
@@ -378,19 +436,20 @@ protected function hasAnchorSelect(\Magento\Store\Model\Store $store)
/**
* Create anchor select
*
- * @param \Magento\Store\Model\Store $store
- * @return \Magento\Framework\DB\Select
+ * @param Store $store
+ * @return Select
+ * @throws \Exception when metadata not found for ProductInterface or CategoryInterface
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
- protected function createAnchorSelect(\Magento\Store\Model\Store $store)
+ protected function createAnchorSelect(Store $store)
{
$isAnchorAttributeId = $this->config->getAttribute(
\Magento\Catalog\Model\Category::ENTITY,
'is_anchor'
)->getId();
- $statusAttributeId = $this->config->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'status')->getId();
+ $statusAttributeId = $this->config->getAttribute(Product::ENTITY, 'status')->getId();
$visibilityAttributeId = $this->config->getAttribute(
- \Magento\Catalog\Model\Product::ENTITY,
+ Product::ENTITY,
'visibility'
)->getId();
$rootCatIds = explode('/', $this->getPathFromCategoryId($store->getRootCategoryId()));
@@ -398,12 +457,12 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store)
$temporaryTreeTable = $this->makeTempCategoryTreeIndex();
- $productMetadata = $this->getMetadataPool()->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
- $categoryMetadata = $this->getMetadataPool()->getMetadata(\Magento\Catalog\Api\Data\CategoryInterface::class);
+ $productMetadata = $this->metadataPool->getMetadata(ProductInterface::class);
+ $categoryMetadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\CategoryInterface::class);
$productLinkField = $productMetadata->getLinkField();
$categoryLinkField = $categoryMetadata->getLinkField();
- return $this->connection->select()->from(
+ $select = $this->connection->select()->from(
['cc' => $this->getTable('catalog_category_entity')],
[]
)->joinInner(
@@ -485,6 +544,10 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store)
'visibility' => new \Zend_Db_Expr($this->connection->getIfNullSql('cpvs.value', 'cpvd.value')),
]
);
+
+ $this->addFilteringByChildProductsToSelect($select, $store);
+
+ return $select;
}
/**
@@ -576,10 +639,10 @@ protected function fillTempCategoryTreeIndex($temporaryName)
/**
* Retrieve select for reindex products of non anchor categories
*
- * @param \Magento\Store\Model\Store $store
- * @return \Magento\Framework\DB\Select
+ * @param Store $store
+ * @return Select
*/
- protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store)
+ protected function getAnchorCategoriesSelect(Store $store)
{
if (!$this->hasAnchorSelect($store)) {
$this->anchorSelects[$store->getId()] = $this->createAnchorSelect($store);
@@ -590,10 +653,10 @@ protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store)
/**
* Reindex products of anchor categories
*
- * @param \Magento\Store\Model\Store $store
+ * @param Store $store
* @return void
*/
- protected function reindexAnchorCategories(\Magento\Store\Model\Store $store)
+ protected function reindexAnchorCategories(Store $store)
{
$selects = $this->prepareSelectsByRange($this->getAnchorCategoriesSelect($store), 'entity_id');
@@ -612,22 +675,23 @@ protected function reindexAnchorCategories(\Magento\Store\Model\Store $store)
/**
* Get select for all products
*
- * @param \Magento\Store\Model\Store $store
- * @return \Magento\Framework\DB\Select
+ * @param Store $store
+ * @return Select
+ * @throws \Exception when metadata not found for ProductInterface
*/
- protected function getAllProducts(\Magento\Store\Model\Store $store)
+ protected function getAllProducts(Store $store)
{
if (!isset($this->productsSelects[$store->getId()])) {
$statusAttributeId = $this->config->getAttribute(
- \Magento\Catalog\Model\Product::ENTITY,
+ Product::ENTITY,
'status'
)->getId();
$visibilityAttributeId = $this->config->getAttribute(
- \Magento\Catalog\Model\Product::ENTITY,
+ Product::ENTITY,
'visibility'
)->getId();
- $metadata = $this->getMetadataPool()->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
+ $metadata = $this->metadataPool->getMetadata(ProductInterface::class);
$linkField = $metadata->getLinkField();
$select = $this->connection->select()->from(
@@ -716,10 +780,10 @@ protected function isIndexRootCategoryNeeded()
/**
* Reindex all products to root category
*
- * @param \Magento\Store\Model\Store $store
+ * @param Store $store
* @return void
*/
- protected function reindexRootCategory(\Magento\Store\Model\Store $store)
+ protected function reindexRootCategory(Store $store)
{
if ($this->isIndexRootCategoryNeeded()) {
$selects = $this->prepareSelectsByRange(
@@ -740,16 +804,4 @@ protected function reindexRootCategory(\Magento\Store\Model\Store $store)
}
}
}
-
- /**
- * @return \Magento\Framework\EntityManager\MetadataPool
- */
- private function getMetadataPool()
- {
- if (null === $this->metadataPool) {
- $this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
- ->get('Magento\Framework\EntityManager\MetadataPool');
- }
- return $this->metadataPool;
- }
}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php
index 5a5dced86f959..9385d1e13c2ad 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php
@@ -1,6 +1,6 @@
cacheContext = $cacheContext ?: ObjectManager::getInstance()->get(CacheContext::class);
+ $this->eventManager = $eventManager ?: ObjectManager::getInstance()->get(EventManagerInterface::class);
+ }
+
/**
* Refresh entities index
*
* @param int[] $entityIds
* @param bool $useTempTable
* @return $this
+ * @throws \Exception if metadataPool doesn't contain metadata for ProductInterface
+ * @throws \DomainException
*/
public function execute(array $entityIds = [], $useTempTable = false)
{
- $this->limitationByProducts = $entityIds;
+ $idsToBeReIndexed = $this->getProductIdsWithParents($entityIds);
+
+ $this->limitationByProducts = $idsToBeReIndexed;
$this->useTempTable = $useTempTable;
+ $affectedCategories = $this->getCategoryIdsFromIndex($idsToBeReIndexed);
+
$this->removeEntries();
$this->reindex();
- $this->registerProducts($entityIds);
- $this->registerCategories($entityIds);
+ $affectedCategories = array_merge($affectedCategories, $this->getCategoryIdsFromIndex($idsToBeReIndexed));
+
+ $this->registerProducts($idsToBeReIndexed);
+ $this->registerCategories($affectedCategories);
+ $this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]);
return $this;
}
+ /**
+ * Get IDs of parent products by their child IDs.
+ *
+ * Returns identifiers of parent product from the catalog_product_relation.
+ * Please note that returned ids don't contain ids of passed child products.
+ *
+ * @param int[] $childProductIds
+ * @return int[]
+ * @throws \Exception if metadataPool doesn't contain metadata for ProductInterface
+ * @throws \DomainException
+ */
+ private function getProductIdsWithParents(array $childProductIds)
+ {
+ /** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */
+ $metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
+ $fieldForParent = $metadata->getLinkField();
+
+ $select = $this->connection
+ ->select()
+ ->from(['relation' => $this->getTable('catalog_product_relation')], [])
+ ->distinct(true)
+ ->where('child_id IN (?)', $childProductIds)
+ ->join(
+ ['cpe' => $this->getTable('catalog_product_entity')],
+ 'relation.parent_id = cpe.' . $fieldForParent,
+ ['cpe.entity_id']
+ );
+
+ $parentProductIds = $this->connection->fetchCol($select);
+
+ return array_unique(array_merge($childProductIds, $parentProductIds));
+ }
+
/**
* Register affected products
*
@@ -53,26 +133,19 @@ public function execute(array $entityIds = [], $useTempTable = false)
*/
private function registerProducts($entityIds)
{
- $this->getCacheContext()->registerEntities(Product::CACHE_TAG, $entityIds);
+ $this->cacheContext->registerEntities(Product::CACHE_TAG, $entityIds);
}
/**
* Register categories assigned to products
*
- * @param array $entityIds
+ * @param array $categoryIds
* @return void
*/
- private function registerCategories($entityIds)
+ private function registerCategories(array $categoryIds)
{
- $categories = $this->connection->fetchCol(
- $this->connection->select()
- ->from($this->getMainTable(), ['category_id'])
- ->where('product_id IN (?)', $entityIds)
- ->distinct()
- );
-
- if ($categories) {
- $this->getCacheContext()->registerEntities(Category::CACHE_TAG, $categories);
+ if ($categoryIds) {
+ $this->cacheContext->registerEntities(Category::CACHE_TAG, $categoryIds);
}
}
@@ -98,7 +171,7 @@ protected function removeEntries()
protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store)
{
$select = parent::getNonAnchorCategoriesSelect($store);
- return $select->where('ccp.product_id IN (?)', $this->limitationByProducts);
+ return $select->where('ccp.product_id IN (?) OR relation.child_id IN (?)', $this->limitationByProducts);
}
/**
@@ -136,16 +209,29 @@ protected function isRangingNeeded()
}
/**
- * Get cache context
+ * Returns a list of category ids which are assigned to product ids in the index
*
- * @return \Magento\Framework\Indexer\CacheContext
- * @deprecated
+ * This may be required to get list of categories that are affected by the indexation process.
+ * Also, returns all parents of assigned categories as they're may be affected as well.
+ *
+ * @param array $productIds
+ * @return array
*/
- private function getCacheContext()
+ private function getCategoryIdsFromIndex(array $productIds)
{
- if ($this->cacheContext === null) {
- $this->cacheContext = \Magento\Framework\App\ObjectManager::getInstance()->get(CacheContext::class);
+ $categoryIds = $this->connection->fetchCol(
+ $this->connection->select()
+ ->from($this->getMainTable(), ['category_id'])
+ ->where('product_id IN (?)', $productIds)
+ ->distinct()
+ );
+ $parentCategories = $categoryIds;
+ foreach ($categoryIds as $categoryId) {
+ $parentIds = explode('/', $this->getPathFromCategoryId($categoryId));
+ $parentCategories = array_merge($parentCategories, $parentIds);
}
- return $this->cacheContext;
+ $categoryIds = array_unique($parentCategories);
+
+ return $categoryIds;
}
}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/RowsFactory.php b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/RowsFactory.php
index 6d570baf7bcb7..078efe4f0424a 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/RowsFactory.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/RowsFactory.php
@@ -1,6 +1,6 @@
_init('Magento\Catalog\Model\ResourceModel\Product');
}
+ /**
+ * Get resource instance
+ *
+ * @throws \Magento\Framework\Exception\LocalizedException
+ * @return \Magento\Catalog\Model\ResourceModel\Product
+ * @deprecated because resource models should be used directly
+ */
+ protected function _getResource()
+ {
+ return parent::_getResource();
+ }
+
/**
* {@inheritdoc}
*/
@@ -1058,12 +1075,7 @@ protected function _afterLoad()
*/
public function cleanCache()
{
- if ($this->getId()) {
- $this->_cacheManager->clean(
- self::CACHE_TAG . '_' . $this->getId()
- );
- }
- return $this;
+ return $this->cleanModelCache();
}
/**
diff --git a/app/code/Magento/Catalog/Model/Product/Action.php b/app/code/Magento/Catalog/Model/Product/Action.php
index 6484f477c0ab6..bb6d56ee0ebf8 100644
--- a/app/code/Magento/Catalog/Model/Product/Action.php
+++ b/app/code/Magento/Catalog/Model/Product/Action.php
@@ -1,6 +1,6 @@
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\Product\Attribute;
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Management.php b/app/code/Magento/Catalog/Model/Product/Attribute/Management.php
index 4529b61147402..d49f9dc31457a 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Management.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Management.php
@@ -1,7 +1,7 @@
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\Product\Attribute;
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php
index b7d592263163a..2e8b32910f361 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php
@@ -1,7 +1,7 @@
_newFile === true) {
- $asset = $this->_assetRepo->createAsset(
- "Magento_Catalog::images/product/placeholder/{$this->getDestinationSubdir()}.jpg"
- );
- $img = $asset->getSourceFile();
- $fileInfo = getimagesize($img);
- } else {
- if ($this->_mediaDirectory->isFile($this->_mediaDirectory->getAbsolutePath($this->_newFile))) {
- $fileInfo = getimagesize($this->_mediaDirectory->getAbsolutePath($this->_newFile));
+ try {
+ $fileInfo = null;
+ if ($this->_newFile === true) {
+ $asset = $this->_assetRepo->createAsset(
+ "Magento_Catalog::images/product/placeholder/{$this->getDestinationSubdir()}.jpg"
+ );
+ $image = $asset->getSourceFile();
+ $fileInfo = getimagesize($image);
+ } else {
+ $image = $this->_mediaDirectory->getAbsolutePath($this->_newFile);
+ if ($this->_mediaDirectory->isFile($image)) {
+ $fileInfo = getimagesize($image);
+ }
+ }
+ return $fileInfo;
+ } finally {
+ if (empty($fileInfo)) {
+ throw new NotLoadInfoImageException(__('Can\'t get information about the picture: %1', $image));
}
}
- return $fileInfo;
}
}
diff --git a/app/code/Magento/Catalog/Model/Product/Image/Cache.php b/app/code/Magento/Catalog/Model/Product/Image/Cache.php
index 2a5316583ff6e..c5e5e0ecac4c0 100644
--- a/app/code/Magento/Catalog/Model/Product/Image/Cache.php
+++ b/app/code/Magento/Catalog/Model/Product/Image/Cache.php
@@ -1,6 +1,6 @@
getGroupByType($this->getData('type')) === self::OPTION_GROUP_FILE) {
+ $this->cleanFileExtensions();
+ }
+
return $this;
}
@@ -912,5 +917,22 @@ private function getMetadataPool()
}
return $this->metadataPool;
}
+
+ /**
+ * Clears all non-accepted characters from file_extension field.
+ *
+ * @return void
+ */
+ private function cleanFileExtensions()
+ {
+ $rawExtensions = $this->getFileExtension();
+ $matches = [];
+ preg_match_all('/(?
[a-z0-9]+)/i', strtolower($rawExtensions), $matches);
+ if (!empty($matches)) {
+ $extensions = implode(', ', array_unique($matches['extensions']));
+ }
+ $this->setFileExtension($extensions);
+ }
+
//@codeCoverageIgnoreEnd
}
diff --git a/app/code/Magento/Catalog/Model/Product/Option/Converter.php b/app/code/Magento/Catalog/Model/Product/Option/Converter.php
index 5ba9ced88588c..f5c447d30cc85 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/Converter.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/Converter.php
@@ -1,7 +1,7 @@
productRepository = $productRepository;
$this->optionResource = $optionResource;
$this->converter = $converter;
+ if (null === $optionFactory) {
+ $optionFactory = \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(\Magento\Catalog\Model\Product\OptionFactory::class);
+ }
+ $this->optionFactory = $optionFactory;
+ if (null === $collectionFactory) {
+ $collectionFactory = \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(\Magento\Catalog\Model\ResourceModel\Product\Option\CollectionFactory::class);
+ }
+ $this->collectionFactory = $collectionFactory;
}
/**
@@ -83,7 +98,7 @@ public function getList($sku)
*/
public function getProductOptions(ProductInterface $product, $requiredOnly = false)
{
- return $this->getCollectionFactory()->create()->getProductOptions(
+ return $this->collectionFactory->create()->getProductOptions(
$product->getEntityId(),
$product->getStoreId(),
$requiredOnly
@@ -122,7 +137,7 @@ public function duplicate(
$hydrator = $this->getHydratorPool()->getHydrator(ProductInterface::class);
$metadata = $this->getMetadataPool()->getMetadata(ProductInterface::class);
return $this->optionResource->duplicate(
- $this->getOptionFactory()->create([]),
+ $this->optionFactory->create([]),
$hydrator->extract($product)[$metadata->getLinkField()],
$hydrator->extract($duplicate)[$metadata->getLinkField()]
);
@@ -228,32 +243,6 @@ protected function markRemovedValues($newValues, $originalValues)
return $newValues;
}
- /**
- * @return \Magento\Catalog\Model\Product\OptionFactory
- * @deprecated
- */
- private function getOptionFactory()
- {
- if (null === $this->optionFactory) {
- $this->optionFactory = \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Catalog\Model\Product\OptionFactory::class);
- }
- return $this->optionFactory;
- }
-
- /**
- * @return \Magento\Catalog\Model\ResourceModel\Product\Option\CollectionFactory
- * @deprecated
- */
- private function getCollectionFactory()
- {
- if (null === $this->collectionFactory) {
- $this->collectionFactory = \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Catalog\Model\ResourceModel\Product\Option\CollectionFactory::class);
- }
- return $this->collectionFactory;
- }
-
/**
* @return \Magento\Framework\EntityManager\MetadataPool
* @deprecated
@@ -269,6 +258,7 @@ private function getMetadataPool()
/**
* @return \Magento\Framework\EntityManager\HydratorPool
+ * @throws \RuntimeException
* @deprecated
*/
private function getHydratorPool()
diff --git a/app/code/Magento/Catalog/Model/Product/Option/SaveHandler.php b/app/code/Magento/Catalog/Model/Product/Option/SaveHandler.php
index 0f77d9e26ceb0..ff15f88bbd3b8 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/SaveHandler.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/SaveHandler.php
@@ -1,6 +1,6 @@
_dateExists()) {
if ($this->useCalendar()) {
- $timestamp += $this->_localeDate->date($value['date'], null, true, false)->getTimestamp();
+ $timestamp += $this->_localeDate->date($value['date'], null, true)->getTimestamp();
} else {
$timestamp += mktime(0, 0, 0, $value['month'], $value['day'], $value['year']);
}
diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php
index b54266e17b402..8db51e97280d7 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php
@@ -1,6 +1,6 @@
productRepository = $productRepository;
$this->entityCollectionProvider = $entityCollectionProvider;
$this->linkInitializer = $linkInitializer;
$this->linkManagement = $linkManagement;
$this->dataObjectProcessor = $dataObjectProcessor;
+ if (null === $productLinkFactory) {
+ $productLinkFactory = \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(\Magento\Catalog\Api\Data\ProductLinkInterfaceFactory::class);
+ }
+ if (null === $productLinkExtensionFactory) {
+ $productLinkExtensionFactory = \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(\Magento\Catalog\Api\Data\ProductLinkExtensionFactory::class);
+ }
+ $this->productLinkFactory = $productLinkFactory;
+ $this->productLinkExtensionFactory = $productLinkExtensionFactory;
}
/**
@@ -149,7 +164,7 @@ public function getList(\Magento\Catalog\Api\Data\ProductInterface $product)
$collection = $this->entityCollectionProvider->getCollection($product, $linkTypeName);
foreach ($collection as $item) {
/** @var \Magento\Catalog\Api\Data\ProductLinkInterface $productLink */
- $productLink = $this->getProductLinkFactory()->create();
+ $productLink = $this->productLinkFactory->create();
$productLink->setSku($product->getSku())
->setLinkType($linkTypeName)
->setLinkedProductSku($item['sku'])
@@ -158,7 +173,7 @@ public function getList(\Magento\Catalog\Api\Data\ProductInterface $product)
if (isset($item['custom_attributes'])) {
$productLinkExtension = $productLink->getExtensionAttributes();
if ($productLinkExtension === null) {
- $productLinkExtension = $this->getProductLinkExtensionFactory()->create();
+ $productLinkExtension = $this->productLinkExtensionFactory->create();
}
foreach ($item['custom_attributes'] as $option) {
$name = $option['attribute_code'];
@@ -258,30 +273,6 @@ private function getLinkTypeProvider()
return $this->linkTypeProvider;
}
- /**
- * @return ProductLinkInterfaceFactory
- */
- private function getProductLinkFactory()
- {
- if (null === $this->productLinkFactory) {
- $this->productLinkFactory = \Magento\Framework\App\ObjectManager::getInstance()
- ->get('Magento\Catalog\Api\Data\ProductLinkInterfaceFactory');
- }
- return $this->productLinkFactory;
- }
-
- /**
- * @return ProductLinkExtensionFactory
- */
- private function getProductLinkExtensionFactory()
- {
- if (null === $this->productLinkExtensionFactory) {
- $this->productLinkExtensionFactory = \Magento\Framework\App\ObjectManager::getInstance()
- ->get('Magento\Catalog\Api\Data\ProductLinkExtensionFactory');
- }
- return $this->productLinkExtensionFactory;
- }
-
/**
* @return \Magento\Framework\EntityManager\MetadataPool
*/
diff --git a/app/code/Magento/Catalog/Model/ProductLink/Type.php b/app/code/Magento/Catalog/Model/ProductLink/Type.php
index a45589204fdc7..e22741e4a2565 100644
--- a/app/code/Magento/Catalog/Model/ProductLink/Type.php
+++ b/app/code/Magento/Catalog/Model/ProductLink/Type.php
@@ -1,6 +1,6 @@
$value) {
$product->setData($key, $value);
}
- $this->assignProductToWebsites($product);
+ $this->assignProductToWebsites($product, $createNew);
return $product;
}
/**
* @param \Magento\Catalog\Model\Product $product
+ * @param bool $createNew
* @return void
*/
- private function assignProductToWebsites(\Magento\Catalog\Model\Product $product)
+ private function assignProductToWebsites(\Magento\Catalog\Model\Product $product, $createNew)
{
- if (!$this->storeManager->hasSingleStore()) {
-
- if ($this->storeManager->getStore()->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) {
- $websiteIds = array_keys($this->storeManager->getWebsites());
- } else {
- $websiteIds = [$this->storeManager->getStore()->getWebsiteId()];
- }
+ $websiteIds = $product->getWebsiteIds();
+
+ if ($createNew && !$this->storeManager->hasSingleStore()) {
+ $websiteIds = array_unique(
+ array_merge(
+ $websiteIds,
+ [$this->storeManager->getStore()->getWebsiteId()]
+ )
+ );
+ }
- $product->setWebsiteIds(array_unique(array_merge($product->getWebsiteIds(), $websiteIds)));
+ if ($createNew && $this->storeManager->getStore(true)->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) {
+ $websiteIds = array_keys($this->storeManager->getWebsites());
}
+
+ $product->setWebsiteIds($websiteIds);
}
/**
@@ -401,7 +408,7 @@ private function processLinks(\Magento\Catalog\Api\Data\ProductInterface $produc
$linksToInitialize = [];
foreach ($linksByType as $link) {
$linkDataArray = $this->extensibleDataObjectConverter
- ->toNestedArray($link, [], 'Magento\Catalog\Api\Data\ProductLinkInterface');
+ ->toNestedArray($link, [], \Magento\Catalog\Api\Data\ProductLinkInterface::class);
$linkedSku = $link->getLinkedProductSku();
if (!isset($linkedProductIds[$linkedSku])) {
throw new NoSuchEntityException(
@@ -518,7 +525,7 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO
}
$productDataArray = $this->extensibleDataObjectConverter
- ->toNestedArray($product, [], 'Magento\Catalog\Api\Data\ProductInterface');
+ ->toNestedArray($product, [], \Magento\Catalog\Api\Data\ProductInterface::class);
$productDataArray = array_replace($productDataArray, $product->getData());
$ignoreLinksFlag = $product->getData('ignore_links_flag');
$productLinks = null;
@@ -631,6 +638,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
$collection->setCurPage($searchCriteria->getCurrentPage());
$collection->setPageSize($searchCriteria->getPageSize());
$collection->load();
+ $collection->addCategoryIds();
$searchResult = $this->searchResultsFactory->create();
$searchResult->setSearchCriteria($searchCriteria);
@@ -717,7 +725,7 @@ private function getMediaGalleryProcessor()
{
if (null === $this->mediaGalleryProcessor) {
$this->mediaGalleryProcessor = \Magento\Framework\App\ObjectManager::getInstance()
- ->get('Magento\Catalog\Model\Product\Gallery\Processor');
+ ->get(\Magento\Catalog\Model\Product\Gallery\Processor::class);
}
return $this->mediaGalleryProcessor;
}
diff --git a/app/code/Magento/Catalog/Model/ProductType.php b/app/code/Magento/Catalog/Model/ProductType.php
index c1c0ecc82c4a0..48267ed8ed760 100644
--- a/app/code/Magento/Catalog/Model/ProductType.php
+++ b/app/code/Magento/Catalog/Model/ProductType.php
@@ -2,7 +2,7 @@
/**
* Product type
*
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model;
diff --git a/app/code/Magento/Catalog/Model/ProductTypeList.php b/app/code/Magento/Catalog/Model/ProductTypeList.php
index 3e9946f43ea95..5c9774d22cece 100644
--- a/app/code/Magento/Catalog/Model/ProductTypeList.php
+++ b/app/code/Magento/Catalog/Model/ProductTypeList.php
@@ -2,7 +2,7 @@
/**
* Product type provider
*
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model;
diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config.php b/app/code/Magento/Catalog/Model/ProductTypes/Config.php
index 701deb688e6f3..81315f0259e84 100644
--- a/app/code/Magento/Catalog/Model/ProductTypes/Config.php
+++ b/app/code/Magento/Catalog/Model/ProductTypes/Config.php
@@ -1,6 +1,6 @@
_storeManager->getStore()->getId(),
+ $this->getStoreId(),
CategoryUrlRewriteGenerator::ENTITY_TYPE
),
'left'
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection/Factory.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection/Factory.php
index 8b13ebd4a5b63..c1533ee7353a0 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection/Factory.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection/Factory.php
@@ -1,6 +1,6 @@
_categoryFactory = $categoryFactory;
$this->_categoryCollectionFactory = $categoryCollectionFactory;
@@ -114,6 +117,11 @@ public function __construct(
$this->_catalogConfig = $catalogConfig;
$this->_eventManager = $eventManager;
parent::__construct($context, $tableStrategy, $connectionName);
+ if (null === $categoryFlatCollectionFactory) {
+ $categoryFlatCollectionFactory = ObjectManager::getInstance()
+ ->get(CategoryFlatCollectionFactory::class);
+ }
+ $this->categoryFlatCollectionFactory = $categoryFlatCollectionFactory;
}
/**
@@ -169,9 +177,7 @@ public function getMainTable()
*/
public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID)
{
- if (is_string($storeId)) {
- $storeId = intval($storeId);
- }
+ $storeId = (int)$storeId;
if ($storeId) {
$suffix = sprintf('store_%d', $storeId);
@@ -407,7 +413,7 @@ public function getCategories($parent, $recursionLevel = 0, $sorted = false, $as
);
$parentPath = $this->getConnection()->fetchOne($select);
- $collection = $this->getCategoryFlatCollectionFactory()
+ $collection = $this->categoryFlatCollectionFactory
->create()
->addNameToResult()
->addUrlRewriteToResult()
@@ -698,19 +704,4 @@ public function getProductsPosition($category)
return $this->getConnection()->fetchPairs($select, $bind);
}
-
- /**
- * Get instance of CategoryFlatCollectionFactory
- *
- * @return CategoryFlatCollectionFactory
- */
- private function getCategoryFlatCollectionFactory()
- {
- if (!$this->categoryFlatCollectionFactory instanceof CategoryFlatCollectionFactory) {
- $this->categoryFlatCollectionFactory = ObjectManager::getInstance()
- ->get(CategoryFlatCollectionFactory::class);
- }
-
- return $this->categoryFlatCollectionFactory;
- }
}
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat/Collection.php
index 2449d6be86040..562b9501dd4eb 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat/Collection.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat/Collection.php
@@ -1,6 +1,6 @@
where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId())
->where('t.customer_group_id = ?', $this->customerSession->getCustomerGroupId())
->order('t.min_price ' . Select::SQL_ASC)
+ ->order(BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS . '.' . $linkField . ' ' . Select::SQL_ASC)
->limit(1);
$priceSelect = $this->baseSelectProcessor->process($priceSelect);
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php
index 8a97d43a18d7e..6fd1d080d32e8 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php
@@ -1,6 +1,6 @@
where('t.attribute_id = ?', $priceAttribute->getAttributeId())
->where('t.value IS NOT NULL')
->order('t.value ' . Select::SQL_ASC)
+ ->order(BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS . '.' . $linkField . ' ' . Select::SQL_ASC)
->limit(1);
$priceSelect = $this->baseSelectProcessor->process($priceSelect);
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php
index 17ce55b1252d6..5c47185a85bf4 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php
@@ -1,6 +1,6 @@
getDatePartSql('special_to.value') .' >= ?',
$currentDate
)->order('t.value ' . Select::SQL_ASC)
+ ->order(BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS . '.' . $linkField . ' ' . Select::SQL_ASC)
->limit(1);
$specialPrice = $this->baseSelectProcessor->process($specialPrice);
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php
index b884d2504a47a..37281193d6a1b 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php
@@ -1,6 +1,6 @@
where('t.all_groups = 1 OR customer_group_id = ?', $this->customerSession->getCustomerGroupId())
->where('t.qty = ?', 1)
->order('t.value ' . Select::SQL_ASC)
+ ->order(BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS . '.' . $linkField . ' ' . Select::SQL_ASC)
->limit(1);
$priceSelect = $this->baseSelectProcessor->process($priceSelect);
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php
index 1ba05e55fe2b1..5782834c06d85 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php
@@ -1,6 +1,6 @@
true, 'nullable' => false, 'default' => '0'],
- 'Attriute Set ID'
+ 'Attribute Set ID'
)
->addColumn(
'parent_id',
diff --git a/app/code/Magento/Catalog/Setup/Recurring.php b/app/code/Magento/Catalog/Setup/Recurring.php
index e6cb302747918..c5dd4f0457f11 100644
--- a/app/code/Magento/Catalog/Setup/Recurring.php
+++ b/app/code/Magento/Catalog/Setup/Recurring.php
@@ -1,6 +1,6 @@
will($this->returnValue($currentCategory));
$this->assertEquals(
- [$productTag, $categoryTag ],
+ [$categoryTag, $productTag],
$this->block->getIdentities()
);
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ListTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ListTest.php
index b97064eed8828..8282a16c546e2 100644
--- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ListTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ListTest.php
@@ -1,6 +1,6 @@
expects($this->any())
->method('getId')
->will($this->returnValue($categoryId));
- $categoryMock->expects($this->once())
- ->method('getAttributes')
- ->willReturn([]);
if (!$parentId) {
if ($storeId) {
$storeManagerMock->expects($this->once())
diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/Widget/CategoriesJsonTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/Widget/CategoriesJsonTest.php
index 90f4f017b5cc6..e4871802dd5ad 100644
--- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/Widget/CategoriesJsonTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/Widget/CategoriesJsonTest.php
@@ -1,7 +1,7 @@
disableOriginalConstructor()
->setMethods(['create'])
->getMock();
- $this->productRepositoryMock = $this->getMockBuilder(ProductRepository::class)
- ->disableOriginalConstructor()
+ $this->productRepositoryMock = $this->getMockBuilder(Proxy::class)
+ ->setMethods(['getById'])
->getMock();
$this->requestMock = $this->getMockBuilder(RequestInterface::class)
->setMethods(['getPost'])
@@ -704,7 +704,7 @@ private function assembleProductRepositoryMock($links)
->willReturn($link['sku']);
// Even optional arguments need to be provided for returnMapValue
- $repositoryReturnMap[] = [$link['id'], false, null, false, $mockLinkedProduct];
+ $repositoryReturnMap[] = [$link['id'], $mockLinkedProduct];
}
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php
index e73269ac8f576..d569f35d453fb 100644
--- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php
@@ -1,6 +1,6 @@
['test_attribute'], 'group_two' => ['attribute_one', 'attribute_two']];
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_merged.xml b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_merged.xml
index 813e9d64af710..c3c52fe89df83 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_merged.xml
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_merged.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_one.xml b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_one.xml
index 3fe4cc449c51d..26ad172c65dbd 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_one.xml
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_one.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_two.xml b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_two.xml
index 718895e7117fb..6990a2e110f9e 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_two.xml
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_two.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/ConfigTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/ConfigTest.php
index 7f469b6dc1eb5..483d21c5078db 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/ConfigTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/ConfigTest.php
@@ -1,6 +1,6 @@
assertEquals("description", $this->category->getCustomAttribute($descriptionAttributeCode)->getValue());
//Change the attribute value, should reflect in getCustomAttribute
- $this->category->setData($descriptionAttributeCode, "new description");
+ $this->category->setCustomAttribute($descriptionAttributeCode, "new description");
$this->assertEquals(1, count($this->category->getCustomAttributes()));
$this->assertNotNull($this->category->getCustomAttribute($descriptionAttributeCode));
$this->assertEquals(
@@ -655,4 +655,22 @@ public function testGetIdentities()
$category->setId(42);
$this->assertNotEmpty($category->getIdentities());
}
+
+ /**
+ * @return void
+ */
+ public function testGetIdentitiesWithAffectedCategories()
+ {
+ $category = $this->getCategoryModel();
+ $expectedIdentities = [
+ 'catalog_category_1',
+ 'catalog_category_2',
+ 'catalog_category_3',
+ 'catalog_category_product_1',
+ ];
+ $category->setId(1);
+ $category->setAffectedCategoryIds([1,2,3]);
+
+ $this->assertEquals($expectedIdentities, $category->getIdentities());
+ }
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Config/CatalogClone/Media/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Config/CatalogClone/Media/ImageTest.php
index 1204fb49ab8d2..8f05a0dae34f4 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Config/CatalogClone/Media/ImageTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Config/CatalogClone/Media/ImageTest.php
@@ -1,6 +1,6 @@
optionRepository = new Repository(
$this->productRepositoryMock,
$this->optionResourceMock,
- $this->converterMock
+ $this->converterMock,
+ $optionFactory,
+ $this->optionCollectionFactory
);
$this->setProperties(
$this->optionRepository,
[
- 'optionFactory' => $optionFactory,
- 'collectionFactory' => $this->optionCollectionFactory,
'metadataPool' => $metadataPool
]
);
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/SaveHandlerTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/SaveHandlerTest.php
index fee9f54ac981f..025313353b15c 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/SaveHandlerTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/SaveHandlerTest.php
@@ -1,6 +1,6 @@
productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+ $this->productMock = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false);
$objectManager = new ObjectManager($this);
- $this->model = $objectManager->getObject('Magento\Catalog\Model\Product\Option');
+ $this->model = $objectManager->getObject(\Magento\Catalog\Model\Product\Option::class);
$this->model->setProduct($this->productMock);
}
@@ -38,7 +41,7 @@ public function testGetProductSku()
public function testGetRegularPrice()
{
$priceInfoMock = $this->getMockForAbstractClass(
- 'Magento\Framework\Pricing\PriceInfoInterface',
+ \Magento\Framework\Pricing\PriceInfoInterface::class,
[],
'',
false,
@@ -47,7 +50,7 @@ public function testGetRegularPrice()
['getAmount', 'getPrice']
);
$priceInfoMock->expects($this->once())->method('getPrice')->willReturnSelf();
- $amountMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface');
+ $amountMock = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Amount\AmountInterface::class);
$priceInfoMock->expects($this->once())->method('getAmount')->willReturn($amountMock);
$this->productMock->expects($this->once())->method('getPriceInfo')->willReturn($priceInfoMock);
@@ -59,4 +62,41 @@ public function testGetRegularPrice()
$this->model->setPriceType(null);
$this->assertEquals(50, $this->model->getRegularPrice());
}
+
+ /**
+ * Tests removing ineligible characters from file_extension.
+ *
+ * @param string $rawExtensions
+ * @param string $expectedExtensions
+ * @dataProvider beforeSaveFileOptionDataProvider
+ */
+ public function testBeforeSaveFileOption($rawExtensions, $expectedExtensions)
+ {
+ $this->model->setType(Option::OPTION_GROUP_FILE);
+ $this->model->setFileExtension($rawExtensions);
+ $this->model->beforeSave();
+ $actualExtensions = $this->model->getFileExtension();
+ $this->assertEquals(
+ $expectedExtensions,
+ $actualExtensions
+ );
+ }
+
+ /**
+ * Data provider for testBeforeSaveFileOption.
+ *
+ * @return array
+ */
+ public function beforeSaveFileOptionDataProvider()
+ {
+ return [
+ ['JPG, PNG, GIF', 'jpg, png, gif'],
+ ['jpg, jpg, jpg', 'jpg'],
+ ['jpg, png, gif', 'jpg, png, gif'],
+ ['jpg png gif', 'jpg, png, gif'],
+ ['!jpg@png#gif%', 'jpg, png, gif'],
+ ['jpg, png, 123', 'jpg, png, 123'],
+ ['', ''],
+ ];
+ }
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifier/CompositeTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifier/CompositeTest.php
index 26a46d11c00d2..03afc2cd37c52 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifier/CompositeTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifier/CompositeTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/product_options_valid.xml b/app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/product_options_valid.xml
index 5f418c4b177ad..9bb8ffd5decad 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/product_options_valid.xml
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/product_options_valid.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
index ce031f5819a7d..c5199f70adc0a 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
@@ -1,7 +1,7 @@
optionConverterMock = $this->getMockBuilder(\Magento\Catalog\Model\Product\Option\Converter::class)
->disableOriginalConstructor()
->getMock();
+ $this->extensionAttributesJoinProcessor = $this->getMockBuilder(JoinProcessorInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$this->model = $this->objectManager->getObject(
\Magento\Catalog\Model\ProductRepository::class,
@@ -347,6 +360,7 @@ protected function setUp()
'imageProcessor' => $this->imageProcessorMock,
'extensionAttributesJoinProcessor' => $this->extensionAttributesJoinProcessorMock,
'mediaGalleryProcessor' => $this->mediaGalleryProcessor,
+ 'extensionAttributesJoinProcessor' => $this->extensionAttributesJoinProcessor,
]
);
}
@@ -671,85 +685,95 @@ public function testDeleteById()
*/
public function testGetList($fieldName)
{
- $searchCriteriaMock = $this->getMock(\Magento\Framework\Api\SearchCriteriaInterface::class, [], [], '', false);
$attributeCode = 'attribute_code';
- $collectionMock = $this->getMock(
- \Magento\Catalog\Model\ResourceModel\Product\Collection::class,
- [],
- [],
- '',
- false
- );
- $extendedSearchCriteriaMock = $this->getMock(\Magento\Framework\Api\SearchCriteria::class, [], [], '', false);
- $productAttributeSearchResultsMock = $this->getMock(
- \Magento\Framework\Api\SearchResults::class,
- [],
- [],
- '',
- false
- );
- $productAttributeMock = $this->getMock(
- \Magento\Catalog\Api\Data\ProductAttributeInterface::class,
- [],
- [],
- '',
- false
- );
- $filterGroupMock = $this->getMock(\Magento\Framework\Api\Search\FilterGroup::class, [], [], '', false);
- $filterGroupFilterMock = $this->getMock(\Magento\Framework\Api\Filter::class, [], [], '', false);
- $sortOrderMock = $this->getMock(\Magento\Framework\Api\SortOrder::class, [], [], '', false);
- $itemsMock = $this->getMock(\Magento\Framework\DataObject::class, [], [], '', false);
- $this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($collectionMock);
- $this->searchCriteriaBuilderMock
- ->expects($this->once())
- ->method('create')
- ->willReturn($extendedSearchCriteriaMock);
- $this->metadataServiceMock
- ->expects($this->once())
- ->method('getList')
- ->with($extendedSearchCriteriaMock)
- ->willReturn($productAttributeSearchResultsMock);
- $productAttributeSearchResultsMock->expects($this->once())
- ->method('getItems')
- ->willReturn([$productAttributeMock]);
- $productAttributeMock->expects($this->once())->method('getAttributeCode')->willReturn($attributeCode);
- $collectionMock->expects($this->once())->method('addAttributeToSelect')->with($attributeCode);
- $collectionMock->expects($this->exactly(2))
- ->method('joinAttribute')
+ $filterGroupFilterMock = $this->getMockBuilder(\Magento\Framework\Api\Filter::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $filterGroupFilterMock->expects(self::exactly(2))->method('getConditionType')->willReturn('eq');
+ $filterGroupFilterMock->expects(self::atLeastOnce())->method('getField')->willReturn($fieldName);
+ $filterGroupFilterMock->expects(self::once())->method('getValue')->willReturn('value');
+
+ $filterGroupMock = $this->getMockBuilder(\Magento\Framework\Api\Search\FilterGroup::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $filterGroupMock->expects(self::once())->method('getFilters')->willReturn([$filterGroupFilterMock]);
+
+ $sortOrderMock = $this->getMockBuilder(\Magento\Framework\Api\SortOrder::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $sortOrderMock->expects(self::atLeastOnce())->method('getField')->willReturn($fieldName);
+ $sortOrderMock->expects(self::once())->method('getDirection')->willReturn(SortOrder::SORT_ASC);
+
+ /** @var \Magento\Framework\Api\SearchCriteriaInterface|\PHPUnit_Framework_MockObject_MockObject $searchCriteriaMock */
+ $searchCriteriaMock = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteriaInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $searchCriteriaMock->expects(self::once())->method('getFilterGroups')->willReturn([$filterGroupMock]);
+ $searchCriteriaMock->expects(self::once())->method('getCurrentPage')->willReturn(4);
+ $searchCriteriaMock->expects(self::once())->method('getPageSize')->willReturn(42);
+ $searchCriteriaMock->expects(self::once())->method('getSortOrders')->willReturn([$sortOrderMock]);
+
+ $itemsMock = $this->getMockBuilder(\Magento\Framework\DataObject::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $collectionMock = $this->getMockBuilder(Collection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $collectionMock->expects(self::once())->method('addAttributeToSelect')->with($attributeCode);
+ $collectionMock->expects(self::once())->method('setPageSize')->with(42);
+ $collectionMock->expects(self::once())->method('load');
+ $collectionMock->expects(self::once())->method('addCategoryIds');
+ $collectionMock->expects(self::once())->method('getItems')->willReturn([$itemsMock]);
+ $collectionMock->expects(self::once())->method('getSize')->willReturn(128);
+ $collectionMock->expects(self::once())->method('addOrder')->with($fieldName, 'ASC');
+ $collectionMock->expects(self::once())->method('setCurPage')->with(4);
+ $collectionMock->expects(self::exactly(2))->method('joinAttribute')
->withConsecutive(
['status', 'catalog_product/status', 'entity_id', null, 'inner'],
['visibility', 'catalog_product/visibility', 'entity_id', null, 'inner']
- );
- $searchCriteriaMock->expects($this->once())->method('getFilterGroups')->willReturn([$filterGroupMock]);
- $filterGroupMock->expects($this->once())->method('getFilters')->willReturn([$filterGroupFilterMock]);
- $filterGroupFilterMock->expects($this->exactly(2))->method('getConditionType')->willReturn('eq');
- $filterGroupFilterMock->expects($this->atLeastOnce())->method('getField')->willReturn($fieldName);
- $filterGroupFilterMock->expects($this->once())->method('getValue')->willReturn('value');
+ );
+
+ $productAttributeMock = $this->getMockBuilder(ProductAttributeInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $productAttributeMock->expects(self::once())->method('getAttributeCode')->willReturn($attributeCode);
+
+ $extendedSearchCriteriaMock = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteria::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $productAttributeSearchResultsMock = $this->getMockBuilder(ProductAttributeSearchResultsInterface::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getItems'])
+ ->getMockForAbstractClass();
+ $productAttributeSearchResultsMock->expects(self::once())->method('getItems')
+ ->willReturn([$productAttributeMock]);
+
+ $this->collectionFactoryMock->expects(self::once())
+ ->method('create')
+ ->willReturn($collectionMock);
+
+ $this->extensionAttributesJoinProcessor->expects(self::once())
+ ->method('process')
+ ->with($collectionMock);
+
+ $this->metadataServiceMock->expects(self::once())->method('getList')->with($extendedSearchCriteriaMock)
+ ->willReturn($productAttributeSearchResultsMock);
+
+ $this->searchCriteriaBuilderMock->expects(self::once())->method('create')
+ ->willReturn($extendedSearchCriteriaMock);
+
$this->expectAddToFilter($fieldName, $collectionMock);
- $searchCriteriaMock->expects($this->once())->method('getSortOrders')->willReturn([$sortOrderMock]);
- $sortOrderMock->expects($this->atLeastOnce())->method('getField')->willReturn($fieldName);
- $sortOrderMock->expects($this->once())->method('getDirection')->willReturn(SortOrder::SORT_ASC);
- $collectionMock->expects($this->once())->method('addOrder')->with($fieldName, 'ASC');
- $searchCriteriaMock->expects($this->once())->method('getCurrentPage')->willReturn(4);
- $collectionMock->expects($this->once())->method('setCurPage')->with(4);
- $searchCriteriaMock->expects($this->once())->method('getPageSize')->willReturn(42);
- $collectionMock->expects($this->once())->method('setPageSize')->with(42);
- $collectionMock->expects($this->once())->method('load');
- $collectionMock->expects($this->once())->method('getItems')->willReturn([$itemsMock]);
- $collectionMock->expects($this->once())->method('getSize')->willReturn(128);
- $searchResultsMock = $this->getMock(
- \Magento\Catalog\Api\Data\ProductSearchResultsInterface::class,
- [],
- [],
- '',
- false
- );
- $searchResultsMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock);
- $searchResultsMock->expects($this->once())->method('setItems')->with([$itemsMock]);
- $searchResultsMock->expects($this->once())->method('setTotalCount')->with(128);
- $this->searchResultsFactoryMock->expects($this->once())->method('create')->willReturn($searchResultsMock);
+ $searchResultsMock = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductSearchResultsInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $searchResultsMock->expects(self::once())->method('setSearchCriteria')->with($searchCriteriaMock);
+ $searchResultsMock->expects(self::once())->method('setItems')->with([$itemsMock]);
+
+ $this->searchResultsFactoryMock->expects($this->once())->method('create')->willReturn($searchResultsMock);
$this->assertEquals($searchResultsMock, $this->model->getList($searchCriteriaMock));
}
@@ -1267,6 +1291,45 @@ public function testSaveExistingWithNewMediaGalleryEntries()
$this->model->save($this->productMock);
}
+ public function testSaveWithDifferentWebsites()
+ {
+ $getWebsitesResultData = [
+ 1 => ['first'],
+ 2 => ['second'],
+ 3 => ['third']
+ ];
+ $getWebsiteIdsResultData = [1,2,3];
+ $setWebsiteIdsResultData = [2,3];
+ $getIdBySkuResultData = 100;
+ $storeMock = $this->getMock(StoreInterface::class);
+ $this->resourceModelMock->expects($this->at(0))->method('getIdBySku')->will($this->returnValue(null));
+ $this->resourceModelMock
+ ->expects($this->at(3))
+ ->method('getIdBySku')
+ ->will($this->returnValue($getIdBySkuResultData));
+ $this->productFactoryMock->expects($this->any())
+ ->method('create')
+ ->will($this->returnValue($this->productMock));
+ $this->initializationHelperMock->expects($this->never())->method('initialize');
+ $this->resourceModelMock->expects($this->once())->method('validate')->with($this->productMock)
+ ->willReturn(true);
+ $this->resourceModelMock->expects($this->once())->method('save')->with($this->productMock)->willReturn(true);
+ $this->extensibleDataObjectConverterMock
+ ->expects($this->once())
+ ->method('toNestedArray')
+ ->will($this->returnValue($this->productData));
+ $this->storeManagerMock->expects($this->any())
+ ->method('getStore')
+ ->willReturn($storeMock);
+ $this->storeManagerMock->expects($this->once())
+ ->method('getWebsites')
+ ->willReturn($getWebsitesResultData);
+ $this->productMock->expects($this->once())->method('getWebsiteIds')->willReturn($getWebsiteIdsResultData);
+ $this->productMock->expects($this->once())->method('setWebsiteIds')->willReturn($setWebsiteIdsResultData);
+
+ $this->assertEquals($this->productMock, $this->model->save($this->productMock));
+ }
+
public function testSaveExistingWithMediaGalleryEntries()
{
//update one entry, delete one entry
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php
index ee224b9aae230..5fda5f029e60f 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php
@@ -1,6 +1,6 @@
assertEquals("red", $this->model->getCustomAttribute($colorAttributeCode)->getValue());
//Change the attribute value, should reflect in getCustomAttribute
- $this->model->setData($colorAttributeCode, "blue");
+ $this->model->setCustomAttribute($colorAttributeCode, "blue");
$this->assertEquals(1, count($this->model->getCustomAttributes()));
$this->assertNotNull($this->model->getCustomAttribute($colorAttributeCode));
$this->assertEquals("blue", $this->model->getCustomAttribute($colorAttributeCode)->getValue());
@@ -1391,21 +1391,6 @@ public function testGetOptionByIdForProductWithoutOptions()
$this->assertNull($this->model->getOptionById(100));
}
- public function testCleanCache()
- {
- //Without an ID cleanCache won't clean anything because the entity is
- //not identified and it will be called later exactly once.
- $this->model->setId(null);
- $this->cacheManagerMock
- ->expects($this->once())
- ->method('clean');
- $this->model->cleanCache();
-
- //Now that ID is set clean will be called.
- $this->model->setId(1);
- $this->model->cleanCache();
- }
-
public function testGetCacheTags()
{
//If entity is identified getCacheTags has to return the same values
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypeListTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypeListTest.php
index 3c4e1fb3fc052..ebefb8eb25a36 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypeListTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypeListTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types.xml b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types.xml
index dc5284d1e5405..0538e81178154 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types.xml
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml
index 724203272620b..7edbc399a9476 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/ConfigTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/ConfigTest.php
index 0c5d7e98095bb..584d034d03719 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/ConfigTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/ConfigTest.php
@@ -1,6 +1,6 @@
_model = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Category\Collection::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['joinTable'])
+ ->getMock();
+ }
+
+ public function testStoreIdUsedByUrlRewrite()
+ {
+ $cond = '{{table}}.is_autogenerated = 1 AND {{table}}.store_id = 100 AND {{table}}.entity_type = \'category\'';
+ $this->_model->expects($this->once())
+ ->method('joinTable')
+ ->with(
+ $this->anything(),
+ $this->anything(),
+ $this->anything(),
+ $this->equalTo($cond),
+ $this->anything()
+ );
+ $this->_model->setStoreId(100);
+ $this->_model->joinUrlRewrite();
+ }
+}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/FlatTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/FlatTest.php
index d1e8570c9c399..af8cca7f71a9d 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/FlatTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/FlatTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/Test/Unit/Observer/MenuCategoryDataTest.php b/app/code/Magento/Catalog/Test/Unit/Observer/MenuCategoryDataTest.php
index 23ea2bc891748..5580cd0c90517 100644
--- a/app/code/Magento/Catalog/Test/Unit/Observer/MenuCategoryDataTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Observer/MenuCategoryDataTest.php
@@ -1,6 +1,6 @@
[
'config' => [
'label' => __('Compatible File Extensions'),
+ 'notice' => __('Enter separated extensions, like: png, jpg, gif.'),
'componentType' => Field::NAME,
'formElement' => Input::NAME,
'dataScope' => static::FIELD_FILE_EXTENSION_NAME,
diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php
index de1d780fbf4fb..3d32fd5b9e957 100755
--- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php
+++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/etc/adminhtml/di.xml b/app/code/Magento/Catalog/etc/adminhtml/di.xml
index 5bc29d75f4186..eab6efa31f786 100644
--- a/app/code/Magento/Catalog/etc/adminhtml/di.xml
+++ b/app/code/Magento/Catalog/etc/adminhtml/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/adminhtml/events.xml b/app/code/Magento/Catalog/etc/adminhtml/events.xml
index 034204feff5c9..f4fd7fc30398c 100644
--- a/app/code/Magento/Catalog/etc/adminhtml/events.xml
+++ b/app/code/Magento/Catalog/etc/adminhtml/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/adminhtml/menu.xml b/app/code/Magento/Catalog/etc/adminhtml/menu.xml
index ee0d1ec5c4117..363829adf4795 100644
--- a/app/code/Magento/Catalog/etc/adminhtml/menu.xml
+++ b/app/code/Magento/Catalog/etc/adminhtml/menu.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/adminhtml/routes.xml b/app/code/Magento/Catalog/etc/adminhtml/routes.xml
index 5deeddb3bb4bd..9015ef28b1a11 100644
--- a/app/code/Magento/Catalog/etc/adminhtml/routes.xml
+++ b/app/code/Magento/Catalog/etc/adminhtml/routes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml
index c5a1b3686fbe5..f91d12b0b2a3c 100644
--- a/app/code/Magento/Catalog/etc/adminhtml/system.xml
+++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/catalog_attributes.xml b/app/code/Magento/Catalog/etc/catalog_attributes.xml
index 650652aa94555..4d9a2db084e39 100644
--- a/app/code/Magento/Catalog/etc/catalog_attributes.xml
+++ b/app/code/Magento/Catalog/etc/catalog_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/catalog_attributes.xsd b/app/code/Magento/Catalog/etc/catalog_attributes.xsd
index d95d5a17c258e..91d6e19896ff8 100644
--- a/app/code/Magento/Catalog/etc/catalog_attributes.xsd
+++ b/app/code/Magento/Catalog/etc/catalog_attributes.xsd
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/config.xml b/app/code/Magento/Catalog/etc/config.xml
index 4a8a523e0d55c..188824a0a5245 100644
--- a/app/code/Magento/Catalog/etc/config.xml
+++ b/app/code/Magento/Catalog/etc/config.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/crontab.xml b/app/code/Magento/Catalog/etc/crontab.xml
index d69ac8f319b5e..c3a8106544357 100644
--- a/app/code/Magento/Catalog/etc/crontab.xml
+++ b/app/code/Magento/Catalog/etc/crontab.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml
index f2f92c6af7484..8ed8da543f365 100644
--- a/app/code/Magento/Catalog/etc/di.xml
+++ b/app/code/Magento/Catalog/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/eav_attributes.xml b/app/code/Magento/Catalog/etc/eav_attributes.xml
index 005402937232f..4d373b540c9fd 100644
--- a/app/code/Magento/Catalog/etc/eav_attributes.xml
+++ b/app/code/Magento/Catalog/etc/eav_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/events.xml b/app/code/Magento/Catalog/etc/events.xml
index 3aa218aac1bdb..8a986a17a6b72 100644
--- a/app/code/Magento/Catalog/etc/events.xml
+++ b/app/code/Magento/Catalog/etc/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/extension_attributes.xml b/app/code/Magento/Catalog/etc/extension_attributes.xml
index ca35211f82553..a8bd78fb68b9d 100644
--- a/app/code/Magento/Catalog/etc/extension_attributes.xml
+++ b/app/code/Magento/Catalog/etc/extension_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/frontend/di.xml b/app/code/Magento/Catalog/etc/frontend/di.xml
index ca1e1e244f49c..6b79af7dbce2d 100644
--- a/app/code/Magento/Catalog/etc/frontend/di.xml
+++ b/app/code/Magento/Catalog/etc/frontend/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/frontend/events.xml b/app/code/Magento/Catalog/etc/frontend/events.xml
index dd225750f73be..63d5f5d3de7ae 100644
--- a/app/code/Magento/Catalog/etc/frontend/events.xml
+++ b/app/code/Magento/Catalog/etc/frontend/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/frontend/page_types.xml b/app/code/Magento/Catalog/etc/frontend/page_types.xml
index 8f929046afeef..daff27951921c 100644
--- a/app/code/Magento/Catalog/etc/frontend/page_types.xml
+++ b/app/code/Magento/Catalog/etc/frontend/page_types.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/frontend/routes.xml b/app/code/Magento/Catalog/etc/frontend/routes.xml
index d4d52559673d6..5b7aa8293d937 100644
--- a/app/code/Magento/Catalog/etc/frontend/routes.xml
+++ b/app/code/Magento/Catalog/etc/frontend/routes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/frontend/sections.xml b/app/code/Magento/Catalog/etc/frontend/sections.xml
index 0bc9c63494b33..7e2c1d1166d1d 100644
--- a/app/code/Magento/Catalog/etc/frontend/sections.xml
+++ b/app/code/Magento/Catalog/etc/frontend/sections.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/indexer.xml b/app/code/Magento/Catalog/etc/indexer.xml
index 5c2ca91e525d9..08ad108119b4a 100644
--- a/app/code/Magento/Catalog/etc/indexer.xml
+++ b/app/code/Magento/Catalog/etc/indexer.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml
index 571176694547a..013afe8f2c2bf 100644
--- a/app/code/Magento/Catalog/etc/module.xml
+++ b/app/code/Magento/Catalog/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/mview.xml b/app/code/Magento/Catalog/etc/mview.xml
index 4600bb7fad370..4213faf9307b5 100644
--- a/app/code/Magento/Catalog/etc/mview.xml
+++ b/app/code/Magento/Catalog/etc/mview.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/product_options.xml b/app/code/Magento/Catalog/etc/product_options.xml
index 43bf4865cb49e..09c5ffde5957d 100644
--- a/app/code/Magento/Catalog/etc/product_options.xml
+++ b/app/code/Magento/Catalog/etc/product_options.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/product_options.xsd b/app/code/Magento/Catalog/etc/product_options.xsd
index 18b5934c1410f..9ca354f6eed93 100644
--- a/app/code/Magento/Catalog/etc/product_options.xsd
+++ b/app/code/Magento/Catalog/etc/product_options.xsd
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/product_options_merged.xsd b/app/code/Magento/Catalog/etc/product_options_merged.xsd
index 7b9e6fa2650ec..9dd95e3c4bd1d 100644
--- a/app/code/Magento/Catalog/etc/product_options_merged.xsd
+++ b/app/code/Magento/Catalog/etc/product_options_merged.xsd
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/product_types.xml b/app/code/Magento/Catalog/etc/product_types.xml
index 513f0905b13ce..fe4922ab8fa1f 100644
--- a/app/code/Magento/Catalog/etc/product_types.xml
+++ b/app/code/Magento/Catalog/etc/product_types.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/product_types.xsd b/app/code/Magento/Catalog/etc/product_types.xsd
index 06999fbeddc7a..b25168f20e93e 100644
--- a/app/code/Magento/Catalog/etc/product_types.xsd
+++ b/app/code/Magento/Catalog/etc/product_types.xsd
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/product_types_base.xsd b/app/code/Magento/Catalog/etc/product_types_base.xsd
index eddd7a6845488..da0e0847f0744 100644
--- a/app/code/Magento/Catalog/etc/product_types_base.xsd
+++ b/app/code/Magento/Catalog/etc/product_types_base.xsd
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/product_types_merged.xsd b/app/code/Magento/Catalog/etc/product_types_merged.xsd
index 1b1d92c163989..62a149f84570d 100644
--- a/app/code/Magento/Catalog/etc/product_types_merged.xsd
+++ b/app/code/Magento/Catalog/etc/product_types_merged.xsd
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/view.xml b/app/code/Magento/Catalog/etc/view.xml
index 8c7500d9c1374..910a3be8055da 100644
--- a/app/code/Magento/Catalog/etc/view.xml
+++ b/app/code/Magento/Catalog/etc/view.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/webapi.xml b/app/code/Magento/Catalog/etc/webapi.xml
index de66084cb50ef..fd5d4d0db1b34 100644
--- a/app/code/Magento/Catalog/etc/webapi.xml
+++ b/app/code/Magento/Catalog/etc/webapi.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/webapi_rest/di.xml b/app/code/Magento/Catalog/etc/webapi_rest/di.xml
index 67e74dfbfd44e..1d2b013f2035d 100644
--- a/app/code/Magento/Catalog/etc/webapi_rest/di.xml
+++ b/app/code/Magento/Catalog/etc/webapi_rest/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/webapi_soap/di.xml b/app/code/Magento/Catalog/etc/webapi_soap/di.xml
index cb5273e4aeac5..98a8ef4de8408 100644
--- a/app/code/Magento/Catalog/etc/webapi_soap/di.xml
+++ b/app/code/Magento/Catalog/etc/webapi_soap/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/etc/widget.xml b/app/code/Magento/Catalog/etc/widget.xml
index f54d4af816c09..153eeedda1d03 100644
--- a/app/code/Magento/Catalog/etc/widget.xml
+++ b/app/code/Magento/Catalog/etc/widget.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/registration.php b/app/code/Magento/Catalog/registration.php
index fada27f08c173..94fe0b1115ce2 100644
--- a/app/code/Magento/Catalog/registration.php
+++ b/app/code/Magento/Catalog/registration.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml
index 30add348f7d2b..6cf41439bf600 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml
index ec97c79610237..21bc2d3c9cd54 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_add.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_add.xml
index d9c70ae487903..8653cbb39343e 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_add.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_add.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_create.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_create.xml
index 02734a674189e..bb103272e5132 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_create.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_create.xml
@@ -1,7 +1,7 @@
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 799c50dfc4756..65ef48cd751d1 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
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml
index 3a073f75eef12..37c2453a2d380 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertspricegrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertspricegrid.xml
index 0cd56d138149e..a65603e513bdb 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertspricegrid.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertspricegrid.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertsstockgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertsstockgrid.xml
index d098da96d3e52..fb63d4e96e657 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertsstockgrid.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertsstockgrid.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit.xml
index ddf02a7cdb9c2..c3328455be8ab 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_form.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_form.xml
index 8f4780d34b17d..1a20c77199913 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_form.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_form.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml
index a19d29a98720e..a46f6e5b0e8b4 100755
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_change_attribute_set.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_change_attribute_set.xml
index 422cf537c3081..794ea397d0829 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_change_attribute_set.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_change_attribute_set.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml
index 9c1280a2500df..4a27158be5f7c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml
index 96c66485f2132..b5efecf0d03c2 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_customoptions.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_customoptions.xml
index 39781cc8adcf0..02f9f32cc91f1 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_customoptions.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_customoptions.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml
index 3375f5b8233f5..1c574a1e918e9 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_form.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_form.xml
index 194c745e6a65a..af1238cb791d7 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_form.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_form.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grid.xml
index e214ccad3dc21..b42a78dfbe302 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grid.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grid.xml
@@ -1,7 +1,7 @@
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 bad6a5d165535..c503196cc8647 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
@@ -1,7 +1,7 @@
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 cb993bc892eac..f43f0c321e280 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
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_options.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_options.xml
index 7d88ff2a04384..9c4fd4d0d7506 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_options.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_options.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_optionsimportgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_optionsimportgrid.xml
index 7f6f62943bbea..b167b3292cb6c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_optionsimportgrid.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_optionsimportgrid.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml
index 6b688eeec2084..1340d40ef4f9f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml
index 4a306dd725b91..1ae83419ae646 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reload.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reload.xml
index 422cf537c3081..794ea397d0829 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reload.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reload.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml
index bbbc1e21669e1..22e16cac8cef2 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml
index bd8c2cd3550f3..a55c7590df9af 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_index.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_index.xml
index b25eecbbc2502..b97ca4a3cbc98 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_index.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_index.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml
index ce0b1521d82e6..a9770ed3c182e 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml
index 83c19659b5135..a4acf572caeb5 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js b/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js
index 848d1f1da908c..5ffc587f65bec 100644
--- a/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js
+++ b/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml
index eaeed5b12ebaf..4cb96a1f840f7 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml
index cf40ee6d78af6..099bd2cae6c5e 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml
index 2cdb9f451a86f..bb3f69ead1c2d 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml
index 6eed355cc3b83..8f75f37104346 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
index cb60254d4d8c7..538541136e910 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
@@ -1,6 +1,6 @@
+
x %2 px. ',
' ',
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml
index 0788d1449d715..2020e24432d4e 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml
index 464e10d6da15c..eb934a5a25fba 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml
@@ -1,6 +1,6 @@
@@ -183,6 +183,7 @@
- false
- false
- false
+ - true
- ui/form/field
- category
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/crosssell_product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/crosssell_product_listing.xml
index 25eb8092ab40d..1cdfbe6439b30 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/crosssell_product_listing.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/crosssell_product_listing.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml
index bf0fd9e33d2e1..942f0e62bc18b 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/new_category_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/new_category_form.xml
index a0307886770c6..2773e9ffa3abe 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/new_category_form.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/new_category_form.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml
index ab5ab6e288e13..afdcdce3356ed 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attributes_grid.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attributes_grid.xml
index 24243f35bc958..852cd9207d27b 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attributes_grid.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attributes_grid.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_custom_options_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_custom_options_listing.xml
index beef5bfe6c314..7ee82e8804298 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_custom_options_listing.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_custom_options_listing.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml
index b99e01147c00d..b3db96293da88 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml
index 5220c962ad0f5..25e6ac9714949 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/related_product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/related_product_listing.xml
index 7801b4169a7e2..1f3f42f5c9d26 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/related_product_listing.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/related_product_listing.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/upsell_product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/upsell_product_listing.xml
index 2cca1d18b46f5..eedf965e1a14e 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/upsell_product_listing.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/upsell_product_listing.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/apply-to-type-switcher.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/apply-to-type-switcher.js
index 13543ade8f726..a5ca9eb1eab0b 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/apply-to-type-switcher.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/apply-to-type-switcher.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js
index 4ba2d110ffb34..ae2ef17d2b0a4 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*global alert:true*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js
index 1da9c2c379c37..829c04c13106d 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js
index 66eb039790f28..05e94bed9ab1f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js
index 9f413832537e2..50934ef273c89 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js
index 78f48b0bafabb..57ba9c01854b2 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js
index b751e75947ecc..20be1cc594d1e 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
require([
@@ -22,7 +22,13 @@ require([
}
function disableFieldEditMode(fieldId) {
- byId(fieldId).prop('disabled', true);
+ var field = byId(fieldId);
+
+ field.prop('disabled', true);
+
+ if (field.next().hasClass('addafter')) {
+ field.parent().addClass('_update-attributes-disabled');
+ }
if (byId(fieldId + '_hidden').length) {
byId(fieldId + '_hidden').prop('disabled', true);
@@ -30,7 +36,13 @@ require([
}
function enableFieldEditMode(fieldId) {
- byId(fieldId).prop('disabled', false);
+ var field = byId(fieldId);
+
+ field.prop('disabled', false);
+
+ if (field.parent().hasClass('_update-attributes-disabled')) {
+ field.parent().removeClass('_update-attributes-disabled');
+ }
if (byId(fieldId + '_hidden').length) {
byId(fieldId + '_hidden').prop('disabled', false);
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js
index 2af880f4d04c5..034085df6cbb3 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js
index 0f45dda8043d0..d315f94f4b6fd 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js
index 9de0ff75fa843..d836974d8574d 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/file-type-field.js b/app/code/Magento/Catalog/view/adminhtml/web/component/file-type-field.js
index bed32eb574695..72bf80a02fdac 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/component/file-type-field.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/component/file-type-field.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js b/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js
index cbb16b397f9e6..c89acc1d7f2cc 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/select-type-grid.js b/app/code/Magento/Catalog/view/adminhtml/web/component/select-type-grid.js
index 57d35424268b8..6262e4d5e5f5f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/component/select-type-grid.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/component/select-type-grid.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-container.js b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-container.js
index b3ef035402c3e..977b7e2e48185 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-container.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-container.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-input.js b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-input.js
index d520758d456a5..46eb6ddb3bf79 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-input.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-input.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-select.js b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-select.js
index 6b61b5e49c97a..0c3190434a09d 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-select.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-select.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/text-type-field.js b/app/code/Magento/Catalog/view/adminhtml/web/component/text-type-field.js
index 72d97b7aebcd9..2b829e5293f46 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/component/text-type-field.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/component/text-type-field.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/bundle-proxy-button.js b/app/code/Magento/Catalog/view/adminhtml/web/js/bundle-proxy-button.js
index 42543656f210b..f260c5066223f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/bundle-proxy-button.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/bundle-proxy-button.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js b/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js
index 5453b760e2f31..e2d7b230fd480 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true jquery:true*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attribute-set-select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attribute-set-select.js
index baefa1ae2e4b5..82bb539a5cc5c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attribute-set-select.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attribute-set-select.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-fieldset.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-fieldset.js
index 1e363ef2a1a0f..3b16c6ab1e2a0 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-fieldset.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-fieldset.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-grid-paging.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-grid-paging.js
index 641dfaf295150..cac54a913da59 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-grid-paging.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-grid-paging.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-insert-listing.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-insert-listing.js
index 10be9f2ffc907..ef47716434d7c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-insert-listing.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-insert-listing.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/checkbox.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/checkbox.js
index b371efca26f64..866cadd6afbad 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/checkbox.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/checkbox.js
@@ -1,4 +1,4 @@
-/* Copyright © 2013-2017 Magento, Inc. All rights reserved.
+/* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-hide-select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-hide-select.js
index 4bf54406e3598..313270caa9954 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-hide-select.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-hide-select.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/input.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/input.js
index 1961bc5fde625..f845b827feb34 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/input.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/input.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/select.js
index 2dc21fc11cf55..d5b8dc8aaedfa 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/select.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/select.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/strategy.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/strategy.js
index e8b276c171ca4..617332ed1c82f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/strategy.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/strategy.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(function () {
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/yesno.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/yesno.js
index 7362acbe63eb2..da113dbf825a2 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/yesno.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/yesno.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js
index 87c7a49db19d1..999dd0880b110 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js
index a6c71e7d4b660..06b670df8a38b 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
@@ -141,6 +141,7 @@ define([
// strip tags
tmpElement = document.createElement('div');
+ str = str.replace(/(<([^>]+)>)/ig, '');
tmpElement.innerHTML = str;
str = tmpElement.textContent || tmpElement.innerText || '';
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/input-handle-required.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/input-handle-required.js
index c342e961fa9e2..73fc159d682a8 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/input-handle-required.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/input-handle-required.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/messages.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/messages.js
index 7e3696ba24bf8..a942ac3a7c573 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/messages.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/messages.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/multiselect-handle-required.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/multiselect-handle-required.js
index b7146137c6bb3..c48c0472b8961 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/multiselect-handle-required.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/multiselect-handle-required.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-form.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-form.js
index 360349f8c61e5..6702b94b119de 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-form.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-form.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-insert-form.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-insert-form.js
index f3624de9cbd0f..fea7195adcf85 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-insert-form.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-insert-form.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-category.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-category.js
index 7a16067b37291..adf6b976d704d 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-category.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-category.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/product-status.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/product-status.js
index 3e3c811584973..5851e8af46644 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/product-status.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/product-status.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-handle-required.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-handle-required.js
index 08ed325c82a78..7f978f9a4f36e 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-handle-required.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-handle-required.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-to-checkbox.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-to-checkbox.js
index 281ef42a9e533..6180ac3051adb 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-to-checkbox.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-to-checkbox.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/url-key-handle-changes.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/url-key-handle-changes.js
index b12f73c17125a..0d3b0b83760ea 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/url-key-handle-changes.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/url-key-handle-changes.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/date.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/date.js
index ecdb3a66006b7..6f46d2911dd29 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/date.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/date.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/fieldset.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/fieldset.js
index 581153832d3a5..2d61b67ae7c74 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/fieldset.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/fieldset.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/input.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/input.js
index bd832632f7513..3fb5ec34717d7 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/input.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/input.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/select.js
index 05453dc19bff8..0030874c1c81e 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/select.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/select.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/strategy.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/strategy.js
index 2e59efeab1b58..61f2a1f000b44 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/strategy.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/strategy.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(function () {
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/textarea.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/textarea.js
index 7446174982a21..0bda5142ea472 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/textarea.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/textarea.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/yesno.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/yesno.js
index 9f8a9e43dacc5..dfa087eddec7c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/yesno.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/yesno.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js
index 878e8e1429680..b46d09a7323b1 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
index 0611c4fae9233..66ed079745150 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/edit-tree.js b/app/code/Magento/Catalog/view/adminhtml/web/js/edit-tree.js
index 7420595078071..41aba13623578 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/edit-tree.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/edit-tree.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js
index 1ecfddac7abb8..97f978de47b60 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/checkbox.js b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/checkbox.js
index 57d45551d180b..0c2eea53bfbad 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/checkbox.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/checkbox.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js
index 84be3a4f8783b..51ffeaea0fc0c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js b/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js
index e20d3f3e0c5b1..169d89d3b766d 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true jquery:true*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js
index 75d768dae7bb6..5239eb207efca 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js b/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js
index 2cfde92d6a762..e0a93ef666938 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint jquery:true*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js b/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js
index a2ae5b794f601..7628b376abe3f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/attributes/grid/paging.html b/app/code/Magento/Catalog/view/adminhtml/web/template/attributes/grid/paging.html
index bf03ffb1049e7..0797843cbf226 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/template/attributes/grid/paging.html
+++ b/app/code/Magento/Catalog/view/adminhtml/web/template/attributes/grid/paging.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/checkbox.html b/app/code/Magento/Catalog/view/adminhtml/web/template/checkbox.html
index 7a2c8e42364df..8510168f4ab30 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/template/checkbox.html
+++ b/app/code/Magento/Catalog/view/adminhtml/web/template/checkbox.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html
index 3a516ad41358f..5d6bb0ae1498f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html
+++ b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-service.html b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-service.html
index ad83bc144615e..c8c2bf5e2b22a 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-service.html
+++ b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-service.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-type-service.html b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-type-service.html
index 3c3cbbde2ab39..0a5f7d946670d 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-type-service.html
+++ b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-type-service.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/input.html b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/input.html
index 560bc90ea6d19..a3aad4284d8d8 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/input.html
+++ b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/input.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html b/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html
index cb741f5288d28..eac68139eecaa 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html
+++ b/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml b/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml
index b47a6a3e69d86..28bf58bfff5c2 100644
--- a/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml
+++ b/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/base/layout/default.xml b/app/code/Magento/Catalog/view/base/layout/default.xml
index 776dbc4b646ef..9b6d27744bcc9 100644
--- a/app/code/Magento/Catalog/view/base/layout/default.xml
+++ b/app/code/Magento/Catalog/view/base/layout/default.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/base/layout/empty.xml b/app/code/Magento/Catalog/view/base/layout/empty.xml
index 776dbc4b646ef..9b6d27744bcc9 100644
--- a/app/code/Magento/Catalog/view/base/layout/empty.xml
+++ b/app/code/Magento/Catalog/view/base/layout/empty.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/base/templates/js/components.phtml b/app/code/Magento/Catalog/view/base/templates/js/components.phtml
index bdcb2e9bf7747..e71938935b8f3 100644
--- a/app/code/Magento/Catalog/view/base/templates/js/components.phtml
+++ b/app/code/Magento/Catalog/view/base/templates/js/components.phtml
@@ -1,6 +1,6 @@
getAdjustmentsHtml() ?>
getSchema()): ?>
+
diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/configured_price.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/configured_price.phtml
index eb424571e9f49..58f1ec1295fea 100644
--- a/app/code/Magento/Catalog/view/base/templates/product/price/configured_price.phtml
+++ b/app/code/Magento/Catalog/view/base/templates/product/price/configured_price.phtml
@@ -1,6 +1,6 @@
' +
- '<% if (data.finalPrice.value) { %>' +
+ '<% if (data.finalPrice.value > 0) { %>' +
' +<%- data.finalPrice.formatted %>' +
+ '<% } else if (data.finalPrice.value < 0) { %>' +
+ ' <%- data.finalPrice.formatted %>' +
'<% } %>',
controlContainer: 'dd'
};
diff --git a/app/code/Magento/Catalog/view/base/web/js/price-utils.js b/app/code/Magento/Catalog/view/base/web/js/price-utils.js
index 2b867658f05d2..4d3747a108068 100644
--- a/app/code/Magento/Catalog/view/base/web/js/price-utils.js
+++ b/app/code/Magento/Catalog/view/base/web/js/price-utils.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
@@ -70,7 +70,7 @@ define([
am = Number(Math.round(Math.abs(amount - i) + 'e+' + precision) + ('e-' + precision));
r = (j ? i.substr(0, j) + groupSymbol : '') +
i.substr(j).replace(re, '$1' + groupSymbol) +
- (precision ? decimalSymbol + am.toFixed(2).replace(/-/, 0).slice(2) : '');
+ (precision ? decimalSymbol + am.toFixed(precision).replace(/-/, 0).slice(2) : '');
return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
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 95e1cd3d358c1..1e3505ba1b08c 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
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default.xml
index d6788f3d4eed6..b5116f6784522 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default_without_children.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default_without_children.xml
index e01b48cc71b11..6b97ebabce5b7 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default_without_children.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default_without_children.xml
@@ -1,7 +1,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 c6f02a8acb155..181aa0fd92202 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
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_gallery.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_gallery.xml
index 7e39fd35d6cde..f1a96d0220ef0 100755
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_gallery.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_gallery.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_opengraph.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_opengraph.xml
index 661ec52df3dcd..2d8b0a502bb10 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_opengraph.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_opengraph.xml
@@ -1,7 +1,7 @@
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 dbb13639831c1..0d98217052782 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
@@ -1,7 +1,7 @@
@@ -94,7 +94,7 @@
getShortDescription
short_description
overview
- none
+ none
Overview
itemprop="description"
@@ -109,7 +109,7 @@
getDescription
description
description
- none
+ none
Details
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_simple.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_simple.xml
index 6703d18deac37..94783b254f8d7 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_simple.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_simple.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_virtual.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_virtual.xml
index dd93e8064e60c..b2fe3e1b5cdd9 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_virtual.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_virtual.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml
index ee16e638b64cb..81d720d60ee3e 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/layout/default.xml b/app/code/Magento/Catalog/view/frontend/layout/default.xml
index f267c2a5ae634..1e52f04820e2d 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/default.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/default.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/requirejs-config.js b/app/code/Magento/Catalog/view/frontend/requirejs-config.js
index 790c25ee6dce2..9c0d36b417546 100644
--- a/app/code/Magento/Catalog/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Catalog/view/frontend/requirejs-config.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml
index 818456d2272f6..992af539aaf05 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml
@@ -1,6 +1,6 @@
+
getIsActive()): ?>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml
index 0fb2622254d71..c7ecc4e940bd1 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml
index c3280c563fe58..6c64b3949f8ce 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml
index 177b45ee679e6..f79a2430fcab1 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml
@@ -1,6 +1,6 @@
helper('Magento\Catalog\Helper\Output');
' : ' ' ?>
-
+
getImage($_product, $image);
if ($pos != null) {
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml
index 518944dfb236c..b428c61b959f3 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml
@@ -1,6 +1,6 @@
-isRedirectToCartEnabled()) : ?>
-
-
-
-
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml
index 9a0afa97578c0..aeecbb21f1cca 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml
@@ -1,6 +1,6 @@
getAtLabel();
$_attributeType = $block->getAtType();
$_attributeAddAttribute = $block->getAddAttribute();
+$renderLabel = true;
+// if defined as 'none' in layout, do not render
+if ($_attributeLabel == 'none') {
+ $renderLabel = false;
+}
+
if ($_attributeLabel && $_attributeLabel == 'default') {
$_attributeLabel = $_product->getResource()->getAttribute($_code)->getFrontendLabel();
}
@@ -34,7 +40,7 @@ if ($_attributeType && $_attributeType == 'text') {
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml
index 431b0229ef682..2e7bedad92cf2 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper/bottom.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper/bottom.phtml
index 08642bc792586..871c29a09ff65 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper/bottom.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper/bottom.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml
index 8c7376ea1cead..45e5aa9b18e97 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html b/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html
index 88886989b19aa..d59237c190f71 100644
--- a/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html
+++ b/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product.php b/app/code/Magento/CatalogImportExport/Model/Export/Product.php
index b3f266728e952..4fdfaf9581420 100644
--- a/app/code/Magento/CatalogImportExport/Model/Export/Product.php
+++ b/app/code/Magento/CatalogImportExport/Model/Export/Product.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogImportExport/etc/di.xml b/app/code/Magento/CatalogImportExport/etc/di.xml
index dca2159fbdc66..1155de1455243 100644
--- a/app/code/Magento/CatalogImportExport/etc/di.xml
+++ b/app/code/Magento/CatalogImportExport/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogImportExport/etc/export.xml b/app/code/Magento/CatalogImportExport/etc/export.xml
index 824b7defdaee6..3325ff1d38a06 100644
--- a/app/code/Magento/CatalogImportExport/etc/export.xml
+++ b/app/code/Magento/CatalogImportExport/etc/export.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogImportExport/etc/import.xml b/app/code/Magento/CatalogImportExport/etc/import.xml
index e4ff1c2825654..522b478752f01 100644
--- a/app/code/Magento/CatalogImportExport/etc/import.xml
+++ b/app/code/Magento/CatalogImportExport/etc/import.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogImportExport/etc/module.xml b/app/code/Magento/CatalogImportExport/etc/module.xml
index c63a6dd52918f..517ffc0fa393d 100644
--- a/app/code/Magento/CatalogImportExport/etc/module.xml
+++ b/app/code/Magento/CatalogImportExport/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogImportExport/registration.php b/app/code/Magento/CatalogImportExport/registration.php
index 5b1c90ca644a6..4726011242428 100644
--- a/app/code/Magento/CatalogImportExport/registration.php
+++ b/app/code/Magento/CatalogImportExport/registration.php
@@ -1,6 +1,6 @@
getStockStatusResource();
$resource->addStockDataToCollection(
$collection,
- !$isShowOutOfStock && $collection->getFlag('require_stock_items')
+ !$isShowOutOfStock
);
$collection->setFlag($stockFlag, true);
}
diff --git a/app/code/Magento/CatalogInventory/Model/AddStockStatusToCollection.php b/app/code/Magento/CatalogInventory/Model/AddStockStatusToCollection.php
index 90e6ed16b7777..2c52b49c1a039 100644
--- a/app/code/Magento/CatalogInventory/Model/AddStockStatusToCollection.php
+++ b/app/code/Magento/CatalogInventory/Model/AddStockStatusToCollection.php
@@ -1,6 +1,6 @@
cacheContext->registerEntities(Product::CACHE_TAG, $productIds);
+ $this->cacheContext->registerEntities(Product::CACHE_TAG, $processIds);
$this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]);
return $this;
diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Full.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Full.php
index 2f545417a074a..dc78d4d9b5a91 100644
--- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Full.php
+++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Full.php
@@ -2,7 +2,7 @@
/**
* @category Magento
* @package Magento_CatalogInventory
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Row.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Row.php
index fda012eec3fda..c7dfcffee3d31 100644
--- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Row.php
+++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Row.php
@@ -2,7 +2,7 @@
/**
* @category Magento
* @package Magento_CatalogInventory
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Rows.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Rows.php
index b2fd2aadf288b..f107955f0201e 100644
--- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Rows.php
+++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Rows.php
@@ -2,7 +2,7 @@
/**
* @category Magento
* @package Magento_CatalogInventory
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Plugin/StoreGroup.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Plugin/StoreGroup.php
index 8ef156ad4e27c..c171e9bda2612 100644
--- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Plugin/StoreGroup.php
+++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/Plugin/StoreGroup.php
@@ -1,6 +1,6 @@
getTable('cataloginventory_stock_item');
$select = $this->getConnection()->select()->from(['si' => $itemTable])
- ->where('website_id=?', $websiteId)
+ ->where('website_id = ?', $websiteId)
->where('product_id IN(?)', $productIds)
->forUpdate(true);
@@ -139,9 +139,15 @@ public function lockProductsStock($productIds, $websiteId)
'type_id' => 'type_id'
]
);
- $this->getConnection()->query($select);
+ $items = [];
- return $this->getConnection()->fetchAll($selectProducts);
+ foreach ($this->getConnection()->query($select)->fetchAll() as $si) {
+ $items[$si['product_id']] = $si;
+ }
+ foreach ($this->getConnection()->fetchAll($selectProducts) as $p) {
+ $items[$p['product_id']]['type_id'] = $p['type_id'];
+ }
+ return $items;
}
/**
diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Collection.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Collection.php
index 2a400c0f8dd97..87df4508b4898 100644
--- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Collection.php
+++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Collection.php
@@ -1,6 +1,6 @@
stockConfiguration = $stockConfiguration;
$this->stockStateProvider = $stockStateProvider;
@@ -131,31 +137,25 @@ public function __construct(
$this->localeDate = $localeDate;
$this->indexProcessor = $indexProcessor;
$this->dateTime = $dateTime;
- }
-
- /**
- * @deprecated
- * @return \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
- */
- private function getProductCollectionFactory()
- {
- if ($this->productCollectionFactory === null) {
- $this->productCollectionFactory = ObjectManager::getInstance()->get(
- \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class
- );
+ if (null === $productCollectionFactory) {
+ $productCollectionFactory = ObjectManager::getInstance()->get(ProductCollectionFactory::class);
}
-
- return $this->productCollectionFactory;
+ $this->productCollectionFactory = $productCollectionFactory;
+ if (null === $stockRegistryStorage) {
+ $stockRegistryStorage = ObjectManager::getInstance()->get(StockRegistryStorage::class);
+ }
+ $this->stockRegistryStorage = $stockRegistryStorage;
}
/**
* @inheritdoc
+ * @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function save(\Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem)
{
try {
/** @var \Magento\Catalog\Model\Product $product */
- $product = $this->getProductCollectionFactory()->create()
+ $product = $this->productCollectionFactory->create()
->setFlag('has_stock_status_filter')
->addIdFilter($stockItem->getProductId())
->addFieldToSelect('type_id')
@@ -190,8 +190,8 @@ public function save(\Magento\CatalogInventory\Api\Data\StockItemInterface $stoc
$this->resource->save($stockItem);
$this->indexProcessor->reindexRow($stockItem->getProductId());
- $this->getStockRegistryStorage()->removeStockItem($stockItem->getProductId());
- $this->getStockRegistryStorage()->removeStockStatus($stockItem->getProductId());
+ $this->stockRegistryStorage->removeStockItem($stockItem->getProductId());
+ $this->stockRegistryStorage->removeStockStatus($stockItem->getProductId());
} catch (\Exception $exception) {
throw new CouldNotSaveException(__('Unable to save Stock Item'), $exception);
}
@@ -200,6 +200,7 @@ public function save(\Magento\CatalogInventory\Api\Data\StockItemInterface $stoc
/**
* @inheritdoc
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function get($stockItemId)
{
@@ -226,13 +227,14 @@ public function getList(\Magento\CatalogInventory\Api\StockItemCriteriaInterface
/**
* @inheritdoc
+ * @throws \Magento\Framework\Exception\CouldNotDeleteException
*/
public function delete(StockItemInterface $stockItem)
{
try {
$this->resource->delete($stockItem);
- $this->getStockRegistryStorage()->removeStockItem($stockItem->getProductId());
- $this->getStockRegistryStorage()->removeStockStatus($stockItem->getProductId());
+ $this->stockRegistryStorage->removeStockItem($stockItem->getProductId());
+ $this->stockRegistryStorage->removeStockStatus($stockItem->getProductId());
} catch (\Exception $exception) {
throw new CouldNotDeleteException(
__('Unable to remove Stock Item with id "%1"', $stockItem->getItemId()),
@@ -244,6 +246,7 @@ public function delete(StockItemInterface $stockItem)
/**
* @inheritdoc
+ * @throws \Magento\Framework\Exception\CouldNotDeleteException
*/
public function deleteById($id)
{
@@ -258,16 +261,4 @@ public function deleteById($id)
}
return true;
}
-
- /**
- * @return StockRegistryStorage
- */
- private function getStockRegistryStorage()
- {
- if (null === $this->stockRegistryStorage) {
- $this->stockRegistryStorage = \Magento\Framework\App\ObjectManager::getInstance()
- ->get('Magento\CatalogInventory\Model\StockRegistryStorage');
- }
- return $this->stockRegistryStorage;
- }
}
diff --git a/app/code/Magento/CatalogInventory/Model/Stock/StockRepository.php b/app/code/Magento/CatalogInventory/Model/Stock/StockRepository.php
index c9f956088b974..9a30b6453a6c9 100644
--- a/app/code/Magento/CatalogInventory/Model/Stock/StockRepository.php
+++ b/app/code/Magento/CatalogInventory/Model/Stock/StockRepository.php
@@ -1,6 +1,6 @@
stockRegistryProvider = $stockRegistryProvider;
$this->stockState = $stockState;
@@ -70,6 +77,8 @@ public function __construct(
$this->productRepository = $productRepository;
$this->qtyCounter = $qtyCounter;
$this->resource = $stockResource;
+ $this->stockRegistryStorage = $stockRegistryStorage ?: \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(StockRegistryStorage::class);
}
/**
@@ -92,9 +101,12 @@ public function registerProductsSale($items, $websiteId = null)
$fullSaveItems = $registeredItems = [];
foreach ($lockedItems as $lockedItemRecord) {
$productId = $lockedItemRecord['product_id'];
+ $this->stockRegistryStorage->removeStockItem($productId, $websiteId);
+
/** @var StockItemInterface $stockItem */
$orderedQty = $items[$productId];
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $websiteId);
+ $stockItem->setQty($lockedItemRecord['qty']); // update data from locked item
$canSubtractQty = $stockItem->getItemId() && $this->canSubtractQty($stockItem);
if (!$canSubtractQty || !$this->stockConfiguration->isQty($lockedItemRecord['type_id'])) {
continue;
@@ -180,7 +192,7 @@ protected function getProductType($productId)
}
/**
- * @return Stock
+ * @return ResourceStock
*/
protected function getResource()
{
diff --git a/app/code/Magento/CatalogInventory/Model/StockRegistry.php b/app/code/Magento/CatalogInventory/Model/StockRegistry.php
index 9797f3039da33..468570b7fecc5 100644
--- a/app/code/Magento/CatalogInventory/Model/StockRegistry.php
+++ b/app/code/Magento/CatalogInventory/Model/StockRegistry.php
@@ -1,6 +1,6 @@
with($productId)
->willReturn($stockItemMock);
- $this->productExtensionMock = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductExtension')
+ $this->productExtensionMock = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductExtensionInterface')
->setMethods(['setStockItem'])
->getMock();
$this->productExtensionMock->expects($this->once())
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/AroundProductRepositorySaveTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/AroundProductRepositorySaveTest.php
index c406ceed3aee0..ec7b24adc417f 100644
--- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/AroundProductRepositorySaveTest.php
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/AroundProductRepositorySaveTest.php
@@ -1,6 +1,6 @@
connectionMock = $this->getMockBuilder(Mysql::class)
->disableOriginalConstructor()
->getMock();
+ $this->statementMock = $this->getMockForAbstractClass(\Zend_Db_Statement_Interface::class);
$this->stock = $this->getMockBuilder(Stock::class)
->setMethods(['getTable', 'getConnection'])
->setConstructorArgs(
@@ -119,7 +125,21 @@ public function testLockProductsStock()
{
$websiteId = 0;
$productIds = [1, 2, 3];
- $result = ['testResult'];
+ $result = [
+ 1 => [
+ 'product_id' => 1,
+ 'type_id' => 'simple'
+ ],
+ 2 => [
+ 'product_id' => 2,
+ 'type_id' => 'simple'
+ ],
+ 3 => [
+ 'product_id' => 3,
+ 'type_id' => 'simple'
+ ]
+ ];
+
$this->selectMock->expects(self::exactly(2))
->method('from')
->withConsecutive(
@@ -130,7 +150,7 @@ public function testLockProductsStock()
$this->selectMock->expects(self::exactly(3))
->method('where')
->withConsecutive(
- [self::identicalTo('website_id=?'), self::identicalTo($websiteId)],
+ [self::identicalTo('website_id = ?'), self::identicalTo($websiteId)],
[self::identicalTo('product_id IN(?)'), self::identicalTo($productIds)],
[self::identicalTo('entity_id IN (?)'), self::identicalTo($productIds)]
)
@@ -149,10 +169,19 @@ public function testLockProductsStock()
->willReturn($this->selectMock);
$this->connectionMock->expects(self::once())
->method('query')
- ->with(self::identicalTo($this->selectMock));
+ ->with(self::identicalTo($this->selectMock))
+ ->willReturn($this->statementMock);
+ $this->statementMock->expects(self::once())
+ ->method('fetchAll')
+ ->willReturn([
+ 1 => ['product_id' => 1],
+ 2 => ['product_id' => 2],
+ 3 => ['product_id' => 3]
+ ]);
+
$this->connectionMock->expects(self::once())
->method('fetchAll')
- ->with($this->selectMock)
+ ->with(self::identicalTo($this->selectMock))
->willReturn($result);
$this->stock->expects(self::exactly(2))
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockRegistryProviderTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockRegistryProviderTest.php
index c37ea68a092c9..c08a5d71ceea2 100644
--- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockRegistryProviderTest.php
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockRegistryProviderTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml
index 9356f15cd7f86..803a6dae492a0 100644
--- a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml
+++ b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml
index c403bb3c627e1..b9332575c96f7 100644
--- a/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml
+++ b/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/config.xml b/app/code/Magento/CatalogInventory/etc/config.xml
index b4da95f48293c..976b3f4cad510 100644
--- a/app/code/Magento/CatalogInventory/etc/config.xml
+++ b/app/code/Magento/CatalogInventory/etc/config.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/di.xml b/app/code/Magento/CatalogInventory/etc/di.xml
index 9e970cef7d052..3290919a51bc7 100644
--- a/app/code/Magento/CatalogInventory/etc/di.xml
+++ b/app/code/Magento/CatalogInventory/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/events.xml b/app/code/Magento/CatalogInventory/etc/events.xml
index 6543b023a72ce..7f97cd6236cc6 100644
--- a/app/code/Magento/CatalogInventory/etc/events.xml
+++ b/app/code/Magento/CatalogInventory/etc/events.xml
@@ -1,7 +1,7 @@
@@ -27,9 +27,6 @@
-
-
-
diff --git a/app/code/Magento/CatalogInventory/etc/extension_attributes.xml b/app/code/Magento/CatalogInventory/etc/extension_attributes.xml
index 43495ebf2e644..2e30788604908 100644
--- a/app/code/Magento/CatalogInventory/etc/extension_attributes.xml
+++ b/app/code/Magento/CatalogInventory/etc/extension_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/frontend/di.xml b/app/code/Magento/CatalogInventory/etc/frontend/di.xml
index 66591baa41660..83f0810fb17d7 100644
--- a/app/code/Magento/CatalogInventory/etc/frontend/di.xml
+++ b/app/code/Magento/CatalogInventory/etc/frontend/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/indexer.xml b/app/code/Magento/CatalogInventory/etc/indexer.xml
index e3fc5e845c4c3..725477f64908f 100644
--- a/app/code/Magento/CatalogInventory/etc/indexer.xml
+++ b/app/code/Magento/CatalogInventory/etc/indexer.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/module.xml b/app/code/Magento/CatalogInventory/etc/module.xml
index 6d86fa559848e..9981b4f63e4e4 100644
--- a/app/code/Magento/CatalogInventory/etc/module.xml
+++ b/app/code/Magento/CatalogInventory/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/mview.xml b/app/code/Magento/CatalogInventory/etc/mview.xml
index 58a051a3d0e1b..b172d3e852823 100644
--- a/app/code/Magento/CatalogInventory/etc/mview.xml
+++ b/app/code/Magento/CatalogInventory/etc/mview.xml
@@ -1,14 +1,17 @@
-
+
+
+
diff --git a/app/code/Magento/CatalogInventory/etc/product_types.xml b/app/code/Magento/CatalogInventory/etc/product_types.xml
index 206a4969b3fd2..9c4653b1bde9e 100644
--- a/app/code/Magento/CatalogInventory/etc/product_types.xml
+++ b/app/code/Magento/CatalogInventory/etc/product_types.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/etc/webapi.xml b/app/code/Magento/CatalogInventory/etc/webapi.xml
index 09753ed6d7ca0..c172b9c971500 100644
--- a/app/code/Magento/CatalogInventory/etc/webapi.xml
+++ b/app/code/Magento/CatalogInventory/etc/webapi.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/i18n/en_US.csv b/app/code/Magento/CatalogInventory/i18n/en_US.csv
index 6dbbf9a2d2b7a..14379ec76f542 100644
--- a/app/code/Magento/CatalogInventory/i18n/en_US.csv
+++ b/app/code/Magento/CatalogInventory/i18n/en_US.csv
@@ -48,11 +48,7 @@ Inventory,Inventory
"Only X left Threshold","Only X left Threshold"
"Display Products Availability in Stock on Storefront","Display Products Availability in Stock on Storefront"
"Product Stock Options","Product Stock Options"
-"
- Please note that these settings apply to individual items in the cart, not to the entire cart.
- ","
- Please note that these settings apply to individual items in the cart, not to the entire cart.
- "
+"Please note that these settings apply to individual items in the cart, not to the entire cart.","Please note that these settings apply to individual items in the cart, not to the entire cart."
"Manage Stock","Manage Stock"
Backorders,Backorders
"Maximum Qty Allowed in Shopping Cart","Maximum Qty Allowed in Shopping Cart"
diff --git a/app/code/Magento/CatalogInventory/registration.php b/app/code/Magento/CatalogInventory/registration.php
index c39a8159f90b8..d15deab6429d7 100644
--- a/app/code/Magento/CatalogInventory/registration.php
+++ b/app/code/Magento/CatalogInventory/registration.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml
index 51587e0732830..af982697f532e 100644
--- a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml
+++ b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js
index 3123784e64e71..75d684137a28b 100644
--- a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js
+++ b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js
index 9bce6ced3141e..4ac1d5ed2d294 100644
--- a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js
+++ b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js
index 877f2b44b4f9a..76a2882852e0f 100644
--- a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js
+++ b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js
@@ -1,9 +1,9 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view.xml
index e6e9e8b30988b..1ebeed3846b0d 100644
--- a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view.xml
+++ b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_simple.xml b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_simple.xml
index bfd59283750be..2ed24b071095e 100644
--- a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_simple.xml
+++ b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_simple.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_virtual.xml b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_virtual.xml
index c83b8b6fc47e7..9943fee84b5cf 100644
--- a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_virtual.xml
+++ b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_virtual.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml b/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml
index 544b82ccd06cf..b8edebb82bbe9 100644
--- a/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml
+++ b/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml
@@ -1,6 +1,6 @@
setRenderer($this->_conditions);
$form->setValues($model->getData());
- $this->setConditionFormName($model->getConditions(), $formName);
+ $this->setConditionFormName($model, $model->getConditions(), $formName);
return $form;
}
/**
- * @param \Magento\Rule\Model\Condition\AbstractCondition $conditions
+ * @param RuleInterface $rule
+ * @param AbstractCondition $conditions
* @param string $formName
* @return void
*/
- private function setConditionFormName(\Magento\Rule\Model\Condition\AbstractCondition $conditions, $formName)
- {
+ private function setConditionFormName(
+ RuleInterface $rule,
+ AbstractCondition $conditions,
+ $formName
+ ) {
$conditions->setFormName($formName);
- $conditions->setJsFormObject($formName);
- if ($conditions->getConditions() && is_array($conditions->getConditions())) {
+ //For every fieldset there's a different form object.
+ $conditions->setJsFormObject(
+ $rule->getConditionsFieldSetId($formName)
+ );
+ $childConditions = $conditions->getCondition();
+ if ($childConditions && is_array($childConditions)) {
foreach ($conditions->getConditions() as $condition) {
- $this->setConditionFormName($condition, $formName);
+ $this->setConditionFormName($rule, $condition, $formName);
}
}
}
diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php
index 56847f971aadd..333ee845798ec 100644
--- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php
+++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php
@@ -1,6 +1,6 @@
where('t.customer_group_id = ?', $this->customerSession->getCustomerGroupId())
->where('t.rule_date = ?', $currentDate)
->order('t.rule_price ' . Select::SQL_ASC)
+ ->order(BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS . '.' . $linkField . ' ' . Select::SQL_ASC)
->limit(1);
$priceSelect = $this->baseSelectProcessor->process($priceSelect);
diff --git a/app/code/Magento/CatalogRule/Model/ResourceModel/ReadHandler.php b/app/code/Magento/CatalogRule/Model/ResourceModel/ReadHandler.php
index 59b7e67654543..ef3eb1ce674eb 100644
--- a/app/code/Magento/CatalogRule/Model/ResourceModel/ReadHandler.php
+++ b/app/code/Magento/CatalogRule/Model/ResourceModel/ReadHandler.php
@@ -1,6 +1,6 @@
getAttribute();
if ('category_ids' == $attrCode) {
- return $this->validateAttribute($model->getAvailableInCategories());
+ return parent::validate($model);
}
$oldAttrValue = $model->getData($attrCode);
diff --git a/app/code/Magento/CatalogRule/Model/Rule/CustomerGroupsOptionsProvider.php b/app/code/Magento/CatalogRule/Model/Rule/CustomerGroupsOptionsProvider.php
index 2ea0814394ad4..14d154c4d4ef2 100644
--- a/app/code/Magento/CatalogRule/Model/Rule/CustomerGroupsOptionsProvider.php
+++ b/app/code/Magento/CatalogRule/Model/Rule/CustomerGroupsOptionsProvider.php
@@ -1,6 +1,6 @@
config = $this->getMock('Magento\Eav\Model\Config', ['getAttribute'], [], '', false);
- $this->productModel = $this->getMock(
- 'Magento\Catalog\Model\Product',
- [
- '__wakeup',
- 'getAvailableInCategories',
- 'hasData',
- 'getData',
- 'getId',
- 'getStoreId',
- 'getResource',
- 'addAttributeToSelect',
- ],
- [],
- '',
- false
- );
- $this->productResource = $this->getMock(
- 'Magento\Catalog\Model\ResourceModel\Product',
- ['loadAllAttributes',
- 'getAttributesByCode',
- 'getAttribute'
- ],
- [],
- '',
- false
- );
- $this->eavAttributeResource = $this->getMock(
- '\Magento\Catalog\Model\ResourceModel\Eav\Attribute',
- [
- '__wakeup',
- 'isAllowedForRuleCondition',
- 'getDataUsingMethod',
- 'getAttributeCode',
- 'getFrontendLabel',
- 'isScopeGlobal',
- 'getBackendType',
- 'getFrontendInput'
- ],
- [],
- '',
- false
- );
+ $this->config = $this->getMockBuilder(\Magento\Eav\Model\Config::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getAttribute'])
+ ->getMock();
+ $this->productModel = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->category = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Category::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->productResource = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product::class)
+ ->setMethods(['loadAllAttributes', 'getAttributesByCode', 'getAttribute', 'getConnection', 'getTable'])
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->connection = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+ $this->dbSelect = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['from', 'where'])
+ ->getMock();
+ $this->eavAttributeResource = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$this->productResource->expects($this->any())->method('loadAllAttributes')
->will($this->returnSelf());
@@ -89,11 +79,12 @@ protected function setUp()
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->product = $this->objectManagerHelper->getObject(
- 'Magento\CatalogRule\Model\Rule\Condition\Product',
+ \Magento\CatalogRule\Model\Rule\Condition\Product::class,
[
'config' => $this->config,
'product' => $this->productModel,
- 'productResource' => $this->productResource
+ 'productResource' => $this->productResource,
+ 'category' => $this->category
]
);
}
@@ -103,12 +94,27 @@ protected function setUp()
*/
public function testValidateMeetsCategory()
{
+ $categoryIdList = [1, 2, 3];
+
+ $this->productResource->expects($this->atLeastOnce())
+ ->method('getConnection')
+ ->willReturn($this->connection);
+ $this->connection->expects($this->atLeastOnce())
+ ->method('select')
+ ->willReturn($this->dbSelect);
+ $this->dbSelect->expects($this->atLeastOnce())
+ ->method('from')
+ ->willReturnSelf();
+ $this->dbSelect->expects($this->atLeastOnce())
+ ->method('where')
+ ->willReturnSelf();
+ $this->connection->expects($this->once())
+ ->method('fetchCol')
+ ->willReturn($categoryIdList);
$this->product->setData('attribute', 'category_ids');
$this->product->setData('value_parsed', '1');
- $this->product->setData('operator', '>=');
+ $this->product->setData('operator', '{}');
- $this->productModel->expects($this->once())->method('getAvailableInCategories')
- ->will($this->returnValue('2'));
$this->assertTrue($this->product->validate($this->productModel));
}
diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/Rule/CustomerGroupsOptionsProviderTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/Rule/CustomerGroupsOptionsProviderTest.php
index 8a6f05c29922e..a51b5b4391230 100644
--- a/app/code/Magento/CatalogRule/Test/Unit/Model/Rule/CustomerGroupsOptionsProviderTest.php
+++ b/app/code/Magento/CatalogRule/Test/Unit/Model/Rule/CustomerGroupsOptionsProviderTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/di.xml b/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
index a993ed0ca485a..0951546561a2e 100644
--- a/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
+++ b/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/events.xml b/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
index afab20010a4b2..bc8f439c1f07e 100644
--- a/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
+++ b/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml b/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml
index e47fa911f5a6e..f342261a92b4f 100644
--- a/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml
+++ b/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml b/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml
index 8eb519e847511..48a22e9aa926a 100644
--- a/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml
+++ b/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/crontab.xml b/app/code/Magento/CatalogRule/etc/crontab.xml
index 0f0102057447e..d202b02ff83be 100644
--- a/app/code/Magento/CatalogRule/etc/crontab.xml
+++ b/app/code/Magento/CatalogRule/etc/crontab.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/crontab/events.xml b/app/code/Magento/CatalogRule/etc/crontab/events.xml
index e82f4c8b1a393..1de5d5001be5f 100644
--- a/app/code/Magento/CatalogRule/etc/crontab/events.xml
+++ b/app/code/Magento/CatalogRule/etc/crontab/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/di.xml b/app/code/Magento/CatalogRule/etc/di.xml
index 6783fd6d69bc2..4b368b1cef89a 100644
--- a/app/code/Magento/CatalogRule/etc/di.xml
+++ b/app/code/Magento/CatalogRule/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/events.xml b/app/code/Magento/CatalogRule/etc/events.xml
index 54d4ba74370a9..ade6957d46df9 100644
--- a/app/code/Magento/CatalogRule/etc/events.xml
+++ b/app/code/Magento/CatalogRule/etc/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/frontend/events.xml b/app/code/Magento/CatalogRule/etc/frontend/events.xml
index 7ec1d35dfbe97..0d0a1fef5354f 100644
--- a/app/code/Magento/CatalogRule/etc/frontend/events.xml
+++ b/app/code/Magento/CatalogRule/etc/frontend/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/indexer.xml b/app/code/Magento/CatalogRule/etc/indexer.xml
index bae3bdf98efb7..08ed456457bfe 100644
--- a/app/code/Magento/CatalogRule/etc/indexer.xml
+++ b/app/code/Magento/CatalogRule/etc/indexer.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/module.xml b/app/code/Magento/CatalogRule/etc/module.xml
index 6a864895ffec7..a1e6c04913a9f 100644
--- a/app/code/Magento/CatalogRule/etc/module.xml
+++ b/app/code/Magento/CatalogRule/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/mview.xml b/app/code/Magento/CatalogRule/etc/mview.xml
index 58015fc69863c..0fc3be87057be 100644
--- a/app/code/Magento/CatalogRule/etc/mview.xml
+++ b/app/code/Magento/CatalogRule/etc/mview.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml b/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml
index 7ca6491d59d76..066a32e7e14dd 100644
--- a/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml
+++ b/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/webapi_rest/events.xml b/app/code/Magento/CatalogRule/etc/webapi_rest/events.xml
index 7ec1d35dfbe97..0d0a1fef5354f 100644
--- a/app/code/Magento/CatalogRule/etc/webapi_rest/events.xml
+++ b/app/code/Magento/CatalogRule/etc/webapi_rest/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/etc/webapi_soap/events.xml b/app/code/Magento/CatalogRule/etc/webapi_soap/events.xml
index 7ec1d35dfbe97..0d0a1fef5354f 100644
--- a/app/code/Magento/CatalogRule/etc/webapi_soap/events.xml
+++ b/app/code/Magento/CatalogRule/etc/webapi_soap/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/registration.php b/app/code/Magento/CatalogRule/registration.php
index 3322ca97134fa..c657d6f7394be 100644
--- a/app/code/Magento/CatalogRule/registration.php
+++ b/app/code/Magento/CatalogRule/registration.php
@@ -1,6 +1,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 77bcd7de41e9a..1a3227a4d79b2 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
@@ -1,11 +1,11 @@
-
+
diff --git a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml
index e781a870f1c5d..5718845d14770 100644
--- a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml
+++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml
index 0c13825d16798..0f8144dd4629e 100644
--- a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml
+++ b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php
index c4b8d5f275f68..5e8706be18666 100644
--- a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php
+++ b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRuleConfigurable/etc/crontab/di.xml b/app/code/Magento/CatalogRuleConfigurable/etc/crontab/di.xml
index ef226c965c57b..fb7479021a7b6 100644
--- a/app/code/Magento/CatalogRuleConfigurable/etc/crontab/di.xml
+++ b/app/code/Magento/CatalogRuleConfigurable/etc/crontab/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRuleConfigurable/etc/di.xml b/app/code/Magento/CatalogRuleConfigurable/etc/di.xml
index 8807b657f1c05..19805ebbeb5d3 100644
--- a/app/code/Magento/CatalogRuleConfigurable/etc/di.xml
+++ b/app/code/Magento/CatalogRuleConfigurable/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRuleConfigurable/etc/module.xml b/app/code/Magento/CatalogRuleConfigurable/etc/module.xml
index c329a1fbe46ee..3552af8ceb337 100644
--- a/app/code/Magento/CatalogRuleConfigurable/etc/module.xml
+++ b/app/code/Magento/CatalogRuleConfigurable/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogRuleConfigurable/registration.php b/app/code/Magento/CatalogRuleConfigurable/registration.php
index 578434d65237b..95cd5b79e5721 100644
--- a/app/code/Magento/CatalogRuleConfigurable/registration.php
+++ b/app/code/Magento/CatalogRuleConfigurable/registration.php
@@ -1,6 +1,6 @@
getBackend()->getType();
- $imputType = $attribute->getFrontend()->getInputType();
- if ($imputType == 'select' || $imputType == 'multiselect') {
+ $inputType = $attribute->getFrontend()->getInputType();
+ if ($inputType == 'select' || $inputType == 'multiselect') {
return 'select';
}
- if ($imputType == 'boolean') {
+ if ($inputType == 'boolean') {
return 'yesno';
}
- if ($imputType == 'price') {
+ if ($inputType == 'price') {
return 'price';
}
diff --git a/app/code/Magento/CatalogSearch/Block/Advanced/Result.php b/app/code/Magento/CatalogSearch/Block/Advanced/Result.php
index 36e60fe4626af..e20207565ae65 100644
--- a/app/code/Magento/CatalogSearch/Block/Advanced/Result.php
+++ b/app/code/Magento/CatalogSearch/Block/Advanced/Result.php
@@ -1,6 +1,6 @@
getField() === 'category_ids') {
- return 'category_ids_index.category_id = ' . (int) $filter->getValue();
+ return "{$this->aliasResolver->getAlias($filter)}.category_id = "
+ . (int) $filter->getValue();
+ } elseif ($filter->getField() === 'visibility') {
+ return "{$this->aliasResolver->getAlias($filter)}." . $query;
} elseif ($attribute->isStatic()) {
$alias = $this->aliasResolver->getAlias($filter);
$resultQuery = str_replace(
diff --git a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Plugin/Aggregation/Category/DataProvider.php b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Plugin/Aggregation/Category/DataProvider.php
index e61414dafe32f..64211e5eb499b 100644
--- a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Plugin/Aggregation/Category/DataProvider.php
+++ b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Plugin/Aggregation/Category/DataProvider.php
@@ -1,6 +1,6 @@
fullAction = $fullActionFactory->create(['data' => $data]);
$this->indexerHandlerFactory = $indexerHandlerFactory;
@@ -71,6 +85,8 @@ public function __construct(
$this->fulltextResource = $fulltextResource;
$this->searchRequestConfig = $searchRequestConfig;
$this->data = $data;
+ $this->parentProductsResolver = $parentProductsResolver
+ ?: ObjectManager::getInstance()->get(ParentProductsResolver::class);
}
/**
@@ -86,10 +102,15 @@ public function execute($ids)
$saveHandler = $this->indexerHandlerFactory->create([
'data' => $this->data
]);
+
+ $ids = (array)$ids;
+ $parentProductIds = $this->parentProductsResolver->getParentProductIds($ids);
+ $idsToBeReIndexed = array_unique(array_merge($ids, $parentProductIds));
+
foreach ($storeIds as $storeId) {
$dimension = $this->dimensionFactory->create(['name' => 'scope', 'value' => $storeId]);
- $saveHandler->deleteIndex([$dimension], new \ArrayObject($ids));
- $saveHandler->saveIndex([$dimension], $this->fullAction->rebuildStoreIndex($storeId, $ids));
+ $saveHandler->deleteIndex([$dimension], new \ArrayObject($idsToBeReIndexed));
+ $saveHandler->saveIndex([$dimension], $this->fullAction->rebuildStoreIndex($storeId, $idsToBeReIndexed));
}
}
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php
index 436fb10b9a1bd..ccc1174d2a82a 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php
@@ -1,6 +1,6 @@
getProductTypeInstance($typeId);
- $relation = $typeInstance->isComposite(
- $this->getProductEmulator($typeId)
- ) ? $typeInstance->getRelationInfo() : false;
+ $relation = $typeInstance->isComposite($this->getProductEmulator($typeId))
+ ? $typeInstance->getRelationInfo()
+ : false;
if ($relation && $relation->getTable() && $relation->getParentFieldName() && $relation->getChildFieldName()) {
$select = $this->connection->select()->from(
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 e08954806da29..b2eda4a323499 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php
@@ -1,6 +1,6 @@
from(['relation' => $this->getTable('catalog_product_relation')], [])
->distinct(true)
->where('child_id IN (?)', $entityIds)
- ->where('parent_id NOT IN (?)', $entityIds)
->join(
['cpe' => $this->getTable('catalog_product_entity')],
'relation.parent_id = cpe.' . $fieldForParent,
@@ -328,7 +330,7 @@ protected function getProductIdsFromParents(array $entityIds)
public function rebuildStoreIndex($storeId, $productIds = null)
{
if ($productIds !== null) {
- $productIds = array_unique(array_merge($productIds, $this->getProductIdsFromParents($productIds)));
+ $productIds = array_unique($productIds);
}
// prepare searchable attributes
$staticFields = [];
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/IndexIterator.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/IndexIterator.php
index 7f4b5f517ac9d..e62a0d058d8d4 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/IndexIterator.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/IndexIterator.php
@@ -1,6 +1,6 @@
resourceConnection = $resourceConnection;
+ $this->metadataPool = $metadataPool;
+ }
+
+ /**
+ * Get IDs of parent products by their child IDs.
+ *
+ * Returns identifiers of parent product from the catalog_product_relation.
+ * Please note that returned ids don't contain ids of passed child products.
+ *
+ * @param int[] $childProductIds
+ * @return int[]
+ * @throws \Exception if metadataPool doesn't contain metadata for ProductInterface
+ * @throws \DomainException
+ */
+ public function getParentProductIds(array $childProductIds)
+ {
+ /** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */
+ $metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
+ $fieldForParent = $metadata->getLinkField();
+
+ $connection = $this->resourceConnection->getConnection();
+
+ $select = $connection
+ ->select()
+ ->from(['relation' => $this->resourceConnection->getTableName('catalog_product_relation')], [])
+ ->distinct(true)
+ ->where('child_id IN (?)', $childProductIds)
+ ->join(
+ ['cpe' => $this->resourceConnection->getTableName('catalog_product_entity')],
+ 'relation.parent_id = cpe.'.$fieldForParent,
+ ['cpe.entity_id']
+ );
+
+ return $connection->fetchCol($select);
+ }
+}
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/ProductFieldset.php b/app/code/Magento/CatalogSearch/Model/Indexer/ProductFieldset.php
index d85b87b310623..29b517d01ef50 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/ProductFieldset.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/ProductFieldset.php
@@ -1,6 +1,6 @@
_getData('currency_rate');
if ($rate === null) {
- $rate = $this->_storeManager->getStore($this->getStoreId())
- ->getCurrentCurrencyRate();
+ $rate = $this->_storeManager->getStore()->getCurrentCurrencyRate();
}
if (!$rate) {
$rate = 1;
@@ -175,6 +174,11 @@ public function getCurrencyRate()
*/
protected function _renderRangeLabel($fromPrice, $toPrice)
{
+ $fromPrice *= $this->getCurrencyRate();
+ if ($toPrice) {
+ $toPrice *= $this->getCurrencyRate();
+ }
+
$formattedFromPrice = $this->priceCurrency->format($fromPrice);
if ($toPrice === '') {
return __('%1 and above', $formattedFromPrice);
@@ -212,7 +216,7 @@ protected function _getItemsData()
if (strpos($key, '_') === false) {
continue;
}
- $data[] = $this->prepareData($key, $count, $data);
+ $data[] = $this->prepareData($key, $count);
}
}
@@ -262,8 +266,8 @@ private function prepareData($key, $count)
$to = $this->getTo($to);
}
$label = $this->_renderRangeLabel(
- empty($from) ? 0 : $from * $this->getCurrencyRate(),
- empty($to) ? $to : $to * $this->getCurrencyRate()
+ empty($from) ? 0 : $from,
+ $to
);
$value = $from . '-' . $to . $this->dataProvider->getAdditionalRequestData();
diff --git a/app/code/Magento/CatalogSearch/Model/Layer/Search/Plugin/CollectionFilter.php b/app/code/Magento/CatalogSearch/Model/Layer/Search/Plugin/CollectionFilter.php
index 46a78fcac1a50..6e1f6f797eea3 100644
--- a/app/code/Magento/CatalogSearch/Model/Layer/Search/Plugin/CollectionFilter.php
+++ b/app/code/Magento/CatalogSearch/Model/Layer/Search/Plugin/CollectionFilter.php
@@ -1,7 +1,7 @@
getSearchCriteriaBuilder();
$this->getFilterBuilder();
- if (!is_array($condition) || !in_array(key($condition), ['from', 'to'])) {
- $this->filterBuilder->setField($field);
- $this->filterBuilder->setValue($condition);
- $this->searchCriteriaBuilder->addFilter($this->filterBuilder->create());
- } else {
+ if (is_array($condition)
+ && in_array(key($condition), ['from', 'to'], true)
+ ) {
if (!empty($condition['from'])) {
- $this->filterBuilder->setField("{$field}.from");
- $this->filterBuilder->setValue($condition['from']);
- $this->searchCriteriaBuilder->addFilter($this->filterBuilder->create());
+ $this->addFieldToFilter("{$field}.from", $condition['from']);
}
if (!empty($condition['to'])) {
- $this->filterBuilder->setField("{$field}.to");
- $this->filterBuilder->setValue($condition['to']);
- $this->searchCriteriaBuilder->addFilter($this->filterBuilder->create());
+ $this->addFieldToFilter("{$field}.to", $condition['to']);
}
+ } else {
+ $this->filterBuilder->setField($field);
+ $this->filterBuilder->setValue($condition);
+ $this->searchCriteriaBuilder->addFilter($this->filterBuilder->create());
}
+
return $this;
}
@@ -346,9 +345,19 @@ protected function _renderFiltersBefore()
$this->_totalRecords = $this->searchResult->getTotalCount();
- if ($this->order && 'relevance' === $this->order['field']) {
- $this->getSelect()->order('search_result.'. TemporaryStorage::FIELD_SCORE . ' ' . $this->order['dir']);
+ if ($this->relevanceOrderDirection) {
+ $this->getSelect()->order(
+ 'search_result.'. TemporaryStorage::FIELD_SCORE . ' ' . $this->relevanceOrderDirection
+ );
}
+
+ /*
+ * This order is required to force search results be the same
+ * for the same requests and products with the same relevance
+ * NOTE: this does not replace existing orders but ADDs one more
+ */
+ $this->setOrder('entity_id');
+
return parent::_renderFiltersBefore();
}
@@ -370,10 +379,12 @@ protected function _renderFilters()
*/
public function setOrder($attribute, $dir = Select::SQL_DESC)
{
- $this->order = ['field' => $attribute, 'dir' => $dir];
- if ($attribute != 'relevance') {
+ if ($attribute === 'relevance') {
+ $this->relevanceOrderDirection = $dir;
+ } else {
parent::setOrder($attribute, $dir);
}
+
return $this;
}
diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php
index c95deb1bf932a..96466d7f0bfe8 100644
--- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php
+++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php
@@ -1,6 +1,6 @@
aliasResolver->getAlias($filter);
- $tableName = $this->resourceConnection->getTableName('catalog_category_product_index');
- $select->joinInner(
- [$alias => $tableName],
- 'search_index.entity_id = category_ids_index.product_id',
- []
- );
+ if (!array_key_exists($alias, $select->getPart('from'))) {
+ $tableName = $this->resourceConnection->getTableName(
+ 'catalog_category_product_index'
+ );
+ $select->joinInner(
+ [$alias => $tableName],
+ "search_index.entity_id = $alias.product_id",
+ []
+ );
+ }
$isApplied = true;
}
diff --git a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterContext.php b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterContext.php
index e1901afce4ffd..83e5a6b67967e 100644
--- a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterContext.php
+++ b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterContext.php
@@ -1,6 +1,6 @@
[
'field' => 'category_ids',
- 'alias' => 'category_ids_index',
+ 'alias' => 'category_products_index',
+ ],
+ 'visibility' => [
+ 'field' => 'visibility',
+ 'alias' => 'category_products_index',
],
];
}
diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Filter/PreprocessorTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Filter/PreprocessorTest.php
index c8dd43c74a10d..b78a29f75fe85 100644
--- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Filter/PreprocessorTest.php
+++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Filter/PreprocessorTest.php
@@ -1,6 +1,6 @@
aliasResolver->expects($this->atLeastOnce())
+ ->method('getAlias')
+ ->willReturn($tableAlias);
$this->filter->expects($this->exactly(3))
->method('getField')
->will($this->returnValue('category_ids'));
@@ -233,9 +237,35 @@ public function testProcessCategoryIds($categoryId, $expectedResult)
->will($this->returnValue($this->attribute));
$actualResult = $this->target->process($this->filter, $isNegation, $query);
+ $expectedResult = strtr($expectedResult, [':alias' => $tableAlias]);
$this->assertSame($expectedResult, $this->removeWhitespaces($actualResult));
}
+ public function testProcessVisibilityIds()
+ {
+ $query = 'visibility in (1, 2)';
+ $tableAlias = 'visibility__alias';
+
+ $this->aliasResolver->expects($this->atLeastOnce())
+ ->method('getAlias')
+ ->willReturn($tableAlias);
+ $this->filter->expects($this->atLeastOnce())
+ ->method('getField')
+ ->will($this->returnValue('visibility'));
+ $this->filter->expects($this->never())
+ ->method('getValue');
+ $this->config->expects($this->once())
+ ->method('getAttribute')
+ ->with(\Magento\Catalog\Model\Product::ENTITY, 'visibility')
+ ->will($this->returnValue($this->attribute));
+
+ $actualResult = $this->target->process($this->filter, false, $query);
+ $this->assertSame(
+ "$tableAlias.$query",
+ $this->removeWhitespaces($actualResult)
+ );
+ }
+
public function testProcessStaticAttribute()
{
$expectedResult = 'attr_table_alias.static_attribute LIKE %name%';
@@ -246,7 +276,7 @@ public function testProcessStaticAttribute()
->willReturn('static_attribute');
$this->aliasResolver->expects($this->once())->method('getAlias')
->willReturn('attr_table_alias');
- $this->filter->expects($this->exactly(3))
+ $this->filter->expects($this->exactly(4))
->method('getField')
->will($this->returnValue('static_attribute'));
$this->config->expects($this->exactly(1))
@@ -285,7 +315,7 @@ public function testProcessTermFilter($frontendInput, $fieldValue, $isNegation,
$this->aliasResolver->expects($this->once())->method('getAlias')
->willReturn('termAttrAlias');
- $this->filter->expects($this->exactly(3))
+ $this->filter->expects($this->exactly(4))
->method('getField')
->willReturn('termField');
$this->filter->expects($this->exactly(2))
@@ -360,7 +390,7 @@ public function testProcessNotStaticAttribute()
$attributeId = 1234567;
$this->scope->expects($this->once())->method('getId')->will($this->returnValue($scopeId));
- $this->filter->expects($this->exactly(4))
+ $this->filter->expects($this->exactly(5))
->method('getField')
->will($this->returnValue('not_static_attribute'));
$this->config->expects($this->exactly(1))
diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/OptionsTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/OptionsTest.php
index 2aae2ca3cbed0..9b3fb1c0c62e3 100644
--- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/OptionsTest.php
+++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/OptionsTest.php
@@ -1,6 +1,6 @@
fulltextResource = $this->getClassMock('\Magento\CatalogSearch\Model\ResourceModel\Fulltext');
$this->searchRequestConfig = $this->getClassMock('Magento\Framework\Search\Request\Config');
- $this->model = new \Magento\CatalogSearch\Model\Indexer\Fulltext(
- $fullActionFactory,
- $indexerHandlerFactory,
- $this->storeManager,
- $dimensionFactory,
- $this->fulltextResource,
- $this->searchRequestConfig,
- []
+ $this->parentProductResolver = $this->getMockBuilder(ParentProductsResolver::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getParentProductIds'])
+ ->getMock();
+
+ $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->model = $objectManager->getObject(
+ \Magento\CatalogSearch\Model\Indexer\Fulltext::class,
+ [
+ 'fullActionFactory' => $fullActionFactory,
+ 'indexerHandlerFactory' => $indexerHandlerFactory,
+ 'storeManager' => $this->storeManager,
+ 'dimensionFactory' => $dimensionFactory,
+ 'fulltextResource' => $this->fulltextResource,
+ 'searchRequestConfig' => $this->searchRequestConfig,
+ 'data' => [],
+ 'parentProductsResolver' => $this->parentProductResolver,
+ ]
);
}
@@ -121,6 +137,10 @@ public function testExecute()
$this->storeManager->expects($this->once())->method('getStores')->willReturn($stores);
$this->saveHandler->expects($this->exactly(count($stores)))->method('deleteIndex');
$this->saveHandler->expects($this->exactly(2))->method('saveIndex');
+ $this->parentProductResolver->expects($this->once())
+ ->method('getParentProductIds')
+ ->with($ids)
+ ->willReturn(['12']);
$this->fullAction->expects($this->exactly(2))
->method('rebuildStoreIndex')
->willReturn(new \ArrayObject([$indexData, $indexData]));
@@ -152,6 +172,10 @@ public function testExecuteList()
$this->storeManager->expects($this->once())->method('getStores')->willReturn($stores);
$this->saveHandler->expects($this->exactly(count($stores)))->method('deleteIndex');
$this->saveHandler->expects($this->exactly(2))->method('saveIndex');
+ $this->parentProductResolver->expects($this->once())
+ ->method('getParentProductIds')
+ ->with($ids)
+ ->willReturn([]);
$this->fullAction->expects($this->exactly(2))
->method('rebuildStoreIndex')
->willReturn(new \ArrayObject([$indexData, $indexData]));
@@ -167,6 +191,10 @@ public function testExecuteRow()
$this->storeManager->expects($this->once())->method('getStores')->willReturn($stores);
$this->saveHandler->expects($this->exactly(count($stores)))->method('deleteIndex');
$this->saveHandler->expects($this->exactly(2))->method('saveIndex');
+ $this->parentProductResolver->expects($this->once())
+ ->method('getParentProductIds')
+ ->with([$id])
+ ->willReturn(['12']);
$this->fullAction->expects($this->exactly(2))
->method('rebuildStoreIndex')
->willReturn(new \ArrayObject([$indexData, $indexData]));
diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/IndexerHandlerFactoryTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/IndexerHandlerFactoryTest.php
index fb5b88fbe9794..007b729b7450f 100644
--- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/IndexerHandlerFactoryTest.php
+++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/IndexerHandlerFactoryTest.php
@@ -1,6 +1,6 @@
resourceConnection = $this->getMockBuilder(ResourceConnection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->metadataPool = $this->getMockBuilder(\Magento\Framework\EntityManager\MetadataPool::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->metadata = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadataInterface::class)
+ ->getMockForAbstractClass();
+ $this->metadataPool->expects($this->once())
+ ->method('getMetadata')
+ ->with(ProductInterface::class)
+ ->willReturn($this->metadata);
+
+ $this->connection = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['select', 'getIfNullSql', 'quote'])
+ ->getMockForAbstractClass();
+
+ $this->resourceConnection->expects($this->atLeastOnce())
+ ->method('getConnection')
+ ->will($this->returnValue($this->connection));
+
+ $this->select = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['from', 'distinct', 'where', 'join', '__toString'])
+ ->getMock();
+ $this->connection->expects($this->any())
+ ->method('select')
+ ->will($this->returnValue($this->select));
+
+ $objectManager = new ObjectManager($this);
+ $this->resolver = $objectManager->getObject(
+ ParentProductsResolver::class,
+ [
+ 'resourceConnection' => $this->resourceConnection,
+ 'metadataPool' => $this->metadataPool,
+ ]
+ );
+ }
+
+ public function testGetParentProductIds()
+ {
+ $childProductIds = [12, 13, 14];
+
+ $this->metadata->expects(self::once())
+ ->method('getLinkField')
+ ->willReturn('product_link_field');
+ $this->resourceConnection->expects($this->any())
+ ->method('getTableName')
+ ->willReturnMap(
+ [
+ ['catalog_product_relation', ResourceConnection::DEFAULT_CONNECTION, 'relation_table'],
+ ['catalog_product_entity', ResourceConnection::DEFAULT_CONNECTION, 'product_table'],
+ ]
+ );
+ $this->select->expects(self::once())->method('from')
+ ->with(['relation' => 'relation_table'], [], null)
+ ->willReturnSelf();
+ $this->select->expects(self::once())->method('distinct')
+ ->with(true)
+ ->willReturnSelf();
+ $this->select->expects(self::once())->method('where')
+ ->withConsecutive(
+ [$this->equalTo('child_id IN (?)'), $this->equalTo($childProductIds)]
+ )
+ ->willReturnSelf();
+ $this->select->expects(self::once())->method('join')
+ ->with(
+ ['cpe' => 'product_table'],
+ 'relation.parent_id = cpe.product_link_field',
+ ['cpe.entity_id']
+ )
+ ->willReturnSelf();
+ $this->resolver->getParentProductIds($childProductIds);
+ }
+}
diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Layer/Catalog/ItemCollectionProviderTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Layer/Catalog/ItemCollectionProviderTest.php
index 5bc4cddf3ae22..15334615853d3 100644
--- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Layer/Catalog/ItemCollectionProviderTest.php
+++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Layer/Catalog/ItemCollectionProviderTest.php
@@ -1,6 +1,6 @@
request = $this->getMockBuilder('\Magento\Framework\App\RequestInterface')
- ->disableOriginalConstructor()
- ->setMethods(['getParam'])
->getMockForAbstractClass();
$dataProviderFactory = $this->getMockBuilder('\Magento\Catalog\Model\Layer\Filter\DataProvider\PriceFactory')
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();
-
$this->dataProvider = $this->getMockBuilder('\Magento\Catalog\Model\Layer\Filter\DataProvider\Price')
->disableOriginalConstructor()
->setMethods(['setPriceId', 'getPrice'])
->getMock();
-
$dataProviderFactory->expects($this->once())
->method('create')
->will($this->returnValue($this->dataProvider));
$this->layer = $this->getMockBuilder('\Magento\Catalog\Model\Layer')
->disableOriginalConstructor()
- ->setMethods(['getState', 'getProductCollection'])
->getMock();
$this->state = $this->getMockBuilder('\Magento\Catalog\Model\Layer\State')
->disableOriginalConstructor()
- ->setMethods(['addFilter'])
->getMock();
$this->layer->expects($this->any())
->method('getState')
->will($this->returnValue($this->state));
- $this->fulltextCollection = $this->fulltextCollection = $this->getMockBuilder(
+ $this->fulltextCollection = $this->getMockBuilder(
'\Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection'
- )
- ->disableOriginalConstructor()
- ->setMethods(['addFieldToFilter', 'getFacetedData'])
+ )->disableOriginalConstructor()
->getMock();
-
$this->layer->expects($this->any())
->method('getProductCollection')
->will($this->returnValue($this->fulltextCollection));
$this->itemDataBuilder = $this->getMockBuilder('\Magento\Catalog\Model\Layer\Filter\Item\DataBuilder')
->disableOriginalConstructor()
- ->setMethods(['addItemData', 'build'])
->getMock();
- $this->filterItemFactory = $this->getMockBuilder(
- '\Magento\Catalog\Model\Layer\Filter\ItemFactory'
- )
+ $this->filterItemFactory = $this->getMockBuilder('\Magento\Catalog\Model\Layer\Filter\ItemFactory')
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();
- $filterItem = $this->getMockBuilder(
- '\Magento\Catalog\Model\Layer\Filter\Item'
- )
+ $filterItem = $this->getMockBuilder('\Magento\Catalog\Model\Layer\Filter\Item')
->disableOriginalConstructor()
->setMethods(['setFilter', 'setLabel', 'setValue', 'setCount'])
->getMock();
@@ -123,12 +111,20 @@ protected function setUp()
$escaper = $this->getMockBuilder('\Magento\Framework\Escaper')
->disableOriginalConstructor()
- ->setMethods(['escapeHtml'])
->getMock();
$escaper->expects($this->any())
->method('escapeHtml')
->will($this->returnArgument(0));
+ $this->storeMock = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
+ ->setMethods(['getCurrentCurrencyRate'])
+ ->getMockForAbstractClass();
+ $storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
+ ->getMockForAbstractClass();
+ $storeManagerMock->expects($this->any())
+ ->method('getStore')
+ ->willReturn($this->storeMock);
+
$this->attribute = $this->getMockBuilder('\Magento\Eav\Model\Entity\Attribute')
->disableOriginalConstructor()
->setMethods(['getAttributeCode', 'getFrontend', 'getIsFilterable'])
@@ -142,6 +138,7 @@ protected function setUp()
'itemDataBuilder' => $this->itemDataBuilder,
'filterItemFactory' => $this->filterItemFactory,
'escaper' => $escaper,
+ 'storeManager' => $storeManagerMock,
]
);
}
@@ -149,7 +146,6 @@ protected function setUp()
/**
* @param $requestValue
* @param $idValue
- * @param $isIdUsed
* @dataProvider applyWithEmptyRequestDataProvider
*/
public function testApplyWithEmptyRequest($requestValue, $idValue)
@@ -224,6 +220,10 @@ function ($field) use ($requestVar, $priceId) {
->with('price')
->will($this->returnSelf());
+ $this->storeMock->expects($this->atLeastOnce())
+ ->method('getCurrentCurrencyRate')
+ ->willReturn(1);
+
$this->target->apply($this->request);
}
diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/ResourceModel/Advanced/CollectionTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/ResourceModel/Advanced/CollectionTest.php
index be80270e58ea3..d891e9a92e413 100644
--- a/app/code/Magento/CatalogSearch/Test/Unit/Model/ResourceModel/Advanced/CollectionTest.php
+++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/ResourceModel/Advanced/CollectionTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml b/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml
index 1f87e8de6eb65..d28b1d90dc06f 100644
--- a/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml
+++ b/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml b/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml
index ab0ddab0a7cf6..0eeb6ab33871e 100644
--- a/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml
+++ b/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/catalog_attributes.xml b/app/code/Magento/CatalogSearch/etc/catalog_attributes.xml
index c13caa8bbf2f0..7b19da16f3397 100644
--- a/app/code/Magento/CatalogSearch/etc/catalog_attributes.xml
+++ b/app/code/Magento/CatalogSearch/etc/catalog_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/config.xml b/app/code/Magento/CatalogSearch/etc/config.xml
index d9f709f501f2e..d5ff194813b9c 100644
--- a/app/code/Magento/CatalogSearch/etc/config.xml
+++ b/app/code/Magento/CatalogSearch/etc/config.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/di.xml b/app/code/Magento/CatalogSearch/etc/di.xml
index 25993adf3530c..2ef0be8601064 100644
--- a/app/code/Magento/CatalogSearch/etc/di.xml
+++ b/app/code/Magento/CatalogSearch/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/events.xml b/app/code/Magento/CatalogSearch/etc/events.xml
index 68d32ad26fb7e..322b7ab990bb5 100644
--- a/app/code/Magento/CatalogSearch/etc/events.xml
+++ b/app/code/Magento/CatalogSearch/etc/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/frontend/di.xml b/app/code/Magento/CatalogSearch/etc/frontend/di.xml
index 69e8823e7bdef..6e21db38fab26 100644
--- a/app/code/Magento/CatalogSearch/etc/frontend/di.xml
+++ b/app/code/Magento/CatalogSearch/etc/frontend/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml b/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml
index 7f05e212df860..8a29ff1bf6d73 100644
--- a/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml
+++ b/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/frontend/routes.xml b/app/code/Magento/CatalogSearch/etc/frontend/routes.xml
index e0bcffc439c25..536d00a093cc6 100644
--- a/app/code/Magento/CatalogSearch/etc/frontend/routes.xml
+++ b/app/code/Magento/CatalogSearch/etc/frontend/routes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/indexer.xml b/app/code/Magento/CatalogSearch/etc/indexer.xml
index 796db4aecc118..9726f5372311d 100644
--- a/app/code/Magento/CatalogSearch/etc/indexer.xml
+++ b/app/code/Magento/CatalogSearch/etc/indexer.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/module.xml b/app/code/Magento/CatalogSearch/etc/module.xml
index 53ee3fca13af2..fd31faa083926 100644
--- a/app/code/Magento/CatalogSearch/etc/module.xml
+++ b/app/code/Magento/CatalogSearch/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/mview.xml b/app/code/Magento/CatalogSearch/etc/mview.xml
index ef5d6b453aac3..e5580d86d1ef8 100644
--- a/app/code/Magento/CatalogSearch/etc/mview.xml
+++ b/app/code/Magento/CatalogSearch/etc/mview.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/etc/search_request.xml b/app/code/Magento/CatalogSearch/etc/search_request.xml
index 84817ab37f36b..d7bfb2e6b4a5c 100644
--- a/app/code/Magento/CatalogSearch/etc/search_request.xml
+++ b/app/code/Magento/CatalogSearch/etc/search_request.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/registration.php b/app/code/Magento/CatalogSearch/registration.php
index 357bda4629222..37fc42c5ab92c 100644
--- a/app/code/Magento/CatalogSearch/registration.php
+++ b/app/code/Magento/CatalogSearch/registration.php
@@ -1,6 +1,6 @@
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 337ec41d8f92e..79d14f26ff2a4 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
@@ -1,7 +1,7 @@
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 56f652ec31af0..91041cf68aca7 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
@@ -1,7 +1,7 @@
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 fe4feb0bfaf0d..95ee44aa14f1e 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
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml
index 566910b76d499..5b29921d850b0 100644
--- a/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml
+++ b/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogSearch/view/frontend/requirejs-config.js b/app/code/Magento/CatalogSearch/view/frontend/requirejs-config.js
index c2a3e552a7299..97a1734be7253 100644
--- a/app/code/Magento/CatalogSearch/view/frontend/requirejs-config.js
+++ b/app/code/Magento/CatalogSearch/view/frontend/requirejs-config.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml
index ffa83a8717b2d..a6564f7cd2fec 100644
--- a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml
+++ b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml
@@ -1,6 +1,6 @@
productScopeRewriteGenerator = $productScopeRewriteGenerator;
+ }
+
+ /**
+ * Generate product url rewrites based on all product categories.
+ *
+ * @param Product $product
+ * @param int|null $rootCategoryId
+ * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[]
+ */
+ public function generate(Product $product, $rootCategoryId = null)
+ {
+ if ($product->getVisibility() == Visibility::VISIBILITY_NOT_VISIBLE) {
+ return [];
+ }
+
+ $storeId = $product->getStoreId();
+
+ $productCategories = $product->getCategoryCollection()
+ ->addAttributeToSelect('url_key')
+ ->addAttributeToSelect('url_path');
+
+ $urls = $this->productScopeRewriteGenerator->isGlobalScope($storeId)
+ ? $this->productScopeRewriteGenerator->generateForGlobalScope(
+ $productCategories,
+ $product,
+ $rootCategoryId
+ )
+ : $this->productScopeRewriteGenerator->generateForSpecificStoreView(
+ $storeId,
+ $productCategories,
+ $product,
+ $rootCategoryId
+ );
+
+ return $urls;
+ }
+}
diff --git a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php
index 65f086dfd0c20..8e36cc9bf1566 100644
--- a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php
+++ b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php
@@ -1,6 +1,6 @@
urlFinder = $urlFinder;
$this->productUrlPathGenerator = $productUrlPathGenerator;
@@ -89,11 +97,12 @@ public function __construct(
if (!isset($mergeDataProviderFactory)) {
$mergeDataProviderFactory = ObjectManager::getInstance()->get(MergeDataProviderFactory::class);
}
+ $this->categoryRepository = $categoryRepository ?: ObjectManager::getInstance()->get(CategoryRepository::class);
$this->mergeDataProviderPrototype = $mergeDataProviderFactory->create();
}
/**
- * Generate list based on current rewrites
+ * Generate product rewrites based on current rewrites without anchor categories.
*
* @param int $storeId
* @param Product $product
@@ -126,6 +135,52 @@ public function generate($storeId, Product $product, ObjectRegistry $productCate
return $mergeDataProvider->getData();
}
+ /**
+ * Generate product rewrites for anchor categories based on current rewrites.
+ *
+ * @param int $storeId
+ * @param Product $product
+ * @param ObjectRegistry $productCategories
+ * @param int|null $rootCategoryId
+ * @return UrlRewrite[]
+ */
+ public function generateAnchor(
+ $storeId,
+ Product $product,
+ ObjectRegistry $productCategories,
+ $rootCategoryId = null
+ ) {
+ $anchorCategoryIds = [];
+ $mergeDataProvider = clone $this->mergeDataProviderPrototype;
+
+ $currentUrlRewrites = $this->urlRewriteFinder->findAllByData(
+ $product->getEntityId(),
+ $storeId,
+ ProductUrlRewriteGenerator::ENTITY_TYPE,
+ $rootCategoryId
+ );
+
+ foreach ($productCategories->getList() as $productCategory) {
+ $anchorCategoryIds = array_merge($productCategory->getAnchorsAbove(), $anchorCategoryIds);
+ }
+
+ foreach ($currentUrlRewrites as $currentUrlRewrite) {
+ $metadata = $currentUrlRewrite->getMetadata();
+ if (isset($metadata['category_id']) && $metadata['category_id'] > 0) {
+ $category = $this->categoryRepository->get($metadata['category_id'], $storeId);
+ if (in_array($category->getId(), $anchorCategoryIds)) {
+ $mergeDataProvider->merge(
+ $currentUrlRewrite->getIsAutogenerated()
+ ? $this->generateForAutogenerated($currentUrlRewrite, $storeId, $category, $product)
+ : $this->generateForCustom($currentUrlRewrite, $storeId, $category, $product)
+ );
+ }
+ }
+ }
+
+ return $mergeDataProvider->getData();
+ }
+
/**
* @param UrlRewrite $url
* @param int $storeId
diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php
index 40753a16f69a3..25f79f714da19 100644
--- a/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php
+++ b/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php
@@ -1,10 +1,11 @@
storeViewService = $storeViewService;
$this->storeManager = $storeManager;
@@ -111,6 +119,8 @@ public function __construct(
$mergeDataProviderFactory = ObjectManager::getInstance()->get(MergeDataProviderFactory::class);
}
$this->mergeDataProviderPrototype = $mergeDataProviderFactory->create();
+ $this->categoryRepository = $categoryRepository ?:
+ ObjectManager::getInstance()->get(CategoryRepositoryInterface::class);
}
/**
@@ -167,9 +177,12 @@ public function generateForSpecificStoreView($storeId, $productCategories, Produ
$mergeDataProvider = clone $this->mergeDataProviderPrototype;
$categories = [];
foreach ($productCategories as $category) {
- if ($this->isCategoryProperForGenerating($category, $storeId)) {
- $categories[] = $category;
+ if (!$this->isCategoryProperForGenerating($category, $storeId)) {
+ continue;
}
+
+ // category should be loaded per appropriate store if category's URL key has been changed
+ $categories[] = $this->getCategoryWithOverriddenUrlKey($storeId, $category);
}
$productCategories = $this->objectRegistryFactory->create(['entities' => $categories]);
@@ -190,6 +203,14 @@ public function generateForSpecificStoreView($storeId, $productCategories, Produ
$mergeDataProvider->merge(
$this->anchorUrlRewriteGenerator->generate($storeId, $product, $productCategories)
);
+ $mergeDataProvider->merge(
+ $this->currentUrlRewritesRegenerator->generateAnchor(
+ $storeId,
+ $product,
+ $productCategories,
+ $rootCategoryId
+ )
+ );
return $mergeDataProvider->getData();
}
@@ -210,4 +231,27 @@ public function isCategoryProperForGenerating(Category $category, $storeId)
return false;
}
+
+ /**
+ * Checks if URL key has been changed for provided category and returns reloaded category,
+ * in other case - returns provided category.
+ *
+ * @param int $storeId
+ * @param Category $category
+ * @return Category
+ */
+ private function getCategoryWithOverriddenUrlKey($storeId, Category $category)
+ {
+ $isUrlKeyOverridden = $this->storeViewService->doesEntityHaveOverriddenUrlKeyForStore(
+ $storeId,
+ $category->getEntityId(),
+ Category::ENTITY
+ );
+
+ if (!$isUrlKeyOverridden) {
+ return $category;
+ }
+
+ return $this->categoryRepository->get($category->getEntityId(), $storeId);
+ }
}
diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php
index bbf5d2b93c968..45a4f5f1eefd9 100644
--- a/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php
+++ b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php
@@ -1,6 +1,6 @@
childrenCategoriesProvider = $childrenCategoriesProvider;
@@ -69,6 +71,7 @@ public function __construct(
$this->productUrlRewriteGenerator = $productUrlRewriteGenerator;
$this->urlPersist = $urlPersist;
$this->productCollectionFactory = $productCollectionFactory;
+ $this->categoryProductUrlPathGenerator = $categoryProductUrlPathGenerator;
if (!isset($mergeDataProviderFactory)) {
$mergeDataProviderFactory = ObjectManager::getInstance()->get(MergeDataProviderFactory::class);
}
@@ -84,11 +87,12 @@ public function __construct(
public function generateProductUrlRewrites(Category $category)
{
$mergeDataProvider = clone $this->mergeDataProviderPrototype;
- $this->isSkippedProduct = [];
+ $this->isSkippedProduct[$category->getEntityId()] = [];
$saveRewriteHistory = $category->getData('save_rewrites_history');
$storeId = $category->getStoreId();
+
if ($category->getChangedProductIds()) {
- $this->isSkippedProduct = $category->getAffectedProductIds();
+ $this->isSkippedProduct[$category->getEntityId()] = $category->getAffectedProductIds();
$collection = $this->productCollectionFactory->create()
->setStoreId($storeId)
->addIdFilter($category->getAffectedProductIds())
@@ -134,7 +138,7 @@ public function generateProductUrlRewrites(Category $category)
* @param int|null $rootCategoryId
* @return UrlRewrite[]
*/
- public function getCategoryProductsUrlRewrites(
+ private function getCategoryProductsUrlRewrites(
Category $category,
$storeId,
$saveRewriteHistory,
@@ -142,42 +146,29 @@ public function getCategoryProductsUrlRewrites(
) {
$mergeDataProvider = clone $this->mergeDataProviderPrototype;
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection */
- $productCollection = $category->getProductCollection()
- ->addAttributeToSelect('name')
- ->addAttributeToSelect('visibility')
- ->addAttributeToSelect('url_key')
- ->addAttributeToSelect('url_path');
+ $productCollection = $this->productCollectionFactory->create();
+
+ $productCollection->setStoreId($storeId)
+ ->addAttributeToSelect(['name', 'visibility', 'url_key', 'url_path'])
+ ->addCategoriesFilter(['eq' => [$category->getEntityId()]]);
+
foreach ($productCollection as $product) {
- if (in_array($product->getId(), $this->isSkippedProduct)) {
+ if (isset($this->isSkippedProduct[$category->getEntityId()]) &&
+ in_array($product->getId(), $this->isSkippedProduct[$category->getEntityId()])
+ ) {
continue;
}
- $this->isSkippedProduct[] = $product->getId();
+ $this->isSkippedProduct[$category->getEntityId()][] = $product->getId();
$product->setStoreId($storeId);
$product->setData('save_rewrites_history', $saveRewriteHistory);
$mergeDataProvider->merge(
- $this->getCategoryBasedProductRewriteGenerator()->generate($product, $category, $rootCategoryId)
+ $this->categoryProductUrlPathGenerator->generate($product, $rootCategoryId)
);
}
return $mergeDataProvider->getData();
}
- /**
- * Retrieve generator, which use single category for different products.
- *
- * @deprecated
- * @return CategoryBasedProductRewriteGenerator|mixed
- */
- private function getCategoryBasedProductRewriteGenerator()
- {
- if (!$this->categoryBasedProductRewriteGenerator) {
- $this->categoryBasedProductRewriteGenerator = ObjectManager::getInstance()
- ->get(CategoryBasedProductRewriteGenerator::class);
- }
-
- return $this->categoryBasedProductRewriteGenerator;
- }
-
/**
* @param Category $category
* @return void
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
index cae6b07db6cce..ca514be51d99b 100644
--- 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
@@ -1,6 +1,6 @@
productScopeRewriteGeneratorMock = $this->getMockBuilder(ProductScopeRewriteGenerator::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->generator = new CategoryProductUrlPathGenerator(
+ $this->productScopeRewriteGeneratorMock
+ );
+ }
+
+ public function testGenerationWithGlobalScope()
+ {
+ $categoryCollectionMock = $this->getMockBuilder(Collection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $productMock = $this->getMockBuilder(Product::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $storeId = 1;
+ $categoryId = 1;
+ $urls = ['dummy-url.html'];
+
+ $productMock->expects($this->once())
+ ->method('getVisibility')
+ ->willReturn(2);
+ $productMock->expects($this->once())
+ ->method('getStoreId')
+ ->willReturn($storeId);
+ $productMock->expects($this->once())
+ ->method('getCategoryCollection')
+ ->willReturn($categoryCollectionMock);
+ $categoryCollectionMock->expects($this->atLeastOnce())
+ ->method('addAttributeToSelect')
+ ->willReturnSelf();
+
+ $this->productScopeRewriteGeneratorMock->expects($this->once())
+ ->method('isGlobalScope')
+ ->with($storeId)
+ ->willReturn(true);
+ $this->productScopeRewriteGeneratorMock->expects($this->once())
+ ->method('generateForGlobalScope')
+ ->with($categoryCollectionMock, $productMock, $categoryId)
+ ->willReturn($urls);
+
+ $this->assertEquals($urls, $this->generator->generate($productMock, $categoryId));
+ }
+
+ public function testGenerationWithSpecificStore()
+ {
+ $categoryCollectionMock = $this->getMockBuilder(Collection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $productMock = $this->getMockBuilder(Product::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $storeId = 1;
+ $categoryId = 1;
+ $urls = ['dummy-url.html'];
+
+ $productMock->expects($this->once())
+ ->method('getVisibility')
+ ->willReturn(2);
+ $productMock->expects($this->once())
+ ->method('getStoreId')
+ ->willReturn($storeId);
+ $productMock->expects($this->once())
+ ->method('getCategoryCollection')
+ ->willReturn($categoryCollectionMock);
+ $categoryCollectionMock->expects($this->atLeastOnce())
+ ->method('addAttributeToSelect')
+ ->willReturnSelf();
+
+ $this->productScopeRewriteGeneratorMock->expects($this->once())
+ ->method('isGlobalScope')
+ ->with($storeId)
+ ->willReturn(false);
+ $this->productScopeRewriteGeneratorMock->expects($this->once())
+ ->method('generateForSpecificStoreView')
+ ->with($storeId, $categoryCollectionMock, $productMock, $categoryId)
+ ->willReturn($urls);
+
+ $this->assertEquals($urls, $this->generator->generate($productMock, $categoryId));
+ }
+}
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlPathGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlPathGeneratorTest.php
index cf199af3a4b07..31cc64659b539 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlPathGeneratorTest.php
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlPathGeneratorTest.php
@@ -1,6 +1,6 @@
setStoreId(3);
$this->currentUrlRewritesRegenerator->expects($this->any())->method('generate')
->will($this->returnValue([$current]));
+ $this->currentUrlRewritesRegenerator->expects($this->any())->method('generateAnchor')
+ ->will($this->returnValue([$current]));
$anchorCategories = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite();
$anchorCategories->setRequestPath('category-4')
->setStoreId(4);
@@ -158,6 +160,8 @@ public function testGenerationForSpecificStore()
->will($this->returnValue([]));
$this->currentUrlRewritesRegenerator->expects($this->any())->method('generate')
->will($this->returnValue([]));
+ $this->currentUrlRewritesRegenerator->expects($this->any())->method('generateAnchor')
+ ->will($this->returnValue([]));
$this->anchorUrlRewriteGenerator->expects($this->any())->method('generate')
->will($this->returnValue([]));
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlPathGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlPathGeneratorTest.php
index 382e6048f82d9..b89678ac5999c 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlPathGeneratorTest.php
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlPathGeneratorTest.php
@@ -1,6 +1,6 @@
setMethods(['getData'])
->disableOriginalConstructor()
->getMock();
+ $this->categoryProductUrlPathGeneratorMock = $this->getMockBuilder(CategoryProductUrlPathGenerator::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$this->mergeDataProviderFactoryMock->expects($this->any())
->method('create')
->willReturn($this->mergeDataProviderMock);
@@ -135,20 +139,15 @@ protected function setUp()
$this->productUrlRewriteGeneratorMock,
$this->urlPersistMock,
$this->collectionFactoryMock,
+ $this->categoryProductUrlPathGeneratorMock,
$this->mergeDataProviderFactoryMock
);
- $this->categoryBasedProductRewriteGeneratorMock = $this->getMockBuilder(
- CategoryBasedProductRewriteGenerator::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
$this->objectManager = new ObjectManager($this);
$this->objectManager->setBackwardCompatibleProperty(
$this->urlRewriteHandler,
- 'categoryBasedProductRewriteGenerator',
- $this->categoryBasedProductRewriteGeneratorMock
+ 'categoryProductUrlPathGenerator',
+ $this->categoryProductUrlPathGeneratorMock
);
$this->productItem = $this->getMock(
@@ -182,6 +181,7 @@ public function testDeleteCategoryRewritesForChildren()
* Covers generateProductUrlRewrites(), getCategoryProductsUrlRewrites() methods.
*
* @dataProvider generateProductUrlRewritesDataProvider
+ * @param array $affectedProductIds
* @return void
*/
public function testGenerateProductUrlRewrites($affectedProductIds)
@@ -202,7 +202,7 @@ public function testGenerateProductUrlRewrites($affectedProductIds)
$this->categoryMock->expects($this->any())
->method('getChangedProductIds')
->willReturn($affectedProductIds);
- $this->categoryMock->expects($this->once())
+ $this->categoryMock->expects($this->any())
->method('getEntityId')
->willReturn($categoryId);
@@ -230,15 +230,15 @@ public function testGenerateProductUrlRewrites($affectedProductIds)
/**
* Calls when $affectedProductIds is not empty.
*
- * @param $saveRewritesHistory
- * @param $storeId
- * @param $categoryId
- * @param $affectedProductIds
+ * @param bool $saveRewritesHistory
+ * @param int $storeId
+ * @param int $categoryId
+ * @param array $affectedProductIds
* @return void
*/
private function callIfAffectedProductsIsset($saveRewritesHistory, $storeId, $categoryId, $affectedProductIds)
{
- $productCollectionMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Collection::class)
+ $productCollectionMock = $this->getMockBuilder(ProductCollection::class)
->setMethods(
[
'getData',
@@ -257,7 +257,8 @@ private function callIfAffectedProductsIsset($saveRewritesHistory, $storeId, $ca
->method('addIdFilter')
->with($affectedProductIds)
->willReturn($productCollectionMock);
- $productCollectionMock = $this->setAdditionalMocks($productCollectionMock, $storeId, $saveRewritesHistory);
+ $productCollectionMock =
+ $this->setAdditionalMocks($productCollectionMock, $storeId, $categoryId, $saveRewritesHistory);
$this->collectionFactoryMock->expects($this->any())
->method('create')
->willReturn($productCollectionMock);
@@ -270,29 +271,27 @@ private function callIfAffectedProductsIsset($saveRewritesHistory, $storeId, $ca
/**
* Calls when $affectedProductIds is empty.
*
- * @param $saveRewritesHistory
- * @param $storeId
- * @param $categoryId
- * @param $affectedProductIds
+ * @param bool $saveRewritesHistory
+ * @param int $storeId
+ * @param int $categoryId
+ * @param array $affectedProductIds
* @return void
*/
private function getCategoryProductsUrlRewrites($saveRewritesHistory, $storeId, $categoryId, $affectedProductIds)
{
$productCollection = $this->getMock(
- \Magento\Catalog\Model\ResourceModel\Product\Collection::class,
- ['addAttributeToSelect'],
+ ProductCollection::class,
+ ['addAttributeToSelect', 'setStoreId', 'addCategoriesFilter'],
[],
'',
false
);
- $productCollection = $this->setAdditionalMocks($productCollection, $storeId, $saveRewritesHistory);
- $this->categoryMock->expects($this->once())
- ->method('getProductCollection')
- ->willReturn($productCollection);
+ $productCollection = $this->setAdditionalMocks($productCollection, $storeId, $categoryId, $saveRewritesHistory);
+ $this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($productCollection);
$categoryBasedProductRewriteGenerated = $this->getProductUrlRewriteResult($affectedProductIds);
- $this->categoryBasedProductRewriteGeneratorMock->expects($this->once())
+ $this->categoryProductUrlPathGeneratorMock->expects($this->once())
->method('generate')
- ->with($this->productItem, $this->categoryMock, $categoryId)
+ ->with($this->productItem, $categoryId)
->willReturn($categoryBasedProductRewriteGenerated);
$this->productItem->expects($this->exactly(2))
->method('getId')
@@ -319,6 +318,7 @@ public function generateProductUrlRewritesDataProvider()
/**
* Returns products urlRewrite result.
*
+ * @param array $affectedProductIds
* @return array
*/
private function getProductUrlRewriteResult($affectedProductIds)
@@ -360,20 +360,21 @@ private function getProductUrlRewriteResult($affectedProductIds)
/**
* Sets additional data to the product Collection Mock.
*
- * @param $productCollectionMock
- * @return $productCollectionMock
+ * @param ProductCollection|\PHPUnit_Framework_MockObject_MockObject $productCollectionMock
+ * @param int $storeId
+ * @param int $categoryId
+ * @param bool $saveRewritesHistory
+ * @return ProductCollection|\PHPUnit_Framework_MockObject_MockObject $productCollectionMock
*/
- private function setAdditionalMocks($productCollectionMock, $storeId, $saveRewritesHistory)
+ private function setAdditionalMocks($productCollectionMock, $storeId, $categoryId, $saveRewritesHistory)
{
+ $productCollectionMock->expects($this->once())->method('setStoreId')->with($storeId)->willReturnSelf();
$productCollectionMock->expects($this->any())->method('addAttributeToSelect')
- ->willReturnMap(
- [
- ['visibility', false, $productCollectionMock],
- ['name', false, $productCollectionMock],
- ['url_key', false, $productCollectionMock],
- ['url_path', false, $productCollectionMock]
- ]
- );
+ ->willReturnSelf();
+ $productCollectionMock->expects($this->any())
+ ->method('addCategoriesFilter')
+ ->with(['eq' => [$categoryId]])
+ ->willReturnSelf();
$this->productItem->expects($this->once())
->method('setStoreId')
->with($storeId)
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Service/V1/StoreViewServiceTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Service/V1/StoreViewServiceTest.php
index 59755d3ac7ca8..773222d93e02c 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Service/V1/StoreViewServiceTest.php
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Service/V1/StoreViewServiceTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml
index a977b24d7c69b..9c4a8aaf41231 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml
index 8b5a72b18ff1b..4aa2e7f40c7c0 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml b/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml
index 5d2dbcb0d90d6..26e3d3da0eb3b 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/di.xml b/app/code/Magento/CatalogUrlRewrite/etc/di.xml
index 7f0fc718083ec..2d421417bfdc0 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/di.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml b/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml
index aaedd2e5bb1a7..a51c3c8cfe046 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/events.xml b/app/code/Magento/CatalogUrlRewrite/etc/events.xml
index 60c8d1045d836..cc558fe81f16d 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/events.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/module.xml b/app/code/Magento/CatalogUrlRewrite/etc/module.xml
index d2bfee12a6eda..65d6e5c748d98 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/module.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogUrlRewrite/registration.php b/app/code/Magento/CatalogUrlRewrite/registration.php
index 8dc5ed7f29d11..7d3cca119a659 100644
--- a/app/code/Magento/CatalogUrlRewrite/registration.php
+++ b/app/code/Magento/CatalogUrlRewrite/registration.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php
index d8be81b99d1d9..cf5de172ebc6a 100644
--- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php
+++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php
@@ -1,15 +1,14 @@
productCollectionFactory = $productCollectionFactory;
$this->catalogProductVisibility = $catalogProductVisibility;
@@ -107,6 +113,8 @@ public function __construct(
$this->sqlBuilder = $sqlBuilder;
$this->rule = $rule;
$this->conditionsHelper = $conditionsHelper;
+ $this->priceCurrency = $priceCurrency
+ ?: \Magento\Framework\App\ObjectManager::getInstance()->get(PriceCurrencyInterface::class);
parent::__construct(
$context,
$data
@@ -144,6 +152,7 @@ public function getCacheKeyInfo()
return [
'CATALOG_PRODUCTS_LIST_WIDGET',
+ $this->priceCurrency->getCurrencySymbol(),
$this->_storeManager->getStore()->getId(),
$this->_design->getDesignTheme()->getId(),
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
diff --git a/app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php b/app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php
index 2a852a708fa88..344afd317f174 100644
--- a/app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php
+++ b/app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php
@@ -1,6 +1,6 @@
storeManager = $storeManager;
parent::__construct(
@@ -67,7 +74,8 @@ public function __construct(
$productResource,
$attrSetCollection,
$localeFormat,
- $data
+ $data,
+ $category
);
}
@@ -106,7 +114,7 @@ protected function _addSpecialAttributes(array &$attributes)
/**
* Add condition to collection
*
- * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
+ * @param ProductCollection $collection
* @return $this
*/
public function addToCollection($collection)
@@ -137,14 +145,12 @@ public function addToCollection($collection)
}
/**
- * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute
- * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
+ * @param EavAttribute $attribute
+ * @param ProductCollection $collection
* @return $this
*/
- protected function addGlobalAttribute(
- \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute,
- \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
- ) {
+ protected function addGlobalAttribute(EavAttribute $attribute, ProductCollection $collection)
+ {
$storeId = $this->storeManager->getStore()->getId();
switch ($attribute->getBackendType()) {
@@ -170,14 +176,12 @@ protected function addGlobalAttribute(
}
/**
- * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute
- * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
+ * @param EavAttribute $attribute
+ * @param ProductCollection $collection
* @return $this
*/
- protected function addNotGlobalAttribute(
- \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute,
- \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
- ) {
+ protected function addNotGlobalAttribute(EavAttribute $attribute, ProductCollection $collection)
+ {
$storeId = $this->storeManager->getStore()->getId();
$values = $collection->getAllAttributeValues($attribute);
$validEntities = [];
diff --git a/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php b/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php
index 4258f94ab5633..7d9e876db2856 100644
--- a/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php
+++ b/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php
@@ -1,6 +1,6 @@
priceCurrency = $this->getMock(PriceCurrencyInterface::class);
$this->collectionFactory =
- $this->getMockBuilder('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory')
+ $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()->getMock();
- $this->visibility = $this->getMockBuilder('Magento\Catalog\Model\Product\Visibility')
+ $this->visibility = $this->getMockBuilder(\Magento\Catalog\Model\Product\Visibility::class)
->setMethods(['getVisibleInCatalogIds'])
->disableOriginalConstructor()
->getMock();
- $this->httpContext = $this->getMock('Magento\Framework\App\Http\Context');
- $this->builder = $this->getMock('Magento\Rule\Model\Condition\Sql\Builder', [], [], '', false);
- $this->rule = $this->getMock('Magento\CatalogWidget\Model\Rule', [], [], '', false);
- $this->widgetConditionsHelper = $this->getMock('Magento\Widget\Helper\Conditions');
- $this->storeManager = $this->getMock('\Magento\Store\Model\StoreManagerInterface');
- $this->design = $this->getMock('\Magento\Framework\View\DesignInterface');
+ $this->httpContext = $this->getMock(\Magento\Framework\App\Http\Context::class);
+ $this->builder = $this->getMock(\Magento\Rule\Model\Condition\Sql\Builder::class, [], [], '', false);
+ $this->rule = $this->getMock(\Magento\CatalogWidget\Model\Rule::class, [], [], '', false);
+ $this->widgetConditionsHelper = $this->getMock(\Magento\Widget\Helper\Conditions::class);
+ $this->storeManager = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class);
+ $this->design = $this->getMock(\Magento\Framework\View\DesignInterface::class);
$objectManagerHelper = new ObjectManagerHelper($this);
$arguments = $objectManagerHelper->getConstructArguments(
- 'Magento\CatalogWidget\Block\Product\ProductsList',
+ \Magento\CatalogWidget\Block\Product\ProductsList::class,
[
'productCollectionFactory' => $this->collectionFactory,
'catalogProductVisibility' => $this->visibility,
@@ -100,59 +107,60 @@ protected function setUp()
'rule' => $this->rule,
'conditionsHelper' => $this->widgetConditionsHelper,
'storeManager' => $this->storeManager,
- 'design' => $this->design
+ 'design' => $this->design,
+ 'priceCurrency' => $this->priceCurrency,
]
);
$this->request = $arguments['context']->getRequest();
$this->layout = $arguments['context']->getLayout();
$this->productsList = $objectManagerHelper->getObject(
- 'Magento\CatalogWidget\Block\Product\ProductsList',
+ \Magento\CatalogWidget\Block\Product\ProductsList::class,
$arguments
);
}
public function testGetCacheKeyInfo()
{
- $store = $this->getMockBuilder('\Magento\Store\Model\Store')
+ $store = $this->getMockBuilder(\Magento\Store\Model\Store::class)
->disableOriginalConstructor()->setMethods(['getId'])->getMock();
$store->expects($this->once())->method('getId')->willReturn(1);
$this->storeManager->expects($this->once())->method('getStore')->willReturn($store);
- $theme = $this->getMock('\Magento\Framework\View\Design\ThemeInterface');
+ $theme = $this->getMock(\Magento\Framework\View\Design\ThemeInterface::class);
$theme->expects($this->once())->method('getId')->willReturn('blank');
$this->design->expects($this->once())->method('getDesignTheme')->willReturn($theme);
$this->httpContext->expects($this->once())->method('getValue')->willReturn('context_group');
$this->productsList->setData('conditions', 'some_serialized_conditions');
-
$this->productsList->setData('page_var_name', 'page_number');
$this->request->expects($this->once())->method('getParam')->with('page_number')->willReturn(1);
-
$this->request->expects($this->once())->method('getParams')->willReturn('request_params');
+ $this->priceCurrency->expects($this->once())->method('getCurrencySymbol')->willReturn('$');
$cacheKey = [
'CATALOG_PRODUCTS_LIST_WIDGET',
+ '$',
1,
'blank',
'context_group',
1,
5,
'some_serialized_conditions',
- serialize('request_params')
+ serialize('request_params'),
];
$this->assertEquals($cacheKey, $this->productsList->getCacheKeyInfo());
}
public function testGetProductPriceHtml()
{
- $product = $this->getMockBuilder('Magento\Catalog\Model\Product')
+ $product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
->setMethods(['getId'])
->disableOriginalConstructor()
->getMock();
$product->expects($this->once())->method('getId')->willReturn(1);
- $priceRenderer = $this->getMockBuilder('\Magento\Framework\Pricing\Render')
+ $priceRenderer = $this->getMockBuilder(\Magento\Framework\Pricing\Render::class)
->setMethods(['render'])
->disableOriginalConstructor()
->getMock();
@@ -173,7 +181,7 @@ public function testGetProductPriceHtml()
\Magento\Framework\Pricing\Render::ZONE_ITEM_LIST,
[
'include_container' => false,
- 'display_minimal_price' => false
+ 'display_minimal_price' => false,
]
));
}
@@ -185,7 +193,7 @@ public function testGetPagerHtmlEmpty()
public function testGetPagerHtml()
{
- $collection = $this->getMockBuilder('\Magento\Catalog\Model\ResourceModel\Product\Collection')
+ $collection = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Collection::class)
->setMethods(['getSize'])
->disableOriginalConstructor()
->getMock();
@@ -195,7 +203,7 @@ public function testGetPagerHtml()
$this->productsList->setData('products_per_page', 2);
$this->productsList->setData('product_collection', $collection);
- $pagerBlock = $this->getMockBuilder('Magento\Catalog\Block\Product\Widget\Html\Pager')
+ $pagerBlock = $this->getMockBuilder(\Magento\Catalog\Block\Product\Widget\Html\Pager::class)
->setMethods([
'toHtml',
'setUseContainer',
@@ -205,7 +213,9 @@ public function testGetPagerHtml()
'setLimit',
'setTotalLimit',
'setCollection',
- ])->disableOriginalConstructor()->getMock();
+ ])
+ ->disableOriginalConstructor()
+ ->getMock();
$pagerBlock->expects($this->once())->method('setUseContainer')->willReturnSelf();
$pagerBlock->expects($this->once())->method('setShowAmounts')->willReturnSelf();
@@ -233,7 +243,7 @@ public function testCreateCollection($pagerEnable, $productsCount, $productsPerP
{
$this->visibility->expects($this->once())->method('getVisibleInCatalogIds')
->willReturn([Visibility::VISIBILITY_IN_CATALOG, Visibility::VISIBILITY_BOTH]);
- $collection = $this->getMockBuilder('\Magento\Catalog\Model\ResourceModel\Product\Collection')
+ $collection = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Collection::class)
->setMethods([
'setVisibility',
'addMinimalPrice',
@@ -322,14 +332,15 @@ public function testShowPager()
public function testGetIdentities()
{
- $collection = $this->getMockBuilder('\Magento\Catalog\Model\ResourceModel\Product\Collection')
+ $collection = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Collection::class)
->setMethods([
'addAttributeToSelect',
'getIterator',
- ])->disableOriginalConstructor()
+ ])
+ ->disableOriginalConstructor()
->getMock();
- $product = $this->getMock('Magento\Framework\DataObject\IdentityInterface', ['getIdentities']);
+ $product = $this->getMock(\Magento\Framework\DataObject\IdentityInterface::class, ['getIdentities']);
$notProduct = $this->getMock('NotProduct', ['getIdentities']);
$product->expects($this->once())->method('getIdentities')->willReturn(['product_identity']);
$collection->expects($this->once())->method('getIterator')->willReturn(
@@ -349,7 +360,7 @@ public function testGetIdentities()
*/
private function getConditionsForCollection($collection)
{
- $conditions = $this->getMockBuilder('\Magento\Rule\Model\Condition\Combine')
+ $conditions = $this->getMockBuilder(\Magento\Rule\Model\Condition\Combine::class)
->setMethods(['collectValidatedAttributes'])
->disableOriginalConstructor()
->getMock();
@@ -359,6 +370,7 @@ private function getConditionsForCollection($collection)
$this->rule->expects($this->once())->method('loadPost')->willReturnSelf();
$this->rule->expects($this->once())->method('getConditions')->willReturn($conditions);
+
return $conditions;
}
diff --git a/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php b/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php
index 79a25d2f397bd..9506937509035 100644
--- a/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php
+++ b/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/CatalogWidget/etc/module.xml b/app/code/Magento/CatalogWidget/etc/module.xml
index a335a9a3d4a07..8954f11f954f7 100644
--- a/app/code/Magento/CatalogWidget/etc/module.xml
+++ b/app/code/Magento/CatalogWidget/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogWidget/etc/widget.xml b/app/code/Magento/CatalogWidget/etc/widget.xml
index c08d3e4da9c6a..3d54c314c6622 100644
--- a/app/code/Magento/CatalogWidget/etc/widget.xml
+++ b/app/code/Magento/CatalogWidget/etc/widget.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/CatalogWidget/registration.php b/app/code/Magento/CatalogWidget/registration.php
index 5a08e70aab0c4..556da60268baf 100644
--- a/app/code/Magento/CatalogWidget/registration.php
+++ b/app/code/Magento/CatalogWidget/registration.php
@@ -1,6 +1,6 @@
layoutProcessors as $processor) {
$this->jsLayout = $processor->process($this->jsLayout);
}
- return \Zend_Json::encode($this->jsLayout);
+ return json_encode($this->jsLayout, JSON_HEX_TAG);
}
/**
diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php
index 4d51c613c08e8..01ead8b514e9c 100644
--- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php
+++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php
@@ -1,6 +1,6 @@
layoutProcessors as $processor) {
$this->jsLayout = $processor->process($this->jsLayout);
}
- return parent::getJsLayout();
+ return json_encode($this->jsLayout, JSON_HEX_TAG);
}
/**
diff --git a/app/code/Magento/Checkout/Block/Cart/ValidationMessages.php b/app/code/Magento/Checkout/Block/Cart/ValidationMessages.php
index ee1df8403b758..7002e0526d13d 100644
--- a/app/code/Magento/Checkout/Block/Cart/ValidationMessages.php
+++ b/app/code/Magento/Checkout/Block/Cart/ValidationMessages.php
@@ -1,6 +1,6 @@
layoutProcessors as $processor) {
$this->jsLayout = $processor->process($this->jsLayout);
}
- return \Zend_Json::encode($this->jsLayout);
+ return json_encode($this->jsLayout, JSON_HEX_TAG);
}
/**
diff --git a/app/code/Magento/Checkout/Block/Onepage/Failure.php b/app/code/Magento/Checkout/Block/Onepage/Failure.php
index 9b9ddfcce67d8..f858960c75ceb 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Failure.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Failure.php
@@ -1,6 +1,6 @@
configurationPool = $configurationPool;
$this->imageHelper = $imageHelper;
$this->msrpHelper = $msrpHelper;
$this->urlBuilder = $urlBuilder;
$this->checkoutHelper = $checkoutHelper;
+ $this->escaper = $escaper ?: ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class);
}
/**
@@ -64,6 +76,8 @@ public function __construct(
protected function doGetItemData()
{
$imageHelper = $this->imageHelper->init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail');
+ $productName = $this->escaper->escapeHtml($this->item->getProduct()->getName());
+
return [
'options' => $this->getOptionList(),
'qty' => $this->item->getQty() * 1,
@@ -71,7 +85,7 @@ protected function doGetItemData()
'configure_url' => $this->getConfigureUrl(),
'is_visible_in_site_visibility' => $this->item->getProduct()->isVisibleInSiteVisibility(),
'product_id' => $this->item->getProduct()->getId(),
- 'product_name' => $this->item->getProduct()->getName(),
+ 'product_name' => $productName,
'product_sku' => $this->item->getProduct()->getSku(),
'product_url' => $this->getProductUrl(),
'product_has_url' => $this->hasProductUrl(),
diff --git a/app/code/Magento/Checkout/CustomerData/DirectoryData.php b/app/code/Magento/Checkout/CustomerData/DirectoryData.php
index 909fa0fee7437..087f3237a50ff 100644
--- a/app/code/Magento/Checkout/CustomerData/DirectoryData.php
+++ b/app/code/Magento/Checkout/CustomerData/DirectoryData.php
@@ -1,6 +1,6 @@
_storeManager = $storeManager;
$this->_checkoutSession = $checkoutSession;
@@ -77,6 +85,8 @@ public function __construct(
$this->_transportBuilder = $transportBuilder;
$this->inlineTranslation = $inlineTranslation;
$this->priceCurrency = $priceCurrency;
+ $this->paymentFailures = $paymentFailures ? : \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(PaymentFailuresInterface::class);
parent::__construct($context);
}
@@ -202,126 +212,10 @@ public function getBaseSubtotalInclTax($item)
* @param string $message
* @param string $checkoutType
* @return $this
- * @SuppressWarnings(PHPMD.CyclomaticComplexity)
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'onepage')
{
- $this->inlineTranslation->suspend();
-
- $template = $this->scopeConfig->getValue(
- 'checkout/payment_failed/template',
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $checkout->getStoreId()
- );
-
- $copyTo = $this->_getEmails('checkout/payment_failed/copy_to', $checkout->getStoreId());
- $copyMethod = $this->scopeConfig->getValue(
- 'checkout/payment_failed/copy_method',
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $checkout->getStoreId()
- );
- $bcc = [];
- if ($copyTo && $copyMethod == 'bcc') {
- $bcc = $copyTo;
- }
-
- $_receiver = $this->scopeConfig->getValue(
- 'checkout/payment_failed/receiver',
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $checkout->getStoreId()
- );
- $sendTo = [
- [
- 'email' => $this->scopeConfig->getValue(
- 'trans_email/ident_' . $_receiver . '/email',
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $checkout->getStoreId()
- ),
- 'name' => $this->scopeConfig->getValue(
- 'trans_email/ident_' . $_receiver . '/name',
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $checkout->getStoreId()
- ),
- ],
- ];
-
- if ($copyTo && $copyMethod == 'copy') {
- foreach ($copyTo as $email) {
- $sendTo[] = ['email' => $email, 'name' => null];
- }
- }
- $shippingMethod = '';
- if ($shippingInfo = $checkout->getShippingAddress()->getShippingMethod()) {
- $data = explode('_', $shippingInfo);
- $shippingMethod = $data[0];
- }
-
- $paymentMethod = '';
- if ($paymentInfo = $checkout->getPayment()) {
- $paymentMethod = $paymentInfo->getMethod();
- }
-
- $items = '';
- foreach ($checkout->getAllVisibleItems() as $_item) {
- /* @var $_item \Magento\Quote\Model\Quote\Item */
- $items .=
- $_item->getProduct()->getName() . ' x ' . $_item->getQty() . ' ' . $checkout->getStoreCurrencyCode()
- . ' ' . $_item->getProduct()->getFinalPrice(
- $_item->getQty()
- ) . "\n";
- }
- $total = $checkout->getStoreCurrencyCode() . ' ' . $checkout->getGrandTotal();
-
- foreach ($sendTo as $recipient) {
- $transport = $this->_transportBuilder->setTemplateIdentifier(
- $template
- )->setTemplateOptions(
- [
- 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE,
- 'store' => Store::DEFAULT_STORE_ID
- ]
- )->setTemplateVars(
- [
- 'reason' => $message,
- 'checkoutType' => $checkoutType,
- 'dateAndTime' => $this->_localeDate->formatDateTime(
- new \DateTime(),
- \IntlDateFormatter::MEDIUM,
- \IntlDateFormatter::MEDIUM
- ),
- 'customer' => $checkout->getCustomerFirstname() . ' ' . $checkout->getCustomerLastname(),
- 'customerEmail' => $checkout->getCustomerEmail(),
- 'billingAddress' => $checkout->getBillingAddress(),
- 'shippingAddress' => $checkout->getShippingAddress(),
- 'shippingMethod' => $this->scopeConfig->getValue(
- 'carriers/' . $shippingMethod . '/title',
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE
- ),
- 'paymentMethod' => $this->scopeConfig->getValue(
- 'payment/' . $paymentMethod . '/title',
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE
- ),
- 'items' => nl2br($items),
- 'total' => $total,
- ]
- )->setFrom(
- $this->scopeConfig->getValue(
- 'checkout/payment_failed/identity',
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $checkout->getStoreId()
- )
- )->addTo(
- $recipient['email'],
- $recipient['name']
- )->addBcc(
- $bcc
- )->getTransport();
-
- $transport->sendMessage();
- }
-
- $this->inlineTranslation->resume();
+ $this->paymentFailures->handle($checkout->getId(), $message, $checkoutType);
return $this;
}
diff --git a/app/code/Magento/Checkout/Helper/ExpressRedirect.php b/app/code/Magento/Checkout/Helper/ExpressRedirect.php
index 1e383ec22b5a7..6f2bb33590cb9 100644
--- a/app/code/Magento/Checkout/Helper/ExpressRedirect.php
+++ b/app/code/Magento/Checkout/Helper/ExpressRedirect.php
@@ -1,6 +1,6 @@
billingAddressManagement = $billingAddressManagement;
$this->paymentMethodManagement = $paymentMethodManagement;
@@ -74,6 +83,7 @@ public function __construct(
$this->paymentInformationManagement = $paymentInformationManagement;
$this->quoteIdMaskFactory = $quoteIdMaskFactory;
$this->cartRepository = $cartRepository;
+ $this->connectionPull = $connectionPull ?: ObjectManager::getInstance()->get(ResourceConnection::class);
}
/**
@@ -85,20 +95,33 @@ public function savePaymentInformationAndPlaceOrder(
\Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
\Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
- $this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress);
+ $salesConnection = $this->connectionPull->getConnection('sales');
+ $checkoutConnection = $this->connectionPull->getConnection('checkout');
+ $salesConnection->beginTransaction();
+ $checkoutConnection->beginTransaction();
+
try {
- $orderId = $this->cartManagement->placeOrder($cartId);
- } catch (\Magento\Framework\Exception\LocalizedException $e) {
- throw new CouldNotSaveException(
- __($e->getMessage()),
- $e
- );
+ $this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress);
+ try {
+ $orderId = $this->cartManagement->placeOrder($cartId);
+ } catch (\Magento\Framework\Exception\LocalizedException $e) {
+ throw new CouldNotSaveException(
+ __($e->getMessage()),
+ $e
+ );
+ } catch (\Exception $e) {
+ $this->getLogger()->critical($e);
+ throw new CouldNotSaveException(
+ __('An error occurred on the server. Please try to place the order again.'),
+ $e
+ );
+ }
+ $salesConnection->commit();
+ $checkoutConnection->commit();
} catch (\Exception $e) {
- $this->getLogger()->critical($e);
- throw new CouldNotSaveException(
- __('An error occurred on the server. Please try to place the order again.'),
- $e
- );
+ $salesConnection->rollBack();
+ $checkoutConnection->rollBack();
+ throw $e;
}
return $orderId;
diff --git a/app/code/Magento/Checkout/Model/GuestShippingInformationManagement.php b/app/code/Magento/Checkout/Model/GuestShippingInformationManagement.php
index c734ba5d7b858..b1194a25ab548 100644
--- a/app/code/Magento/Checkout/Model/GuestShippingInformationManagement.php
+++ b/app/code/Magento/Checkout/Model/GuestShippingInformationManagement.php
@@ -1,6 +1,6 @@
paymentMethodManagement = $paymentMethodManagement;
$this->paymentDetailsFactory = $paymentDetailsFactory;
@@ -120,6 +128,18 @@ public function __construct(
$this->addressRepository = $addressRepository;
$this->scopeConfig = $scopeConfig;
$this->totalsCollector = $totalsCollector;
+ if (!$cartExtensionFactory) {
+ $cartExtensionFactory = ObjectManager::getInstance()->get(CartExtensionFactory::class);
+ }
+ $this->cartExtensionFactory = $cartExtensionFactory;
+ if (!$shippingAssignmentFactory) {
+ $shippingAssignmentFactory = ObjectManager::getInstance()->get(ShippingAssignmentFactory::class);
+ }
+ $this->shippingAssignmentFactory = $shippingAssignmentFactory;
+ if (!$shippingFactory) {
+ $shippingFactory = ObjectManager::getInstance()->get(ShippingFactory::class);
+ }
+ $this->shippingFactory = $shippingFactory;
}
/**
@@ -200,19 +220,19 @@ private function prepareShippingAssignment(CartInterface $quote, AddressInterfac
{
$cartExtension = $quote->getExtensionAttributes();
if ($cartExtension === null) {
- $cartExtension = $this->getCartExtensionFactory()->create();
+ $cartExtension = $this->cartExtensionFactory->create();
}
$shippingAssignments = $cartExtension->getShippingAssignments();
if (empty($shippingAssignments)) {
- $shippingAssignment = $this->getShippingAssignmentFactory()->create();
+ $shippingAssignment = $this->shippingAssignmentFactory->create();
} else {
$shippingAssignment = $shippingAssignments[0];
}
$shipping = $shippingAssignment->getShipping();
if ($shipping === null) {
- $shipping = $this->getShippingFactory()->create();
+ $shipping = $this->shippingFactory->create();
}
$shipping->setAddress($address);
@@ -221,37 +241,4 @@ private function prepareShippingAssignment(CartInterface $quote, AddressInterfac
$cartExtension->setShippingAssignments([$shippingAssignment]);
return $quote->setExtensionAttributes($cartExtension);
}
-
- /**
- * @return CartExtensionFactory
- */
- private function getCartExtensionFactory()
- {
- if (!$this->cartExtensionFactory) {
- $this->cartExtensionFactory = ObjectManager::getInstance()->get(CartExtensionFactory::class);
- }
- return $this->cartExtensionFactory;
- }
-
- /**
- * @return ShippingAssignmentFactory
- */
- private function getShippingAssignmentFactory()
- {
- if (!$this->shippingAssignmentFactory) {
- $this->shippingAssignmentFactory = ObjectManager::getInstance()->get(ShippingAssignmentFactory::class);
- }
- return $this->shippingAssignmentFactory;
- }
-
- /**
- * @return ShippingFactory
- */
- private function getShippingFactory()
- {
- if (!$this->shippingFactory) {
- $this->shippingFactory = ObjectManager::getInstance()->get(ShippingFactory::class);
- }
- return $this->shippingFactory;
- }
}
diff --git a/app/code/Magento/Checkout/Model/Sidebar.php b/app/code/Magento/Checkout/Model/Sidebar.php
index ed785e68d5cc0..4276d7d07f3c3 100644
--- a/app/code/Magento/Checkout/Model/Sidebar.php
+++ b/app/code/Magento/Checkout/Model/Sidebar.php
@@ -1,6 +1,6 @@
getConstructArguments($className);
/** @var \Magento\Framework\App\Helper\Context $context */
$context = $arguments['context'];
@@ -74,50 +74,50 @@ protected function setUp()
'checkout/payment_failed/template',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
8,
- 'fixture_email_template_payment_failed'
+ 'fixture_email_template_payment_failed',
],
[
'checkout/payment_failed/receiver',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
8,
- 'sysadmin'
+ 'sysadmin',
],
[
'trans_email/ident_sysadmin/email',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
8,
- 'sysadmin@example.com'
+ 'sysadmin@example.com',
],
[
'trans_email/ident_sysadmin/name',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
8,
- 'System Administrator'
+ 'System Administrator',
],
[
'checkout/payment_failed/identity',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
8,
- 'noreply@example.com'
+ 'noreply@example.com',
],
[
'carriers/ground/title',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
null,
- 'Ground Shipping'
+ 'Ground Shipping',
],
[
'payment/fixture-payment-method/title',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
null,
- 'Check Money Order'
+ 'Check Money Order',
],
[
'checkout/options/onepage_checkout_enabled',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
null,
- 'One Page Checkout'
- ]
+ 'One Page Checkout',
+ ],
]
)
);
@@ -140,113 +140,11 @@ protected function setUp()
*/
public function testSendPaymentFailedEmail()
{
- $shippingAddress = new \Magento\Framework\DataObject(['shipping_method' => 'ground_transportation']);
- $billingAddress = new \Magento\Framework\DataObject(['street' => 'Fixture St']);
-
- $this->_transportBuilder->expects(
- $this->once()
- )->method(
- 'setTemplateOptions'
- )->with(
- [
- 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE,
- 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
- ]
- )->will(
- $this->returnSelf()
- );
-
- $this->_transportBuilder->expects(
- $this->once()
- )->method(
- 'setTemplateIdentifier'
- )->with(
- 'fixture_email_template_payment_failed'
- )->will(
- $this->returnSelf()
- );
-
- $this->_transportBuilder->expects(
- $this->once()
- )->method(
- 'setFrom'
- )->with(
- 'noreply@example.com'
- )->will(
- $this->returnSelf()
- );
-
- $this->_transportBuilder->expects(
- $this->once()
- )->method(
- 'addTo'
- )->with(
- 'sysadmin@example.com',
- 'System Administrator'
- )->will(
- $this->returnSelf()
- );
-
- $this->_transportBuilder->expects(
- $this->once()
- )->method(
- 'setTemplateVars'
- )->with(
- [
- 'reason' => 'test message',
- 'checkoutType' => 'onepage',
- 'dateAndTime' => 'Oct 02, 2013',
- 'customer' => 'John Doe',
- 'customerEmail' => 'john.doe@example.com',
- 'billingAddress' => $billingAddress,
- 'shippingAddress' => $shippingAddress,
- 'shippingMethod' => 'Ground Shipping',
- 'paymentMethod' => 'Check Money Order',
- 'items' => "Product One x 2 USD 10 \nProduct Two x 3 USD 60 \n",
- 'total' => 'USD 70'
- ]
- )->will(
- $this->returnSelf()
- );
-
- $this->_transportBuilder->expects($this->once())->method('addBcc')->will($this->returnSelf());
- $this->_transportBuilder->expects(
- $this->once()
- )->method(
- 'getTransport'
- )->will(
- $this->returnValue($this->getMock('Magento\Framework\Mail\TransportInterface'))
- );
+ $quoteMock = $this->getMockBuilder(\Magento\Quote\Model\Quote::class)
+ ->disableOriginalConstructor()
+ ->getMock();
- $this->_translator->expects($this->at(1))->method('suspend');
- $this->_translator->expects($this->at(1))->method('resume');
-
- $productOne = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
- $productOne->expects($this->once())->method('getName')->will($this->returnValue('Product One'));
- $productOne->expects($this->once())->method('getFinalPrice')->with(2)->will($this->returnValue(10));
-
- $productTwo = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
- $productTwo->expects($this->once())->method('getName')->will($this->returnValue('Product Two'));
- $productTwo->expects($this->once())->method('getFinalPrice')->with(3)->will($this->returnValue(60));
-
- $quote = new \Magento\Framework\DataObject(
- [
- 'store_id' => 8,
- 'store_currency_code' => 'USD',
- 'grand_total' => 70,
- 'customer_firstname' => 'John',
- 'customer_lastname' => 'Doe',
- 'customer_email' => 'john.doe@example.com',
- 'billing_address' => $billingAddress,
- 'shipping_address' => $shippingAddress,
- 'payment' => new \Magento\Framework\DataObject(['method' => 'fixture-payment-method']),
- 'all_visible_items' => [
- new \Magento\Framework\DataObject(['product' => $productOne, 'qty' => 2]),
- new \Magento\Framework\DataObject(['product' => $productTwo, 'qty' => 3])
- ]
- ]
- );
- $this->assertSame($this->_helper, $this->_helper->sendPaymentFailedEmail($quote, 'test message'));
+ $this->assertSame($this->_helper, $this->_helper->sendPaymentFailedEmail($quoteMock, 'test message'));
}
/**
@@ -259,7 +157,7 @@ public function testGetCheckout()
public function testGetQuote()
{
- $quoteMock = $this->getMock('\Magento\Quote\Model\Quote', [], [], '', false);
+ $quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false);
$this->_checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock));
$this->assertEquals($quoteMock, $this->_helper->getQuote());
}
@@ -267,9 +165,9 @@ public function testGetQuote()
public function testFormatPrice()
{
$price = 5.5;
- $quoteMock = $this->getMock('\Magento\Quote\Model\Quote', [], [], '', false);
+ $quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false);
$storeMock = $this->getMock(
- 'Magento\Store\Model\Store',
+ \Magento\Store\Model\Store::class,
['formatPrice', '__wakeup'],
[],
'',
@@ -300,11 +198,9 @@ public function testCanOnepageCheckout()
public function testIsContextCheckout()
{
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $context = $objectManagerHelper->getObject(
- 'Magento\Framework\App\Helper\Context'
- );
+ $context = $objectManagerHelper->getObject(\Magento\Framework\App\Helper\Context::class);
$helper = $objectManagerHelper->getObject(
- 'Magento\Checkout\Helper\Data',
+ \Magento\Checkout\Helper\Data::class,
['context' => $context]
);
$context->getRequest()->expects($this->once())->method('getParam')->with('context')->will(
@@ -324,7 +220,7 @@ public function testIsCustomerMustBeLogged()
public function testGetPriceInclTax()
{
- $itemMock = $this->getMock('Magento\Framework\DataObject', ['getPriceInclTax'], [], '', false);
+ $itemMock = $this->getMock(\Magento\Framework\DataObject::class, ['getPriceInclTax'], [], '', false);
$itemMock->expects($this->exactly(2))->method('getPriceInclTax')->will($this->returnValue(5.5));
$this->assertEquals(5.5, $this->_helper->getPriceInclTax($itemMock));
}
@@ -337,17 +233,17 @@ public function testGetPriceInclTaxWithoutTax()
$rowTotal = 15;
$roundPrice = 17;
$expected = 17;
- $storeManager = $this->getMock('\Magento\Store\Model\StoreManagerInterface', [], [], '', false);
+ $storeManager = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class, [], [], '', false);
$objectManagerHelper = new ObjectManager($this);
$helper = $objectManagerHelper->getObject(
- '\Magento\Checkout\Helper\Data',
+ \Magento\Checkout\Helper\Data::class,
[
'storeManager' => $storeManager,
'priceCurrency' => $this->priceCurrency,
]
);
$itemMock = $this->getMock(
- 'Magento\Framework\DataObject',
+ \Magento\Framework\DataObject::class,
['getPriceInclTax', 'getQty', 'getTaxAmount', 'getDiscountTaxCompensation', 'getRowTotal'],
[],
'',
@@ -368,7 +264,7 @@ public function testGetSubtotalInclTax()
{
$rowTotalInclTax = 5.5;
$expected = 5.5;
- $itemMock = $this->getMock('Magento\Framework\DataObject', ['getRowTotalInclTax'], [], '', false);
+ $itemMock = $this->getMock(\Magento\Framework\DataObject::class, ['getRowTotalInclTax'], [], '', false);
$itemMock->expects($this->exactly(2))->method('getRowTotalInclTax')->will($this->returnValue($rowTotalInclTax));
$this->assertEquals($expected, $this->_helper->getSubtotalInclTax($itemMock));
}
@@ -380,7 +276,7 @@ public function testGetSubtotalInclTaxNegative()
$rowTotal = 15;
$expected = 17;
$itemMock = $this->getMock(
- 'Magento\Framework\DataObject',
+ \Magento\Framework\DataObject::class,
['getRowTotalInclTax', 'getTaxAmount', 'getDiscountTaxCompensation', 'getRowTotal'],
[],
'',
@@ -396,16 +292,16 @@ public function testGetSubtotalInclTaxNegative()
public function testGetBasePriceInclTaxWithoutQty()
{
- $storeManager = $this->getMock('\Magento\Store\Model\StoreManagerInterface', [], [], '', false);
+ $storeManager = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class, [], [], '', false);
$objectManagerHelper = new ObjectManager($this);
$helper = $objectManagerHelper->getObject(
- '\Magento\Checkout\Helper\Data',
+ \Magento\Checkout\Helper\Data::class,
[
'storeManager' => $storeManager,
'priceCurrency' => $this->priceCurrency,
]
);
- $itemMock = $this->getMock('Magento\Framework\DataObject', ['getQty'], [], '', false);
+ $itemMock = $this->getMock(\Magento\Framework\DataObject::class, ['getQty'], [], '', false);
$itemMock->expects($this->once())->method('getQty');
$this->priceCurrency->expects($this->once())->method('round');
$helper->getPriceInclTax($itemMock);
@@ -413,16 +309,16 @@ public function testGetBasePriceInclTaxWithoutQty()
public function testGetBasePriceInclTax()
{
- $storeManager = $this->getMock('\Magento\Store\Model\StoreManagerInterface', [], [], '', false);
+ $storeManager = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class, [], [], '', false);
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$helper = $objectManagerHelper->getObject(
- '\Magento\Checkout\Helper\Data',
+ \Magento\Checkout\Helper\Data::class,
[
'storeManager' => $storeManager,
'priceCurrency' => $this->priceCurrency,
]
);
- $itemMock = $this->getMock('Magento\Framework\DataObject', ['getQty', 'getQtyOrdered'], [], '', false);
+ $itemMock = $this->getMock(\Magento\Framework\DataObject::class, ['getQty', 'getQtyOrdered'], [], '', false);
$itemMock->expects($this->once())->method('getQty')->will($this->returnValue(false));
$itemMock->expects($this->exactly(2))->method('getQtyOrdered')->will($this->returnValue(5.5));
$this->priceCurrency->expects($this->once())->method('round');
@@ -432,7 +328,7 @@ public function testGetBasePriceInclTax()
public function testGetBaseSubtotalInclTax()
{
$itemMock = $this->getMock(
- 'Magento\Framework\DataObject',
+ \Magento\Framework\DataObject::class,
['getBaseTaxAmount', 'getBaseDiscountTaxCompensation', 'getBaseRowTotal'],
[],
'',
@@ -446,7 +342,7 @@ public function testGetBaseSubtotalInclTax()
public function testIsAllowedGuestCheckoutWithoutStore()
{
- $quoteMock = $this->getMock('\Magento\Quote\Model\Quote', [], [], '', false);
+ $quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false);
$store = null;
$quoteMock->expects($this->once())->method('getStoreId')->will($this->returnValue(1));
$this->_scopeConfig->expects($this->once())
diff --git a/app/code/Magento/Checkout/Test/Unit/Helper/ExpressRedirectTest.php b/app/code/Magento/Checkout/Test/Unit/Helper/ExpressRedirectTest.php
index 15d68a7819bd3..4fd3d58e5bc7f 100644
--- a/app/code/Magento/Checkout/Test/Unit/Helper/ExpressRedirectTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Helper/ExpressRedirectTest.php
@@ -1,6 +1,6 @@
loggerMock = $this->getMock(\Psr\Log\LoggerInterface::class);
+ $this->resourceConnectionMock = $this->getMockBuilder(ResourceConnection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$this->model = $objectManager->getObject(
\Magento\Checkout\Model\GuestPaymentInformationManagement::class,
[
@@ -73,7 +85,8 @@ protected function setUp()
'paymentMethodManagement' => $this->paymentMethodManagementMock,
'cartManagement' => $this->cartManagementMock,
'cartRepository' => $this->cartRepositoryMock,
- 'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock
+ 'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock,
+ 'connectionPull' => $this->resourceConnectionMock
]
);
$objectManager->setBackwardCompatibleProperty($this->model, 'logger', $this->loggerMock);
@@ -89,6 +102,27 @@ public function testSavePaymentInformationAndPlaceOrder()
$billingAddressMock->expects($this->once())->method('setEmail')->with($email)->willReturnSelf();
+ $adapterMockForSales = $this->getMockBuilder(AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+ $adapterMockForCheckout = $this->getMockBuilder(AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
+ $this->resourceConnectionMock->expects($this->at(0))
+ ->method('getConnection')
+ ->with('sales')
+ ->willReturn($adapterMockForSales);
+ $adapterMockForSales->expects($this->once())->method('beginTransaction');
+ $adapterMockForSales->expects($this->once())->method('commit');
+
+ $this->resourceConnectionMock->expects($this->at(1))
+ ->method('getConnection')
+ ->with('checkout')
+ ->willReturn($adapterMockForCheckout);
+ $adapterMockForCheckout->expects($this->once())->method('beginTransaction');
+ $adapterMockForCheckout->expects($this->once())->method('commit');
+
$this->billingAddressManagementMock->expects($this->once())
->method('assign')
->with($cartId, $billingAddressMock);
@@ -114,6 +148,27 @@ public function testSavePaymentInformationAndPlaceOrderException()
$billingAddressMock->expects($this->once())->method('setEmail')->with($email)->willReturnSelf();
+ $adapterMockForSales = $this->getMockBuilder(AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+ $adapterMockForCheckout = $this->getMockBuilder(AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
+ $this->resourceConnectionMock->expects($this->at(0))
+ ->method('getConnection')
+ ->with('sales')
+ ->willReturn($adapterMockForSales);
+ $adapterMockForSales->expects($this->once())->method('beginTransaction');
+ $adapterMockForSales->expects($this->once())->method('rollback');
+
+ $this->resourceConnectionMock->expects($this->at(1))
+ ->method('getConnection')
+ ->with('checkout')
+ ->willReturn($adapterMockForCheckout);
+ $adapterMockForCheckout->expects($this->once())->method('beginTransaction');
+ $adapterMockForCheckout->expects($this->once())->method('rollback');
+
$this->billingAddressManagementMock->expects($this->once())
->method('assign')
->with($cartId, $billingAddressMock);
@@ -176,6 +231,27 @@ public function testSavePaymentInformationAndPlaceOrderWithLocalizedException()
$billingAddressMock->expects($this->once())->method('setEmail')->with($email)->willReturnSelf();
+ $adapterMockForSales = $this->getMockBuilder(AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+ $adapterMockForCheckout = $this->getMockBuilder(AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
+ $this->resourceConnectionMock->expects($this->at(0))
+ ->method('getConnection')
+ ->with('sales')
+ ->willReturn($adapterMockForSales);
+ $adapterMockForSales->expects($this->once())->method('beginTransaction');
+ $adapterMockForSales->expects($this->once())->method('rollback');
+
+ $this->resourceConnectionMock->expects($this->at(1))
+ ->method('getConnection')
+ ->with('checkout')
+ ->willReturn($adapterMockForCheckout);
+ $adapterMockForCheckout->expects($this->once())->method('beginTransaction');
+ $adapterMockForCheckout->expects($this->once())->method('rollback');
+
$this->billingAddressManagementMock->expects($this->once())
->method('assign')
->with($cartId, $billingAddressMock);
diff --git a/app/code/Magento/Checkout/Test/Unit/Model/GuestShippingInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/GuestShippingInformationManagementTest.php
index bdba1e9246449..6183eedbc1c79 100644
--- a/app/code/Magento/Checkout/Test/Unit/Model/GuestShippingInformationManagementTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Model/GuestShippingInformationManagementTest.php
@@ -1,6 +1,6 @@
shippingAssignmentFactoryMock =
$this->getMock(\Magento\Quote\Model\ShippingAssignmentFactory::class, ['create'], [], '', false);
$this->cartExtensionFactoryMock =
- $this->getMock(\Magento\Quote\Api\Data\CartExtensionInterfaceFactory::class, ['create'], [], '', false);
+ $this->getMock(\Magento\Quote\Api\Data\CartExtensionFactory::class, ['create'], [], '', false);
$this->shippingFactoryMock =
$this->getMock(\Magento\Quote\Model\ShippingFactory::class, ['create'], [], '', false);
diff --git a/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php b/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php
index f9be7d48994d4..bb86367765676 100644
--- a/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Checkout/etc/config.xml b/app/code/Magento/Checkout/etc/config.xml
index dcc63a978e0a3..3c24c38ecf85b 100644
--- a/app/code/Magento/Checkout/etc/config.xml
+++ b/app/code/Magento/Checkout/etc/config.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/di.xml b/app/code/Magento/Checkout/etc/di.xml
index 5e769e4748be1..7650ca4eccdc1 100644
--- a/app/code/Magento/Checkout/etc/di.xml
+++ b/app/code/Magento/Checkout/etc/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/email_templates.xml b/app/code/Magento/Checkout/etc/email_templates.xml
index 2fb2f1ca37992..976a93c50f48a 100644
--- a/app/code/Magento/Checkout/etc/email_templates.xml
+++ b/app/code/Magento/Checkout/etc/email_templates.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/events.xml b/app/code/Magento/Checkout/etc/events.xml
index 8c657c5d8b09e..dd2897f5db6eb 100644
--- a/app/code/Magento/Checkout/etc/events.xml
+++ b/app/code/Magento/Checkout/etc/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/fieldset.xml b/app/code/Magento/Checkout/etc/fieldset.xml
index 44bcdc9367c51..3b545101f023f 100644
--- a/app/code/Magento/Checkout/etc/fieldset.xml
+++ b/app/code/Magento/Checkout/etc/fieldset.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/frontend/di.xml b/app/code/Magento/Checkout/etc/frontend/di.xml
index 40385740a6130..49cd31bd0d92a 100644
--- a/app/code/Magento/Checkout/etc/frontend/di.xml
+++ b/app/code/Magento/Checkout/etc/frontend/di.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/frontend/events.xml b/app/code/Magento/Checkout/etc/frontend/events.xml
index dce51690514b4..901b652201db1 100644
--- a/app/code/Magento/Checkout/etc/frontend/events.xml
+++ b/app/code/Magento/Checkout/etc/frontend/events.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/frontend/page_types.xml b/app/code/Magento/Checkout/etc/frontend/page_types.xml
index 25200529e6d74..bd06cbfb702a3 100644
--- a/app/code/Magento/Checkout/etc/frontend/page_types.xml
+++ b/app/code/Magento/Checkout/etc/frontend/page_types.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/frontend/routes.xml b/app/code/Magento/Checkout/etc/frontend/routes.xml
index 3d50251a2247e..565c2e5ed9ab8 100644
--- a/app/code/Magento/Checkout/etc/frontend/routes.xml
+++ b/app/code/Magento/Checkout/etc/frontend/routes.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/frontend/sections.xml b/app/code/Magento/Checkout/etc/frontend/sections.xml
index b0fd4d9e38a81..35733a6119a25 100644
--- a/app/code/Magento/Checkout/etc/frontend/sections.xml
+++ b/app/code/Magento/Checkout/etc/frontend/sections.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml
index 3357b79479b95..219ca87337fc9 100644
--- a/app/code/Magento/Checkout/etc/module.xml
+++ b/app/code/Magento/Checkout/etc/module.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/etc/webapi.xml b/app/code/Magento/Checkout/etc/webapi.xml
index 8c2c1f3820d4c..26c601a4e9f38 100644
--- a/app/code/Magento/Checkout/etc/webapi.xml
+++ b/app/code/Magento/Checkout/etc/webapi.xml
@@ -1,7 +1,7 @@
@@ -104,7 +104,7 @@
-
+
diff --git a/app/code/Magento/Checkout/registration.php b/app/code/Magento/Checkout/registration.php
index 915fa033ac1cb..00613601741e9 100644
--- a/app/code/Magento/Checkout/registration.php
+++ b/app/code/Magento/Checkout/registration.php
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/Checkout/view/frontend/layout/catalog_category_view.xml
index 4bfe51a17fa48..0f692e8a279c2 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/catalog_category_view.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/catalog_category_view.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Checkout/view/frontend/layout/catalog_product_view.xml
index 4bfe51a17fa48..0f692e8a279c2 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/catalog_product_view.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/catalog_product_view.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml
index 57b32c26a7619..061c0715e52b9 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure_type_simple.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure_type_simple.xml
index b4250c802711b..39e1e1f75e898 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure_type_simple.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure_type_simple.xml
@@ -1,7 +1,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 6e5a8fb0f1017..1b7102856d50d 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
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml
index 69fc24be97757..9268f8a18d174 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml
index 622841071c2c3..e3796b7ff65c2 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml
index b48123cec8bc0..1b9bad3d81c65 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml
index 169d29099f81d..eca071a677082 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml
index c2f8eeda0431e..0b5147eb45d29 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml
index 39cb66575990f..43c2962d5569f 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml
index 6a5b33ce6cec2..1766647270e32 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml
index f3a4dfb080e62..8f262a718052e 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_success.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_success.xml
index b0af16ef1454a..542355cead4e4 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_success.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_success.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/layout/default.xml b/app/code/Magento/Checkout/view/frontend/layout/default.xml
index fe26adbe3c7cf..26942e5d611fa 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/default.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/default.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/page_layout/checkout.xml b/app/code/Magento/Checkout/view/frontend/page_layout/checkout.xml
index 8b3b73a639429..87a8c7a151d99 100644
--- a/app/code/Magento/Checkout/view/frontend/page_layout/checkout.xml
+++ b/app/code/Magento/Checkout/view/frontend/page_layout/checkout.xml
@@ -1,7 +1,7 @@
diff --git a/app/code/Magento/Checkout/view/frontend/requirejs-config.js b/app/code/Magento/Checkout/view/frontend/requirejs-config.js
index 68e95b48e8d05..1f552b779539c 100644
--- a/app/code/Magento/Checkout/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Checkout/view/frontend/requirejs-config.js
@@ -1,5 +1,5 @@
/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
diff --git a/app/code/Magento/Checkout/view/frontend/templates/button.phtml b/app/code/Magento/Checkout/view/frontend/templates/button.phtml
index ae8d8e95076f4..77147395a7791 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/button.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/button.phtml
@@ -1,6 +1,6 @@
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml
index 44f8d1a3889f8..cb92e62f1f0c8 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml
@@ -1,6 +1,6 @@
+ class="input-text qty" data-validate="= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"/>
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 0087d6abd421d..9e44f8f4b48aa 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
@@ -1,6 +1,6 @@
isShowBeforeOrderConfirm($product) && $helper->isMinima