Skip to content

Commit 2bb86b6

Browse files
author
Magento CICD
authored
MAGETWO-65006: [GitHub][PR] Keep transparency when resizing images #7307
2 parents dfd68b9 + b8b7be8 commit 2bb86b6

File tree

13 files changed

+315
-86
lines changed

13 files changed

+315
-86
lines changed

app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceBlock name="shipment_items">
11-
<block class="Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer" name="shipment_item_bundle" as="shipment_item_bundle" template="sales/shipment/view/items/renderer.phtml"/>
11+
<block class="Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer" name="bundle" as="bundle" template="sales/shipment/view/items/renderer.phtml"/>
1212
</referenceBlock>
1313
</body>
1414
</page>

app/code/Magento/Catalog/Model/ProductIdLocator.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@
88

99
/**
1010
* Product ID locator provides all product IDs by SKUs.
11-
* @api
1211
*/
1312
class ProductIdLocator implements \Magento\Catalog\Model\ProductIdLocatorInterface
1413
{
14+
/**
15+
* Limit values for array IDs by SKU.
16+
*
17+
* @var int
18+
*/
19+
private $idsLimit;
20+
1521
/**
1622
* Metadata pool.
1723
*
@@ -34,13 +40,16 @@ class ProductIdLocator implements \Magento\Catalog\Model\ProductIdLocatorInterfa
3440
/**
3541
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
3642
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory
43+
* @param string $limitIdsBySkuValues
3744
*/
3845
public function __construct(
3946
\Magento\Framework\EntityManager\MetadataPool $metadataPool,
40-
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory
47+
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory,
48+
$idsLimit
4149
) {
4250
$this->metadataPool = $metadataPool;
4351
$this->collectionFactory = $collectionFactory;
52+
$this->idsLimit = (int)$idsLimit;
4453
}
4554

4655
/**
@@ -75,7 +84,19 @@ public function retrieveProductIdsBySkus(array $skus)
7584
$productIds[$sku] = $this->idsBySku[$unifiedSku];
7685
}
7786
}
78-
87+
$this->truncateToLimit();
7988
return $productIds;
8089
}
90+
91+
/**
92+
* Cleanup IDs by SKU cache more than some limit.
93+
*
94+
* @return void
95+
*/
96+
private function truncateToLimit()
97+
{
98+
if (count($this->idsBySku) > $this->idsLimit) {
99+
$this->idsBySku = array_slice($this->idsBySku, round($this->idsLimit / -2));
100+
}
101+
}
81102
}

