Skip to content

Commit f69bf0c

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - magento#21357: [Backport] Removed direct use of SessionManager class, used SessionManagerInterface instead (by @mage2pratik) - magento#21202: [Backport] Issue fix magento#20010 Wrong price amount in opengraph (by @mage2pratik) - magento#20970: [backport] admin-store-view-label-not-alignment-2 (by @amol2jcommerce) - magento#21207: [Backport] disable add to cart until page load (by @amol2jcommerce) - magento#21344: [Backport] Added translation for comment tag (by @yogeshsuhagiya) - magento#21213: [backport] Focus not proper on configurable product swatches 2.2 (by @amol2jcommerce) - magento#21317: [Backport] Minimum Qty Allowed in Shopping Cart not working on related product (by @mageprince) - magento#20743: [Backport] bundle-product-radio-button-misalign (by @amol2jcommerce) Fixed GitHub Issues: - magento#19274: Why is SessionManager used instead of its Interface? (reported by @dyuk1987) has been fixed in magento#21357 by @mage2pratik in 2.2-develop branch Related commits: 1. f5df1a8 2. 737a79e - magento#20010: Wrong price amount in opengraph (reported by @jcourtei) has been fixed in magento#21202 by @mage2pratik in 2.2-develop branch Related commits: 1. 85cdc9d - magento#20518: On Bundle product radio button misalign (reported by @parag2jcommerce) has been fixed in magento#20743 by @amol2jcommerce in 2.2-develop branch Related commits: 1. f0032ee 2. 1a05beb 3. 927408d
2 parents 802fa5d + f73ddcb commit f69bf0c

File tree

14 files changed

+75
-28
lines changed

14 files changed

+75
-28
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<button type="submit"
3434
title="<?= /* @escapeNotVerified */ $buttonTitle ?>"
3535
class="action primary tocart"
36-
id="product-addtocart-button">
36+
id="product-addtocart-button" disabled>
3737
<span><?= /* @escapeNotVerified */ $buttonTitle ?></span>
3838
</button>
3939
<?= $block->getChildHtml('', true) ?>

app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />
1515
<meta property="og:description" content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" />
1616
<meta property="og:url" content="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>" />
17-
<?php if ($priceAmount = $block->getProduct()->getFinalPrice()):?>
17+
<?php if ($priceAmount = $block->getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()):?>
1818
<meta property="product:price:amount" content="<?= /* @escapeNotVerified */ $priceAmount ?>"/>
1919
<?= $block->getChildHtml('meta.currency') ?>
2020
<?php endif;?>

