Skip to content

Commit 80ba877

Browse files
author
Alex Milenin
committed
Add patches
1 parent 690b77f commit 80ba877

25 files changed

+648
-21
lines changed

Patch-ADM_QuickDevBar-jquery-ui.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- view/base/web/js/quickdevbar.orig.js 2019-10-29 12:21:10.512000000 +0300
2+
+++ view/base/web/js/quickdevbar.js 2019-12-16 17:48:14.583467937 +0300
3+
@@ -1,7 +1,7 @@
4+
5+
/* */
6+
define(["jquery",
7+
- "jquery/ui",
8+
+ "jquery-ui-modules/tabs",
9+
"filtertable",
10+
"metadata",
11+
"tablesorter",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- Helper/Entity/ProductHelper.php 2019-05-29 18:47:57.778785105 +0300
2+
+++ Helper/Entity/ProductHelper.php 2019-06-07 16:24:40.116609085 +0300
3+
@@ -953,7 +953,7 @@
4+
5+
$currencies = $this->currencyManager->getConfigAllowCurrencies();
6+
7+
- $facets = $this->configHelper->getFacets();
8+
+ $facets = $this->configHelper->getFacets($storeId);
9+
foreach ($facets as $facet) {
10+
if ($facet['attribute'] === 'price') {
11+
foreach ($currencies as $currency_code) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- Helper/Entity/Product/PriceManager/ProductWithoutChildren.php 2019-09-14 14:25:03.415094182 +0300
2+
+++ Helper/Entity/Product/PriceManager/ProductWithoutChildren.fixed.php 2019-09-14 14:27:07.475294250 +0300
3+
@@ -248,6 +248,7 @@
4+
$groupId = (int) $group->getData('customer_group_id');
5+
6+
$product->setData('customer_group_id', $groupId);
7+
+ $product->setData('website_id', $product->getStore()->getWebsiteId());
8+
9+
$discountedPrice = $product->getPriceModel()->getFinalPrice(1, $product);
10+
if ($currencyCode !== $this->baseCurrencyCode) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- Helper/Data.orig.php 2019-02-20 11:46:32.000000000 +0300
2+
+++ Helper/Data.php 2019-09-18 18:32:10.757035874 +0300
3+
@@ -577,6 +577,7 @@
4+
$this->logger->start('START EMULATION');
5+
6+
$this->emulation->startEnvironmentEmulation($storeId, Area::AREA_FRONTEND, true);
7+
+ \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\App\Config\ScopeCodeResolver::class)->clean();
8+
$this->emulationRuns = true;
9+
10+
$this->logger->stop('START EMULATION');
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
--- Model/Indexer/Page.php 2019-02-20 11:46:32.000000000 +0300
2+
+++ Model/Indexer/Page.php 2019-09-20 16:36:59.000000000 +0300
3+
@@ -43,13 +43,9 @@ class Page implements Magento\Framework\
4+
$this->output = $output;
5+
}
6+
7+
- public function execute($ids)
8+
+ public function execute($ids)
9+
{
10+
- }
11+
-
12+
- public function executeFull()
13+
- {
14+
- if (!$this->configHelper->getApplicationID()
15+
+ if (!$this->configHelper->getApplicationID()
16+
|| !$this->configHelper->getAPIKey()
17+
|| !$this->configHelper->getSearchOnlyAPIKey()) {
18+
$errorMessage = 'Algolia reindexing failed:
19+
@@ -74,17 +70,29 @@ class Page implements Magento\Framework\
20+
}
21+
22+
if ($this->isPagesInAdditionalSections($storeId)) {
23+
- $this->queue->addToQueue($this->fullAction, 'rebuildStorePageIndex', ['store_id' => $storeId], 1);
24+
+ $this->queue->addToQueue(
25+
+ $this->fullAction,
26+
+ 'rebuildStorePageIndex',
27+
+ ['store_id' => $storeId, 'page_ids' => $ids],
28+
+ is_array($ids) ? count($ids) : 1
29+
+ );
30+
}
31+
}
32+
}
33+
34+
+ public function executeFull()
35+
+ {
36+
+ $this->execute(null);
37+
+ }
38+
+
39+
public function executeList(array $ids)
40+
{
41+
+ $this->execute($ids);
42+
}
43+
44+
public function executeRow($id)
45+
{
46+
+ $this->execute([$id]);
47+
}
48+
49+
private function isPagesInAdditionalSections($storeId)
50+
--- Model/Indexer/PageObserver.php 1970-01-01 03:00:00.000000000 +0300
51+
+++ Model/Indexer/PageObserver.php 2019-09-20 16:42:26.000000000 +0300
52+
@@ -0,0 +1,42 @@
53+
+<?php
54+
+
55+
+namespace Algolia\AlgoliaSearch\Model\Indexer;
56+
+
57+
+use Magento\Framework\Indexer\IndexerRegistry;
58+
+use Magento\Framework\Model\AbstractModel;
59+
+
60+
+class PageObserver
61+
+{
62+
+ private $indexer;
63+
+
64+
+ public function __construct(IndexerRegistry $indexerRegistry)
65+
+ {
66+
+ $this->indexer = $indexerRegistry->get('algolia_pages');
67+
+ }
68+
+
69+
+ public function beforeSave(
70+
+ \Magento\Cms\Model\ResourceModel\Page $pageResource,
71+
+ AbstractModel $page
72+
+ ) {
73+
+ $pageResource->addCommitCallback(function () use ($page) {
74+
+ if (!$this->indexer->isScheduled()) {
75+
+ $this->indexer->reindexRow($page->getId());
76+
+ }
77+
+ });
78+
+
79+
+ return [$page];
80+
+ }
81+
+
82+
+ public function beforeDelete(
83+
+ \Magento\Cms\Model\ResourceModel\Page $pageResource,
84+
+ AbstractModel $page
85+
+ ) {
86+
+ $pageResource->addCommitCallback(function () use ($page) {
87+
+ if (!$this->indexer->isScheduled()) {
88+
+ $this->indexer->reindexRow($page->getId());
89+
+ }
90+
+ });
91+
+
92+
+ return [$page];
93+
+ }
94+
+}
95+
--- etc/di.xml 2019-02-20 11:46:32.000000000 +0300
96+
+++ etc/di.xml 2019-09-20 16:43:43.000000000 +0300
97+
@@ -1,5 +1,8 @@
98+
<?xml version="1.0"?>
99+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
100+
+ <type name="Magento\Cms\Model\ResourceModel\Page">
101+
+ <plugin name="algoliaPages" type="Algolia\AlgoliaSearch\Model\Indexer\PageObserver"/>
102+
+ </type>
103+
<type name="Magento\Catalog\Model\ResourceModel\Product">
104+
<plugin name="algoliaProducts" type="Algolia\AlgoliaSearch\Model\Indexer\ProductObserver"/>
105+
</type>
106+
--- etc/mview.xml 2019-02-20 11:46:32.000000000 +0300
107+
+++ etc/mview.xml 2019-09-20 16:44:50.000000000 +0300
108+
@@ -3,6 +3,9 @@
109+
<view id="algolia_suggestions" class="Algolia\AlgoliaSearch\Model\Indexer\Suggestion" group="indexer">
110+
</view>
111+
<view id="algolia_pages" class="Algolia\AlgoliaSearch\Model\Indexer\Page" group="indexer">
112+
+ <subscriptions>
113+
+ <table name="cms_page" entity_column="page_id" />
114+
+ </subscriptions>
115+
</view>
116+
<view id="algolia_additional_sections" class="Algolia\AlgoliaSearch\Model\Indexer\Page" group="indexer">
117+
</view>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- view/frontend/web/instantsearch.orig.js 2019-02-20 11:46:32.000000000 +0300
2+
+++ view/frontend/web/instantsearch.js 2019-05-28 16:12:26.829680349 +0300
3+
@@ -216,7 +216,7 @@
4+
}
5+
6+
content += '</div>';
7+
- content += algoliaConfig.translations.or + ' <a href="' + algoliaConfig.baseUrl + '/catalogsearch/result/?q=__empty__">' + algoliaConfig.translations.seeAll + '</a>'
8+
+ // content += algoliaConfig.translations.or + ' <a href="' + algoliaConfig.baseUrl + '/catalogsearch/result/?q=__empty__">' + algoliaConfig.translations.seeAll + '</a>'
9+
10+
content += '</div>';
11+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- view/base/web/js/label.js 2020-03-27 17:04:50.000000000 +0300
2+
+++ view/base/web/js/label.js 2020-04-22 12:54:25.631698660 +0300
3+
@@ -1,6 +1,7 @@
4+
define([
5+
'jquery',
6+
- 'underscore'
7+
+ 'underscore',
8+
+ 'jquery-ui-modules/widget'
9+
], function ($, _) {
10+
11+
$.widget('mage.amShowLabel', {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/Model/Layer/Filter/Category.php b/Model/Layer/Filter/Category.php
2+
index 855d80e..4d9bf20 100644
3+
--- a/Model/Layer/Filter/Category.php
4+
+++ b/Model/Layer/Filter/Category.php
5+
@@ -610,6 +610,13 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
6+
$requestBuilder->removePlaceholder(CategoryHelper::ATTRIBUTE_CODE);
7+
$requestBuilder->bind(CategoryHelper::ATTRIBUTE_CODE, $categoryId);
8+
$requestBuilder->setAggregationsOnly(CategoryHelper::ATTRIBUTE_CODE);
9+
+
10+
+ /** @var \Magento\Search\Model\EngineResolver $searchEngine */
11+
+ $searchEngine = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Search\Model\EngineResolver::class);
12+
+ if (\in_array($searchEngine->getCurrentSearchEngine(), ['elasticsearch', 'elasticsearch5', 'elasticsearch6'])) {
13+
+ $requestBuilder->setSize(0); // fix for ES aggregation performance
14+
+ }
15+
+
16+
$queryRequest = $requestBuilder->create();
17+
18+
return $queryRequest;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- Controller/Index/Index.php.orig 2019-10-25 14:02:22.000000000 +0300
2+
+++ Controller/Index/Index.php 2020-04-10 11:29:24.187028602 +0300
3+
@@ -359,6 +359,7 @@
4+
5+
$result['popup'] = $html;
6+
$result['sku'] = $resultItem->getSku();
7+
+ $result['productIds'] = [$productId];
8+
9+
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
10+
$resultJson->setData($result);
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
--- Helper/DataConverter.php 2020-02-07 19:50:46.000000000 +0300
2+
+++ Helper/DataConverter.php 2020-02-27 14:17:19.150006124 +0300
3+
@@ -21,7 +21,7 @@
4+
*/
5+
public function toApiFloat($float)
6+
{
7+
- return round($float * 100);
8+
+ return (int) round($float * 100);
9+
}
10+
11+
/**
12+
13+
--- Model/Checkout/Orderline/Items/Discount.php 2020-02-07 19:50:46.000000000 +0300
14+
+++ Model/Checkout/Orderline/Items/Discount.php 2020-02-28 11:12:19.656878831 +0300
15+
@@ -155,10 +155,10 @@
16+
);
17+
$total = $totals['discount'];
18+
19+
- $parameter->setDiscountUnitPrice(-$this->helper->toApiFloat($discount['unit_price']))
20+
- ->setDiscountTaxRate($this->helper->toApiFloat($discount['tax_rate']))
21+
- ->setDiscountTotalAmount(-$this->helper->toApiFloat($discount['total_amount']))
22+
- ->setDiscountTaxAmount(-$this->helper->toApiFloat($discount['tax_amount']))
23+
+ $parameter->setDiscountUnitPrice(-$discount['unit_price'])
24+
+ ->setDiscountTaxRate($discount['tax_rate'])
25+
+ ->setDiscountTotalAmount(-$discount['total_amount'])
26+
+ ->setDiscountTaxAmount(-$discount['tax_amount'])
27+
->setDiscountTitle((string)$total->getTitle())
28+
->setDiscountReference($total->getCode());
29+
30+
--- Model/Calculator/Discounts.php 2020-02-07 19:50:46.000000000 +0300
31+
+++ Model/Calculator/Discounts.php 2020-02-28 10:09:44.852988400 +0300
32+
@@ -72,7 +72,21 @@
33+
*/
34+
public function getDiscountTaxAmount($items, $total, $taxRate)
35+
{
36+
- return -($total->getValue() - ($total->getValue() / (1 + $taxRate)));
37+
+ $taxAmount = 0;
38+
+ foreach ($items as $item) {
39+
+ if ($item->getBaseDiscountAmount() == 0) {
40+
+ continue;
41+
+ }
42+
+ $taxAmount += $item->getDiscountTaxCompensationAmount();
43+
+ }
44+
+
45+
+ if ($taxAmount === 0) {
46+
+ if ($taxRate > 1) {
47+
+ $taxRate = $taxRate / 100;
48+
+ }
49+
+ $taxAmount = -($total->getValue() - ($total->getValue() / (1 + $taxRate)));
50+
+ }
51+
+ return $taxAmount;
52+
}
53+
54+
/**
55+
@@ -194,14 +208,17 @@
56+
57+
if ($this->klarnaConfig->isSeparateTaxLine($store) || $this->isTaxBeforeDiscount($store)) {
58+
$taxRate = 0;
59+
- $taxAmount = 0;
60+
} elseif ($this->isPriceExcludesVat($store)) {
61+
$unitPrice += $taxAmount;
62+
$totalAmount += $taxAmount;
63+
}
64+
+ $taxRate = $this->dataConverter->toApiFloat($taxRate);
65+
+ $totalAmount = $this->dataConverter->toApiFloat($totalAmount);
66+
+ //recalculate tax amount to match rounded rate and total amount
67+
+ $taxAmount = (int) round($totalAmount - $totalAmount * 10000 / (10000 + $taxRate));
68+
69+
return [
70+
- 'unit_price' => $unitPrice,
71+
+ 'unit_price' => $this->dataConverter->toApiFloat($unitPrice),
72+
'total_amount' => $totalAmount,
73+
'tax_rate' => $taxRate,
74+
'tax_amount' => $taxAmount

0 commit comments

Comments
 (0)