Skip to content

Commit 34b0747

Browse files
author
Alexander Akimov
authored
Merge pull request #1095 from magento-south/BUGS
[South] Bugfixes
2 parents 999675a + 6f7facd commit 34b0747

File tree

22 files changed

+809
-55
lines changed

22 files changed

+809
-55
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,14 @@ public function execute()
213213
$category->save();
214214
$this->messageManager->addSuccess(__('You saved the category.'));
215215
} catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
216-
var_dump($e->getMessage());
217216
$this->messageManager->addError($e->getMessage());
218217
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
219218
$this->_getSession()->setCategoryData($categoryPostData);
220219
} catch (\Magento\Framework\Exception\LocalizedException $e) {
221-
var_dump($e->getMessage());
222220
$this->messageManager->addError($e->getMessage());
223221
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
224222
$this->_getSession()->setCategoryData($categoryPostData);
225223
} catch (\Exception $e) {
226-
var_dump($e->getMessage());
227224
$this->messageManager->addError(__('Something went wrong while saving the category.'));
228225
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
229226
$this->_getSession()->setCategoryData($categoryPostData);

app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
use Magento\ConfigurableProduct\Model\ConfigurableAttributeData;
1111
use Magento\Customer\Helper\Session\CurrentCustomer;
12+
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\Locale\Format;
1214
use Magento\Framework\Pricing\PriceCurrencyInterface;
1315

1416
/**
@@ -59,6 +61,11 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView
5961
*/
6062
protected $configurableAttributeData;
6163

64+
/**
65+
* @var Format
66+
*/
67+
private $localeFormat;
68+
6269
/**
6370
* @param \Magento\Catalog\Block\Product\Context $context
6471
* @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils
@@ -69,6 +76,8 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView
6976
* @param PriceCurrencyInterface $priceCurrency
7077
* @param ConfigurableAttributeData $configurableAttributeData
7178
* @param array $data
79+
* @param Format|null $localeFormat
80+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
7281
*/
7382
public function __construct(
7483
\Magento\Catalog\Block\Product\Context $context,
@@ -79,14 +88,17 @@ public function __construct(
7988
CurrentCustomer $currentCustomer,
8089
PriceCurrencyInterface $priceCurrency,
8190
ConfigurableAttributeData $configurableAttributeData,
82-
array $data = []
91+
array $data = [],
92+
Format $localeFormat = null
8393
) {
8494
$this->priceCurrency = $priceCurrency;
8595
$this->helper = $helper;
8696
$this->jsonEncoder = $jsonEncoder;
8797
$this->catalogProduct = $catalogProduct;
8898
$this->currentCustomer = $currentCustomer;
8999
$this->configurableAttributeData = $configurableAttributeData;
100+
$this->localeFormat = $localeFormat ?: ObjectManager::getInstance()->get(Format::class);
101+
90102
parent::__construct(
91103
$context,
92104
$arrayUtils,
@@ -197,17 +209,16 @@ public function getJsonConfig()
197209
'template' => str_replace('%s', '<%- data.price %>', $store->getCurrentCurrency()->getOutputFormat()),
198210
'currencyFormat' => $store->getCurrentCurrency()->getOutputFormat(),
199211
'optionPrices' => $this->getOptionPrices(),
212+
'priceFormat' => $this->localeFormat->getPriceFormat(),
200213
'prices' => [
201214
'oldPrice' => [
202-
'amount' => $this->_registerJsPrice($regularPrice->getAmount()->getValue()),
215+
'amount' => $this->localeFormat->getNumber($regularPrice->getAmount()->getValue()),
203216
],
204217
'basePrice' => [
205-
'amount' => $this->_registerJsPrice(
206-
$finalPrice->getAmount()->getBaseAmount()
207-
),
218+
'amount' => $this->localeFormat->getNumber($finalPrice->getAmount()->getBaseAmount()),
208219
],
209220
'finalPrice' => [
210-
'amount' => $this->_registerJsPrice($finalPrice->getAmount()->getValue()),
221+
'amount' => $this->localeFormat->getNumber($finalPrice->getAmount()->getValue()),
211222
],
212223
],
213224
'productId' => $currentProduct->getId(),
@@ -238,26 +249,28 @@ protected function getOptionPrices()
238249
$tierPricesList = $tierPriceModel->getTierPriceList();
239250
foreach ($tierPricesList as $tierPrice) {
240251
$tierPrices[] = [
241-
'qty' => $this->_registerJsPrice($tierPrice['price_qty']),
242-
'price' => $this->_registerJsPrice($tierPrice['price']->getValue()),
243-
'percentage' => $this->_registerJsPrice($tierPriceModel->getSavePercent($tierPrice['price'])),
252+
'qty' => $this->localeFormat->getNumber($tierPrice['price_qty']),
253+
'price' => $this->localeFormat->getNumber($tierPrice['price']->getValue()),
254+
'percentage' => $this->localeFormat->getNumber(
255+
$tierPriceModel->getSavePercent($tierPrice['price'])
256+
),
244257
];
245258
}
246259

247260
$prices[$product->getId()] =
248261
[
249262
'oldPrice' => [
250-
'amount' => $this->_registerJsPrice(
263+
'amount' => $this->localeFormat->getNumber(
251264
$priceInfo->getPrice('regular_price')->getAmount()->getValue()
252265
),
253266
],
254267
'basePrice' => [
255-
'amount' => $this->_registerJsPrice(
268+
'amount' => $this->localeFormat->getNumber(
256269
$priceInfo->getPrice('final_price')->getAmount()->getBaseAmount()
257270
),
258271
],
259272
'finalPrice' => [
260-
'amount' => $this->_registerJsPrice(
273+
'amount' => $this->localeFormat->getNumber(
261274
$priceInfo->getPrice('final_price')->getAmount()->getValue()
262275
),
263276
],
@@ -270,6 +283,7 @@ protected function getOptionPrices()
270283
/**
271284
* Replace ',' on '.' for js
272285
*
286+
* @deprecated Will be removed in major release
273287
* @param float $price
274288
* @return string
275289
*/

0 commit comments

Comments
 (0)