Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Forwardport] [TASK] Fix overriding of payment methods in getPaymentMethodList #2

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
193d007
DEVOPS-2174: Fix integration tests
slavvka Apr 27, 2018
3015b64
DEVOPS-2174: Fix integration tests
slavvka Apr 27, 2018
74778c6
DEVOPS-2174: Fix integration tests
slavvka May 1, 2018
32a9110
MAGETWO-90310: [Magento Cloud] - PayPal pop up does not work with vir…
StasKozar May 2, 2018
d0332cb
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-90310
StasKozar May 2, 2018
9cfb607
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-90310
StasKozar May 3, 2018
4ed0792
MAGETWO-90313: Import existing customer with only three columns will …
OlgaVasyltsun May 3, 2018
7d2c8a5
MAGETWO-90144: [Forwardport] Fixed amount discount for whole cart app…
OlgaVasyltsun May 3, 2018
276082a
MAGETWO-90313: Import existing customer with only three columns will …
OlgaVasyltsun May 3, 2018
79c23fa
MAGETWO-90310: [Magento Cloud] - PayPal pop up does not work with vir…
StasKozar May 3, 2018
18148e8
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-90144
OlgaVasyltsun May 3, 2018
cfefced
MAGETWO-90563: [Forwardport] Implement segmentation for Category Prod…
slopukhov May 3, 2018
0a2e9d6
Merge branch '2.3-develop' of github.com:magento/magento2ce into MAGE…
slopukhov May 3, 2018
17ff1ac
Merge remote-tracking branch 'mainline/2.3-develop' into DEVOPS-2174
slavvka May 3, 2018
eac772a
DEVOPS-2174: Fix integration tests
slavvka May 3, 2018
585906b
MAGETWO-90563: [Forwardport] Implement segmentation for Category Prod…
slopukhov May 4, 2018
dec9f82
Merge remote-tracking branch 'origin/MAGETWO-90313' into 2.3-develop-…
svitja May 4, 2018
b7f79fb
MAGETWO-90144: [Forwardport] Fixed amount discount for whole cart app…
OlgaVasyltsun May 4, 2018
e2ae3b6
MAGETWO-90563: [Forwardport] Implement segmentation for Category Prod…
slopukhov May 4, 2018
42d4e1b
Merge branch '2.3-develop' of github.com:magento/magento2ce into MAGE…
slopukhov May 4, 2018
a959241
Merge remote-tracking branch 'origin/MAGETWO-90144' into 2.3-develop-…
StasKozar May 4, 2018
9c7b444
Merge remote-tracking branch 'origin/MAGETWO-90310' into 2.3-develop-…
DianaRusin May 4, 2018
1f8bc62
merge magento/2.3-develop into magento-borg/DEVOPS-2174
May 4, 2018
33e4a1d
DEVOPS-2174: Fix static tests
slavvka May 4, 2018
59717eb
Merge remote-tracking branch 'origin/DEVOPS-2174' into DEVOPS-2174
slavvka May 4, 2018
435b165
[2.3-develop] [ForwardPort] Port of #12285 The option <var name="allo…
May 5, 2018
163d4cc
[2.3-develop] [ForwardPort] Port of #15020 Update Gallery Template to…
May 5, 2018
e56645c
ENGCOM-1457: [2.3-develop] [ForwardPort] Port of #15020 Update Galler…
magento-engcom-team May 5, 2018
4113f26
Fixed Travis Build Problems
May 6, 2018
c0b9e8f
Added strict types declaration
May 6, 2018
05b1512
Attempt to fix codacy issue
May 6, 2018
2701a4f
Fix Travis Long Line Check
May 6, 2018
567da67
ENGCOM-1456: [2.3-develop] [ForwardPort] Port of #12285 The option <v…
magento-engcom-team May 7, 2018
b76ddf8
fix: set message-success in setup if we already have the latest version
DanielRuf May 5, 2018
40d9180
fix: break line into multiple lines to fix PHPCS violation
DanielRuf May 5, 2018
1bb694b
ENGCOM-1460: [Forwardport] fix: set message-success in setup if we al…
magento-engcom-team May 7, 2018
3eaa11f
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr17
zakdma May 7, 2018
9f13c1a
DEVOPS-2174: Fix integration tests
slavvka May 7, 2018
2c2f8f8
Merge remote-tracking branch 'mainline/2.3-develop' into DEVOPS-2174
slavvka May 7, 2018
dbf74dc
Merge branch '2.3-develop' of github.com:magento/magento2ce into MAGE…
slopukhov May 8, 2018
b6e2ad0
Duplicate Order Confirmation Emails for PayPal Express checkout order…
rogyar May 8, 2018
e07e762
Add statement to 'beforeSave' method to allow app:config:import
rogyar May 8, 2018
beb0baa
ENGCOM-1468: [Forwardport] Duplicate Order Confirmation Emails for Pa…
magento-engcom-team May 8, 2018
c94472a
ENGCOM-1469: [Forwardport] Add statement to 'beforeSave' method to al…
magento-engcom-team May 8, 2018
52971ba
MAGETWO-90563: [Forwardport] Implement segmentation for Category Prod…
slopukhov May 8, 2018
77c69ea
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr17
zakdma May 8, 2018
5728b3c
ENGCOM-1469: [Forwardport] Add statement to 'beforeSave' method to al…
VladimirZaets May 8, 2018
4c55860
ENGCOM-1460: [Forwardport] fix: set message-success in setup if we al…
VladimirZaets May 8, 2018
4b29a01
ENGCOM-1457: [2.3-develop] [ForwardPort] Port of #15020 Update Galler…
VladimirZaets May 8, 2018
521518f
ENGCOM-1456: [2.3-develop] [ForwardPort] Port of #12285 The option <v…
VladimirZaets May 8, 2018
a53347e
Merge pull request #2514 from magento-performance/MAGETWO-90563
kandy May 8, 2018
04fac0e
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr17
zakdma May 8, 2018
76349ca
[EngCom] Public Pull Requests - 2.3-develop
magento-engcom-team May 8, 2018
6771f36
Code cleanup, add more visibility
thomas-kl1 Apr 9, 2018
79b74b6
Fixed typo and logic mismatch
Apr 28, 2018
4276a24
Fixed reset method usage
Apr 28, 2018
a132f54
Changed return type of addToCartPostParams to array
LordZardeck Apr 26, 2018
361d576
Removed extra spaces from language file
yogeshsuhagiya Apr 28, 2018
435650b
Removed extra close tag
yogeshsuhagiya May 2, 2018
44a1f2b
use Module_Name/template/path format instead of using template/path i…
Jakhotiya May 2, 2018
c68b1af
Fixed typo in _buttons.less
kalpmehta May 5, 2018
f48135b
Fixed typo in _typography.less
kalpmehta May 5, 2018
32bd463
Fixed typo in _layout.less
kalpmehta May 5, 2018
df3127c
ENGCOM-1477: [Forwardport] Fixed typos in .less files #15083
magento-engcom-team May 8, 2018
feedd9a
ENGCOM-1478: [Forwardport] Code cleanup, add more visibility #15069
magento-engcom-team May 8, 2018
6890aa1
ENGCOM-1480: [Forwardport] Changed return type of addToCartPostParams…
magento-engcom-team May 8, 2018
d01529e
ENGCOM-1481: [Forwardport] Removed extra spaces from language file #1…
magento-engcom-team May 8, 2018
46cb916
ENGCOM-1482: [Forwardport] Removed extra close tag #15078
magento-engcom-team May 8, 2018
aca4735
ENGCOM-1483: [Forwardport] use 'Module_Name::template/path' format in…
magento-engcom-team May 8, 2018
9735582
ENGCOM-1483: [Forwardport] use "Module_Name::template/path" format in…
May 9, 2018
6ae03ab
ENGCOM-1482: [Forwardport] Removed extra close tag #15078
May 9, 2018
bba5cdb
ENGCOM-1481: [Forwardport] Removed extra spaces from language file #1…
May 9, 2018
d649418
ENGCOM-1480: [Forwardport] Changed return type of addToCartPostParams…
May 9, 2018
aa72ef3
ENGCOM-1478: [Forwardport] Code cleanup, add more visibility #15069
May 9, 2018
4b74a5a
ENGCOM-1477: [Forwardport] Fixed typos in .less files #15083
May 9, 2018
27e4708
ENGCOM-1468: [Forwardport] Duplicate Order Confirmation Emails for Pa…
May 9, 2018
14a5702
:arrows_clockwise: [EngCom] Public Pull Requests - 2.3-develop
magento-engcom-team May 9, 2018
ddeb591
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr17
zakdma May 9, 2018
ae29904
Merge remote-tracking branch 'mainline/2.3-develop' into DEVOPS-2174
slavvka May 9, 2018
fb5eccf
Merge pull request #2513 from magento-tsg/2.3-develop-pr17
slavvka May 9, 2018
8b02375
Merge remote-tracking branch 'mainline/2.3-develop' into DEVOPS-2174
slavvka May 9, 2018
b16dfc6
Merge pull request #2501 from magento-borg/DEVOPS-2174
slavvka May 9, 2018
ce811f9
Fix overriding of payment methods in getPaymentMethodList
mashb1t May 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
use Magento\Framework\Model\ResourceModel\Db\Context;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Catalog\Api\Data\CategoryInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver as TableResolver;
use Magento\Framework\Search\Request\Dimension;
use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction;

