Skip to content

Commit bac009a

Browse files
committed
Merge pull request #624 from magento-fearless-kiwis/develop
[FearlessKiwis] Bug fixes
2 parents a5be15b + 3b770f7 commit bac009a

File tree

11 files changed

+133
-23
lines changed

11 files changed

+133
-23
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/Source.php

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ protected function _prepareIndex($entityIds = null, $attributeId = null)
103103
* @param array $entityIds the entity ids limitation
104104
* @param int $attributeId the attribute id limitation
105105
* @return $this
106+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
106107
*/
107108
protected function _prepareSelectIndex($entityIds = null, $attributeId = null)
108109
{
@@ -125,31 +126,37 @@ protected function _prepareSelectIndex($entityIds = null, $attributeId = null)
125126
['s' => $this->getTable('store')],
126127
['store_id', 'website_id']
127128
)->joinLeft(
128-
['d' => $this->getTable('catalog_product_entity_int')],
129-
'd.store_id = 0 OR d.store_id = s.store_id',
130-
['attribute_id', 'value']
129+
['dd' => $this->getTable('catalog_product_entity_int')],
130+
'dd.store_id = 0',
131+
['attribute_id']
131132
)->joinLeft(
132-
['d2' => $this->getTable('catalog_product_entity_int')],
133+
['ds' => $this->getTable('catalog_product_entity_int')],
134+
"ds.store_id = s.store_id AND ds.attribute_id = dd.attribute_id AND " .
135+
"ds.{$productIdField} = dd.{$productIdField}",
136+
['value' => new \Zend_Db_Expr('COALESCE(ds.value, dd.value)')]
137+
)->joinLeft(
138+
['d2d' => $this->getTable('catalog_product_entity_int')],
133139
sprintf(
134-
"d.{$productIdField} = d2.{$productIdField}"
135-
. ' AND d2.attribute_id = %s AND d2.value = %s AND d.store_id = d2.store_id',
136-
$this->_eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'status')->getId(),
137-
ProductStatus::STATUS_ENABLED
140+
"d2d.store_id = 0 AND d2d.{$productIdField} = dd.{$productIdField} AND d2d.attribute_id = %s",
141+
$this->_eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'status')->getId()
138142
),
139143
[]
144+
)->joinLeft(
145+
['d2s' => $this->getTable('catalog_product_entity_int')],
146+
"d2s.store_id = s.store_id AND d2s.attribute_id = d2d.attribute_id AND " .
147+
"d2s.{$productIdField} = d2d.{$productIdField}",
148+
[]
140149
)->joinLeft(
141150
['cpe' => $this->getTable('catalog_product_entity')],
142-
"cpe.{$productIdField} = d.{$productIdField}",
151+
"cpe.{$productIdField} = dd.{$productIdField}",
143152
array_unique([$productIdField, 'entity_id'])
144153
)->where(
145154
's.store_id != 0'
146155
)->where(
147-
'd.value IS NOT NULL'
156+
'(ds.value IS NOT NULL OR dd.value IS NOT NULL)'
148157
)->where(
149-
'd2.value IS NOT NULL'
150-
)->group([
151-
's.store_id', 's.website_id', 'cpe.entity_id', 'd.attribute_id', 'd.value',
152-
]);
158+
(new \Zend_Db_Expr('COALESCE(d2s.value, d2d.value)')) . ' = ' . ProductStatus::STATUS_ENABLED
159+
)->distinct(true);
153160

