Skip to content

Commit

Permalink
Merge pull request #86 from magento-commerce/1.1.11
Browse files Browse the repository at this point in the history
1.1.11 Release
  • Loading branch information
katmoon authored Mar 8, 2022
2 parents 428026a + 235f218 commit 6d66bed
Show file tree
Hide file tree
Showing 13 changed files with 1,516 additions and 4 deletions.
2 changes: 1 addition & 1 deletion patches-info.json

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions patches/commerce/MDVA-40830_2.4.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/vendor/magento/module-customer-balance/Model/Plugin/CollectQuoteTotalsPlugin.php b/vendor/magento/module-customer-balance/Model/Plugin/CollectQuoteTotalsPlugin.php
new file mode 100644
index 00000000000..7148ee02e4e
--- /dev/null
+++ b/vendor/magento/module-customer-balance/Model/Plugin/CollectQuoteTotalsPlugin.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\CustomerBalance\Model\Plugin;
+
+use Magento\Quote\Model\Quote;
+
+class CollectQuoteTotalsPlugin
+{
+ /**
+ * Reset quote used customer balance amount
+ *
+ * @param \Magento\Quote\Model\Quote\TotalsCollector $subject
+ * @param Quote $quote
+ *
+ * @return void
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function beforeCollectQuoteTotals(
+ \Magento\Quote\Model\Quote\TotalsCollector $subject,
+ Quote $quote
+ ) {
+ $quote->setBaseCustomerBalAmountUsed(0);
+ $quote->setCustomerBalanceAmountUsed(0);
+ }
+}
\ No newline at end of file
diff --git a/vendor/magento/module-customer-balance/etc/graphql/di.xml b/vendor/magento/module-customer-balance/etc/graphql/di.xml
new file mode 100644
index 00000000000..aee150823f4
--- /dev/null
+++ b/vendor/magento/module-customer-balance/etc/graphql/di.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
+ <type name ="Magento\Quote\Model\Quote\TotalsCollector">
+ <plugin name="quoteCollectTotalsPlugin" type="Magento\CustomerBalance\Model\Plugin\CollectQuoteTotalsPlugin" />
+ </type>
+</config>
\ No newline at end of file
43 changes: 43 additions & 0 deletions patches/commerce/MDVA-41350_2.3.5-p1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff --git a/vendor/magento/module-advanced-checkout/Model/Cart.php b/vendor/magento/module-advanced-checkout/Model/Cart.php
index 6322a62989b6..762757c8b5ee 100644
--- a/vendor/magento/module-advanced-checkout/Model/Cart.php
+++ b/vendor/magento/module-advanced-checkout/Model/Cart.php
@@ -33,17 +33,17 @@ class Cart extends \Magento\Framework\DataObject implements \Magento\Checkout\Mo
/**
* Context of the cart - admin order
*/
- const CONTEXT_ADMIN_ORDER = 'admin_order';
+ public const CONTEXT_ADMIN_ORDER = 'admin_order';

/**
* Context of the cart - admin checkout
*/
- const CONTEXT_ADMIN_CHECKOUT = 'admin_checkout';
+ public const CONTEXT_ADMIN_CHECKOUT = 'admin_checkout';

/**
* Context of the cart - frontend
*/
- const CONTEXT_FRONTEND = 'frontend';
+ public const CONTEXT_FRONTEND = 'frontend';

/**
* Context of the cart
@@ -126,7 +126,7 @@ class Cart extends \Magento\Framework\DataObject implements \Magento\Checkout\Mo
protected $quoteRepository;

/**
- * Wishlist factory
+ * Wishlist factory model
*
* @var \Magento\Wishlist\Model\WishlistFactory
*/
@@ -976,7 +976,7 @@ protected function _loadProductBySku($sku)
try {
$product = $this->productRepository->get($sku, false, $storeId);
$this->addProductToLocalCache($product, $storeId);
- } catch (NoSuchEntityException $e) {
+ } catch (\Magento\Framework\Exception\LocalizedException $e) {
return false;
}
}
126 changes: 126 additions & 0 deletions patches/commerce/MDVA-42520_2.4.3-p1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
diff --git a/vendor/magento/module-negotiable-quote/Model/Customer/StoreCustomerRate.php b/vendor/magento/module-negotiable-quote/Model/Customer/StoreCustomerRate.php
index cbc1d08882..f36acf8184 100644
--- a/vendor/magento/module-negotiable-quote/Model/Customer/StoreCustomerRate.php
+++ b/vendor/magento/module-negotiable-quote/Model/Customer/StoreCustomerRate.php
@@ -62,6 +62,8 @@ class StoreCustomerRate
}

