Skip to content

Commit 3fe9eeb

Browse files
committed
Merge pull request #277 from magento-south/BUGS
[SOUTH] Bugfixes
2 parents d50ee54 + c0bbd84 commit 3fe9eeb

File tree

22 files changed

+424
-62
lines changed

22 files changed

+424
-62
lines changed

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
type="checkbox"
3232
<?php if ($_option->getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^=&quot;bundle_option[' . $_option->getId() . ']&quot;]:checked\'}"'?>
3333
name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][<?php /* @escapeNotVerified */ echo $_selection->getId() ?>]"
34+
data-selector="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][<?php /* @escapeNotVerified */ echo $_selection->getId() ?>]"
3435
<?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?>
3536
<?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>
3637
value="<?php /* @escapeNotVerified */ echo $_selection->getSelectionId() ?>"/>

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/multi.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
size="5"
2626
id="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?>"
2727
name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][]"
28+
data-selector="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][]"
2829
class="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?> multiselect product bundle option change-container-classname"
2930
<?php if ($_option->getRequired()) echo 'data-validate={required:true}' ?>>
3031
<?php if(!$_option->getRequired()): ?>

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/radio.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
class="radio product bundle option"
3333
id="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?>"
3434
name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
35+
data-selector="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
3536
<?php echo ($_default && $_default->isSalable())?'':' checked="checked" ' ?>
3637
value=""/>
3738
<label class="label" for="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?>">
@@ -46,6 +47,7 @@
4647
id="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?>-<?php /* @escapeNotVerified */ echo $_selection->getSelectionId() ?>"
4748
<?php if ($_option->getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':true}"'?>
4849
name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
50+
data-selector="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
4951
<?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?>
5052
<?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>
5153
value="<?php /* @escapeNotVerified */ echo $_selection->getSelectionId() ?>"/>
@@ -67,6 +69,7 @@
6769
class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>"
6870
type="number"
6971
name="bundle_option_qty[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
72+
data-selector="bundle_option_qty[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
7073
value="<?php /* @escapeNotVerified */ echo $_defaultQty ?>"/>
7174
</div>
7275
</div>

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/select.phtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<?php else:?>
2828
<select id="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?>"
2929
name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
30+
data-selector="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
3031
class="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?> product bundle option bundle-option-select change-container-classname"
3132
<?php if ($_option->getRequired()) echo 'data-validate = {required:true}' ?>>
3233
<option value=""><?php /* @escapeNotVerified */ echo __('Choose a selection...') ?></option>
@@ -50,6 +51,7 @@
5051
class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>"
5152
type="number"
5253
name="bundle_option_qty[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
54+
data-selector="bundle_option_qty[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
5355
value="<?php /* @escapeNotVerified */ echo $_defaultQty ?>"/>
5456
</div>
5557
</div>

app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ protected function _getHtmlSelect($name, $value = null)
199199
$extraParams .= ' onchange="opConfig.reloadPrice()"';
200200
}
201201
$extraParams .= ' data-role="calendar-dropdown" data-calendar-role="' . $name . '"';
202+
$extraParams .= ' data-selector="' . $select->getName() . '"';
202203
$select->setExtraParams($extraParams);
203204

204205
if ($value === null) {

app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public function getValuesHtml()
6969
if (!$this->getSkipJsReloadPrice()) {
7070
$extraParams .= ' onchange="opConfig.reloadPrice()"';
7171
}
72+
$extraParams .= ' data-selector="' . $select->getName() . '"';
7273
$select->setExtraParams($extraParams);
7374

7475
if ($configValue) {
@@ -97,6 +98,7 @@ public function getValuesHtml()
9798
' product-custom-option" name="options[' .
9899
$_option->getId() .
99100
']"' .
101+
' data-selector="options[' . $_option->getId() . ']"' .
100102
($this->getSkipJsReloadPrice() ? '' : ' onclick="opConfig.reloadPrice()"') .
101103
' value="" checked="checked" /><label class="label admin__field-label" for="options_' .
102104
$_option->getId() .
@@ -128,6 +130,11 @@ public function getValuesHtml()
128130
$checked = $configValue == $htmlValue ? 'checked' : '';
129131
}
130132

133+
$dataSelector = 'options[' . $_option->getId() . ']';
134+
if ($arraySign) {
135+
$dataSelector .= '[' . $htmlValue . ']';
136+
}
137+
131138
$selectHtml .= '<div class="field choice admin__field admin__field-option' .
132139
$require .
133140
'">' .
@@ -151,6 +158,7 @@ public function getValuesHtml()
151158
$htmlValue .
152159
'" ' .
153160
$checked .
161+
' data-selector="' . $dataSelector . '"' .
154162
' price="' .
155163
$this->pricingHelper->currencyByStore($_value->getPrice(true), $store, false) .
156164
'" />' .

app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ $class = ($_option->getIsRequire()) ? ' required' : '';
3737
data-validate="<?php echo $block->escapeHtml(json_encode($_textValidate));?>"
3838
<?php } ?>
3939
name="options[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
40+
data-selector="options[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
4041
value="<?php echo $block->escapeHtml($block->getDefaultValue()) ?>"/>
4142
<?php elseif ($_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_AREA): ?>
4243
<?php $_textAreaValidate = null;
@@ -53,6 +54,7 @@ $class = ($_option->getIsRequire()) ? ' required' : '';
5354
data-validate="<?php echo $block->escapeHtml(json_encode($_textAreaValidate));?>"
5455
<?php } ?>
5556
name="options[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
57+
data-selector="options[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
5658
rows="5"
5759
cols="25"><?php echo $block->escapeHtml($block->getDefaultValue()) ?></textarea>
5860
<?php endif; ?>

