Preference class doesn't workHow can i rewrite TierPrice Block in Magento2How to override core helper in magento 2?main.CRITICAL: Plugin class doesn't existReceiving object specific class which was injected in constructor by three-part extensionHow to use Context object to get config valuesHow to access model in bundle block class?Magento 2: Plugin class does not existMagento 2 Create dynamic array From different Model Collection to use in multi select in gridMagento 2.3 Can't view module's front end page output?Magento2 REST API get all customers details
Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?
Does the Linux kernel need a file system to run?
When were female captains banned from Starfleet?
Picking the different solutions to the time independent Schrodinger eqaution
putting logo on same line but after title, latex
Store Credit Card Information in Password Manager?
Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?
Can disgust be a key component of horror?
Temporarily disable WLAN internet access for children, but allow it for adults
Does malloc reserve more space while allocating memory?
Angel of Condemnation - Exile creature with second ability
15% tax on $7.5k earnings. Is that right?
Why would a new[] expression ever invoke a destructor?
How to fade a semiplane defined by line?
Quoting Keynes in a lecture
Why Shazam when there is already Superman?
Why "had" in "[something] we would have made had we used [something]"?
How can "mimic phobia" be cured or prevented?
Invalid date error by date command
Limits and Infinite Integration by Parts
How does a computer interpret real numbers?
What is the highest possible scrabble score for placing a single tile
Pre-mixing cryogenic fuels and using only one fuel tank
What does "Scientists rise up against statistical significance" mean? (Comment in Nature)
Preference class doesn't work
How can i rewrite TierPrice Block in Magento2How to override core helper in magento 2?main.CRITICAL: Plugin class doesn't existReceiving object specific class which was injected in constructor by three-part extensionHow to use Context object to get config valuesHow to access model in bundle block class?Magento 2: Plugin class does not existMagento 2 Create dynamic array From different Model Collection to use in multi select in gridMagento 2.3 Can't view module's front end page output?Magento2 REST API get all customers details
I'm trying to replace a class method "wrapResult" from:
MagentoCatalogPricingRenderFinalPriceBox
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="MagentoCatalogPricingRenderFinalPriceBox"
type="ModRepSalesPricingRenderFinalPriceBox"/></config>
Class FinalPriceBox:
namespace ModRepSalesPricingRender;
use MagentoCatalogModelProductPricingRendererSalableResolverInterface;
use MagentoCatalogPricingPriceMinimalPriceCalculatorInterface;
use MagentoFrameworkPricingPricePriceInterface;
use MagentoFrameworkPricingRenderRendererPool;
use MagentoFrameworkPricingSaleableInterface;
use MagentoFrameworkViewElementTemplateContext;
class FinalPriceBox extends MagentoCatalogPricingRenderFinalPriceBox
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,
ModRepSalesHelperRepSalesPrices $helperRepSalesPrices,
MagentoFrameworkPricingHelperData $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>';
magento2 magento2.2 di preference
add a comment |
I'm trying to replace a class method "wrapResult" from:
MagentoCatalogPricingRenderFinalPriceBox
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="MagentoCatalogPricingRenderFinalPriceBox"
type="ModRepSalesPricingRenderFinalPriceBox"/></config>
Class FinalPriceBox:
namespace ModRepSalesPricingRender;
use MagentoCatalogModelProductPricingRendererSalableResolverInterface;
use MagentoCatalogPricingPriceMinimalPriceCalculatorInterface;
use MagentoFrameworkPricingPricePriceInterface;
use MagentoFrameworkPricingRenderRendererPool;
use MagentoFrameworkPricingSaleableInterface;
use MagentoFrameworkViewElementTemplateContext;
class FinalPriceBox extends MagentoCatalogPricingRenderFinalPriceBox
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,
ModRepSalesHelperRepSalesPrices $helperRepSalesPrices,
MagentoFrameworkPricingHelperData $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>';
magento2 magento2.2 di preference
Have you runsetup:di:compile
command?
– Matthias_CompactCode
yesterday
@Matthias_CompactCode yes... all deploy:(
– chdzma
yesterday
add a comment |
I'm trying to replace a class method "wrapResult" from:
MagentoCatalogPricingRenderFinalPriceBox
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="MagentoCatalogPricingRenderFinalPriceBox"
type="ModRepSalesPricingRenderFinalPriceBox"/></config>
Class FinalPriceBox:
namespace ModRepSalesPricingRender;
use MagentoCatalogModelProductPricingRendererSalableResolverInterface;
use MagentoCatalogPricingPriceMinimalPriceCalculatorInterface;
use MagentoFrameworkPricingPricePriceInterface;
use MagentoFrameworkPricingRenderRendererPool;
use MagentoFrameworkPricingSaleableInterface;
use MagentoFrameworkViewElementTemplateContext;
class FinalPriceBox extends MagentoCatalogPricingRenderFinalPriceBox
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,
ModRepSalesHelperRepSalesPrices $helperRepSalesPrices,
MagentoFrameworkPricingHelperData $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>';
magento2 magento2.2 di preference
I'm trying to replace a class method "wrapResult" from:
MagentoCatalogPricingRenderFinalPriceBox
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="MagentoCatalogPricingRenderFinalPriceBox"
type="ModRepSalesPricingRenderFinalPriceBox"/></config>
Class FinalPriceBox:
namespace ModRepSalesPricingRender;
use MagentoCatalogModelProductPricingRendererSalableResolverInterface;
use MagentoCatalogPricingPriceMinimalPriceCalculatorInterface;
use MagentoFrameworkPricingPricePriceInterface;
use MagentoFrameworkPricingRenderRendererPool;
use MagentoFrameworkPricingSaleableInterface;
use MagentoFrameworkViewElementTemplateContext;
class FinalPriceBox extends MagentoCatalogPricingRenderFinalPriceBox
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,
ModRepSalesHelperRepSalesPrices $helperRepSalesPrices,
MagentoFrameworkPricingHelperData $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>';
magento2 magento2.2 di preference
magento2 magento2.2 di preference
asked yesterday
chdzmachdzma
430112
430112
Have you runsetup:di:compile
command?
– Matthias_CompactCode
yesterday
@Matthias_CompactCode yes... all deploy:(
– chdzma
yesterday
add a comment |
Have you runsetup:di:compile
command?
– Matthias_CompactCode
yesterday
@Matthias_CompactCode yes... all deploy:(
– chdzma
yesterday
Have you run
setup:di:compile
command?– Matthias_CompactCode
yesterday
Have you run
setup:di:compile
command?– Matthias_CompactCode
yesterday
@Matthias_CompactCode yes... all deploy:(
– chdzma
yesterday
@Matthias_CompactCode yes... all deploy:(
– chdzma
yesterday
add a comment |
1 Answer
1
active
oldest
votes
There might be several causes for this. There might be another module with a preference on this class. If this module is loaded after yours, your preference will be overwritten. Try debugging it by switching MagentoCatalogPricingRenderFinalPriceBox
to another class.
I have searched and only found VirtualType with this class. Is it possible to replace a function with VirtualType?
– chdzma
yesterday
You cannot replace a function with VirtualType. Make sure yourdi.xml
is located in the right area directory.
– Matthias_CompactCode
yesterday
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266852%2fpreference-class-doesnt-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There might be several causes for this. There might be another module with a preference on this class. If this module is loaded after yours, your preference will be overwritten. Try debugging it by switching MagentoCatalogPricingRenderFinalPriceBox
to another class.
I have searched and only found VirtualType with this class. Is it possible to replace a function with VirtualType?
– chdzma
yesterday
You cannot replace a function with VirtualType. Make sure yourdi.xml
is located in the right area directory.
– Matthias_CompactCode
yesterday
add a comment |
There might be several causes for this. There might be another module with a preference on this class. If this module is loaded after yours, your preference will be overwritten. Try debugging it by switching MagentoCatalogPricingRenderFinalPriceBox
to another class.
I have searched and only found VirtualType with this class. Is it possible to replace a function with VirtualType?
– chdzma
yesterday
You cannot replace a function with VirtualType. Make sure yourdi.xml
is located in the right area directory.
– Matthias_CompactCode
yesterday
add a comment |
There might be several causes for this. There might be another module with a preference on this class. If this module is loaded after yours, your preference will be overwritten. Try debugging it by switching MagentoCatalogPricingRenderFinalPriceBox
to another class.
There might be several causes for this. There might be another module with a preference on this class. If this module is loaded after yours, your preference will be overwritten. Try debugging it by switching MagentoCatalogPricingRenderFinalPriceBox
to another class.
answered yesterday
Matthias_CompactCodeMatthias_CompactCode
1564
1564
I have searched and only found VirtualType with this class. Is it possible to replace a function with VirtualType?
– chdzma
yesterday
You cannot replace a function with VirtualType. Make sure yourdi.xml
is located in the right area directory.
– Matthias_CompactCode
yesterday
add a comment |
I have searched and only found VirtualType with this class. Is it possible to replace a function with VirtualType?
– chdzma
yesterday
You cannot replace a function with VirtualType. Make sure yourdi.xml
is located in the right area directory.
– Matthias_CompactCode
yesterday
I have searched and only found VirtualType with this class. Is it possible to replace a function with VirtualType?
– chdzma
yesterday
I have searched and only found VirtualType with this class. Is it possible to replace a function with VirtualType?
– chdzma
yesterday
You cannot replace a function with VirtualType. Make sure your
di.xml
is located in the right area directory.– Matthias_CompactCode
yesterday
You cannot replace a function with VirtualType. Make sure your
di.xml
is located in the right area directory.– Matthias_CompactCode
yesterday
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266852%2fpreference-class-doesnt-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you run
setup:di:compile
command?– Matthias_CompactCode
yesterday
@Matthias_CompactCode yes... all deploy:(
– chdzma
yesterday