Skip to content

Commit 14a5702

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #15051: [Forwardport] Add statement to 'beforeSave' method to allow app:config:import (by @rogyar) - #15034: [Forwardport] fix: set message-success in setup if we already have the latest version (by @DanielRuf) - #15022: [2.3-develop] [ForwardPort] Port of #15020 Update Gallery Template to handle boolean config Variables (by @gwharton) - #15021: [2.3-develop] [ForwardPort] Port of #12285 The option <var name="allowfullscreen">false</var> for mobile device don't work in product view page gallery (by @gwharton) - #15081: [Forwardport] use "Module_Name::template/path" format instead of using template/path i� (by @adrian-martinez-interactiv4) - #15078: [Forwardport] Removed extra close tag (by @adrian-martinez-interactiv4) - #15075: [Forwardport] Removed extra spaces from language file (by @adrian-martinez-interactiv4) - #15073: [Forwardport] Changed return type of addToCartPostParams to array (by @adrian-martinez-interactiv4) - #15069: [Forwardport] Code cleanup, add more visibility (by @adrian-martinez-interactiv4) - #15083: [Forwardport] Fixed typos in .less files (by @adrian-martinez-interactiv4) - #15050: [Forwardport] Duplicate Order Confirmation Emails for PayPal Express checkout (by @rogyar) Fixed GitHub Issues: - #12285: The option <var name="allowfullscreen">false</var> for mobile device don't work in product view page gallery (reported by @novakivskiy) has been fixed in #15022 by @gwharton in 2.3-develop branch Related commits: 1. 163d4cc - #15009: [2.2.4] Gallery theme variables being ignored (reported by @gwharton) has been fixed in #15022 by @gwharton in 2.3-develop branch Related commits: 1. 163d4cc - #12285: The option <var name="allowfullscreen">false</var> for mobile device don't work in product view page gallery (reported by @novakivskiy) has been fixed in #15021 by @gwharton in 2.3-develop branch Related commits: 1. 435b165 2. 4113f26 3. c0b9e8f 4. 05b1512 5. 2701a4f
2 parents a53347e + 27e4708 commit 14a5702

File tree

15 files changed

+163
-112
lines changed

15 files changed

+163
-112
lines changed

