FinalPricePlugin.php 684 B

1234567891011121314151617181920
  1. <?php
  2. namespace Smartwave\Dailydeals\Plugin;
  3. class FinalPricePlugin
  4. {
  5. public function beforeSetTemplate(\Magento\Catalog\Pricing\Render\FinalPriceBox $subject, $template)
  6. {
  7. $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  8. $enable=$objectManager->create('Smartwave\Dailydeals\Helper\Data')->chkEnableDailydeals();
  9. if ($enable) {
  10. if ($template == 'Magento_Catalog::product/price/final_price.phtml') {
  11. return ['Smartwave_Dailydeals::product/price/final_price.phtml'];
  12. } else {
  13. return [$template];
  14. }
  15. } else {
  16. return[$template];
  17. }
  18. }
  19. }