/**
* @api
Expand All @@ -29,22 +33,30 @@ class Index extends AbstractDb
*/
protected $metadataPool;

/**
* @var TableResolver
*/
private $tableResolver;

/**
* Index constructor.
* @param Context $context
* @param StoreManagerInterface $storeManager
* @param MetadataPool $metadataPool
* @param null $connectionName
* @param TableResolver|null $tableResolver
*/
public function __construct(
Context $context,
StoreManagerInterface $storeManager,
MetadataPool $metadataPool,
$connectionName = null
$connectionName = null,
TableResolver $tableResolver = null
) {
parent::__construct($context, $connectionName);
$this->storeManager = $storeManager;
$this->metadataPool = $metadataPool;
$this->tableResolver = $tableResolver ?: ObjectManager::getInstance()->get(TableResolver::class);
}

/**
Expand Down Expand Up @@ -116,8 +128,17 @@ public function getCategoryProductIndexData($storeId = null, $productIds = null)
{
$connection = $this->getConnection();

$catalogCategoryProductDimension = new Dimension(\Magento\Store\Model\Store::ENTITY, $storeId);

$catalogCategoryProductTableName = $this->tableResolver->resolve(
AbstractAction::MAIN_INDEX_TABLE,
[
$catalogCategoryProductDimension
]
);

$select = $connection->select()->from(
[$this->getTable('catalog_category_product_index')],
[$catalogCategoryProductTableName],
['category_id', 'product_id', 'position', 'store_id']
)->where(
'store_id = ?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ public function __construct(
public function beforeSave()
{
$value = $this->getValue();
if (!is_array($value)) {
try {
$value = $this->serializer->unserialize($value);
} catch (\InvalidArgumentException $e) {
$value = [];
}
}
$result = [];
foreach ($value as $data) {
if (empty($data['country_id']) || empty($data['cc_types'])) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Product/ListProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public function getIdentities()
* Get post parameters
*
* @param Product $product
* @return string
* @return array
*/
public function getAddToCartPostParams(Product $product)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\Product;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\DB\Query\Generator as QueryGenerator;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\DB\Query\Generator as QueryGenerator;
use Magento\Framework\DB\Select;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Store\Model\Store;
Expand Down Expand Up @@ -42,6 +42,7 @@ abstract class AbstractAction

