Skip to content

Commit 79c89e9

Browse files
author
Mike Weis
committed
Merge branch 'develop' into FearlessKiwis-MAGETWO-43961-fpt-final-price-with-custom-opts
2 parents fa8493b + f920640 commit 79c89e9

File tree

72 files changed

+655
-3654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+655
-3654
lines changed

app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions"/>
2525
<block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" as="details" template="express/review/details.phtml">
2626
<block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
27-
<block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/>
27+
<block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
2828
</block>
2929
<block class="Magento\CheckoutAgreements\Block\Agreements" name="paypal.express.review.details.agreements" as="agreements" template="Magento_CheckoutAgreements::additional_agreements.phtml"/>
3030
</block>

app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\CatalogSearch\Model\Adapter\Mysql\Filter;
77

88
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
910
use Magento\CatalogSearch\Model\Search\TableMapper;
1011
use Magento\Eav\Model\Config;
1112
use Magento\Framework\App\ResourceConnection;
@@ -97,7 +98,7 @@ public function process(FilterInterface $filter, $isNegation, $query)
9798
*/
9899
private function processQueryWithField(FilterInterface $filter, $isNegation, $query)
99100
{
100-
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
101+
/** @var Attribute $attribute */
101102
$attribute = $this->config->getAttribute(Product::ENTITY, $filter->getField());
102103
if ($filter->getField() === 'price') {
103104
$resultQuery = str_replace(
@@ -114,24 +115,16 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
114115
$this->connection->quoteIdentifier($alias . '.' . $attribute->getAttributeCode()),
115116
$query
116117
);
117-
} elseif ($filter->getType() === FilterInterface::TYPE_TERM
118-
&& in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
118+
} elseif (
119+
$filter->getType() === FilterInterface::TYPE_TERM &&
120+
in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
119121
) {
120-
$alias = $this->tableMapper->getMappingAlias($filter);
121-
if (is_array($filter->getValue())) {
122-
$value = sprintf(
123-
'%s IN (%s)',
124-
($isNegation ? 'NOT' : ''),
125-
implode(',', $filter->getValue())
126-
);
127-
} else {
128-
$value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
129-
}
130-
$resultQuery = sprintf(
131-
'%1$s.value %2$s',
132-
$alias,
133-
$value
134-
);
122+
$resultQuery = $this->processTermSelect($filter, $isNegation);
123+
} elseif (
124+
$filter->getType() === FilterInterface::TYPE_RANGE &&
125+
in_array($attribute->getBackendType(), ['decimal', 'int'], true)
126+
) {
127+
$resultQuery = $this->processRangeNumeric($filter, $query, $attribute);
135128
} else {
136129
$table = $attribute->getBackendTable();
137130
$select = $this->connection->select();
@@ -161,4 +154,57 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
161154

162155
return $resultQuery;
163156
}
157+
158+
/**
159+
* @param FilterInterface $filter
160+
* @param string $query
161+
* @param Attribute $attribute
162+
* @return string
163+
*/
164+
private function processRangeNumeric(FilterInterface $filter, $query, $attribute)
165+
{
166+
$tableSuffix = $attribute->getBackendType() === 'decimal' ? '_decimal' : '';
167+
$table = $this->resource->getTableName("catalog_product_index_eav{$tableSuffix}");
168+
$select = $this->connection->select();
169+
170+
$currentStoreId = $this->scopeResolver->getScope()->getId();
171+
172+
$select->from(['main_table' => $table], 'entity_id')
173+
->columns([$filter->getField() => 'main_table.value'])
174+
->where('main_table.attribute_id = ?', $attribute->getAttributeId())
175+
->where('main_table.store_id = ?', $currentStoreId)
176+
->having($query);
177+
178+
$resultQuery = 'search_index.entity_id IN (
179+
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
180+
)';
181+
182+
return $resultQuery;
183+
}
184+
185+
/**
186+
* @param FilterInterface $filter
187+
* @param bool $isNegation
188+
* @return string
189+
*/
190+
private function processTermSelect(FilterInterface $filter, $isNegation)
191+
{
192+
$alias = $this->tableMapper->getMappingAlias($filter);
193+
if (is_array($filter->getValue())) {
194+
$value = sprintf(
195+
'%s IN (%s)',
196+
($isNegation ? 'NOT' : ''),
197+
implode(',', $filter->getValue())
198+
);
199+
} else {
200+
$value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
201+
}
202+
$resultQuery = sprintf(
203+
'%1$s.value %2$s',
204+
$alias,
205+
$value
206+
);
207+
208+
return $resultQuery;
209+
}
164210
}

