Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #21357: [Backport] Removed direct use of SessionManager class, used SessionManagerInterface instead (by @mage2pratik)
 - #21202: [Backport] Issue fix #20010 Wrong price amount in opengraph (by @mage2pratik)
 - #20970: [backport] admin-store-view-label-not-alignment-2 (by @amol2jcommerce)
 - #21207: [Backport] disable add to cart until page load (by @amol2jcommerce)
 - #21344: [Backport] Added translation for comment tag (by @yogeshsuhagiya)
 - #21213: [backport] Focus not proper on configurable product swatches 2.2 (by @amol2jcommerce)
 - #21317: [Backport] Minimum Qty Allowed in Shopping Cart not working on related product (by @mageprince)
 - #20743: [Backport] bundle-product-radio-button-misalign (by @amol2jcommerce)


Fixed GitHub Issues:
 - #19274: Why is SessionManager used instead of its Interface? (reported by @dyuk1987) has been fixed in #21357 by @mage2pratik in 2.2-develop branch
   Related commits:
     1. f5df1a8
     2. 737a79e

 - #20010: Wrong price amount in opengraph (reported by @jcourtei) has been fixed in #21202 by @mage2pratik in 2.2-develop branch
   Related commits:
     1. 85cdc9d

 - #20518: On Bundle product radio button misalign (reported by @parag2jcommerce) has been fixed in #20743 by @amol2jcommerce in 2.2-develop branch
   Related commits:
     1. f0032ee
     2. 1a05beb
     3. 927408d
  • Loading branch information