/**
* Suffix for table to show it is temporary
* @deprecated
*/
const TEMPORARY_TABLE_SUFFIX = '_tmp';

Expand Down Expand Up @@ -106,6 +107,11 @@ abstract class AbstractAction
*/
protected $metadataPool;

/**
* @var TableMaintainer
*/
protected $tableMaintainer;

/**
* @var string
* @since 101.0.0
Expand All @@ -121,22 +127,25 @@ abstract class AbstractAction
* @param ResourceConnection $resource
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Model\Config $config
* @param QueryGenerator|null $queryGenerator
* @param QueryGenerator $queryGenerator
* @param MetadataPool|null $metadataPool
* @param TableMaintainer|null $tableMaintainer
*/
public function __construct(
\Magento\Framework\App\ResourceConnection $resource,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Model\Config $config,
QueryGenerator $queryGenerator = null,
MetadataPool $metadataPool = null
MetadataPool $metadataPool = null,
TableMaintainer $tableMaintainer = null
) {
$this->resource = $resource;
$this->connection = $resource->getConnection();
$this->storeManager = $storeManager;
$this->config = $config;
$this->queryGenerator = $queryGenerator ?: ObjectManager::getInstance()->get(QueryGenerator::class);
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
$this->tableMaintainer = $tableMaintainer ?: ObjectManager::getInstance()->get(TableMaintainer::class);
}