app/code/Magento/Catalog/Model/ProductIdLocatorInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
/**
99
* Product ID locator provides all product IDs by SKU.
10+
* @api
1011
*/
1112
interface ProductIdLocatorInterface
1213
{

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@
157157
<argument name="perPageValues" xsi:type="string">9,15,30</argument>
158158
</arguments>
159159
</type>
160+
<type name="Magento\Catalog\Model\ProductIdLocator">
161+
<arguments>
162+
<argument name="idsLimit" xsi:type="number">1000</argument>
163+
</arguments>
164+
</type>
160165
<type name="Magento\Catalog\Model\Config\Source\ListPerPage">
161166
<arguments>
162167
<argument name="options" xsi:type="string">5,10,15,20,25</argument>

app/code/Magento/Paypal/Helper/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class Data extends \Magento\Framework\App\Helper\AbstractHelper
1616
{
1717
const HTML_TRANSACTION_ID =
18-
'<a target="_blank" href="https://www.%1$s.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=%2$s">%2$s</a>';
18+
'<a target="_blank" href="https://www%1$s.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=%2$s">%2$s</a>';
1919

2020
/**
2121
* Cache for shouldAskToCreateBillingAgreement()
@@ -133,7 +133,7 @@ public function getHtmlTransactionId($methodCode, $txnId)
133133
if (in_array($methodCode, $this->methodCodes)) {
134134
/** @var \Magento\Paypal\Model\Config $config */
135135
$config = $this->configFactory->create()->setMethod($methodCode);
136-
$sandboxFlag = ($config->getValue('sandboxFlag') ? 'sandbox' : '');
136+
$sandboxFlag = ($config->getValue('sandboxFlag') ? '.sandbox' : '');
137137
return sprintf(self::HTML_TRANSACTION_ID, $sandboxFlag, $txnId);
138138
}
139139
return $txnId;

app/code/Magento/Paypal/Model/Express/Checkout.php

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,9 @@ public function getCheckoutShortcutImageUrl()
387387
$pal = null;
388388
} elseif (!$pal) {
389389
$pal = null;
390-
$this->_getApi();
391390
try {
392-
$this->_api->callGetPalDetails();
393-
$pal = $this->_api->getPal();
391+
$this->_getApi()->callGetPalDetails();
392+
$pal = $this->_getApi()->getPal();
394393
$this->_configCacheType->save($pal, $cacheId);
395394
} catch (\Exception $e) {
396395
$this->_configCacheType->save(self::PAL_CACHE_ID, $cacheId);
@@ -503,11 +502,10 @@ public function start($returnUrl, $cancelUrl, $button = null)
503502
$this->_quote->reserveOrderId();
504503
$this->quoteRepository->save($this->_quote);
505504
// prepare API
506-
$this->_getApi();
507505
$solutionType = $this->_config->getMerchantCountry() == 'DE'
508506
? \Magento\Paypal\Model\Config::EC_SOLUTION_TYPE_MARK
509507
: $this->_config->getValue('solutionType');
510-
$this->_api->setAmount($this->_quote->getBaseGrandTotal())
508+
$this->_getApi()->setAmount($this->_quote->getBaseGrandTotal())
511509
->setCurrencyCode($this->_quote->getBaseCurrencyCode())
512510
->setInvNum($this->_quote->getReservedOrderId())
513511
->setReturnUrl($returnUrl)
@@ -516,7 +514,7 @@ public function start($returnUrl, $cancelUrl, $button = null)
516514
->setPaymentAction($this->_config->getValue('paymentAction'));
517515
if ($this->_giropayUrls) {
518516
list($successUrl, $cancelUrl, $pendingUrl) = $this->_giropayUrls;
519-
$this->_api->addData(
517+
$this->_getApi()->addData(
520518
[
521519
'giropay_cancel_url' => $cancelUrl,
522520
'giropay_success_url' => $successUrl,
@@ -526,13 +524,13 @@ public function start($returnUrl, $cancelUrl, $button = null)
526524
}
527525

528526
if ($this->_isBml) {
529-
$this->_api->setFundingSource('BML');
527+
$this->_getApi()->setFundingSource('BML');
530528
}
531529

532530
$this->_setBillingAgreementRequest();
533531

534532
if ($this->_config->getValue('requireBillingAddress') == PaypalConfig::REQUIRE_BILLING_ADDRESS_ALL) {
535-
$this->_api->setRequireBillingAddress(1);
533+
$this->_getApi()->setRequireBillingAddress(1);
536534
}
537535

538536
// suppress or export shipping address
@@ -541,15 +539,18 @@ public function start($returnUrl, $cancelUrl, $button = null)
541539
if ($this->_config->getValue('requireBillingAddress')
542540
== PaypalConfig::REQUIRE_BILLING_ADDRESS_VIRTUAL
543541
) {
544-
$this->_api->setRequireBillingAddress(1);
542+
$this->_getApi()->setRequireBillingAddress(1);
545543
}
546-
$this->_api->setSuppressShipping(true);
544+
$this->_getApi()->setSuppressShipping(true);
547545
} else {
546+
547+
$this->_getApi()->setBillingAddress($this->_quote->getBillingAddress());
548+
548549
$address = $this->_quote->getShippingAddress();
549550
$isOverridden = 0;
550551
if (true === $address->validate()) {
551552
$isOverridden = 1;
552-
$this->_api->setAddress($address);
553+
$this->_getApi()->setAddress($address);
553554
}
554555
$this->_quote->getPayment()->setAdditionalInformation(
555556
self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDDEN,
@@ -561,19 +562,19 @@ public function start($returnUrl, $cancelUrl, $button = null)
561562
/** @var $cart \Magento\Payment\Model\Cart */
562563
$cart = $this->_cartFactory->create(['salesModel' => $this->_quote]);
563564

564-
$this->_api->setPaypalCart($cart);
565+
$this->_getApi()->setPaypalCart($cart);
565566

566567
if (!$this->_taxData->getConfig()->priceIncludesTax()) {
567568
$this->setShippingOptions($cart, $address);
568569
}
569570

570-
$this->_config->exportExpressCheckoutStyleSettings($this->_api);
571+
$this->_config->exportExpressCheckoutStyleSettings($this->_getApi());
571572

572573
/* Temporary solution. @TODO: do not pass quote into Nvp model */
573-
$this->_api->setQuote($this->_quote);
574-
$this->_api->callSetExpressCheckout();
574+
$this->_getApi()->setQuote($this->_quote);
575+
$this->_getApi()->callSetExpressCheckout();
575576

576-
$token = $this->_api->getToken();
577+
$token = $this->_getApi()->getToken();
577578

578579
$this->_setRedirectUrl($button, $token);
579580

@@ -613,15 +614,15 @@ public function canSkipOrderReviewStep()
613614
*/
614615
public function returnFromPaypal($token)
615616
{
616-
$this->_getApi();
617-
$this->_api->setToken($token)
617+
$this->_getApi()
618+
->setToken($token)
618619
->callGetExpressCheckoutDetails();
619620
$quote = $this->_quote;
620621

621622
$this->ignoreAddressValidation();
622623

623624
// import shipping address
624-
$exportedShippingAddress = $this->_api->getExportedShippingAddress();
625+
$exportedShippingAddress = $this->_getApi()->getExportedShippingAddress();
625626
if (!$quote->getIsVirtual()) {
626627
$shippingAddress = $quote->getShippingAddress();
627628
if ($shippingAddress) {
@@ -640,8 +641,8 @@ public function returnFromPaypal($token)
640641

641642
// import shipping method
642643
$code = '';
643-
if ($this->_api->getShippingRateCode()) {
644-
$code = $this->_matchShippingMethodCode($shippingAddress, $this->_api->getShippingRateCode());
644+
if ($this->_getApi()->getShippingRateCode()) {
645+
$code = $this->_matchShippingMethodCode($shippingAddress, $this->_getApi()->getShippingRateCode());
645646
if ($code) {
646647
// possible bug of double collecting rates :-/
647648
$shippingAddress->setShippingMethod($code)->setCollectShippingRates(true);
@@ -670,17 +671,18 @@ public function returnFromPaypal($token)
670671
} else {
671672
$billingAddress = $quote->getBillingAddress();
672673
}
673-
$exportedBillingAddress = $this->_api->getExportedBillingAddress();
674+
$exportedBillingAddress = $this->_getApi()->getExportedBillingAddress();
674675

675676
$this->_setExportedAddressData($billingAddress, $exportedBillingAddress);
676677
$billingAddress->setCustomerNote($exportedBillingAddress->getData('note'));
677678
$quote->setBillingAddress($billingAddress);
679+
$quote->setCheckoutMethod($this->getCheckoutMethod());
678680

679681
// import payment info
680682
$payment = $quote->getPayment();
681683
$payment->setMethod($this->_methodType);
682-
$this->_paypalInfo->importToPayment($this->_api, $payment);
683-
$payment->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID, $this->_api->getPayerId())
684+
$this->_paypalInfo->importToPayment($this->_getApi(), $payment);
685+
$payment->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID, $this->_getApi()->getPayerId())
684686
->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_TOKEN, $token);
685687
$quote->collectTotals();
686688
$this->quoteRepository->save($quote);
@@ -724,8 +726,7 @@ public function getShippingOptionsCallbackResponse(array $request)
724726

725727
try {
726728
// obtain addresses
727-
$this->_getApi();
728-
$address = $this->_api->prepareShippingOptionsCallbackAddress($request);
729+
$address = $this->_getApi()->prepareShippingOptionsCallbackAddress($request);
729730
$quoteAddress = $this->_quote->getShippingAddress();
730731

731732
// compare addresses, calculate shipping rates and prepare response
@@ -738,7 +739,7 @@ public function getShippingOptionsCallbackResponse(array $request)
738739
$this->totalsCollector->collectAddressTotals($this->_quote, $quoteAddress);
739740
$options = $this->_prepareShippingOptions($quoteAddress, false, true);
740741
}
741-
$response = $this->_api->setShippingOptions($options)->formatShippingOptionsCallback();
742+
$response = $this->_getApi()->setShippingOptions($options)->formatShippingOptionsCallback();
742743

743744
// log request and response
744745
$debugData['response'] = $response;
@@ -956,7 +957,7 @@ protected function _setBillingAgreementRequest()
956957
if (!$this->_agreementFactory->create()->needToCreateForCustomer($this->_customerId)) {
957958
return $this;
958959
}
959-
$this->_api->setBillingType($this->_api->getBillingAgreementType());
960+
$this->_getApi()->setBillingType($this->_getApi()->getBillingAgreementType());
960961
return $this;
961962
}
962963

@@ -1129,7 +1130,7 @@ public function getCustomerSession()
11291130
private function setShippingOptions(PaypalCart $cart, Address $address = null)
11301131
{
11311132
// for included tax always disable line items (related to paypal amount rounding problem)
1132-
$this->_api->setIsLineItemsEnabled($this->_config->getValue(PaypalConfig::TRANSFER_CART_LINE_ITEMS));
1133+
$this->_getApi()->setIsLineItemsEnabled($this->_config->getValue(PaypalConfig::TRANSFER_CART_LINE_ITEMS));
11331134

11341135
// add shipping options if needed and line items are available
11351136
$cartItems = $cart->getAllItems();
@@ -1140,7 +1141,7 @@ private function setShippingOptions(PaypalCart $cart, Address $address = null)
11401141
if (!$this->_quote->getIsVirtual()) {
11411142
$options = $this->_prepareShippingOptions($address, true);
11421143
if ($options) {
1143-
$this->_api->setShippingOptionsCallbackUrl(
1144+
$this->_getApi()->setShippingOptionsCallbackUrl(
11441145
$this->_coreUrl->getUrl(
11451146
'*/*/shippingOptionsCallback',
11461147
['quote_id' => $this->_quote->getId()]

0 commit comments

Comments
 (0)