app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ $_attributes = $block->decorateArray($block->getAllowAttributes());
2121
</label>
2222
<div class="control">
2323
<select name="super_attribute[<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>]"
24+
data-selector="super_attribute[<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>]"
2425
data-validate="{required:true}"
2526
id="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>"
2627
class="super-attribute-select">

app/code/Magento/Customer/Model/Account/Redirect.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
use Magento\Customer\Model\Session;
99
use Magento\Customer\Model\Url as CustomerUrl;
1010
use Magento\Framework\App\RequestInterface;
11+
use Magento\Framework\Controller\ResultFactory;
1112
use Magento\Framework\UrlInterface;
1213
use Magento\Store\Model\ScopeInterface;
1314
use Magento\Store\Model\StoreManagerInterface;
1415
use Magento\Framework\App\Config\ScopeConfigInterface;
1516
use Magento\Framework\Controller\Result\Redirect as ResultRedirect;
16-
use Magento\Framework\Controller\Result\RedirectFactory;
17+
use Magento\Framework\Controller\Result\Forward as ResultForward;
1718
use Magento\Framework\Url\DecoderInterface;
1819

1920
/**
@@ -52,9 +53,9 @@ class Redirect
5253
protected $url;
5354

5455
/**
55-
* @var RedirectFactory
56+
* @var ResultFactory
5657
*/
57-
protected $resultRedirectFactory;
58+
protected $resultFactory;
5859

5960
/**
6061
* @param RequestInterface $request
@@ -64,7 +65,7 @@ class Redirect
6465
* @param UrlInterface $url
6566
* @param DecoderInterface $urlDecoder
6667
* @param CustomerUrl $customerUrl
67-
* @param RedirectFactory $resultRedirectFactory
68+
* @param ResultFactory $resultFactory
6869
*/
6970
public function __construct(
7071
RequestInterface $request,
@@ -74,7 +75,7 @@ public function __construct(
7475
UrlInterface $url,
7576
DecoderInterface $urlDecoder,
7677
CustomerUrl $customerUrl,
77-
RedirectFactory $resultRedirectFactory
78+
ResultFactory $resultFactory
7879
) {
7980
$this->request = $request;
8081
$this->session = $customerSession;
@@ -83,23 +84,31 @@ public function __construct(
8384
$this->url = $url;
8485
$this->urlDecoder = $urlDecoder;
8586
$this->customerUrl = $customerUrl;
86-
$this->resultRedirectFactory = $resultRedirectFactory;
87+
$this->resultFactory = $resultFactory;
8788
}
8889

8990
/**
9091
* Retrieve redirect
9192
*
92-
* @return ResultRedirect
93+
* @return ResultRedirect|ResultForward
9394
*/
9495
public function getRedirect()
9596
{
9697
$this->updateLastCustomerId();
9798
$this->prepareRedirectUrl();
9899

99-
/** @var ResultRedirect $resultRedirect */
100-
$resultRedirect = $this->resultRedirectFactory->create();
101-
$resultRedirect->setUrl($this->session->getBeforeAuthUrl(true));
102-
return $resultRedirect;
100+
/** @var ResultRedirect|ResultForward $result */
101+
if ($this->session->getBeforeRequestParams()) {
102+
$result = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
103+
$result->setParams($this->session->getBeforeRequestParams())
104+
->setModule($this->session->getBeforeModuleName())
105+
->setController($this->session->getBeforeControllerName())
106+
->forward($this->session->getBeforeAction());
107+
} else {
108+
$result = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
109+
$result->setUrl($this->session->getBeforeAuthUrl(true));
110+
}
111+
return $result;
103112
}
104113

105114
/**
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Customer\Model\Address\Validator;
7+
8+
class Postcode
9+
{
10+
/**
11+
* @var \Magento\Directory\Helper\Data
12+
*/
13+
protected $directoryHelper;
14+
15+
/**
16+
* @param \Magento\Directory\Helper\Data $directoryHelper
17+
*/
18+
public function __construct(\Magento\Directory\Helper\Data $directoryHelper)
19+
{
20+
$this->directoryHelper = $directoryHelper;
21+
}
22+
23+
/**
24+
* Check if postcode is valid
25+
*
26+
* @param string $countryId
27+
* @param string $postcode
28+
* @return bool
29+
*/
30+
public function isValid($countryId, $postcode)
31+
{
32+
return $this->directoryHelper->isZipCodeOptional($countryId) || !empty($postcode);
33+
}
34+
}

0 commit comments

Comments
 (0)