/**
Expand Down Expand Up @@ -180,6 +189,7 @@ protected function getTable($table)
* The name is switched between 'catalog_category_product_index' and 'catalog_category_product_index_replica'
*
* @return string
* @deprecated
*/
protected function getMainTable()
{
Expand All @@ -190,6 +200,7 @@ protected function getMainTable()
* Return temporary index table name
*
* @return string
* @deprecated
*/
protected function getMainTmpTable()
{
Expand All @@ -198,6 +209,19 @@ protected function getMainTmpTable()
: $this->getMainTable();
}

/**
* Return index table name
*
* @param int $storeId
* @return string
*/
protected function getIndexTable($storeId)
{
return $this->useTempTable
? $this->tableMaintainer->getMainReplicaTable($storeId)
: $this->tableMaintainer->getMainTable($storeId);
}

/**
* Return category path by id
*
Expand Down Expand Up @@ -319,7 +343,7 @@ protected function getNonAnchorCategoriesSelect(Store $store)
}

/**
* Add filtering by child products to select.
* Add filtering by child products to select
*
* It's used for correct handling of composite products.
* This method makes assumption that select already joins `catalog_product_entity` as `cpe`.
Expand Down Expand Up @@ -422,7 +446,7 @@ protected function reindexNonAnchorCategories(Store $store)
$this->connection->query(
$this->connection->insertFromSelect(
$select,
$this->getMainTmpTable(),
$this->getIndexTable($store->getId()),
['category_id', 'product_id', 'position', 'is_parent', 'store_id', 'visibility'],
\Magento\Framework\DB\Adapter\AdapterInterface::INSERT_ON_DUPLICATE
)
Expand Down Expand Up @@ -612,6 +636,12 @@ protected function makeTempCategoryTreeIndex()
['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY]
);

$temporaryTable->addIndex(
'child_id',
['child_id'],
['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX]
);

// Drop the temporary table in case it already exists on this (persistent?) connection.
$this->connection->dropTemporaryTable($temporaryName);
$this->connection->createTemporaryTable($temporaryTable);
Expand Down Expand Up @@ -678,7 +708,7 @@ protected function reindexAnchorCategories(Store $store)
$this->connection->query(
$this->connection->insertFromSelect(
$select,
$this->getMainTmpTable(),
$this->getIndexTable($store->getId()),
['category_id', 'product_id', 'position', 'is_parent', 'store_id', 'visibility'],
\Magento\Framework\DB\Adapter\AdapterInterface::INSERT_ON_DUPLICATE
)
Expand Down Expand Up @@ -804,7 +834,7 @@ protected function reindexRootCategory(Store $store)
$this->connection->query(
$this->connection->insertFromSelect(
$select,
$this->getMainTmpTable(),
$this->getIndexTable($store->getId()),
['category_id', 'product_id', 'position', 'is_parent', 'store_id', 'visibility'],
\Magento\Framework\DB\Adapter\AdapterInterface::INSERT_ON_DUPLICATE
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,35 @@ public function __construct(
}

/**
*
* Clear the table we'll be writing de-normalized data into
* to prevent archived data getting in the way of actual data.
*
* @return void
*/
private function clearCurrentTable()
private function createTables()
{
$this->connection->delete(
$this->activeTableSwitcher
->getAdditionalTableName($this->getMainTable())
);
foreach ($this->storeManager->getStores() as $store) {
$this->tableMaintainer->createTablesForStore($store->getId());
}
}

/**
* @return void
*/
private function clearReplicaTables()
{
foreach ($this->storeManager->getStores() as $store) {
$this->connection->truncateTable($this->tableMaintainer->getMainReplicaTable($store->getId()));
}
}

/**
* @return void
*/
private function switchTables()
{
$tablesToSwitch = [];
foreach ($this->storeManager->getStores() as $store) {
$tablesToSwitch[] = $this->tableMaintainer->getMainTable($store->getId());
}
$this->activeTableSwitcher->switchTable($this->connection, $tablesToSwitch);
}

/**
Expand All @@ -109,22 +126,26 @@ private function clearCurrentTable()
*/
public function execute()
{
$this->clearCurrentTable();
$this->createTables();
$this->clearReplicaTables();
$this->reindex();
$this->activeTableSwitcher->switchTable($this->connection, [$this->getMainTable()]);
$this->switchTables();
return $this;
}

/**
* Publish data from tmp to index
* Publish data from tmp to replica table
*
* @param \Magento\Store\Model\Store $store
* @return void
*/
protected function publishData()
private function publishData($store)
{
$select = $this->connection->select()->from($this->getMainTmpTable());
$columns = array_keys($this->connection->describeTable($this->getMainTable()));
$tableName = $this->activeTableSwitcher->getAdditionalTableName($this->getMainTable());
$select = $this->connection->select()->from($this->tableMaintainer->getMainTmpTable($store->getId()));
$columns = array_keys(
$this->connection->describeTable($this->tableMaintainer->getMainReplicaTable($store->getId()))
);
$tableName = $this->tableMaintainer->getMainReplicaTable($store->getId());

$this->connection->query(
$this->connection->insertFromSelect(
Expand All @@ -136,23 +157,13 @@ protected function publishData()
);
}

/**
* Clear all index data
*
* @return void
*/
protected function clearTmpData()
{
$this->connection->delete($this->getMainTmpTable());
}

/**
* {@inheritdoc}
*/
protected function reindexRootCategory(\Magento\Store\Model\Store $store)
{
if ($this->isIndexRootCategoryNeeded()) {
$this->reindexCategoriesBySelect($this->getAllProducts($store), 'cp.entity_id IN (?)');
$this->reindexCategoriesBySelect($this->getAllProducts($store), 'cp.entity_id IN (?)', $store);
}
}

Expand All @@ -164,7 +175,7 @@ protected function reindexRootCategory(\Magento\Store\Model\Store $store)
*/
protected function reindexAnchorCategories(\Magento\Store\Model\Store $store)
{
$this->reindexCategoriesBySelect($this->getAnchorCategoriesSelect($store), 'ccp.product_id IN (?)');
$this->reindexCategoriesBySelect($this->getAnchorCategoriesSelect($store), 'ccp.product_id IN (?)', $store);
}

/**
Expand All @@ -175,20 +186,25 @@ protected function reindexAnchorCategories(\Magento\Store\Model\Store $store)
*/
protected function reindexNonAnchorCategories(\Magento\Store\Model\Store $store)
{
$this->reindexCategoriesBySelect($this->getNonAnchorCategoriesSelect($store), 'ccp.product_id IN (?)');
$this->reindexCategoriesBySelect($this->getNonAnchorCategoriesSelect($store), 'ccp.product_id IN (?)', $store);
}

/**
* Reindex categories using given SQL select and condition.
*
* @param \Magento\Framework\DB\Select $basicSelect
* @param string $whereCondition
* @param \Magento\Store\Model\Store $store
* @return void
*/
private function reindexCategoriesBySelect(\Magento\Framework\DB\Select $basicSelect, $whereCondition)
private function reindexCategoriesBySelect(\Magento\Framework\DB\Select $basicSelect, $whereCondition, $store)
{
$this->tableMaintainer->createMainTmpTable($store->getId());

$entityMetadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
$columns = array_keys($this->connection->describeTable($this->getMainTmpTable()));
$columns = array_keys(
$this->connection->describeTable($this->tableMaintainer->getMainTmpTable($store->getId()))
);
$this->batchSizeManagement->ensureBatchSize($this->connection, $this->batchRowsCount);
$batches = $this->batchProvider->getBatches(
$this->connection,
Expand All @@ -197,7 +213,7 @@ private function reindexCategoriesBySelect(\Magento\Framework\DB\Select $basicSe
$this->batchRowsCount
);
foreach ($batches as $batch) {
$this->clearTmpData();
$this->connection->delete($this->tableMaintainer->getMainTmpTable($store->getId()));
$resultSelect = clone $basicSelect;
$select = $this->connection->select();
$select->distinct(true);
Expand All @@ -207,12 +223,12 @@ private function reindexCategoriesBySelect(\Magento\Framework\DB\Select $basicSe
$this->connection->query(
$this->connection->insertFromSelect(
$resultSelect,
$this->getMainTmpTable(),
$this->tableMaintainer->getMainTmpTable($store->getId()),
$columns,
\Magento\Framework\DB\Adapter\AdapterInterface::INSERT_ON_DUPLICATE
)
);
$this->publishData();
$this->publishData($store);
}
}
}
Loading