app/code/Magento/Catalog/view/frontend/web/js/validate-product.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ define([
1313
$.widget('mage.productValidate', {
1414
options: {
1515
bindSubmit: false,
16-
radioCheckboxClosest: '.nested'
16+
radioCheckboxClosest: '.nested',
17+
addToCartButtonSelector: '.action.tocart'
1718
},
1819

1920
/**
@@ -41,6 +42,7 @@ define([
4142
return false;
4243
}
4344
});
45+
$(this.options.addToCartButtonSelector).attr('disabled', false);
4446
}
4547
});
4648

app/code/Magento/Checkout/Model/Cart.php

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Shopping cart model
1616
*
1717
* @api
18+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1819
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1920
* @deprecated 100.1.0 Use \Magento\Quote\Model\Quote instead
2021
*/
@@ -354,22 +355,10 @@ protected function _getProductRequest($requestInfo)
354355
public function addProduct($productInfo, $requestInfo = null)
355356
{
356357
$product = $this->_getProduct($productInfo);
357-
$request = $this->_getProductRequest($requestInfo);
358358
$productId = $product->getId();
359359

360360
if ($productId) {
361-
$stockItem = $this->stockRegistry->getStockItem($productId, $product->getStore()->getWebsiteId());
362-
$minimumQty = $stockItem->getMinSaleQty();
363-
//If product quantity is not specified in request and there is set minimal qty for it
364-
if ($minimumQty
365-
&& $minimumQty > 0
366-
&& !$request->getQty()
367-
) {
368-
$request->setQty($minimumQty);
369-
}
370-
}
371-
372-
if ($productId) {
361+
$request = $this->getQtyRequest($product, $requestInfo);
373362
try {
374363
$result = $this->getQuote()->addProduct($product, $request);
375364
} catch (\Magento\Framework\Exception\LocalizedException $e) {
@@ -425,8 +414,9 @@ public function addProductsByIds($productIds)
425414
}
426415
$product = $this->_getProduct($productId);
427416
if ($product->getId() && $product->isVisibleInCatalog()) {
417+
$request = $this->getQtyRequest($product);
428418
try {
429-
$this->getQuote()->addProduct($product);
419+
$this->getQuote()->addProduct($product, $request);
430420
} catch (\Exception $e) {
431421
$allAdded = false;
432422
}
@@ -747,4 +737,26 @@ private function getRequestInfoFilter()
747737
}
748738
return $this->requestInfoFilter;
749739
}
740+
741+
/**
742+
* Get request quantity
743+
*
744+
* @param Product $product
745+
* @param \Magento\Framework\DataObject|int|array $request
746+
* @return int|DataObject
747+
*/
748+
private function getQtyRequest($product, $request = 0)
749+
{
750+
$request = $this->_getProductRequest($request);
751+
$stockItem = $this->stockRegistry->getStockItem($product->getId(), $product->getStore()->getWebsiteId());
752+
$minimumQty = $stockItem->getMinSaleQty();
753+
//If product quantity is not specified in request and there is set minimal qty for it
754+
if ($minimumQty
755+
&& $minimumQty > 0
756+
&& !$request->getQty()
757+
) {
758+
$request->setQty($minimumQty);
759+
}
760+
return $request;
761+
}
750762
}

app/code/Magento/Customer/CustomerData/Plugin/SessionChecker.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
*/
66
namespace Magento\Customer\CustomerData\Plugin;
77

8-
use Magento\Framework\Session\SessionManager;
8+
use Magento\Framework\Session\SessionManagerInterface;
99
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
1010
use Magento\Framework\Stdlib\Cookie\PhpCookieManager;
1111

12+
/**
13+
* Class SessionChecker
14+
*/
1215
class SessionChecker
1316
{
1417
/**
@@ -36,10 +39,12 @@ public function __construct(
3639
/**
3740
* Delete frontend session cookie if customer session is expired
3841
*
39-
* @param SessionManager $sessionManager
42+
* @param SessionManagerInterface $sessionManager
4043
* @return void
44+
* @throws \Magento\Framework\Exception\InputException
45+
* @throws \Magento\Framework\Stdlib\Cookie\FailureToSendException
4146
*/
42-
public function beforeStart(SessionManager $sessionManager)
47+
public function beforeStart(SessionManagerInterface $sessionManager)
4348
{
4449
if (!$this->cookieManager->getCookie($sessionManager->getName())
4550
&& $this->cookieManager->getCookie('mage-cache-sessid')

app/code/Magento/Customer/etc/frontend/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<type name="Magento\Checkout\Block\Cart\Sidebar">
5858
<plugin name="customer_cart" type="Magento\Customer\Model\Cart\ConfigPlugin" />
5959
</type>
60-
<type name="Magento\Framework\Session\SessionManager">
60+
<type name="Magento\Framework\Session\SessionManagerInterface">
6161
<plugin name="session_checker" type="Magento\Customer\CustomerData\Plugin\SessionChecker" />
6262
</type>
6363
<type name="Magento\Authorization\Model\CompositeUserContext">
@@ -77,4 +77,4 @@
7777
</argument>
7878
</arguments>
7979
</type>
80-
</config>
80+
</config>

app/code/Magento/Msrp/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<section id="sales">
1111
<group id="msrp" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0">
1212
<label>Minimum Advertised Price</label>
13-
<field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
13+
<field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
1414
<label>Enable MAP</label>
1515
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
1616
<comment>

app/code/Magento/Msrp/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Price,Price
1313
"Add to Cart","Add to Cart"
1414
"Minimum Advertised Price","Minimum Advertised Price"
1515
"Enable MAP","Enable MAP"
16+
"<strong style=""color:red"">Warning!</strong> Enabling MAP by default will hide all product prices on Storefront.","<strong style=""color:red"">Warning!</strong> Enabling MAP by default will hide all product prices on Storefront."
1617
"Display Actual Price","Display Actual Price"
1718
"Default Popup Text Message","Default Popup Text Message"
1819
"Default ""What's This"" Text Message","Default ""What's This"" Text Message"

app/code/Magento/Paypal/Controller/Transparent/RequestSecureToken.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\Controller\ResultInterface;
1212
use Magento\Framework\Session\Generic;
1313
use Magento\Framework\Session\SessionManager;
14+
use Magento\Framework\Session\SessionManagerInterface;
1415
use Magento\Paypal\Model\Payflow\Service\Request\SecureToken;
1516
use Magento\Paypal\Model\Payflow\Transparent;
1617
use Magento\Quote\Model\Quote;
@@ -39,7 +40,7 @@ class RequestSecureToken extends \Magento\Framework\App\Action\Action
3940
private $secureTokenService;
4041

4142
/**
42-
* @var SessionManager
43+
* @var SessionManager|SessionManagerInterface
4344
*/
4445
private $sessionManager;
4546

@@ -55,19 +56,21 @@ class RequestSecureToken extends \Magento\Framework\App\Action\Action
5556
* @param SecureToken $secureTokenService
5657
* @param SessionManager $sessionManager
5758
* @param Transparent $transparent
59+
* @param SessionManagerInterface|null $sessionInterface
5860
*/
5961
public function __construct(
6062
Context $context,
6163
JsonFactory $resultJsonFactory,
6264
Generic $sessionTransparent,
6365
SecureToken $secureTokenService,
6466
SessionManager $sessionManager,
65-
Transparent $transparent
67+
Transparent $transparent,
68+
SessionManagerInterface $sessionInterface = null
6669
) {
6770
$this->resultJsonFactory = $resultJsonFactory;
6871
$this->sessionTransparent = $sessionTransparent;
6972
$this->secureTokenService = $secureTokenService;
70-
$this->sessionManager = $sessionManager;
73+
$this->sessionManager = $sessionInterface ?: $sessionManager;
7174
$this->transparent = $transparent;
7275
parent::__construct($context);
7376
}

app/code/Magento/Swatches/view/frontend/web/css/swatches.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
margin-top: 10px;
3232
}
3333

34+
.swatch-attribute-options:focus {
35+
box-shadow: none;
36+
}
37+
3438
.swatch-option {
3539
/*width: 30px;*/
3640
padding: 1px 2px;
@@ -47,6 +51,10 @@
4751
text-overflow: ellipsis;
4852
}
4953

54+
.swatch-option:focus {
55+
box-shadow: 0 0 3px 1px #68a8e0;
56+
}
57+
5058
.swatch-option.text {
5159
background: #F0F0F0;
5260
color: #686868;

app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@
236236
.store-view {
237237
&:not(.store-switcher) {
238238
float: left;
239+
margin-top: 13px;
239240
}
240241

241242
.store-switcher-label {

app/design/frontend/Magento/luma/Magento_Bundle/web/css/source/_module.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
.field.choice {
5959
input {
6060
float: left;
61+
margin-top: 4px;
62+
}
63+
64+
input[type='checkbox'] {
65+
margin-top: 2px;
6166
}
6267

6368
.label {

app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@
294294
}
295295

296296
.product-options-wrapper {
297+
.fieldset {
298+
&:focus {
299+
box-shadow: none;
300+
}
301+
}
297302
.fieldset-product-options-inner {
298303
.legend {
299304
.lib-css(font-weight, @font-weight__semibold);

lib/internal/Magento/Framework/View/Context.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Framework\Event\ManagerInterface;
1515
use Psr\Log\LoggerInterface as Logger;
1616
use Magento\Framework\Session\SessionManager;
17+
use Magento\Framework\Session\SessionManagerInterface;
1718
use Magento\Framework\TranslateInterface;
1819
use Magento\Framework\UrlInterface;
1920
use Magento\Framework\View\ConfigInterface as ViewConfig;
@@ -144,6 +145,7 @@ class Context
144145
* @param Logger $logger
145146
* @param AppState $appState
146147
* @param LayoutInterface $layout
148+
* @param SessionManagerInterface|null $sessionManager
147149
*
148150
* @todo reduce parameter number
149151
*
@@ -163,15 +165,16 @@ public function __construct(
163165
CacheState $cacheState,
164166
Logger $logger,
165167
AppState $appState,
166-
LayoutInterface $layout
168+
LayoutInterface $layout,
169+
SessionManagerInterface $sessionManager = null
167170
) {
168171
$this->request = $request;
169172
$this->eventManager = $eventManager;
170173
$this->urlBuilder = $urlBuilder;
171174
$this->translator = $translator;
172175
$this->cache = $cache;
173176
$this->design = $design;
174-
$this->session = $session;
177+
$this->session = $sessionManager ?: $session;
175178
$this->scopeConfig = $scopeConfig;
176179
$this->frontController = $frontController;
177180
$this->viewConfig = $viewConfig;
@@ -332,6 +335,8 @@ public function getModuleName()
332335
}
333336

334337
/**
338+
* Get Front Name
339+
*
335340
* @see getModuleName
336341
*/
337342
public function getFrontName()

0 commit comments

Comments
 (0)