Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
- <referenceBlock name="render.product.prices">
- <arguments>
- <argument name="default" xsi:type="array">
- <item name="prices" xsi:type="array">
- <item name="final_price" xsi:type="array">
- <!-- item name="render_class" xsi:type="string">MagentoCatalogPricingRenderFinalPriceBox</item> -->
- <item name="render_template" xsi:type="string">MyVendor_MyModule::product/price/final_price.phtml</item>
- </item>
- </item>
- </argument>
- </arguments>
- </referenceBlock>
- </layout>
- <type name="MagentoCatalogPricingRenderFinalPriceBox">
- <plugin name="MyVendor_MyModule_change_template" type="MyVendorMyModulePluginFinalPricePlugin" />
- </type>
- <?php
- namespace MyVendorMyModulePlugin;
- class FinalPricePlugin
- {
- public function beforeSetTemplate(MagentoCatalogPricingRenderFinalPriceBox $subject, $template)
- {
- $objectManager = MagentoFrameworkAppObjectManager::getInstance();
- $enable=$objectManager->create('MyVendorMyModuleHelperData')->chkIsModuleEnable();
- if ($enable) {
- if ($template == 'Magento_Catalog::product/price/final_price.phtml') {
- return ['MyVendor_MyModule::product/price/final_price.phtml'];
- }
- else
- {
- return [$template];
- }
- } else {
- return[$template];
- }
- }
- }
Add Comment
Please, Sign In to add comment