Skip to content

Commit

Permalink
ENGCOM-2230: Add spelling correction: formatedPrice to formattedPrice #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov authored Jul 11, 2018
2 parents 62976e5 + 609a8c3 commit 93cbb05
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ public function getOption()
}

/**
* Retrieve formatted price
*
* @return string
*/
public function getFormatedPrice()
public function getFormattedPrice()
{
if ($option = $this->getOption()) {
return $this->_formatPrice(
Expand All @@ -120,6 +122,17 @@ public function getFormatedPrice()
return '';
}

/**
* @return string
*
* @deprecated
* @see getFormattedPrice()
*/
public function getFormatedPrice()
{
return $this->getFormattedPrice();
}

/**
* Return formated price
*
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Catalog/Block/Product/View/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
namespace Magento\Catalog\Block\Product\View;

use Magento\Catalog\Model\Product;

class Price extends \Magento\Framework\View\Element\Template
{
/**
Expand Down Expand Up @@ -37,7 +39,8 @@ public function __construct(
*/
public function getPrice()
{
/** @var Product $product */
$product = $this->_coreRegistry->registry('product');
return $product->getFormatedPrice();
return $product->getFormattedPrice();
}
}
17 changes: 15 additions & 2 deletions app/code/Magento/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1124,11 +1124,24 @@ public function getTierPrice($qty = null)
/**
* Get formatted by currency product price
*
* @return array || double
* @return array|double
*/
public function getFormattedPrice()
{
return $this->getPriceModel()->getFormattedPrice($this);
}

/**
* Get formatted by currency product price
*
* @return array|double
*
* @deprecated
* @see getFormattedPrice()
*/
public function getFormatedPrice()
{
return $this->getPriceModel()->getFormatedPrice($this);
return $this->getFormattedPrice();
}

/**
Expand Down
37 changes: 34 additions & 3 deletions app/code/Magento/Catalog/Model/Product/Type/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,15 @@ public function getTierPriceCount($product)
*
* @param float $qty
* @param Product $product
*
* @return array|float
*/
public function getFormatedTierPrice($qty, $product)
public function getFormattedTierPrice($qty, $product)
{
$price = $product->getTierPrice($qty);
if (is_array($price)) {
foreach (array_keys($price) as $index) {
$price[$index]['formated_price'] = $this->priceCurrency->convertAndFormat(
$price[$index]['formatted_price'] = $this->priceCurrency->convertAndFormat(
$price[$index]['website_price']
);
}
Expand All @@ -492,15 +493,45 @@ public function getFormatedTierPrice($qty, $product)
return $price;
}

/**
* Get formatted by currency tier price
*
* @param float $qty
* @param Product $product
*
* @return array|float
*
* @deprecated
* @see getFormattedTierPrice()
*/
public function getFormatedTierPrice($qty, $product)
{
return $this->getFormattedTierPrice($qty, $product);
}

/**
* Get formatted by currency product price
*
* @param Product $product
* @return array|float
*/
public function getFormattedPrice($product)
{
return $this->priceCurrency->format($product->getFinalPrice());
}

/**
* Get formatted by currency product price
*
* @param Product $product
* @return array || float
*
* @deprecated
* @see getFormattedPrice()
*/
public function getFormatedPrice($product)
{
return $this->priceCurrency->format($product->getFinalPrice());
return $this->getFormattedPrice($product);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="admin__field field<?php if ($_option->getIsRequire()) echo ' required _required' ?>">
<label class="label admin__field-label">
<?= $block->escapeHtml($_option->getTitle()) ?>
<?= /* @escapeNotVerified */ $block->getFormatedPrice() ?>
<?= /* @escapeNotVerified */ $block->getFormattedPrice() ?>
</label>
<div class="admin__field-control control">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// @codingStandardsIgnoreFile

?>
<?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\File */ ?>
<?php $_option = $block->getOption(); ?>
<?php $_fileInfo = $block->getFileInfo(); ?>
<?php $_fileExists = $_fileInfo->hasData() ? true : false; ?>
Expand Down Expand Up @@ -64,7 +65,7 @@ require(['prototype'], function(){
<div class="admin__field <?php if ($_option->getIsRequire()) echo ' required _required' ?>">
<label class="admin__field-label label">
<?= $block->escapeHtml($_option->getTitle()) ?>
<?= /* @escapeNotVerified */ $block->getFormatedPrice() ?>
<?= /* @escapeNotVerified */ $block->getFormattedPrice() ?>
</label>
<div class="admin__field-control control">
<?php if ($_fileExists): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="field admin__field<?php if ($_option->getIsRequire()) echo ' required _required' ?>">
<label class="admin__field-label label">
<?= $block->escapeHtml($_option->getTitle()) ?>
<?= /* @escapeNotVerified */ $block->getFormatedPrice() ?>
<?= /* @escapeNotVerified */ $block->getFormattedPrice() ?>
</label>
<div class="control admin__field-control">
<?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// @codingStandardsIgnoreFile

?>
<?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Date */ ?>
<?php $_option = $block->getOption() ?>
<?php $_optionId = $_option->getId() ?>
<?php $class = ($_option->getIsRequire()) ? ' required' : ''; ?>
Expand All @@ -15,7 +16,7 @@
<fieldset class="fieldset fieldset-product-options-inner<?= /* @escapeNotVerified */ $class ?>">
<legend class="legend">
<span><?= $block->escapeHtml($_option->getTitle()) ?></span>
<?= /* @escapeNotVerified */ $block->getFormatedPrice() ?>
<?= /* @escapeNotVerified */ $block->getFormattedPrice() ?>
</legend>
<div class="control">
<?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// @codingStandardsIgnoreFile

?>
<?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\File */ ?>
<?php $_option = $block->getOption(); ?>
<?php $_fileInfo = $block->getFileInfo(); ?>
<?php $_fileExists = $_fileInfo->hasData(); ?>
Expand All @@ -19,7 +20,7 @@
<div class="field file<?= /* @escapeNotVerified */ $class ?>">
<label class="label" for="<?= /* @noEscape */ $_fileName ?>" id="<?= /* @noEscape */ $_fileName ?>-label">
<span><?= $block->escapeHtml($_option->getTitle()) ?></span>
<?= /* @escapeNotVerified */ $block->getFormatedPrice() ?>
<?= /* @escapeNotVerified */ $block->getFormattedPrice() ?>
</label>
<?php if ($_fileExists): ?>
<div class="control">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// @codingStandardsIgnoreFile

?>
<?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Text */ ?>
<?php
$_option = $block->getOption();
$class = ($_option->getIsRequire()) ? ' required' : '';
Expand All @@ -17,7 +18,7 @@ $class = ($_option->getIsRequire()) ? ' required' : '';
} ?><?= /* @escapeNotVerified */ $class ?>">
<label class="label" for="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text">
<span><?= $block->escapeHtml($_option->getTitle()) ?></span>
<?= /* @escapeNotVerified */ $block->getFormatedPrice() ?>
<?= /* @escapeNotVerified */ $block->getFormattedPrice() ?>
</label>

<div class="control">
Expand Down

0 comments on commit 93cbb05

Please sign in to comment.