app/code/Magento/Braintree/Model/Adminhtml/System/Config/CountryCreditCard.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ public function __construct(
6666
public function beforeSave()
6767
{
6868
$value = $this->getValue();
69+
if (!is_array($value)) {
70+
try {
71+
$value = $this->serializer->unserialize($value);
72+
} catch (\InvalidArgumentException $e) {
73+
$value = [];
74+
}
75+
}
6976
$result = [];
7077
foreach ($value as $data) {
7178
if (empty($data['country_id']) || empty($data['cc_types'])) {

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public function getIdentities()
356356
* Get post parameters
357357
*
358358
* @param Product $product
359-
* @return string
359+
* @return array
360360
*/
361361
public function getAddToCartPostParams(Product $product)
362362
{

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

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,11 @@
4747
"data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
4848
"options": {
4949
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>",
50-
<?php if (($block->getVar("gallery/loop"))): ?>
51-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ?>,
52-
<?php endif; ?>
53-
<?php if (($block->getVar("gallery/keyboard"))): ?>
54-
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ?>,
55-
<?php endif; ?>
56-
<?php if (($block->getVar("gallery/arrows"))): ?>
57-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ?>,
58-
<?php endif; ?>
59-
<?php if (($block->getVar("gallery/allowfullscreen"))): ?>
60-
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ?>,
61-
<?php endif; ?>
62-
<?php if (($block->getVar("gallery/caption"))): ?>
63-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ?>,
64-
<?php endif; ?>
50+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ? 'true' : 'false' ?>,
51+
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ? 'true' : 'false' ?>,
52+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ? 'true' : 'false' ?>,
53+
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ? 'true' : 'false' ?>,
54+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ? 'true' : 'false' ?>,
6555
"width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
6656
"thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
6757
<?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
@@ -76,28 +66,18 @@
7666
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
7767
<?php endif; ?>
7868
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
79-
<?php if (($block->getVar("gallery/navarrows"))): ?>
80-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ?>,
81-
<?php endif; ?>
69+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
8270
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
8371
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
8472
},
8573
"fullscreen": {
8674
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
87-
<?php if ($block->getVar("gallery/fullscreen/loop")): ?>
88-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ?>,
89-
<?php endif; ?>
75+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
9076
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
91-
<?php if ($block->getVar("gallery/transition/navarrows")): ?>
92-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ?>,
93-
<?php endif; ?>
77+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
9478
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
95-
<?php if ($block->getVar("gallery/fullscreen/arrows")): ?>
96-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ?>,
97-
<?php endif; ?>
98-
<?php if ($block->getVar("gallery/fullscreen/caption")): ?>
99-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ?>,
100-
<?php endif; ?>
79+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
80+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
10181
<?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
10282
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
10383
<?php endif; ?>

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ Inventory,Inventory
5555
"Only X left Threshold","Only X left Threshold"
5656
"Display Products Availability in Stock on Storefront","Display Products Availability in Stock on Storefront"
5757
"Product Stock Options","Product Stock Options"
58-
"
59-
Please note that these settings apply to individual items in the cart, not to the entire cart.
60-
","
61-
Please note that these settings apply to individual items in the cart, not to the entire cart.
62-
"
58+
"Please note that these settings apply to individual items in the cart, not to the entire cart.","Please note that these settings apply to individual items in the cart, not to the entire cart."
6359
"Manage Stock","Manage Stock"
6460
Backorders,Backorders
6561
"Maximum Qty Allowed in Shopping Cart","Maximum Qty Allowed in Shopping Cart"

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,9 @@ public function place($token, $shippingMethodCode = null)
809809
case \Magento\Sales\Model\Order::STATE_PROCESSING:
810810
case \Magento\Sales\Model\Order::STATE_COMPLETE:
811811
case \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW:
812-
$this->orderSender->send($order);
812+
if (!$order->getEmailSent()) {
813+
$this->orderSender->send($order);
814+
}
813815
$this->_checkoutSession->start();
814816
break;
815817
default:

app/code/Magento/Review/Block/Product/ReviewRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class ReviewRenderer extends \Magento\Framework\View\Element\Template implements
1818
* @var array
1919
*/
2020
protected $_availableTemplates = [
21-
self::FULL_VIEW => 'helper/summary.phtml',
22-
self::SHORT_VIEW => 'helper/summary_short.phtml',
21+
self::FULL_VIEW => 'Magento_Review::helper/summary.phtml',
22+
self::SHORT_VIEW => 'Magento_Review::helper/summary_short.phtml',
2323
];
2424

2525
/**

app/code/Magento/Review/view/frontend/templates/view.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<div class="actions">
5050
<div class="secondary">
5151
<a class="action back" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
52-
<span><?= $block->escapeHtml(__('Back to Product Reviews')) ?></a></span>
52+
<span><?= $block->escapeHtml(__('Back to Product Reviews')) ?></span>
5353
</a>
5454
</div>
5555
</div>

app/code/Magento/Rule/Model/Condition/AbstractCondition.php

Lines changed: 37 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ abstract class AbstractCondition extends \Magento\Framework\DataObject implement
2424
{
2525
/**
2626
* Defines which operators will be available for this condition
27-
*
2827
* @var string
2928
*/
3029
protected $_inputType = null;
@@ -84,17 +83,13 @@ public function __construct(Context $context, array $data = [])
8483

8584
$options = $this->getAttributeOptions();
8685
if ($options) {
87-
foreach (array_keys($options) as $attr) {
88-
$this->setAttribute($attr);
89-
break;
90-
}
86+
reset($options);
87+
$this->setAttribute(key($options));
9188
}
9289
$options = $this->getOperatorOptions();
9390
if ($options) {
94-
foreach (array_keys($options) as $operator) {
95-
$this->setOperator($operator);
96-
break;
97-
}
91+
reset($options);
92+
$this->setOperator(key($options));
9893
}
9994
}
10095

@@ -160,14 +155,13 @@ public function getForm()
160155
*/
161156
public function asArray(array $arrAttributes = [])
162157
{
163-
$out = [
158+
return [
164159
'type' => $this->getType(),
165160
'attribute' => $this->getAttribute(),
166161
'operator' => $this->getOperator(),
167162
'value' => $this->getValue(),
168163
'is_value_processed' => $this->getIsValueParsed(),
169164
];
170-
return $out;
171165
}
172166

173167
/**
@@ -205,7 +199,7 @@ public function getMappedSqlField()
205199
*/
206200
public function asXml()
207201
{
208-
$xml = "<type>" .
202+
return "<type>" .
209203
$this->getType() .
210204
"</type>" .
211205
"<attribute>" .
@@ -217,7 +211,6 @@ public function asXml()
217211
"<value>" .
218212
$this->getValue() .
219213
"</value>";
220-
return $xml;
221214
}
222215

223216
/**
@@ -244,8 +237,7 @@ public function loadXml($xml)
244237
if (is_string($xml)) {
245238
$xml = simplexml_load_string($xml);
246239
}
247-
$arr = (array)$xml;
248-
$this->loadArray($arr);
240+
$this->loadArray((array)$xml);
249241
return $this;
250242
}
251243

@@ -304,10 +296,7 @@ public function loadOperatorOptions()
304296
*/
305297
public function getInputType()
306298
{
307-
if (null === $this->_inputType) {
308-
return 'string';
309-
}
310-
return $this->_inputType;
299+
return null === $this->_inputType ? 'string' : $this->_inputType;
311300
}
312301

313302
/**
@@ -348,12 +337,11 @@ public function loadValueOptions()
348337
*/
349338
public function getValueSelectOptions()
350339
{
351-
$valueOption = $opt = [];
340+
$opt = [];
352341
if ($this->hasValueOption()) {
353-
$valueOption = (array)$this->getValueOption();
354-
}
355-
foreach ($valueOption as $key => $value) {
356-
$opt[] = ['value' => $key, 'label' => $value];
342+
foreach ((array)$this->getValueOption() as $key => $value) {
343+
$opt[] = ['value' => $key, 'label' => $value];
344+
}
357345
}
358346
return $opt;
359347
}
@@ -470,22 +458,20 @@ public function getNewChildName()
470458
*/
471459
public function asHtml()
472460
{
473-
$html = $this->getTypeElementHtml() .
461+
return $this->getTypeElementHtml() .
474462
$this->getAttributeElementHtml() .
475463
$this->getOperatorElementHtml() .
476464
$this->getValueElementHtml() .
477465
$this->getRemoveLinkHtml() .
478466
$this->getChooserContainerHtml();
479-
return $html;
480467
}
481468

482469
/**
483470
* @return string
484471
*/
485472
public function asHtmlRecursive()
486473
{
487-
$html = $this->asHtml();
488-
return $html;
474+
return $this->asHtml();
489475
}
490476

491477
/**
@@ -520,9 +506,10 @@ public function getTypeElementHtml()
520506
public function getAttributeElement()
521507
{
522508
if (null === $this->getAttribute()) {
523-
foreach (array_keys($this->getAttributeOption()) as $option) {
524-
$this->setAttribute($option);
525-
break;
509+
$options = $this->getAttributeOption();
510+
if ($options) {
511+
reset($options);
512+
$this->setAttribute(key($options));
526513
}
527514
}
528515
return $this->getForm()->addField(
@@ -558,10 +545,8 @@ public function getOperatorElement()
558545
{
559546
$options = $this->getOperatorSelectOptions();
560547
if ($this->getOperator() === null) {
561-
foreach ($options as $option) {
562-
$this->setOperator($option['value']);
563-
break;
564-
}
548+
$option = reset($options);
549+
$this->setOperator($option['value']);
565550
}
566551

567552
$elementId = sprintf('%s__%s__operator', $this->getPrefix(), $this->getId());
@@ -654,8 +639,7 @@ public function getValueElementHtml()
654639
public function getAddLinkHtml()
655640
{
656641
$src = $this->_assetRepo->getUrl('images/rule_component_add.gif');
657-
$html = '<img src="' . $src . '" class="rule-param-add v-middle" alt="" title="' . __('Add') . '"/>';
658-
return $html;
642+
return '<img src="' . $src . '" class="rule-param-add v-middle" alt="" title="' . __('Add') . '"/>';
659643
}
660644

661645
/**
@@ -676,11 +660,7 @@ public function getRemoveLinkHtml()
676660
public function getChooserContainerHtml()
677661
{
678662
$url = $this->getValueElementChooserUrl();
679-
$html = '';
680-
if ($url) {
681-
$html = '<div class="rule-chooser" url="' . $url . '"></div>';
682-
}
683-
return $html;
663+
return $url ? '<div class="rule-chooser" url="' . $url . '"></div>' : '';
684664
}
685665

686666
/**
@@ -690,8 +670,7 @@ public function getChooserContainerHtml()
690670
*/
691671
public function asString($format = '')
692672
{
693-
$str = $this->getAttributeName() . ' ' . $this->getOperatorName() . ' ' . $this->getValueName();
694-
return $str;
673+
return $this->getAttributeName() . ' ' . $this->getOperatorName() . ' ' . $this->getValueName();
695674
}
696675

697676
/**
@@ -700,8 +679,7 @@ public function asString($format = '')
700679
*/
701680
public function asStringRecursive($level = 0)
702681
{
703-
$str = str_pad('', $level * 3, ' ', STR_PAD_LEFT) . $this->asString();
704-
return $str;
682+
return str_pad('', $level * 3, ' ', STR_PAD_LEFT) . $this->asString();
705683
}
706684

707685
/**
@@ -740,12 +718,10 @@ public function validateAttribute($validatedValue)
740718
case '==':
741719
case '!=':
742720
if (is_array($value)) {
743-
if (is_array($validatedValue)) {
744-
$result = array_intersect($value, $validatedValue);
745-
$result = !empty($result);
746-
} else {
721+
if (!is_array($validatedValue)) {
747722
return false;
748723
}
724+
$result = !empty(array_intersect($value, $validatedValue));
749725
} else {
750726
if (is_array($validatedValue)) {
751727
$result = count($validatedValue) == 1 && array_shift($validatedValue) == $value;
@@ -759,18 +735,16 @@ public function validateAttribute($validatedValue)
759735
case '>':
760736
if (!is_scalar($validatedValue)) {
761737
return false;
762-
} else {
763-
$result = $validatedValue <= $value;
764738
}
739+
$result = $validatedValue <= $value;
765740
break;
766741

767742
case '>=':
768743
case '<':
769744
if (!is_scalar($validatedValue)) {
770745
return false;
771-
} else {
772-
$result = $validatedValue >= $value;
773746
}
747+
$result = $validatedValue >= $value;
774748
break;
775749

776750
case '{}':
@@ -783,12 +757,11 @@ public function validateAttribute($validatedValue)
783757
}
784758
}
785759
} elseif (is_array($value)) {
786-
if (is_array($validatedValue)) {
787-
$result = array_intersect($value, $validatedValue);
788-
$result = !empty($result);
789-
} else {
760+
if (!is_array($validatedValue)) {
790761
return false;
791762
}
763+
$result = array_intersect($value, $validatedValue);
764+
$result = !empty($result);
792765
} else {
793766
if (is_array($validatedValue)) {
794767
$result = in_array($value, $validatedValue);
@@ -833,13 +806,13 @@ protected function _compareValues($validatedValue, $value, $strict = true)
833806
{
834807
if ($strict && is_numeric($validatedValue) && is_numeric($value)) {
835808
return $validatedValue == $value;
836-
} else {
837-
$validatePattern = preg_quote($validatedValue, '~');
838-
if ($strict) {
839-
$validatePattern = '^' . $validatePattern . '$';
840-
}
841-
return (bool)preg_match('~' . $validatePattern . '~iu', $value);
842809
}
810+
811+
$validatePattern = preg_quote($validatedValue, '~');
812+
if ($strict) {
813+
$validatePattern = '^' . $validatePattern . '$';
814+
}
815+
return (bool)preg_match('~' . $validatePattern . '~iu', $value);
843816
}
844817

845818
/**

0 commit comments

Comments
 (0)