cancel
Showing results for 
Search instead for 
Did you mean: 

Errors after commenting out 'As low as' from final_price.phtml on line 16

SOLVED

Errors after commenting out 'As low as' from final_price.phtml on line 16

Hello,

I'm on Magento 2.3.4 and I attempted to remove the label 'As low as' from the Configurable Products by commenting out line 16 in /var/www/html/<MagentoRootFolder/vendor/magento/module-configurable-product/view/base/templates/product/price/final_price.phtml

 

?php
2 /**
3 * Copyright © Magento, Inc. All rights reserved.
4 * See COPYING.txt for license details.
5 */
6
7 /** @var \Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox$block */
8 /** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */
9 $priceModel = $block->getPriceType('regular_price');
10 /** @var \Magento\Framework\Pricing\Price\PriceInterface $finalPriceModel */
11 $finalPriceModel = $block->getPriceType('final_price');
12 $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
13 $schema = ($block->getZone() == 'item_view') ? true : false;
14 ?>
15 <span class="normal-price">
16 <?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [
17 'display_label' => __('As low as'),
18 'price_id' => $block->getPriceId('product-price-' . $idSuffix),
19 'price_type' => 'finalPrice',
20 'include_container' => true,
21 'schema' => $schema,
22 ]);
23 ?>
24 </span>

Commenting out the line simply broke my website and now I keep getting the error listed below whenever I click on any product page or product.

1 exception(s):
Exception #0 (Exception): Notice: Undefined variable: finalPriceModel in /var/www/html/MagentoRootFolder/vendor/magento/module-configurable-product/view/base/templates/product/price/final_price.phtml on line 16

Exception #0 (Exception): Notice: Undefined variable: finalPriceModel in /var/www/html/MagentoRootFolder/vendor/magento/module-configurable-product/view/base/templates/product/price/final_price.phtml on line 16
<pre>#1 include('/var/www/html/mg...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#2 Magento\Framework\View\TemplateEngine\Php->render(&Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox\Interceptor#00000000567a824b000000002978268a#, '/var/www/html/mg...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]


Can anyone help me fix this?

I revert the changes I made, reindex, cleared my cache plus compile deploy static content with no success.

I can't fix my website and I keep getting the error message listed above.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Errors after commenting out 'As low as' from final_price.phtml on line 16

I solved this error message after saving the subpage along with the products listed within the subpage.

After reindexing and clearing the cache everything started working again.

View solution in original post

1 REPLY 1

Re: Errors after commenting out 'As low as' from final_price.phtml on line 16

I solved this error message after saving the subpage along with the products listed within the subpage.

After reindexing and clearing the cache everything started working again.

View solution in original post