diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php b/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php index d582005f653ef..181211a0fc4a2 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php @@ -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( @@ -120,6 +122,17 @@ public function getFormatedPrice() return ''; } + /** + * @return string + * + * @deprecated + * @see getFormattedPrice() + */ + public function getFormatedPrice() + { + return $this->getFormattedPrice(); + } + /** * Return formated price * diff --git a/app/code/Magento/Catalog/Block/Product/View/Price.php b/app/code/Magento/Catalog/Block/Product/View/Price.php index c38625247b533..37598dfb1a8da 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Price.php +++ b/app/code/Magento/Catalog/Block/Product/View/Price.php @@ -9,6 +9,8 @@ */ namespace Magento\Catalog\Block\Product\View; +use Magento\Catalog\Model\Product; + class Price extends \Magento\Framework\View\Element\Template { /** @@ -37,7 +39,8 @@ public function __construct( */ public function getPrice() { + /** @var Product $product */ $product = $this->_coreRegistry->registry('product'); - return $product->getFormatedPrice(); + return $product->getFormattedPrice(); } } diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index f514e5c68769e..90af9bee270bd 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -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(); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index 7eaedf77eb859..f6caa299d66d7 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -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'] ); } @@ -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); } /** diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml index 8e5583a6699b7..30c05c2ec689b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml @@ -13,7 +13,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml index edf4f68afded7..4ad7a95c91980 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml @@ -7,6 +7,7 @@ // @codingStandardsIgnoreFile ?> + getOption(); ?> getFileInfo(); ?> hasData() ? true : false; ?> @@ -64,7 +65,7 @@ require(['prototype'], function(){
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml index 14e485c6445e0..11fba22ea8139 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml @@ -12,7 +12,7 @@
getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD): ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml index 3420512977aad..66895fa1eabf9 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml @@ -7,6 +7,7 @@ // @codingStandardsIgnoreFile ?> + getOption() ?> getId() ?> getIsRequire()) ? ' required' : ''; ?> @@ -15,7 +16,7 @@
escapeHtml($_option->getTitle()) ?> - getFormatedPrice() ?> + getFormattedPrice() ?>
getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml index 3ceba2eebd214..adb729c6d86ec 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml @@ -7,6 +7,7 @@ // @codingStandardsIgnoreFile ?> + getOption(); ?> getFileInfo(); ?> hasData(); ?> @@ -19,7 +20,7 @@
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml index 852e0095f2f66..a04e366a43a2d 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml @@ -7,6 +7,7 @@ // @codingStandardsIgnoreFile ?> + getOption(); $class = ($_option->getIsRequire()) ? ' required' : ''; @@ -17,7 +18,7 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; } ?>">