I'm trying to replace a class method "wrapResult" from:
\Magento\Catalog\Pricing\Render\FinalPriceBox
Never enter into this method. Try to stop the execution with die () or with xdebug, enter directly to the parent method.
What I can be doing wrong?
DI XML:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Catalog\Pricing\Render\FinalPriceBox"
type="Mod\RepSales\Pricing\Render\FinalPriceBox"/></config>
Class FinalPriceBox:
namespace Mod\RepSales\Pricing\Render;
use Magento\Catalog\Model\Product\Pricing\Renderer\SalableResolverInterface;
use Magento\Catalog\Pricing\Price\MinimalPriceCalculatorInterface;
use Magento\Framework\Pricing\Price\PriceInterface;
use Magento\Framework\Pricing\Render\RendererPool;
use Magento\Framework\Pricing\SaleableInterface;
use Magento\Framework\View\Element\Template\Context;
class FinalPriceBox extends \Magento\Catalog\Pricing\Render\FinalPriceBox
{
const ATTR_PVP = 'sgi_pvp';
protected $helperPrice;
protected $helperRepSalesPrices;
public function __construct(
Context $context,
SaleableInterface $saleableItem,
PriceInterface $price,
RendererPool $rendererPool,
array $data = [],
SalableResolverInterface $salableResolver = null,
MinimalPriceCalculatorInterface $minimalPriceCalculator = null,
\Mod\RepSales\Helper\RepSalesPrices $helperRepSalesPrices,
\Magento\Framework\Pricing\Helper\Data $helperPrice
)
{
$this->helperRepSalesPrices = $helperRepSalesPrices;
$this->helperPrice = $helperPrice;
parent::__construct($context, $saleableItem, $price, $rendererPool, $data, $salableResolver, $minimalPriceCalculator);
}
protected function wrapResult($html)
{
if ($this->helperRepSalesPrices->changePrices()) {
$price = $this->getSaleableItem()->getData(self::ATTR_PVP);
$price = floatval(str_replace(',', '.', $price));
$priceFormat = $this->helperPrice->currency(number_format($price, 2), true, false);
$html = '<span class="price-container price-final_price tax weee">' .
'<span id="product-price-' . $this->getSaleableItem()->getId() . '" data-price-amount="' . $price . '" data-price-type="finalPrice" class="price-wrapper ">' .
'<span class="price">' . $priceFormat . '</span>' .
'</span>' .
'</span>';
}
return '<div class="price-box ' . $this->getData('css_classes') . '" ' .
'data-role="priceBox" ' .
'data-product-id="' . $this->getSaleableItem()->getId() . '"' .
'>' . $html . '</div>';
}
}
setup:di:compile
command?