Skip to content

Commit

Permalink
Merge remote-tracking branch 'main-ce/develop' into MAGETWO-54731
Browse files Browse the repository at this point in the history
  • Loading branch information
magicbunneh committed Jul 4, 2016
2 parents 1d93779 + 6af1543 commit 7336d15
Show file tree
Hide file tree
Showing 43 changed files with 404 additions and 111 deletions.
6 changes: 4 additions & 2 deletions app/code/Magento/Bundle/Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
/** @var \Magento\Eav\Setup\EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

$eavSetup->addAttributeGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Bundle Items', 16);
$attributeSetId = $eavSetup->getDefaultAttributeSetId(ProductAttributeInterface::ENTITY_TYPE_CODE);
$eavSetup->addAttributeGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, $attributeSetId, 'Bundle Items', 16);

$this->upgradePriceType($eavSetup);
$this->upgradeSkuType($eavSetup);
Expand Down Expand Up @@ -133,9 +134,10 @@ private function upgradeWeightType(EavSetup $eavSetup)
*/
private function upgradeShipmentType(EavSetup $eavSetup)
{
$attributeSetId = $eavSetup->getDefaultAttributeSetId(ProductAttributeInterface::ENTITY_TYPE_CODE);
$eavSetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Bundle Items',
'shipment_type',
1
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Bundle/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<type name="Magento\Quote\Model\Quote\Item\Repository">
<arguments>
<argument name="cartItemProcessors" xsi:type="array">
<item name="bundle" xsi:type="object">\Magento\Bundle\Model\CartItemProcessor</item>
<item name="bundle" xsi:type="object">\Magento\Bundle\Model\CartItemProcessor\Proxy</item>
</argument>
</arguments>
</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ protected function updateOptionsValues(array &$options)
$option->setOptionId($optionId);
if (is_array($optionValue)) {
$optionValue = $this->processFileOptionValue($optionValue);
$optionValue = $this->processDateOptionValue($optionValue);
$optionValue = implode(',', $optionValue);
}
$option->setOptionValue($optionValue);
Expand Down Expand Up @@ -147,6 +148,24 @@ private function processFileOptionValue(array $optionValue)
return $optionValue;
}

/**
* Returns date option value only with 'date_internal data
*
* @param array $optionValue
* @return array
*/
private function processDateOptionValue(array $optionValue)
{
if (array_key_exists('date_internal', $optionValue)
) {
$closure = function ($key) {
return $key === 'date_internal';
};
$optionValue = array_filter($optionValue, $closure, ARRAY_FILTER_USE_KEY);
}
return $optionValue;
}