/**
+ * Inits the quote.
+ *
* @param CartInterface $quote
*/
public function init(CartInterface $quote)
@@ -71,6 +73,8 @@ class StoreCustomerRate
}

/**
+ * Returns tax rate factor.
+ *
* @param CartItemInterface $cartItem
* @return float
* @throws LocalizedException
@@ -80,7 +84,7 @@ class StoreCustomerRate
{
$taxRateFactor = 1.0;

- if ($this->hasNegotiatedPrice() && $this->taxConfig->priceIncludesTax($cartItem->getStoreId())) {
+ if ($this->isTaxFactorApplicable((int)$cartItem->getStoreId())) {
$customerRate = $this->getCustomerRate($cartItem);
$storeRate = $this->getStoreRate($cartItem);

@@ -91,6 +95,8 @@ class StoreCustomerRate
}

/**
+ * Returns customer tax rate factor.
+ *
* @param CartItemInterface $cartItem
* @return float
* @throws LocalizedException
@@ -100,7 +106,7 @@ class StoreCustomerRate
{
$taxRateFactor = 1.0;

- if ($this->hasNegotiatedPrice() && $this->taxConfig->priceIncludesTax($cartItem->getStoreId())) {
+ if ($this->isTaxFactorApplicable((int)$cartItem->getStoreId())) {
$customerRate = $this->getCustomerRate($cartItem);

$taxRateFactor = (100 + $customerRate) / 100;
@@ -110,6 +116,8 @@ class StoreCustomerRate
}

/**
+ * Returns store tax rate factor.
+ *
* @param CartItemInterface $cartItem
* @return float
* @throws LocalizedException
@@ -118,8 +126,7 @@ class StoreCustomerRate
public function getStoreTaxRateFactor(CartItemInterface $cartItem): float
{
$taxRateFactor = 1.0;
-
- if ($this->hasNegotiatedPrice() && $this->taxConfig->priceIncludesTax($cartItem->getStoreId())) {
+ if ($this->isTaxFactorApplicable((int)$cartItem->getStoreId())) {
$storeRate = $this->getStoreRate($cartItem);

$taxRateFactor = (100 + $storeRate) / 100;
@@ -129,6 +136,21 @@ class StoreCustomerRate
}

/**
+ * Checks whether tax factor calculation is applicable.
+ *
+ * @param int $storeId
+ * @return bool
+ */
+ private function isTaxFactorApplicable(int $storeId): bool
+ {
+ return $this->hasNegotiatedPrice()
+ && $this->taxConfig->priceIncludesTax($storeId)
+ && !$this->taxConfig->crossBorderTradeEnabled($storeId);
+ }
+
+ /**
+ * Checks negotiated price.
+ *
* @return bool
*/
private function hasNegotiatedPrice(): bool
@@ -146,6 +168,8 @@ class StoreCustomerRate
}