154161
if ($entityIds !== null) {
155162
$subSelect->where('cpe.entity_id IN(?)', $entityIds);

app/code/Magento/Catalog/etc/di.xml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,16 +715,63 @@
715715
</argument>
716716
</arguments>
717717
</type>
718+
<virtualType name="Magento\Catalog\EntityCreator\MetadataPool" type="Magento\Framework\EntityManager\MetadataPool">
719+
<arguments>
720+
<argument name="metadata" xsi:type="array">
721+
<item name="Magento\Catalog\Api\Data\ProductInterface" xsi:type="array">
722+
<item name="entityContext" xsi:type="array">
723+
<item name="store" xsi:type="string">Magento\Store\Model\DefaultStoreScopeProvider</item>
724+
</item>
725+
</item>
726+
<item name="Magento\Catalog\Api\Data\CategoryInterface" xsi:type="array">
727+
<item name="entityContext" xsi:type="array">
728+
<item name="store" xsi:type="string">Magento\Store\Model\DefaultStoreScopeProvider</item>
729+
</item>
730+
</item>
731+
<item name="Magento\Catalog\Api\Data\CategoryTreeInterface" xsi:type="array">
732+
<item name="entityContext" xsi:type="array">
733+
<item name="store" xsi:type="string">Magento\Store\Model\DefaultStoreScopeProvider</item>
734+
</item>
735+
</item>
736+
</argument>
737+
</arguments>
738+
</virtualType>
739+
<virtualType name="Magento\Catalog\Model\Entity\CreationScopeResolver" type="Magento\Framework\Model\Entity\ScopeResolver">
740+
<arguments>
741+
<argument name="metadataPool" xsi:type="object">Magento\Catalog\EntityCreator\MetadataPool</argument>
742+
</arguments>
743+
</virtualType>
718744
<virtualType name="Magento\Catalog\Model\ResourceModel\CreateHandler" type="Magento\Eav\Model\ResourceModel\CreateHandler">
719745
<arguments>
720-
<argument name="attributePersistor" xsi:type="object">Magento\Catalog\Model\ResourceModel\AttributePersistor</argument>
746+
<argument name="metadataPool" xsi:type="object">Magento\Catalog\EntityCreator\MetadataPool</argument>
747+
<argument name="scopeResolver" xsi:type="object">Magento\Catalog\Model\Entity\CreationScopeResolver</argument>
721748
</arguments>
722749
</virtualType>
723750
<virtualType name="Magento\Catalog\Model\ResourceModel\UpdateHandler" type="Magento\Eav\Model\ResourceModel\UpdateHandler">
724751
<arguments>
725752
<argument name="attributePersistor" xsi:type="object">Magento\Catalog\Model\ResourceModel\AttributePersistor</argument>
726753
</arguments>
727754
</virtualType>
755+
<type name="Magento\Framework\EntityManager\Operation\AttributePool">
756+
<arguments>
757+
<argument name="extensionActions" xsi:type="array">
758+
<item name="eav" xsi:type="array">
759+
<item name="Magento\Catalog\Api\Data\CategoryTreeInterface" xsi:type="array">
760+
<item name="create" xsi:type="string">Magento\Catalog\Model\ResourceModel\CreateHandler</item>
761+
<item name="update" xsi:type="string">Magento\Catalog\Model\ResourceModel\UpdateHandler</item>
762+
</item>
763+
<item name="Magento\Catalog\Api\Data\CategoryInterface" xsi:type="array">
764+
<item name="create" xsi:type="string">Magento\Catalog\Model\ResourceModel\CreateHandler</item>
765+
<item name="update" xsi:type="string">Magento\Catalog\Model\ResourceModel\UpdateHandler</item>
766+
</item>
767+
<item name="Magento\Catalog\Api\Data\ProductInterface" xsi:type="array">
768+
<item name="create" xsi:type="string">Magento\Catalog\Model\ResourceModel\CreateHandler</item>
769+
<item name="update" xsi:type="string">Magento\Catalog\Model\ResourceModel\UpdateHandler</item>
770+
</item>
771+
</item>
772+
</argument>
773+
</arguments>
774+
</type>
728775
<type name="Magento\Framework\EntityManager\HydratorPool">
729776
<arguments>
730777
<argument name="hydrators" xsi:type="array">

app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,6 @@ public function getColumnHtml(\Magento\Framework\DataObject $item, $column, $fie
281281
case 'price-original':
282282
$html = $this->displayPriceAttribute('original_price');
283283
break;
284-
case 'price':
285-
$html = $this->displayPriceAttribute('price');
286-
break;
287284
case 'tax-amount':
288285
$html = $this->displayPriceAttribute('tax_amount');
289286
break;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Store\Model;
8+
9+
use Magento\Framework\Model\Entity\ScopeProviderInterface;
10+
use Magento\Store\Model\Store;
11+
use Magento\Framework\Model\Entity\ScopeFactory;
12+
13+
/**
14+
* Class StoreScope
15+
*/
16+
class DefaultStoreScopeProvider implements ScopeProviderInterface
17+
{
18+
19+
/**
20+
* @var ScopeFactory
21+
*/
22+
private $scopeFactory;
23+
24+
/**
25+
* StoreScopeProvider constructor.
26+
*
27+
* @param ScopeFactory $scopeFactory
28+
*/
29+
public function __construct(
30+
ScopeFactory $scopeFactory
31+
) {
32+
$this->scopeFactory = $scopeFactory;
33+
}
34+
35+
/**
36+
* @param string $entityType
37+
* @param array $entityData
38+
* @return \Magento\Framework\Model\Entity\ScopeInterface
39+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
40+
*/
41+
public function getContext($entityType, $entityData = [])
42+
{
43+
return $this->scopeFactory->create(Store::STORE_ID, Store::DEFAULT_STORE_ID, null);
44+
}
45+
}

app/code/Magento/Store/Model/StoreScopeProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct(
4343
* @param string $entityType
4444
* @param array $entityData
4545
* @return \Magento\Framework\Model\Entity\ScopeInterface
46+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4647
*/
4748
public function getContext($entityType, $entityData = [])
4849
{
@@ -54,9 +55,6 @@ public function getContext($entityType, $entityData = [])
5455

5556
$identifier = Store::STORE_ID;
5657
$fallback = null;
57-
if ($value == 1) {
58-
$value = 0;
59-
}
6058
if ($value != Store::DEFAULT_STORE_ID) {
6159
$fallback = $this->scopeFactory->create($identifier, Store::DEFAULT_STORE_ID);
6260
}

dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public function save()
117117
*/
118118
public function delete()
119119
{
120+
$this->waitBeforeClick();
120121
$this->_rootElement->find($this->deleteButton)->click();
121122
}
122123

@@ -139,6 +140,6 @@ public function checkDeleteButton()
139140
protected function waitBeforeClick()
140141
{
141142
time_nanosleep(0, 600000000);
142-
usleep(500000);
143+
usleep(1000000);
143144
}
144145
}

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/TaxCalculationTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<data name="customer/dataset" xsi:type="string">johndoe_unique</data>
1515
<data name="salesRule" xsi:type="string">active_sales_rule_for_all_groups_no_coupon</data>
1616
<data name="catalogRule" xsi:type="string">-</data>
17-
<data name="configData" xsi:type="string">display_excluding_including_tax</data>
17+
<data name="configData" xsi:type="string">total_cat_excl_ship_incl_after_disc_on_excl, display_excluding_including_tax</data>
1818
<data name="qty" xsi:type="string">3</data>
1919
<data name="prices/category_price_excl_tax" xsi:type="string">1.00</data>
2020
<data name="prices/category_price_incl_tax" xsi:type="string">1.10</data>

dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function run()
5959
{
6060
$result['salesRule'] = null;
6161
if ($this->salesRule !== null) {
62+
$this->deleteAllSalesRule->run();
6263
$salesRule = $this->fixtureFactory->createByCode(
6364
'salesRule',
6465
['dataset' => $this->salesRule]

dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertOrderTaxOnBackend.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function processAssert(
9393
$this->orderInvoiceNew = $orderInvoiceNew;
9494
$this->orderCreditMemoNew = $orderCreditMemoNew;
9595
$orderIndex->open();
96+
$this->waitBeforeClick();
9697
$orderIndex->getSalesOrderGrid()->openFirstRow();
9798
//Check prices on order page
9899
$actualPrices = [];
@@ -222,4 +223,15 @@ public function toString()
222223
{
223224
return 'Prices on backend after order creation is correct.';
224225
}
226+
227+
/**
228+
* Wait for User before click
229+
*
230+
* @return void
231+
*/
232+
protected function waitBeforeClick()
233+
{
234+
time_nanosleep(0, 600000000);
235+
usleep(1000000);
236+
}
225237
}

dev/tests/functional/tests/app/Magento/Tax/Test/TestStep/CreateTaxRuleStep.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function run()
5959
{
6060
$result['taxRule'] = null;
6161
if ($this->taxRule !== null) {
62+
$this->deleteAllTaxRule->run();
6263
$taxRuleDataSets = explode(',', $this->taxRule);
6364
foreach ($taxRuleDataSets as $taxRuleDataSet) {
6465
$taxRule = $this->fixtureFactory->createByCode(

0 commit comments

Comments
 (0)