Skip to content

Commit 69d490a

Browse files
committed
Merge remote-tracking branch 'nord/MAGETWO-50761' into pr-495
2 parents 6fa3f94 + 7fae40a commit 69d490a

File tree

4 files changed

+72
-4
lines changed

4 files changed

+72
-4
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@
7777
<?php
7878
$values = [];
7979
foreach($block->getOptionValues() as $value) {
80-
array_push($values, $value->getData());
80+
$value = $value->getData();
81+
$values[] = is_array($value) ? array_map("htmlspecialchars_decode", $value) : $value;
8182
}
8283
?>
8384
<script type="text/x-magento-init">
8485
{
8586
"*": {
8687
"Magento_Catalog/js/options": {
87-
"attributesData": <?php /* @escapeNotVerified */ echo json_encode($values); ?>,
88+
"attributesData": <?php /* @noEscape */ echo json_encode($values, JSON_HEX_QUOT); ?>,
8889
"isSortable": <?php echo (int)(!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) ?>,
8990
"isReadOnly": <?php echo (int)$block->getReadOnly(); ?>
9091
}

app/code/Magento/Catalog/view/base/web/js/price-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ define([
1818
optionsSelector: '.product-custom-option',
1919
optionConfig: {},
2020
optionHandlers: {},
21-
optionTemplate: '<%- data.label %>' +
21+
optionTemplate: '<%= data.label %>' +
2222
'<% if (data.finalPrice.value) { %>' +
2323
' +<%- data.finalPrice.formatted %>' +
2424
'<% } %>',

app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f
196196
)->columns(['qty' => new \Zend_Db_Expr('SUM(' . $qtyExpr . ')')])
197197
->where('cw.website_id != 0')
198198
->where('e.type_id = ?', $this->getTypeId())
199-
->group('e.entity_id');
199+
->group(['e.entity_id', 'cw.website_id']);
200200

201201
// add limitation of status
202202
$condition = $connection->quoteInto(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock;
8+
9+
/**
10+
* Class DefaultStockTest
11+
* @magentoAppArea adminhtml
12+
*/
13+
class DefaultStockTest extends \PHPUnit_Framework_TestCase
14+
{
15+
/**
16+
* @var \Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\DefaultStock
17+
*/
18+
private $indexer;
19+
20+
protected function setUp()
21+
{
22+
$this->indexer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
23+
\Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\DefaultStock::class
24+
);
25+
26+
}
27+
28+
/**
29+
* @magentoDataFixture Magento/Store/_files/website.php
30+
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
31+
*
32+
* @throws \Magento\Framework\Exception\NoSuchEntityException
33+
*/
34+
public function testReindexEntity()
35+
{
36+
/** @var \Magento\Catalog\Model\ProductRepository $productRepository */
37+
$productRepository = $this->getObject(\Magento\Catalog\Model\ProductRepository::class);
38+
/** @var \Magento\Store\Api\WebsiteRepositoryInterface $websiteRepository */
39+
$websiteRepository = $this->getObject(
40+
\Magento\Store\Api\WebsiteRepositoryInterface::class
41+
);
42+
$product = $productRepository->get('simple');
43+
$testWebsite = $websiteRepository->get('test');
44+
$product->setWebsiteIds([1, $testWebsite->getId()])->save();
45+
46+
/** @var \Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory $criteriaFactory */
47+
$criteriaFactory = $this->getObject(
48+
\Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory::class
49+
);
50+
/** @var \Magento\CatalogInventory\Api\StockStatusRepositoryInterface $stockStatusRepository */
51+
$stockStatusRepository = $this->getObject(
52+
\Magento\CatalogInventory\Api\StockStatusRepositoryInterface::class
53+
);
54+
$criteria = $criteriaFactory->create();
55+
$criteria->setProductsFilter([$product->getId()]);
56+
$criteria->addFilter('website', 'website_id', $testWebsite->getId());
57+
$items = $stockStatusRepository->getList($criteria)->getItems();
58+
$this->assertEquals($product->getId(), $items[$product->getId()]->getProductId());
59+
}
60+
61+
private function getObject($class)
62+
{
63+
return \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
64+
$class
65+
);
66+
}
67+
}

0 commit comments

Comments
 (0)