/**
* @return \Magento\Catalog\Model\Product\Option\UrlBuilder
*
Expand Down
33 changes: 17 additions & 16 deletions app/code/Magento/Catalog/Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,30 +167,31 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
'frontend_label',
'Product Name'
);
$attributeSetId = $categorySetup->getDefaultAttributeSetId(ProductAttributeInterface::ENTITY_TYPE_CODE);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Product Details',
'visibility',
80
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Product Details',
'news_from_date',
90
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Product Details',
'news_to_date',
100
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Product Details',
'country_of_manufacture',
110
Expand All @@ -199,26 +200,26 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
//Content tab
$categorySetup->addAttributeGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Content',
15
);
$categorySetup->updateAttributeGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Content',
'tab_group_code',
'basic'
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Content',
'description'
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Content',
'short_description',
100
Expand All @@ -227,20 +228,20 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
//Images tab
$groupId = (int)$categorySetup->getAttributeGroupByCode(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'image-management',
'attribute_group_id'
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
$groupId,
'image',
1
);
$categorySetup->updateAttributeGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
$groupId,
'attribute_group_name',
'Images'
Expand Down Expand Up @@ -282,27 +283,27 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
//Schedule Design Update tab
$categorySetup->addAttributeGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Schedule Design Update',
55
);
$categorySetup->updateAttributeGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Schedule Design Update',
'tab_group_code',
'advanced'
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Schedule Design Update',
'custom_design_from',
20
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Schedule Design Update',
'custom_design_to',
30
Expand All @@ -316,7 +317,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
);
$categorySetup->addAttributeToGroup(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'Default',
$attributeSetId,
'Schedule Design Update',
'custom_design'
);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@
<type name="Magento\Quote\Model\Quote\Item\Repository">
<arguments>
<argument name="cartItemProcessors" xsi:type="array">
<item name="custom_options" xsi:type="object">Magento\Catalog\Model\CustomOptions\CustomOptionProcessor</item>
<item name="custom_options" xsi:type="object">Magento\Catalog\Model\CustomOptions\CustomOptionProcessor\Proxy</item>
</argument>
</arguments>
</type>
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Checkout/Block/Cart/Sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public function getConfig()
'removeItemUrl' => $this->getRemoveItemUrl(),
'imageTemplate' => $this->getImageHtmlTemplate(),
'baseUrl' => $this->getBaseUrl(),
'minicartMaxItemsVisible' => $this->getMiniCartMaxItemsCount()
'minicartMaxItemsVisible' => $this->getMiniCartMaxItemsCount(),
'websiteId' => $this->_storeManager->getStore()->getWebsiteId()
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ protected function getMultilineFieldConfig($attributeCode, array $attributeConfi
$attributeConfig['validation']
)
: $attributeConfig['validation'],
'additionalClasses' => $isFirstLine ? : 'additional'
'additionalClasses' => $isFirstLine ? 'field' : 'additional'

];
if ($isFirstLine && isset($attributeConfig['default']) && $attributeConfig['default'] != null) {
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Checkout/CustomerData/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function getSectionData()
'items' => $this->getRecentItems(),
'extra_actions' => $this->layout->createBlock('Magento\Catalog\Block\ShortcutButtons')->toHtml(),
'isGuestCheckoutAllowed' => $this->isGuestCheckoutAllowed(),
'website_id' => $this->getQuote()->getStore()->getWebsiteId()
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public function testGetTotalsHtml()

public function testGetConfig()
{
$websiteId = 100;
$storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false);

$shoppingCartUrl = 'http://url.com/cart';
Expand All @@ -139,7 +140,8 @@ public function testGetConfig()
'removeItemUrl' => $removeItemUrl,
'imageTemplate' => $imageTemplate,
'baseUrl' => $baseUrl,
'minicartMaxItemsVisible' => 3
'minicartMaxItemsVisible' => 3,
'websiteId' => 100
];

$valueMap = [
Expand All @@ -156,7 +158,7 @@ public function testGetConfig()
$this->urlBuilderMock->expects($this->exactly(4))
->method('getUrl')
->willReturnMap($valueMap);
$this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock);
$this->storeManagerMock->expects($this->exactly(2))->method('getStore')->willReturn($storeMock);
$storeMock->expects($this->once())->method('getBaseUrl')->willReturn($baseUrl);
$this->imageHelper->expects($this->once())->method('getFrame')->willReturn(false);

Expand All @@ -166,6 +168,8 @@ public function testGetConfig()
\Magento\Checkout\Block\Cart\Sidebar::XML_PATH_CHECKOUT_SIDEBAR_COUNT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)->willReturn(3);

$storeMock->expects($this->once())->method('getWebsiteId')->willReturn($websiteId);

$this->assertEquals($expectedResult, $this->model->getConfig());
}
Expand Down
20 changes: 16 additions & 4 deletions app/code/Magento/Checkout/Test/Unit/CustomerData/CartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ public function testGetSectionData()
$productRewrite = [$productId => ['rewrite' => 'product']];
$itemData = ['item' => 'data'];
$shortcutButtonsHtml = '<span>Buttons</span>';
$websiteId = 100;

$subtotalMock = $this->getMock('\Magento\Framework\DataObject', ['getValue'], [], '', false);
$subtotalMock->expects($this->once())->method('getValue')->willReturn($subtotalValue);
$totals = ['subtotal' => $subtotalMock];

$quoteMock = $this->getMock(
'\Magento\Quote\Model\Quote',
['getTotals', 'getHasError', 'getAllVisibleItems'],
['getTotals', 'getHasError', 'getAllVisibleItems', 'getStore'],
[],
'',
false
Expand All @@ -119,6 +120,10 @@ public function testGetSectionData()
$quoteItemMock = $this->getMock('\Magento\Quote\Model\Quote\Item', ['getProduct', 'getStoreId'], [], '', false);
$quoteMock->expects($this->once())->method('getAllVisibleItems')->willReturn([$quoteItemMock]);

$storeMock = $this->getMock(\Magento\Store\Model\System\Store::class, ['getWebsiteId'], [], '', false);
$storeMock->expects($this->once())->method('getWebsiteId')->willReturn($websiteId);
$quoteMock->expects($this->once())->method('getStore')->willReturn($storeMock);

$productMock = $this->getMock(
'\Magento\Catalog\Model\Product',
['isVisibleInSiteVisibility', 'getId', 'setUrlDataObject'],
Expand Down Expand Up @@ -166,7 +171,8 @@ public function testGetSectionData()
['item' => 'data']
],
'extra_actions' => '<span>Buttons</span>',
'isGuestCheckoutAllowed' => 1
'isGuestCheckoutAllowed' => 1,
'website_id' => $websiteId
];
$this->assertEquals($expectedResult, $this->model->getSectionData());
}
Expand All @@ -180,6 +186,7 @@ public function testGetSectionDataWithCompositeProduct()
$subtotalValue = 200;
$productId = 10;
$storeId = 20;
$websiteId = 100;

$productRewrite = [$productId => ['rewrite' => 'product']];
$itemData = ['item' => 'data'];
Expand All @@ -190,7 +197,7 @@ public function testGetSectionDataWithCompositeProduct()

$quoteMock = $this->getMock(
'\Magento\Quote\Model\Quote',
['getTotals', 'getHasError', 'getAllVisibleItems'],
['getTotals', 'getHasError', 'getAllVisibleItems', 'getStore'],
[],
'',
false
Expand All @@ -207,6 +214,10 @@ public function testGetSectionDataWithCompositeProduct()
$quoteMock->expects($this->once())->method('getTotals')->willReturn($totals);
$quoteMock->expects($this->once())->method('getHasError')->willReturn(false);

$storeMock = $this->getMock(\Magento\Store\Model\System\Store::class, ['getWebsiteId'], [], '', false);
$storeMock->expects($this->once())->method('getWebsiteId')->willReturn($websiteId);
$quoteMock->expects($this->once())->method('getStore')->willReturn($storeMock);

$this->checkoutCartMock->expects($this->once())->method('getSummaryQty')->willReturn($summaryQty);
$this->checkoutHelperMock->expects($this->once())
->method('formatPrice')
Expand Down Expand Up @@ -271,7 +282,8 @@ public function testGetSectionDataWithCompositeProduct()
['item' => 'data']
],
'extra_actions' => '<span>Buttons</span>',
'isGuestCheckoutAllowed' => 1
'isGuestCheckoutAllowed' => 1,
'website_id' => $websiteId
];
$this->assertEquals($expectedResult, $this->model->getSectionData());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
</action>
</referenceBlock>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Onepage\Success" name="checkout.success" template="success.phtml" cacheable="false"/>
<block class="Magento\Checkout\Block\Onepage\Success" name="checkout.success" template="success.phtml" cacheable="false">
<container name="order.success.additional.info" label="Order Success Additional Info"/>
</block>
<block class="Magento\Checkout\Block\Registration" name="checkout.registration" template="registration.phtml" cacheable="false"/>
</referenceContainer>
<container name="order.success.additional.info" label="Order Success Additional Info"/>
</body>
</page>
3 changes: 2 additions & 1 deletion app/code/Magento/Checkout/view/frontend/web/js/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ define([
target = $(this.options.minicart.list),
outerHeight;

self.scrollHeight = 0;
target.children().each(function () {

if ($(this).find('.options').length > 0) {
Expand All @@ -259,7 +260,7 @@ define([
self.scrollHeight += outerHeight;
});

target.height(height);
target.parent().height(height);
}
});

Expand Down
11 changes: 11 additions & 0 deletions app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,22 @@ define([
self.isLoading(true);
});

if (cartData().websiteId !== window.checkout.websiteId) {
customerData.reload(['cart'], false);
}

return this._super();
},
isLoading: ko.observable(false),
initSidebar: initSidebar,

/**
* Close mini shopping cart.
*/
closeMinicart: function () {
$('[data-block="minicart"]').find('[data-role="dropdownDialog"]').dropdownDialog('close');
},

/**
* @return {Boolean}
*/
Expand Down
Loading

0 comments on commit 7336d15

Please sign in to comment.