/**
+ * Returns customer rate.
+ *
* @param CartItemInterface $cartItem
* @return float
* @throws LocalizedException
@@ -160,6 +184,8 @@ class StoreCustomerRate
}

/**
+ * Returns store rate.
+ *
* @param CartItemInterface $cartItem
* @return float
* @throws LocalizedException
@@ -174,6 +200,8 @@ class StoreCustomerRate
}

/**
+ * Returns quote tax rate request.
+ *
* @return DataObject
* @throws LocalizedException
* @throws NoSuchEntityException
@@ -194,6 +222,8 @@ class StoreCustomerRate
}

/**
+ * Returns customer tax class.
+ *
* @return int
* @throws LocalizedException
* @throws NoSuchEntityException
99 changes: 99 additions & 0 deletions patches/commerce/MDVA-43195_2.4.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
diff --git a/vendor/magento/module-target-rule/Block/Checkout/Cart/Crosssell.php b/vendor/magento/module-target-rule/Block/Checkout/Cart/Crosssell.php
index dad5c739308..61c79e216b1 100644
--- a/vendor/magento/module-target-rule/Block/Checkout/Cart/Crosssell.php
+++ b/vendor/magento/module-target-rule/Block/Checkout/Cart/Crosssell.php
@@ -6,6 +6,8 @@
namespace Magento\TargetRule\Block\Checkout\Cart;

use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\TargetRule\Model\Rotation;
@@ -16,6 +18,7 @@ use Magento\TargetRule\Model\Rotation;
* @api
* @SuppressWarnings(PHPMD.LongVariable)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @since 100.0.2
*/
class Crosssell extends \Magento\TargetRule\Block\Product\AbstractProduct
@@ -473,9 +476,9 @@ class Crosssell extends \Magento\TargetRule\Block\Product\AbstractProduct
$collection = $this->getLinkCollection();
if ($collection) {
if ($this->_byLastAddedProduct) {
- $collection->addProductFilter($this->getLastAddedProduct()->getEntityId());
+ $collection->addProductFilter($this->getLastAddedProductLinkId());
} else {
- $filterProductIds = array_merge($this->_getCartProductIds(), $this->_getCartProductIdsRel());
+ $filterProductIds = array_merge($this->getCartProductLinkIds(), $this->getCartRelatedProductLinkIds());
$collection->addProductFilter($filterProductIds);
}
$collection->addExcludeProductFilter($this->_getExcludeProductIds());
@@ -532,4 +535,65 @@ class Crosssell extends \Magento\TargetRule\Block\Product\AbstractProduct
{
return count($this->getItemCollection());
}
+
+ /**
+ * Get cart products link IDs
+ *
+ * @return array
+ */
+ private function getCartProductLinkIds(): array
+ {
+ $linkField = $this->getProductLinkField();
+ $linkIds = [];
+ foreach ($this->_getCartProducts() as $product) {
+ /** * @var Product $product */
+ $linkIds[] = $product->getData($linkField);
+ }
+ return $linkIds;
+ }
+
+ /**
+ * Get last product added to cart link ID
+ *
+ * @return int
+ */
+ private function getLastAddedProductLinkId(): int
+ {
+ $linkField = $this->getProductLinkField();
+ return (int) $this->getLastAddedProduct()->getData($linkField);
+ }
+
+ /**
+ * Get product link ID field
+ *
+ * @return string
+ */
+ private function getProductLinkField(): string
+ {
+ /* @var $collection Collection */
+ $collection = $this->_productCollectionFactory->create();
+ return $collection->getProductEntityMetadata()->getLinkField();
+ }
+
+ /**
+ * Get cart related products link IDs
+ *
+ * @return array
+ */
+ private function getCartRelatedProductLinkIds(): array
+ {
+ $productIds = $this->_getCartProductIdsRel();
+ $linkIds = [];
+ if (!empty($productIds)) {
+ $linkField = $this->getProductLinkField();
+ /* @var $collection Collection */
+ $collection = $this->_productCollectionFactory->create();
+ $collection->addIdFilter($productIds);
+ foreach ($collection as $product) {
+ /** * @var Product $product */
+ $linkIds[] = $product->getData($linkField);
+ }
+ }
+ return $linkIds;
+ }
}
40 changes: 40 additions & 0 deletions patches/commerce/MDVA-43417_2.4.3-p1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/vendor/magento/module-customer-custom-attributes/view/frontend/templates/customer/form/register.phtml b/vendor/magento/module-customer-custom-attributes/view/frontend/templates/customer/form/register.phtml
index 626a9b36a64..5ac068a9482 100644
--- a/vendor/magento/module-customer-custom-attributes/view/frontend/templates/customer/form/register.phtml
+++ b/vendor/magento/module-customer-custom-attributes/view/frontend/templates/customer/form/register.phtml
@@ -6,6 +6,8 @@

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
/** @var \Magento\Framework\Escaper $escaper */
+/** @var \Magento\Customer\ViewModel\CreateAccountButton $createAccountButtonViewModel */
+$createAccountButtonViewModel = $block->getData('create_account_button_view_model');
?>
<?php
/**
@@ -316,7 +318,9 @@ $formData = $block->getFormData();
<div class="primary">
<button type="submit"
class="action submit primary"
- title="<?= $block->escapeHtmlAttr(__('Create an Account')) ?>">
+ title="<?= $block->escapeHtmlAttr(__('Create an Account')) ?>"
+ id="send2"
+ <?php if ($createAccountButtonViewModel->disabled()): ?> disabled="disabled" <?php endif; ?>>
<span><?= $block->escapeHtml(__('Create an Account')) ?></span>
</button>
</div>
@@ -332,6 +336,7 @@ $formData = $block->getFormData();
<?php
$displayAllRegions = $block->getConfig("general/region/display_all") ? "true" : "false";
?>
+<?php // phpcs:ignore Magento2.Legacy.PhtmlTemplate ?>
<script type="text/x-magento-init">
{
"#country": {
@@ -349,6 +354,7 @@ $formData = $block->getFormData();
}
</script>
<?php endif; ?>
+<?php // phpcs:ignore Magento2.Legacy.PhtmlTemplate ?>
<script type="text/x-magento-init">
{
"*": {
Loading

0 comments on commit 6d66bed

Please sign in to comment.