Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
<?php $priceModel = $block->getPriceType('regular_price'); $finalPriceModel = $block->getPriceType('final_price'); $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : ''; $schema = ($block->getZone() == 'item_view') ? true : false; $valor = $_product->getResource()->getPrice('special_price')->getFrontend()->getValue($_product); $total = $_product->getFinalPrice(); $percent = $_product->getResource()->getAttribute('desconto')->getFrontend()->getValue($_product); $discount_value = ($total / 100) * $percent; $final_price = $total - $discount_value; ?>```
Can anybody help me? I’m converting a module from Magento 1 to 2. I put this section to show a price in the product view with a 10% discount in case the customer wants to pay in advance. This value of 10 is taken from a custom product attribute so that when I want to offer 15 I enter the product and make the change. But my codex is giving an error on line 5 Undefined variable. I’ve already made some changes but none of them worked and I can’t display them on the frontend.