diff --git a/app/code/Magento/Catalog/Block/Product/AwareInterface.php b/app/code/Magento/Catalog/Block/Product/AwareInterface.php
new file mode 100644
index 0000000000000..de9564075531c
--- /dev/null
+++ b/app/code/Magento/Catalog/Block/Product/AwareInterface.php
@@ -0,0 +1,20 @@
+_compareProduct;
+ }
+}
diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Item/Block.php b/app/code/Magento/Catalog/Block/Product/ProductList/Item/Block.php
new file mode 100644
index 0000000000000..c2fdd87aa6ade
--- /dev/null
+++ b/app/code/Magento/Catalog/Block/Product/ProductList/Item/Block.php
@@ -0,0 +1,38 @@
+product = $product;
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getProduct()
+ {
+ return $this->product;
+ }
+}
diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Item/Container.php b/app/code/Magento/Catalog/Block/Product/ProductList/Item/Container.php
new file mode 100644
index 0000000000000..003e1f05ccb59
--- /dev/null
+++ b/app/code/Magento/Catalog/Block/Product/ProductList/Item/Container.php
@@ -0,0 +1,31 @@
+getLayout();
+ if ($layout) {
+ $name = $this->getNameInLayout();
+ foreach ($layout->getChildBlocks($name) as $child) {
+ if ($child instanceof ProductAwareInterface) {
+ $child->setProduct($this->getProduct());
+ }
+ }
+ }
+ return parent::getChildHtml($alias, $useCache);
+ }
+}
diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php
index 419e4968dce6b..20af7d137729a 100644
--- a/app/code/Magento/Catalog/Block/Product/View.php
+++ b/app/code/Magento/Catalog/Block/Product/View.php
@@ -110,6 +110,7 @@ public function __construct(
* Return wishlist widget options
*
* @return array
+ * @deprecated
*/
public function getWishlistOptions()
{
diff --git a/app/code/Magento/Catalog/Block/Product/View/AddTo/Compare.php b/app/code/Magento/Catalog/Block/Product/View/AddTo/Compare.php
new file mode 100644
index 0000000000000..40638734035bc
--- /dev/null
+++ b/app/code/Magento/Catalog/Block/Product/View/AddTo/Compare.php
@@ -0,0 +1,24 @@
+getProduct();
+ return $this->_compareProduct->getPostDataParams($product);
+ }
+}
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 8a9870bcf7ed0..4c8ae8eaae952 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
@@ -21,6 +21,11 @@
+
+
+
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 dd23502c49c86..f7f1ee4ae54b7 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
@@ -82,7 +82,10 @@
-
+
+
+
@@ -129,11 +132,21 @@
related
+
+
+
upsell
+
+
+
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 324bc105adc72..dea0f99387dd1 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml
@@ -97,28 +97,9 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
>
- helper('Magento\Wishlist\Helper\Data')->isAllow()): ?>
-
-
-
+ getChildBlock('addto')): ?>
+ setProduct($_product)->getChildHtml(); ?>
- helper('Magento\Catalog\Helper\Product\Compare');
- ?>
-
-
-
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
new file mode 100644
index 0000000000000..5cd2eb6922b12
--- /dev/null
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml
index ab5702770354b..0b013839fdc9c 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml
@@ -24,8 +24,7 @@ switch ($type = $block->getType()) {
$shuffle = (int) $block->isShuffled();
$canItemsAddToCart = $block->canItemsAddToCart();
- $showWishlist = true;
- $showCompare = true;
+ $showAddTo = true;
$showCart = false;
$templateType = null;
$description = false;
@@ -45,8 +44,7 @@ switch ($type = $block->getType()) {
$shuffle = 0;
$canItemsAddToCart = $block->canItemsAddToCart();
- $showWishlist = true;
- $showCompare = true;
+ $showAddTo = true;
$showCart = false;
$templateType = null;
$description = false;
@@ -64,8 +62,7 @@ switch ($type = $block->getType()) {
$limit = $block->getPositionLimit();
$shuffle = (int) $block->isShuffled();
- $showWishlist = false;
- $showCompare = false;
+ $showAddTo = false;
$showCart = false;
$templateType = null;
$description = false;
@@ -85,8 +82,7 @@ switch ($type = $block->getType()) {
$limit = $block->getItemLimit('upsell');
$shuffle = 0;
- $showWishlist = false;
- $showCompare = false;
+ $showAddTo = false;
$showCart = false;
$templateType = null;
$description = false;
@@ -104,8 +100,7 @@ switch ($type = $block->getType()) {
$title = __('More Choices:');
$items = $block->getItemCollection();
- $showWishlist = true;
- $showCompare = true;
+ $showAddTo = true;
$showCart = true;
$templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
$description = false;
@@ -123,8 +118,7 @@ switch ($type = $block->getType()) {
$title = __('More Choices:');
$items = $block->getItems();
- $showWishlist = true;
- $showCompare = true;
+ $showAddTo = true;
$showCart = true;
$templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
$description = false;
@@ -144,8 +138,7 @@ switch ($type = $block->getType()) {
$title = __('New Products');
$items = $exist;
- $showWishlist = true;
- $showCompare = true;
+ $showAddTo = true;
$showCart = true;
$templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
$description = ($mode == 'list') ? true : false;
@@ -219,7 +212,7 @@ switch ($type = $block->getType()) {
-
+
@@ -248,23 +241,10 @@ switch ($type = $block->getType()) {
-
+
- helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?>
-
-
-
-
- getAddToCompareUrl() && $showCompare): ?>
- helper('Magento\Catalog\Helper\Product\Compare');
- ?>
-
-
-
+ getChildBlock('addto')): ?>
+ setProduct($_item)->getChildHtml(); ?>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml
index f6f7928007688..2fc3c9dc78f73 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml
@@ -8,27 +8,6 @@
/** @var $block \Magento\Catalog\Block\Product\View*/
?>
-getProduct();
-$_wishlistSubmitParams = $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product);
-$compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');
-?>
-
- helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?>
-
-
-
+ getChildHtml(); ?>
-
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml
new file mode 100644
index 0000000000000..3b6da83b34456
--- /dev/null
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml
@@ -0,0 +1,14 @@
+
+
+
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 27978a374f351..09e583f2f106b 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
@@ -25,6 +25,11 @@
+
+
+
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 cb0587085bb10..7f8e28626e5a7 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
@@ -26,6 +26,11 @@
+
+
+
diff --git a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php
index 023061cc90bf1..237d28e2845e4 100644
--- a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php
+++ b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php
@@ -134,6 +134,10 @@ public function saveAddressInformation(
$carrierCode = $addressInformation->getShippingCarrierCode();
$methodCode = $addressInformation->getShippingMethodCode();
+ if (!$address->getCustomerAddressId()) {
+ $address->setCustomerAddressId(null);
+ }
+
if (!$address->getCountryId()) {
throw new StateException(__('Shipping address is not set'));
}
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 8e5392d5c6a24..3676e2f45cba3 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
@@ -190,6 +190,11 @@
crosssell
+
+
+
diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
index 26006bfa8dfc8..601c4bad9c74c 100644
--- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
+++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
@@ -41,6 +41,7 @@ protected function _extractCustomerData()
CustomerInterface::DEFAULT_SHIPPING,
'confirmation',
'sendemail_store_id',
+ 'extension_attributes',
];
$customerData = $this->_extractData(
@@ -108,6 +109,10 @@ protected function _extractData(
}
}
+ if (empty($filteredData['extension_attributes'])) {
+ unset($filteredData['extension_attributes']);
+ }
+
return $filteredData;
}
diff --git a/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php b/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php
index 6c19f945df5c8..fb2b2d13c9c50 100644
--- a/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php
+++ b/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php
@@ -119,6 +119,7 @@ public function save(\Magento\Customer\Api\Data\AddressInterface $address)
throw $inputException;
}
$addressModel->save();
+ $address->setId($addressModel->getId());
// Clean up the customer registry since the Address save has a
// side effect on customer : \Magento\Customer\Model\ResourceModel\Address::_afterSave
$this->customerRegistry->remove($address->getCustomerId());
diff --git a/app/code/Magento/Customer/etc/frontend/di.xml b/app/code/Magento/Customer/etc/frontend/di.xml
index 91c6531a21e4f..389d0eea246ea 100644
--- a/app/code/Magento/Customer/etc/frontend/di.xml
+++ b/app/code/Magento/Customer/etc/frontend/di.xml
@@ -60,4 +60,14 @@
+
+
+
+ -
+
- Magento\Customer\Model\Authorization\CustomerSessionUserContext
+ - 10
+
+
+
+
diff --git a/app/code/Magento/Quote/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php
index ddaf1e5f96dc3..b97e15e5e5344 100644
--- a/app/code/Magento/Quote/Model/Quote.php
+++ b/app/code/Magento/Quote/Model/Quote.php
@@ -1024,6 +1024,7 @@ public function addCustomerAddress(\Magento\Customer\Api\Data\AddressInterface $
$addresses = (array)$this->getCustomer()->getAddresses();
$addresses[] = $address;
$this->getCustomer()->setAddresses($addresses);
+ $this->updateCustomerData($this->customerRepository->save($this->getCustomer()));
return $this;
}
diff --git a/app/code/Magento/Quote/Model/QuoteManagement.php b/app/code/Magento/Quote/Model/QuoteManagement.php
index 2325ccaad612a..0cf55f0e89675 100644
--- a/app/code/Magento/Quote/Model/QuoteManagement.php
+++ b/app/code/Magento/Quote/Model/QuoteManagement.php
@@ -536,6 +536,7 @@ protected function _prepareCustomerQuote($quote)
}
$quote->addCustomerAddress($shippingAddress);
$shipping->setCustomerAddressData($shippingAddress);
+ $shipping->setCustomerAddressId($shippingAddress->getId());
}
if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
@@ -550,6 +551,7 @@ protected function _prepareCustomerQuote($quote)
}
$quote->addCustomerAddress($billingAddress);
$billing->setCustomerAddressData($billingAddress);
+ $billing->setCustomerAddressId($billingAddress->getId());
}
if ($shipping && !$shipping->getCustomerId() && !$hasDefaultBilling) {
$shipping->setIsDefaultBilling(true);
diff --git a/app/code/Magento/Quote/Model/ResourceModel/Quote.php b/app/code/Magento/Quote/Model/ResourceModel/Quote.php
index 66f506033b670..241f0d6b272fc 100644
--- a/app/code/Magento/Quote/Model/ResourceModel/Quote.php
+++ b/app/code/Magento/Quote/Model/ResourceModel/Quote.php
@@ -64,7 +64,9 @@ protected function _getLoadSelect($field, $value, $object)
$select = parent::_getLoadSelect($field, $value, $object);
$storeIds = $object->getSharedStoreIds();
if ($storeIds) {
- $select->where('store_id IN (?)', $storeIds);
+ if ($storeIds != ['*']) {
+ $select->where('store_id IN (?)', $storeIds);
+ }
} else {
/**
* For empty result
diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php
index 7da2feffe464e..adaa950330cc0 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php
@@ -137,6 +137,11 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
*/
private $extensionAttributesJoinProcessorMock;
+ /**
+ * @var \Magento\Customer\Api\Data\CustomerInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $customerDataFactoryMock;
+
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
@@ -180,7 +185,7 @@ protected function setUp()
false,
true,
true,
- ['getById']
+ ['getById', 'save']
);
$this->objectCopyServiceMock = $this->getMock(
'Magento\Framework\DataObject\Copy',
@@ -273,7 +278,13 @@ protected function setUp()
'',
false
);
-
+ $this->customerDataFactoryMock = $this->getMock(
+ 'Magento\Customer\Api\Data\CustomerInterfaceFactory',
+ ['create'],
+ [],
+ '',
+ false
+ );
$this->quote = (new ObjectManager($this))
->getObject(
'Magento\Quote\Model\Quote',
@@ -295,7 +306,8 @@ protected function setUp()
'extensibleDataObjectConverter' => $this->extensibleDataObjectConverterMock,
'customerRepository' => $this->customerRepositoryMock,
'objectCopyService' => $this->objectCopyServiceMock,
- 'extensionAttributesJoinProcessor' => $this->extensionAttributesJoinProcessorMock
+ 'extensionAttributesJoinProcessor' => $this->extensionAttributesJoinProcessorMock,
+ 'customerDataFactory' => $this->customerDataFactoryMock
]
);
}
@@ -549,13 +561,30 @@ public function testSetCustomerAddressData()
'',
false
);
- $this->customerRepositoryMock->expects($this->once())
+ $requestMock = $this->getMock(
+ '\Magento\Framework\DataObject'
+ );
+
+ $this->extensibleDataObjectConverterMock->expects($this->any())
+ ->method('toFlatArray')
+ ->will($this->returnValue(['customer_id' => $customerId]));
+
+ $this->customerRepositoryMock->expects($this->any())
->method('getById')
->will($this->returnValue($customerMock));
- $customerMock->expects($this->once())
+ $this->customerDataFactoryMock->expects($this->any())
+ ->method('create')
+ ->will($this->returnValue($customerMock));
+ $this->customerRepositoryMock->expects($this->once())
+ ->method('save')
+ ->will($this->returnValue($customerMock));
+ $customerMock->expects($this->any())
->method('getAddresses')
->will($this->returnValue($addresses));
-
+ $this->objectFactoryMock->expects($this->once())
+ ->method('create')
+ ->with($this->equalTo(['customer_id' => $customerId]))
+ ->will($this->returnValue($requestMock));
$result = $this->quote->setCustomerAddressData([$addressMock]);
$this->assertInstanceOf('Magento\Quote\Model\Quote', $result);
$this->assertEquals($customerResultMock, $this->quote->getCustomer());
diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php
index b47be0f5bd8fb..a125bb2da1716 100644
--- a/app/code/Magento/Sales/Model/AdminOrder/Create.php
+++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php
@@ -1739,9 +1739,13 @@ public function _prepareCustomer()
if ($this->getBillingAddress()->getSaveInAddressBook()) {
$this->_prepareCustomerAddress($this->getQuote()->getCustomer(), $this->getBillingAddress());
+ $address = $this->getBillingAddress()->setCustomerId($this->getQuote()->getCustomer()->getId());
+ $this->setBillingAddress($address);
}
if (!$this->getQuote()->isVirtual() && $this->getShippingAddress()->getSaveInAddressBook()) {
$this->_prepareCustomerAddress($this->getQuote()->getCustomer(), $this->getShippingAddress());
+ $address = $this->getShippingAddress()->setCustomerId($this->getQuote()->getCustomer()->getId());
+ $this->setShippingAddress($address);
}
$this->getQuote()->updateCustomerData($this->getQuote()->getCustomer());
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml
index 63410d6b45d28..9652061d14278 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml
@@ -64,6 +64,7 @@ $orderStoreDate = $block->formatDate(
|
getStatusLabel() ?> |
+ getChildHtml(); ?>
isSingleStoreMode() == false):?>
|
diff --git a/app/code/Magento/Theme/Block/Html/Footer.php b/app/code/Magento/Theme/Block/Html/Footer.php
index d0b840bb26fc1..61f80f95c8d52 100644
--- a/app/code/Magento/Theme/Block/Html/Footer.php
+++ b/app/code/Magento/Theme/Block/Html/Footer.php
@@ -73,6 +73,8 @@ public function getCacheKeyInfo()
(int)$this->_storeManager->getStore()->isCurrentlySecure(),
$this->_design->getDesignTheme()->getId(),
$this->httpContext->getValue(Context::CONTEXT_AUTH),
+ $this->getTemplateFile(),
+ 'template' => $this->getTemplate()
];
}
diff --git a/app/code/Magento/Wishlist/Block/Catalog/Product/ProductList/Item/AddTo/Wishlist.php b/app/code/Magento/Wishlist/Block/Catalog/Product/ProductList/Item/AddTo/Wishlist.php
new file mode 100644
index 0000000000000..b9f6e0038f2d2
--- /dev/null
+++ b/app/code/Magento/Wishlist/Block/Catalog/Product/ProductList/Item/AddTo/Wishlist.php
@@ -0,0 +1,20 @@
+_wishlistHelper;
+ }
+}
diff --git a/app/code/Magento/Wishlist/Block/Catalog/Product/View/AddTo/Wishlist.php b/app/code/Magento/Wishlist/Block/Catalog/Product/View/AddTo/Wishlist.php
new file mode 100644
index 0000000000000..6f2cb307c1aef
--- /dev/null
+++ b/app/code/Magento/Wishlist/Block/Catalog/Product/View/AddTo/Wishlist.php
@@ -0,0 +1,54 @@
+_jsonEncoder->encode($this->getWishlistOptions());
+ }
+
+ /**
+ * Return wishlist widget options
+ *
+ * @return array
+ */
+ public function getWishlistOptions()
+ {
+ return ['productType' => $this->getProduct()->getTypeId()];
+ }
+
+ /**
+ * Return wishlist params
+ *
+ * @return string
+ */
+ public function getWishlistParams()
+ {
+ $product = $this->getProduct();
+ return $this->_wishlistHelper->getAddParams($product);
+ }
+
+ /**
+ * Check whether the wishlist is allowed
+ *
+ * @return string
+ */
+ public function isWishListAllowed()
+ {
+ return $this->_wishlistHelper->isAllow();
+ }
+}
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/Wishlist/view/frontend/layout/catalog_category_view.xml
index 21844038d444a..dd9fb74924115 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/catalog_category_view.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/catalog_category_view.xml
@@ -15,6 +15,11 @@
+
+
+
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml
index 1e4f27875c6bd..4c01d341bb682 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml
@@ -15,6 +15,22 @@
+
+
+
+
+
+
+
+
+
+
+