app/code/Magento/Checkout/Block/Onepage.php

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
*/
66
namespace Magento\Checkout\Block;
77

8-
use Magento\Checkout\Block\Checkout\LayoutProcessorInterface;
9-
use Magento\Customer\Api\CustomerRepositoryInterface;
10-
use Magento\Customer\Model\Address\Config as AddressConfig;
11-
128
/**
139
* Onepage checkout block
1410
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1511
*/
16-
class Onepage extends \Magento\Checkout\Block\Onepage\AbstractOnepage
12+
class Onepage extends \Magento\Framework\View\Element\Template
1713
{
1814
/**
1915
* @var \Magento\Framework\Data\Form\FormKey
@@ -36,60 +32,25 @@ class Onepage extends \Magento\Checkout\Block\Onepage\AbstractOnepage
3632
protected $configProvider;
3733

3834
/**
39-
* @var array|Checkout\LayoutProcessorInterface[]
35+
* @var array|\Magento\Checkout\Block\Checkout\LayoutProcessorInterface[]
4036
*/
4137
protected $layoutProcessors;
4238

4339
/**
4440
* @param \Magento\Framework\View\Element\Template\Context $context
45-
* @param \Magento\Directory\Helper\Data $directoryHelper
46-
* @param \Magento\Framework\App\Cache\Type\Config $configCacheType
47-
* @param \Magento\Customer\Model\Session $customerSession
48-
* @param \Magento\Checkout\Model\Session $resourceSession
49-
* @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
50-
* @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
51-
* @param CustomerRepositoryInterface $customerRepository
52-
* @param AddressConfig $addressConfig
53-
* @param \Magento\Framework\App\Http\Context $httpContext
54-
* @param \Magento\Customer\Model\Address\Mapper $addressMapper
5541
* @param \Magento\Framework\Data\Form\FormKey $formKey
5642
* @param \Magento\Checkout\Model\CompositeConfigProvider $configProvider
57-
* @param LayoutProcessorInterface[] $layoutProcessors
43+
* @param array $layoutProcessors
5844
* @param array $data
59-
* @codeCoverageIgnore
60-
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6145
*/
6246
public function __construct(
6347
\Magento\Framework\View\Element\Template\Context $context,
64-
\Magento\Directory\Helper\Data $directoryHelper,
65-
\Magento\Framework\App\Cache\Type\Config $configCacheType,
66-
\Magento\Customer\Model\Session $customerSession,
67-
\Magento\Checkout\Model\Session $resourceSession,
68-
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
69-
\Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory,
70-
CustomerRepositoryInterface $customerRepository,
71-
AddressConfig $addressConfig,
72-
\Magento\Framework\App\Http\Context $httpContext,
73-
\Magento\Customer\Model\Address\Mapper $addressMapper,
7448
\Magento\Framework\Data\Form\FormKey $formKey,
7549
\Magento\Checkout\Model\CompositeConfigProvider $configProvider,
7650
array $layoutProcessors = [],
7751
array $data = []
7852
) {
79-
parent::__construct(
80-
$context,
81-
$directoryHelper,
82-
$configCacheType,
83-
$customerSession,
84-
$resourceSession,
85-
$countryCollectionFactory,
86-
$regionCollectionFactory,
87-
$customerRepository,
88-
$addressConfig,
89-
$httpContext,
90-
$addressMapper,
91-
$data
92-
);
53+
parent::__construct($context, $data);
9354
$this->formKey = $formKey;
9455
$this->_isScopePrivate = true;
9556
$this->jsLayout = isset($data['jsLayout']) && is_array($data['jsLayout']) ? $data['jsLayout'] : [];

0 commit comments

Comments
 (0)