magento-engcom-team authored Feb 23, 2019
2 parents 802fa5d + f73ddcb commit f69bf0c
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<button type="submit"
title="<?= /* @escapeNotVerified */ $buttonTitle ?>"
class="action primary tocart"
id="product-addtocart-button">
id="product-addtocart-button" disabled>
<span><?= /* @escapeNotVerified */ $buttonTitle ?></span>
</button>
<?= $block->getChildHtml('', true) ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />
<meta property="og:description" content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" />
<meta property="og:url" content="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>" />
<?php if ($priceAmount = $block->getProduct()->getFinalPrice()):?>
<?php if ($priceAmount = $block->getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()):?>
<meta property="product:price:amount" content="<?= /* @escapeNotVerified */ $priceAmount ?>"/>
<?= $block->getChildHtml('meta.currency') ?>
<?php endif;?>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ define([
$.widget('mage.productValidate', {
options: {
bindSubmit: false,
radioCheckboxClosest: '.nested'
radioCheckboxClosest: '.nested',
addToCartButtonSelector: '.action.tocart'
},

/**
Expand Down Expand Up @@ -41,6 +42,7 @@ define([
return false;
}
});
$(this.options.addToCartButtonSelector).attr('disabled', false);
}
});

Expand Down
40 changes: 26 additions & 14 deletions app/code/Magento/Checkout/Model/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Shopping cart model
*
* @api
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @deprecated 100.1.0 Use \Magento\Quote\Model\Quote instead
*/
Expand Down Expand Up @@ -354,22 +355,10 @@ protected function _getProductRequest($requestInfo)
public function addProduct($productInfo, $requestInfo = null)
{
$product = $this->_getProduct($productInfo);
$request = $this->_getProductRequest($requestInfo);
$productId = $product->getId();

if ($productId) {
$stockItem = $this->stockRegistry->getStockItem($productId, $product->getStore()->getWebsiteId());
$minimumQty = $stockItem->getMinSaleQty();
//If product quantity is not specified in request and there is set minimal qty for it
if ($minimumQty
&& $minimumQty > 0
&& !$request->getQty()
) {
$request->setQty($minimumQty);
}
}

if ($productId) {
$request = $this->getQtyRequest($product, $requestInfo);
try {
$result = $this->getQuote()->addProduct($product, $request);
} catch (\Magento\Framework\Exception\LocalizedException $e) {
Expand Down Expand Up @@ -425,8 +414,9 @@ public function addProductsByIds($productIds)
}
$product = $this->_getProduct($productId);
if ($product->getId() && $product->isVisibleInCatalog()) {
$request = $this->getQtyRequest($product);
try {
$this->getQuote()->addProduct($product);
$this->getQuote()->addProduct($product, $request);
} catch (\Exception $e) {
$allAdded = false;
}
Expand Down Expand Up @@ -747,4 +737,26 @@ private function getRequestInfoFilter()
}
return $this->requestInfoFilter;
}

/**
* Get request quantity
*
* @param Product $product
* @param \Magento\Framework\DataObject|int|array $request
* @return int|DataObject
*/
private function getQtyRequest($product, $request = 0)
{
$request = $this->_getProductRequest($request);
$stockItem = $this->stockRegistry->getStockItem($product->getId(), $product->getStore()->getWebsiteId());
$minimumQty = $stockItem->getMinSaleQty();
//If product quantity is not specified in request and there is set minimal qty for it
if ($minimumQty
&& $minimumQty > 0
&& !$request->getQty()
) {
$request->setQty($minimumQty);
}
return $request;
}
}
11 changes: 8 additions & 3 deletions app/code/Magento/Customer/CustomerData/Plugin/SessionChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
*/
namespace Magento\Customer\CustomerData\Plugin;

use Magento\Framework\Session\SessionManager;
use Magento\Framework\Session\SessionManagerInterface;
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
use Magento\Framework\Stdlib\Cookie\PhpCookieManager;

/**
* Class SessionChecker
*/
class SessionChecker
{
/**
Expand Down Expand Up @@ -36,10 +39,12 @@ public function __construct(
/**
* Delete frontend session cookie if customer session is expired
*
* @param SessionManager $sessionManager
* @param SessionManagerInterface $sessionManager
* @return void
* @throws \Magento\Framework\Exception\InputException
* @throws \Magento\Framework\Stdlib\Cookie\FailureToSendException
*/
public function beforeStart(SessionManager $sessionManager)
public function beforeStart(SessionManagerInterface $sessionManager)
{
if (!$this->cookieManager->getCookie($sessionManager->getName())
&& $this->cookieManager->getCookie('mage-cache-sessid')
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Customer/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<type name="Magento\Checkout\Block\Cart\Sidebar">
<plugin name="customer_cart" type="Magento\Customer\Model\Cart\ConfigPlugin" />
</type>
<type name="Magento\Framework\Session\SessionManager">
<type name="Magento\Framework\Session\SessionManagerInterface">
<plugin name="session_checker" type="Magento\Customer\CustomerData\Plugin\SessionChecker" />
</type>
<type name="Magento\Authorization\Model\CompositeUserContext">
Expand All @@ -77,4 +77,4 @@
</argument>
</arguments>
</type>
</config>
</config>
2 changes: 1 addition & 1 deletion app/code/Magento/Msrp/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<section id="sales">
<group id="msrp" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Minimum Advertised Price</label>
<field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<label>Enable MAP</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Msrp/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Price,Price
"Add to Cart","Add to Cart"
"Minimum Advertised Price","Minimum Advertised Price"
"Enable MAP","Enable MAP"
"<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."
"Display Actual Price","Display Actual Price"
"Default Popup Text Message","Default Popup Text Message"
"Default ""What's This"" Text Message","Default ""What's This"" Text Message"
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\Session\Generic;
use Magento\Framework\Session\SessionManager;
use Magento\Framework\Session\SessionManagerInterface;
use Magento\Paypal\Model\Payflow\Service\Request\SecureToken;
use Magento\Paypal\Model\Payflow\Transparent;
use Magento\Quote\Model\Quote;
Expand Down Expand Up @@ -39,7 +40,7 @@ class RequestSecureToken extends \Magento\Framework\App\Action\Action
private $secureTokenService;

/**
* @var SessionManager
* @var SessionManager|SessionManagerInterface
*/
private $sessionManager;

Expand All @@ -55,19 +56,21 @@ class RequestSecureToken extends \Magento\Framework\App\Action\Action
* @param SecureToken $secureTokenService
* @param SessionManager $sessionManager
* @param Transparent $transparent
* @param SessionManagerInterface|null $sessionInterface
*/
public function __construct(
Context $context,
JsonFactory $resultJsonFactory,
Generic $sessionTransparent,
SecureToken $secureTokenService,
SessionManager $sessionManager,
Transparent $transparent
Transparent $transparent,
SessionManagerInterface $sessionInterface = null
) {
$this->resultJsonFactory = $resultJsonFactory;
$this->sessionTransparent = $sessionTransparent;
$this->secureTokenService = $secureTokenService;
$this->sessionManager = $sessionManager;
$this->sessionManager = $sessionInterface ?: $sessionManager;
$this->transparent = $transparent;
parent::__construct($context);
}
Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/Swatches/view/frontend/web/css/swatches.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
margin-top: 10px;
}

.swatch-attribute-options:focus {
box-shadow: none;
}

.swatch-option {
/*width: 30px;*/
padding: 1px 2px;
Expand All @@ -47,6 +51,10 @@
text-overflow: ellipsis;
}

.swatch-option:focus {
box-shadow: 0 0 3px 1px #68a8e0;
}

.swatch-option.text {
background: #F0F0F0;
color: #686868;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@
.store-view {
&:not(.store-switcher) {
float: left;
margin-top: 13px;
}

.store-switcher-label {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
.field.choice {
input {
float: left;
margin-top: 4px;
}

input[type='checkbox'] {
margin-top: 2px;
}

.label {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@
}

.product-options-wrapper {
.fieldset {
&:focus {
box-shadow: none;
}
}
.fieldset-product-options-inner {
.legend {
.lib-css(font-weight, @font-weight__semibold);
Expand Down
9 changes: 7 additions & 2 deletions lib/internal/Magento/Framework/View/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Magento\Framework\Event\ManagerInterface;
use Psr\Log\LoggerInterface as Logger;
use Magento\Framework\Session\SessionManager;
use Magento\Framework\Session\SessionManagerInterface;
use Magento\Framework\TranslateInterface;
use Magento\Framework\UrlInterface;
use Magento\Framework\View\ConfigInterface as ViewConfig;
Expand Down Expand Up @@ -144,6 +145,7 @@ class Context
* @param Logger $logger
* @param AppState $appState
* @param LayoutInterface $layout
* @param SessionManagerInterface|null $sessionManager
*
* @todo reduce parameter number
*
Expand All @@ -163,15 +165,16 @@ public function __construct(
CacheState $cacheState,
Logger $logger,
AppState $appState,
LayoutInterface $layout
LayoutInterface $layout,
SessionManagerInterface $sessionManager = null
) {
$this->request = $request;
$this->eventManager = $eventManager;
$this->urlBuilder = $urlBuilder;
$this->translator = $translator;
$this->cache = $cache;
$this->design = $design;
$this->session = $session;
$this->session = $sessionManager ?: $session;
$this->scopeConfig = $scopeConfig;
$this->frontController = $frontController;
$this->viewConfig = $viewConfig;
Expand Down Expand Up @@ -332,6 +335,8 @@ public function getModuleName()
}

/**
* Get Front Name
*
* @see getModuleName
*/
public function getFrontName()
Expand Down

0 comments on commit f69bf0c

Please sign in to comment.